From 8b1c4effa0b958ec48915c88a9285c687d946ea0 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Wed, 18 Jan 2023 01:08:13 -0300 Subject: [PATCH] nuke all the #if 0's scripted commit: find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';' https://coan2.sourceforge.net/coan_man_1.html --- Console/Console.cpp | 1700 ----------------- Console/Cursors.cpp | 74 - Console/Cursors.h | 6 - Editor/Editor Callbacks.cpp | 39 - Editor/Editor Undo.cpp | 93 - Editor/EditorBuildings.cpp | 37 - Editor/EditorItems.cpp | 6 - Editor/Sector Summary.cpp | 258 --- Editor/editscreen.cpp | 218 --- Laptop/Encyclopedia_Data_new.cpp | 5 - Laptop/Encyclopedia_new.cpp | 97 - Standard Gaming Platform/Mss.h | 4 - Standard Gaming Platform/PngLoader.cpp | 147 -- Standard Gaming Platform/himage.cpp | 81 - Standard Gaming Platform/impTGA.cpp | 23 - Standard Gaming Platform/input.cpp | 19 - Standard Gaming Platform/sgp.cpp | 36 - Standard Gaming Platform/shading.cpp | 23 - Standard Gaming Platform/stringicmp.cpp | 15 - Standard Gaming Platform/video.cpp | 37 - Standard Gaming Platform/vobject.cpp | 8 - Standard Gaming Platform/vobject_blitters.cpp | 82 - Strategic/Auto Resolve.cpp | 11 - Strategic/Game Event Hook.cpp | 11 - Strategic/LuaInitNPCs.cpp | 30 - .../Map Screen Interface Map Inventory.cpp | 212 -- Strategic/Merc Contract.cpp | 36 - Strategic/Quests.cpp | 6 - Tactical/Arms Dealer Init.cpp | 52 - Tactical/GAP.cpp | 29 - Tactical/Handle UI.cpp | 8 - Tactical/Interface Items.cpp | 44 - Tactical/Item Types.cpp | 6 - Tactical/Items.cpp | 91 - Tactical/Keys.cpp | 12 - Tactical/LOS.cpp | 36 - Tactical/Map Information.cpp | 321 ---- Tactical/Militia Control.cpp | 15 - Tactical/Overhead.cpp | 77 - Tactical/PATHAI.cpp | 63 - Tactical/Points.cpp | 274 --- Tactical/Real Time Input.cpp | 52 - Tactical/Rotting Corpses.cpp | 50 - Tactical/Soldier Ani.cpp | 42 - Tactical/Soldier Control.cpp | 365 ---- Tactical/Soldier Tile.cpp | 12 - Tactical/Turn Based Input.cpp | 23 - Tactical/Vehicles.cpp | 14 - Tactical/World Items.cpp | 13 - Tactical/XML_LBEPocket.cpp | 10 - Tactical/bullets.cpp | 9 - Tactical/opplist.cpp | 10 - TacticalAI/AIMain.cpp | 19 - TacticalAI/FindLocations.cpp | 78 - TileEngine/Exit Grids.cpp | 131 -- TileEngine/Explosion Control.cpp | 8 - TileEngine/Isometric Utils.cpp | 39 - TileEngine/Render Fun.cpp | 4 - TileEngine/lighting.cpp | 72 - TileEngine/overhead map.cpp | 7 - TileEngine/physics.cpp | 37 - TileEngine/renderworld.cpp | 57 - TileEngine/structure.cpp | 20 - TileEngine/tiledef.cpp | 18 - TileEngine/worlddef.cpp | 9 - TileEngine/worldman.cpp | 4 - Utils/Cursors.cpp | 69 - Utils/Sound Control.cpp | 34 - Utils/Text Input.cpp | 2 - Utils/Text Utils.cpp | 911 --------- Utils/Utilities.cpp | 97 - Utils/XML_Items.cpp | 99 - 72 files changed, 6657 deletions(-) diff --git a/Console/Console.cpp b/Console/Console.cpp index c4d1241c1..e7453938e 100644 --- a/Console/Console.cpp +++ b/Console/Console.cpp @@ -189,18 +189,6 @@ Console::Console(LPCTSTR pszConfigFile, LPCTSTR pszShellCmdLine, LPCTSTR pszCons , m_nTextBgColor(0) { -#if 0 - m_strConfigFile = GetFullFilename(pszConfigFile); - - if (!_tcsicmp(pszReloadNewConfig, _T("yes"))) { - m_dwReloadNewConfigDefault = RELOAD_NEW_CONFIG_YES; - } else if (!_tcsicmp(pszReloadNewConfig, _T("no"))) { - m_dwReloadNewConfigDefault = RELOAD_NEW_CONFIG_NO; - } else { - m_dwReloadNewConfigDefault = RELOAD_NEW_CONFIG_PROMPT; - } - m_dwReloadNewConfig = m_dwReloadNewConfigDefault; -#endif m_mouseCursorOffset.x = 0; m_mouseCursorOffset.y = 0; @@ -210,26 +198,6 @@ Console::Console(LPCTSTR pszConfigFile, LPCTSTR pszShellCmdLine, LPCTSTR pszCons ::ZeroMemory(&m_rectSelection, sizeof(RECT)); -#if 0 - // get Console.exe directory - TCHAR szPathName[MAX_PATH]; - ::ZeroMemory(szPathName, sizeof(szPathName)); - ::GetModuleFileName(ghInstance, szPathName, MAX_PATH); - - tstring strExeDir(szPathName); - - strExeDir = strExeDir.substr(0, strExeDir.rfind(_T("\\"))); - strExeDir += TCHAR('\\'); - - // if no config file is given, get console.xml from the startup directory - if (m_strConfigFile.length() == 0) { - - m_strConfigFile = strExeDir + tstring(_T("console.xml")); - } - - // get readme filename - m_strReadmeFile = strExeDir + tstring(_T("Readme.txt")); -#endif ::ZeroMemory(&m_csbiCursor, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); ::ZeroMemory(&m_csbiConsole, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); @@ -591,16 +559,6 @@ void Console::OnActivateApp(BOOL bActivate, DWORD dwFlags) { DrawCursor(); } -#if 0 - if ((m_dwTransparency == TRANSPARENCY_ALPHA) && (m_byInactiveAlpha > 0)) { - if (bActivate) { - g_pfnSetLayeredWndAttr(m_hWnd, m_crBackground, m_byAlpha, LWA_ALPHA); - } else { - g_pfnSetLayeredWndAttr(m_hWnd, m_crBackground, m_byInactiveAlpha, LWA_ALPHA); - } - - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -683,53 +641,6 @@ void Console::OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam) { ///////////////////////////////////////////////////////////////////////////// void Console::OnLButtonDown(UINT uiFlags, POINTS points) { -#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; - rect.top = 0; - rect.right = m_nClientWidth; - 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; - } else if (m_bMouseDragable) { - // start to drag window - ::SetCapture(m_hWnd); - } - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -825,88 +736,6 @@ void Console::OnMButtonDown(UINT uiFlags, POINTS points) { void Console::OnMouseMove(UINT uiFlags, POINTS points) { -#if 0 - RECT windowRect; - int deltaX, deltaY; - POINT point; - - 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_bMouseDragable) || (m_bInverseShift == !(uiFlags & MK_SHIFT))) { - - // some text has been selected, just return - if (m_nTextSelection == TEXT_SELECTION_SELECTED) return; - - // selecting text for copy/paste - 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; - } else { - 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; - } else { - m_rectSelection.top = coordSel.Y * m_nCharHeight + m_nInsideBorder; - m_rectSelection.bottom = (m_coordSelOrigin.Y + 1) * m_nCharHeight + m_nInsideBorder; - } - -// TRACE(_T("Selection rect: %i,%i x %i,%i\n"), m_rectSelection.left, m_rectSelection.top, m_rectSelection.right, m_rectSelection.bottom); - - ::InvalidateRect(m_hWnd, &m_rectSelection, FALSE); - } - - } else if (m_bMouseDragable) { - - // moving the window - HWND hwndZ; - switch (m_dwCurrentZOrder) { - case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; - case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; - case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; - } - - ::SetWindowPos( - m_hWnd, - hwndZ, - windowRect.left + deltaX, - windowRect.top + deltaY, - 0, - 0, - SWP_NOSIZE); - - ::PostMessage(m_hWnd, WM_PAINT, 0, 0); - } - } - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -1101,17 +930,6 @@ void Console::OnTrayNotify(WPARAM wParam, LPARAM lParam) { ///////////////////////////////////////////////////////////////////////////// -#if 0 -void Console::OnWallpaperChanged(const TCHAR* pszFilename) { - - if (m_dwTransparency == TRANSPARENCY_FAKE) { - SetWindowTransparency(); - CreateBackgroundBitmap(); - RepaintWindow(); - } - -} -#endif ///////////////////////////////////////////////////////////////////////////// @@ -1120,746 +938,6 @@ 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; - IXMLElement* pRootElement = NULL; - IXMLElementCollection* pColl = NULL; - IXMLElement* pFontElement = NULL; - IXMLElement* pPositionElement = NULL; - IXMLElement* pAppearanceElement = NULL; - IXMLElement* pScrollbarElement = NULL; - 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(), - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - 0, - NULL, - &pFileStream))) { - - throw XmlException(FALSE); - } - - // create XML document instance - if (!SUCCEEDED(::CoCreateInstance( - 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()); - if (varAttValue.vt == VT_BSTR) { - 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); - - // get font settings - IXMLElementCollection* pFontColl = NULL; - if (!SUCCEEDED(pColl->item(CComVariant(_T("font")), CComVariant(0), (IDispatch**)&pFontElement))) throw XmlException(FALSE); - if (pFontElement) { - if (!SUCCEEDED(pFontElement->get_children(&pFontColl))) throw XmlException(FALSE); - - 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()); - if (strText.Length() > 0) m_dwFontSize = _ttoi(OLE2T(strText)); - } - SAFERELEASE(pFontSubelement); - - if (!SUCCEEDED(pFontColl->item(CComVariant(_T("italic")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); - if (pFontSubelement) { - pFontSubelement->get_text(strText.Out()); - 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)); - varAttValue.Clear(); - pFontSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); - 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); - } - SAFERELEASE(pFontSubelement); - - // get font color mapping - if (!SUCCEEDED(pFontColl->item(CComVariant(_T("colors")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); - if (pFontSubelement) { - - IXMLElementCollection* pColorsColl = NULL; - - if (!SUCCEEDED(pFontSubelement->get_children(&pColorsColl))) throw XmlException(FALSE); - - if (pColorsColl) { - - for (int i = 0; i < 16; ++i) { - IXMLElement* pColorSubelement = NULL; - 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)); - varAttValue.Clear(); - pColorSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); - 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); - } - - SAFERELEASE(pColorSubelement); - } - } - 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) { - pPositionSubelement->get_text(strText.Out()); - 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()); - if (strText.Length() > 0) m_nY = _ttoi(OLE2T(strText)); - } - 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"))) { - m_dwDocked = DOCK_TOP_RIGHT; - } else if (!_tcsicmp(strTempText.c_str(), _T("bottom right"))) { - m_dwDocked = DOCK_BOTTOM_RIGHT; - } else if (!_tcsicmp(strTempText.c_str(), _T("bottom left"))) { - m_dwDocked = DOCK_BOTTOM_LEFT; - } else { - m_dwDocked = DOCK_NONE; - } - } - 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; - } else if (!_tcsicmp(strTempText.c_str(), _T("on top"))) { - m_dwCurrentZOrder = Z_ORDER_ONTOP; - m_dwOriginalZOrder = Z_ORDER_ONTOP; - } else if (!_tcsicmp(strTempText.c_str(), _T("on bottom"))) { - m_dwCurrentZOrder = Z_ORDER_ONBOTTOM; - m_dwOriginalZOrder = Z_ORDER_ONBOTTOM; - } else { - m_dwCurrentZOrder = Z_ORDER_REGULAR; - m_dwOriginalZOrder = Z_ORDER_REGULAR; - } - } - SAFERELEASE(pPositionSubelement); - } - - SAFERELEASE(pPositionColl); - } - - // get appearance settings - IXMLElementCollection* pAppearanceColl = NULL; - 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; - - if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("hide_console")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); - if (pAppearanaceSubelement) { - pAppearanaceSubelement->get_text(strText.Out()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bHideConsole = TRUE; - } else { - m_bHideConsole = FALSE; - } - } - SAFERELEASE(pAppearanaceSubelement); - - if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("hide_console_timeout")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); - if (pAppearanaceSubelement) { - pAppearanaceSubelement->get_text(strText.Out()); - if (strText.Length() > 0) m_dwHideConsoleTimeout = _ttoi(OLE2T(strText)); - } - SAFERELEASE(pAppearanaceSubelement); - - if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("start_minimized")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); - if (pAppearanaceSubelement) { - pAppearanaceSubelement->get_text(strText.Out()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bStartMinimized = TRUE; - } else { - m_bStartMinimized = FALSE; - } - } - SAFERELEASE(pAppearanaceSubelement); - - IXMLElementCollection* pScrollbarColl = NULL; - 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"))) { - m_nScrollbarStyle = FSB_FLAT_MODE; - } else if (!_tcsicmp(strTempText.c_str(), _T("encarta"))) { - m_nScrollbarStyle = FSB_ENCARTA_MODE; - } - } - SAFERELEASE(pScrollbarSubelement); - - - if (!SUCCEEDED(pScrollbarColl->item(CComVariant(_T("width")), CComVariant(0), (IDispatch**)&pScrollbarSubelement))) throw XmlException(FALSE); - if (pScrollbarSubelement) { - pScrollbarSubelement->get_text(strText.Out()); - 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()); - if (strText.Length() > 0) m_nScrollbarButtonHeight = _ttoi(OLE2T(strText)); - } - SAFERELEASE(pScrollbarSubelement); - - if (!SUCCEEDED(pScrollbarColl->item(CComVariant(_T("thumb_height")), CComVariant(0), (IDispatch**)&pScrollbarSubelement))) throw XmlException(FALSE); - if (pScrollbarSubelement) { - pScrollbarSubelement->get_text(strText.Out()); - if (strText.Length() > 0) m_nScrollbarThunmbHeight = _ttoi(OLE2T(strText)); - } - SAFERELEASE(pScrollbarSubelement); - } - SAFERELEASE(pScrollbarColl); - } - - if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("border")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); - if (pAppearanaceSubelement) { - pAppearanaceSubelement->get_text(strText.Out()); - if (!_tcsicmp(OLE2T(strText), _T("true")) || !_tcsicmp(OLE2T(strText), _T("regular"))) { - m_dwWindowBorder = BORDER_REGULAR; - } else if (!_tcsicmp(OLE2T(strText), _T("thin"))) { - m_dwWindowBorder = BORDER_THIN; - } else { - m_dwWindowBorder = BORDER_NONE; - } - } - SAFERELEASE(pAppearanaceSubelement); - - if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("inside_border")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); - if (pAppearanaceSubelement) { - pAppearanaceSubelement->get_text(strText.Out()); - 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"))) { - m_dwTaskbarButton = TASKBAR_BUTTON_TRAY; - } else { - m_dwTaskbarButton = TASKBAR_BUTTON_NORMAL; - } - } - SAFERELEASE(pAppearanaceSubelement); - - 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) { - m_dwRows = 0; - } else { - m_dwRows = _ttoi(OLE2T(varAttValue.bstrVal)); - } - } - - pAppearanaceSubelement->getAttribute(CComBSTR(_T("columns")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) { - if (_tcsicmp(OLE2T(varAttValue.bstrVal), _T("max")) == 0) { - m_dwColumns = 0; - } else { - m_dwColumns = _ttoi(OLE2T(varAttValue.bstrVal)); - } - } - - pAppearanaceSubelement->getAttribute(CComBSTR(_T("buffer_rows")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) { - m_dwBufferRows = _ttoi(OLE2T(varAttValue.bstrVal)); - m_bUseTextBuffer = TRUE; - } else { - m_dwBufferRows = m_dwRows; - } - } - 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()); - if (varAttValue.vt == VT_BSTR) m_byAlpha = (BYTE)_ttoi(OLE2T(varAttValue.bstrVal)); - pAppearanaceSubelement->getAttribute(CComBSTR(_T("inactive_alpha")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) m_byInactiveAlpha = (BYTE)_ttoi(OLE2T(varAttValue.bstrVal)); - - 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"))) { - m_dwTransparency = TRANSPARENCY_ALPHA; - } else if (!_tcsicmp(strTempText.c_str(), _T("color key"))) { - m_dwTransparency = TRANSPARENCY_COLORKEY; - } 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); - - if (!SUCCEEDED(pBackgroundColl->item(CComVariant(_T("console_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_crConsoleBackground = RGB(r, g, b); - } - SAFERELEASE(pBackgroundSubelement); - - if (!SUCCEEDED(pBackgroundColl->item(CComVariant(_T("tint")), 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) m_byTintR = _ttoi(OLE2T(varAttValue.bstrVal)); - pBackgroundSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) m_byTintG = _ttoi(OLE2T(varAttValue.bstrVal)); - pBackgroundSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); - 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; - } - SAFERELEASE(pBackgroundSubelement); - - if (!SUCCEEDED(pBackgroundColl->item(CComVariant(_T("image")), CComVariant(0), (IDispatch**)&pBackgroundSubelement))) throw XmlException(FALSE); - if (pBackgroundSubelement) { - - pBackgroundSubelement->getAttribute(CComBSTR(_T("style")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) { - if (!_tcsicmp(OLE2T(varAttValue.bstrVal), _T("resize"))) { - m_dwBackgroundStyle = BACKGROUND_STYLE_RESIZE; - } else if (!_tcsicmp(OLE2T(varAttValue.bstrVal), _T("center"))) { - m_dwBackgroundStyle = BACKGROUND_STYLE_CENTER; - } else if (!_tcsicmp(OLE2T(varAttValue.bstrVal), _T("tile"))) { - m_dwBackgroundStyle = BACKGROUND_STYLE_TILE; - } - } - - pBackgroundSubelement->getAttribute(CComBSTR(_T("relative")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) { - if (!_tcsicmp(OLE2T(varAttValue.bstrVal), _T("true"))) { - m_bRelativeBackground = TRUE; - } else { - m_bRelativeBackground = FALSE; - } - } - - pBackgroundSubelement->getAttribute(CComBSTR(_T("extend")), varAttValue.Out()); - if (varAttValue.vt == VT_BSTR) { - if (!_tcsicmp(OLE2T(varAttValue.bstrVal), _T("true"))) { - m_bExtendBackground = TRUE; - } else { - m_bExtendBackground = FALSE; - } - } - - pBackgroundSubelement->get_text(strText.Out()); - m_strBackgroundFile = OLE2T(strText); - m_bBitmapBackground = TRUE; - } - SAFERELEASE(pBackgroundSubelement); - } - 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; - - if (!SUCCEEDED(pCursorColl->item(CComVariant(_T("color")), CComVariant(0), (IDispatch**)&pCursorSubelement))) throw XmlException(FALSE); - if (pCursorSubelement) { - 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"))) { - m_dwCursorStyle = CURSOR_STYLE_XTERM; - } else if (!_tcsicmp(strTempText.c_str(), _T("block"))) { - m_dwCursorStyle = CURSOR_STYLE_BLOCK; - } else if (!_tcsicmp(strTempText.c_str(), _T("noblink block"))) { - m_dwCursorStyle = CURSOR_STYLE_NBBLOCK; - } else if (!_tcsicmp(strTempText.c_str(), _T("pulse block"))) { - m_dwCursorStyle = CURSOR_STYLE_PULSEBLOCK; - } else if (!_tcsicmp(strTempText.c_str(), _T("bar"))) { - m_dwCursorStyle = CURSOR_STYLE_BAR; - } else if (!_tcsicmp(strTempText.c_str(), _T("console"))) { - m_dwCursorStyle = CURSOR_STYLE_CONSOLE; - } else if (!_tcsicmp(strTempText.c_str(), _T("noblink line"))) { - m_dwCursorStyle = CURSOR_STYLE_NBHLINE; - } else if (!_tcsicmp(strTempText.c_str(), _T("horizontal line"))) { - m_dwCursorStyle = CURSOR_STYLE_HLINE; - } else if (!_tcsicmp(strTempText.c_str(), _T("vertical line"))) { - m_dwCursorStyle = CURSOR_STYLE_VLINE; - } else if (!_tcsicmp(strTempText.c_str(), _T("rect"))) { - m_dwCursorStyle = CURSOR_STYLE_RECT; - } else if (!_tcsicmp(strTempText.c_str(), _T("noblink rect"))) { - m_dwCursorStyle = CURSOR_STYLE_NBRECT; - } else if (!_tcsicmp(strTempText.c_str(), _T("pulse rect"))) { - m_dwCursorStyle = CURSOR_STYLE_PULSERECT; - } else if (!_tcsicmp(strTempText.c_str(), _T("fading block"))) { - m_dwCursorStyle = CURSOR_STYLE_FADEBLOCK; - } - } - SAFERELEASE(pCursorSubelement); - } - 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); - } - - // get behaviour settings - IXMLElementCollection* pBehaviorColl = NULL; - if (!SUCCEEDED(pColl->item(CComVariant(_T("behaviour")), CComVariant(0), (IDispatch**)&pBehaviorElement))) { - if (!SUCCEEDED(pColl->item(CComVariant(_T("behavior")), CComVariant(0), (IDispatch**)&pBehaviorElement))) throw XmlException(FALSE); - } - - 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()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bMouseDragable = TRUE; - } else { - m_bMouseDragable = FALSE; - } - } - 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()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bCopyOnSelect = TRUE; - } else { - m_bCopyOnSelect = FALSE; - } - } - SAFERELEASE(pBehaviourSubelement); - - if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("inverse_shift")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); - if (pBehaviourSubelement) { - pBehaviourSubelement->get_text(strText.Out()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bInverseShift = TRUE; - } else { - m_bInverseShift = FALSE; - } - } - 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()); - if (!_tcsicmp(OLE2T(strText), _T("yes"))) { - m_dwReloadNewConfig = RELOAD_NEW_CONFIG_YES; - } else if (!_tcsicmp(OLE2T(strText), _T("no"))) { - m_dwReloadNewConfig = RELOAD_NEW_CONFIG_NO; - } else { - m_dwReloadNewConfig = RELOAD_NEW_CONFIG_PROMPT; - } - } - SAFERELEASE(pBehaviourSubelement); - - if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("disable_menu")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); - if (pBehaviourSubelement) { - pBehaviourSubelement->get_text(strText.Out()); - if (!_tcsicmp(OLE2T(strText), _T("true"))) { - m_bPopupMenuDisabled = TRUE; - } else { - m_bPopupMenuDisabled = FALSE; - } - } - SAFERELEASE(pBehaviourSubelement); - - } - SAFERELEASE(pBehaviorColl); - } - - bRet = TRUE; - - } catch (const XmlException& e) { - bRet = e.m_bRet; - } - - SAFERELEASE(pBehaviorElement); - SAFERELEASE(pCursorElement); - SAFERELEASE(pBackgroundElement); - SAFERELEASE(pScrollbarElement); - SAFERELEASE(pAppearanceElement); - SAFERELEASE(pPositionElement); - SAFERELEASE(pFontElement); - SAFERELEASE(pColl); - SAFERELEASE(pRootElement); - SAFERELEASE(pPersistStream); - SAFERELEASE(pConfigDoc); - SAFERELEASE(pFileStream); - - ::CoUninitialize(); - return bRet; -#endif return 1; } @@ -2175,284 +1253,12 @@ 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; - - if (m_bRelativeBackground) { - - if (g_bWin2000) { - // 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); - } else { - // WinNT compatibility (hope it works, I didn't test it) - dwBackgroundWidth = dwPrimaryDisplayWidth; - dwBackgroundHeight = dwBackgroundHeight; - } - - } else { - dwBackgroundWidth = m_nClientWidth; - dwBackgroundHeight = m_nClientHeight; - } - - // now, load the image... - fipImage image; - IMAGE_DATA imageData; - - if (!image.load(T2A(m_strBackgroundFile.c_str()))) { - 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* pPixelSubel = pPixels; - - while (pPixelSubel < pPixelsEnd) { - - *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; - - if (m_dwBackgroundStyle == BACKGROUND_STYLE_RESIZE) { - - if (m_bRelativeBackground) { - if (m_bExtendBackground) { - imageData.dwImageWidth = dwBackgroundWidth; - imageData.dwImageHeight = dwBackgroundHeight; - } else { - imageData.dwImageWidth = dwPrimaryDisplayWidth; - imageData.dwImageHeight = dwPrimaryDisplayHeight; - } - } else { - imageData.dwImageWidth = (DWORD)m_nClientWidth; - imageData.dwImageHeight = (DWORD)m_nClientHeight; - } - - if ((image.getWidth() != imageData.dwImageWidth) || (image.getHeight() != imageData.dwImageHeight)) { - 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(), - 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, - 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 { - ::CopyMemory(&crBackground, &m_crBackground, sizeof(COLORREF)); - } - - 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, - 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, - 0, - 0, - dwBackgroundWidth, - dwBackgroundHeight, - imageData.hdcImage, - 0, - 0, - SRCCOPY); - break; - - case BACKGROUND_STYLE_CENTER : - ::BitBlt( - m_hdcBackground, - (dwBackgroundWidth <= imageData.dwImageWidth) ? 0 : (dwBackgroundWidth - imageData.dwImageWidth)/2, - (dwBackgroundHeight <= imageData.dwImageHeight) ? 0 : (dwBackgroundHeight - imageData.dwImageHeight)/2, - imageData.dwImageWidth, - imageData.dwImageHeight, - imageData.hdcImage, - (dwBackgroundWidth < imageData.dwImageWidth) ? (imageData.dwImageWidth - dwBackgroundWidth)/2 : 0, - (dwBackgroundHeight < imageData.dwImageHeight) ? (imageData.dwImageHeight - dwBackgroundHeight)/2 : 0, - SRCCOPY); - break; - } - } else { - ::EnumDisplayMonitors(NULL, NULL, Console::BackgroundEnumProc, (DWORD)&imageData); - } - - ::SelectObject(imageData.hdcImage, hbmpImageOld); - ::DeleteObject(hbmpImage); - ::DeleteDC(imageData.hdcImage); -} -#endif ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -#if 0 -BOOL CALLBACK Console::BackgroundEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { - - IMAGE_DATA* pImageData = (IMAGE_DATA*)dwData; - - 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, - (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, - 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, - (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, - dwDisplayHeight, - pImageData->hdcImage, - (dwDisplayWidth < pImageData->dwImageWidth) ? (pImageData->dwImageWidth - dwDisplayWidth)/2 : 0, - (dwDisplayHeight < pImageData->dwImageHeight) ? (pImageData->dwImageHeight - dwDisplayHeight)/2 : 0, - SRCCOPY); - - break; - } - - return TRUE; -} -#endif ///////////////////////////////////////////////////////////////////////////// @@ -2543,63 +1349,6 @@ void Console::CalcWindowSize() { ///////////////////////////////////////////////////////////////////////////// -#if 0 -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; - if (::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop"), 0, KEY_READ, &hkeyDesktop) == ERROR_SUCCESS) { - TCHAR szData[MAX_PATH]; - DWORD dwDataSize = MAX_PATH; - - DWORD dwWallpaperStyle; - DWORD dwTileWallpaper; - - ::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)); - ::RegQueryValueEx(hkeyDesktop, _T("WallpaperStyle"), NULL, NULL, (BYTE*)szData, &dwDataSize); - - dwWallpaperStyle = _ttoi(szData); - - dwDataSize = MAX_PATH; - ::ZeroMemory(szData, sizeof(szData)); - ::RegQueryValueEx(hkeyDesktop, _T("TileWallpaper"), NULL, NULL, (BYTE*)szData, &dwDataSize); - - dwTileWallpaper = _ttoi(szData); - - if (dwTileWallpaper == 1) { - m_dwBackgroundStyle = BACKGROUND_STYLE_TILE; - } else { - - if (dwWallpaperStyle == 0) { - m_dwBackgroundStyle = BACKGROUND_STYLE_CENTER; - } else { - m_dwBackgroundStyle = BACKGROUND_STYLE_RESIZE; - } - } - } - - ::RegCloseKey(hkeyDesktop); - } - } -} -#endif ///////////////////////////////////////////////////////////////////////////// @@ -2660,17 +1409,10 @@ 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); -#else DWORD dwScreenWidth = ::GetSystemMetrics(SM_CXSCREEN); DWORD dwScreenHeight = ::GetSystemMetrics(SM_CYSCREEN); DWORD dwTop = ::GetSystemMetrics(0); DWORD dwLeft = ::GetSystemMetrics(0); -#endif switch (m_dwDocked) { case DOCK_TOP_LEFT: @@ -2985,79 +1727,12 @@ void Console::ReloadSettings() { 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; - } else { - m_strShell = _T("cmd.exe"); - } - } - - tstring strShellCmdLine(m_strShell); - if (m_strShellCmdLine.length() > 0) { - strShellCmdLine += _T(" "); - strShellCmdLine += m_strShellCmdLine; - } - -// strShellCmdLine = "cmd.exe"; - - // create the console window - TCHAR szConsoleTitle[MAX_PATH]; - ::AllocConsole(); - // we use this to avoid possible problems with multiple console instances running - _stprintf(szConsoleTitle, _T("%i"), ::GetCurrentThreadId()); - ::SetConsoleTitle(szConsoleTitle); - m_hStdOut = ::GetStdHandle(STD_OUTPUT_HANDLE); - while ((m_hWndConsole = ::FindWindow(NULL, szConsoleTitle)) == NULL) ::Sleep(50); - ::SetConsoleTitle(m_strWinConsoleTitle.c_str()); -#endif // this is a little hack needed to support columns greater than standard 80 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, - NULL, - &si, - &pi)) { - - return FALSE; - } - - if (m_dwHideConsoleTimeout > 0) { - ::ShowWindow(m_hWndConsole, SW_MINIMIZE); - ::SetTimer(m_hWnd, TIMER_SHOW_HIDE_CONSOLE, m_dwHideConsoleTimeout, NULL); - } 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; } @@ -3068,10 +1743,6 @@ BOOL Console::StartShellProcess() { ///////////////////////////////////////////////////////////////////////////// void Console::RefreshStdOut() { -#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 } ///////////////////////////////////////////////////////////////////////////// @@ -3091,73 +1762,6 @@ void Console::RefreshScreenBuffer() { si.nPos = (int)m_csbiConsole.srWindow.Top; ::FlatSB_SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE); -#if 0 - if ((m_csbiConsole.srWindow.Right - m_csbiConsole.srWindow.Left + 1 != m_dwColumns) || (m_csbiConsole.srWindow.Bottom - m_csbiConsole.srWindow.Top + 1 != m_dwRows) || (m_csbiConsole.dwSize.Y != m_dwBufferRows)) { - m_dwColumns = m_csbiConsole.srWindow.Right - m_csbiConsole.srWindow.Left + 1; - m_dwRows = m_csbiConsole.srWindow.Bottom - m_csbiConsole.srWindow.Top + 1; - ResizeConsoleWindow(); - } - - 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; - srRegion.Right = m_dwColumns - 1; - - DEL_ARR(m_pScreenBufferNew); - m_pScreenBufferNew = new CHAR_INFO[m_dwRows * m_dwColumns]; - ::ZeroMemory( m_pScreenBufferNew, m_dwRows * m_dwColumns * sizeof(CHAR_INFO)); - for (int i=0; i (DWORD) dwColumns * m_dwBufferRows) { - ::SetConsoleWindowInfo(m_hStdOutFresh, TRUE, &srConsoleRect); - ::SetConsoleScreenBufferSize(m_hStdOutFresh, coordConsoleSize); - } else if (((DWORD)csbi.dwSize.X < dwColumns) || ((DWORD)csbi.dwSize.Y < m_dwBufferRows) || ((DWORD)(csbi.srWindow.Bottom - csbi.srWindow.Top + 1) != m_dwRows)) { - ::SetConsoleScreenBufferSize(m_hStdOutFresh, coordConsoleSize); - ::SetConsoleWindowInfo(m_hStdOutFresh, TRUE, &srConsoleRect); - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -3235,28 +1827,6 @@ void Console::ResizeConsoleWindow() { // srConsoleRect.Right = m_dwColumns - 1; // srConsoleRect.Bottom= m_dwRows - 1; -#if 0 - // order of setting window size and screen buffer size depends on current and desired dimensions - 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); - } -#endif SetScrollbarStuff(); CalcWindowSize(); @@ -3290,15 +1860,6 @@ void Console::RepaintWindow() { rect.bottom = m_nClientHeight; rect.right = m_nClientWidth; -#if 0 - if (m_bBitmapBackground) { - if (m_bRelativeBackground) { - ::BitBlt(m_hdcConsole, 0, 0, m_nClientWidth, m_nClientHeight, m_hdcBackground, m_nX+m_nXBorderSize-m_nBackgroundOffsetX, m_nY+m_nCaptionSize+m_nYBorderSize-m_nBackgroundOffsetY, SRCCOPY); - } else { - ::BitBlt(m_hdcConsole, 0, 0, m_nClientWidth, m_nClientHeight, m_hdcBackground, 0, 0, SRCCOPY); - } - } else { -#endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } @@ -3473,15 +2034,6 @@ void Console::RepaintWindowChanges() { rect.bottom = dwY + m_nCharHeight; rect.right = dwX + m_nCharWidth; -#if 0 - if (m_bBitmapBackground) { - if (m_bRelativeBackground) { - ::BitBlt(m_hdcConsole, dwX, dwY, m_nCharWidth, m_nCharHeight, m_hdcBackground, m_nX+m_nXBorderSize-m_nBackgroundOffsetX+(int)dwX, m_nY+m_nCaptionSize+m_nYBorderSize-m_nBackgroundOffsetY+(int)dwY, SRCCOPY); - } else { - ::BitBlt(m_hdcConsole, dwX, dwY, m_nCharWidth, m_nCharHeight, m_hdcBackground, dwX, dwY, SRCCOPY); - } - } else { -#endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } @@ -3520,15 +2072,6 @@ void Console::RepaintWindowChanges() { rect.bottom = m_nClientHeight; rect.right = m_nClientWidth; -#if 0 - if (m_bBitmapBackground) { - if (m_bRelativeBackground) { - ::BitBlt(m_hdcConsole, 0, 0, m_nClientWidth, m_nClientHeight, m_hdcBackground, m_nX+m_nXBorderSize-m_nBackgroundOffsetX, m_nY+m_nCaptionSize+m_nYBorderSize-m_nBackgroundOffsetY, SRCCOPY); - } else { - ::BitBlt(m_hdcConsole, 0, 0, m_nClientWidth, m_nClientHeight, m_hdcBackground, 0, 0, SRCCOPY); - } - } else { -#endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } @@ -3579,27 +2122,9 @@ void Console::DrawCursor(BOOL bOnlyCursor) { ::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 - ::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 RECT rectCursor; if (!bOnlyCursor) { @@ -3696,33 +2221,6 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) { ::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, - SRCCOPY); - - } else { - ::BitBlt( - m_hdcConsole, - rectCursor.left, - rectCursor.top, - rectCursor.right - rectCursor.left, - rectCursor.bottom - rectCursor.top, - m_hdcBackground, - rectCursor.left, - rectCursor.top, SRCCOPY); - } - } else { -#endif ::FillRect(m_hdcConsole, &rectCursor, m_hBkBrush); // } @@ -3791,13 +2289,6 @@ void Console::ShowHideConsole() { ///////////////////////////////////////////////////////////////////////////// -#if 0 -void Console::ShowHideConsoleTimeout() { - - ::KillTimer(m_hWnd, TIMER_SHOW_HIDE_CONSOLE); - ShowHideConsole(); -} -#endif ///////////////////////////////////////////////////////////////////////////// @@ -3860,24 +2351,6 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { PasteClipoardText(); return FALSE; -#if 0 - case ID_HIDE_CONSOLE: - m_bHideConsole = !m_bHideConsole; - ShowHideConsole(); - return FALSE; - - 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); @@ -3893,32 +2366,6 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { return TRUE; } -#if 0 - // 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); - m_strConfigFile = tstring(szFilename); - - if (m_dwReloadNewConfig == RELOAD_NEW_CONFIG_PROMPT) { - if (::MessageBox( - m_hWndConsole, - _T("Load new settings?"), - _T("New configuration selected"), - MB_YESNO|MB_ICONQUESTION) == IDYES) { - - ReloadSettings(); - } - } else if (m_dwReloadNewConfig == RELOAD_NEW_CONFIG_YES) { - ReloadSettings(); - } - - return FALSE; - } -#endif return TRUE; } @@ -3930,10 +2377,6 @@ 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)); -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -3943,10 +2386,6 @@ 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)); -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -3956,55 +2395,6 @@ void Console::UpdateHideConsoleMenuItem() { 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; - mii.fType = MFT_RADIOCHECK | MFT_STRING; - 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 } ///////////////////////////////////////////////////////////////////////////// @@ -4229,29 +2619,6 @@ void Console::SendTextToConsole(const wchar_t *pszText) m_pCursor->SetState(c_state); } -#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; - pKeyEvents[i].Event.KeyEvent.wRepeatCount = 1; - pKeyEvents[i].Event.KeyEvent.wVirtualKeyCode = 0; - pKeyEvents[i].Event.KeyEvent.wVirtualScanCode = 0; - pKeyEvents[i].Event.KeyEvent.uChar.UnicodeChar = pszText[i]; - pKeyEvents[i].Event.KeyEvent.dwControlKeyState = 0; - } - ::WriteConsoleInput(hStdIn, pKeyEvents, dwTextLen, &dwTextWritten); - - DEL_ARR(pKeyEvents); - ::CloseHandle(hStdIn); -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -4293,42 +2660,6 @@ void Console::GetDesktopRect(RECT& rectDesktop) { rectDesktop.bottom = rectDesktop.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN); } -#if 0 -} else { - // we keep this for WinNT compatibility - - rectDesktop.left= 0; - 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; - } - } - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -4416,22 +2747,6 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM myself->OnActivateApp((BOOL)wParam, (DWORD)lParam); return 0; -#if 0 - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - MSG msg; - - ::ZeroMemory(&msg, sizeof(MSG)); - - msg.hwnd = myself->m_hWnd; - msg.message = uMsg; - msg.wParam = wParam; - msg.lParam = lParam; - - ::TranslateMessage(&msg); - ::PostMessage(myself->m_hWndConsole, uMsg, wParam, lParam); - return 0; -#endif case WM_CHAR: myself->OnChar( (WORD) wParam); @@ -4459,11 +2774,6 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM myself->OnCursorTimer(); return 0; -#if 0 - case TIMER_SHOW_HIDE_CONSOLE: - myself->ShowHideConsoleTimeout(); - return 0; -#endif default: return 1; @@ -4519,16 +2829,6 @@ DWORD Console::MonitorThread() { // HANDLE arrHandles[] = { m_hStdOut}; for (;;) { // Infinite loop -#if 0 - DWORD dwWait = ::WaitForMultipleObjects(1, arrHandles, FALSE, INFINITE); - - if (dwWait == WAIT_OBJECT_0) { - ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); - break; - } else if (dwWait == WAIT_OBJECT_0 + 1) { - break; - } else if (dwWait == WAIT_OBJECT_0 + 2) { -#endif AddOutput(); ::SetTimer(m_hWnd, TIMER_REPAINT_CHANGE, m_dwChangeRepaintInt, NULL); // we sleep here for a while, to prevent 'flooding' of m_hStdOut events diff --git a/Console/Cursors.cpp b/Console/Cursors.cpp index a74bd1b59..56579caef 100644 --- a/Console/Cursors.cpp +++ b/Console/Cursors.cpp @@ -327,13 +327,7 @@ void ConsoleCursor::Draw(LPRECT pRect) { if (m_bActive && m_bVisible) { -#if 0 - CONSOLE_CURSOR_INFO csi; - ::GetConsoleCursorInfo(m_hStdOut, &csi); - rect.top += (rect.bottom - rect.top) * (100-csi.dwSize)/100; -#else rect.top += (rect.bottom - rect.top) * 80 / 100; -#endif ::FillRect(m_hdcWindow, &rect, m_hActiveBrush); } @@ -706,38 +700,6 @@ FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs { 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 - // each time - m_nBmpWidth = BLEND_BMP_WIDTH; - m_nBmpHeight= BLEND_BMP_HEIGHT; - m_hMemDC = ::CreateCompatibleDC(hdcWindow); - m_hBmp = ::CreateCompatibleBitmap(hdcWindow, m_nBmpWidth, m_nBmpHeight); - m_hBmpOld = (HBITMAP)::SelectObject(m_hMemDC, m_hBmp); - - HBRUSH hBrush= ::CreateSolidBrush(m_crCursorColor); - RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = m_nBmpWidth; - rect.bottom = m_nBmpHeight; - - ::FillRect(m_hMemDC, &rect, hBrush); - ::DeleteObject(hBrush); - - m_nStep = -ALPHA_STEP; - - m_bfn.BlendOp = AC_SRC_OVER; - m_bfn.BlendFlags = 0; - m_bfn.SourceConstantAlpha = 255; - m_bfn.AlphaFormat = 0; - - } else { -#endif FakeBlend(); // } } @@ -746,13 +708,6 @@ FadeBlockCursor::~FadeBlockCursor() { if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); -#if 0 - if (g_bWin2000) { - ::SelectObject(m_hMemDC, m_hBmpOld); - ::DeleteObject(m_hBmp); - ::DeleteDC(m_hMemDC); - } -#endif } ///////////////////////////////////////////////////////////////////////////// @@ -762,24 +717,6 @@ FadeBlockCursor::~FadeBlockCursor() { void FadeBlockCursor::Draw(LPRECT pRect) { -#if 0 - if (g_bWin2000) { - - g_pfnAlphaBlend( - m_hdcWindow, - pRect->left, - pRect->top, - pRect->right - pRect->left, - pRect->bottom - pRect->top, - m_hMemDC, - 0, - 0, - BLEND_BMP_WIDTH, - BLEND_BMP_HEIGHT, - m_bfn); - - } else { -#endif HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]); ::FillRect(m_hdcWindow, pRect, hBrush); @@ -793,17 +730,6 @@ void FadeBlockCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void FadeBlockCursor::PrepareNext() { -#if 0 - if (g_bWin2000){ - if (m_bfn.SourceConstantAlpha < ALPHA_STEP) { - m_nStep = ALPHA_STEP; - } else if ((DWORD)m_bfn.SourceConstantAlpha + ALPHA_STEP > 255) { - m_nStep = -ALPHA_STEP; - } - - m_bfn.SourceConstantAlpha += m_nStep; - } else { -#endif if (m_nIndex == 0) { m_nStep = 1; } else if (m_nIndex == (FADE_STEPS)) { diff --git a/Console/Cursors.h b/Console/Cursors.h index a7e916097..3a1f4c173 100644 --- a/Console/Cursors.h +++ b/Console/Cursors.h @@ -337,12 +337,6 @@ class FadeBlockCursor : public Cursor { HMODULE m_hUser32; BLENDFUNCTION m_bfn; HDC m_hMemDC; -#if 0 - HBITMAP m_hBmp; - HBITMAP m_hBmpOld; - int m_nBmpWidth; - int m_nBmpHeight; -#endif }; ///////////////////////////////////////////////////////////////////////////// diff --git a/Editor/Editor Callbacks.cpp b/Editor/Editor Callbacks.cpp index fd102ba7d..9590e7b48 100644 --- a/Editor/Editor Callbacks.cpp +++ b/Editor/Editor Callbacks.cpp @@ -791,27 +791,7 @@ void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { -#if 0//dnl ch80 011213 - gfRenderTaskbar = TRUE; - if (_KeyDown( 17 ) ) // CTRL - { - if (_KeyDown( 16 ) ) // SHIFT - eInfo.sScrollIndex = 0; - else - eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 60, 0); - } - else if (_KeyDown( 16 ) ) // SHIFT - eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 6, 0); - else - eInfo.sScrollIndex--; - - if( !eInfo.sScrollIndex ) - DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) - EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); -#else ScrollEditorItemsInfo(FALSE); -#endif } } @@ -819,26 +799,7 @@ void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { -#if 0//dnl ch80 011213 - gfRenderTaskbar = TRUE; - if (_KeyDown( 17 ) ) // CTRL - { - if (_KeyDown( 16 ) ) // SHIFT - eInfo.sScrollIndex = max( ((eInfo.sNumItems+1)/2)-6, 0); - else - eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 60, (eInfo.sNumItems+1)/2-6); - } - else if (_KeyDown( 16 ) ) // SHIFT - eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 6, (eInfo.sNumItems+1)/2-6); - else - eInfo.sScrollIndex++; - - EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) - DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); -#else ScrollEditorItemsInfo(TRUE); -#endif } } diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp index 370f6e744..0d09d8b97 100644 --- a/Editor/Editor Undo.cpp +++ b/Editor/Editor Undo.cpp @@ -367,56 +367,6 @@ void CropStackToMaxLength( INT32 iMaxCmds ) } } -#if 0//dnl ch86 200214 -//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 - //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 - //in the undo list. - if( gfIgnoreUndoCmdsForLights ) - return; - - pNode = (undo_stack*)MemAlloc( sizeof( undo_stack ) ); - if( !pNode ) - return; - - pUndoInfo = (undo_struct *)MemAlloc( sizeof( undo_struct ) ); - if( !pUndoInfo ) - { - MemFree( pNode ); - return; - } - - pUndoInfo->fLightSaved = TRUE; - //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; - pUndoInfo->iMapIndex = iMapIndex; - pUndoInfo->pMapTile = NULL; - - //Add to undo stack - pNode->iCmdCount = 1; - pNode->pData = pUndoInfo; - pNode->pNext = gpTileUndoStack; - gpTileUndoStack = pNode; - - CropStackToMaxLength( MAX_UNDO_COMMAND_LENGTH ); -} -#endif BOOLEAN AddToUndoList( INT32 iMapIndex ) { @@ -543,11 +493,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) { // this loop won't execute for single-tile structures; for multi-tile structures, we have to // add to the undo list all the other tiles covered by the structure -#if 0//dnl ch83 080114 - iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; -#else iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]); -#endif AddToUndoList( iCoveredMapIndex ); } pStructure = pStructure->pNext; @@ -575,19 +521,11 @@ void CheckMapIndexForMultiTileStructures( UINT32 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) { -#if 0//dnl ch83 080114 - iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; -#else iCoveredMapIndex = AddPosRelToBase(usMapIndex, pStructure->pDBStructureRef->ppTile[ubLoop]); -#endif } else { -#if 0//dnl ch83 080114 - iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; -#else iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]); -#endif } AddToUndoList( iCoveredMapIndex ); } @@ -636,26 +574,6 @@ BOOLEAN ExecuteUndoList( void ) while ( (iCurCount < iCmdCount) && (gpTileUndoStack != NULL) ) { iUndoMapIndex = gpTileUndoStack->pData->iMapIndex; -#if 0//dnl ch86 201214 - fExitGrid = ExitGridAtGridNo( 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... - gfIgnoreUndoCmdsForLights = TRUE; - ConvertGridNoToXY( iUndoMapIndex, &sX, &sY ); - if( !gpTileUndoStack->pData->ubLightRadius ) - RemoveLight( sX, sY ); - else - PlaceLight( gpTileUndoStack->pData->ubLightRadius, sX, sY, gpTileUndoStack->pData->ubLightID ); - //Turn off the flag so lights can again be added to the undo list. - gfIgnoreUndoCmdsForLights = FALSE; - } - else -#endif { // We execute the undo command node by simply swapping the contents // of the undo's MAP_ELEMENT with the world's element. SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); @@ -730,19 +648,8 @@ BOOLEAN ExecuteUndoList( void ) //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 0//dnl ch86 110214 - if( fExitGrid && !ExitGridAtGridNo( iUndoMapIndex ) ) - { //An exitgrid has been removed, so get rid of the associated indicator. - RemoveTopmost( iUndoMapIndex, FIRSTPOINTERS8 ); - } - else if( !fExitGrid && ExitGridAtGridNo( iUndoMapIndex ) ) - { //An exitgrid has been added, so add the associated indicator - AddTopmostToTail( iUndoMapIndex, FIRSTPOINTERS8 ); - } -#else if(gfShowExitGrids && fExitGrid) AddTopmostToTail(iUndoMapIndex, FIRSTPOINTERS8); -#endif } return( TRUE ); diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp index 4f343c086..fd7f9c29c 100644 --- a/Editor/EditorBuildings.cpp +++ b/Editor/EditorBuildings.cpp @@ -366,44 +366,8 @@ void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo ) AddTopmostToTail( iDstGridNo, pNode->usIndex ); pNode = pNode->pNext; } -#if 0//dnl ch86 110214 - for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ ) - { - HideStructOfGivenType( iDstGridNo, usType, (BOOLEAN)(!fBuildingShowRoofs) ); - } -#endif } -#if 0//dnl ch86 220214 -void MoveBuilding( INT32 iMapIndex ) -{ - BUILDINGLAYOUTNODE *curr; - INT32 iOffset; - if( !gpBuildingLayoutList ) - return; - SortBuildingLayout( iMapIndex ); - iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo; - if(iOffset == 0)//dnl ch32 080909 - return; - //First time, set the undo gridnos to everything effected. - curr = gpBuildingLayoutList; - while( curr ) - { - AddToUndoList( curr->sGridNo ); - AddToUndoList( curr->sGridNo + iOffset ); - curr = curr->next; - } - //Now, move the building - curr = gpBuildingLayoutList; - while( curr ) - { - PasteMapElementToNewMapElement( curr->sGridNo, curr->sGridNo + iOffset ); - DeleteStuffFromMapTile( curr->sGridNo ); - curr = curr->next; - } - MarkWorldDirty(); -} -#else void MoveBuilding( INT32 iMapIndex ) { INT8 bLightType; @@ -465,7 +429,6 @@ void MoveBuilding( INT32 iMapIndex ) MarkWorldDirty(); LightSpriteRenderAll(); } -#endif void PasteBuilding( INT32 iMapIndex ) { diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index bf756c031..b6c96847d 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -1032,16 +1032,10 @@ void DeleteSelectedItem() if( gpEditingItemPool == gpItemPool ) gpEditingItemPool = NULL; RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 ); -#if 0//dnl ch86 220214 - gpItemPool = NULL; - //determine if there are still any items at this location - if( GetItemPoolFromGround( sGridNo, &gpItemPool ) ) -#else ITEM_POOL *pItemPoolOld = gpItemPool; GetItemPoolFromGround(sGridNo, &gpItemPool); UpdateItemPoolInUndoList(sGridNo, pItemPoolOld, gpItemPool); if(gpItemPool) -#endif { //reset display for remaining items SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); } diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index 6f1645fc8..47317b3fe 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -239,11 +239,6 @@ enum{ SUMMARY_LOAD, SUMMARY_SAVE, SUMMARY_OVERRIDE, -#if 0 - SUMMARY_NEW_GROUNDLEVEL, - SUMMARY_NEW_BASEMENTLEVEL, - SUMMARY_NEW_CAVELEVEL, -#endif SUMMARY_UPDATE, SUMMARY_SCIFI, SUMMARY_REAL, @@ -351,17 +346,6 @@ void CreateSummaryWindow() CreateCheckBoxButton( ( INT16 ) ( MAP_LEFT + 110 ), ( INT16 ) ( MAP_BOTTOM + 59 ), "EDITOR\\smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryOverrideCallback ); -#if 0 - iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ] = - CreateSimpleButton( MAP_LEFT, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewGroundLevelCallback ); - SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ], L"New map" ); - iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ] = - CreateSimpleButton( MAP_LEFT+32, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewBasementLevelCallback ); - SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ], L"New basement" ); - iSummaryButton[ SUMMARY_NEW_CAVELEVEL ] = - CreateSimpleButton( MAP_LEFT+64, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewCaveLevelCallback ); - SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_CAVELEVEL ], L"New cave level" ); -#endif iSummaryButton[ SUMMARY_UPDATE ] = @@ -1826,23 +1810,6 @@ void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason ) void PerformTest() { -#if 0 - OutputDebugString( "PERFORMING A NEW TEST -------------------------------------------------\n" ); - memset( gbDefaultSurfaceUsed, 0, sizeof( gbDefaultSurfaceUsed ) ); - giCurrentTilesetID = -1; - switch( Random( 3 ) ) - { - case 0: - LoadWorld( "J9.dat" ); - break; - case 1: - LoadWorld( "J9_b1.dat" ); - break; - case 2: - LoadWorld( "J9_b2.dat" ); - break; - } -#endif } @@ -3029,16 +2996,6 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason ) SetProgressBarTitle( 0, pSummaryUpdateCallbackText[0], BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); -#if 0 - // 0verhaul: This should NOT be freed. An array index can be freed when it is recalculated, - // as this function is about to do. And then it SHOULD be freed first, which it wasn't doing. - // Either way, using this pointer is not a safe way to free the current sector's summary data. - if( gpCurrentSectorSummary ) - { - MemFree( gpCurrentSectorSummary ); - gpCurrentSectorSummary = NULL; - } -#endif sprintf( str, "%c%d", gsSelSectorY + 'A' - 1, gsSelSectorX ); EvaluateWorld( str, (UINT8)giCurrLevel ); @@ -3252,220 +3209,6 @@ void ApologizeOverrideAndForceUpdateEverything() gusNumberOfMapsToBeForceUpdated = 0; } -#if 0//dnl ch81 041213 this function is screwed up so decide to rewrite it -//CHRISL: ADB changed the way this load file is handled -extern int gEnemyPreservedTempFileVersion[256]; -extern int gCivPreservedTempFileVersion[256]; -void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) -{ - HWFILE hfile; - UINT32 uiNumBytesRead; - UINT32 uiNumItems; - CHAR8 szFilename[40]; - BASIC_SOLDIERCREATE_STRUCT basic; - SOLDIERCREATE_STRUCT priority; - INT32 i, j; - UINT16 usNumItems; - OBJECTTYPE *pItem; - UINT16 usPEnemyIndex, usNEnemyIndex; - - SUMMARYFILE *s = gpCurrentSectorSummary; - MAPCREATE_STRUCT *m = &gpCurrentSectorSummary->MapInfo; - - //Clear memory for all the item summaries loaded - if( gpWorldItemsSummaryArray ) - { - delete[]( gpWorldItemsSummaryArray ); - gpWorldItemsSummaryArray = NULL; - gusWorldItemsSummaryArraySize = 0; - } - if( gpPEnemyItemsSummaryArray ) - { - delete[]( gpPEnemyItemsSummaryArray ); - gpPEnemyItemsSummaryArray = NULL; - gusPEnemyItemsSummaryArraySize = 0; - } - if( gpNEnemyItemsSummaryArray ) - { - delete[]( gpNEnemyItemsSummaryArray ); - gpNEnemyItemsSummaryArray = NULL; - gusNEnemyItemsSummaryArraySize = 0; - } - - if( !gpCurrentSectorSummary->uiNumItemsPosition ) - { //Don't have one, so generate them - if( gpCurrentSectorSummary->ubSummaryVersion == GLOBAL_SUMMARY_VERSION ) - gusNumEntriesWithOutdatedOrNoSummaryInfo++; - SummaryUpdateCallback( ButtonList[ iSummaryButton[ SUMMARY_UPDATE ] ], MSYS_CALLBACK_REASON_LBUTTON_UP ); - } - //Open the original map for the sector - sprintf( szFilename, "MAPS\\%S", gszFilename ); - hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); - if( !hfile ) - { //The file couldn't be found! - return; - } - // ADB: The uiNumItemsPosition may be 0 here due to the recursion further down. - // If so, skip the read - uiNumItems = 0; - if (gpCurrentSectorSummary->uiNumItemsPosition) - { - //Now fileseek directly to the file position where the number of world items are stored - if( !FileSeek( hfile, gpCurrentSectorSummary->uiNumItemsPosition, FILE_SEEK_FROM_START ) ) - { //Position couldn't be found! - FileClose( hfile ); - return; - } - //Now load the number of world items from the map. - FileRead( hfile, &uiNumItems, 4, &uiNumBytesRead ); - if( uiNumBytesRead != 4 ) - { //Invalid situation. - FileClose( hfile ); - return; - } - } - - //Now compare this number with the number the summary thinks we should have. If they are different, - //then the summary doesn't match the map. What we will do is force regenerate the map so that they do - //match - if( uiNumItems != gpCurrentSectorSummary->usNumItems && fAllowRecursion ) - { - FileClose( hfile ); - gpCurrentSectorSummary->uiNumItemsPosition = 0; - SetupItemDetailsMode( FALSE ); - return; - } - //Passed the gauntlet, so now allocate memory for it, and load all the world items into this array. - ShowButton( iSummaryButton[ SUMMARY_SCIFI ] ); - ShowButton( iSummaryButton[ SUMMARY_REAL ] ); - ShowButton( iSummaryButton[ SUMMARY_ENEMY ] ); - gpWorldItemsSummaryArray = new WORLDITEM[ uiNumItems ]; - gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems; - for (unsigned int x = 0; x < uiNumItems; ++x) - { - gpWorldItemsSummaryArray[x].Load(hfile, s->dMajorMapVersion, m->ubMapVersion); - } - - //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 - //keeping track of two different values. The first value is the number of droppable items that come off of - //enemy detailed placements, the other counter keeps track of the number of droppable items that come off of - //normal enemy placements. After doing this, the memory is allocated for the tables that will store all the item - //summary information, then the second pass will repeat the process, except it will record the actual items. - - //PASS #1 - if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) ) - { //Position couldn't be found! - FileClose( hfile ); - return; - } - for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ ) - { - FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) ) - { //Invalid situation. - FileClose( hfile ); - return; - } - if( basic.fDetailedPlacement ) - { //skip static priority placement - if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) ) - { //Invalid situation. - FileClose( hfile ); - return; - } - } - else - { //non detailed placements don't have items, so skip - continue; - } - if( basic.bTeam == ENEMY_TEAM ) - { - //Count the items that this enemy placement drops - usNumItems = 0; - for( j = 0; j < 9; j++ ) - { - pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; - if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) ) - { - usNumItems++; - } - } - if( basic.fPriorityExistance ) - { - gusPEnemyItemsSummaryArraySize += usNumItems; - } - else - { - gusNEnemyItemsSummaryArraySize += usNumItems; - } - } - } - - //Pass 1 completed, so now allocate enough space to hold all the items - if( gusPEnemyItemsSummaryArraySize ) - { - gpPEnemyItemsSummaryArray = new OBJECTTYPE[ gusPEnemyItemsSummaryArraySize ]; - } - if( gusNEnemyItemsSummaryArraySize ) - { - gpNEnemyItemsSummaryArray = new OBJECTTYPE[ gusNEnemyItemsSummaryArraySize ]; - } - - //PASS #2 - //During this pass, simply copy all the data instead of counting it, now that we have already done so. - usPEnemyIndex = usNEnemyIndex = 0; - if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) ) - { //Position couldn't be found! - FileClose( hfile ); - return; - } - for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ ) - { - FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) ) - { //Invalid situation. - FileClose( hfile ); - return; - } - if( basic.fDetailedPlacement ) - { //skip static priority placement - if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) ) - { //Invalid situation. - FileClose( hfile ); - return; - } - } - else - { //non detailed placements don't have items, so skip - continue; - } - if( basic.bTeam == ENEMY_TEAM ) - { - //Copy the items that this enemy placement drops - usNumItems = 0; - for( j = 0; j < 9; j++ ) - { - pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; - if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) ) - { - if( basic.fPriorityExistance ) - { - gpPEnemyItemsSummaryArray[ usPEnemyIndex ] = *pItem; - usPEnemyIndex++; - } - else - { - gpNEnemyItemsSummaryArray[ usNEnemyIndex ] = *pItem; - usNEnemyIndex++; - } - } - } - } - } - FileClose( hfile ); -} -#else void SetupItemDetailsMode(BOOLEAN fAllowRecursion) { UINT32 uiNumItems, uiFileSize, uiBytesRead; @@ -3630,7 +3373,6 @@ void SetupItemDetailsMode(BOOLEAN fAllowRecursion) } } } -#endif UINT8 GetCurrentSummaryVersion() { diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index beebb1086..a36d3d2eb 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -2090,22 +2090,7 @@ void HandleKeyboardShortcuts( ) // item left scroll if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { -#if 0//dnl ch80 011213 - if( eInfo.sScrollIndex ) - { - if( EditorInputEvent.usKeyState & CTRL_DOWN ) - eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 60, 0); - else - eInfo.sScrollIndex--; - - if( !eInfo.sScrollIndex ) - DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) - EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); - } -#else ScrollEditorItemsInfo(FALSE); -#endif } else { @@ -2120,21 +2105,7 @@ void HandleKeyboardShortcuts( ) // item right scroll if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { -#if 0//dnl ch80 011213 - if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) - { - if( EditorInputEvent.usKeyState & CTRL_DOWN ) - eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 60, (eInfo.sNumItems+1)/2-6); - else - eInfo.sScrollIndex++; - - EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) - DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); - } -#else ScrollEditorItemsInfo(TRUE); -#endif } else { @@ -2149,22 +2120,7 @@ void HandleKeyboardShortcuts( ) // item left scroll by page if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { -#if 0//dnl ch80 011213 - if( eInfo.sScrollIndex ) - { - if( EditorInputEvent.usKeyState & CTRL_DOWN ) - eInfo.sScrollIndex = 0; - else - eInfo.sScrollIndex = __max(eInfo.sScrollIndex - 6, 0); - - if( !eInfo.sScrollIndex ) - DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) - EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); - } -#else ScrollEditorItemsInfo(FALSE); -#endif } //gfRenderTaskbar = TRUE; break; @@ -2172,21 +2128,7 @@ void HandleKeyboardShortcuts( ) // item right scroll by page if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { -#if 0//dnl ch80 011213 - if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) - { - if( EditorInputEvent.usKeyState & CTRL_DOWN ) - eInfo.sScrollIndex = max( ((eInfo.sNumItems+1)/2)-6, 0); - else - eInfo.sScrollIndex = __min(eInfo.sScrollIndex + 6, (eInfo.sNumItems+1)/2-6); - - EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); - if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) - DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); - } -#else ScrollEditorItemsInfo(TRUE); -#endif } //gfRenderTaskbar = TRUE; break; @@ -3264,65 +3206,6 @@ BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType, INT8 b // Returns TRUE if deleted the light, otherwise, returns FALSE. // i.e. FALSE is not an error condition! // -#if 0//dnl ch86 210214 -BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) -{ - INT32 iCount; - UINT16 cnt; - SOLDIERTYPE *pSoldier; - BOOLEAN fSoldierLight; - BOOLEAN fRemovedLight; - INT32 iMapIndex = 0; - UINT32 uiLastLightType = 0; - UINT8 *pLastLightName = NULL; - - fRemovedLight = FALSE; - - // Check all lights if any at this given position - 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! - fSoldierLight = FALSE; - for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) - { - if ( GetSoldier( &pSoldier, cnt ) ) - { - if ( pSoldier->iLight == iCount ) - fSoldierLight = TRUE; - } - } - - if ( !fSoldierLight ) - { - // Ok, it's not a merc's light so kill it! - pLastLightName = (UINT8 *) LightSpriteGetTypeName( iCount ); - uiLastLightType = LightSprites[iCount].uiLightType; - LightSpritePower( iCount, FALSE ); - LightSpriteDestroy( iCount ); - fRemovedLight = TRUE; - 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 - usRadius = pLastLightName[4] - 0x30; - AddLightToUndoList( iMapIndex, usRadius, (UINT8)uiLastLightType ); - } - - return( fRemovedLight ); -} -#else BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType) { INT32 iCount, iMapIndex; @@ -3340,7 +3223,6 @@ BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType) RemoveAllObjectsOfTypeRange(iMapIndex, GOODRING, GOODRING); return(fRemovedLight); } -#endif //---------------------------------------------------------------------------------------------- // ShowLightPositionHandles @@ -3473,79 +3355,6 @@ BOOLEAN CheckForSlantRoofs( void ) // void MapOptimize(void) { -#if 0 - INT32 GridNo; - LEVELNODE *start, *head, *end, *node, *temp; - MAP_ELEMENT *pMapTile; - BOOLEAN fFound, fChangedHead, fChangedTail; - - for( GridNo = 0; GridNo < WORLD_MAX; GridNo++ ) - { - if ( !GridNoOnVisibleWorldTile( GridNo ) ) - { - // Tile isn't in viewable area so trash everything in it - TrashMapTile( GridNo ); - } - else - { - // Tile is in viewable area so try to optimize any extra land pieces - pMapTile = &gpWorldLevelData[ GridNo ]; - - node = start = pMapTile->pLandStart; - head = pMapTile->pLandHead; - - if ( start == NULL ) - node = start = head; - - end = pMapTile->pLandTail; - - fChangedHead = fChangedTail = fFound = FALSE; - while ( !fFound && node != NULL ) - { - if ( gTileDatabase[node->usIndex].ubFullTile == 1 ) - fFound = TRUE; - else - node = node->pNext; - } - - if(fFound) - { - // Delete everything up to the start node -/* -// Not having this means we still keep the smoothing - - while( head != start && head != NULL ) - { - fChangedHead = TRUE; - temp = head->pNext; - MemFree( head ); - head = temp; - if ( head ) - head->pPrev = NULL; - } -*/ - - // Now delete from the end to "node" - while( end != node && end != NULL ) - { - fChangedTail = TRUE; - temp = end->pPrev; - MemFree( end ); - end = temp; - if ( end ) - end->pNext = NULL; - } - - if ( fChangedHead ) - pMapTile->pLandHead = head; - - if ( fChangedTail ) - pMapTile->pLandTail = end; - } - } - } - -#endif } @@ -3929,29 +3738,11 @@ void HandleMouseClicksInGameScreen()//dnl ch80 011213 { if(iLastMapIndexRB != iMapIndex && iLastMapIndexRB == -1) iLastMapIndexRB = iMapIndex; -#if 0 - gfRenderWorld = TRUE; - switch(iDrawMode) - { - default: - gfRenderWorld = fPrevState; - break; - } -#endif } else if(_MiddleButtonDown) { if(iLastMapIndexMB != iMapIndex && iLastMapIndexMB == -1) iLastMapIndexMB = iMapIndex; -#if 0 - gfRenderWorld = TRUE; - switch(iDrawMode) - { - default: - gfRenderWorld = fPrevState; - break; - } -#endif } else if(!_LeftButtonDown) { @@ -4192,15 +3983,6 @@ void HandleMouseClicksInGameScreen()//dnl ch80 011213 { if(iMapIndex == iLastMapIndexMB)// MiddleClick performed on same tile { -#if 0 - gfRenderWorld = TRUE; - switch(iDrawMode) - { - default: - gfRenderWorld = fPrevState; - break; - } -#endif } iLastMapIndexMB = -1; } diff --git a/Laptop/Encyclopedia_Data_new.cpp b/Laptop/Encyclopedia_Data_new.cpp index 07be98a02..5de9ac67b 100644 --- a/Laptop/Encyclopedia_Data_new.cpp +++ b/Laptop/Encyclopedia_Data_new.cpp @@ -1324,13 +1324,8 @@ void GameInitEncyclopediaData_NEW( ) giEncyclopedia_DataBtnImage = BUTTON_NO_IMAGE; memset( giEncyclopedia_DataFilterBtn, BUTTON_NO_SLOT, sizeof(giEncyclopedia_DataFilterBtn) ); giEncyclopedia_DataFilterBtnImage = BUTTON_NO_IMAGE; -#if 0//debug - memset( gbEncyclopediaData_ItemVisible, ENC_ITEM_DISCOVERED_NOT_REACHABLE, sizeof(gbEncyclopediaData_ItemVisible) ); - gbEncyclopediaData_ItemVisible[1] = ENC_ITEM_NOT_DISCOVERED; -#else if( guiCurrentScreen == MAINMENU_SCREEN ) EncyclopediaInitItemsVisibility(); -#endif // do following only once at start of JA2 CHECKV( guiCurrentScreen == 0 ); //prepare indexes for subfilter texts defined in _LanguageText.cpp, assuming there are blank separators between filter button texts ("1", "2", "3", "", "1", "", "1", "2", "3", "4") diff --git a/Laptop/Encyclopedia_new.cpp b/Laptop/Encyclopedia_new.cpp index f9ae0cf92..e1c5ac39b 100644 --- a/Laptop/Encyclopedia_new.cpp +++ b/Laptop/Encyclopedia_new.cpp @@ -38,11 +38,7 @@ #include "vobject.h"//video objects #include "Utils/Cursors.h" #include "Text.h"//button text -#ifdef ENC_USE_BUTTONSYSTEM #include "Button System.h" -#else - #include "WordWrap.h"//centered text -#endif #include "Encyclopedia_new.h" //#include "Encrypted File.h" //#include "Soldier Profile.h" @@ -68,13 +64,8 @@ UINT32 guiEncyclopediaAimLogo; ///@} ///@{ buttons, graphics and regions for main page -#ifdef ENC_USE_BUTTONSYSTEM INT32 giEncyclopediaBtn[ ENC_NUM_SUBPAGES ]; INT32 giEncyclopediaBtnImage; -#else -MOUSE_REGION gEncyclopediaBtnRegions[ ENC_NUM_SUBPAGES ]; -UINT32 guiEncyclopediaBtnImage; -#endif #define ENC_BTN_GAP 6 #define ENC_AIMLOGO_GAP_TOP 20 #define ENC_AIMLOGO_GAP_BOTTOM 40 @@ -85,11 +76,7 @@ ENC_SUBPAGE_T geENC_SubPage; ///< Current sub page /////// //prototypes -#ifdef ENC_USE_BUTTONSYSTEM void BtnEncyclopedia_newSelectDataPageBtnCallBack ( GUI_BUTTON *btn, INT32 reason ); -#else -void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason ); -#endif /////// //functions @@ -108,11 +95,8 @@ void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, IN void GameInitEncyclopedia_NEW() { // initialize gui handles -#ifdef ENC_USE_BUTTONSYSTEM memset( giEncyclopediaBtn, BUTTON_NO_SLOT, sizeof(giEncyclopediaBtn) ); giEncyclopediaBtnImage = BUTTON_NO_IMAGE; -#else -#endif // check for files only on start of JA2 CHECKV( guiCurrentScreen == 0 && gGameExternalOptions.gEncyclopedia ); @@ -178,7 +162,6 @@ BOOLEAN EnterEncyclopedia_NEW( ) CHECKF(hVObject);CHECKF(hVObject->pETRLEObject); logoBottomY = hVObject->pETRLEObject->usHeight + LAPTOP_SCREEN_WEB_UL_Y + ENC_AIMLOGO_GAP_TOP; -#ifdef ENC_USE_BUTTONSYSTEM//use button system ////// // load button graphic for the data pages giEncyclopediaBtnImage = LoadButtonImage( "ENCYCLOPEDIA\\CONTENTBUTTON.STI", BUTTON_NO_IMAGE, 0, BUTTON_NO_IMAGE , 0, BUTTON_NO_IMAGE ); @@ -202,34 +185,6 @@ BOOLEAN EnterEncyclopedia_NEW( ) GetButtonPtr( giEncyclopediaBtn[ i ] )->fShiftImage = TRUE; //SpecifyButtonSoundScheme( giEncyclopediaDataBtn[ i ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); } -#else - ////// - // load button graphic for the data pages - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP( "ENCYCLOPEDIA\\CONTENTBUTTON.STI", VObjectDesc.ImageFile ); - CHECKF( AddVideoObject( &VObjectDesc, &guiEncyclopediaBtnImage ) ); - ////// - // create mouse regions for data buttons and set user data - GetVideoObject( &hVObject, guiEncyclopediaBtnImage ); - CHECKF(hVObject);CHECKF(hVObject->pETRLEObject); - buttonSizeX = hVObject->pETRLEObject->usWidth;//get width of buttons from image - buttonSizeY = hVObject->pETRLEObject->usHeight;//get heigth of buttons from image - - for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ ) - { - MSYS_DefineRegion( &gEncyclopediaBtnRegions[i], - LAPTOP_SCREEN_UL_X + (LAPTOP_SCREEN_WIDTH)/2 - buttonSizeX/2,//upper left x: center of laptop screen - 1/2 buttonsize - logoBottomY + ENC_AIMLOGO_GAP_BOTTOM + i * (ENC_BTN_GAP + buttonSizeY),//upper left y: below logo + logo gap + previous buttons and button gaps - LAPTOP_SCREEN_UL_X + (LAPTOP_SCREEN_WIDTH)/2 + buttonSizeX/2,//lower right x: center of laptop screen + 1/2 buttonsize - logoBottomY + ENC_AIMLOGO_GAP_BOTTOM + buttonSizeY + i * (ENC_BTN_GAP + buttonSizeY),//lower right y: below logo + logo gap + button height + previous buttons and button gaps - MSYS_PRIORITY_HIGH,//priority - CURSOR_WWW,//cursor - MSYS_NO_CALLBACK,//moveCB - BtnEncyclopedia_newSelectDataPageRegionCallBack); - MSYS_SetRegionUserData( &gEncyclopediaBtnRegions[i], 0, i + 1 ); - CHECKF( MSYS_AddRegion( &gEncyclopediaBtnRegions[i] ) ); - } -#endif return TRUE; } @@ -252,7 +207,6 @@ BOOLEAN ExitEncyclopedia_NEW( ) // destroy AIM logo success &= DeleteVideoObjectFromIndex( guiEncyclopediaAimLogo ); -#ifdef ENC_USE_BUTTONSYSTEM//use button system // destroy buttons for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ ) if ( giEncyclopediaBtn[ i ] != BUTTON_NO_SLOT ) @@ -270,13 +224,6 @@ BOOLEAN ExitEncyclopedia_NEW( ) } else success = FALSE; -#else - // destroy button graphic - success &= DeleteVideoObjectFromIndex( guiEncyclopediaBtnImage ); - // destroy mouseregions for buttons - for (UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++) - MSYS_RemoveRegion( &gEncyclopediaBtnRegions[i] ); -#endif return success; } @@ -303,20 +250,7 @@ void RenderEncyclopedia_NEW( ) CHECKV( BltVideoObjectFromIndex( FRAME_BUFFER, guiEncyclopediaAimLogo, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ) ); // render Buttons for Data pages -#ifdef ENC_USE_BUTTONSYSTEM RenderButtons(); -#else - for ( UINT8 i = 0; i < ENC_NUM_SUBPAGES; i++ ) - { - x = gEncyclopediaBtnRegions[ i ].RegionTopLeftX; - y = gEncyclopediaBtnRegions[ i ].RegionTopLeftY; - //Btn graphic - CHECKV( BltVideoObjectFromIndex( FRAME_BUFFER, guiEncyclopediaBtnImage, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ) ); - //Btn text - y += (gEncyclopediaBtnRegions[ i ].RegionBottomRightY - y)/2 - GetFontHeight( FONT12ARIAL )/2; - DrawTextToScreen( pMenuStrings[ i ], x, y, (UINT16)gEncyclopediaBtnRegions[ i ].RegionBottomRightX - x, FONT12ARIAL, FONT_FCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - } -#endif // finish render CHECKV ( RenderWWWProgramTitleBar() ); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); @@ -401,7 +335,6 @@ void ChangingEncyclopediaSubPage( UINT8 ubSubPageNumber ) ////////////// //Callback functions -#ifdef ENC_USE_BUTTONSYSTEM//use button system void BtnEncyclopedia_newSelectDataPageBtnCallBack( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -430,35 +363,5 @@ void BtnEncyclopedia_newSelectDataPageBtnCallBack( GUI_BUTTON *btn, INT32 reason InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } -#else -/** -* @brief Callback for data page buttons. -* Userdata at index 0 is used to determine which button is pressed. -*/ -void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason ) -{ - CHECKV( gGameExternalOptions.gEncyclopedia ); - if (iReason & MSYS_CALLBACK_REASON_INIT) - { - } - else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { - UINT8 selectedButton = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); - - if( selectedButton == 0 ) - { - guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; - } - else if( selectedButton > 0 && selectedButton <= ENC_NUM_SUBPAGES ) - { - ChangingEncyclopediaSubPage ( selectedButton ); - guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_DATA; - } - } - else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) - { - } -} -#endif #endif diff --git a/Standard Gaming Platform/Mss.h b/Standard Gaming Platform/Mss.h index c89f8e5d7..bd0e38b6b 100644 --- a/Standard Gaming Platform/Mss.h +++ b/Standard Gaming Platform/Mss.h @@ -277,12 +277,8 @@ extern "C" { #define DXDEF __declspec(dllexport) #else - #if 1 /*def __BORLANDC__*/ #define DXDEC extern #define DXDEF - #else - #define DXDEC __declspec(dllimport) - #endif #endif diff --git a/Standard Gaming Platform/PngLoader.cpp b/Standard Gaming Platform/PngLoader.cpp index b817851d1..88453b61d 100644 --- a/Standard Gaming Platform/PngLoader.cpp +++ b/Standard Gaming Platform/PngLoader.cpp @@ -179,62 +179,6 @@ bool IndexedSTIImage::addImage(UINT8 *data, UINT32 data_size, UINT32 image_width return true; -#if 0 - unsigned int uiBufferPos = 0; - - bool bZeroRun = false; - UINT8 uiRunLength = 0; - UINT8 *uiRunStartPosition = data; - if(*data == 0) - { - bZeroRun = true; - } - bool done = false; - UINT32 scanline = 0; - while(!done) - { - if(bZeroRun) - { - while((*data == 0) && (uiRunLength < 128) && (uiBufferPos < data_size) && (scanline < image_width)) - { - data++; - uiRunLength++; - uiBufferPos++; - scanline++; - } - uiRunStartPosition = compressed; - *compressed++ = uiRunLength | iCOMPRESS_TRANSPARENT; - compressed_size += 1; - } - else - { - uiRunStartPosition = compressed++; - while((*data != 0) && (uiRunLength < 128) && (uiBufferPos < data_size) && (scanline < image_width)) - { - *compressed++ = *data++; - uiRunLength++; - uiBufferPos++; - scanline++; - } - *uiRunStartPosition = uiRunLength; - compressed_size += uiRunLength+1; - } - // prepare next run - uiRunLength = 0; - bZeroRun = (*data != 0) ? false : true; - if(scanline == image_width) - { - scanline = 0; - // "close" scanline with a zero - *compressed++ = 0; - compressed_size += 1; - } - if(uiBufferPos >= data_size) - { - done = true; - } - } -#endif } @@ -870,7 +814,6 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents) void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info) { -#if 1 hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject)); if(!hImage->pETRLEObject) { @@ -908,37 +851,6 @@ void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info) } hImage->fFlags |= IMAGE_BITMAPDATA; -#else - UINT32 SIZE = info->height * info->width; - hImage->p16BPPData = new UINT16[SIZE]; - memset(hImage->p16BPPData, 0, SIZE*sizeof(UINT16)); - UINT16* dest_row = NULL; - UINT32 rgbcolor = 0; - for(unsigned int i=0; iheight; ++i) - { - dest_row = &(hImage->p16BPPData[i*info->width]); - png_bytep row_i = rows[i]; - for(unsigned int sx = 0, dx = 0; sx < 4*info->width; sx+=4, dx+=1) - { - if(row_i[sx+3] == 255) - { - rgbcolor = FROMRGB(row_i[sx], row_i[sx+1], row_i[sx+2]); - if(rgbcolor == 0) - { - // since we already use rgb(0,0,0) as a fully transparent color, - // the color black will be mapped to rgb(0,1,0), because green has the most bits - //rgbcolor = 1 << 8; - rgbcolor = FROMRGB(0,1,0); - } - dest_row[dx] = Get16BPPColor(rgbcolor); - } - else - { - dest_row[dx] = Get16BPPColor(0); - } - } - } -#endif } @@ -1039,65 +951,6 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in SGP_THROW_IFFALSE( etrle_size > 0, L"ETRLE compression of PNG image failed" ); subim.sOffsetX = subimage.sOffsetX; subim.sOffsetY = subimage.sOffsetY; -#if 0 - unsigned int uiBufferPos = 0; - - bool bZeroRun = false; - UINT8 uiRunLength = 0; - UINT8 *uiRunStartPosition = data; - if(*data == 0) - { - bZeroRun = true; - } - bool done = false; - UINT32 scanline = 0; - while(!done) - { - if(bZeroRun) - { - while((*data == 0) && (uiRunLength < 128) && (uiBufferPos < SIZE) && (scanline < info->width)) - { - data++; - uiRunLength++; - uiBufferPos++; - scanline++; - } - uiRunStartPosition = compressed; - *compressed++ = uiRunLength | COMPRESS_TRANSPARENT; - compressed_size += 1; - *compressed++ = 0; - compressed_size += 1; - } - else - { - uiRunStartPosition = compressed++; - while((*data != 0) && (uiRunLength < 128) && (uiBufferPos < SIZE) && (scanline < info->width)) - { - *compressed++ = *data++; - uiRunLength++; - uiBufferPos++; - scanline++; - } - *uiRunStartPosition = uiRunLength | COMPRESS_NON_TRANSPARENT; - compressed_size += uiRunLength+1; - } - // prepare next run - uiRunLength = 0; - bZeroRun = (*data != 0) ? false : true; - if(scanline == info->width) - { - scanline = 0; - // "close" scanline with a zero - *compressed++ = 0; - compressed_size += 1; - } - if(uiBufferPos >= SIZE) - { - done = true; - } - } - UINT32 etrle_size = compressed_size; -#endif //subimage.uiDataLength = compressed_size; subimage.uiDataLength = etrle_size; subimage.uiDataOffset = 0; diff --git a/Standard Gaming Platform/himage.cpp b/Standard Gaming Platform/himage.cpp index 08d8dcaf9..f2c84bdd7 100644 --- a/Standard Gaming Platform/himage.cpp +++ b/Standard Gaming Platform/himage.cpp @@ -129,86 +129,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test CHAR8 ExtensionSep[] = "."; UINT32 iFileLoader; -#if 0 - SGPFILENAME Extension; - STR StrPtr; - - // Depending on extension of filename, use different image readers - // Get extension - StrPtr = strstr( ImageFile, ExtensionSep ); - - if ( StrPtr == NULL ) - { - // No extension given, use default internal loader extension - DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "No extension given, using default" ); - strcat( ImageFile, ".PCX" ); - strcpy( Extension, ".PCX" ); - } - else - { - strcpy( Extension, StrPtr+1 ); - } - - // Determine type from Extension - do - { - iFileLoader = UNKNOWN_FILE_READER; - - if ( _stricmp( Extension, "PCX" ) == 0 ) - { - iFileLoader = PCX_FILE_READER; - break; - } - else if ( _stricmp( Extension, "TGA" ) == 0 ) - { - iFileLoader = TGA_FILE_READER; - break; - } - else if ( _stricmp( Extension, "STI" ) == 0 ) - { -#ifdef USE_VFS - // see if there is a .jpc file first and when that fails, try .sti - vfs::Path str(ImageFile); - vfs::String::str_t const& findext = str.c_wcs(); - vfs::String::size_t dot = findext.find_last_of(vfs::Const::DOT()); - vfs::String fname = findext.substr(0,dot).append(CONST_DOTJPC); - if(getVFS()->fileExists(fname)) - { - iFileLoader = JPC_FILE_READER; - strncpy(ImageFile, fname.utf8().c_str(), fname.length()); - ImageFile[fname.length()] = 0; - break; - } -#endif - iFileLoader = STCI_FILE_READER; - break; - } - else if ( _stricmp( Extension, "PNG" ) == 0 ) - { - iFileLoader = PNG_FILE_READER; - break; - } -#ifdef USE_VFS - else if ( vfs::StrCmp::Equal(Extension, L"jpc.7z") ) - { - iFileLoader = JPC_FILE_READER; - break; - } -#endif - } while ( FALSE ); - - // Determine if resource exists before creating image structure - if ( !FileExists( ImageFile ) ) - { - //If in debig, make fatal! -#ifdef _DEBUG - //FatalError( "Resource file %s does not exist.", ImageFile ); -#endif - DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, String("Resource file %s does not exist.", ImageFile) ); - - return( NULL ); - } -#else std::string filename(ImageFile); iFileLoader = ImageFileType::getFileReaderType(filename, order); if ( iFileLoader == UNKNOWN_FILE_READER ) @@ -222,7 +142,6 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::Test return( NULL ); } -#endif // Create memory for image structure hImage = (HIMAGE)MemAlloc( sizeof( image_type ) ); diff --git a/Standard Gaming Platform/impTGA.cpp b/Standard Gaming Platform/impTGA.cpp index 15f2d89db..8c4564c06 100644 --- a/Standard Gaming Platform/impTGA.cpp +++ b/Standard Gaming Platform/impTGA.cpp @@ -269,29 +269,6 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui hImage->fFlags |= IMAGE_BITMAPDATA; } - #if 0 - // 32 bit not yet allowed in SGP - else if ( uiImagePixelSize == 32 ) - { - iNumValues = uiWidth * uiHeight; - - for ( i=0 ; i "; - - // Reset the pressed keys - gfKeyState[ ALT ] = FALSE; - gfKeyState[ 219 ] = FALSE; // "\" -#endif } } } @@ -1018,30 +1006,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC SHOWEXCEPTION(ex); } -#if 0 - 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(); - - // After this frame, reset input given flag - gfSGPInputReceived = FALSE; - } - } - } -#endif // This is the normal exit point diff --git a/Standard Gaming Platform/shading.cpp b/Standard Gaming Platform/shading.cpp index 0480410fa..321551393 100644 --- a/Standard Gaming Platform/shading.cpp +++ b/Standard Gaming Platform/shading.cpp @@ -232,29 +232,6 @@ void BuildIntensityTable(void) -#if 0 - - UINT32 lumin; - UINT32 rmod, gmod, bmod; - - for(red=0; red < 256; red+=4) - for(green=0; green < 256; green+=4) - for(blue=0; blue < 256; blue+=4) - { - index=Get16BPPColor(FROMRGB(red, green, blue)); - - lumin=( red*299/1000)+ ( green*587/1000 ) + ( blue*114/1000 ); - - //lumin = __min(lumin, 255); - rmod=(255*lumin)/256; - gmod=(100*lumin)/256; - bmod=(100*lumin)/256; - - //rmod = __m( 255, rmod ); - - IntensityTable[index]=Get16BPPColor( FROMRGB( rmod, gmod , bmod ) ); - } -#endif diff --git a/Standard Gaming Platform/stringicmp.cpp b/Standard Gaming Platform/stringicmp.cpp index b354b5796..b1881ed43 100644 --- a/Standard Gaming Platform/stringicmp.cpp +++ b/Standard Gaming Platform/stringicmp.cpp @@ -11,20 +11,6 @@ bool TStringiLess::operator() (std::string const& s1, std::string const& s2) con // An MSVC compliance issue... //using std::toupper; -#if 0 - std::string::const_iterator p1 = s1.begin(); - std::string::const_iterator p2 = s2.begin(); - - while (p1 != s1.end() && p2 != s2.end() && toupper(*p1) == toupper(*p2)) { - ++p1; - ++p2; - } - - if (p1 == s1.end()) return p2 != s2.end(); - if (p2 == s2.end()) return false; - - return toupper(*p1) < toupper(*p2); -#else const char *p1 = s1.c_str(); const char *p2 = s2.c_str(); @@ -37,5 +23,4 @@ bool TStringiLess::operator() (std::string const& s1, std::string const& s2) con if (!*p2) return false; return toupper(*p1) < toupper(*p2); -#endif } diff --git a/Standard Gaming Platform/video.cpp b/Standard Gaming Platform/video.cpp index 6104b6792..0432e5121 100644 --- a/Standard Gaming Platform/video.cpp +++ b/Standard Gaming Platform/video.cpp @@ -1493,13 +1493,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr #endif -#if 0 - 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 for ( cnt = 0; cnt < usNumStrips; cnt++ ) { @@ -1596,28 +1589,6 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr ExecuteVideoOverlaysToAlternateBuffer( BACKBUFFER ); -#if 0 - - // Erase mouse from old position - if (gMouseCursorBackground[ uiCurrentMouseBackbuffer ].fRestore == TRUE ) - { - - do - { - ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, usMouseXPos, usMouseYPos, gMouseCursorBackground[uiCurrentMouseBackbuffer].pSurface, (LPRECT)&MouseRegion, DDBLTFAST_NOCOLORKEY); - if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) - { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); - - if (ReturnCode == DDERR_SURFACELOST || (IS_ERROR(ReturnCode) && ++iDXLoopCount > iMaxDXLoopCount)) - { - - } - } - } while (ReturnCode != DD_OK); - } - -#endif } @@ -1786,14 +1757,6 @@ void RefreshScreen(void *DummyVariable) // Either Method (1) or (2) // { -#if 0 - if ( gfRenderScroll ) - { - ScrollJA2Background( guiScrollDirection, gsScrollXIncrement, gsScrollYIncrement, gpPrimarySurface, gpBackBuffer, TRUE, PREVIOUS_MOUSE_DATA ); - // ScrollJA2Background( guiScrollDirection, gsScrollXIncrement, gsScrollYIncrement, gpBackBuffer, gpBackBuffer, TRUE, PREVIOUS_MOUSE_DATA ); - gfForceFullScreenRefresh = TRUE; - } -#endif if (gfForceFullScreenRefresh == TRUE) { // diff --git a/Standard Gaming Platform/vobject.cpp b/Standard Gaming Platform/vobject.cpp index 505166699..67bb59ce9 100644 --- a/Standard Gaming Platform/vobject.cpp +++ b/Standard Gaming Platform/vobject.cpp @@ -922,18 +922,10 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE case 32: SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images"); image = &hSrcVObject->p16BPPObject[usIndex]; -#if 0 - Blt16BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES, - image->p16BPPData, image->usWidth * sizeof(UINT16), - iDestX, iDestY, - 0, 0, image->usWidth, image->usHeight, - 0 ); -#else Blt32BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES, (UINT32*)image->p16BPPData, image->usWidth * sizeof(UINT32), iDestX, iDestY, 0, 0, image->usWidth, image->usHeight); -#endif break; case 16: diff --git a/Standard Gaming Platform/vobject_blitters.cpp b/Standard Gaming Platform/vobject_blitters.cpp index 8d527293c..999aa63e6 100644 --- a/Standard Gaming Platform/vobject_blitters.cpp +++ b/Standard Gaming Platform/vobject_blitters.cpp @@ -224,7 +224,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc //alpha = 255; if(alpha > 0) { -#if 1 // the darker shade tmpVal = ShadeTable[*pDstPtr]; @@ -249,9 +248,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc newcolor = FROMRGB(red,green,blue); *pDstPtr = Get16BPPColor(newcolor); -#else - *pDstPtr = ShadeTable[*pDstPtr]; -#endif } pSrcPtr++; pDstPtr++; @@ -7258,7 +7254,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI pDestPtr = (UINT16*)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2)); uiLineSkipDest = uiDestPitch - (uiWidth*2); uiLineSkipSrc = uiSrcPitch - (uiWidth*2); -#if 1 do { UINT32 w = uiWidth; @@ -7273,36 +7268,6 @@ BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UI pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest); } while (--uiHeight != 0); -#else -__asm { - mov esi, pSrcPtr - mov edi, pDestPtr - mov ebx, uiHeight - mov dx, usTrans - -BlitNewLine: - mov ecx, uiWidth - -Blit2: - mov ax, [esi] - cmp ax, dx - je Blit3 - - mov [edi], ax - -Blit3: - add esi, 2 - add edi, 2 - dec ecx - jnz Blit2 - - add edi, uiLineSkipDest - add esi, uiLineSkipSrc - dec ebx - jnz BlitNewLine - - } -#endif return(TRUE); } @@ -7318,7 +7283,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS pDestPtr = (UINT16*)((UINT8 *)pDest + (iDestYPos * uiDestPitch) + (iDestXPos * 2)); uiLineSkipDest = uiDestPitch - (uiWidth * 2); uiLineSkipSrc = uiSrcPitch - (uiWidth * 2); -#if 1 do { UINT32 w = uiWidth; @@ -7336,7 +7300,6 @@ BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pS pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest); } while (--uiHeight != 0); -#endif return TRUE; } @@ -9649,51 +9612,6 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha(UINT16 *pBuffer, UINT32 uiDe } -#if 0 - -BlitNTL4: - - // TEST FOR Z FIRST! - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL8 - - // Write it NOW! - jmp BlitNTL7 - -BlitNTL8: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL9 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - // Write normal z value - mov ax, usZValue - mov [ebx], ax - jmp BlitNTL10 - -BlitNTL9: - - // Write high z - mov ax, 32767 - mov [ebx], ax - -BlitNTL10: - - xor eax, eax - mov al, [esi] - mov ax, [edx+eax*2] - mov [edi], ax -#endif /********************************************************************************************** diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 087ec7e1a..08a983644 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2205,17 +2205,6 @@ void CreateAutoResolveInterface() ubGreenMilitia += bonusGreenMilitia; // This block should be unnecessary. If the counts do not line up, there is a bug. -#if 0 - while( ubEliteMilitia + ubRegMilitia + ubGreenMilitia < gpAR->ubCivs ) - { - switch( PreRandom( 3 ) ) - { - case 0: ubEliteMilitia++; break; - case 1: ubRegMilitia++; break; - case 2: ubGreenMilitia++; break; - } - } -#endif cnt = 0; // Add the militia in this sector diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index ba2fa54ec..284a05d90 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -102,17 +102,6 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) BOOLEAN bMercDayOne = FALSE; // BF : file access is bad, especially if a function is called so often. -#if 0 - // Kaiden: Opening the INI File - CIniReader iniReader("..\\Ja2_Options.ini"); - - if(is_networked) memset(&iniReader, 0, sizeof (CIniReader) );//disable ini in mp (taking default values) - - //Kaiden: Getting Value for MERC Available on Day one? - // for some reason, this can't be in gamesettings.cpp - // or it won't work. - bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE); -#endif DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent"); if( gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents && _KeyDown( NUM_LOCK ) ) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index c379eab2b..e799bb236 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -12786,22 +12786,7 @@ static bool locationStringToCoordinates_AltSector(std::string loc, UINT8* x, UIN } // gather column -#if 0 - loc = loc.substr(1); - stringstream ss = stringstream(); - if (loc[0] >= '0' && loc[0] <= '9') - { - ss << loc[0]; - loc = loc.substr(1); - } - if (loc[0] >= '0' && loc[0] <= '9') - { - ss << loc[0]; - loc = loc.substr(1); - } -#else stringstream ss(loc.substr(1)); -#endif int col = 0; ss >> col; if (col >= 1 && col <= 16) @@ -12840,22 +12825,7 @@ static bool locationStringToCoordinates(std::string loc, UINT8* x, UINT8* y, UIN } // gather column -#if 0 - loc = loc.substr(1); - stringstream ss = stringstream(); - if (loc[0] >= '0' && loc[0] <= '9') - { - ss << loc[0]; - loc = loc.substr(1); - } - if (loc[0] >= '0' && loc[0] <= '9') - { - ss << loc[0]; - loc = loc.substr(1); - } -#else stringstream ss(loc); -#endif int col = 0; ss >> col; if (col >= 1 && col <= 16) diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index c0ab1771a..2d3334b63 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -1091,24 +1091,8 @@ void SaveSeenAndUnseenItems( void ) //make list of seen items for ( UINT32 i = 0; i < pInventoryPoolList.size(); i++ ) { -#if 0 - if ( pInventoryPoolList[ i ].object.exists() ) - { - pInventoryPoolList[ i ].fExists = TRUE; - pInventoryPoolList[ i ].bVisible = TRUE; - //Check - if(TileIsOutOfBounds( pInventoryPoolList[ i ].sGridNo) && !( pInventoryPoolList[ i ].usFlags & WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT ) ) - { - pInventoryPoolList[ i ].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.", pInventoryPoolList[ i ].object.usItem, ItemNames[ pInventoryPoolList[ i ].object.usItem] ); - } - -#else if ( pInventoryPoolList[i].fExists ) { -#endif worldItemsSaveList.push_back(pInventoryPoolList[i]); iExistingItems++; } @@ -3625,45 +3609,6 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) { SOLDIERTYPE *pSoldier = NULL; static BOOLEAN fItemWasHighLighted = FALSE; -#if 0 - if( iCurrentSlot == -1 ) - { - giCompatibleItemBaseTime = 0; - } - - if( fChangedInventorySlots == TRUE ) - { - giCompatibleItemBaseTime = 0; - fChangedInventorySlots = FALSE; - } - - // reset the base time to the current game clock - if( giCompatibleItemBaseTime == 0 ) - { - giCompatibleItemBaseTime = GetJA2Clock( ); - - if( fItemWasHighLighted == TRUE ) - { - fTeamPanelDirty = TRUE; - fMapPanelDirty = TRUE; - fItemWasHighLighted = FALSE; - } - } - - ResetCompatibleItemArray( ); - ResetMapSectorInventoryPoolHighLights( ); - - if( iCurrentSlot == -1 ) - { - return; - } - - // Check also that we're not beyond the resize. - if (pInventoryPoolList.size() < (UINT32)(iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) )) - { - return; - } -#else //if same slot then before dont recalculate if ( !fChangedInventorySlots ) return; @@ -3689,36 +3634,10 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) } return; } -#endif // given this slot value, check if anything in the displayed sector inventory or on the mercs inventory is compatable if( fShowInventoryFlag ) { -#if 0 - // check if any compatable items in the soldier inventory matches with this item - if( gfCheckForCursorOverMapSectorInventoryItem ) - { - pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; - if( pSoldier ) - { - if( HandleCompatibleAmmoUIForMapScreen( pSoldier, iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ), TRUE, FALSE ) ) - { - if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 ) - { - if( fItemWasHighLighted == FALSE ) - { - fTeamPanelDirty = TRUE; - fItemWasHighLighted = TRUE; - } - } - } - } - } - else - { - giCompatibleItemBaseTime = 0; - } -#else //Soldier inventory is shown, highlight those items pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; if( pSoldier ) @@ -3729,40 +3648,17 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) } fTeamPanelDirty = TRUE; } -#endif } // now handle for the sector inventory if( fShowMapInventoryPool ) { -#if 0 - // check if any compatable items in the soldier inventory matches with this item - if( gfCheckForCursorOverMapSectorInventoryItem ) - { - if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) ) - { - if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 ) - { - if( fItemWasHighLighted == FALSE ) - { - fItemWasHighLighted = TRUE; - fMapPanelDirty = TRUE; - } - } - } - } - else - { - giCompatibleItemBaseTime = 0; - } -#else if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) ) { fItemWasHighLighted = TRUE;//remember that something is highlighted } fMapPanelDirty = TRUE; -#endif } fChangedInventorySlots = FALSE; @@ -3870,79 +3766,11 @@ void CheckGridNoOfItemsInMapScreenMapInventory() void SortSectorInventory( std::vector& pInventory, UINT32 uiSizeOfArray ) { -#if 0//dnl ch75 011113 return code from v1.12 as current one is terrible slow - //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); - } - } -#else #if _ITERATOR_DEBUG_LEVEL > 1//dnl ch75 061113 under debug VS2010 throws exceptions after qsort but not under VS2005 and VS2008, all release version seems to work fine std::sort(pInventory.begin(), pInventory.begin() + uiSizeOfArray); #else qsort((LPVOID)&pInventory.front(), (size_t)uiSizeOfArray, sizeof(WORLDITEM), MapScreenSectorInventoryCompare); #endif -#endif } INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2) @@ -3955,31 +3783,10 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2) UINT16 ubItem2Quality; //dnl ch75 071113 without below fix sort will create mess when use empty slots because fExists remain TRUE after item is removed from inventory so decide to rather check ubNumberOfObjects -#if 0 - if(!(pFirst->fExists && pFirst->object.ubNumberOfObjects && pFirst->object.usItem) && (pFirst->fExists | pFirst->object.ubNumberOfObjects | pFirst->object.usItem)) - { - pFirst->fExists = FALSE; - pFirst->object.ubNumberOfObjects = 0; - pFirst->object.usItem = NONE; - return(1); - } - if(!(pSecond->fExists && pSecond->object.ubNumberOfObjects && pSecond->object.usItem) && (pSecond->fExists | pSecond->object.ubNumberOfObjects | pSecond->object.usItem)) - { - pSecond->fExists = FALSE; - pSecond->object.ubNumberOfObjects = 0; - pSecond->object.usItem = NONE; - return(-1); - } - if(!pFirst->fExists) - return(1); - if(!pSecond->fExists) - return(-1); -#else if(!pFirst->object.ubNumberOfObjects) return(1); if(!pSecond->object.ubNumberOfObjects) return(-1); -#endif usItem1Index = pFirst->object.usItem; usItem2Index = pSecond->object.usItem; @@ -4157,20 +3964,7 @@ BOOLEAN SortInventoryPoolQ(void) { if(pInventoryPoolList.size() > 0) { -#if 0//dnl ch75 311013 - for(INT32 iSlotCounter=0; iSlotCounter<(INT32)pInventoryPoolList.size(); iSlotCounter++) - if(pInventoryPoolList[iSlotCounter].object.usItem == NOTHING && pInventoryPoolList[iSlotCounter].object.exists() == false) - { - pInventoryPoolList[iSlotCounter].fExists = FALSE; - pInventoryPoolList[iSlotCounter].bVisible = FALSE; - } - SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size()); - iLastInventoryPoolPage = (pInventoryPoolList.size() - 1) / MAP_INVENTORY_POOL_SLOT_COUNT; - if(iCurrentInventoryPoolPage > iLastInventoryPoolPage) - iCurrentInventoryPoolPage = iLastInventoryPoolPage; -#else SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size()); -#endif } fMapPanelDirty = TRUE; return(TRUE); @@ -6227,9 +6021,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ... -#if 0//def JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperature ); -#endif (*itemStack)[i]->data.bTemperature = newguntemperature; // ... set new temperature @@ -6247,9 +6038,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO (*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature -#if 0//def JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature ); -#endif // we assume that there can exist only 1 underbarrel weapon per gun break; diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index 14e42d7d2..727ad39e1 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -1373,42 +1373,6 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier ) { AddCharacterToDeadList( pSoldier ); -#if 0 - //if the dead merc is in the current sector - if( pSoldier->sSectorX == gWorldSectorX && - pSoldier->sSectorY == gWorldSectorY && - pSoldier->bSectorZ == gbWorldSectorZ ) - { - TurnSoldierIntoCorpse( pSoldier, FALSE, FALSE ); - } - else - { - ROTTING_CORPSE_DEFINITION Corpse; - - // Setup some values! - Corpse.ubBodyType = pSoldier->ubBodyType; - Corpse.sGridNo = pSoldier->sInsertionGridNo; - Corpse.dXPos = pSoldier->dXPos; - Corpse.dYPos = pSoldier->dYPos; - Corpse.sHeightAdjustment = pSoldier->sHeightAdjustment; - - 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 ); - - Corpse.bDirection = pSoldier->ubDirection; - - // Set time of death - Corpse.uiTimeOfDeath = GetWorldTotalMin( ); - - // Set type - Corpse.ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ]; - - //Add the rotting corpse info to the sectors unloaded rotting corpse file - AddRottingCorpseToUnloadedSectorsRottingCorpseFile( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, &Corpse); - } -#endif return( TRUE ); } diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 2e0d25d9d..3efbaf952 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -1596,9 +1596,7 @@ void CheckForQuests( UINT32 uiDay ) { // This function gets called at 8:00 AM time of the day -#ifdef TESTQUESTS ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay ); -#endif #ifdef JA2UB // ------------------------------------------------------------------------------- @@ -1609,9 +1607,7 @@ void CheckForQuests( UINT32 uiDay ) if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED ) { StartQuest( QUEST_DESTROY_MISSLES, -1, -1 ); -#ifdef TESTQUESTS ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest"); -#endif } //Ja25: No deliver letter quest, dont start it #else @@ -1623,11 +1619,9 @@ void CheckForQuests( UINT32 uiDay ) if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED) { StartQuest( QUEST_DELIVER_LETTER, -1, -1 ); -#ifdef TESTQUESTS if (!is_networked) ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest"); -#endif } #endif // This quest gets turned OFF through conversation with Miguel - when user hands diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index d20658d74..9f1a5f398 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -45,58 +45,6 @@ void RemoveNonIntelItems(); UINT8 gubLastSpecialItemAddedAtElement = 255; // Flugente 2012-12-19: merchant data has been externalised - see XML_Merchants.cpp -#if 0 -// THIS STRUCTURE HAS UNCHANGING INFO THAT DOESN'T GET SAVED/RESTORED/RESET -// TODO: externalize -const ARMS_DEALER_INFO DefaultarmsDealerInfo[ NUM_ARMS_DEALERS ] = -{ - //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, 15000, 15000, 0, 1, 10, 1, 10, 2, 3, false, false }, -/* Franz Hinkle */ { 1.0f, 1.5f, FRANZ, ARMS_DEALER_BUYS_SELLS, 5000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 5000, 5000, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Keith Hemps */ { 0.75f, 1.0f, KEITH, ARMS_DEALER_BUYS_SELLS, 1500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 1500, 1500, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Jake Cameron */ { 0.8f, 1.1f, JAKE, ARMS_DEALER_BUYS_SELLS, 2500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 2500, 2500, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Gabby Mulnick*/ { 1.0f, 1.0f, GABBY, ARMS_DEALER_BUYS_SELLS, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, - -#ifdef JA2UB -/* Devin Connell*/ //ja25 ub Biggins//{ 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false }, -#else -/* Devin Connell*/ { 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false }, -#endif - -/* Howard Filmore*/ { 1.0f, 1.0f, HOWARD, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Sam Rozen */ { 1.0f, 1.0f, SAM, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Frank */ { 1.0f, 1.0f, FRANK, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 0, 100, 1, 2, false, true }, - -/* Bar Bro 1 */ { 1.0f, 1.0f, HERVE, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Bar Bro 2 */ { 1.0f, 1.0f, PETER, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Bar Bro 3 */ { 1.0f, 1.0f, ALBERTO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true }, -/* Bar Bro 4 */ { 1.0f, 1.0f, CARLO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS , 250, 250, 0, 1, 10, 0, 100, 1, 2, false, true }, - -/* Micky O'Brien*/ { 1.0f, 1.4f, MICKY, ARMS_DEALER_BUYS_ONLY, 10000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 10000, 10000, 0, 1, 10, 1, 10, 1, 2, false, true }, - - //Repair Repair - //Speed Cost -/* Arnie Brunzwell*/{ 0.1f, 0.8f, ARNIE, ARMS_DEALER_REPAIRS, 1500, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1500, 1500, 0, 1, 10, 1, 10, 1, 2, false, true }, -/* Fredo */ { 0.6f, 0.6f, FREDO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, -#ifdef JA2UB -/* Raul */ { 0.80f, 1.8f, PERKO, ARMS_DEALER_BUYS_SELLS, 20000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, -#else -/* Perko */ { 1.0f, 0.4f, PERKO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, -#endif - -/* Elgin */ { 1.0f, 1.0f, DRUGGIST, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true }, -/* Manny */ { 1.0f, 1.0f, MANNY, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true }, - -#ifdef JA2UB -/* Betty */ { 0.75f, 1.25f, 73, ARMS_DEALER_BUYS_SELLS, 10000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, -#endif - - -}; -#endif std::vector armsDealerInfo (NUM_ARMS_DEALERS); diff --git a/Tactical/GAP.cpp b/Tactical/GAP.cpp index 0b3cb6675..5478734aa 100644 --- a/Tactical/GAP.cpp +++ b/Tactical/GAP.cpp @@ -10,35 +10,6 @@ SUBSEQUENTSOUNDS subsequentsounds; -#if 0 -static void AILCALLBACK timer_func( UINT32 user ) -{ - AudioGapList *pGapList; - - pGapList = (AudioGapList*)user; - - 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->gap_monitor_current < pGapList->count ) - { - if ( ( pGapList->gap_monitor_timer / 1000) >= pGapList->start[ pGapList->gap_monitor_current ]) - { - pGapList->audio_gap_active = 1; - } - } - } -} -#endif void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList ) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index a438e5005..31e19f3ca 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -3920,14 +3920,6 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 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->pathing.bPathStored = FALSE; - } - else -#endif { pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1; } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index c993ec667..d914c65e9 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -2761,19 +2761,6 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } } -#if 0 - if ( gbInvalidPlacementSlot[ sPocket ] ) - { - if ( sPocket != SECONDHANDPOS ) - { - // If we are in inv panel and our guy is not = cursor guy... - if ( !gfSMDisableForItems ) - { - fHatchItOut = TRUE; - } - } - } -#endif if (AM_A_ROBOT(pSoldier) && sPocket == HANDPOS) fHatchItOut = FALSE; @@ -3808,7 +3795,6 @@ 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 ) { @@ -3833,7 +3819,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec gprintfinvalidate( sNewX, sNewY, pStr ); } } -#endif if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) { @@ -3941,35 +3926,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } } -#if 0 - else - { - 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 if ( ItemHasAttachments( pObject, pSoldier, iter ) ) { if ( !IsGrenadeLauncherAttached( pObject, iter ) ) diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 55bd75b2d..de7478ad3 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -594,13 +594,7 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index) bool OBJECTTYPE::exists() { -#if 0//dnl ch75 011113 - if(this == NULL) - return(FALSE); - return (ubNumberOfObjects > 0 && usItem != NOTHING); -#else return(this && ubNumberOfObjects && usItem); -#endif } void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 00ec359e4..358fb0a3d 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -3031,49 +3031,6 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject ) 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(UINT16 x = 0; x < invsize; ++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 } } } @@ -8458,19 +8415,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) { (*pObj).fFlags |= OBJECT_UNDROPPABLE; } -#if 0//dnl ch74 201013 create default attachments rather at gun status instead of 100% - for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++){ - if(Item [ usItem ].defaultattachments[cnt] == 0) - break; - - //cannot use gTempObject - OBJECTTYPE defaultAttachment; - CreateItem(Item [ usItem ].defaultattachments[cnt],100,&defaultAttachment); - pObj->AttachObject(NULL,&defaultAttachment, FALSE); - } -#else AttachDefaultAttachments(pObj);//dnl ch75 261013 -#endif } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateItem: return %d",fRet)); @@ -12644,42 +12589,6 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex) UINT16 usNumMatches = 0; UINT16 usRandom = 0; UINT16 lowestCoolness = LowestLaunchableCoolness(itemIndex); -#if 0 - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomLaunchable: itemIndex = %d", itemIndex)); - - // WANNE: This should fix the hang on the merc positioning screen (fix by Razer) - //while( !usNumMatches ) - { //Count the number of valid launchables - for( i = 0; i < MAXITEMS; ++i ) - { - if ( Item[i].usItemClass == 0 ) - break; - //Madd: quickfix: make it not choose best grenades right away. - if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) ) - usNumMatches++; - } - } - - if( usNumMatches ) - { - usRandom = (UINT16)Random( usNumMatches ); - for( i = 0; i < MAXITEMS; ++i ) - { - if ( Item[i].usItemClass == 0 ) - break; - - if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) ) - { - if( usRandom ) - usRandom--; - else - { - return i; - } - } - } - } -#endif // Flugente: the above code is highly dubious.. why do we loop over all items 2 times, and why that obscure usRandom--; business? This can cause an underflow! BOOLEAN isnight = NightTime(); diff --git a/Tactical/Keys.cpp b/Tactical/Keys.cpp index 306a1055c..f7c53fea0 100644 --- a/Tactical/Keys.cpp +++ b/Tactical/Keys.cpp @@ -1190,9 +1190,6 @@ BOOLEAN ModifyDoorStatus( INT32 sGridNo, BOOLEAN fOpen, BOOLEAN fPerceivedOpen ) if ( pBaseStructure == NULL ) { -#if 0 - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", sGridNo ); -#endif return( FALSE ); } @@ -1314,9 +1311,6 @@ BOOLEAN IsDoorOpen( INT32 sGridNo ) if ( pBaseStructure == NULL ) { -#if 0 - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", sGridNo ); -#endif return( FALSE ); } @@ -1527,9 +1521,6 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus ) if ( pBaseStructure == NULL ) { -#if 0 - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", pDoorStatus->sGridNo ); -#endif return; } @@ -1611,9 +1602,6 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse if ( pBaseStructure == NULL ) { -#if 0 - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", pDoorStatus->sGridNo ); -#endif return; } diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 6196e0e2e..0b97beff0 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4805,15 +4805,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, dDeltaX = dEndX - dStartX; dDeltaY = dEndY - dStartY; dDeltaZ = dEndZ - dStartZ; -#if 0//dnl ch60 020913 isn't true see reason in FireBulletGivenTarget - //lal bugfix - if( dDeltaZ > 0 ) - d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ ); - else - d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#else d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#endif iDistance = (INT32) d2DDistance; if ( d2DDistance != iDistance ) @@ -5304,15 +5296,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA dDeltaX = dEndX - dStartX; dDeltaY = dEndY - dStartY; dDeltaZ = dEndZ - dStartZ; -#if 0//dnl ch60 311009 this isn't correct, e.g. if you try head shot from prone to standing target at 1 tile, Distance3D will calculate 7,8 tile distance, this means that you will always hit target regard of CTH calculation, correct usage will be Distance3D(dDeltaX, dDeltaY, CONVERT_HEIGHTUNITS_TO_DISTANCE(dDeltaZ)) but we need here 2D distance as was in original v1.12 - //lal bugfix - if( dDeltaZ > 0 ) - d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ ); - else - d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#else d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#endif iDistance = (INT32) d2DDistance; if ( d2DDistance != iDistance ) @@ -5813,15 +5797,7 @@ INT8 FireFragmentGivenTarget( UINT8 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dDeltaX = dEndX - dStartX; dDeltaY = dEndY - dStartY; dDeltaZ = dEndZ - dStartZ; -#if 0//dnl ch60 030913 - //lal bugfix - if( dDeltaZ > 0 ) - d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ ); - else - d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#else d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#endif iDistance = (INT32) d2DDistance; if ( d2DDistance != iDistance ) @@ -5990,15 +5966,7 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT dDeltaX = dEndX - dStartX; dDeltaY = dEndY - dStartY; dDeltaZ = dEndZ - dStartZ; -#if 0//dnl ch60 030913 - //lal bugfix - if( dDeltaZ > 0 ) - d2DDistance = Distance3D( dDeltaX, dDeltaY, dDeltaZ ); - else - d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#else d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#endif iDistance = (INT32) d2DDistance; if ( d2DDistance != iDistance ) @@ -8584,11 +8552,7 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT /////////////////////////////////////////////////////////////////////// // Find distance between shooter and target, in points. FLOAT d2DDistance=0; -#if 0//dnl ch60 030913 - d2DDistance = Distance3D( dDeltaX, dDeltaY, CONVERT_HEIGHTUNITS_TO_DISTANCE( dDeltaZ ) ); -#else d2DDistance = Distance2D( dDeltaX, dDeltaY ); -#endif // Round it upwards. INT32 iDistance = (INT32) d2DDistance; if ( d2DDistance != iDistance ) diff --git a/Tactical/Map Information.cpp b/Tactical/Map Information.cpp index 24c5ff73e..0ff75813e 100644 --- a/Tactical/Map Information.cpp +++ b/Tactical/Map Information.cpp @@ -199,327 +199,6 @@ void SaveMapInformation(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMinorMapVe //loading and won't be permanently updated until the map is saved, regardless of changes. void UpdateOldVersionMap() { -#if 0 //This code is no longer needed since the major version update from 1.0 to 4.0 - //However, I am keeping it in for reference. - SOLDIERINITNODE *curr; - INT32 i; - LEVELNODE *pStruct; - //VERSION 0 -- obsolete November 14, 1997 - if( gMapInformation.ubMapVersion == 0 ) - { - //Soldier information contained two fixable bugs. - gMapInformation.ubMapVersion++; - curr = gSoldierInitHead; - while( curr ) - { - //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 - // which put it completely out of range. - if( curr->pBasicPlacement->bAttitude > 7 ) - curr->pBasicPlacement->bAttitude = (INT8)Random(8); - //go to next node - curr = curr->next; - } - } - //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 - // as well as certain decals found commonly in illegal places. - for( i = 0; i < WORLD_MAX; i++ ) - { - RemoveAllStructsOfTypeRange( i, FIRSTWALLDECAL, LASTWALLDECAL ); - RemoveAllStructsOfTypeRange( i, FIFTHWALLDECAL, SIXTHWALLDECAL ); - } - } - //VERSION 2 -- obsolete February 3, 1998 - if( gMapInformation.ubMapVersion == 2 ) - { - gMapInformation.ubMapVersion++; - curr = gSoldierInitHead; - while( curr ) - { - //Bug #04) Assign enemy mercs default army color code if applicable - if( curr->pBasicPlacement->bTeam == ENEMY_TEAM && !curr->pBasicPlacement->ubSoldierClass ) - { - if( !curr->pDetailedPlacement ) - { - curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; - } - else if( curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == NO_PROFILE ) - { - curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; - curr->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; - } - } - curr = curr->next; - } - } - //VERSION 3 -- obsolete February 9, 1998 - if( gMapInformation.ubMapVersion == 3 ) - { - gMapInformation.ubMapVersion++; - //Bug #05) Move entry points down if necessary. - ValidateEntryPointGridNo( &gMapInformation.sNorthGridNo ); - ValidateEntryPointGridNo( &gMapInformation.sEastGridNo ); - ValidateEntryPointGridNo( &gMapInformation.sSouthGridNo ); - ValidateEntryPointGridNo( &gMapInformation.sWestGridNo ); - } - //VERSION 4 -- obsolete February 25, 1998 - if( gMapInformation.ubMapVersion == 4 ) - { - gMapInformation.ubMapVersion++; - //6) Change all doors to FIRSTDOOR - for( i = 0; i < WORLD_MAX; ++i ) - { - //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 - pStruct = gpWorldLevelData[ i ].pStructHead; - while( pStruct ) - { - //outside topleft - if( pStruct->usIndex == 932 || pStruct->usIndex == 952 || pStruct->usIndex == 972 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 912 ); - break; - } - else if( pStruct->usIndex == 936 || pStruct->usIndex == 956 || pStruct->usIndex == 976 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 916 ); - break; - } - //outside topright - else if( pStruct->usIndex == 927 || pStruct->usIndex == 947 || pStruct->usIndex == 967 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 907 ); - break; - } - else if( pStruct->usIndex == 931 || pStruct->usIndex == 951 || pStruct->usIndex == 971 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 911 ); - break; - } - //inside topleft - else if( pStruct->usIndex == 942 || pStruct->usIndex == 962 || pStruct->usIndex == 982 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 922 ); - break; - } - else if( pStruct->usIndex == 946 || pStruct->usIndex == 966 || pStruct->usIndex == 986 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 926 ); - break; - } - //inside topright - else if( pStruct->usIndex == 937 || pStruct->usIndex == 957 || pStruct->usIndex == 977 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 917 ); - break; - } - else if( pStruct->usIndex == 941 || pStruct->usIndex == 961 || pStruct->usIndex == 981 ) - { - ReplaceStructIndex( i, pStruct->usIndex, 921 ); - break; - } - pStruct = pStruct->pNext; - } - } - } - //VERSION 5 -- obsolete March 4, 1998 - if( gMapInformation.ubMapVersion == 5 ) - { - gMapInformation.ubMapVersion++; - //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. - gMapInformation.ubMapVersion++; - curr = gSoldierInitHead; - while( curr ) - { - //Bug #04) Assign enemy mercs default army color code if applicable - if( curr->pDetailedPlacement ) - { - INT32 invsize = (INT32)curr->pDetailedPlacement->Inv.size(); - for( i = 0; i < invsize; ++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; - } - } - curr = curr->next; - } - } - //VERSION 7 -- obsolete April 14, 1998 - 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 - // current detailed placements will also have priority existance. - curr = gSoldierInitHead; - while( curr ) - { - if( curr->pDetailedPlacement ) - { - curr->pBasicPlacement->fPriorityExistance = TRUE; - } - curr = curr->next; - } - } - - if( gMapInformation.ubMapVersion == 14 ) - { //Toast all of the ambiguous road pieces that ended up wrapping the byte. - LEVELNODE *pStruct, *pStruct2; - INT32 i; - for( i = 0; i < WORLD_MAX; i++ ) - { - pStruct = gpWorldLevelData[ i ].pObjectHead; - if( pStruct && pStruct->usIndex == 1078 && i < WORLD_MAX-2 && i >= 320 ) - { //This is the only detectable road piece that we can repair. - pStruct2 = gpWorldLevelData[ i+1 ].pObjectHead; - if( pStruct2 && pStruct2->usIndex == 1081 ) - { - RemoveObject( i, pStruct->usIndex ); - RemoveObject( i+1, pStruct->usIndex+1 ); - RemoveObject( i+2, pStruct->usIndex+2 ); - RemoveObject( i-160, pStruct->usIndex-160 ); - RemoveObject( i-159, pStruct->usIndex-159 ); - RemoveObject( i-158, pStruct->usIndex-158 ); - RemoveObject( i-320, pStruct->usIndex-320 ); - RemoveObject( i-319, pStruct->usIndex-319 ); - RemoveObject( i-318, pStruct->usIndex-318 ); - AddObjectToTail( i, 1334 ); - AddObjectToTail( i-160, 1335 ); - AddObjectToTail( i-320, 1336 ); - AddObjectToTail( i+1, 1337 ); - AddObjectToTail( i-159, 1338 ); - AddObjectToTail( i-319, 1339 ); - AddObjectToTail( i+2, 1340 ); - AddObjectToTail( i-158, 1341 ); - AddObjectToTail( i-318, 1342 ); - } - } - else if( pStruct && pStruct->usIndex >= 1079 && pStruct->usIndex < 1115 ) - { - RemoveObject( i, pStruct->usIndex ); - } - } - } - - if( gMapInformation.ubMapVersion <= 7 ) - { - if( gfEditMode ) - { - #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Currently loaded map is corrupt! Allowing the map to load anyway!" ); - #endif - } - else - { - if( gbWorldSectorZ ) - { - AssertMsg( 0, String( "Currently loaded map (%c%d_b%d.dat) is invalid -- less than the minimum supported version.", gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); - } - else if( !gbWorldSectorZ ) - { - AssertMsg( 0, String( "Currently loaded map (%c%d.dat) is invalid -- less than the minimum supported version.", gWorldSectorY + 'A' - 1, gWorldSectorX ) ); - } - } - } - //VERSION 8 -- obsolete April 18, 1998 - if( gMapInformation.ubMapVersion == 8 ) - { - gMapInformation.ubMapVersion++; - //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 - //and there were two one byte fields cleared, fKillSlotIfOwnerDies and ubScheduleID - memset( &curr->pDetailedPlacement->fKillSlotIfOwnerDies, 0, 120 ); - } - curr = curr->next; - } - } - //Version 9 -- Kris -- obsolete April 27, 1998 - if( gMapInformation.ubMapVersion == 9 ) - { - gMapInformation.ubMapVersion++; - curr = gSoldierInitHead; - while( curr ) - { - //Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. - if( curr->pDetailedPlacement && curr->pDetailedPlacement->ubBodyType == CRIPPLECIV ) - { - curr->pDetailedPlacement->ubBodyType = COW; - curr->pBasicPlacement->ubBodyType = COW; - } - curr = curr->next; - } - } - if( gMapInformation.ubMapVersion < 12 ) - { - gMapInformation.ubMapVersion = 12; - gMapInformation.sCenterGridNo = -1; - } - if( gMapInformation.ubMapVersion < 13 ) - { //replace all merc ammo inventory slots status value with the max ammo that the clip can hold. - INT32 cnt; - OBJECTTYPE *pItem; - gMapInformation.ubMapVersion++; - //Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at - // fKillSlotIfOwnerDies. - curr = gSoldierInitHead; - while( curr ) - { - if( curr->pDetailedPlacement ) - { - UINT32 invsize = curr->pDetailedPlacement->Inv.size(); - for ( UINT32 i = 0; i < invsize; ++i ) - { - pItem = &curr->pDetailedPlacement->Inv[ i ]; - if( Item[ pItem->usItem ].usItemClass & IC_AMMO ) - { - for( cnt = 0; cnt < pItem->ubNumberOfObjects; ++cnt ) - { - pItem->shots.ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize; - } - } - } - } - curr = curr->next; - } - } - if( gMapInformation.ubMapVersion < 14 ) - { - gMapInformation.ubMapVersion++; - if( !gfCaves && !gfBasement ) - { - ReplaceObsoleteRoads(); - } - } - 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 - //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." ); diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index b69df0418..935d78524 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -299,21 +299,6 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) // If the sector is already loaded, don't add the existing militia for( x = 1; x < guiDirNumber ; ++x ) { -#if 0 - // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] ); - if( gfMSResetMilitia ) - { - if( gpAttackDirs[ x ][ 3 ] != INSERTION_CODE_CENTER ) - { - AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - ubGreen -= gpAttackDirs[ x ][0]; - ubRegs -= gpAttackDirs[ x ][1]; - ubElites -= gpAttackDirs[ x ][2]; - } - } - //else - //{ -#endif AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); } diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 0148b9a5e..7d37ee0ab 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -9296,11 +9296,6 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) { DebugAI(AI_MSG_INFO, pSoldier, String("CancelAIAction: suppression: change stance/cower")); CancelAIAction( pSoldier, TRUE ); -#if 0 - pSoldier->aiData.bAction = AI_ACTION_CHANGE_STANCE; - pSoldier->aiData.usActionData = ubNewStance; - pSoldier->aiData.bActionInProgress = TRUE; -#endif } // go for it! @@ -9642,38 +9637,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) UINT32 cnt; UINT8 ubID; -#if 0 - // 0verhaul: None of this is necessary anymore with the new attack busy system - if (ubID == NOBODY) - { - pSoldier = NULL; - pTarget = NULL; - } - else - { - pSoldier = MercPtrs[ ubID ]; - if ( ubTargetID != NOBODY) - { - pTarget = MercPtrs[ ubTargetID ]; - } - else - { - pTarget = NULL; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(">>Target ptr is null!" ) ); - } - } - - if (fCalledByAttacker) - { - if (pSoldier && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN) - { - if (pSoldier->bBulletsLeft > 0) - { - return( pTarget ); - } - } - } -#endif // if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) // { @@ -9798,15 +9761,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) return( NULL ); } #endif -#if 0 - // 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 - pTarget->bNumPelletsHitBy = 0; - // reset flag for making "ow" sound on being shot - } -#endif if (pSoldier) { @@ -10099,17 +10053,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) SOLDIERTYPE * ReduceAttackBusyCount( ) { -#if 0 - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyCount") ); - if ( ubID == NOBODY ) - { - return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, NOBODY ) ); - } - else - { - return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, MercPtrs[ ubID ]->ubTargetID ) ); - } -#endif // 0verhaul: This is now a simple subroutine. return InternalReduceAttackBusyCount( ); } @@ -10126,26 +10069,6 @@ SOLDIERTYPE * FreeUpAttacker( ) return( ReduceAttackBusyCount( ) ); } -#if 0 -// 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") ); - return( InternalReduceAttackBusyCount( ubID, TRUE, ubTargetID ) ); -} - -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") ); - return( InternalReduceAttackBusyCount( ubID, FALSE, ubTargetID ) ); -} -#endif void StopMercAnimation( BOOLEAN fStop ) diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 0ca1e1662..bdbfb146b 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -708,7 +708,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , guiTotalPathChecks++; #endif -#ifdef VEHICLE fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); if ( fMultiTile == false) @@ -758,7 +757,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , fContinuousTurnNeeded = FALSE; } } -#endif if (fContinuousTurnNeeded == false) { @@ -803,16 +801,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , { SetRenderFlags( RENDER_FLAG_FULL ); // The RenderCoverDebugInfo call is now made by RenderWorld. So don't try to call it here -#if 0 - if ( guiCurrentScreen == GAME_SCREEN ) - { - RenderWorld(); - RenderCoverDebug( ); - InvalidateScreen( ); - EndFrameBufferRender(); - RefreshScreen( NULL ); - } -#endif } #endif @@ -901,13 +889,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , if (gfDisplayCoverValues && gfDrawPathPoints) { SetRenderFlags( RENDER_FLAG_FULL ); -#if 0 - RenderWorld(); - RenderCoverDebug( ); - InvalidateScreen( ); - EndFrameBufferRender(); - RefreshScreen( NULL ); -#endif } #endif @@ -1088,7 +1069,6 @@ void AStarPathfinder::ExecuteAStarLogic() continue; } -#ifdef VEHICLE //has side effects, including setting loop counters int retVal = VehicleObstacleCheck(); if (retVal == 1) @@ -1099,7 +1079,6 @@ void AStarPathfinder::ExecuteAStarLogic() { return; } -#endif //calc the cost to move from the current node to here INT16 terrainCost = EstimateActionPointCost( pSoldier, CurrentNode, direction, movementMode, 0, 3 ); @@ -1769,7 +1748,6 @@ int AStarPathfinder::CalcH() int x = abs(n1->x - n2->x); int y = abs(n1->y - n2->y); -#if 1 if (x >= y) { return this->travelcostDiag * y + this->travelcostOrth * (x-y); @@ -1778,35 +1756,6 @@ int AStarPathfinder::CalcH() { return this->travelcostDiag * x + this->travelcostOrth * (y-x); } -#else - // Try a real distance method. This should underestimate in some cases - // However, the distances need to be increased for the moment because running orthogonal is 1AP while running diagonal is 2AP - // so the total to reach a diagonal tile is identical for 2 moves. So we have to trick the pathing calc into thinking it's - // a longer distance and also calculate the other costs accordingly. - - x *= 100; - y *= 100; - - int d = x*x + y*y; - int r = 1200; // Just a guess - - if (d == 0) - { - return d; - } - - while (1) - { - int gr = (r + (d/r)) / 2; - if (gr == r || gr == r+1) - { - break; - } - r = gr; - } - - return r * travelcostOrth; -#endif } #ifdef ASTAR_USING_EXTRACOVER @@ -2116,7 +2065,6 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA } #endif //#ifdef ASTAR_USING_EXTRACOVER -#ifdef VEHICLE void AStarPathfinder::InitVehicle() { fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); @@ -2263,7 +2211,6 @@ int AStarPathfinder::VehicleObstacleCheck() } return 0; } -#endif bool AStarPathfinder::WantToTraverse() { @@ -2523,7 +2470,6 @@ b=GetJA2Clock();//return s->sGridNo+6; INT32 iWaterToWater; INT16 ubCurAPCost,ubAPCost; INT16 ubNewAPCost=0; - #ifdef VEHICLE //BOOLEAN fTurnSlow = FALSE; //BOOLEAN fReverse = FALSE; // stuff for vehicles turning BOOLEAN fMultiTile, fVehicle; @@ -2534,7 +2480,6 @@ b=GetJA2Clock();//return s->sGridNo+6; UINT16 usAnimSurface; //INT32 iCnt2, iCnt3; BOOLEAN fVehicleIgnoreObstacles = FALSE; - #endif INT32 iLastDir = 0; @@ -2759,7 +2704,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) guiTotalPathChecks++; #endif -#ifdef VEHICLE fMultiTile = ((s->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); if (fMultiTile) @@ -2819,7 +2763,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) fContinuousTurnNeeded = FALSE; } -#endif if (!fContinuousTurnNeeded) { @@ -2962,7 +2905,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) } #endif -#ifdef VEHICLE /* if (fTurnSlow) { @@ -2987,7 +2929,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) } */ -#endif if (gubNPCAPBudget) { @@ -3048,7 +2989,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) //for ( iCnt = iLoopStart; iCnt != iLoopEnd; iCnt = (iCnt + iLoopIncrement) % MAXDIR ) for ( iCnt = iLoopStart; ; ) { -#ifdef VEHICLE /* if (fTurnSlow) { @@ -3130,7 +3070,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) } } -#endif newLoc = curLoc + dirDelta[iCnt]; @@ -3479,7 +3418,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) } } -#ifdef VEHICLE if (fMultiTile) { // vehicle test for obstacles: prevent movement to next tile if @@ -3518,7 +3456,6 @@ if(!GridNoOnVisibleWorldTile(iDestination)) } */ } -#endif // NEW Apr 21 by Ian: abort if cost exceeds budget if (gubNPCAPBudget) diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 53cbe3f14..e11740fc5 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -679,7 +679,6 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, // Get switch value... sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ]; -#if 1 //Moa: set to 0 to use original copy and paste code from ActionPointCost() if ( sSwitchValue == TRAVELCOST_FENCE ) { // If we are changeing stance ( either before or after getting there.... @@ -737,191 +736,6 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, sPoints += ActionPointCost( pSoldier, sGridNo, bDir, usMovementMode ); return (sPoints); -#else - // Tile cost should not be reduced based on movement mode... - if ( sSwitchValue == TRAVELCOST_FENCE ) - { - return( sTileCost ); - } - - - // WANNE.WATER: If our soldier is not on the ground level and the tile is a "water" tile, then simply set the tile to "FLAT_GROUND" - // This should fix "problems" for special modified maps - UINT8 ubTerrainID = gpWorldLevelData[ sGridNo ].ubTerrainID; - - if ( TERRAIN_IS_WATER( ubTerrainID) && pSoldier->pathing.bLevel > 0 ) - ubTerrainID = FLAT_GROUND; - - // ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER - if ( TERRAIN_IS_WATER( ubTerrainID) ) - { - 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) - { - /////////////////////////////////////////////////////////////////////////////////////////////////////////// - // SANDRO - This part have been modified "a bit" - // Check movement modifiers - switch( usMovementMode ) - { - case RUNNING: - case ADULTMONSTER_WALKING: - case BLOODCAT_RUN: - sPoints = sTileCost + APBPConstants[AP_MODIFIER_RUN]; - 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 : - case WALKING_ALTERNATIVE_RDY : - case SIDE_STEP_ALTERNATIVE_RDY : - sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK]; - if (!(pSoldier->MercInWater()) && ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) ) && !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) ) - { - sPoints += APBPConstants[AP_MODIFIER_READY]; - } - break; - case SIDE_STEP_WEAPON_RDY: - case SIDE_STEP_DUAL_RDY: - case WALKING_WEAPON_RDY: - case WALKING_DUAL_RDY: - sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; - break; - case START_SWAT: - case SWAT_BACKWARDS: - case SWATTING: - sPoints = sTileCost + APBPConstants[AP_MODIFIER_SWAT]; - break; - case CRAWLING: - sPoints = sTileCost + APBPConstants[AP_MODIFIER_CRAWL]; - break; - - default: - - // Invalid movement mode - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) ); - sPoints = sTileCost; - break; - } - - // Check for reverse mode - if ( pSoldier->bReverse || gUIUseReverse ) - sPoints += APBPConstants[AP_REVERSE_MODIFIER]; - - // STOMP traits - Athletics trait decreases movement cost - if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, ATHLETICS_NT )) - { - sPoints = max(1, (INT16)((sPoints * (100 - gSkillTraitValues.ubATAPsMovementReduction) / 100) + 0.5)); - } - - // Flugente: riot shields lower movement speed - if ( pSoldier->IsRiotShieldEquipped( ) ) - sPoints *= gItemSettings.fShieldMovementAPCostModifier; - - // Flugente: dragging someone - if ( pSoldier->IsDraggingSomeone( ) ) - sPoints *= gItemSettings.fDragAPCostModifier; - - // Check if doors if not player's merc (they have to open them manually) - if ( sSwitchValue == TRAVELCOST_DOOR && pSoldier->bTeam != gbPlayerNum ) - { - sPoints += GetAPsToOpenDoor( pSoldier ) + GetAPsToOpenDoor( pSoldier ); // Include open and close costs! - } - // Check for stealth mode - if ( pSoldier->bStealthMode ) - { - // STOMP traits - Stealthy trait decreases stealth AP modifier - if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, STEALTHY_NT )) - { - sPoints += (max(0, (INT16)((APBPConstants[AP_STEALTH_MODIFIER] * (100 - gSkillTraitValues.ubSTStealthModeSpeedBonus) / 100) + 0.5))); - } - else - { - sPoints += APBPConstants[AP_STEALTH_MODIFIER]; - } - } - // Check for backpack - if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( pSoldier ) != ITEM_NOT_FOUND ) - sPoints += APBPConstants[AP_MODIFIER_PACK]; - - /////////////////////////////////////////////////////////////////////////////////////////////////////////// - } - - // Get switch value... - sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ]; - - // 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 SIDE_STEP_WEAPON_RDY: - case SIDE_STEP_DUAL_RDY: - case WALK_BACKWARDS: - case RUNNING: - case WALKING : - case WALKING_WEAPON_RDY: - case WALKING_DUAL_RDY: - case WALKING_ALTERNATIVE_RDY : - case SIDE_STEP_ALTERNATIVE_RDY: - - // 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 += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed.. - } - break; - - case SWATTING: - case START_SWAT: - case SWAT_BACKWARDS: - - // Add cost to stand once there BEFORE.... - sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed.. - break; - - case CRAWLING: - - // Can't do it here..... - break; - } - } - else if (sSwitchValue == TRAVELCOST_NOT_STANDING) - { - switch(usMovementMode) - { - case RUNNING: - case WALKING : - case WALKING_WEAPON_RDY: - case WALKING_DUAL_RDY: - case SIDE_STEP: - case SIDE_STEP_WEAPON_RDY: - case SIDE_STEP_DUAL_RDY: - case WALK_BACKWARDS: - case WALKING_ALTERNATIVE_RDY : - case SIDE_STEP_ALTERNATIVE_RDY: - // charge crouch APs for ducking head! - sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed.. - break; - - default: - break; - } - } - - return( sPoints ); -#endif } @@ -2563,20 +2377,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // Do we need to stand up? bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); } -#if 0//dnl ch73 021013 relocate this to MinAPsToPunch - // blunt weapons & blades - else if ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE ) - { - if ( usTargID != NOBODY ) - { - // Check if target is prone, if so, calc cost... - if ( gAnimControl[ MercPtrs[ usTargID ]->usAnimState ].ubEndHeight == ANIM_PRONE ) - bAPCost += GetAPsToChangeStance( pSoldier, ANIM_CROUCH ); - else - bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); - } - } -#endif else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too { if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) @@ -2594,10 +2394,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, //Calculate usTurningCost if (!TileIsOutOfBounds(sGridNo)) { -#if 0//dnl ch73 021013 relocate this to MinAPsToPunch - // Buggler: actual melee ap deduction for turning applies only when target is 1 tile away - if ( !( ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE ) && usRange > 1 ) ) -#endif { if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 { @@ -2652,11 +2448,6 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, bAPCost += APBPConstants[AP_UNJAM]; } -#if 0//dnl ch63 240813 this seems very wrong, in most case (pSoldier->bActionPoints > bFullAps) and this will return less points then is actually required and could cancel some AI actions, like throwing grenades - // the minimum AP cost of ANY shot can NEVER be more than merc's maximum APs! - if ( bAPCost > bFullAPs ) - bAPCost = bFullAPs; -#endif // this SHOULD be impossible, but nevertheless... if ( bAPCost < 1 ) bAPCost = 1; @@ -3812,73 +3603,8 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTurningCos INT32 iFullAPs; INT32 iAPCost = APBPConstants[AP_MIN_AIM_ATTACK]; UINT16 usInHand; -#if 0//dnl ch72 180913 - UINT16 usTargID; - UINT32 uiMercFlags; - UINT8 ubDirection; - - if(pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO)//dnl ch63 240813 - usInHand = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]); - else -#endif // make sure the guy's actually got a throwable item in his hand! usInHand = pSoldier->inv[HANDPOS].usItem; -#if 0//dnl ch72 180913 this goes down because of new trait system - if ( ( !(Item[ usInHand ].usItemClass & IC_GRENADE) && - !(Item[ usInHand ].usItemClass & IC_LAUNCHER)) ) - { - //AXP 25.03.2007: See if we are about to throw grenade (grenade was not in hand, but in temp object) - if ( pSoldier->pTempObject != NULL && pSoldier->pThrowParams != NULL && - pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && (Item[ pSoldier->pTempObject->usItem ].usItemClass & IC_GRENADE) ) - { - //nothing here - } - else - { -#ifdef JA2TESTVERSION - ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %d", usInHand ); -#endif - return(0); - } - } - - if (!TileIsOutOfBounds(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; - } - - /*// OK, get a direction and see if we need to turn... - if (ubAddTurningCost) - { - ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); - - // Is it the same as he's facing? - if ( ubDirection != pSoldier->ubDirection ) - { - //Lalien: disabled it again - //AXP 25.03.2007: Reenabled look cost - //iAPCost += GetAPsToLook( pSoldier ); - } - }*/ - } - /*else - { - // Assume we need to add cost! - //iAPCost += GetAPsToLook( pSoldier ); - }*/ - - // if attacking a new target (or if the specific target is uncertain) - //AXP 25.03.2007: Aim-at-same-tile AP cost/bonus doesn't make any sense for thrown objects - //if ( ( sGridNo != pSoldier->sLastTarget ) ) - //{ - // iAPCost += APBPConstants[AP_CHANGE_TARGET]; - //} - - //iAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); // moved lower - SANDRO -#endif // Calculate default top & bottom of the magic "aiming" formula) diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index b23b93e53..3b3f520ff 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -798,28 +798,6 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { // ATE: Select everybody in squad and make move! { -#if 0 - SOLDIERTYPE * pTeamSoldier; - INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; - - // OK, loop through all guys who are 'multi-selected' and - // check if our currently selected guy is amoung the - // lucky few.. if not, change to a guy who is... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ ) - { - // Default turn off - pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); - - // If controllable - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == MercPtrs[ gusSelectedSoldier ]->bAssignment ) - { - pTeamSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; - } - } - EndMultiSoldierSelection( FALSE ); -#endif // Make move! *puiNewEvent = C_MOVE_MERC; @@ -888,36 +866,6 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } -#if 0 - fDone = FALSE; - if( GetSoldier( &pSoldier, gusUIFullTargetID ) && gpItemPointer == NULL ) - { - if( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) &&( pSoldier->bAssignment >= ON_DUTY )&&!( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) - { - fShowAssignmentMenu = TRUE; - gfRTClickLeftHoldIntercepted = TRUE; - CreateDestroyAssignmentPopUpBoxes( ); - SetTacticalPopUpAssignmentBoxXY( ); - DetermineBoxPositions( ); - DetermineWhichAssignmentMenusCanBeShown( ); - fFirstClickInAssignmentScreenMask = TRUE; - gfIgnoreScrolling = TRUE; - - fDone = TRUE; - } - else - { - fShowAssignmentMenu = FALSE; - CreateDestroyAssignmentPopUpBoxes( ); - DetermineWhichAssignmentMenusCanBeShown( ); - } - } - - if( fDone == TRUE ) - { - break; - } -#endif break; diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index c58273e7b..93882d899 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -660,11 +660,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) for (ubLoop = 0; ubLoop < pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++) { ppTile = pDBStructureRef->ppTile; -#if 0//dnl ch83 080114 - sTileGridNo = pCorpseDef->sGridNo + ppTile[ ubLoop ]->sPosRelToBase; -#else sTileGridNo = AddPosRelToBase(pCorpseDef->sGridNo, ppTile[ubLoop]); -#endif //Remove blood RemoveBlood( sTileGridNo, pCorpseDef->bLevel ); } @@ -1544,52 +1540,6 @@ ROTTING_CORPSE *FindCorpseBasedOnStructure( INT32 sGridNo, INT8 asLevel, STRUCT void CorpseHit( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID ) { -#if 0 - STRUCTURE *pStructure, *pBaseStructure; - ROTTING_CORPSE *pCorpse = NULL; - INT32 sBaseGridNo; - - pStructure = FindStructureByID( sGridNo, usStructureID ); - - // Get base.... - pBaseStructure = FindBaseStructure( pStructure ); - - // Find base gridno... - sBaseGridNo = pBaseStructure->sGridNo; - - // Get corpse ID..... - pCorpse = FindCorpseBasedOnStructure( sBaseGridNo, asLevel, pBaseStructure ); - - if ( pCorpse == NULL ) - { - #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Bullet hit corpse but corpse cannot be found at: %d", sBaseGridNo ); - #endif - return; - } - - // Twitch the bugger... - #ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Corpse hit" ); - #endif - - if ( GridNoOnScreen( sBaseGridNo ) ) - { - // Twitch.... - // Set frame... - SetAniTileFrame( pCorpse->pAniTile, 1 ); - - // Go reverse... - pCorpse->pAniTile->uiFlags |= ( ANITILE_BACKWARD | ANITILE_PAUSE_AFTER_LOOP ); - - // Turn off pause... - pCorpse->pAniTile->uiFlags &= (~ANITILE_PAUSED); - } - - // PLay a sound.... - PlayJA2Sample( (UINT32)( BULLET_IMPACT_2 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - -#endif } void VaporizeCorpse( INT32 sGridNo, INT8 asLevel, UINT16 usStructureID ) diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index cf6025fb7..1e83d2cb8 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -4857,48 +4857,6 @@ 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->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 ) - { - INT8 bTestDirection = pSoldier->ubDirection; - BOOLEAN fForceDirection = FALSE; - BOOLEAN fDoFallback = FALSE; - - // As the damage pretty brutal? - - // TRY FALLING BACKWARDS, ( ONLY IF WE ARE A MERC! ) - if ( Random( 1000 ) > 40 && IS_MERC_BODY_TYPE( 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( pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( bTestDirection ) ) ); - - if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->pathing.bLevel ) && OKHeightDest( pSoldier, sNewGridNo ) ) - { - // ALL'S OK HERE..... IF WE FORCED DIRECTION, SET! - if ( fForceDirection ) - { - pSoldier->EVENT_SetSoldierDirection( bTestDirection ); - pSoldier->EVENT_SetSoldierDesiredDirection( bTestDirection ); - } - pSoldier->ChangeSoldierState( FALLBACK_HIT_STAND, 0, FALSE ); - return; - } - } - } -} - -#endif BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState ) { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index a60307370..e9e5cbf99 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -3633,29 +3633,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // Unset paused for no APs..... this->AdjustNoAPToFinishMove( FALSE ); -#if 0 - // 0verhaul: This is a test. The only time I have been able to make this code hit is when - // the player goes prone while moving. And that is not what this part is intended for. I - // have seen the soldier in the middle of crawling, get up, turn, and then go prone again to - // continue along his path. But this code was not hit for that part. And this code seems - // 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 && this->usDontUpdateNewGridNoOnMoveAnimChange == 1 ) - { - if ( this->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_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 ( this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_START_UP_FROM_MOVE ) - { - usNewState = PRONE_UP; - this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; - } - } -#endif // We are about to start moving // Handle buddy beginning to move... @@ -3795,20 +3772,8 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // 0verhaul: Okay, here is a question: Is the "non-interrupt" supposed to be transferrable to other anims? // That is, if one anim is not interruptable but it chains to another anim, should the "not interruptable" flag // remain? I'm going to try out the theory that new animations should reset the "don't interrupt" flag. -#if 0 - if ( uiNewAnimFlags & ANIM_NONINTERRUPT ) - { - this->flags.fInNonintAnim = TRUE; - } - - if ( uiNewAnimFlags & ANIM_RT_NONINTERRUPT ) - { - this->flags.fRTInNonintAnim = TRUE; - } -#else 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[this->usAnimState].uiFlags & ANIM_FIREREADY) && !(gAnimControl[usNewState].uiFlags & ANIM_FIREREADY) ) @@ -3956,31 +3921,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { // CHRISL // SANDRO - APBPConstants[AP_CROUCH] changed to GetAPsCrouch() -#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor - if ( (UsingNewInventorySystem( ) == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag ) - { - if ( usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF ) - { - sAPCost = GetAPsCrouch( this, FALSE ) + 2; - sBPCost = APBPConstants[BP_CROUCH] + 2; - } - else if ( usNewState == KNEEL_DOWN || usNewState == BIGMERC_CROUCH_TRANS_INTO ) - { - sAPCost = GetAPsCrouch( this, FALSE ) + 1; - sBPCost = APBPConstants[BP_CROUCH] + 1; - } - else - { - sAPCost = GetAPsCrouch( this, FALSE ); - sBPCost = APBPConstants[BP_CROUCH]; - } - } - else - { - sAPCost = GetAPsCrouch( this, FALSE ); - sBPCost = APBPConstants[BP_CROUCH]; - } -#else if ( UsingNewInventorySystem( ) ) { if ( usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF ) @@ -3999,7 +3939,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart sAPCost = GetAPsCrouch( this, FALSE ); sBPCost = APBPConstants[BP_CROUCH]; } -#endif DeductPoints( this, sAPCost, sBPCost ); } this->flags.fDontChargeAPsForStanceChange = FALSE; @@ -4017,26 +3956,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart //if ( this->sGridNo == this->pathing.sFinalDestination || this->pathing.usPathIndex == 0 ) //{ // CHRISL -#if 0//dnl ch70 160913 this is wrong we cannot just add constants to sAPCost this must be done in GetAPsCrouch and GetAPsProne because all preactions calculation will show incorrect values under cursor - if ( (UsingNewInventorySystem( ) == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND && !this->flags.ZipperFlag ) - { - if ( usNewState == PRONE_UP ) - { - sAPCost = GetAPsProne( this, FALSE ) + 2; - sBPCost = APBPConstants[BP_PRONE] + 2; - } - else - { - sAPCost = GetAPsProne( this, FALSE ) + 1; - sBPCost = APBPConstants[BP_PRONE] + 1; - } - } - else - { - sAPCost = GetAPsProne( this, FALSE ); - sBPCost = APBPConstants[BP_PRONE]; - } -#else if ( UsingNewInventorySystem( ) ) { if ( usNewState == PRONE_UP ) @@ -4055,7 +3974,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart sAPCost = GetAPsProne( this, FALSE ); sBPCost = APBPConstants[BP_PRONE]; } -#endif DeductPoints( this, sAPCost, sBPCost ); //} } @@ -4394,16 +4312,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart this->flags.fForceShade = FALSE; // CHECK IF WE ARE AT AN IDLE ACTION -#if 0 - if ( gAnimControl[usNewState].uiFlags & ANIM_IDLE ) - { - this->aiData.bAction = ACTION_DONE; - } - else - { - this->aiData.bAction = ACTION_BUSY; - } -#endif // ATE; For some animations that could use some variations, do so.... if ( usNewState == CHARIOTS_OF_FIRE || usNewState == BODYEXPLODING ) @@ -5030,18 +4938,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) // break; //} -#if 0 - // 0verhaul: This does not go here! In spite of this function's name, it is not the actual "fire" function. - // In fact this sets the muzzle flash even while the soldier may be turning to shoot, which can cause - // problems for real-time shooting. - - // The correct place for this is UseGun, which already has code to set or reset the flash. - - 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", this->flags.fMuzzleFlash ) ); @@ -5061,42 +4957,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) //this->sLastTarget = sTargetGridNo; this->ubTargetID = WhoIsThere2( sTargetGridNo, this->bTargetLevel ); -#if 0 - // if (Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN) - { - 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 ( 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 ( 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 - this->bBulletsLeft = __min( GetShotsPerBurst( &this->inv[this->ubAttackingHand] ), this->inv[this->ubAttackingHand][0]->data.gun.ubGunShotsLeft ); - } - } - else if ( IsValidSecondHandShot( this ) ) - { - // two-pistol attack - two bullets! - this->bBulletsLeft = 2; - } - else - { - this->bBulletsLeft = 1; - } - - if ( AmmoTypes[this->inv[this->ubAttackingHand][0]->data.gun.ubGunAmmoType].numberOfBullets > 1 ) - { - 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", this->bBulletsLeft ) ); // Convert our grid-not into an XY @@ -5166,26 +5026,6 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) } else { -#if 0//dnl ch72 250913 move this above as need to be done before calling SoldierReadyWeapon - // IF WE ARE IN REAl-TIME, FIRE IMMEDIATELY! - if ( ((gTacticalStatus.uiFlags & REALTIME) || !(gTacticalStatus.uiFlags & INCOMBAT)) ) - { - //fDoFireRightAway = TRUE; - } - - // Check if our weapon has no intermediate anim... - 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: - //case MORTAR: - //case GLAUNCHER:*/ - - fDoFireRightAway = TRUE; - // break; - //} -#endif if ( fDoFireRightAway ) { // Set to true so we don't get toasted twice for APs.. @@ -5881,24 +5721,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "EVENT_SoldierGotHit" ); -#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 ( this->usAnimState ) - { - case SHOOT_ROCKET: - case SHOOT_MORTAR: - case THROW_ITEM: - // crouch throwing - case THROW_ITEM_CROUCHED: - // crouch throwing - case LOB_ITEM: - - 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 ) @@ -5909,22 +5731,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // Set attacker's ID this->ubAttackerID = ubAttackerID; -#if 0 - // 0verhaul: Slashing out more unnecessary and reworked code - if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) ) - { - // Increment being attacked count - this->bBeingAttackedCount++; - } - - // if defender is a vehicle, there will be no hit animation played! - if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) ) - { - // Increment the number of people busy doing stuff because of an attack (busy doing hit anim!) - gTacticalStatus.ubAttackBusyCount++; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "!!!!!!! Person got hit, attack count now %d", gTacticalStatus.ubAttackBusyCount ) ); - } -#endif // ATE; Save hit location info...( for later anim determination stuff ) this->ubHitLocation = ubHitLocation; @@ -6248,34 +6054,6 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } -#if 0 - // 0verhaul: None of this hairyness is necessary anymore! Hazaa! - // CJC: moved to after SoldierTakeDamage so that any quotes from the defender - // will not be said if they are knocked out or killed - if ( ubReason != TAKE_DAMAGE_TENTACLES && ubReason != TAKE_DAMAGE_OBJECT ) - { - // OK, OK: THis is hairy, however, it's ness. because the normal freeup call uses the - // attckers intended target, and here we want to use thier actual target.... - - // ATE: If it's from GUNFIRE damage, keep in mind bullets... - if ( Item[usWeaponIndex].usItemClass & IC_GUN ) - { - pNewSoldier = FreeUpAttackerGivenTarget( this->ubAttackerID, this->ubID ); - } - else - { - pNewSoldier = ReduceAttackBusyGivenTarget( this->ubAttackerID, this->ubID ); - } - - if ( pNewSoldier != NULL ) - { - //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 ) ); - } -#endif // Flugente: moved the damage calculation into a separate function sBreathLoss = max( 1, (INT16)(sBreathLoss * (100 - this->GetDamageResistance( FALSE, TRUE )) / 100) ); @@ -7337,14 +7115,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT32 sDestGridNo, UINT16 } // 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 ( this->pathing.bPathStored ) - { - fContinue = TRUE; - } - else -#endif { iDest = FindBestPath( this, sDestGridNo, this->pathing.bLevel, usMovementAnim, COPYROUTE, fFlags ); fContinue = (iDest != 0); @@ -8788,32 +8558,6 @@ UINT8 gRedGlowR[] = }; -#if 0 -UINT8 gOrangeGlowR[] = -{ - 0, // Normal shades - 20, - 40, - 60, - 80, - 100, - 120, - 140, - 160, - 180, - - 0, // For gray palettes - 20, - 40, - 60, - 80, - 100, - 120, - 140, - 160, - 180, -}; -#endif UINT8 gOrangeGlowR[] = { @@ -8842,32 +8586,6 @@ UINT8 gOrangeGlowR[] = }; -#if 0 -UINT8 gOrangeGlowG[] = -{ - 0, // Normal shades - 5, - 10, - 25, - 30, - 35, - 40, - 45, - 50, - 55, - - 0, // For gray palettes - 5, - 10, - 25, - 30, - 35, - 40, - 45, - 50, - 55, -}; -#endif UINT8 gOrangeGlowG[] = { @@ -12036,28 +11754,6 @@ UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier ) return(atan8( sXPos2, sYPos2, sXPos, sYPos )); } -#if 0 -UINT8 atan8( INT16 x1, INT16 y1, INT16 x2, INT16 y2 ) -{ - static int trig[8] = {2, 3, 4, 5, 6, 7, 8, 1}; - // returned values are N=1, NE=2, E=3, SE=4, S=5, SW=6, W=7, NW=8 - double dx = (x2 - x1); - double dy = (y2 - y1); - double a; - int i, k; - if ( dx == 0 ) - dx = 0.00390625; // 1/256th -#define PISLICES (8) - a = (atan2( dy, dx ) + PI / PISLICES) / (PI / (PISLICES / 2)); - i = (int)a; - if ( a>0 ) - k = i; else - if ( a<0 ) - k = i + (PISLICES - 1); else - k = 0; - return(trig[k]); -} -#endif //#if 0 UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 ) @@ -12420,22 +12116,6 @@ void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT1 void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance ) { -#if 0 - EV_S_CHANGESTANCE SChangeStance; - -#ifdef NETWORKED - if ( !IsTheSolderUnderMyControl( pSoldier->ubID ) ) - return; -#endif - - SChangeStance.ubNewStance = ubNewStance; - SChangeStance.usSoldierID = pSoldier->ubID; - SChangeStance.sXPos = pSoldier->sX; - SChangeStance.sYPos = pSoldier->sY; - SChangeStance.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; - - AddGameEvent( S_CHANGESTANCE, 0, &SChangeStance ); -#endif if ( ((pSoldier->ubID > 19 && !is_server) || (pSoldier->ubID > 119 && is_server)) && is_networked )return; @@ -12458,51 +12138,6 @@ void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); } -#if 0 -// This function is now obsolete. Just call ReduceAttackBusyCount. - -// This function just encapolates the check for turnbased and having an attacker in the first place -void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ) -{ - INT32 cnt; - UINT8 ubNumToFree; - - //if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) - { - // ATE: Removed... - //if ( pSoldier->ubAttackerID != NOBODY ) - { - // JA2 Gold - // set next-to-previous attacker, so long as this isn't a repeat attack - if ( pSoldier->ubPreviousAttackerID != pSoldier->ubAttackerID ) - { - pSoldier->ubNextToPreviousAttackerID = pSoldier->ubPreviousAttackerID; - } - - // get previous attacker id - pSoldier->ubPreviousAttackerID = pSoldier->ubAttackerID; - - // Copy BeingAttackedCount here.... - ubNumToFree = pSoldier->bBeingAttackedCount; - // Zero it out BEFORE, as supression may increase it again... - pSoldier->bBeingAttackedCount = 0; - - for ( cnt = 0; cnt < ubNumToFree; cnt++ ) - { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "@@@@@@@ Freeing up attacker of %d (attacker is %d) - releasesoldierattacker num to free is %d", pSoldier->ubID, pSoldier->ubAttackerID, ubNumToFree ) ); - ReduceAttackBusyCount( pSoldier->ubAttackerID, FALSE ); - } - - // ATE: Set to NOBODY if this person is NOT dead - // otherise, we keep it so the kill can be awarded! - if ( pSoldier->stats.bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER ) - { - pSoldier->ubAttackerID = NOBODY; - } - } - } -} -#endif BOOLEAN SOLDIERTYPE::MercInWater( void ) { diff --git a/Tactical/Soldier Tile.cpp b/Tactical/Soldier Tile.cpp index 306e97cc0..063b2df33 100644 --- a/Tactical/Soldier Tile.cpp +++ b/Tactical/Soldier Tile.cpp @@ -357,18 +357,6 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b } else { -#if 0 - // Check if there is a reserved marker here at least.... - sNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirection ) ); - - if ( ( gpWorldLevelData[ sNewGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) ) - { - if ( gpWorldLevelData[ sNewGridNo ].ubReservedSoldierID != pSoldier->ubID ) - { - return( MOVE_TILE_TEMP_BLOCKED ); - } - } -#endif } } diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index e906847b1..38fd00762 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -2975,14 +2975,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } break; -#if 0//dnl ch75 021113 - case '\"': - Testing(1); - break; - case '\'': - Testing(2); - break; -#endif case '`': @@ -4232,21 +4224,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else if ( fCtrl ) { -#if 0 - if ( INFORMATION_CHEAT_LEVEL() ) - { - if ( gfUIShowCurIntTile ^= TRUE ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection ON." ); - gubIntTileCheckFlags = INTILE_CHECK_FULL; - } - else - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection OFF." ); - gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE; - } - } -#endif } else { diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index c0075dbe3..d67d18ae9 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -2018,20 +2018,6 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridN SOLDIERTYPE *pSoldier; BOOLEAN fMadeCorpse = FALSE; -#if 0 - { - // injure someone inside - iRand = Random( gNewVehicle[ pVehicleList[ ubID ].ubVehicleType ].iNewSeatingCapacities ); - if( pVehicleList[ ubID ].pPassengers[ iRand ] ) - { - // hurt this person - InjurePersonInVehicle( ( INT16 )ubID, pVehicleList[ ubID ].pPassengers[ iRand ], ( UINT8 )( sDmg / 2 ) ); - } - } - - ScreenMsg( FONT_BLACK, MSG_INTERFACE, sCritLocationStrings[ iCrit ] ); - } -#endif pSoldier = GetSoldierStructureForVehicle( ubID ); Assert(pSoldier); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index c097a3bf6..dd544fb43 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -875,19 +875,6 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM { //all armed bombs are buried dummyItem.bVisible = BURIED; } -#if 0//dnl ch74 201013 this is already done in OBJECTTYPE::Load() - //Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you? - //this should fix that... - for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++) - { - if(Item [ dummyItem.object.usItem ].defaultattachments[cnt] == 0) - break; - - OBJECTTYPE defaultAttachment; - CreateItem(Item [ dummyItem.object.usItem ].defaultattachments[cnt],100,&defaultAttachment); - dummyItem.object.AttachObject(NULL,&defaultAttachment, FALSE); - } -#endif // sevenfm: don't allow max repair threshold less than current object status dummyItem.object[0]->data.sRepairThreshold = __max(dummyItem.object[0]->data.sRepairThreshold, dummyItem.object[0]->data.objectStatus); AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex ); diff --git a/Tactical/XML_LBEPocket.cpp b/Tactical/XML_LBEPocket.cpp index 29ee6b1f6..e4a6cadc1 100644 --- a/Tactical/XML_LBEPocket.cpp +++ b/Tactical/XML_LBEPocket.cpp @@ -189,18 +189,8 @@ lbepocketParseData * pData = (lbepocketParseData *)userData; else if(strcmp(name, "pName") == 0) { pData->curElement = ELEMENT; -#if 0 - 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 MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curLBEPocket.pName, sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) ); pData->curLBEPocket.pName[sizeof(pData->curLBEPocket.pName)/sizeof(pData->curLBEPocket.pName[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "pSilhouette") == 0) { diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index f8b47ea2d..3548b30c2 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -554,15 +554,6 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos ); LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE)); -#if 0 - if ( pBullet->pFirer->pathing.bLevel > 0 ) // if firer on roof then - { - if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area - { - LightSpritePower( pBullet->pAniTile->lightSprite, FALSE); - } - } -#endif return; } diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 6164964a6..098eb7f6c 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1383,16 +1383,6 @@ INT16 DistanceVisible(SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, // let tanks see and be seen further (at night) if ( (ARMED_VEHICLE( pSoldier ) && sDistVisible > 0) || (pSubject && ARMED_VEHICLE( pSubject )) ) { -#if 0 - if ( ARMED_VEHICLE(pSoldier) && sDistVisible > 0 && pSubject) - { - sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) ); - } - else - { - sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() ); - } -#endif // 0verhaul: This bit of code 1) seems to have no real reason to exist (MaxDistVisible just calls this function anyway), // and 2) causes infinite recursion because MaxDistVisible just calls this function, which comes right back here. Just // add 5 to sDistVisible and go on. diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index ee36d5137..b195326e2 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1921,25 +1921,6 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) UINT16 usHandItem = pSoldier->inv[HANDPOS].usItem; INT8 bSlot; -#if 0//dnl ch64 260813 decision to use machinegun or cannon is done in DecideAction, this here will just lead into burst with cannon if decision was use machinegun - if (TANK(pSoldier)) - { - // No cannon selected to fire - if (!Item[pSoldier->inv[HANDPOS].usItem].cannon) - { - // 50 % chance, that the tank fires with the explosive cannon - UINT32 fireWithCannon = GetRndNum(2); - if (fireWithCannon) - { - UINT32 tankCannonIndex = GetTankCannonIndex(); - if (tankCannonIndex > 0) - { - usHandItem = tankCannonIndex; - } - } - } - } -#endif UINT16 usSoldierIndex; // added by SANDRO #ifdef TESTAICONTROL diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index b78bff215..826c45c64 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -2946,85 +2946,7 @@ INT32 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp ) BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) { -#if 1 return FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel) != DIRECTION_IRRELEVANT; -#else - BUILDING * pBuilding; - INT32 i; - INT32 iSearchRange = 1; - INT16 sMaxLeft, sMaxRight, sMaxUp, sMaxDown, sXOffset, sYOffset; - - //DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , "CanClimbFromHere"); - - - // determine maximum horizontal limits - sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL)); - sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1)); - - // determine maximum vertical limits - sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW)); - sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1)); - - INT32 sGridNo=NOWHERE; - - for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++) - { - for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++) - { - // calculate the next potential gridno - sGridNo = pSoldier->sGridNo + sXOffset + (MAXCOL * sYOffset); - //DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Checking grid %d" , sGridNo )); - - //NumMessage("Testing gridno #",gridno); - if ( !(sGridNo >=0 && sGridNo < WORLD_MAX) ) - { - continue; - } - - - if ( sGridNo == pSoldier->pathing.sBlackList ) - { - continue; - } - - - // 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 - // FindBuilding, The original code that was from this point till the - // end of the function is now commented out AFTER the function. - - pBuilding = FindBuilding ( sGridNo ); - - if ( pBuilding != NULL) - { - if ( fUp ) - { - - for (i = 0 ; i < pBuilding->ubNumClimbSpots; i++) - { - if (pBuilding->sUpClimbSpots[ i ] == pSoldier->sGridNo && - (WhoIsThere2( pBuilding->sUpClimbSpots[ i ], 0 ) == NOBODY) - && (WhoIsThere2( pBuilding->sDownClimbSpots[ i ], 1 ) == NOBODY) ) - return TRUE; - } - } - else - { - for (i = 0 ; i < pBuilding->ubNumClimbSpots; i++) - { - if (pBuilding->sDownClimbSpots[ i ] == pSoldier->sGridNo && - (WhoIsThere2( pBuilding->sUpClimbSpots[ i ], 0 ) == NOBODY) - && (WhoIsThere2( pBuilding->sDownClimbSpots[ i ], 1 ) == NOBODY) ) - return TRUE; - } - } - } - } - } - return FALSE; -#endif } // OK, this place shows potential. How useful is it as cover? //NumMessage("Promising seems gridno #",gridno); diff --git a/TileEngine/Exit Grids.cpp b/TileEngine/Exit Grids.cpp index 4ada6bb00..036b48d54 100644 --- a/TileEngine/Exit Grids.cpp +++ b/TileEngine/Exit Grids.cpp @@ -12,68 +12,14 @@ #include "SaveLoadMap.h" #include "Text.h" -#if 0//dnl ch86 180214 -BOOLEAN gfLoadingExitGrids = FALSE; - -//used by editor. -EXITGRID gExitGrid = {0,1,1,0}; - -BOOLEAN gfOverrideInsertionWithExitGrid = FALSE; - -// - -#define MAX_EXITGRIDS 4096 - -EXITGRID gpExitGrids[MAX_EXITGRIDS]; -UINT guiExitGridsCount = 0; - - -//INT32 ConvertExitGridToINT32( EXITGRID *pExitGrid ) -//{ -// INT32 iExitGridInfo; -// iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28; -// iExitGridInfo += (pExitGrid->ubGotoSectorY-1)<< 24; -// iExitGridInfo += pExitGrid->ubGotoSectorZ << 20; -// iExitGridInfo += pExitGrid->usGridNo & 0x0000ffff; -// return iExitGridInfo; -//} -// -//void ConvertINT32ToExitGrid( INT32 iExitGridInfo, EXITGRID *pExitGrid ) -//{ -// //convert the int into 4 unsigned bytes. -// 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); -//} -#else BOOLEAN gfLoadingExitGrids = FALSE; BOOLEAN gfOverrideInsertionWithExitGrid = FALSE; EXITGRID gExitGrid; EXITGRID *ExitGridTable = NULL; UINT16 gusNumExitGrids = 0; -#endif BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid ) { -#if 0//dnl ch86 170214 - LEVELNODE *pShadow; - pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead; - //Search through object layer for an exitgrid - while( pShadow ) - { - if ( pShadow->uiFlags & LEVELNODE_EXITGRID ) - { -// -// ConvertINT32ToExitGrid( pShadow->iExitGridInfo, pExitGrid ); - memcpy(pExitGrid, pShadow->pExitGridInfo, sizeof(EXITGRID)); -// - return TRUE; - } - pShadow = pShadow->pNext; - } - return FALSE; -#else INT32 i = 0; while(i < gusNumExitGrids) { @@ -85,7 +31,6 @@ BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid ) i++; } return(FALSE); -#endif } BOOLEAN ExitGridAtGridNo( UINT32 usMapIndex ) @@ -123,42 +68,6 @@ BOOLEAN GetExitGridLevelNode( UINT32 usMapIndex, LEVELNODE **ppLevelNode ) void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) { -#if 0//dnl ch86 180214 - LEVELNODE *pShadow, *tail; - pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; - - //Search through object layer for an exitgrid - while( pShadow ) - { - tail = pShadow; - if( pShadow->uiFlags & LEVELNODE_EXITGRID ) - { //we have found an existing exitgrid in this node, so replace it with the new information. - memcpy(pShadow->pExitGridInfo, pExitGrid, sizeof(EXITGRID));//dnl ch80 011213 - return; - } - pShadow = pShadow->pNext; - } - - // Add levelnode - AddShadowToHead( iMapIndex, MOCKFLOOR1 ); - // Get new node - pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; - - //fill in the information for the new exitgrid levelnode. -// -// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid ); - memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID)); - pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount; - guiExitGridsCount++; -// - pShadow->uiFlags |= ( LEVELNODE_EXITGRID | LEVELNODE_HIDDEN ); - - //Add the exit grid to the sector, only if we call ApplyMapChangesToMapTempFile() first. - if( !gfEditMode && !gfLoadingExitGrids ) - { - AddExitGridToMapTempFile( iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - } -#else pExitGrid->iMapIndex = iMapIndex; INT32 i = 0, j = -1; while(i < gusNumExitGrids) @@ -196,18 +105,10 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) if(!gfEditMode && !gfLoadingExitGrids) AddExitGridToMapTempFile(iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ); } -#endif } void RemoveExitGridFromWorld( INT32 iMapIndex ) { -#if 0//dnl ch86 180214 - UINT16 usDummy; - if( TypeExistsInShadowLayer( iMapIndex, MOCKFLOOR, &usDummy ) ) - { - RemoveAllShadowsOfTypeRange( iMapIndex, MOCKFLOOR, MOCKFLOOR ); - } -#else INT32 i = 0; while(i < gusNumExitGrids) { @@ -219,7 +120,6 @@ void RemoveExitGridFromWorld( INT32 iMapIndex ) } i++; } -#endif } void TrashExitGridTable(void)//dnl ch86 170214 @@ -284,37 +184,15 @@ void LoadExitGrids(INT8** hBuffer, FLOAT dMajorMapVersion) UINT16 usNumExitGrids; INT32 usMapIndex; EXITGRID ExitGrid; -#if 0//dnl ch86 170214 - // New world is loading so trash all old EXITGRID's - memset(gpExitGrids, 0, sizeof(gpExitGrids)); - guiExitGridsCount = 0; -#else TrashExitGridTable(); -#endif gfLoadingExitGrids = TRUE; LOADDATA(&usNumExitGrids, *hBuffer, sizeof(usNumExitGrids)); for(int i=0; ifFlags & TILE_ON_ROOF ) ) { -#if 0//dnl ch83 080114 - sStructGridNo = pBase->sGridNo + ppTile[ubLoop]->sPosRelToBase; -#else sStructGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); -#endif // there might be two structures in this tile, one on each level, but we just want to // delete one on each pass @@ -1456,11 +1452,7 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) { -#if 0//dnl ch83 080114 - sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; -#else sNewGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); -#endif // look in adjacent tiles for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ ) { diff --git a/TileEngine/Isometric Utils.cpp b/TileEngine/Isometric Utils.cpp index 0f59940eb..5f68cf493 100644 --- a/TileEngine/Isometric Utils.cpp +++ b/TileEngine/Isometric Utils.cpp @@ -669,16 +669,6 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY ) return( TRUE ); } -#if 0 -// 0verhaul -// 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( UINT32 *psMapPos ) -{ - return GetMouseMapPos( (INT32 *)psMapPos ); -} -#endif BOOLEAN GetMouseMapPos( INT32 *psMapPos ) { @@ -1309,11 +1299,7 @@ BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo ) // Get screen coordinates for current position of soldier GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY); -#if 0//dnl ch53 151009 - if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) ) -#else if ( sWorldX >= 30 && sWorldX <= (gsTRX - gsTLX - 30) && sWorldY >= 20 && sWorldY <= (gsBLY - gsTLY - 10) ) -#endif { return GridNoOnWalkableWorldTile(sGridNo); } @@ -1321,31 +1307,6 @@ BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo ) return( FALSE ); } -#if 0//dnl ch53 101009 -// This function is used when we care about astetics with the top Y portion of the -// gma eplay area -// mostly due to UI bar that comes down.... -BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo ) -{ - INT16 sWorldX; - INT16 sWorldY; - INT16 sXMapPos, sYMapPos; - - // Check for valid gridno... - ConvertGridNoToXY( sGridNo, &sXMapPos, &sYMapPos ); - - // Get screen coordinates for current position of soldier - GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY); - - if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && - sWorldY > 40 && sWorldY < ( gsBLY - gsTLY - 20 ) ) - { - return( TRUE ); - } - - return( FALSE ); -} -#endif BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection ) { diff --git a/TileEngine/Render Fun.cpp b/TileEngine/Render Fun.cpp index 6248840c7..e2ecd20cf 100644 --- a/TileEngine/Render Fun.cpp +++ b/TileEngine/Render Fun.cpp @@ -208,11 +208,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo ) for ( ubLoop = 0; ubLoop < pBase->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++ ) { ppTile = pBase->pDBStructureRef->ppTile; -#if 0//dnl ch83 080114 - sGridNo = pBase->sGridNo + ppTile[ ubLoop ]->sPosRelToBase; -#else sGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); -#endif if (sGridNo < 0 || sGridNo > WORLD_MAX) { continue; diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index b2f01d3ba..f873eaf18 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -540,12 +540,6 @@ UINT8 ubTravelCost; //bDirection = atan8( iX, iY, iSrcX, iSrcY ); bDirection = atan8( iSrcX, iSrcY, iX, iY ); -#if 0 - if ( usTileNo == 20415 && bDirection == 3 ) - { - int i = 0; - } -#endif ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ]; @@ -564,50 +558,6 @@ UINT8 ubTravelCost; } } -#if 0 - pStruct = gpWorldLevelData[ usTileNo ].pStructHead; - while ( pStruct != NULL ) - { - if ( pStruct->usIndex < giNumberOfTiles ) - { - 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.. - if((uiType >= FIRSTWALL) && (uiType <=LASTDECORATIONS )) - { - GetWallOrientation(pStruct->usIndex, &usWallOrientation); - - bWallCount++; - } - } - - pStruct=pStruct->pNext; - } - - if ( bWallCount ) - { - // ATE: If TWO or more - assume it's BLOCKED and return TRUE - if ( bWallCount != 1 ) - { - return( TRUE ); - } - - switch(usWallOrientation) - { - case INSIDE_TOP_RIGHT: - case OUTSIDE_TOP_RIGHT: - return( iSrcX < iX ); - - case INSIDE_TOP_LEFT: - case OUTSIDE_TOP_LEFT: - return( iSrcY < iY ); - - } - } - -#endif return(FALSE); } @@ -2152,28 +2102,6 @@ BOOLEAN LightIlluminateWall(INT16 iSourceX, INT16 iSourceY, INT16 iTileX, INT16 // return( LightTileHasWall( iSourceX, iSourceY, iTileX, iTileY ) ); -#if 0 -UINT16 usWallOrientation; - - GetWallOrientation(pStruct->usIndex, &usWallOrientation); - - switch(usWallOrientation) - { - case NO_ORIENTATION: - return(TRUE); - - case INSIDE_TOP_RIGHT: - case OUTSIDE_TOP_RIGHT: - return(iSourceX >= iTileX); - - case INSIDE_TOP_LEFT: - case OUTSIDE_TOP_LEFT: - return(iSourceY >= iTileY); - - } - return(FALSE); - -#endif return( TRUE ); } diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 8f42f1923..c2b5a0528 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -995,15 +995,8 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart // Black color for the background! //ColorFillVideoSurfaceArea( FRAME_BUFFER, sStartPointX_S, sStartPointY_S, sEndXS, sEndYS, 0 ); -#if 0//dnl ch79 291113 - if(gfTacticalPlacementGUIActive)//dnl ch45 021009 Skip overwrite buttons area which is not refresh during scroll //dnl ch77 211113 - ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-160, 0); - else - ColorFillVideoSurfaceArea(uiBigMap, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-120, 0); -#else if(uiVSurface == FRAME_BUFFER)//dnl ch82 090114 ColorFillVideoSurfaceArea(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-(gfTacticalPlacementGUIActive?160:120), 0); -#endif fInterfacePanelDirty = DIRTYLEVEL2; InvalidateScreen(); diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index da184a9b6..a08b72365 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -1457,43 +1457,6 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) -#if 0 -{ - LEVELNODE *pNode; - INT32 sNewGridNo; - - //Determine new gridno - sNewGridNo = MAPROWCOLTOPOS( ( pObject->Position.y / CELL_Y_SIZE ), ( pObject->Position.x / CELL_X_SIZE ) ); - - // Look at old gridno - if ( sNewGridNo != pObject->sGridNo ) - { - // We're at a new gridno! - - // First find levelnode of our object and delete - pNode = gpWorldLevelData[ pObject->sGridNo ].pStructHead; - - // LOOP THORUGH OBJECT LAYER - while( pNode != NULL ) - { - if ( pNode->uiFlags & LEVELNODE_PHYSICSOBJECT ) - { - if ( pNode->iPhysicsObjectID == pObject->iID ) - { - RemoveStruct( pObject->sGridNo, pNode->usIndex ); - break; - } - } - - pNode = ppNode->pNext; - } - - // Set new gridno, add - } - // Add new object / update position - -} -#endif void ObjectHitWindow( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ) { diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index a2fd01fbe..08eef0b78 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -354,14 +354,6 @@ UINT32 uiAdditiveLayerUsedFlags = 0xffffffff; // Array of shade values to use..... #define NUM_GLOW_FRAMES 30 -#if 0 -INT16 gsGlowFrames[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -}; -#endif INT16 gsGlowFrames[] = { @@ -1608,28 +1600,6 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { if (fUseTileElem) { -#if 0 - // DONOT RENDER IF IT'S A HIDDEN STRUCT AND TILE IS NOT REVEALED - if (uiTileElemFlags & HIDDEN_TILE) - { - // IF WORLD IS NOT REVEALED, QUIT -#ifdef JA2EDITOR - if (!gfEditMode) -#endif - { - if (!(gpWorldLevelData[uiTileIndex].uiFlags & MAPELEMENT_REVEALED) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS)) - { - //CONTINUE, DONOT RENDER - if (!fLinkedListDirection) - pNode = pNode->pPrevNode; - else - pNode = pNode->pNext; - - continue; - } - } - } -#endif } } @@ -9084,33 +9054,6 @@ void SetMercGlowNormal( ) -#if 0 - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) - { - if ( sZOffsetY > 0 ) - { - sZOffsetY++; - } - if ( sZOffsetX > 0 ) - { - sZOffsetX++; - } - } - - sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ - sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ - - - if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) )\ - {\ - sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ - sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ -\ - sWorldY = GetMapXYWorldY( sMapX + sZOffsetX, sMapY + sZOffsetY );\ - }\ - else - -#endif void SetRenderCenter( INT16 sNewX, INT16 sNewY ) diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 7f8a33c06..49264a512 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -660,11 +660,7 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC } ppTile = pDBStructureRef->ppTile; -#if 0//dnl ch83 080114 - sGridNo = sBaseGridNo + ppTile[ubTileIndex]->sPosRelToBase; -#else sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubTileIndex]); -#endif if (sGridNo < 0 || sGridNo > WORLD_MAX) { return( FALSE ); @@ -835,16 +831,8 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC } for (bLoop2 = 0; bLoop2 < pDBStructure->ubNumberOfTiles; bLoop2++) { -#if 0//dnl ch83 080114 - if ( sBaseGridNo + ppTile[bLoop2]->sPosRelToBase == sOtherGridNo) - { - // obstacle will straddle wall! - return( FALSE ); - } -#else if(AddPosRelToBase(sBaseGridNo, ppTile[bLoop2]) == sOtherGridNo) return(FALSE);// obstacle will straddle wall! -#endif } } } @@ -1107,11 +1095,7 @@ STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRU MemFree( ppStructure ); return( NULL ); } -#if 0//dnl ch83 080114 - ppStructure[ubLoop]->sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; -#else ppStructure[ubLoop]->sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); -#endif if (ubLoop != BASE_TILE) { #ifdef JA2EDITOR @@ -1319,11 +1303,7 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure ) // Free all the tiles for (ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) { -#if 0//dnl ch83 080114 - sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; -#else sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); -#endif // there might be two structures in this tile, one on each level, but we just want to // delete one on each pass pCurrent = FindStructureByID( sGridNo, usStructureID ); diff --git a/TileEngine/tiledef.cpp b/TileEngine/tiledef.cpp index 8318ed462..26ca0d4c9 100644 --- a/TileEngine/tiledef.cpp +++ b/TileEngine/tiledef.cpp @@ -594,23 +594,6 @@ UINT8 gubEncryptionArray2[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_AR }, }; -#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 ] = { @@ -626,7 +609,6 @@ UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] = TRAVELCOST_SHORE, // MED WATER TRAVELCOST_SHORE, // DEEP WATER }; -#endif ADDITIONAL_TILE_PROPERTIES_VALUES zAdditionalTileProperties; diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index a311df9c4..05709b6fc 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2276,15 +2276,6 @@ BOOLEAN SaveWorld(const STR8 puiFilename, FLOAT dMajorMapVersion, UINT8 ubMinorM { SaveMapLights( hfile ); } -#if 0//dnl ch74 191013 from 050611 Scheinworld reported problem with basement levels and similar maps which doesn't need entry points so decide to remove this check completely - if(gMapInformation.sCenterGridNo == -1 || gMapInformation.ubEditorSmoothingType == SMOOTHING_NORMAL && (gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 && gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1))//dnl ch17 290909 - { - swprintf(gzErrorCatchString, L"SAVE ABORTED! Center and at least one of (N,S,E,W) entry point should be set."); - gfErrorCatch = TRUE; - FileClose(hfile); - return(FALSE); - } -#endif gMapInformation.ubMapVersion = ubMinorMapVersion;//dnl ch74 241013 all this years MapInfo saves incorrect version :-( SaveMapInformation(hfile, dMajorMapVersion, ubMinorMapVersion);//dnl ch33 150909 diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index cfba1961b..6f869e308 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -2293,10 +2293,6 @@ BOOLEAN RemoveShadow( INT32 iMapIndex, UINT16 usIndex ) { pOldShadow->pNext = pShadow->pNext; } -#if 0//#ifdef JA2EDITOR//dnl ch80 011213 //dnl ch86 190214 - if(pShadow->uiFlags & LEVELNODE_EXITGRID && pShadow->pExitGridInfo) - memset(pShadow->pExitGridInfo, 0, sizeof(EXITGRID)); -#endif // Delete memory assosiated with item MemFree( pShadow ); guiLevelNodes--; diff --git a/Utils/Cursors.cpp b/Utils/Cursors.cpp index 28c083c7d..ebe95b50d 100644 --- a/Utils/Cursors.cpp +++ b/Utils/Cursors.cpp @@ -1857,32 +1857,6 @@ void DrawMouseText( ) } //if ( gpItemPointer != NULL ) -#if 0 - { - if ( gpItemPointer->ubNumberOfObjects > 1 ) - { - SetFontDestBuffer( MOUSE_BUFFER , 0, 0, 64, 64, FALSE ); - - swprintf( pStr, L"x%d", gpItemPointer->ubNumberOfObjects ); - - FindFontCenterCoordinates( 0, 0, gsCurMouseWidth, gsCurMouseHeight, pStr, TINYFONT1, &sX, &sY ); - - SetFont( TINYFONT1 ); - - SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_WHITE ); - SetFontShadow( DEFAULT_SHADOW ); - - if ( !( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) - { - mprintf( sX + 10, sY - 10, L"x%d", gpItemPointer->ubNumberOfObjects ); - } - - // reset - SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - } - } -#endif } void UpdateAnimatedCursorFrames( UINT32 uiCursorIndex ) @@ -2008,47 +1982,4 @@ HVOBJECT GetCursorFileVideoObject( UINT32 uiCursorFile ) void SyncPairedCursorFrames( UINT32 uiSrcIndex, UINT32 uiDestIndex ) { -#if 0 - CursorData *pSrcCurData, *pDestCurData; - CursorImage *pSrcCurImage, *pDestCurImage; - UINT32 cnt; - INT32 iCurFrame = -1; - - if ( uiSrcIndex == VIDEO_NO_CURSOR || uiDestIndex == VIDEO_NO_CURSOR ) - { - return; - } - - pSrcCurData = &( CursorDatabase[ uiSrcIndex ] ); - pDestCurData = &( CursorDatabase[ uiDestIndex ] ); - - // Get Current frame from src - for ( cnt = 0; cnt < pSrcCurData->usNumComposites; cnt++ ) - { - pSrcCurImage = &( pSrcCurData->Composites[ cnt ] ); - - if ( CursorFileDatabase[ pSrcCurImage->uiFileIndex ].fFlags & ANIMATED_CURSOR ) - { - iCurFrame = pSrcCurImage->uiCurrentFrame; - break; - } - } - - // If we are not an animated cursor, return now - if ( iCurFrame == -1 ) - { - return; - } - - // Update dest - for ( cnt = 0; cnt < pDestCurData->usNumComposites; cnt++ ) - { - pDestCurImage = &( pDestCurData->Composites[ cnt ] ); - - if ( CursorFileDatabase[ pDestCurImage->uiFileIndex ].fFlags & ANIMATED_CURSOR ) - { - pDestCurImage->uiCurrentFrame = iCurFrame; - } - } -#endif } diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 71ea2e72e..2598dc28e 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -631,40 +631,6 @@ UINT32 CalculateSoundEffectsVolume( UINT32 uiVolume ) } -#if 0 -int x,dif,absDif; - - // This function calculates the general LEFT / RIGHT direction of a gridno - // based on the middle of your screen. - - x = Gridx(gridno); - - dif = ScreenMiddleX - x; - - if ( (absDif=abs(dif)) > 32) - { - // 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); - } - else // hardly any difference, so sound should be played from middle - return(MIDDLE); - -} -#endif // == Lesh slightly changed this function ============ INT32 SoundDir( INT32 sGridNo ) diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 4b50981ea..3efcb415b 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -751,7 +751,6 @@ BOOLEAN HandleTextInput( InputAtom *Event ) } //For any number of reasons, these ALT and CTRL combination key presses //will be processed externally -#if 1 if( Event->usKeyState & CTRL_DOWN ) { if( Event->usParam == 'c' || Event->usParam == 'C' ) @@ -786,7 +785,6 @@ BOOLEAN HandleTextInput( InputAtom *Event ) return FALSE; } } -#endif if( Event->usKeyState & ALT_DOWN || Event->usKeyState & CTRL_DOWN && Event->usParam != DEL ) return FALSE; //F1-F12 regardless of state are processed externally as well. diff --git a/Utils/Text Utils.cpp b/Utils/Text Utils.cpp index f3d156be7..757a20c73 100644 --- a/Utils/Text Utils.cpp +++ b/Utils/Text Utils.cpp @@ -11,382 +11,14 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) if (pNameString != NULL) { -#if 0 - j = -1; - for (int i=0;i<80;i++) - { - j++; - if ( j<(int)strlen(Item[ubIndex].szLongItemName )) - { - pNameString[i] = Item[ubIndex].szLongItemName [j]; - - #ifdef GERMAN - // We have a german special character - if (Item[ubIndex].szLongItemName [j] == -61) - { - // This character determines the special character - switch (Item[ubIndex].szLongItemName [j + 1]) - { - // ü - case -68: - pNameString[i] = 252; - // Skip next character, because "umlaute" have 2 chars - j++; - break; - // Ü - case -100: - pNameString[i] = 220; - j++; - break; - // ä - case -92: - pNameString[i] = 228; - j++; - break; - // Ä - case -124: - pNameString[i] = 196; - j++; - break; - // ö - case -74: - pNameString[i] = 246; - j++; - break; - // Ö - case -106: - pNameString[i] = 214; - j++; - break; - // ß - case -97: - pNameString[i] = 223; - j++; - break; - } - } - #endif - - #ifdef POLISH - switch( pNameString[ i ] ) - { - case 260: pNameString[ i ] = 165; break; - case 262: pNameString[ i ] = 198; break; - case 280: pNameString[ i ] = 202; break; - case 321: pNameString[ i ] = 163; break; - case 323: pNameString[ i ] = 209; break; - case 211: pNameString[ i ] = 211; break; - - case 346: pNameString[ i ] = 338; break; - case 379: pNameString[ i ] = 175; break; - case 377: pNameString[ i ] = 143; break; - case 261: pNameString[ i ] = 185; break; - case 263: pNameString[ i ] = 230; break; - case 281: pNameString[ i ] = 234; break; - - case 322: pNameString[ i ] = 179; break; - case 324: pNameString[ i ] = 241; break; - case 243: pNameString[ i ] = 243; break; - case 347: pNameString[ i ] = 339; break; - case 380: pNameString[ i ] = 191; break; - case 378: pNameString[ i ] = 376; break; - } - #endif - - #ifdef RUSSIAN - if ((unsigned char)Item[ubIndex].szLongItemName [j] == 208) //d0 - { - // 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 - - case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A - case 145: pNameString[ i ] = 193; j++; break; - case 146: pNameString[ i ] = 194; j++; break; - case 147: pNameString[ i ] = 195; j++; break; - case 148: pNameString[ i ] = 196; j++; break; - case 149: pNameString[ i ] = 197; j++; break; - case 150: pNameString[ i ] = 198; j++; break; - case 151: pNameString[ i ] = 199; j++; break; - case 152: pNameString[ i ] = 200; j++; break; - case 153: pNameString[ i ] = 201; j++; break; - case 154: pNameString[ i ] = 202; j++; break; - case 155: pNameString[ i ] = 203; j++; break; - case 156: pNameString[ i ] = 204; j++; break; - case 157: pNameString[ i ] = 205; j++; break; - case 158: pNameString[ i ] = 206; j++; break; - case 159: pNameString[ i ] = 207; j++; break; - case 160: pNameString[ i ] = 208; j++; break; - case 161: pNameString[ i ] = 209; j++; break; - case 162: pNameString[ i ] = 210; j++; break; - case 163: pNameString[ i ] = 211; j++; break; - case 164: pNameString[ i ] = 212; j++; break; - case 165: pNameString[ i ] = 213; j++; break; - case 166: pNameString[ i ] = 214; j++; break; - case 167: pNameString[ i ] = 215; j++; break; - case 168: pNameString[ i ] = 216; j++; break; - case 169: pNameString[ i ] = 217; j++; break; - case 170: pNameString[ i ] = 218; j++; break; - 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 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA - - //small letters - case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A - case 177: pNameString[ i ] = 225; j++; break; - case 178: pNameString[ i ] = 226; j++; break; - case 179: pNameString[ i ] = 227; j++; break; - case 180: pNameString[ i ] = 228; j++; break; - case 181: pNameString[ i ] = 229; j++; break; - case 182: pNameString[ i ] = 230; j++; break; - case 183: pNameString[ i ] = 231; j++; break; - case 184: pNameString[ i ] = 232; j++; break; - case 185: pNameString[ i ] = 233; j++; break; - case 186: pNameString[ i ] = 234; j++; break; - 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 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE - } - } - - if ( ((unsigned char)Item[ubIndex].szLongItemName [j] == 209) ) //d1 - { - // 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; - case 131: pNameString[ i ] = 243; j++; break; - case 132: pNameString[ i ] = 244; j++; break; - case 133: pNameString[ i ] = 245; j++; break; - case 134: pNameString[ i ] = 246; j++; break; - case 135: pNameString[ i ] = 247; j++; break; - case 136: pNameString[ i ] = 248; j++; break; - case 137: pNameString[ i ] = 249; j++; break; - case 138: pNameString[ i ] = 250; j++; break; - case 139: pNameString[ i ] = 251; j++; break; - case 140: pNameString[ i ] = 252; j++; break; - case 141: pNameString[ i ] = 253; j++; break; - case 142: pNameString[ i ] = 254; j++; break; - case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA - - case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO - } - } - #endif - - } - else - { - pNameString[i] ='\0'; - } - } -#else wcsncpy( pNameString, Item[ubIndex].szLongItemName, 80); pNameString[79] ='\0'; -#endif } if(pInfoString != NULL) { -#if 0 - j = -1; - for (int i=0;i<400;i++) - { - j++; - if ( j<(int)strlen(Item[ubIndex].szItemDesc )) - { - pInfoString[i] = Item[ubIndex].szItemDesc [j]; - - #ifdef GERMAN - // We have a german special character - if (Item[ubIndex].szItemDesc [j] == -61) - { - // This character determines the special character - switch (Item[ubIndex].szItemDesc [j + 1]) - { - // ü - case -68: - pInfoString[i] = 252; - // Skip next character, because "umlaute" have 2 chars - j++; - break; - // Ü - case -100: - pInfoString[i] = 220; - j++; - break; - // ä - case -92: - pInfoString[i] = 228; - j++; - break; - // Ä - case -124: - pInfoString[i] = 196; - j++; - break; - // ö - case -74: - pInfoString[i] = 246; - j++; - break; - // Ö - case -106: - pInfoString[i] = 214; - j++; - break; - // ß - case -97: - pInfoString[i] = 223; - j++; - break; - } - } - #endif - - #ifdef POLISH - switch( pNameString[ i ] ) - { - case 260: pInfoString[ i ] = 165; break; - case 262: pInfoString[ i ] = 198; break; - case 280: pInfoString[ i ] = 202; break; - case 321: pInfoString[ i ] = 163; break; - case 323: pInfoString[ i ] = 209; break; - case 211: pInfoString[ i ] = 211; break; - - case 346: pInfoString[ i ] = 338; break; - case 379: pInfoString[ i ] = 175; break; - case 377: pInfoString[ i ] = 143; break; - case 261: pInfoString[ i ] = 185; break; - case 263: pInfoString[ i ] = 230; break; - case 281: pInfoString[ i ] = 234; break; - - case 322: pInfoString[ i ] = 179; break; - case 324: pInfoString[ i ] = 241; break; - case 243: pInfoString[ i ] = 243; break; - case 347: pInfoString[ i ] = 339; break; - case 380: pInfoString[ i ] = 191; break; - case 378: pInfoString[ i ] = 376; break; - } - #endif - - - #ifdef RUSSIAN - if ((unsigned char)Item[ubIndex].szItemDesc [j] == 208) //d0 - { - // 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 - - case 144: pInfoString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A - case 145: pInfoString[ i ] = 193; j++; break; - case 146: pInfoString[ i ] = 194; j++; break; - case 147: pInfoString[ i ] = 195; j++; break; - case 148: pInfoString[ i ] = 196; j++; break; - case 149: pInfoString[ i ] = 197; j++; break; - case 150: pInfoString[ i ] = 198; j++; break; - case 151: pInfoString[ i ] = 199; j++; break; - case 152: pInfoString[ i ] = 200; j++; break; - case 153: pInfoString[ i ] = 201; j++; break; - case 154: pInfoString[ i ] = 202; j++; break; - case 155: pInfoString[ i ] = 203; j++; break; - case 156: pInfoString[ i ] = 204; j++; break; - case 157: pInfoString[ i ] = 205; j++; break; - case 158: pInfoString[ i ] = 206; j++; break; - case 159: pInfoString[ i ] = 207; j++; break; - case 160: pInfoString[ i ] = 208; j++; break; - case 161: pInfoString[ i ] = 209; j++; break; - case 162: pInfoString[ i ] = 210; j++; break; - case 163: pInfoString[ i ] = 211; j++; break; - case 164: pInfoString[ i ] = 212; j++; break; - case 165: pInfoString[ i ] = 213; j++; break; - case 166: pInfoString[ i ] = 214; j++; break; - case 167: pInfoString[ i ] = 215; j++; break; - case 168: pInfoString[ i ] = 216; j++; break; - case 169: pInfoString[ i ] = 217; j++; break; - case 170: pInfoString[ i ] = 218; j++; break; - 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 175: pInfoString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA - - //small letters - case 176: pInfoString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A - case 177: pInfoString[ i ] = 225; j++; break; - case 178: pInfoString[ i ] = 226; j++; break; - case 179: pInfoString[ i ] = 227; j++; break; - case 180: pInfoString[ i ] = 228; j++; break; - case 181: pInfoString[ i ] = 229; j++; break; - case 182: pInfoString[ i ] = 230; j++; break; - case 183: pInfoString[ i ] = 231; j++; break; - case 184: pInfoString[ i ] = 232; j++; break; - case 185: pInfoString[ i ] = 233; j++; break; - case 186: pInfoString[ i ] = 234; j++; break; - 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 191: pInfoString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE - } - } - - if ( ((unsigned char)Item[ubIndex].szItemDesc [j] == 209) ) //d1 - { - // 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; - case 131: pInfoString[ i ] = 243; j++; break; - case 132: pInfoString[ i ] = 244; j++; break; - case 133: pInfoString[ i ] = 245; j++; break; - case 134: pInfoString[ i ] = 246; j++; break; - case 135: pInfoString[ i ] = 247; j++; break; - case 136: pInfoString[ i ] = 248; j++; break; - case 137: pInfoString[ i ] = 249; j++; break; - case 138: pInfoString[ i ] = 250; j++; break; - case 139: pInfoString[ i ] = 251; j++; break; - case 140: pInfoString[ i ] = 252; j++; break; - case 141: pInfoString[ i ] = 253; j++; break; - case 142: pInfoString[ i ] = 254; j++; break; - case 143: pInfoString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA - - 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 - // } - //} - #endif - } - else - { - pInfoString[i] ='\0'; - } - } -#else wcsncpy( pInfoString, Item[ubIndex].szItemDesc, 400); pInfoString[399] ='\0'; -#endif } return(TRUE); @@ -396,187 +28,8 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) { if (pNameString != NULL) { -#if 0 - int j = -1; - - for (int i=0;i<80;i++) - { - j++; - if ( j<(int)strlen(Item[ubIndex].szBRName)) - { - pNameString[i] = Item[ubIndex].szBRName [j]; - - #ifdef GERMAN - // We have a german special character - if (Item[ubIndex].szBRName [j] == -61) - { - // This character determines the special character - switch (Item[ubIndex].szBRName [j + 1]) - { - // ü - case -68: - pNameString[i] = 252; - // Skip next character, because "umlaute" have 2 chars - j++; - break; - // Ü - case -100: - pNameString[i] = 220; - j++; - break; - // ä - case -92: - pNameString[i] = 228; - j++; - break; - // Ä - case -124: - pNameString[i] = 196; - j++; - break; - // ö - case -74: - pNameString[i] = 246; - j++; - break; - // Ö - case -106: - pNameString[i] = 214; - j++; - break; - // ß - case -97: - pNameString[i] = 223; - j++; - break; - } - } - #endif - - #ifdef POLISH - switch( pNameString[ i ] ) - { - case 260: pNameString[ i ] = 165; break; - case 262: pNameString[ i ] = 198; break; - case 280: pNameString[ i ] = 202; break; - case 321: pNameString[ i ] = 163; break; - case 323: pNameString[ i ] = 209; break; - case 211: pNameString[ i ] = 211; break; - - case 346: pNameString[ i ] = 338; break; - case 379: pNameString[ i ] = 175; break; - case 377: pNameString[ i ] = 143; break; - case 261: pNameString[ i ] = 185; break; - case 263: pNameString[ i ] = 230; break; - case 281: pNameString[ i ] = 234; break; - - case 322: pNameString[ i ] = 179; break; - case 324: pNameString[ i ] = 241; break; - case 243: pNameString[ i ] = 243; break; - case 347: pNameString[ i ] = 339; break; - case 380: pNameString[ i ] = 191; break; - case 378: pNameString[ i ] = 376; break; - } - #endif - - #ifdef RUSSIAN - if ((unsigned char)Item[ubIndex].szBRName [j] == 208) //d0 - { - // 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 - - case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A - case 145: pNameString[ i ] = 193; j++; break; - case 146: pNameString[ i ] = 194; j++; break; - case 147: pNameString[ i ] = 195; j++; break; - case 148: pNameString[ i ] = 196; j++; break; - case 149: pNameString[ i ] = 197; j++; break; - case 150: pNameString[ i ] = 198; j++; break; - case 151: pNameString[ i ] = 199; j++; break; - case 152: pNameString[ i ] = 200; j++; break; - case 153: pNameString[ i ] = 201; j++; break; - case 154: pNameString[ i ] = 202; j++; break; - case 155: pNameString[ i ] = 203; j++; break; - case 156: pNameString[ i ] = 204; j++; break; - case 157: pNameString[ i ] = 205; j++; break; - case 158: pNameString[ i ] = 206; j++; break; - case 159: pNameString[ i ] = 207; j++; break; - case 160: pNameString[ i ] = 208; j++; break; - case 161: pNameString[ i ] = 209; j++; break; - case 162: pNameString[ i ] = 210; j++; break; - case 163: pNameString[ i ] = 211; j++; break; - case 164: pNameString[ i ] = 212; j++; break; - case 165: pNameString[ i ] = 213; j++; break; - case 166: pNameString[ i ] = 214; j++; break; - case 167: pNameString[ i ] = 215; j++; break; - case 168: pNameString[ i ] = 216; j++; break; - case 169: pNameString[ i ] = 217; j++; break; - case 170: pNameString[ i ] = 218; j++; break; - 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 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA - - //small letters - case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A - case 177: pNameString[ i ] = 225; j++; break; - case 178: pNameString[ i ] = 226; j++; break; - case 179: pNameString[ i ] = 227; j++; break; - case 180: pNameString[ i ] = 228; j++; break; - case 181: pNameString[ i ] = 229; j++; break; - case 182: pNameString[ i ] = 230; j++; break; - case 183: pNameString[ i ] = 231; j++; break; - case 184: pNameString[ i ] = 232; j++; break; - case 185: pNameString[ i ] = 233; j++; break; - case 186: pNameString[ i ] = 234; j++; break; - 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 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE - } - } - - if ( ((unsigned char)Item[ubIndex].szBRName [j] == 209) ) //d1 - { - // 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; - case 131: pNameString[ i ] = 243; j++; break; - case 132: pNameString[ i ] = 244; j++; break; - case 133: pNameString[ i ] = 245; j++; break; - case 134: pNameString[ i ] = 246; j++; break; - case 135: pNameString[ i ] = 247; j++; break; - case 136: pNameString[ i ] = 248; j++; break; - case 137: pNameString[ i ] = 249; j++; break; - case 138: pNameString[ i ] = 250; j++; break; - case 139: pNameString[ i ] = 251; j++; break; - case 140: pNameString[ i ] = 252; j++; break; - case 141: pNameString[ i ] = 253; j++; break; - case 142: pNameString[ i ] = 254; j++; break; - case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA - - case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO - } - } - #endif - } - else - { - pNameString[i] ='\0'; - } - } -#else wcsncpy( pNameString, Item[ubIndex].szBRName, 80); pNameString[79] ='\0'; -#endif } return TRUE; } @@ -585,188 +38,8 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) { if (pDescString != NULL) { -#if 0 - int j = -1; - - for (int i=0;i<400;i++) - { - j++; - if ( j<(int)strlen(Item[ubIndex].szBRDesc)) - { - pDescString[i] = Item[ubIndex].szBRDesc [j]; - - // WANNE: German specific characters - #ifdef GERMAN - // We have a german special character - if (Item[ubIndex].szBRDesc [j] == -61) - { - // This character determines the special character - switch (Item[ubIndex].szBRDesc [j + 1]) - { - // ü - case -68: - pDescString[i] = 252; - // Skip next character, because "umlaute" have 2 chars - j++; - break; - // Ü - case -100: - pDescString[i] = 220; - j++; - break; - // ä - case -92: - pDescString[i] = 228; - j++; - break; - // Ä - case -124: - pDescString[i] = 196; - j++; - break; - // ö - case -74: - pDescString[i] = 246; - j++; - break; - // Ö - case -106: - pDescString[i] = 214; - j++; - break; - // ß - case -97: - pDescString[i] = 223; - j++; - break; - } - } - #endif - - #ifdef POLISH - switch( pDescString[ i ] ) - { - case 260: pDescString[ i ] = 165; break; - case 262: pDescString[ i ] = 198; break; - case 280: pDescString[ i ] = 202; break; - case 321: pDescString[ i ] = 163; break; - case 323: pDescString[ i ] = 209; break; - case 211: pDescString[ i ] = 211; break; - - case 346: pDescString[ i ] = 338; break; - case 379: pDescString[ i ] = 175; break; - case 377: pDescString[ i ] = 143; break; - case 261: pDescString[ i ] = 185; break; - case 263: pDescString[ i ] = 230; break; - case 281: pDescString[ i ] = 234; break; - - case 322: pDescString[ i ] = 179; break; - case 324: pDescString[ i ] = 241; break; - case 243: pDescString[ i ] = 243; break; - case 347: pDescString[ i ] = 339; break; - case 380: pDescString[ i ] = 191; break; - case 378: pDescString[ i ] = 376; break; - } - #endif - - #ifdef RUSSIAN - if ((unsigned char)Item[ubIndex].szBRDesc [j] == 208) //d0 - { - // 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 - - case 144: pDescString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A - case 145: pDescString[ i ] = 193; j++; break; - case 146: pDescString[ i ] = 194; j++; break; - case 147: pDescString[ i ] = 195; j++; break; - case 148: pDescString[ i ] = 196; j++; break; - case 149: pDescString[ i ] = 197; j++; break; - case 150: pDescString[ i ] = 198; j++; break; - case 151: pDescString[ i ] = 199; j++; break; - case 152: pDescString[ i ] = 200; j++; break; - case 153: pDescString[ i ] = 201; j++; break; - case 154: pDescString[ i ] = 202; j++; break; - case 155: pDescString[ i ] = 203; j++; break; - case 156: pDescString[ i ] = 204; j++; break; - case 157: pDescString[ i ] = 205; j++; break; - case 158: pDescString[ i ] = 206; j++; break; - case 159: pDescString[ i ] = 207; j++; break; - case 160: pDescString[ i ] = 208; j++; break; - case 161: pDescString[ i ] = 209; j++; break; - case 162: pDescString[ i ] = 210; j++; break; - case 163: pDescString[ i ] = 211; j++; break; - case 164: pDescString[ i ] = 212; j++; break; - case 165: pDescString[ i ] = 213; j++; break; - case 166: pDescString[ i ] = 214; j++; break; - case 167: pDescString[ i ] = 215; j++; break; - case 168: pDescString[ i ] = 216; j++; break; - case 169: pDescString[ i ] = 217; j++; break; - case 170: pDescString[ i ] = 218; j++; break; - 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 175: pDescString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA - - //small letters - case 176: pDescString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A - case 177: pDescString[ i ] = 225; j++; break; - case 178: pDescString[ i ] = 226; j++; break; - case 179: pDescString[ i ] = 227; j++; break; - case 180: pDescString[ i ] = 228; j++; break; - case 181: pDescString[ i ] = 229; j++; break; - case 182: pDescString[ i ] = 230; j++; break; - case 183: pDescString[ i ] = 231; j++; break; - case 184: pDescString[ i ] = 232; j++; break; - case 185: pDescString[ i ] = 233; j++; break; - case 186: pDescString[ i ] = 234; j++; break; - 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 191: pDescString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE - } - } - - if ( ((unsigned char)Item[ubIndex].szBRDesc [j] == 209) ) //d1 - { - // 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; - case 131: pDescString[ i ] = 243; j++; break; - case 132: pDescString[ i ] = 244; j++; break; - case 133: pDescString[ i ] = 245; j++; break; - case 134: pDescString[ i ] = 246; j++; break; - case 135: pDescString[ i ] = 247; j++; break; - case 136: pDescString[ i ] = 248; j++; break; - case 137: pDescString[ i ] = 249; j++; break; - case 138: pDescString[ i ] = 250; j++; break; - case 139: pDescString[ i ] = 251; j++; break; - case 140: pDescString[ i ] = 252; j++; break; - case 141: pDescString[ i ] = 253; j++; break; - case 142: pDescString[ i ] = 254; j++; break; - case 143: pDescString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA - - case 145: pDescString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO - } - } - #endif - } - else - { - pDescString[i] ='\0'; - } - } -#else wcsncpy( pDescString, Item[ubIndex].szBRDesc, 400); pDescString[399] ='\0'; -#endif } return TRUE; @@ -776,192 +49,8 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) { if(pNameString != NULL) { -#if 0 - int j = -1; - - for (int i=0;i<80;i++) - { - j++; - - if ( i<(int)wcslen(Item[ubIndex].szItemName)) - { - pNameString[i] = Item[ubIndex].szItemName [j]; - - // WANNE: German specific characters - #ifdef GERMAN - // We have a german special character - if (Item[ubIndex].szItemName [j] == -61) - { - // This character determines the special character - switch (Item[ubIndex].szItemName [j + 1]) - { - // ü - case -68: - pNameString[i] = 252; - // Skip next character, because "umlaute" have 2 chars - j++; - break; - // Ü - case -100: - pNameString[i] = 220; - j++; - break; - // ä - case -92: - pNameString[i] = 228; - j++; - break; - // Ä - case -124: - pNameString[i] = 196; - j++; - break; - // ö - case -74: - pNameString[i] = 246; - j++; - break; - // Ö - case -106: - pNameString[i] = 214; - j++; - break; - // ß - case -97: - pNameString[i] = 223; - j++; - break; - } - } - #endif - - #ifdef POLISH - switch( pNameString[ i ] ) - { - case 260: pNameString[ i ] = 165; break; - case 262: pNameString[ i ] = 198; break; - case 280: pNameString[ i ] = 202; break; - case 321: pNameString[ i ] = 163; break; - case 323: pNameString[ i ] = 209; break; - case 211: pNameString[ i ] = 211; break; - - case 346: pNameString[ i ] = 338; break; - case 379: pNameString[ i ] = 175; break; - case 377: pNameString[ i ] = 143; break; - case 261: pNameString[ i ] = 185; break; - case 263: pNameString[ i ] = 230; break; - case 281: pNameString[ i ] = 234; break; - - case 322: pNameString[ i ] = 179; break; - case 324: pNameString[ i ] = 241; break; - case 243: pNameString[ i ] = 243; break; - case 347: pNameString[ i ] = 339; break; - case 380: pNameString[ i ] = 191; break; - case 378: pNameString[ i ] = 376; break; - } - #endif - - - - #ifdef RUSSIAN - if ((unsigned char)Item[ubIndex].szItemName [j] == 208) //d0 - { - // 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 - - case 144: pNameString[ i ] = 192; j++; break; //U+0410 A d0 90 CYRILLIC CAPITAL LETTER A - case 145: pNameString[ i ] = 193; j++; break; - case 146: pNameString[ i ] = 194; j++; break; - case 147: pNameString[ i ] = 195; j++; break; - case 148: pNameString[ i ] = 196; j++; break; - case 149: pNameString[ i ] = 197; j++; break; - case 150: pNameString[ i ] = 198; j++; break; - case 151: pNameString[ i ] = 199; j++; break; - case 152: pNameString[ i ] = 200; j++; break; - case 153: pNameString[ i ] = 201; j++; break; - case 154: pNameString[ i ] = 202; j++; break; - case 155: pNameString[ i ] = 203; j++; break; - case 156: pNameString[ i ] = 204; j++; break; - case 157: pNameString[ i ] = 205; j++; break; - case 158: pNameString[ i ] = 206; j++; break; - case 159: pNameString[ i ] = 207; j++; break; - case 160: pNameString[ i ] = 208; j++; break; - case 161: pNameString[ i ] = 209; j++; break; - case 162: pNameString[ i ] = 210; j++; break; - case 163: pNameString[ i ] = 211; j++; break; - case 164: pNameString[ i ] = 212; j++; break; - case 165: pNameString[ i ] = 213; j++; break; - case 166: pNameString[ i ] = 214; j++; break; - case 167: pNameString[ i ] = 215; j++; break; - case 168: pNameString[ i ] = 216; j++; break; - case 169: pNameString[ i ] = 217; j++; break; - case 170: pNameString[ i ] = 218; j++; break; - 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 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA - - //small letters - case 176: pNameString[ i ] = 224; j++; break; //U+0430 a d0 b0 CYRILLIC SMALL LETTER A - case 177: pNameString[ i ] = 225; j++; break; - case 178: pNameString[ i ] = 226; j++; break; - case 179: pNameString[ i ] = 227; j++; break; - case 180: pNameString[ i ] = 228; j++; break; - case 181: pNameString[ i ] = 229; j++; break; - case 182: pNameString[ i ] = 230; j++; break; - case 183: pNameString[ i ] = 231; j++; break; - case 184: pNameString[ i ] = 232; j++; break; - case 185: pNameString[ i ] = 233; j++; break; - case 186: pNameString[ i ] = 234; j++; break; - 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 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE - } - } - - if ( ((unsigned char)Item[ubIndex].szItemName [j] == 209) ) //d1 - { - // 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; - case 131: pNameString[ i ] = 243; j++; break; - case 132: pNameString[ i ] = 244; j++; break; - case 133: pNameString[ i ] = 245; j++; break; - case 134: pNameString[ i ] = 246; j++; break; - case 135: pNameString[ i ] = 247; j++; break; - case 136: pNameString[ i ] = 248; j++; break; - case 137: pNameString[ i ] = 249; j++; break; - case 138: pNameString[ i ] = 250; j++; break; - case 139: pNameString[ i ] = 251; j++; break; - case 140: pNameString[ i ] = 252; j++; break; - case 141: pNameString[ i ] = 253; j++; break; - case 142: pNameString[ i ] = 254; j++; break; - case 143: pNameString[ i ] = 255; j++; break; //U+044F d1 8f CYRILLIC SMALL LETTER YA - - case 145: pNameString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO - } - } - #endif - - } - else - { - pNameString[i] ='\0'; - } - } -#else wcsncpy( pNameString, Item[ubIndex].szItemName, 80 ); pNameString[79] ='\0'; -#endif } return(TRUE); diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index 8b6836c75..a2634b5fb 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -393,115 +393,18 @@ BOOLEAN HandleJA2CDCheck( ) #endif -#ifdef NOCDCHECK return( TRUE ); -#else - BOOLEAN fFailed = FALSE; - CHAR8 zCdLocation[ SGPFILENAME_LEN ]; - CHAR8 zCdFile[ SGPFILENAME_LEN ]; - 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 ] ); - - hFile = FileOpen( zCdFile, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); - - // Check if it exists... - if ( !hFile ) - { - fFailed = TRUE; - FileClose( hFile ); - break; - } - - // Check min size -//#ifndef GERMAN -// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] ) -// { -// fFailed = TRUE; -// FileClose( hFile ); -// break; -// } -//#endif - - FileClose( hFile ); - - } - } - else - { - fFailed = TRUE; - } - - if ( fFailed ) - { - CHAR8 zErrorMessage[256]; - - sprintf( zErrorMessage, "%S", gzLateLocalizedString[ 56 ] ); - // Pop up message boc and get answer.... - if ( MessageBox( NULL, zErrorMessage, "Jagged Alliance 2 v1.13", MB_OK ) == IDOK ) - { - return( FALSE ); - } - } - - return( TRUE ); - -#endif } BOOLEAN HandleJA2CDCheckTwo( ) { -#ifdef NOCDCHECK return( TRUE ); -#else - BOOLEAN fFailed = TRUE; - CHAR8 zCdLocation[ SGPFILENAME_LEN ]; - CHAR8 zCdFile[ SGPFILENAME_LEN ]; - - // Check for a file on CD.... - if( GetCDromDriveLetter( zCdLocation ) ) - { - // OK, build filename - sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ Random( 2 ) ] ); - - // Check if it exists... - if ( FileExists( zCdFile ) ) - { - fFailed = FALSE; - } - } - - if ( fFailed ) - { - CHAR8 zErrorMessage[256]; - - sprintf( zErrorMessage, "%S", gzLateLocalizedString[ 56 ] ); - // Pop up message boc and get answer.... - if ( MessageBox( NULL, zErrorMessage, "Jagged Alliance 2 v1.13", MB_OK ) == IDOK ) - { - return( FALSE ); - } - } - else - { - return( TRUE ); - } - - return( FALSE ); -#endif } diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index ce4cac81f..7a576d561 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -384,9 +384,6 @@ 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 { @@ -438,136 +435,40 @@ itemEndElementHandle(void *userData, const XML_Char *name) // pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0'; //} -#if 0 - if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - strcpy(pData->curItem.szItemName,pData->szCharData); - else - { - strncpy(pData->curItem.szItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH); - pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0'; - } - - for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) - { - temp = pData->szCharData[i]; - pData->curItem.szItemName[i] = temp; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemname[%d] = %s, temp = %s",i,&pData->curItem.szItemName[i],&temp)); - } -#else MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemName, sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) ); pData->curItem.szItemName[sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "szLongItemName") == 0) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: longitemname"); pData->curElement = ELEMENT; -#if 0 - if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - { - strcpy(pData->curItem.szLongItemName,pData->szCharData); - } - else - { - strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH); - pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0'; - } - - for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) - { - temp = pData->szCharData[i]; - pData->curItem.szLongItemName[i] = temp; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: longitemname[%d] = %s, temp = %s",i,&pData->curItem.szLongItemName[i],&temp)); - } - //if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - //{ - // strcpy(pData->curItem.szLongItemName,pData->szCharData); - //} - //else - //{ - // strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH); - // pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0'; - //} -#else MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szLongItemName, sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) ); pData->curItem.szLongItemName[sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "szItemDesc") == 0) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: itemdesc"); pData->curElement = ELEMENT; -#if 0 - if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - strcpy(pData->curItem.szItemDesc,pData->szCharData); - else - { - strncpy(pData->curItem.szItemDesc,pData->szCharData,MAX_CHAR_DATA_LENGTH); - pData->curItem.szItemDesc[MAX_CHAR_DATA_LENGTH] = '\0'; - } - - for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) - { - temp = pData->szCharData[i]; - pData->curItem.szItemDesc[i] = temp; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemdesc[%d] = %s, temp = %s",i,&pData->curItem.szItemDesc[i],&temp)); - } -#else MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemDesc, sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) ); pData->curItem.szItemDesc[sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "szBRName") == 0) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brname"); pData->curElement = ELEMENT; -#if 0 - if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - strcpy(pData->curItem.szBRName,pData->szCharData); - else - { - strncpy(pData->curItem.szBRName,pData->szCharData,MAX_CHAR_DATA_LENGTH); - pData->curItem.szBRName[MAX_CHAR_DATA_LENGTH] = '\0'; - } - - for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) - { - temp = pData->szCharData[i]; - pData->curItem.szBRName[i] = temp; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRname[%d] = %s, temp = %s",i,&pData->curItem.szBRName[i],&temp)); - } -#else MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRName, sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) ); pData->curItem.szBRName[sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "szBRDesc") == 0) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brdesc"); pData->curElement = ELEMENT; -#if 0 - if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) - strcpy(pData->curItem.szBRDesc,pData->szCharData); - else - { - strncpy(pData->curItem.szBRDesc,pData->szCharData,MAX_CHAR_DATA_LENGTH); - pData->curItem.szBRDesc[MAX_CHAR_DATA_LENGTH] = '\0'; - } - - for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) - { - temp = pData->szCharData[i]; - pData->curItem.szBRDesc[i] = temp; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRdesc[%d] = %s, temp = %s",i,&pData->curItem.szBRDesc[i],&temp)); - } -#else MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRDesc, sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) ); pData->curItem.szBRDesc[sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) - 1] = '\0'; -#endif } else if(strcmp(name, "usItemClass") == 0) {