Merge branch 'master' of github.com:1dot13/source

This commit is contained in:
zwwooooo
2023-04-12 13:49:10 +08:00
144 changed files with 2722 additions and 8444 deletions
+46
View File
@@ -0,0 +1,46 @@
root = true
[*.{cpp,h}]
indent_style = tabs
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
# Charset encoding is an open topic, we would need to convert all files to the ideal encoding the world uses
# Visual Studio requires BOM to properly detect files as being utf if not using .editorconfig, but with .editorconfig we don't need the bom
#charset = utf-8
#charset = utf-8-bom
# Currently windows-1252 seems to be used for most files, but thats not an officially supported .editorconfig encoding
#charset = windows-1252
# cmake
[*.json]
charset = utf-8
indent_style = spaces
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
# github workflow
[*.{yml,yaml}]
charset = utf-8
indent_style = spaces
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
# gamedir xml
[*.xml]
charset = utf-8
indent_style = tabs
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
# gamedir ini
[*.ini]
charset = utf-8
indent_style = tabs
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
+5 -11
View File
@@ -96,20 +96,14 @@ jobs:
then
# if we build for a specific tag, use that as the game version
# examples:
# - v1.3.3
# - v1.3.2-rc2
# - v1.13.1
# - v1.13.2-rc2
GAME_VERSION="$GITHUB_REF_NAME"
else
# tag the very first commit as v1.13, fixes git describe if no tags are around
if ! git rev-list v1.13 2>/dev/null
then
git tag v1.13 $(git rev-list --max-parents=0 HEAD) && git push origin v1.13
fi
# uses `git describe`, which tries to find a tag in the commit hierarchy
# uses `git describe`, which tries to find a tag in the commit hierarchy. or fall back to a v1.13 version
# example five (5) commits after v1.13:
# - v1.13-5-7g7ffa
GAME_VERSION="$(git describe --tags --match='v[0-9]*' $GITHUB_SHA)"
GAME_VERSION="$(git describe --tags --match='v[0-9]*' $GITHUB_SHA || echo v0-$(git rev-list --skip 1 --count $GITHUB_SHA)-g${GITHUB_SHA:0:8})"
fi
# max 15 CHAR8
GAME_VERSION="${GAME_VERSION:0:15}"
@@ -201,7 +195,7 @@ jobs:
- name: Delete Latest
if: startsWith(github.ref, 'refs/tags/v') == false
uses: dev-drprasad/delete-tag-and-release@master
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: "latest"
env:
+4 -3
View File
@@ -187,7 +187,8 @@ jobs:
set -eux
# "-" separates words, "_" combines words, see double-click behavior
DIST_NAME="JA2-${GAME_VERSION}-G${GAMEDIR_COMMIT_SHA:0:4}L${GAMEDIR_LANGUAGES_COMMIT_SHA:0:4}-${{ inputs.language }}"
DIST_PREFIX='JA2_113'
DIST_NAME="${DIST_PREFIX}-${GAME_VERSION}-G${GAMEDIR_COMMIT_SHA:0:4}L${GAMEDIR_LANGUAGES_COMMIT_SHA:0:4}-${{ inputs.language }}"
echo "DIST_NAME=$DIST_NAME" >> $GITHUB_ENV
echo "If you encounter problems during gameplay, please provide the following version information:
@@ -204,8 +205,8 @@ jobs:
Gamedir Languages Repository: $GAMEDIR_LANGUAGES_REPOSITORY
Gamedir Languages Commit SHA: $GAMEDIR_LANGUAGES_COMMIT_SHA
Gamedir Languages Commit Date: $GAMEDIR_LANGUAGES_COMMIT_DATETIME
" > gamedir/ja2_1.13_version.txt
cat gamedir/ja2_1.13_version.txt
" > "gamedir/${DIST_PREFIX}-Version.txt"
cat "gamedir/${DIST_PREFIX}-Version.txt"
- name: Create release archive
shell: bash
+9 -2
View File
@@ -1,4 +1,11 @@
# CLion
.idea/
cmake-build-*/
# Visual Studio 2022
.vs/
build/
lib/
.vs/
.idea/
out/
CMakeSettings.json
/CMakeUserPresets.json
+172
View File
@@ -0,0 +1,172 @@
cmake_minimum_required(VERSION 3.20)
project(ja2)
include(cmake/CopyUserPresetTemplate.cmake)
CopyUserPresetTemplate()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# lua51.lib and lua51.vc9.lib have been built with /MTx, so we must as well
# TODO: build our own Lua 5.1.2 from source so we can use whichever
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP USE_VFS _CRT_SECURE_NO_DEPRECATE)
include_directories(${CMAKE_SOURCE_DIR} "ext/VFS/include" Utils TileEngine TacticalAI ModularizedTacticalAI Tactical Strategic "Standard Gaming Platform" Res Lua Laptop Multiplayer "Multiplayer/raknet" Editor Console)
# external libraries
add_subdirectory("ext/libpng")
add_subdirectory("ext/zlib")
add_subdirectory("ext/VFS")
target_link_libraries(bfVFS PRIVATE 7z)
# ja2export utility
add_subdirectory("ext/export/src")
# static libraries whose source files, header files or header files included
# by header files do not rely on Applications or Languages preprocessor definitions,
# and therefore only need to be compiled once. Good.
add_subdirectory(Lua)
# static libraries whose source files, header files or header files included
# by header files rely on Application and Language preprocessor definitions, and
# therefore need to be compiled multiple times. Very Bad.
add_subdirectory(TileEngine)
add_subdirectory(TacticalAI)
add_subdirectory(Utils)
add_subdirectory(Strategic)
add_subdirectory("Standard Gaming Platform")
add_subdirectory(Laptop)
add_subdirectory(Editor)
add_subdirectory(Console)
add_subdirectory(Tactical)
add_subdirectory(ModularizedTacticalAI)
# TODO: Rename 'Standard Gaming Platform' directory to 'SGP' so this can be refactored away
set(Ja2_Libs
TileEngine
TacticalAI
Utils
Strategic
SGP
Laptop
Editor
Console
Tactical
ModularizedTacticalAI
)
# TODO: Move these units into their own directory to declutter the root dir and CMakeLists.txt file
set(Ja2Src
"aniviewscreen.cpp"
"Credits.cpp"
"Fade Screen.cpp"
"FeaturesScreen.cpp"
"GameInitOptionsScreen.cpp"
"gameloop.cpp"
"gamescreen.cpp"
"GameSettings.cpp"
"GameVersion.cpp"
"HelpScreen.cpp"
"Init.cpp"
"Intro.cpp"
"JA2 Splash.cpp"
"Ja25Update.cpp"
"jascreens.cpp"
"Language Defines.cpp"
"Loading Screen.cpp"
"MainMenuScreen.cpp"
"MessageBoxScreen.cpp"
"MPChatScreen.cpp"
"MPConnectScreen.cpp"
"MPHostScreen.cpp"
"MPJoinScreen.cpp"
"MPScoreScreen.cpp"
"MPXmlTeams.cpp"
"Multiplayer/client.cpp"
"Multiplayer/server.cpp"
"Multiplayer/transfer_rules.cpp"
"Options Screen.cpp"
"profiler.cpp"
"SaveLoadGame.cpp"
"SaveLoadScreen.cpp"
"SCREENS.cpp"
"Sys Globals.cpp"
"ub_config.cpp"
"XML_DifficultySettings.cpp"
"XML_IntroFiles.cpp"
"XML_Layout_MainMenu.cpp"
Res/ja2.rc
)
set(Ja2_Libraries
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${PROJECT_SOURCE_DIR}/lua51.lib"
"${PROJECT_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${PROJECT_SOURCE_DIR}/SMACKW32.LIB"
"${PROJECT_SOURCE_DIR}/binkw32.lib"
bfVFS
"${PROJECT_SOURCE_DIR}/Multiplayer/raknet/RakNetLibStatic.lib"
"ws2_32.lib"
)
# simple function to validate Languages and Application choices
include(cmake/ValidateOptions.cmake)
set(ValidLanguages CHINESE DUTCH ENGLISH FRENCH GERMAN ITALIAN POLISH RUSSIAN)
ValidateOptions("${ValidLanguages}" "Languages" "${Languages}" "LangTargets")
set(ValidApplications JA2 JA2MAPEDITOR JA2UB JA2UBMAPEDITOR)
ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "ApplicationTargets")
# preprocessor definitions for Debug build, per the legacy MSBuild
set(debugFlags $<IF:$<CONFIG:Debug>,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>)
# Due to widespread preprocessor definition abuse in the codebase, practically
# every library-language-executable combination is its own compilation target
# TODO: refactor preprocessor usage onto, ideally, a single translation unit
foreach(lang IN LISTS LangTargets)
foreach(exe IN LISTS ApplicationTargets)
set(Executable ${exe}_${lang})
# executable for an application/language combination, e.g. JA2_ENGLISH.exe
add_executable(${Executable} WIN32)
target_sources(${Executable} PRIVATE ${Ja2Src})
# Good libraries have already been built, can be simply linked here
target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries})
# for each app/lang combination, the Very Bad libraries need to be built,
# with the appropriate preprocessor definitions
foreach(lib IN LISTS Ja2_Libs)
# syntactic sugar to hopefully make this more readable
set(VeryBadLib ${Executable}_${lib})
set(isEditor $<STREQUAL:${exe},JA2MAPEDITOR>)
set(isUb $<STREQUAL:${exe},JA2UB>)
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
# static library for an app/lang combination, e.g. JA2_ENGLISH_SGP.lib
add_library(${VeryBadLib})
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
target_compile_definitions(${VeryBadLib} PUBLIC
$<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,>
$<IF:${isUb},JA2UB;JA2UBMAPS,>
$<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,>
${debugFlags}
${lang}
)
target_link_libraries(${Executable} PUBLIC ${VeryBadLib})
endforeach()
# for SGP only
target_link_libraries(${Executable}_SGP PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
target_link_libraries(${Executable}_SGP PUBLIC libpng)
target_compile_definitions(${Executable}_SGP PRIVATE NO_ZLIB_COMPRESSION)
endforeach()
endforeach()
+6
View File
@@ -0,0 +1,6 @@
set(ConsoleSrc
"${CMAKE_CURRENT_SOURCE_DIR}/Console.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Cursors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Dialogs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FileStream.cpp"
PARENT_SCOPE)
-1700
View File
File diff suppressed because it is too large Load Diff
-74
View File
@@ -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)) {
-6
View File
@@ -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
};
/////////////////////////////////////////////////////////////////////////////
+27
View File
@@ -0,0 +1,27 @@
set(EditorSrc
"${CMAKE_CURRENT_SOURCE_DIR}/Cursor Modes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Editor Callbacks.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Editor Modes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Editor Taskbar Creation.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Editor Taskbar Utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Editor Undo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EditorBuildings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EditorItems.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EditorMapInfo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EditorMercs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EditorTerrain.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/editscreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/edit_sys.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Item Statistics.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LoadScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/messagebox.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/newsmooth.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/popupmenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Road Smoothing.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Sector Summary.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/selectwin.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SmartMethod.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/smooth.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Smoothing Utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ActionItems.cpp"
PARENT_SCOPE)
-39
View File
@@ -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
}
}
-93
View File
@@ -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 );
-37
View File
@@ -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 )
{
-6
View File
@@ -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 );
}
+283
View File
@@ -1,5 +1,281 @@
#pragma once
#include "BuildDefines.h"
//-----------------------------------------------
//
// civilian "sub teams":
enum
{
NON_CIV_GROUP = 0,
REBEL_CIV_GROUP,
KINGPIN_CIV_GROUP,
SANMONA_ARMS_GROUP,
ANGELS_GROUP,
BEGGARS_CIV_GROUP,
TOURISTS_CIV_GROUP,
ALMA_MILITARY_CIV_GROUP,
DOCTORS_CIV_GROUP,
COUPLE1_CIV_GROUP,
HICKS_CIV_GROUP,
WARDEN_CIV_GROUP,
JUNKYARD_CIV_GROUP,
FACTORY_KIDS_GROUP,
QUEENS_CIV_GROUP,
UNNAMED_CIV_GROUP_15,
UNNAMED_CIV_GROUP_16,
UNNAMED_CIV_GROUP_17,
UNNAMED_CIV_GROUP_18,
UNNAMED_CIV_GROUP_19,
ASSASSIN_CIV_GROUP, // Flugente: enemy assassins belong to this group
POW_PRISON_CIV_GROUP, // Flugente: prisoners of war the player caught are in this group
UNNAMED_CIV_GROUP_22,
UNNAMED_CIV_GROUP_23,
VOLUNTEER_CIV_GROUP, // Flugente: civilians that the player recruited
BOUNTYHUNTER_CIV_GROUP, // Flugente: hostile bounty hunters
DOWNEDPILOT_CIV_GROUP, // Flugente: downed pilots
SCIENTIST_GROUP, // Flugente: enemy civilian personnel
RADAR_TECHNICIAN_GROUP,
AIRPORT_STAFF_GROUP,
BARRACK_STAFF_GROUP,
FACTORY_GROUP,
ADMINISTRATIVE_STAFF_GROUP,
LOYAL_CIV_GROUP, // civil population deeply loyal to the queen
BLACKMARKET_GROUP, // black market dealer and bodyguards
UNNAMED_CIV_GROUP_35,
UNNAMED_CIV_GROUP_36,
UNNAMED_CIV_GROUP_37,
UNNAMED_CIV_GROUP_38,
UNNAMED_CIV_GROUP_39,
UNNAMED_CIV_GROUP_40,
UNNAMED_CIV_GROUP_41,
UNNAMED_CIV_GROUP_42,
UNNAMED_CIV_GROUP_43,
UNNAMED_CIV_GROUP_44,
UNNAMED_CIV_GROUP_45,
UNNAMED_CIV_GROUP_46,
UNNAMED_CIV_GROUP_47,
UNNAMED_CIV_GROUP_48,
UNNAMED_CIV_GROUP_49,
UNNAMED_CIV_GROUP_50,
UNNAMED_CIV_GROUP_51,
UNNAMED_CIV_GROUP_52,
UNNAMED_CIV_GROUP_53,
UNNAMED_CIV_GROUP_54,
UNNAMED_CIV_GROUP_55,
UNNAMED_CIV_GROUP_56,
UNNAMED_CIV_GROUP_57,
UNNAMED_CIV_GROUP_58,
UNNAMED_CIV_GROUP_59,
UNNAMED_CIV_GROUP_60,
UNNAMED_CIV_GROUP_61,
UNNAMED_CIV_GROUP_62,
UNNAMED_CIV_GROUP_63,
UNNAMED_CIV_GROUP_64,
UNNAMED_CIV_GROUP_65,
UNNAMED_CIV_GROUP_66,
UNNAMED_CIV_GROUP_67,
UNNAMED_CIV_GROUP_68,
UNNAMED_CIV_GROUP_69,
UNNAMED_CIV_GROUP_70,
UNNAMED_CIV_GROUP_71,
UNNAMED_CIV_GROUP_72,
UNNAMED_CIV_GROUP_73,
UNNAMED_CIV_GROUP_74,
UNNAMED_CIV_GROUP_75,
UNNAMED_CIV_GROUP_76,
UNNAMED_CIV_GROUP_77,
UNNAMED_CIV_GROUP_78,
UNNAMED_CIV_GROUP_79,
UNNAMED_CIV_GROUP_80,
UNNAMED_CIV_GROUP_81,
UNNAMED_CIV_GROUP_82,
UNNAMED_CIV_GROUP_83,
UNNAMED_CIV_GROUP_84,
UNNAMED_CIV_GROUP_85,
UNNAMED_CIV_GROUP_86,
UNNAMED_CIV_GROUP_87,
UNNAMED_CIV_GROUP_88,
UNNAMED_CIV_GROUP_89,
UNNAMED_CIV_GROUP_90,
UNNAMED_CIV_GROUP_91,
UNNAMED_CIV_GROUP_92,
UNNAMED_CIV_GROUP_93,
UNNAMED_CIV_GROUP_94,
UNNAMED_CIV_GROUP_95,
UNNAMED_CIV_GROUP_96,
UNNAMED_CIV_GROUP_97,
UNNAMED_CIV_GROUP_98,
UNNAMED_CIV_GROUP_99,
UNNAMED_CIV_GROUP_100,
UNNAMED_CIV_GROUP_101,
UNNAMED_CIV_GROUP_102,
UNNAMED_CIV_GROUP_103,
UNNAMED_CIV_GROUP_104,
UNNAMED_CIV_GROUP_105,
UNNAMED_CIV_GROUP_106,
UNNAMED_CIV_GROUP_107,
UNNAMED_CIV_GROUP_108,
UNNAMED_CIV_GROUP_109,
UNNAMED_CIV_GROUP_110,
UNNAMED_CIV_GROUP_111,
UNNAMED_CIV_GROUP_112,
UNNAMED_CIV_GROUP_113,
UNNAMED_CIV_GROUP_114,
UNNAMED_CIV_GROUP_115,
UNNAMED_CIV_GROUP_116,
UNNAMED_CIV_GROUP_117,
UNNAMED_CIV_GROUP_118,
UNNAMED_CIV_GROUP_119,
UNNAMED_CIV_GROUP_120,
UNNAMED_CIV_GROUP_121,
UNNAMED_CIV_GROUP_122,
UNNAMED_CIV_GROUP_123,
UNNAMED_CIV_GROUP_124,
UNNAMED_CIV_GROUP_125,
UNNAMED_CIV_GROUP_126,
UNNAMED_CIV_GROUP_127,
UNNAMED_CIV_GROUP_128,
UNNAMED_CIV_GROUP_129,
UNNAMED_CIV_GROUP_130,
UNNAMED_CIV_GROUP_131,
UNNAMED_CIV_GROUP_132,
UNNAMED_CIV_GROUP_133,
UNNAMED_CIV_GROUP_134,
UNNAMED_CIV_GROUP_135,
UNNAMED_CIV_GROUP_136,
UNNAMED_CIV_GROUP_137,
UNNAMED_CIV_GROUP_138,
UNNAMED_CIV_GROUP_139,
UNNAMED_CIV_GROUP_140,
UNNAMED_CIV_GROUP_141,
UNNAMED_CIV_GROUP_142,
UNNAMED_CIV_GROUP_143,
UNNAMED_CIV_GROUP_144,
UNNAMED_CIV_GROUP_145,
UNNAMED_CIV_GROUP_146,
UNNAMED_CIV_GROUP_147,
UNNAMED_CIV_GROUP_148,
UNNAMED_CIV_GROUP_149,
UNNAMED_CIV_GROUP_150,
UNNAMED_CIV_GROUP_151,
UNNAMED_CIV_GROUP_152,
UNNAMED_CIV_GROUP_153,
UNNAMED_CIV_GROUP_154,
UNNAMED_CIV_GROUP_155,
UNNAMED_CIV_GROUP_156,
UNNAMED_CIV_GROUP_157,
UNNAMED_CIV_GROUP_158,
UNNAMED_CIV_GROUP_159,
UNNAMED_CIV_GROUP_160,
UNNAMED_CIV_GROUP_161,
UNNAMED_CIV_GROUP_162,
UNNAMED_CIV_GROUP_163,
UNNAMED_CIV_GROUP_164,
UNNAMED_CIV_GROUP_165,
UNNAMED_CIV_GROUP_166,
UNNAMED_CIV_GROUP_167,
UNNAMED_CIV_GROUP_168,
UNNAMED_CIV_GROUP_169,
UNNAMED_CIV_GROUP_170,
UNNAMED_CIV_GROUP_171,
UNNAMED_CIV_GROUP_172,
UNNAMED_CIV_GROUP_173,
UNNAMED_CIV_GROUP_174,
UNNAMED_CIV_GROUP_175,
UNNAMED_CIV_GROUP_176,
UNNAMED_CIV_GROUP_177,
UNNAMED_CIV_GROUP_178,
UNNAMED_CIV_GROUP_179,
UNNAMED_CIV_GROUP_180,
UNNAMED_CIV_GROUP_181,
UNNAMED_CIV_GROUP_182,
UNNAMED_CIV_GROUP_183,
UNNAMED_CIV_GROUP_184,
UNNAMED_CIV_GROUP_185,
UNNAMED_CIV_GROUP_186,
UNNAMED_CIV_GROUP_187,
UNNAMED_CIV_GROUP_188,
UNNAMED_CIV_GROUP_189,
UNNAMED_CIV_GROUP_190,
UNNAMED_CIV_GROUP_191,
UNNAMED_CIV_GROUP_192,
UNNAMED_CIV_GROUP_193,
UNNAMED_CIV_GROUP_194,
UNNAMED_CIV_GROUP_195,
UNNAMED_CIV_GROUP_196,
UNNAMED_CIV_GROUP_197,
UNNAMED_CIV_GROUP_198,
UNNAMED_CIV_GROUP_199,
UNNAMED_CIV_GROUP_200,
UNNAMED_CIV_GROUP_201,
UNNAMED_CIV_GROUP_202,
UNNAMED_CIV_GROUP_203,
UNNAMED_CIV_GROUP_204,
UNNAMED_CIV_GROUP_205,
UNNAMED_CIV_GROUP_206,
UNNAMED_CIV_GROUP_207,
UNNAMED_CIV_GROUP_208,
UNNAMED_CIV_GROUP_209,
UNNAMED_CIV_GROUP_210,
UNNAMED_CIV_GROUP_211,
UNNAMED_CIV_GROUP_212,
UNNAMED_CIV_GROUP_213,
UNNAMED_CIV_GROUP_214,
UNNAMED_CIV_GROUP_215,
UNNAMED_CIV_GROUP_216,
UNNAMED_CIV_GROUP_217,
UNNAMED_CIV_GROUP_218,
UNNAMED_CIV_GROUP_219,
UNNAMED_CIV_GROUP_220,
UNNAMED_CIV_GROUP_221,
UNNAMED_CIV_GROUP_222,
UNNAMED_CIV_GROUP_223,
UNNAMED_CIV_GROUP_224,
UNNAMED_CIV_GROUP_225,
UNNAMED_CIV_GROUP_226,
UNNAMED_CIV_GROUP_227,
UNNAMED_CIV_GROUP_228,
UNNAMED_CIV_GROUP_229,
UNNAMED_CIV_GROUP_230,
UNNAMED_CIV_GROUP_231,
UNNAMED_CIV_GROUP_232,
UNNAMED_CIV_GROUP_233,
UNNAMED_CIV_GROUP_234,
UNNAMED_CIV_GROUP_235,
UNNAMED_CIV_GROUP_236,
UNNAMED_CIV_GROUP_237,
UNNAMED_CIV_GROUP_238,
UNNAMED_CIV_GROUP_239,
UNNAMED_CIV_GROUP_240,
UNNAMED_CIV_GROUP_241,
UNNAMED_CIV_GROUP_242,
UNNAMED_CIV_GROUP_243,
UNNAMED_CIV_GROUP_244,
UNNAMED_CIV_GROUP_245,
UNNAMED_CIV_GROUP_246,
UNNAMED_CIV_GROUP_247,
UNNAMED_CIV_GROUP_248,
UNNAMED_CIV_GROUP_249,
UNNAMED_CIV_GROUP_250,
UNNAMED_CIV_GROUP_251,
UNNAMED_CIV_GROUP_252,
UNNAMED_CIV_GROUP_253,
UNNAMED_CIV_GROUP_254,
NUM_CIV_GROUPS
};
#define CIV_GROUP_NEUTRAL 0
#define CIV_GROUP_WILL_EVENTUALLY_BECOME_HOSTILE 1
#define CIV_GROUP_WILL_BECOME_HOSTILE 2
#define CIV_GROUP_HOSTILE 3
#ifdef JA2EDITOR
#ifndef __EDITORMERCS_H
@@ -110,6 +386,13 @@ void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent );
extern UINT16 gusMercsNewItemIndex;
extern BOOLEAN gfRenderMercInfo;
//NOTE: The editor uses these enumerations, so please update the text as well if you modify or
// add new groups. Try to abbreviate the team name as much as possible. The text is in
// EditorMercs.c
extern CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 128 ];
//
//-----------------------------------------------
void ChangeCivGroup( UINT8 ubNewCivGroup );
#define MERCINV_LGSLOT_WIDTH 48
+2 -2
View File
@@ -562,7 +562,7 @@ void CreateFileDialog( STR16 zTitle )
//File list window
iFileDlgButtons[4] = CreateHotSpot( (iScreenWidthOffset + 179+4), (iScreenHeightOffset + 69+3), (179+4+240), (69+120+3), MSYS_PRIORITY_HIGH-1, BUTTON_NO_CALLBACK, FDlgNamesCallback);
//Title button
iFileDlgButtons[5] = CreateTextButton(zTitle, HUGEFONT, FONT_LTKHAKI, FONT_DKKHAKI,
iFileDlgButtons[5] = CreateTextButton(zTitle, GetHugeFont(), FONT_LTKHAKI, FONT_DKKHAKI,
BUTTON_USE_DEFAULT,iScreenWidthOffset + 179, iScreenHeightOffset + 39,281,30,BUTTON_NO_TOGGLE,
MSYS_PRIORITY_HIGH-2,BUTTON_NO_CALLBACK,BUTTON_NO_CALLBACK);
DisableButton(iFileDlgButtons[5]);
@@ -1013,7 +1013,7 @@ UINT32 ProcessFileIO()
case INITIATE_MAP_SAVE: //draw save message
StartFrameBufferRender( );
SaveFontSettings();
SetFont( HUGEFONT );
SetFont( GetHugeFont() );
SetFontForeground( FONT_LTKHAKI );
SetFontShadow( FONT_DKKHAKI );
SetFontBackground( 0 );
+2 -276
View File
@@ -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 ] =
@@ -1824,28 +1808,6 @@ void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason )
#include "Tile Surface.h"
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
}
BOOLEAN HandleSummaryInput( InputAtom *pEvent )
{
if( !gfSummaryWindowActive )
@@ -1871,17 +1833,6 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent )
else if( gfWorldLoaded )
DestroySummaryWindow();
break;
case F6:
PerformTest();
break;
case F7:
for( x = 0; x < 10; x++ )
PerformTest();
break;
case F8:
for( x = 0; x < 100; x++ )
PerformTest();
break;
case 'y':case 'Y':
if( gusNumEntriesWithOutdatedOrNoSummaryInfo && !gfOutdatedDenied )
{
@@ -3029,16 +2980,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 );
@@ -3134,11 +3075,11 @@ void ApologizeOverrideAndForceUpdateEverything()
//Draw it
DrawButton( iSummaryButton[ SUMMARY_BACKGROUND ] );
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
SetFont( HUGEFONT );
SetFont( GetHugeFont() );
SetFontForeground( FONT_RED );
SetFontShadow( FONT_NEARBLACK );
swprintf( str, pApologizeOverrideAndForceUpdateEverythingText[0] );
mprintf( (iScreenWidthOffset + 320) - StringPixLength( str, HUGEFONT )/2, iScreenHeightOffset + 105, str );
mprintf( (iScreenWidthOffset + 320) - StringPixLength( str, GetHugeFont() )/2, iScreenHeightOffset + 105, str );
SetFont( FONT10ARIAL );
SetFontForeground( FONT_YELLOW );
swprintf( str, pApologizeOverrideAndForceUpdateEverythingText[1], gusNumberOfMapsToBeForceUpdated );
@@ -3252,220 +3193,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 +3357,6 @@ L01:
}
}
}
#endif
UINT8 GetCurrentSummaryVersion()
{
-238
View File
@@ -505,8 +505,6 @@ BOOLEAN EditModeShutdown( void )
RemoveLightPositionHandles( );
MapOptimize();
RemoveCursors();
fHelpScreen = FALSE;
@@ -2090,22 +2088,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 +2103,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 +2118,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 +2126,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 +3204,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 +3221,6 @@ BOOLEAN RemoveLight(INT16 iMapX, INT16 iMapY, INT8 bLightType)
RemoveAllObjectsOfTypeRange(iMapIndex, GOODRING, GOODRING);
return(fRemovedLight);
}
#endif
//----------------------------------------------------------------------------------------------
// ShowLightPositionHandles
@@ -3459,97 +3339,6 @@ BOOLEAN CheckForSlantRoofs( void )
//----------------------------------------------------------------------------------------------
// MapOptimize
//
// Runs through all map locations, and if it's outside the visible world, then we remove
// EVERYTHING from it since it will never be seen!
//
// If it can be seen, then we remove all extraneous land tiles. We find the tile that has the first
// FULL TILE indicator, and delete anything that may come after it (it'll never be seen anyway)
//
// Doing the above has shown to free up about 1.1 Megs on the default map. Deletion of non-viewable
// land pieces alone gained us about 600 K of memory.
//
void MapOptimize(void)
{
#if 0
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
}
//----------------------------------------------------------------------------------------------
// CheckForFences
//
@@ -3929,29 +3718,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 +3963,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;
}
-2
View File
@@ -57,8 +57,6 @@ void HideEditorToolbar( INT32 iOldTaskMode );
void ProcessSelectionArea();
void MapOptimize(void);
extern UINT16 GenericButtonFillColors[40];
//These go together. The taskbar has a specific color scheme.
+11 -9
View File
@@ -284,7 +284,7 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[TOPTION_RTCONFIRM] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_RTCONFIRM" , FALSE );
gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SLEEPWAKE_NOTIFICATION" , TRUE );
gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_USE_METRIC_SYSTEM" , TRUE );
gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_MERC_ALWAYS_LIGHT_UP" , FALSE );
gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] = iniReader.ReadBoolean("JA2 Game Settings", "TOPTION_MERC_CASTS_LIGHT" , FALSE);
gGameSettings.fOptions[TOPTION_SMART_CURSOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SMART_CURSOR" , FALSE );
gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SNAP_CURSOR_TO_DOOR" , TRUE );
gGameSettings.fOptions[TOPTION_GLOW_ITEMS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_GLOW_ITEMS" , TRUE );
@@ -332,6 +332,8 @@ BOOLEAN LoadGameSettings()
else
gGameSettings.fOptions[TOPTION_TOGGLE_TURN_MODE] = FALSE;
gGameSettings.fOptions[TOPTION_ALT_START_AIM] = iniReader.ReadBoolean("JA2 Game Settings", "TOPTION_ALT_START_AIM" , FALSE); // Start at max aiming level instead of default no aiming
gGameSettings.fOptions[TOPTION_ALT_PATHFINDING] = iniReader.ReadBoolean("JA2 Game Settings", "TOPTION_ALT_PATHFINDING" , FALSE); // A* pathfinding
gGameSettings.fOptions[TOPTION_MERCENARY_FORMATIONS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_MERCENARY_FORMATIONS" , TRUE ); // Flugente: mercenary formations
gGameSettings.fOptions[TOPTION_SHOW_ENEMY_LOCATION] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SHOW_ENEMY_LOCATION" , FALSE); // sevenfm: show locations of known enemies
gGameSettings.fOptions[TOPTION_REPORT_MISS_MARGIN] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_REPORT_MISS_MARGIN" , FALSE ); // HEADROCK HAM 4: Shot offset report
@@ -353,7 +355,6 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_END] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_DEBUG_MODE_OPTIONS_END" , FALSE );
gGameSettings.fOptions[TOPTION_LAST_OPTION] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_LAST_OPTION" , FALSE );
gGameSettings.fOptions[NUM_GAME_OPTIONS] = iniReader.ReadBoolean("JA2 Game Settings","NUM_GAME_OPTIONS" , FALSE );
gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_MERC_CASTS_LIGHT" , TRUE );
gGameSettings.fOptions[TOPTION_HIDE_BULLETS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_HIDE_BULLETS" , FALSE );
gGameSettings.fOptions[TOPTION_TRACKING_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_TRACKING_MODE" , TRUE );
gGameSettings.fOptions[TOPTION_DISABLE_CURSOR_SWAP] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_DISABLE_CURSOR_SWAP" , FALSE );
@@ -572,7 +573,7 @@ BOOLEAN SaveGameSettings()
settings << "TOPTION_RTCONFIRM = " << (gGameSettings.fOptions[TOPTION_RTCONFIRM] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SLEEPWAKE_NOTIFICATION = " << (gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_USE_METRIC_SYSTEM = " << (gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_MERC_ALWAYS_LIGHT_UP = " << (gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_MERC_CASTS_LIGHT = " << (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE") << endl;
settings << "TOPTION_SMART_CURSOR = " << (gGameSettings.fOptions[TOPTION_SMART_CURSOR] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SNAP_CURSOR_TO_DOOR = " << (gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_GLOW_ITEMS = " << (gGameSettings.fOptions[TOPTION_GLOW_ITEMS] ? "TRUE" : "FALSE" ) << endl;
@@ -608,12 +609,14 @@ BOOLEAN SaveGameSettings()
settings << "TOPTION_AUTO_FAST_FORWARD_MODE = " << (gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SHOW_LAST_ENEMY = " << (gGameSettings.fOptions[TOPTION_SHOW_LAST_ENEMY] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SHOW_LBE_CONTENT = " << (gGameSettings.fOptions[TOPTION_SHOW_LBE_CONTENT] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_INVERT_WHEEL = " << (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_INVERT_WHEEL = " << (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_ZOMBIES = " << (gGameSettings.fOptions[TOPTION_ZOMBIES] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_ENABLE_INVENTORY_POPUPS = " << (gGameSettings.fOptions[TOPTION_ENABLE_INVENTORY_POPUPS] ? "TRUE" : "FALSE" ) << endl; // the_bob : enable popups for picking items from sector inv
settings << "TOPTION_MERCENARY_FORMATIONS = " << (gGameSettings.fOptions[TOPTION_MERCENARY_FORMATIONS] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SHOW_ENEMY_LOCATION = " << (gGameSettings.fOptions[TOPTION_SHOW_ENEMY_LOCATION] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_ALT_START_AIM = " << (gGameSettings.fOptions[TOPTION_ALT_START_AIM] ? "TRUE" : "FALSE") << endl;
settings << "TOPTION_ALT_PATHFINDING = " << (gGameSettings.fOptions[TOPTION_ALT_PATHFINDING] ? "TRUE" : "FALSE") << endl;
settings << "TOPTION_CHEAT_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = " << (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) << endl;
@@ -633,7 +636,6 @@ BOOLEAN SaveGameSettings()
settings << ";******************************************************************************************************************************" << endl;
settings << "TOPTION_LAST_OPTION = " << (gGameSettings.fOptions[TOPTION_LAST_OPTION] ? "TRUE" : "FALSE" ) << endl;
settings << "NUM_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_MERC_CASTS_LIGHT = " << (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_HIDE_BULLETS = " << (gGameSettings.fOptions[TOPTION_HIDE_BULLETS] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_TRACKING_MODE = " << (gGameSettings.fOptions[TOPTION_TRACKING_MODE] ? "TRUE" : "FALSE" ) << endl;
settings << "NUM_ALL_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_ALL_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
@@ -777,7 +779,7 @@ void InitGameSettings()
gGameSettings.fOptions[ TOPTION_RTCONFIRM ] = FALSE;
gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] = TRUE;
gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] = TRUE;
gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] = FALSE;
gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] = FALSE;
gGameSettings.fOptions[ TOPTION_SMART_CURSOR ] = FALSE;
gGameSettings.fOptions[ TOPTION_SNAP_CURSOR_TO_DOOR ] = TRUE;
gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] = TRUE;
@@ -841,7 +843,9 @@ void InitGameSettings()
gGameSettings.fOptions[TOPTION_INVERT_WHEEL] = FALSE;
gGameSettings.fOptions[ TOPTION_MERCENARY_FORMATIONS ] = FALSE; // Flugente: mercenary formations
gGameSettings.fOptions[ TOPTION_SHOW_ENEMY_LOCATION ] = FALSE; // sevenfm: show locations of known enemies
gGameSettings.fOptions[TOPTION_SHOW_ENEMY_LOCATION] = FALSE; // sevenfm: show locations of known enemies
gGameSettings.fOptions[TOPTION_ALT_START_AIM] = FALSE;
gGameSettings.fOptions[TOPTION_ALT_PATHFINDING] = FALSE;
// arynn: Cheat/Debug Menu
gGameSettings.fOptions[ TOPTION_CHEAT_MODE_OPTIONS_HEADER ] = FALSE;
@@ -870,8 +874,6 @@ void InitGameSettings()
gGameSettings.fOptions[ NUM_GAME_OPTIONS ] = FALSE; // Toggles prior to this will be able to be toggled by the player
// JA2Gold
gGameSettings.fOptions[ TOPTION_MERC_CASTS_LIGHT ] = TRUE;
gGameSettings.fOptions[ TOPTION_HIDE_BULLETS ] = FALSE;
gGameSettings.fOptions[ TOPTION_TRACKING_MODE ] = TRUE;
+3 -3
View File
@@ -33,7 +33,7 @@ enum
// TOPTION_DISPLAY_ENEMY_INDICATOR, //Displays the number of enemies seen by the merc, ontop of their portrait
TOPTION_SLEEPWAKE_NOTIFICATION,
TOPTION_USE_METRIC_SYSTEM, //If set, uses the metric system
TOPTION_MERC_ALWAYS_LIGHT_UP,
TOPTION_MERC_CASTS_LIGHT,
TOPTION_SMART_CURSOR,
TOPTION_SNAP_CURSOR_TO_DOOR,
TOPTION_GLOW_ITEMS,
@@ -103,6 +103,8 @@ enum
// sevenfm: new settings
TOPTION_SHOW_ENEMY_LOCATION,
TOPTION_ALT_START_AIM,
TOPTION_ALT_PATHFINDING,
// arynn: Debug/Cheat
TOPTION_CHEAT_MODE_OPTIONS_HEADER,
@@ -127,8 +129,6 @@ enum
//These options will NOT be toggable by the Player
// JA2Gold
TOPTION_MERC_CASTS_LIGHT,
TOPTION_HIDE_BULLETS,
TOPTION_TRACKING_MODE,
+14 -26
View File
@@ -1,52 +1,40 @@
#include "Types.h"
#include "GameVersion.h"
//
// Keeps track of the game version
//
// ------------------------------
// MAP EDITOR (Release and Debug) BUILD VERSION
// ------------------------------
#ifdef JA2EDITOR
#ifdef JA2EDITOR // map editor
#ifdef JA2UB
CHAR16 zProductLabel[64] = { L"Unfinished Business - Map Editor v1.13" };
CHAR16 zProductLabel[64] = { L"JA2 1.13 Unfinished Business - Map Editor" };
#else
CHAR16 zProductLabel[64] = { L"Map Editor v1.13" };
CHAR16 zProductLabel[64] = { L"JA2 1.13 - Map Editor" };
#endif
// ------------------------------
// DEBUG BUILD VERSIONS
// ------------------------------
#elif defined JA2BETAVERSION
#elif defined JA2BETAVERSION // debug
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zProductLabel[64] = { L"Debug: Unfinished Business - v1.13" };
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13 Unfinished Business" };
#elif defined (JA113DEMO)
CHAR16 zProductLabel[64] = { L"Debug: JA2 Demo - v1.13" };
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13 Demo" };
#else
CHAR16 zProductLabel[64] = { L"Debug: v1.13" };
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13" };
#endif
#elif defined CRIPPLED_VERSION
//RELEASE BUILD VERSION s
CHAR16 zProductLabel[64] = { L"Beta v. 0.98" };
CHAR16 zProductLabel[64] = { L"JA2 113 Beta-0.98" };
// ------------------------------
// RELEASE BUILD VERSIONS
// ------------------------------
#else
#else // release
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zProductLabel[64] = { L"Unfinished Business - v1.13" };
CHAR16 zProductLabel[64] = { L"JA2 1.13 Unfinished Business" };
#elif defined (JA113DEMO)
CHAR16 zProductLabel[64] = { L"JA2 Demo - v1.13" };
CHAR16 zProductLabel[64] = { L"JA2 1.13 Demo" };
#else
CHAR16 zProductLabel[64] = { L"v1.13" };
CHAR16 zProductLabel[64] = { L"JA2 1.13" };
#endif
#endif
+101
View File
@@ -0,0 +1,101 @@
set(LaptopSrc
"${CMAKE_CURRENT_SOURCE_DIR}/aim.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimArchives.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimFacialIndex.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimHistory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimLinks.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimMembers.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimPolicies.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AimSort.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BaseTable.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyR.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRAmmo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRArmour.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRGuns.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRMailOrder.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRMisc.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRShipments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BobbyRUsed.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BriefingRoom.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BriefingRoomM.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BriefingRoom_Data.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/BrokenLink.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CampaignHistoryMain.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CampaignHistory_Summary.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CampaignStats.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CharProfile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DropDown.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DynamicDialogueWidget.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/email.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Encyclopedia_Data_new.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Encyclopedia_new.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FacilityProduction.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/files.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/finances.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/florist Cards.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/florist Gallery.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/florist Order Form.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/florist.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/funeral.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GunEmporium.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/history.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP AboutUs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Attribute Entrance.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Attribute Finish.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Attribute Selection.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Background.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Begin Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Character and Disability Entrance.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Character Trait.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Color Choosing.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Compile Character.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Confirm.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Disability Trait.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Finish.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Gear Entrance.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Gear.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP HomePage.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP MainPage.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Minor Trait.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Personality Entrance.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Personality Finish.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Personality Quiz.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Portraits.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Prejudice.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Skill Trait.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Text System.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMP Voices.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IMPVideoObjects.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/insurance Comments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/insurance Contract.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/insurance Info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/insurance.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Intelmarket.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/laptop.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/merccompare.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mercs Account.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mercs Files.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mercs No Account.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mercs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MilitiaInterface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MilitiaWebsite.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/personnel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PMC.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PostalService.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sirtech.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Store Inventory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/WHO.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AIMAvailability.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_BriefingRoom.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_CampaignStatsEvents.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ConditionsForMercAvailability.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DeliveryMethods.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Email.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EmailMercAvailable.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EmailMercLevelUp.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_History.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IMPPortraits.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IMPVoices.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_OldAIMArchive.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ShippingDestinations.cpp"
PARENT_SCOPE)
-5
View File
@@ -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")
-97
View File
@@ -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
+27 -8
View File
@@ -69,6 +69,7 @@ extern BOOLEAN bBigBody;
#define IMP_GEAR_SPACE_BETWEEN_BOXES 1
#define IMP_GEAR_INV_SLOTS 25
//*******************************************************************
//
// Local Variables
@@ -76,7 +77,7 @@ extern BOOLEAN bBigBody;
//*******************************************************************
INV_REGIONS gIMPGearInvData[NUM_INV_SLOTS];
MOUSE_REGION gIMPGearInvRegion[NUM_INV_SLOTS];
MOUSE_REGION gIMPGearInvPoolRegion[25];
MOUSE_REGION gIMPGearInvPoolRegion[IMP_GEAR_INV_SLOTS];
UINT32 gIMPInvDoneButtonImage;
UINT32 gIMPInvDoneButton;
UINT32 gIMPInvArrowButtonImage[2];
@@ -237,10 +238,11 @@ void ExitIMPGear( void )
{
MSYS_RemoveRegion(&gIMPGearInvRegion[cnt]);
}
for (size_t i = 0; i < 25; i++)
for (size_t i = 0; i < IMP_GEAR_INV_SLOTS; i++)
{
MSYS_RemoveRegion(&gIMPGearInvPoolRegion[i]);
}
fShowIMPItemHighLight = FALSE;
}
@@ -859,7 +861,7 @@ void IMPCloseInventoryPool(void)
{
MSYS_EnableRegion(&gIMPGearInvRegion[cnt]);
}
for (size_t i = 0; i < 25; i++)
for (size_t i = 0; i < IMP_GEAR_INV_SLOTS; i++)
{
MSYS_DisableRegion(&gIMPGearInvPoolRegion[i]);
}
@@ -946,7 +948,7 @@ void IMPInvClickCallback(MOUSE_REGION* pRegion, INT32 iReason)
MSYS_DisableRegion(&gIMPGearInvRegion[cnt]);
}
for (size_t i = 0; i < 25; i++)
for (size_t i = 0; i < IMP_GEAR_INV_SLOTS; i++)
{
MSYS_EnableRegion(&gIMPGearInvPoolRegion[i]);
}
@@ -1104,7 +1106,7 @@ void InitImpGearCoords(void)
}
// Inventory pool slots
for (size_t i = 0; i < 25; i++)
for (size_t i = 0; i < IMP_GEAR_INV_SLOTS; i++)
{
const UINT32 xOffset = gIMPInvPoolLayout.x + 24; // top left coords of the first item slot in selection grid sti
const UINT32 yOffset = gIMPInvPoolLayout.y + 8;
@@ -1187,12 +1189,19 @@ void DrawItemTextToInvPool(STR16 itemName, UINT32 x, UINT32 y)
void RenderImpGearSelectionChoices(UINT32 pocket)
{
CHAR16 tooltipText[5000];
const UINT32 xOffset = gIMPInvPoolLayout.x + 24; // top left coords of the first item slot in selection grid sti
const UINT32 yOffset = gIMPInvPoolLayout.y + 8;
const UINT32 xStep = 72; // steps to the next slot column and row
const UINT32 yStep = 32;
const UINT32 pageShift = gIMPCurrentInventoryPoolPage * 25;
// Reset item slot tooltips
for (size_t i = 0; i < IMP_GEAR_INV_SLOTS; i++)
{
SetRegionFastHelpText(&gIMPGearInvPoolRegion[i], szIMPGearPocketText[55]);
}
const UINT32 pageShift = gIMPCurrentInventoryPoolPage * IMP_GEAR_INV_SLOTS;
UINT32 end = gIMPPossibleItems[pocket].size();
if (gIMPCurrentInventoryPoolPage < gIMPLastInventoryPoolPage)
{
@@ -1211,7 +1220,17 @@ void RenderImpGearSelectionChoices(UINT32 pocket)
const auto xText = x;
const auto yText = y + 24;
DrawItemTextToInvPool(gIMPPossibleItems[pocket][i].second, xText, yText);
// Update tool tip to contain item name
const auto itemIndex = gIMPPossibleItems[pocket][i].first;
if (itemIndex != 0)
{
extern void GetHelpTextForItemInLaptop(STR16 pzStr, UINT16 usItemNumber);
GetHelpTextForItemInLaptop(tooltipText, itemIndex);
wcscat(tooltipText, L"\n");
wcscat(tooltipText, szIMPGearPocketText[55]);
SetRegionFastHelpText(&gIMPGearInvPoolRegion[i - pageShift], tooltipText);
}
// Check if currently selected item is shown in pool and adjust glow coordinates
if (item == gIMPPocketSelectedItems[pocket].first)
@@ -1476,4 +1495,4 @@ void RenderIMPGearBodytype(void)
}
BltVideoObjectFromIndex(FRAME_BUFFER, gIMPINVENTORY, index, x, y, VO_BLT_SRCTRANSPARENCY, NULL);
}
}
+14
View File
@@ -0,0 +1,14 @@
set(ModularizedTacticalAISrc
"${CMAKE_CURRENT_SOURCE_DIR}/src/LegacyArmedVehiclePlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/AbstractPlanFactory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/CrowPlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/LegacyAIPlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/LegacyAIPlanFactory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/LegacyCreaturePlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/LegacyZombiePlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/NullPlan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/NullPlanFactory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Plan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/PlanFactoryLibrary.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/PlanList.cpp"
PARENT_SCOPE)
+43
View File
@@ -0,0 +1,43 @@
set(SGPSrc
"${CMAKE_CURRENT_SOURCE_DIR}/Button Sound Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Button System.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Compression.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Container.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Cursor Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DEBUG.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/debug_util.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/debug_win_util.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DirectDraw Calls.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DirectX Common.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/English.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FileCat.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FileMan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Flic.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Font.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/himage.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/impTGA.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/input.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Install.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LibraryDataBase.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/line.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MemMan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mousesystem.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PCX.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PngLoader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Random.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/readdir.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/RegInst.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sgp.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sgp_logger.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/shading.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/soundman.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/STCI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/stringicmp.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/timer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/video.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/vobject.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/vobject_blitters.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/vsurface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/WinFont.cpp"
PARENT_SCOPE)
-4
View File
@@ -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
-147
View File
@@ -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; i<info->height; ++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;
-81
View File
@@ -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 ) );
-23
View File
@@ -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<iNumValues; i++ )
{
if ( !FileRead( hFile, &b, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &g, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &r, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
if ( !FileRead( hFile, &a, sizeof(UINT8), &uiBytesRead ) )
goto freeEnd;
pBMData[ i*3 ] = r;
pBMData[ i*3+1 ] = g;
pBMData[ i*3+2 ] = b;
}
}
#endif
}
return( TRUE );
-22
View File
@@ -1609,28 +1609,6 @@ BOOLEAN IsCursorRestricted( void )
void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos )
{
#if 0
FLOAT flNewXPos, flNewYPos;
// Wizardry NOTE: This function currently doesn't quite work right for in any Windows resolution other than 640x480.
// mouse_event() uses your current Windows resolution to calculate the resulting x,y coordinates. So in order to get
// the right coordinates, you'd have to find out the current Windows resolution through a system call, and then do:
// uiNewXPos = uiNewXPos * SCREEN_WIDTH / WinScreenResX;
// uiNewYPos = uiNewYPos * SCREEN_HEIGHT / WinScreenResY;
//
// JA2 doesn't have this problem, 'cause they use DirectDraw calls that change the Windows resolution properly.
//
// Alex Meduna, Dec. 3, 1997
// Adjust coords based on our resolution
flNewXPos = ( (FLOAT)uiNewXPos / SCREEN_WIDTH ) * 65536;
flNewYPos = ( (FLOAT)uiNewYPos / SCREEN_HEIGHT ) * 65536;
mouse_event( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (UINT32)flNewXPos, (UINT32)flNewYPos, 0, 0 );
#endif
// 0verhaul:
// The above is a bad hack. Especially in windowed mode. We don't want coords relative to the entire screen in that case.
// So instead, get screen coords and then use the setcursorpos call.
POINT newmouse;
newmouse.x = uiNewXPos;
newmouse.y = uiNewYPos;
-36
View File
@@ -142,9 +142,6 @@ static CRITICAL_SECTION gcsGameLoop;
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
#if USE_CONSOLE
Console g_Console("", "", "Lua Console", "no");
#endif
#ifdef USE_VFS
@@ -394,15 +391,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
if (wParam == '\\' &&
lParam && KF_ALTDOWN)
{
#if USE_CONSOLE
g_Console.Create(ghWindow);
cout << "LUA console ready" << endl;
cout << "> ";
// 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
-23
View File
@@ -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
+7 -10
View File
@@ -1852,16 +1852,6 @@ UINT32 uiCount;
return(FALSE);
}
// Lesh modifications
// Sound debug
static struct SoundLog {
sgp::Logger_ID id;
SoundLog() {
id = sgp::Logger::instance().createLogger();
sgp::Logger::instance().connectFile(id, SndDebugFileName, true, sgp::Logger::FLUSH_ON_DELETE);
}
} s_SoundLog;
//*****************************************************************************************
// SoundLog
// Writes string into log file
@@ -1872,6 +1862,13 @@ static struct SoundLog {
//*****************************************************************************************
void SoundLog(CHAR8 *strMessage)
{
static struct SoundLog {
sgp::Logger_ID id;
SoundLog() {
id = sgp::Logger::instance().createLogger();
sgp::Logger::instance().connectFile(id, SndDebugFileName, true, sgp::Logger::FLUSH_ON_DELETE);
}
} s_SoundLog;
#ifndef USE_VFS
if ((SndDebug = fopen(SndDebugFileName, "a+t")) != NULL)
{
-15
View File
@@ -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
}
-37
View File
@@ -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)
{
//
+28 -27
View File
@@ -1,12 +1,12 @@
#include "DirectDraw Calls.h"
#include <stdio.h>
#include "debug.h"
#include "video.h"
#include "himage.h"
#include "vobject.h"
#include "wcheck.h"
#include "vobject_blitters.h"
#include "sgp.h"
#include "DirectDraw Calls.h"
#include <stdio.h>
#include "debug.h"
#include "video.h"
#include "himage.h"
#include "vobject.h"
#include "wcheck.h"
#include "vobject_blitters.h"
#include "sgp.h"
#include <unordered_map>
@@ -589,6 +589,7 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
hVObject->usNumberOf16BPPObjects = 1;
hVObject->ubBitDepth = hImage->ubBitDepth;
strncpy(hVObject->ImageFile, hImage->ImageFile, SGPFILENAME_LEN);
if ( VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMFILE )
{
@@ -627,6 +628,7 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
hVObject->usNumberOf16BPPObjects = 1;
hVObject->ubBitDepth = hImage->ubBitDepth;
strncpy(hVObject->ImageFile, hImage->ImageFile, SGPFILENAME_LEN);
if ( VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMFILE )
{
@@ -656,6 +658,7 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
hVObject->pETRLEObject = TempETRLEData.pETRLEObject;
hVObject->pPixData = TempETRLEData.pPixData;
hVObject->uiSizePixData = TempETRLEData.uiSizePixData;
strncpy(hVObject->ImageFile, hImage->ImageFile, SGPFILENAME_LEN);
// Set palette from himage
if ( hImage->ubBitDepth == 8 )
@@ -897,9 +900,10 @@ UINT32 count;
//
// *******************************************************************
// High level blit function encapsolates ALL effects and BPP
// High level blit function encapsulates ALL effects and BPP
BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT32 fBltFlags, blt_fx *pBltFx )
{
CHAR8 errorText[512];
// Sometimes an exception is thrown in that method.
//BF __try
{
@@ -920,24 +924,18 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
switch( hSrcVObject->ubBitDepth )
{
case 32:
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
sprintf(errorText, "Video object index is larger than the number of images. Filename: %s", hSrcVObject->ImageFile);
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, errorText);
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:
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
sprintf(errorText, "Video object index is larger than the number of images. Filename: %s", hSrcVObject->ImageFile);
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, errorText);
image = &hSrcVObject->p16BPPObject[usIndex];
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
{
@@ -957,8 +955,8 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
break;
case 8:
SGP_THROW_IFFALSE( hSrcVObject->usNumberOfObjects > usIndex, L"Video object index is larger than the number of subimages");
sprintf(errorText, "Video object index is larger than the number of sub images. Filename: %s", hSrcVObject->ImageFile);
SGP_THROW_IFFALSE( hSrcVObject->usNumberOfObjects > usIndex, errorText);
// Switch based on flags given
do
{
@@ -1569,9 +1567,10 @@ BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT1
BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY )
{
UINT16 *pBuffer;
UINT32 uiPitch;
HVOBJECT hSrcVObject;
CHAR8 errorText[512];
UINT16 *pBuffer;
UINT32 uiPitch;
HVOBJECT hSrcVObject;
// Lock video surface
pBuffer = (UINT16*)LockVideoSurface( uiDestVSurface, &uiPitch );
@@ -1600,14 +1599,16 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc
}
else if(hSrcVObject->ubBitDepth == 16)
{
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
sprintf(errorText, "Video object index is larger than the number of images. Filename: %s", hSrcVObject->ImageFile);
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, errorText);
SixteenBPPObjectInfo &image = hSrcVObject->p16BPPObject[0];
Blt16BPPTo16BPPTransShadow(pBuffer, uiPitch, image.p16BPPData, image.usWidth * sizeof(UINT16),
iDestX, iDestY, 0, 0, image.usWidth, image.usHeight, 0x1F);
}
else if(hSrcVObject->ubBitDepth == 32)
{
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
sprintf(errorText, "Video object index is larger than the number of images. Filename: %s", hSrcVObject->ImageFile);
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, errorText);
SixteenBPPObjectInfo &image = hSrcVObject->p16BPPObject[0];
Blt32BPPTo16BPPTransShadow(pBuffer, uiPitch, (UINT32*)image.p16BPPData, image.usWidth * sizeof(UINT32),
iDestX, iDestY, 0, 0, image.usWidth, image.usHeight);
+17 -21
View File
@@ -84,30 +84,26 @@ typedef struct
// The video object contains different data based on it's type, compressed or not
typedef struct TAG_HVOBJECT
{
UINT32 fFlags; // Special flags
UINT32 uiSizePixData; // ETRLE data size
SGPPaletteEntry *pPaletteEntry; // 8BPP Palette
COLORVAL TransparentColor; // Defaults to 0,0,0
UINT16 *p16BPPPalette; // A 16BPP palette used for 8->16 blits
UINT32 fFlags; // Special flags
UINT32 uiSizePixData; // ETRLE data size
SGPPaletteEntry *pPaletteEntry; // 8BPP Palette
COLORVAL TransparentColor; // Defaults to 0,0,0
UINT16 *p16BPPPalette; // A 16BPP palette used for 8->16 blits
PTR pPixData; // ETRLE pixel data
ETRLEObject *pETRLEObject; // Object offset data etc
PTR pPixData; // ETRLE pixel data
ETRLEObject *pETRLEObject; // Object offset data etc
SixteenBPPObjectInfo *p16BPPObject;
UINT16 *pShades[HVOBJECT_SHADE_TABLES]; // Shading tables
UINT16 *pShadeCurrent;
UINT16 *pGlow; // glow highlight table
UINT8 *pShade8; // 8-bit shading index table
UINT8 *pGlow8; // 8-bit glow table
ZStripInfo **ppZStripInfo; // Z-value strip info arrays
UINT16 usNumberOf16BPPObjects;
UINT16 usNumberOfObjects; // Total number of objects
UINT8 ubBitDepth; // BPP
// Reserved for added room and 32-byte boundaries
BYTE bReserved[ 1 ];
UINT16 *pShades[HVOBJECT_SHADE_TABLES]; // Shading tables
UINT16 *pShadeCurrent;
UINT16 *pGlow; // glow highlight table
UINT8 *pShade8; // 8-bit shading index table
UINT8 *pGlow8; // 8-bit glow table
ZStripInfo **ppZStripInfo; // Z-value strip info arrays
UINT16 usNumberOf16BPPObjects;
UINT16 usNumberOfObjects; // Total number of objects
UINT8 ubBitDepth; // BPP
SGPFILENAME ImageFile;
} SGPVObject, *HVOBJECT;
@@ -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
/**********************************************************************************************
-13
View File
@@ -2204,19 +2204,6 @@ void CreateAutoResolveInterface()
ubRegMilitia += bonusRegularMilitia;
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
ARCreateMilitiaSquad( &cnt, ubEliteMilitia, ubRegMilitia, ubGreenMilitia, gpAR->ubSectorX, gpAR->ubSectorY);
+66
View File
@@ -0,0 +1,66 @@
set(StrategicSrc
"${CMAKE_CURRENT_SOURCE_DIR}/AI Viewer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ASD.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Assignments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Auto Resolve.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Campaign Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Creature Spreading.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Facilities.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Game Clock.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Game Event Hook.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Game Events.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Game Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Hourly Update.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25 Strategic Ai.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Luaglobal.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LuaInitNPCs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Helicopter.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface Border.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface Bottom.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface Map Inventory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface Map.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface TownMine Info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Screen Interface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MapScreen Quotes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mapscreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Meanwhile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Merc Contract.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MilitiaIndividual.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MilitiaSquads.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MiniEvents.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Player Command.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PreBattle Interface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Queen Command.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Quest Debug System.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Quests.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Rebel Command.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Reinforcement.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scheduling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic AI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Event Handler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Merc Handler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Mines LUA.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Mines.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Movement Costs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Movement.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Pathing.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Status.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Town Loyalty.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/strategic town reputation.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Turns.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/strategic.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/strategicmap.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Town Militia.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/UndergroundInit.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Army.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Bloodcats.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_CoolnessBySector.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Creatures.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ExtraItems.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Facilities.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_FacilityTypes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Minerals.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_SectorNames.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_SquadNames.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_UniformColors.cpp"
PARENT_SCOPE)
-12
View File
@@ -101,18 +101,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 ) )
-30
View File
@@ -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)
+1 -1
View File
@@ -124,7 +124,7 @@ BOOLEAN LoadMapBorderGraphics( void )
{
FilenameForBPP( "INTERFACE\\MBS.sti", VObjectDesc.ImageFile );
}
else if (iResolution == _1280x720)
else if (isWidescreenUI())
{
FilenameForBPP("INTERFACE\\MBS_1280x720.sti", VObjectDesc.ImageFile);
}
+2 -2
View File
@@ -266,7 +266,7 @@ void HandleLoadOfMapBottomGraphics( void )
{
FilenameForBPP( "INTERFACE\\map_screen_bottom.sti", VObjectDesc.ImageFile );
}
else if (iResolution == _1280x720)
else if (isWidescreenUI())
{
FilenameForBPP("INTERFACE\\map_screen_bottom_1280x720.sti", VObjectDesc.ImageFile);
}
@@ -1292,7 +1292,7 @@ void EnableDisableBottomButtonsAndRegions( void )
{
DisableButton( giMapInvDoneButton );
}
else
else if (!isWidescreenUI())
{
EnableButton( giMapInvDoneButton );
}
@@ -40,6 +40,7 @@
#include "Interface Items.h"
#include "Food.h" // added by Flugente
#include "Campaign Types.h" // added by Flugente
#include "mapscreen.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -448,7 +449,7 @@ BOOLEAN LoadInventoryPoolGraphic( void )
{
sprintf( VObjectDesc.ImageFile, "INTERFACE\\sector_inventory.sti" );
}
else if (iResolution == _1280x720)
else if (isWidescreenUI())
{
sprintf(VObjectDesc.ImageFile, "INTERFACE\\sector_inventory_1280x720.sti");
}
@@ -1091,24 +1092,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 +3610,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 +3635,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 +3649,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 +3767,11 @@ void CheckGridNoOfItemsInMapScreenMapInventory()
void SortSectorInventory( std::vector<WORLDITEM>& 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<WORLDITEM>::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<WORLDITEM>::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<WORLDITEM>::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<WORLDITEM>::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 +3784,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 +3965,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,8 +6022,8 @@ 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 );
#if 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,8 +6042,8 @@ 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 );
#if 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
+2 -2
View File
@@ -1819,7 +1819,7 @@ BOOLEAN InitializePalettesForMap( void )
if (iResolution >= _640x480 && iResolution < _800x600)
strcpy(vs_desc.ImageFile, "INTERFACE\\b_map.pcx");
else if (iResolution == _1280x720)
else if (isWidescreenUI())
strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_1280x720.pcx");
else if (iResolution < _1024x768)
strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_800x600.pcx");
@@ -6717,7 +6717,7 @@ void HandleLowerLevelMapBlit( void )
offsetY = yVal;
imageIndex = 0;
}
else if (iResolution == _1280x720)
else if (isWidescreenUI())
{
offsetX = xVal + 21;
offsetY = yVal + 17;
-36
View File
@@ -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 );
}
+3 -15
View File
@@ -523,22 +523,10 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
UpdateRefuelSiteAvailability( );
}
//shadooow: re-enable quest if player loses control of the N7 prison and quest was disabled previously
if (sMapX == gModSettings.ubMeanwhileInterrogatePOWSectorX && sMapY == gModSettings.ubMeanwhileInterrogatePOWSectorY && gubQuest[QUEST_INTERROGATION] == QUESTCANNOTSTART)
{
gubQuest[QUEST_INTERROGATION] = QUESTNOTSTARTED;
}
//shadooow: re-enable quest if player loses control of the Alma prison and quest was disabled previously
if (sMapX == gModSettings.ubInitialPOWSectorX && sMapY == gModSettings.ubInitialPOWSectorY && gubQuest[QUEST_HELD_IN_ALMA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_ALMA] = QUESTNOTSTARTED;
}
#ifndef JA2UB
//shadooow: re-enable quest if player loses control of the Tixa prison and quest was disabled previously
if (sMapX == gModSettings.ubTixaPrisonSectorX && sMapY == gModSettings.ubTixaPrisonSectorY && gubQuest[QUEST_HELD_IN_TIXA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_TIXA] = QUESTNOTSTARTED;
}
HandlePOWQuestState(Q_RESET, QUEST_INTERROGATION, sMapX, sMapY, bMapZ);
HandlePOWQuestState(Q_RESET, QUEST_HELD_IN_ALMA, sMapX, sMapY, bMapZ);
HandlePOWQuestState(Q_RESET, QUEST_HELD_IN_TIXA, sMapX, sMapY, bMapZ);
#endif
// Flugente: reduce workforce
SectorInfo[SECTOR( sMapX, sMapY )].usWorkers = SectorInfo[SECTOR( sMapX, sMapY )].usWorkers * gGameExternalOptions.dInitialWorkerRate;
+9
View File
@@ -2141,6 +2141,15 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
// because if this is a simultaneous group attack, the mercs could be coming from different sides, and the
// placement screen can't handle mercs on the same squad arriving from difference edges!
fSuccess = AddCharacterToSquad( pSoldier, bUniqueVehicleSquad );
// if we failed, create another squad
if (!fSuccess)
{
bUniqueVehicleSquad = GetFirstEmptySquad();
if (bUniqueVehicleSquad != -1)
{
fSuccess = AddCharacterToSquad(pSoldier, bUniqueVehicleSquad);
}
}
}
//CHRISL: So what's supposed to happen in the merc is assigned to a vehicle but fExitVehicles is FALSE?
else
+67 -66
View File
@@ -41,6 +41,7 @@
#include "Morale.h"
#include "CampaignStats.h" // added by Flugente
#include "ASD.h" // added by Flugente
#include "Interface Panels.h"
#ifdef JA2BETAVERSION
extern BOOLEAN gfClearCreatureQuest;
@@ -2716,43 +2717,31 @@ void BeginCaptureSquence( )
void EndCaptureSequence( )
{
#ifdef JA2UB
// no UB
#else
#ifndef JA2UB
// Set flag...
if( !( gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE ) || !(gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE) )
{
// CJC Dec 1 2002: fixing multiple captures:
//gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE;
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED )
{
// CJC Dec 1 2002: fixing multiple captures:
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE;
StartQuest( QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY );
}
// CJC Dec 1 2002: fixing multiple captures:
//else if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTDONE )
else if (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED)
else if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED)
{
// CJC Dec 1 2002: fixing multiple captures:
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE;
StartQuest(QUEST_HELD_IN_TIXA, gWorldSectorX, gWorldSectorY);
}
else if (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_HELD_IN_TIXA] != QUESTINPROGRESS && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
else if (gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
{
StartQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY );
// CJC Dec 1 2002: fixing multiple captures:
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE;
// OK! - Schedule Meanwhile now!
HandleInterrogationMeanwhileScene();
}
// CJC Dec 1 2002: fixing multiple captures
else
{
// !?!? set both flags
// Set both flags if we can't start any of the three POW quests
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE;
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE;
}
@@ -2760,16 +2749,22 @@ void EndCaptureSequence( )
#endif
}
int CalculateMaximumPrisonerAmount()
{
#ifndef JA2UB
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED) { return std::size(gModSettings.iInitialPOWGridNo); }
if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED) { return std::size(gModSettings.iTixaPrisonPOWGridNo); }
if (gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) { return std::size(gModSettings.iMeanwhileInterrogatePOWGridNo); }
#endif
return 0;
}
void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
{
UINT32 i;
BOOLEAN fMadeCorpse;
INT32 iNumEnemiesInSector;
#ifndef JA2UB
AssertNotNIL(pSoldier);
// ATE: Check first if ! in player captured sequence already
// CJC Dec 1 2002: fixing multiple captures
if ( ( gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE ) && (gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE) )
{
return;
@@ -2780,6 +2775,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
{
pSoldier->stats.bLife = 0;
pSoldier->iHealableInjury = 0; // added by SANDRO
BOOLEAN fMadeCorpse;
HandleSoldierDeath( pSoldier, &fMadeCorpse );
return;
}
@@ -2800,32 +2796,31 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
return;
}
// ATE: Patch fix If in a vehicle, remove from vehicle...
TakeSoldierOutOfVehicle( pSoldier );
HandleMoraleEvent( pSoldier, MORALE_MERC_CAPTURED, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
// Change to POW....
//-add him to a POW assignment/group
if( ( pSoldier->bAssignment != ASSIGNMENT_POW ) )
if (gStrategicStatus.ubNumCapturedForRescue >= CalculateMaximumPrisonerAmount())
{
SetTimeOfAssignmentChangeForMerc( pSoldier );
SetTimeOfAssignmentChangeForMerc(pSoldier);
return;
}
ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_POW );
RemoveCharacterFromSquads( pSoldier );
WORLDITEM WorldItem;
std::vector<WORLDITEM> pWorldItem;
#ifdef JA2UB
if (gStrategicStatus.ubNumCapturedForRescue < 3 && (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
#else
if (gStrategicStatus.ubNumCapturedForRescue < 3 && (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
#endif
{
INT32 itemdropoffgridno = -1;
// ATE: Patch fix If in a vehicle, remove from vehicle...
TakeSoldierOutOfVehicle(pSoldier);
HandleMoraleEvent(pSoldier, MORALE_MERC_CAPTURED, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ);
// Change to POW....
//-add him to a POW assignment/group
if ((pSoldier->bAssignment != ASSIGNMENT_POW))
{
SetTimeOfAssignmentChangeForMerc(pSoldier);
}
ChangeSoldiersAssignment(pSoldier, ASSIGNMENT_POW);
RemoveCharacterFromSquads(pSoldier);
INT32 itemdropoffgridno = -1;
// Is this the first one..?
if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED )
{
@@ -2837,7 +2832,6 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->usStrategicInsertionData = gModSettings.iInitialPOWGridNo[gStrategicStatus.ubNumCapturedForRescue];
itemdropoffgridno = gModSettings.iInitialPOWItemGridNo[gStrategicStatus.ubNumCapturedForRescue];
}
#ifndef JA2UB
else if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED)
{
//-teleport him to Tixa as originally planned
@@ -2848,7 +2842,6 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->usStrategicInsertionData = gModSettings.iTixaPrisonPOWGridNo[gStrategicStatus.ubNumCapturedForRescue];
itemdropoffgridno = gModSettings.iTixaPrisonPOWItemGridNo[gStrategicStatus.ubNumCapturedForRescue];
}
#endif
else //if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTDONE )
{
//-teleport him to N7
@@ -2860,8 +2853,10 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
}
// OK, drop all items!
WORLDITEM WorldItem;
std::vector<WORLDITEM> pWorldItem;
UINT32 invsize = pSoldier->inv.size();
for ( i = 0; i < invsize; ++i )
for (UINT32 i = 0; i < invsize; ++i )
{
if ( pSoldier->inv[i].exists() )
{
@@ -2883,34 +2878,40 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
gStrategicStatus.ubNumCapturedForRescue++;
}
//Bandaging him would prevent him from dying (due to low HP)
pSoldier->bBleeding = 0;
//Bandaging him would prevent him from dying (due to low HP)
pSoldier->bBleeding = 0;
// wake him up
if ( pSoldier->flags.fMercAsleep )
{
PutMercInAwakeState( pSoldier );
pSoldier->flags.fForcedToStayAwake = FALSE;
}
// wake him up
if ( pSoldier->flags.fMercAsleep )
{
PutMercInAwakeState( pSoldier );
pSoldier->flags.fForcedToStayAwake = FALSE;
}
//Set his life to 50% + or - 10 HP.
INT8 oldlife = pSoldier->stats.bLife;
pSoldier->stats.bLife = max(35, pSoldier->stats.bLifeMax / 2);
//Set his life to 50% + or - 10 HP.
INT8 oldlife = pSoldier->stats.bLife;
pSoldier->stats.bLife = max(35, pSoldier->stats.bLifeMax / 2);
if ( pSoldier->stats.bLife >= 45 )
{
pSoldier->stats.bLife += (INT8)(10 - Random( 21 ) );
}
if ( pSoldier->stats.bLife >= 45 )
{
pSoldier->stats.bLife += (INT8)(10 - Random( 21 ) );
}
// SANDRO - make the lost life insta-healable
pSoldier->iHealableInjury = ((pSoldier->stats.bLifeMax - pSoldier->stats.bLife) * 100);
// SANDRO - make the lost life insta-healable
pSoldier->iHealableInjury = ((pSoldier->stats.bLifeMax - pSoldier->stats.bLife) * 100);
// make him quite exhausted when found
pSoldier->bBreath = pSoldier->bBreathMax = 50;
pSoldier->sBreathRed = 0;
pSoldier->flags.fMercCollapsedFlag = FALSE;
// make him quite exhausted when found
pSoldier->bBreath = pSoldier->bBreathMax = 50;
pSoldier->sBreathRed = 0;
pSoldier->flags.fMercCollapsedFlag = FALSE;
RemoveSoldierFromTacticalSector(pSoldier, TRUE);
RemovePlayerFromTeamSlotGivenMercID(pSoldier->ubID);
SelectNextAvailSoldier(pSoldier);
}
#endif
}
+80 -11
View File
@@ -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
@@ -1737,9 +1731,84 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR
}
}
void HandlePOWQuestState(PowQuestState state, Quests quest, INT16 mapX, INT16 mapY, INT8 mapZ)
{
#ifndef JA2UB
bool correctSector = false;
switch (quest)
{
case QUEST_HELD_IN_ALMA:
correctSector = (mapX == gModSettings.ubInitialPOWSectorX && mapY == gModSettings.ubInitialPOWSectorY && mapZ == 0);
break;
case QUEST_INTERROGATION:
correctSector = (mapX == gModSettings.ubMeanwhileInterrogatePOWSectorX && mapY == gModSettings.ubMeanwhileInterrogatePOWSectorY && mapZ == 0);
break;
case QUEST_HELD_IN_TIXA:
correctSector = (mapX == gModSettings.ubTixaPrisonSectorX && mapY == gModSettings.ubTixaPrisonSectorY && mapZ == 0);
break;
default:
break;
}
if (correctSector)
{
switch (state)
{
case Q_FAIL:
// End quest if player loses prison
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Quest failed
InternalEndQuest(quest, mapX, mapY, FALSE);
}
else if (gubQuest[quest] == QUESTCANNOTSTART)
{
// Re-enable quest if player loses control of the prison and quest was disabled previously
gubQuest[quest] = QUESTNOTSTARTED;
}
break;
case Q_SUCCESS:
// End quest if player takes control of the prison
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Complete quest
EndQuest(quest, mapX, mapY);
}
else if (gubQuest[quest] == QUESTNOTSTARTED)
{
// Disable quest if player takes control of the prison
gubQuest[quest] = QUESTCANNOTSTART;
}
break;
case Q_RESET:
// Re-enable quest if player loses control of the prison and quest was disabled previously
if (gubQuest[quest] == QUESTCANNOTSTART)
{
gubQuest[quest] = QUESTNOTSTARTED;
}
break;
case Q_END:
if (gubQuest[quest] == QUESTINPROGRESS)
{
EndQuest(quest, mapX, mapY);
HandleNPCDoAction(0, NPC_ACTION_GRANT_EXPERIENCE_3, 0);
}
break;
case Q_LEFT_SECTOR:
// End interrogation quest if we left the sector, but haven't killed all enemies
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Finish quest, although not give points here...
InternalEndQuest(quest, mapX, mapY, FALSE);
// ... give them manually, but halved
GiveQuestRewardPoint(mapX, mapY, 4, NO_PROFILE);
// Also let us know we finished the quest
ResetHistoryFact(quest, mapX, mapY);
}
break;
default:
break;
}
}
#endif
}
+9 -6
View File
@@ -756,10 +756,13 @@ extern BOOLEAN CheckForNewShipment( void );
extern BOOLEAN CheckTalkerFemale( void );
extern BOOLEAN CheckTalkerUnpropositionedFemale( void );
enum PowQuestState
{
Q_FAIL,
Q_SUCCESS,
Q_RESET,
Q_END,
Q_LEFT_SECTOR
};
void HandlePOWQuestState(PowQuestState state, Quests quest, INT16 mapX, INT16 mapY, INT8 mapZ);
#endif
+2 -2
View File
@@ -4453,7 +4453,7 @@ void CheckMembersOfMvtGroupAndComplainAboutBleeding( SOLDIERTYPE *pSoldier )
return;
}
// make sure there are members in the group..if so, then run through and make each bleeder compain
// make sure there are members in the group..if so, then run through and make each bleeder complain
pPlayer = pGroup->pPlayerList;
// is there a player list?
@@ -6274,4 +6274,4 @@ void GetInfoFromGroupsInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam, BO
}
pGroup = pGroup->next;
}
}
}
+5 -4
View File
@@ -4952,7 +4952,7 @@ UINT32 MapScreenHandle(void)
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if (!is_networked)
{
if (iResolution == _1280x720)
if (isWidescreenUI())
{
FilenameForBPP("INTERFACE\\newgoldpiece3_1280x720.sti", VObjectDesc.ImageFile);
}
@@ -4972,7 +4972,7 @@ UINT32 MapScreenHandle(void)
else
{
// OJW - 20081204 - change mapscreen interface for MP games
if (iResolution == _1280x720)
if (isWidescreenUI())
{
FilenameForBPP("INTERFACE\\mpgoldpiece3_1280x720.sti", VObjectDesc.ImageFile);
}
@@ -5708,7 +5708,7 @@ UINT32 MapScreenHandle(void)
HandleCharBarRender( );
}
if( fShowInventoryFlag || fDisableDueToBattleRoster )
if( (fShowInventoryFlag && !isWidescreenUI()) || fDisableDueToBattleRoster )
{
for( iCounter = 0; iCounter < MAX_SORT_METHODS; iCounter++ )
{
@@ -15668,6 +15668,7 @@ void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList )
}
fCharacterInfoPanelDirty = TRUE;
fResetMapCoords = TRUE;
// if showing sector inventory
if ( fShowMapInventoryPool )
@@ -17968,4 +17969,4 @@ void initMapViewAndBorderCoordinates(void)
UI_MAP.HeliETA.Upper_Popup_Y = (50 + iScreenHeightOffset - 100);
UI_MAP.HeliETA.Alternate_Height = 97;
}
}
}
+110 -41
View File
@@ -2215,7 +2215,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// GridNo = NOWHERE, which causes this assertion to fail
//CHRISL: There's also an issue with vehicles. Soldiers in any vehicle are considered to be in sGridNo = NOWHERE
// This will result in an assertion error, so let's skip the assertion if the merc is assigned to a vehicle
if ( !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && !SPY_LOCATION( MercPtrs[i]->bAssignment ) )
if (!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && !SPY_LOCATION(MercPtrs[i]->bAssignment) && MercPtrs[i]->bAssignment != ASSIGNMENT_POW)
{
//Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds( MercPtrs[i]->sGridNo ) || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
@@ -2265,7 +2265,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// GridNo = NOWHERE, which causes this assertion to fail
//CHRISL: There's also an issue with vehicles. Soldiers in any vehicle are considered to be in sGridNo = NOWHERE
// This will result in an assertion error, so let's skip the assertion if the merc is assigned to a vehicle
if ( !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE )
if (!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && MercPtrs[i]->bAssignment != ASSIGNMENT_POW)
{
//Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds( MercPtrs[i]->sGridNo ) || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
@@ -3290,23 +3290,9 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
}
// ATE: Call actions based on what POW we are on...
if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTINPROGRESS )
{
// Complete quest
EndQuest( QUEST_HELD_IN_ALMA, sSectorX, sSectorY );
// Do action
HandleNPCDoAction( 0, NPC_ACTION_GRANT_EXPERIENCE_3, 0 );
}
#ifndef JA2UB
else if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTINPROGRESS)
{
// Complete quest
EndQuest(QUEST_HELD_IN_TIXA, sSectorX, sSectorY);
// Do action
HandleNPCDoAction(0, NPC_ACTION_GRANT_EXPERIENCE_3, 0);
}
HandlePOWQuestState(Q_END, QUEST_HELD_IN_ALMA, sSectorX, sSectorY, bSectorZ);
HandlePOWQuestState(Q_END, QUEST_HELD_IN_TIXA, sSectorX, sSectorY, bSectorZ);
#endif
}
}
@@ -4301,6 +4287,68 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
}
}
void JumpIntoEscapedSector(UINT8 ubTacticalDirection)
{
// Remove any incapacitated mercs from current squads and assign them to new squad
UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT32 const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID;
INT8 currentSquad = -1;
for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastID; ++i, ++pSoldier)
{
// Are we not active in sector
if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->stats.bLife >= OKLIFE)
{
continue;
}
if (currentSquad == -1)
{
currentSquad = AddCharacterToUniqueSquad(pSoldier);
continue;
}
if (!AddCharacterToSquad(pSoldier, currentSquad))
{
currentSquad = AddCharacterToUniqueSquad(pSoldier);
}
}
// Retreat squads that are capable of it
for (size_t i = 0; i < NUMBER_OF_SQUADS; i++)
{
for (size_t j = 0; j < NUMBER_OF_SOLDIERS_PER_SQUAD; j++)
{
SOLDIERTYPE* pSoldier = Squad[i][j];
if (pSoldier && OK_CONTROLLABLE_MERC(pSoldier))
{
GROUP* pGroup = GetGroup(pSoldier->ubGroupID);
switch (ubTacticalDirection)
{
case NORTH:
pGroup->ubPrevX = pGroup->ubSectorX;
pGroup->ubPrevY = pGroup->ubSectorY - 1;
break;
case EAST:
pGroup->ubPrevX = pGroup->ubSectorX + 1;
pGroup->ubPrevY = pGroup->ubSectorY;
break;
case SOUTH:
pGroup->ubPrevX = pGroup->ubSectorX;
pGroup->ubPrevY = pGroup->ubSectorY + 1;
break;
case WEST:
pGroup->ubPrevX = pGroup->ubSectorX - 1;
pGroup->ubPrevY = pGroup->ubSectorY;
break;
default:
break;
}
RetreatGroupToPreviousSector(pGroup);
break;
}
}
}
}
void HandleSoldierLeavingSectorByThemSelf( SOLDIERTYPE *pSoldier )
{
@@ -4361,17 +4409,7 @@ void AllMercsWalkedToExitGrid( )
(gubAdjacentJumpCode == JUMP_ALL_LOAD_NEW || gubAdjacentJumpCode == JUMP_SINGLE_LOAD_NEW) )
{
HandleLoyaltyImplicationsOfMercRetreat( RETREAT_TACTICAL_TRAVERSAL, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
// End inetrrogation quest if we left the sector, but haven't killed all enemies
if ( gWorldSectorX == 7 && gWorldSectorY == 14 && gbWorldSectorZ == 0 && gubQuest[QUEST_INTERROGATION] == QUESTINPROGRESS )
{
// Finish quest, although not give points here...
InternalEndQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, FALSE );
// ... give them manually, but halved
GiveQuestRewardPoint( gWorldSectorX, gWorldSectorY, 4, NO_PROFILE );
// Also get us know, we finished the quest
ResetHistoryFact( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY );
}
HandlePOWQuestState(Q_END, QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -4539,17 +4577,7 @@ void AllMercsHaveWalkedOffSector( )
(gubAdjacentJumpCode == JUMP_ALL_LOAD_NEW || gubAdjacentJumpCode == JUMP_SINGLE_LOAD_NEW) )
{
HandleLoyaltyImplicationsOfMercRetreat( RETREAT_TACTICAL_TRAVERSAL, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
// End inetrrogation quest if we left the sector, but haven't killed all enemies
if ( gWorldSectorX == 7 && gWorldSectorY == 14 && gbWorldSectorZ == 0 && gubQuest[QUEST_INTERROGATION] == QUESTINPROGRESS )
{
// Finish quest, although not give points here...
InternalEndQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, FALSE );
// ... give them manually, but halved
GiveQuestRewardPoint( gWorldSectorX, gWorldSectorY, 4, NO_PROFILE );
// Also get us know, we finished the quest
ResetHistoryFact( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY );
}
HandlePOWQuestState(Q_END, QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
}
////////////////////////////////////////////////////////////////////////////////////////
}
@@ -6921,6 +6949,47 @@ BOOLEAN EscapeDirectionIsValid( INT8 * pbDirection )
}
return(*pbDirection != -1);
}
bool IsEscapeDirectionValid(WorldDirections pbDirection)
{
bool isValid = false;
UINT8 const ubSectorID = SECTOR(gWorldSectorX, gWorldSectorY);
switch (pbDirection)
{
case NORTH:
if (!(gWorldSectorY - 1 < MINIMUM_VALID_Y_COORDINATE || gMapInformation.sNorthGridNo == NOWHERE ||
SectorInfo[ubSectorID].ubTraversability[NORTH_STRATEGIC_MOVE] == GROUNDBARRIER || SectorInfo[ubSectorID].ubTraversability[NORTH_STRATEGIC_MOVE] == EDGEOFWORLD))
{
isValid = true;
}
break;
case EAST:
if (!(gWorldSectorX + 1 > MAXIMUM_VALID_X_COORDINATE || gMapInformation.sEastGridNo == NOWHERE ||
SectorInfo[ubSectorID].ubTraversability[EAST_STRATEGIC_MOVE] == GROUNDBARRIER || SectorInfo[ubSectorID].ubTraversability[EAST_STRATEGIC_MOVE] == EDGEOFWORLD))
{
isValid = true;
}
break;
case SOUTH:
if (!(gWorldSectorY + 1 > MAXIMUM_VALID_Y_COORDINATE || gMapInformation.sSouthGridNo == NOWHERE ||
SectorInfo[ubSectorID].ubTraversability[SOUTH_STRATEGIC_MOVE] == GROUNDBARRIER || SectorInfo[ubSectorID].ubTraversability[SOUTH_STRATEGIC_MOVE] == EDGEOFWORLD))
{
isValid = true;
}
break;
case WEST:
if (!(gWorldSectorX - 1 < MINIMUM_VALID_X_COORDINATE || gMapInformation.sWestGridNo == NOWHERE ||
SectorInfo[ubSectorID].ubTraversability[WEST_STRATEGIC_MOVE] == GROUNDBARRIER || SectorInfo[ubSectorID].ubTraversability[WEST_STRATEGIC_MOVE] == EDGEOFWORLD))
{
isValid = true;
}
break;
}
return isValid;
}
#ifdef JA2UB
@@ -7968,4 +8037,4 @@ UINT8 tryToRecoverSquadsAndMovementGroups(SOLDIERTYPE* pCharacter) {
}
CheckSquadMovementGroups();
return GetSoldierGroupId(pCharacter);
}
}
+3 -2
View File
@@ -119,7 +119,7 @@ void GetMapFileName(INT16 sMapX,INT16 sMapY, INT8 bSectorZ, STR8 bString, BOOLEA
// Called from within tactical.....
void JumpIntoAdjacentSector( UINT8 ubDirection, UINT8 ubJumpCode, INT32 sAdditionalData );//dnl ch56 151009
void JumpIntoEscapedSector(UINT8 ubTacticalDirection);
BOOLEAN CanGoToTacticalInSector( INT16 sX, INT16 sY, UINT8 ubZ );
@@ -207,6 +207,7 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSect
BOOLEAN MapExists( UINT8 * szFilename );
BOOLEAN EscapeDirectionIsValid( INT8 * pbDirection );
bool IsEscapeDirectionValid(WorldDirections pbDirection);
//Used for determining the type of error message that comes up when you can't traverse to
//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED!
extern BOOLEAN gfInvalidTraversal;
@@ -235,4 +236,4 @@ BOOLEAN CanRequestMilitiaReinforcements( INT16 sMapX, INT16 sMapY, INT16 sSrcMap
// Bob: check and try to fix issues with squad and group assignment
UINT8 tryToRecoverSquadsAndMovementGroups(SOLDIERTYPE* pCharacter);
#endif
#endif
-52
View File
@@ -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<ARMS_DEALER_INFO> armsDealerInfo (NUM_ARMS_DEALERS);
+157
View File
@@ -0,0 +1,157 @@
set(TacticalSrc
"${CMAKE_CURRENT_SOURCE_DIR}/Air Raid.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Animation Cache.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Animation Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Animation Data.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Arms Dealer Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ArmsDealerInvInit.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Auto Bandage.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Boxing.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/bullets.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Campaign.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Civ Quotes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Dialogue Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Disease.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DisplayCover.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Drugs And Alcohol.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DynamicDialogue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/End Game.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Enemy Soldier Save.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/EnemyItemDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Faces.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Food.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/fov.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GAP.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Handle Doors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Handle Items.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Handle UI Plan.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Handle UI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Cursors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Dialogue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Enhanced.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Items.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Panels.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface Utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Interface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/InterfaceItemImages.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Inventory Choosing.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Item Types.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Items.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25_Tactical.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Keys.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/AbstractXMLLoader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/BodyType.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/BodyTypeDB.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/EnumeratorDB.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/Filter.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/FilterDB.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/Layers.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/PaletteDB.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/PaletteTable.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/SurfaceCache.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/SurfaceDB.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LogicalBodyTypes/XMLParseException.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LOS.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Map Information.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Merc Entering.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Merc Hiring.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Militia Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Minigame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Morale.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/opplist.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Overhead.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PATHAI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Points.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QARRAY.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Rain.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/RandomMerc.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Real Time Input.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Rotting Corpses.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ShopKeeper Interface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SkillCheck.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SkillMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Add.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Ani.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Control.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Create.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Find.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Init List.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Profile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Soldier Tile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SoldierTooltips.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Spread Burst.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Squads.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Strategic Exit GUI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Structure Wrap.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Tactical Save.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Tactical Turns.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TeamTurns.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Turn Based Input.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/UI Cursors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Vehicles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AttachmentInfo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Attachments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AttachmentSlots.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Background.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_BurstSounds.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_CivGroupNames.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Clothes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ComboMergeInfo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_CompatibleFaceItems.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Disease.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Drugs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyAmmoDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyArmourDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyExplosiveDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyItemChoice.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyMiscDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyNames.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyRank.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyWeaponChoice.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_EnemyWeaponDrops.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Explosive.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Food.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_FoodOpinions.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_HiddenNames.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IMPItemChoices.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IncompatibleAttachments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_InteractiveTiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_ItemAdjustments.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Keys.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Launchable.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_LBEPocket.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_LBEPocketPopup.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_LoadBearingEquipment.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_LoadScreenHints.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Locks.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Magazine.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Merchants.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_MercStartingGear.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Merge.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_MilitiaIndividual.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_NewFaceGear.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Opinions.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Profiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Qarray.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_RandomItem.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_RandomStats.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_RPCFacesSmall.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_SectorLoadscreens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_SoldierProfiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Sounds.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_SpreadPatterns.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_StructureConstruct.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_StructureDeconstruct.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Structure_Move.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Taunts.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AdditionalTileProperties.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_TonyInventory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Vehicles.cpp"
PARENT_SCOPE)
+4 -34
View File
@@ -197,42 +197,12 @@ BOOLEAN GetCivQuoteText(UINT16 ubCivQuoteID, UINT16 ubEntryID, STR16 zQuote )
void SurrenderMessageBoxCallBack( UINT8 ubExitValue )
{
SOLDIERTYPE *pTeamSoldier;
INT32 cnt = 0;
if ( ubExitValue == MSG_BOX_RETURN_YES )
{
// CJC Dec 1 2002: fix multiple captures
BeginCaptureSquence();
// Do capture....
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++)
{
// Are we active and in sector.....
if ( pTeamSoldier->bActive && pTeamSoldier->bInSector )
{
if ( pTeamSoldier->stats.bLife != 0 )
{
EnemyCapturesPlayerSoldier( pTeamSoldier );
RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE );
}
}
}
EndCaptureSequence( );
gfSurrendered = TRUE;
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
ActionDone( gCivQuoteData.pCiv );
}
else
{
ActionDone( gCivQuoteData.pCiv );
AttemptToCapturePlayerSoldiers();
}
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
ActionDone( gCivQuoteData.pCiv );
}
void ShutDownQuoteBox( BOOLEAN fForce )
@@ -2383,4 +2353,4 @@ BOOLEAN PlayVoiceTaunt(SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTa
}
return TRUE;
}
}
-29
View File
@@ -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 )
+63 -68
View File
@@ -88,6 +88,11 @@
#include "Map Screen Interface.h" // added by Flugente for SquadNames
#include "Keys.h" // added by silversurfer for door handling from the side
#include "AIInternals.h"
extern BOOLEAN gubWorldTileInLight[MAX_ALLOWED_WORLD_MAX];
extern BOOLEAN gubIsCorpseThere[MAX_ALLOWED_WORLD_MAX];
extern INT32 gubMerkCanSeeThisTile[MAX_ALLOWED_WORLD_MAX];
//////////////////////////////////////////////////////////////////////////////
// SANDRO - In this file, all APBPConstants[AP_CROUCH] and APBPConstants[AP_PRONE] were changed to GetAPsCrouch() and GetAPsProne()
// On the bottom here, there are these functions made
@@ -1365,74 +1370,74 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent )
SaveGame(SAVE__END_TURN_NUM, zString );
}
// Flugente: this stuff is only ever used in AStar pathing and is a unnecessary waste of resources otherwise, so I'm putting an end to this
#ifdef USE_ASTAR_PATHS
////ddd enemy turn optimization
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT ) )
if (gGameSettings.fOptions[TOPTION_ALT_PATHFINDING])
{
memset( gubWorldTileInLight, FALSE, sizeof( gubWorldTileInLight ) );
memset( gubIsCorpseThere, FALSE, sizeof( gubIsCorpseThere ) );
memset( gubMerkCanSeeThisTile, FALSE, sizeof( gubMerkCanSeeThisTile ) );
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT ) )
{
memset( gubWorldTileInLight, FALSE, sizeof( gubWorldTileInLight ) );
memset( gubIsCorpseThere, FALSE, sizeof( gubIsCorpseThere ) );
memset( gubMerkCanSeeThisTile, FALSE, sizeof( gubMerkCanSeeThisTile ) );
//sevenfm translated: unwinding of loop. When changing WORLD_MAX to another value will need some cleaning! dangerous code! ;)
//sevenfm translated: unwinding of loop. When changing WORLD_MAX to another value will need some cleaning! dangerous code! ;)
// WANNE: We had a custom user map (Tixa, J9), where the following loop caused an unhandled exception.
// The crash occurd at ~index 16000 when calling the method IsCorpseAtGridNo() ...
// I don't know what causes it ...
// Just try/catch (ugly, but works).
__try
{
for(UINT32 i=0; i<(UINT32)WORLD_MAX; i+=4)
{
gubWorldTileInLight[i] = InLightAtNight(i, gpWorldLevelData[ i ].sHeight);
gubIsCorpseThere[i] = IsCorpseAtGridNo( i, gpWorldLevelData[ i ].sHeight );
gubWorldTileInLight[i+1] = InLightAtNight(i+1, gpWorldLevelData[ i+1 ].sHeight);
gubIsCorpseThere[i+1] = IsCorpseAtGridNo( i+1, gpWorldLevelData[ i+1 ].sHeight );
gubWorldTileInLight[i+2] = InLightAtNight(i+2, gpWorldLevelData[ i+2 ].sHeight);
gubIsCorpseThere[i+2] = IsCorpseAtGridNo( i+2, gpWorldLevelData[ i+2 ].sHeight );
gubWorldTileInLight[i+3] = InLightAtNight(i+3, gpWorldLevelData[ i+3 ].sHeight);
gubIsCorpseThere[i+3] = IsCorpseAtGridNo( i+3, gpWorldLevelData[ i+3 ].sHeight );
}
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
// WANNE: Ignore, so the game can continue ...
}
INT32 tcnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
SOLDIERTYPE *tS;
INT16 sXOffset, sYOffset;
INT32 sGridNo;
UINT16 usSightLimit=0;
for ( tS = MercPtrs[ tcnt ]; tcnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++tcnt, tS++ )
{
if ( tS->stats.bLife >= OKLIFE && tS->sGridNo != NOWHERE && tS->bInSector )
// WANNE: We had a custom user map (Tixa, J9), where the following loop caused an unhandled exception.
// The crash occurd at ~index 16000 when calling the method IsCorpseAtGridNo() ...
// I don't know what causes it ...
// Just try/catch (ugly, but works).
__try
{
for(UINT32 i=0; i<(UINT32)WORLD_MAX; i+=4)
{
gubWorldTileInLight[i] = InLightAtNight(i, gpWorldLevelData[ i ].sHeight);
gubIsCorpseThere[i] = IsCorpseAtGridNo( i, gpWorldLevelData[ i ].sHeight );
gubWorldTileInLight[i+1] = InLightAtNight(i+1, gpWorldLevelData[ i+1 ].sHeight);
gubIsCorpseThere[i+1] = IsCorpseAtGridNo( i+1, gpWorldLevelData[ i+1 ].sHeight );
gubWorldTileInLight[i+2] = InLightAtNight(i+2, gpWorldLevelData[ i+2 ].sHeight);
gubIsCorpseThere[i+2] = IsCorpseAtGridNo( i+2, gpWorldLevelData[ i+2 ].sHeight );
gubWorldTileInLight[i+3] = InLightAtNight(i+3, gpWorldLevelData[ i+3 ].sHeight);
gubIsCorpseThere[i+3] = IsCorpseAtGridNo( i+3, gpWorldLevelData[ i+3 ].sHeight );
}
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
//loop through all the gridnos that we are interested in
for (sYOffset = -30; sYOffset <= 30; ++sYOffset)
// WANNE: Ignore, so the game can continue ...
}
INT32 tcnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
SOLDIERTYPE *tS;
INT16 sXOffset, sYOffset;
INT32 sGridNo;
UINT16 usSightLimit=0;
for ( tS = MercPtrs[ tcnt ]; tcnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++tcnt, tS++ )
{
if ( tS->stats.bLife >= OKLIFE && tS->sGridNo != NOWHERE && tS->bInSector )
{
for (sXOffset = -30; sXOffset <= 30; ++sXOffset)
//loop through all the gridnos that we are interested in
for (sYOffset = -30; sYOffset <= 30; ++sYOffset)
{
sGridNo = tS->sGridNo + sXOffset + (MAXCOL * sYOffset);
if ( sGridNo <= 0 || sGridNo >= WORLD_MAX )
continue;
//usSightLimit = tS->GetMaxDistanceVisible(sGridNo, FALSE, CALC_FROM_WANTED_DIR);
if(gubMerkCanSeeThisTile[sGridNo]==0)
for (sXOffset = -30; sXOffset <= 30; ++sXOffset)
{
gubMerkCanSeeThisTile[sGridNo]=//SoldierToVirtualSoldierLineOfSightTest( tS, sGridNo, FALSE, ANIM_STAND, TRUE, usSightLimit );
SoldierToVirtualSoldierLineOfSightTest( tS, sGridNo, tS->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_WANTED_DIR);
}
}//fo
}
}//if
sGridNo = tS->sGridNo + sXOffset + (MAXCOL * sYOffset);
if ( sGridNo <= 0 || sGridNo >= WORLD_MAX )
continue;
//usSightLimit = tS->GetMaxDistanceVisible(sGridNo, FALSE, CALC_FROM_WANTED_DIR);
if(gubMerkCanSeeThisTile[sGridNo]==0)
{
gubMerkCanSeeThisTile[sGridNo]=//SoldierToVirtualSoldierLineOfSightTest( tS, sGridNo, FALSE, ANIM_STAND, TRUE, usSightLimit );
SoldierToVirtualSoldierLineOfSightTest( tS, sGridNo, tS->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_WANTED_DIR);
}
}//fo
}
}//if
}
}
}
//ddd enemy turn optimization**
#endif
// End our turn!
if (is_server || !is_client)
@@ -3920,14 +3925,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;
}
@@ -7433,9 +7430,7 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec
}
// This ain't gonna happen with backpack
if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pSoldier->CanClimbWithCurrentBackpack())
{
return( FALSE );
}
-44
View File
@@ -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 ) )
+4 -16
View File
@@ -4632,10 +4632,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
if ( fNearLowerLevel )
{
if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!gpSMCurrentMerc->CanClimbWithCurrentBackpack())
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]);
return;
@@ -4646,10 +4643,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
if ( fNearHeigherLevel )
{
if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!gpSMCurrentMerc->CanClimbWithCurrentBackpack())
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]);
return;
@@ -4662,10 +4656,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
if (gGameExternalOptions.fCanClimbOnWalls == TRUE)
{
if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!gpSMCurrentMerc->CanClimbWithCurrentBackpack())
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]);
return;
@@ -4681,10 +4672,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) )
{
if ((UsingNewInventorySystem() == true) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)gpSMCurrentMerc->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[gpSMCurrentMerc->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!gpSMCurrentMerc->CanClimbWithCurrentBackpack())
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]);
return;
+1
View File
@@ -5,6 +5,7 @@
#include "mousesystem.h"
#include "structure.h"
#include "Assignments.h" // added by Flugente for the stat-enums
#include <EditorMercs.h>
#define MAX_UICOMPOSITES 4
-6
View File
@@ -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)
-92
View File
@@ -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,44 +12589,7 @@ 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();
UINT16 maxcoolness = max( HighestPlayerProgressPercentage() / 10, lowestCoolness );
+10 -12
View File
@@ -1167,6 +1167,11 @@ BOOLEAN LoadDoorTableFromDoorTableTempFile( )
static auto ComplainAboutMissingDoorStructure(const INT32 GridNo) {
#if JA2TESTVERSION
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Door structure data at %d was not found", GridNo);
#endif
}
// fOpen is True if the door is open, false if it is closed
BOOLEAN ModifyDoorStatus( INT32 sGridNo, BOOLEAN fOpen, BOOLEAN fPerceivedOpen )
@@ -1190,9 +1195,7 @@ 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
ComplainAboutMissingDoorStructure(sGridNo);
return( FALSE );
}
@@ -1314,9 +1317,7 @@ 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
ComplainAboutMissingDoorStructure(sGridNo);
return( FALSE );
}
@@ -1367,6 +1368,7 @@ DOOR_STATUS *GetDoorStatus( INT32 sGridNo )
if ( pBaseStructure == NULL )
{
ComplainAboutMissingDoorStructure(sGridNo);
return( NULL );
}
@@ -1527,9 +1529,7 @@ 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
ComplainAboutMissingDoorStructure(pDoorStatus->sGridNo);
return;
}
@@ -1611,9 +1611,7 @@ 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
ComplainAboutMissingDoorStructure(pDoorStatus->sGridNo);
return;
}
+2 -36
View File
@@ -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,9 @@ 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
/* see previous commit for historically interesting comment on the reason Distance2D instead
of Distance3D is used here */
d2DDistance = Distance2D( dDeltaX, dDeltaY );
#endif
iDistance = (INT32) d2DDistance;
if ( d2DDistance != iDistance )
@@ -5813,15 +5799,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 +5968,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 +8554,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 )
+39
View File
@@ -2,6 +2,21 @@
namespace LogicalBodyTypes {
INT32 CompareAttachment(SOLDIERTYPE* pSoldier, INVENTORY_SLOT slot, UINT8 index)
{
INT32 cmp_val = 0;
if (pSoldier->inv[slot].objectStack.size() > 0)
{
OBJECTTYPE* const attachment = pSoldier->inv[slot].objectStack.front().GetAttachmentAtIndex(index);
if (attachment) { cmp_val = attachment->usItem; }
else { cmp_val = 0; }
}
else { cmp_val = 0; }
return cmp_val;
}
Filter::Filter(void) {
}
@@ -210,6 +225,30 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) {
case REQ_WEARING_BACKPACK:
cmp_val = pSoldier->inv[BPACKPOCKPOS].exists();
break;
case REQ_HELMETPOSATTACHMENT0:
cmp_val = CompareAttachment(pSoldier, HELMETPOS, 0);
break;
case REQ_HELMETPOSATTACHMENT1:
cmp_val = CompareAttachment(pSoldier, HELMETPOS, 1);
break;
case REQ_HELMETPOSATTACHMENT2:
cmp_val = CompareAttachment(pSoldier, HELMETPOS, 2);
break;
case REQ_HELMETPOSATTACHMENT3:
cmp_val = CompareAttachment(pSoldier, HELMETPOS, 3);
break;
case REQ_LEGPOSATTACHMENT0:
cmp_val = CompareAttachment(pSoldier, LEGPOS, 0);
break;
case REQ_LEGPOSATTACHMENT1:
cmp_val = CompareAttachment(pSoldier, LEGPOS, 1);
break;
case REQ_LEGPOSATTACHMENT2:
cmp_val = CompareAttachment(pSoldier, LEGPOS, 2);
break;
case REQ_LEGPOSATTACHMENT3:
cmp_val = CompareAttachment(pSoldier, LEGPOS, 3);
break;
default:
if (q < NUM_REQTYPESINV) {
cmp_val = pSoldier->inv[q].usItem;
+9 -1
View File
@@ -64,6 +64,14 @@ public:
REQ_HELMET_AMOR_PROTECTION,
REQ_HELMET_AMOR_COVERAGE,
REQ_WEARING_BACKPACK,
REQ_HELMETPOSATTACHMENT0,
REQ_HELMETPOSATTACHMENT1,
REQ_HELMETPOSATTACHMENT2,
REQ_HELMETPOSATTACHMENT3,
REQ_LEGPOSATTACHMENT0,
REQ_LEGPOSATTACHMENT1,
REQ_LEGPOSATTACHMENT2,
REQ_LEGPOSATTACHMENT3,
NUM_REQTYPES,
// 3rd byte is for operator flags
_REQ_BTWN = 0x20000,
@@ -86,7 +94,7 @@ public:
};
typedef std::pair <INT32, INT32> NumberPair;
typedef std::list <std::wstring> StringList;
typedef std::list <INT32> NumberList;
typedef std::vector <INT32> NumberList;
union criterionVariant {
INT32 number;
std::wstring* string;
+10 -2
View File
@@ -270,7 +270,7 @@ namespace LogicalBodyTypes {
/*****************************************
Filter enum criterion types
******************************************/
LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 33,
LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 41,
Filter::REQ_HELMETPOS,
Filter::REQ_VESTPOS,
Filter::REQ_LEGPOS,
@@ -303,7 +303,15 @@ namespace LogicalBodyTypes {
Filter::REQ_VEST_AMOR_COVERAGE,
Filter::REQ_HELMET_AMOR_PROTECTION,
Filter::REQ_HELMET_AMOR_COVERAGE,
Filter::REQ_WEARING_BACKPACK
Filter::REQ_WEARING_BACKPACK,
Filter::REQ_HELMETPOSATTACHMENT0,
Filter::REQ_HELMETPOSATTACHMENT1,
Filter::REQ_HELMETPOSATTACHMENT2,
Filter::REQ_HELMETPOSATTACHMENT3,
Filter::REQ_LEGPOSATTACHMENT0,
Filter::REQ_LEGPOSATTACHMENT1,
Filter::REQ_LEGPOSATTACHMENT2,
Filter::REQ_LEGPOSATTACHMENT3
);
/*****************************************
-321
View File
@@ -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." );
-15
View File
@@ -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] );
}
-283
View File
@@ -335,280 +335,6 @@ extern UINT8 giMAXIMUM_NUMBER_OF_CIVS;
#define LAN_TEAM_FOUR 9
//hayden
//-----------------------------------------------
//
// civilian "sub teams":
enum
{
NON_CIV_GROUP = 0,
REBEL_CIV_GROUP,
KINGPIN_CIV_GROUP,
SANMONA_ARMS_GROUP,
ANGELS_GROUP,
BEGGARS_CIV_GROUP,
TOURISTS_CIV_GROUP,
ALMA_MILITARY_CIV_GROUP,
DOCTORS_CIV_GROUP,
COUPLE1_CIV_GROUP,
HICKS_CIV_GROUP,
WARDEN_CIV_GROUP,
JUNKYARD_CIV_GROUP,
FACTORY_KIDS_GROUP,
QUEENS_CIV_GROUP,
UNNAMED_CIV_GROUP_15,
UNNAMED_CIV_GROUP_16,
UNNAMED_CIV_GROUP_17,
UNNAMED_CIV_GROUP_18,
UNNAMED_CIV_GROUP_19,
ASSASSIN_CIV_GROUP, // Flugente: enemy assassins belong to this group
POW_PRISON_CIV_GROUP, // Flugente: prisoners of war the player caught are in this group
UNNAMED_CIV_GROUP_22,
UNNAMED_CIV_GROUP_23,
VOLUNTEER_CIV_GROUP, // Flugente: civilians that the player recruited
BOUNTYHUNTER_CIV_GROUP, // Flugente: hostile bounty hunters
DOWNEDPILOT_CIV_GROUP, // Flugente: downed pilots
SCIENTIST_GROUP, // Flugente: enemy civilian personnel
RADAR_TECHNICIAN_GROUP,
AIRPORT_STAFF_GROUP,
BARRACK_STAFF_GROUP,
FACTORY_GROUP,
ADMINISTRATIVE_STAFF_GROUP,
LOYAL_CIV_GROUP, // civil population deeply loyal to the queen
BLACKMARKET_GROUP, // black market dealer and bodyguards
UNNAMED_CIV_GROUP_35,
UNNAMED_CIV_GROUP_36,
UNNAMED_CIV_GROUP_37,
UNNAMED_CIV_GROUP_38,
UNNAMED_CIV_GROUP_39,
UNNAMED_CIV_GROUP_40,
UNNAMED_CIV_GROUP_41,
UNNAMED_CIV_GROUP_42,
UNNAMED_CIV_GROUP_43,
UNNAMED_CIV_GROUP_44,
UNNAMED_CIV_GROUP_45,
UNNAMED_CIV_GROUP_46,
UNNAMED_CIV_GROUP_47,
UNNAMED_CIV_GROUP_48,
UNNAMED_CIV_GROUP_49,
UNNAMED_CIV_GROUP_50,
UNNAMED_CIV_GROUP_51,
UNNAMED_CIV_GROUP_52,
UNNAMED_CIV_GROUP_53,
UNNAMED_CIV_GROUP_54,
UNNAMED_CIV_GROUP_55,
UNNAMED_CIV_GROUP_56,
UNNAMED_CIV_GROUP_57,
UNNAMED_CIV_GROUP_58,
UNNAMED_CIV_GROUP_59,
UNNAMED_CIV_GROUP_60,
UNNAMED_CIV_GROUP_61,
UNNAMED_CIV_GROUP_62,
UNNAMED_CIV_GROUP_63,
UNNAMED_CIV_GROUP_64,
UNNAMED_CIV_GROUP_65,
UNNAMED_CIV_GROUP_66,
UNNAMED_CIV_GROUP_67,
UNNAMED_CIV_GROUP_68,
UNNAMED_CIV_GROUP_69,
UNNAMED_CIV_GROUP_70,
UNNAMED_CIV_GROUP_71,
UNNAMED_CIV_GROUP_72,
UNNAMED_CIV_GROUP_73,
UNNAMED_CIV_GROUP_74,
UNNAMED_CIV_GROUP_75,
UNNAMED_CIV_GROUP_76,
UNNAMED_CIV_GROUP_77,
UNNAMED_CIV_GROUP_78,
UNNAMED_CIV_GROUP_79,
UNNAMED_CIV_GROUP_80,
UNNAMED_CIV_GROUP_81,
UNNAMED_CIV_GROUP_82,
UNNAMED_CIV_GROUP_83,
UNNAMED_CIV_GROUP_84,
UNNAMED_CIV_GROUP_85,
UNNAMED_CIV_GROUP_86,
UNNAMED_CIV_GROUP_87,
UNNAMED_CIV_GROUP_88,
UNNAMED_CIV_GROUP_89,
UNNAMED_CIV_GROUP_90,
UNNAMED_CIV_GROUP_91,
UNNAMED_CIV_GROUP_92,
UNNAMED_CIV_GROUP_93,
UNNAMED_CIV_GROUP_94,
UNNAMED_CIV_GROUP_95,
UNNAMED_CIV_GROUP_96,
UNNAMED_CIV_GROUP_97,
UNNAMED_CIV_GROUP_98,
UNNAMED_CIV_GROUP_99,
UNNAMED_CIV_GROUP_100,
UNNAMED_CIV_GROUP_101,
UNNAMED_CIV_GROUP_102,
UNNAMED_CIV_GROUP_103,
UNNAMED_CIV_GROUP_104,
UNNAMED_CIV_GROUP_105,
UNNAMED_CIV_GROUP_106,
UNNAMED_CIV_GROUP_107,
UNNAMED_CIV_GROUP_108,
UNNAMED_CIV_GROUP_109,
UNNAMED_CIV_GROUP_110,
UNNAMED_CIV_GROUP_111,
UNNAMED_CIV_GROUP_112,
UNNAMED_CIV_GROUP_113,
UNNAMED_CIV_GROUP_114,
UNNAMED_CIV_GROUP_115,
UNNAMED_CIV_GROUP_116,
UNNAMED_CIV_GROUP_117,
UNNAMED_CIV_GROUP_118,
UNNAMED_CIV_GROUP_119,
UNNAMED_CIV_GROUP_120,
UNNAMED_CIV_GROUP_121,
UNNAMED_CIV_GROUP_122,
UNNAMED_CIV_GROUP_123,
UNNAMED_CIV_GROUP_124,
UNNAMED_CIV_GROUP_125,
UNNAMED_CIV_GROUP_126,
UNNAMED_CIV_GROUP_127,
UNNAMED_CIV_GROUP_128,
UNNAMED_CIV_GROUP_129,
UNNAMED_CIV_GROUP_130,
UNNAMED_CIV_GROUP_131,
UNNAMED_CIV_GROUP_132,
UNNAMED_CIV_GROUP_133,
UNNAMED_CIV_GROUP_134,
UNNAMED_CIV_GROUP_135,
UNNAMED_CIV_GROUP_136,
UNNAMED_CIV_GROUP_137,
UNNAMED_CIV_GROUP_138,
UNNAMED_CIV_GROUP_139,
UNNAMED_CIV_GROUP_140,
UNNAMED_CIV_GROUP_141,
UNNAMED_CIV_GROUP_142,
UNNAMED_CIV_GROUP_143,
UNNAMED_CIV_GROUP_144,
UNNAMED_CIV_GROUP_145,
UNNAMED_CIV_GROUP_146,
UNNAMED_CIV_GROUP_147,
UNNAMED_CIV_GROUP_148,
UNNAMED_CIV_GROUP_149,
UNNAMED_CIV_GROUP_150,
UNNAMED_CIV_GROUP_151,
UNNAMED_CIV_GROUP_152,
UNNAMED_CIV_GROUP_153,
UNNAMED_CIV_GROUP_154,
UNNAMED_CIV_GROUP_155,
UNNAMED_CIV_GROUP_156,
UNNAMED_CIV_GROUP_157,
UNNAMED_CIV_GROUP_158,
UNNAMED_CIV_GROUP_159,
UNNAMED_CIV_GROUP_160,
UNNAMED_CIV_GROUP_161,
UNNAMED_CIV_GROUP_162,
UNNAMED_CIV_GROUP_163,
UNNAMED_CIV_GROUP_164,
UNNAMED_CIV_GROUP_165,
UNNAMED_CIV_GROUP_166,
UNNAMED_CIV_GROUP_167,
UNNAMED_CIV_GROUP_168,
UNNAMED_CIV_GROUP_169,
UNNAMED_CIV_GROUP_170,
UNNAMED_CIV_GROUP_171,
UNNAMED_CIV_GROUP_172,
UNNAMED_CIV_GROUP_173,
UNNAMED_CIV_GROUP_174,
UNNAMED_CIV_GROUP_175,
UNNAMED_CIV_GROUP_176,
UNNAMED_CIV_GROUP_177,
UNNAMED_CIV_GROUP_178,
UNNAMED_CIV_GROUP_179,
UNNAMED_CIV_GROUP_180,
UNNAMED_CIV_GROUP_181,
UNNAMED_CIV_GROUP_182,
UNNAMED_CIV_GROUP_183,
UNNAMED_CIV_GROUP_184,
UNNAMED_CIV_GROUP_185,
UNNAMED_CIV_GROUP_186,
UNNAMED_CIV_GROUP_187,
UNNAMED_CIV_GROUP_188,
UNNAMED_CIV_GROUP_189,
UNNAMED_CIV_GROUP_190,
UNNAMED_CIV_GROUP_191,
UNNAMED_CIV_GROUP_192,
UNNAMED_CIV_GROUP_193,
UNNAMED_CIV_GROUP_194,
UNNAMED_CIV_GROUP_195,
UNNAMED_CIV_GROUP_196,
UNNAMED_CIV_GROUP_197,
UNNAMED_CIV_GROUP_198,
UNNAMED_CIV_GROUP_199,
UNNAMED_CIV_GROUP_200,
UNNAMED_CIV_GROUP_201,
UNNAMED_CIV_GROUP_202,
UNNAMED_CIV_GROUP_203,
UNNAMED_CIV_GROUP_204,
UNNAMED_CIV_GROUP_205,
UNNAMED_CIV_GROUP_206,
UNNAMED_CIV_GROUP_207,
UNNAMED_CIV_GROUP_208,
UNNAMED_CIV_GROUP_209,
UNNAMED_CIV_GROUP_210,
UNNAMED_CIV_GROUP_211,
UNNAMED_CIV_GROUP_212,
UNNAMED_CIV_GROUP_213,
UNNAMED_CIV_GROUP_214,
UNNAMED_CIV_GROUP_215,
UNNAMED_CIV_GROUP_216,
UNNAMED_CIV_GROUP_217,
UNNAMED_CIV_GROUP_218,
UNNAMED_CIV_GROUP_219,
UNNAMED_CIV_GROUP_220,
UNNAMED_CIV_GROUP_221,
UNNAMED_CIV_GROUP_222,
UNNAMED_CIV_GROUP_223,
UNNAMED_CIV_GROUP_224,
UNNAMED_CIV_GROUP_225,
UNNAMED_CIV_GROUP_226,
UNNAMED_CIV_GROUP_227,
UNNAMED_CIV_GROUP_228,
UNNAMED_CIV_GROUP_229,
UNNAMED_CIV_GROUP_230,
UNNAMED_CIV_GROUP_231,
UNNAMED_CIV_GROUP_232,
UNNAMED_CIV_GROUP_233,
UNNAMED_CIV_GROUP_234,
UNNAMED_CIV_GROUP_235,
UNNAMED_CIV_GROUP_236,
UNNAMED_CIV_GROUP_237,
UNNAMED_CIV_GROUP_238,
UNNAMED_CIV_GROUP_239,
UNNAMED_CIV_GROUP_240,
UNNAMED_CIV_GROUP_241,
UNNAMED_CIV_GROUP_242,
UNNAMED_CIV_GROUP_243,
UNNAMED_CIV_GROUP_244,
UNNAMED_CIV_GROUP_245,
UNNAMED_CIV_GROUP_246,
UNNAMED_CIV_GROUP_247,
UNNAMED_CIV_GROUP_248,
UNNAMED_CIV_GROUP_249,
UNNAMED_CIV_GROUP_250,
UNNAMED_CIV_GROUP_251,
UNNAMED_CIV_GROUP_252,
UNNAMED_CIV_GROUP_253,
UNNAMED_CIV_GROUP_254,
NUM_CIV_GROUPS
};
#define CIV_GROUP_NEUTRAL 0
#define CIV_GROUP_WILL_EVENTUALLY_BECOME_HOSTILE 1
#define CIV_GROUP_WILL_BECOME_HOSTILE 2
#define CIV_GROUP_HOSTILE 3
// boxing state
enum BoxingStates
{
@@ -621,15 +347,6 @@ enum BoxingStates
LOST_ROUND
} ;
//NOTE: The editor uses these enumerations, so please update the text as well if you modify or
// add new groups. Try to abbreviate the team name as much as possible. The text is in
// EditorMercs.c
#ifdef JA2EDITOR
extern CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 128 ];
#endif
//
//-----------------------------------------------
// PALETTE SUBSITUTION TYPES
typedef struct
{
+129 -209
View File
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <random>
#include <array>
#include "wcheck.h"
#include "stdlib.h"
#include "debug.h"
@@ -1178,12 +1180,6 @@ BOOLEAN ExecuteOverhead( )
pSoldier->flags.fSoldierWasMoving = FALSE;
HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, TRUE, FALSE );
if ( !gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] )
{
pSoldier->DeleteSoldierLight( );
pSoldier->SetCheckSoldierLightFlag( );
}
}
}
else
@@ -7600,35 +7596,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
HandleGlobalLoyaltyEvent(GLOBAL_LOYALTY_BATTLE_LOST, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
}
// SANDRO - end quest if cleared the sector after interrogation (sector N7 by Meduna)
if ( gWorldSectorX == gModSettings.ubMeanwhileInterrogatePOWSectorX && gWorldSectorY == gModSettings.ubMeanwhileInterrogatePOWSectorY &&
gbWorldSectorZ == 0)
{
if (gubQuest[QUEST_INTERROGATION] == QUESTINPROGRESS)
{
// Quest failed
InternalEndQuest(QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, FALSE);
}
else if (gubQuest[QUEST_INTERROGATION] == QUESTCANNOTSTART)
{
//shadooow: re-enable quest if player loses control of the N7 prison and quest was disabled previously
gubQuest[QUEST_INTERROGATION] = QUESTNOTSTARTED;
}
}
//shadooow: re-enable quest if player loses control of the Alma prison and quest was disabled previously
if (gWorldSectorX == gModSettings.ubInitialPOWSectorX && gWorldSectorY == gModSettings.ubInitialPOWSectorY &&
gbWorldSectorZ == 0 && gubQuest[QUEST_HELD_IN_ALMA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_ALMA] = QUESTNOTSTARTED;
}
#ifndef JA2UB
//shadooow: re-enable quest if player loses control of the Tixa prison and quest was disabled previously
if (gWorldSectorX == gModSettings.ubTixaPrisonSectorX && gWorldSectorY == gModSettings.ubTixaPrisonSectorY &&
gbWorldSectorZ == 0 && gubQuest[QUEST_HELD_IN_TIXA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_TIXA] = QUESTNOTSTARTED;
}
#endif
HandlePOWQuestState(Q_FAIL, QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
HandlePOWQuestState(Q_FAIL, QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
HandlePOWQuestState(Q_FAIL, QUEST_HELD_IN_TIXA, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
#endif
// Play death music
#ifdef NEWMUSIC
@@ -7824,51 +7796,12 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
if (!is_networked)
ShouldBeginAutoBandage( );
}
// SANDRO - end quest if cleared the sector after interrogation (sector N7 by Meduna)
if ( gWorldSectorX == gModSettings.ubMeanwhileInterrogatePOWSectorX && gWorldSectorY == gModSettings.ubMeanwhileInterrogatePOWSectorY &&
gbWorldSectorZ == 0)
{
if (gubQuest[QUEST_INTERROGATION] == QUESTINPROGRESS)
{
// Complete quest
EndQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY );
}
else if(gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
{
//shadooow: disable quest if player takes control of the N7 prison
gubQuest[QUEST_INTERROGATION] = QUESTCANNOTSTART;
}
}
//shadooow: disable quest if player takes control of the Alma prison
if (gWorldSectorX == gModSettings.ubInitialPOWSectorX && gWorldSectorY == gModSettings.ubInitialPOWSectorY &&
gbWorldSectorZ == 0)
{
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTINPROGRESS)
{
// Complete quest
EndQuest(QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY);
}
else if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED)
{
gubQuest[QUEST_HELD_IN_ALMA] = QUESTCANNOTSTART;
}
}
#ifndef JA2UB
//shadooow: disable quest if player takes control of the Tixa prison
if (gWorldSectorX == gModSettings.ubTixaPrisonSectorX && gWorldSectorY == gModSettings.ubTixaPrisonSectorY &&
gbWorldSectorZ == 0 && gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED)
{
if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTINPROGRESS)
{
// Complete quest
EndQuest(QUEST_HELD_IN_TIXA, gWorldSectorX, gWorldSectorY);
}
else if (gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED)
{
gubQuest[QUEST_HELD_IN_TIXA] = QUESTCANNOTSTART;
}
}
#endif
#ifndef JA2UB
HandlePOWQuestState(Q_SUCCESS, QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
HandlePOWQuestState(Q_SUCCESS, QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
HandlePOWQuestState(Q_SUCCESS, QUEST_HELD_IN_TIXA, gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
#endif
// Say battle end quote....
if (fAnEnemyRetreated)
@@ -8593,16 +8526,14 @@ BOOLEAN CheckForLosingEndOfBattle( )
{
//if( GetWorldDay() > STARTDAY_ALLOW_PLAYER_CAPTURE_FOR_RESCUE && !( gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE ))
{
#ifdef JA2UB
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
#else
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_HELD_IN_TIXA] != QUESTINPROGRESS && gubQuest[ QUEST_INTERROGATION ] == QUESTNOTSTARTED ) )
#endif
#ifndef JA2UB
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[ QUEST_INTERROGATION ] == QUESTNOTSTARTED )
{
fDoCapture = TRUE;
// CJC Dec 1 2002: fix capture sequences
BeginCaptureSquence();
}
#endif
}
}
}
@@ -8638,8 +8569,6 @@ BOOLEAN CheckForLosingEndOfBattle( )
if ( pTeamSoldier->stats.bLife != 0 && fDoCapture )
{
EnemyCapturesPlayerSoldier( pTeamSoldier );
RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE );
}
}
@@ -9302,11 +9231,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!
@@ -9648,38 +9572,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))
// {
@@ -9720,7 +9612,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
pSoldier = NULL;
if (gTacticalStatus.ubCurrentTeam == gbPlayerNum)
if (gTacticalStatus.ubCurrentTeam == gbPlayerNum && gusSelectedSoldier < TOTAL_SOLDIERS)
{
pSoldier = MercPtrs[ gusSelectedSoldier ];
}
@@ -9741,7 +9633,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
// If we still haven't figured out who last acted, it could be that the team number changed during the attack. Unfortunately this
// can happen during a switch from real-time. For now we will assume the last actor was a PC, but a real "Who started this?" pointer
// would work quite well. If only I could close all the holes that the UI opens so that one routine could handle everything.
if (!pSoldier)
if (!pSoldier && gusSelectedSoldier < TOTAL_SOLDIERS)
{
if (is_networked)
{
@@ -9804,15 +9696,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)
{
@@ -10105,17 +9988,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( );
}
@@ -10132,26 +10004,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 )
@@ -10381,7 +10233,10 @@ void DoneFadeOutDueToDeath( )
void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue )
{
// Enter mapscreen.....
if(!is_client)CheckAndHandleUnloadingOfCurrentWorld();
if (!is_client)
{
CheckAndHandleUnloadingOfCurrentWorld();
}
else
{
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[40] );
@@ -10525,6 +10380,12 @@ void DoPOWPathChecks( )
pSoldier->aiData.bNeutral = FALSE;
AddCharacterToAnySquad( pSoldier );
pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 );
// Decrement amount of prisoners
if (gStrategicStatus.ubNumCapturedForRescue > 0)
{
gStrategicStatus.ubNumCapturedForRescue--;
}
}
}
}
@@ -11175,6 +11036,107 @@ void HandleTurncoatAttempt( SOLDIERTYPE* pSoldier )
}
}
void EscapeTimerCallback()
{
const bool chanceToEscape = Chance(75);
bool escaped = false;
// Look for an escape direction for remaining mercs
std::array<WorldDirections, 4> possibleEscapeDirections{ NORTH, EAST, SOUTH, WEST };
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(possibleEscapeDirections.begin(), possibleEscapeDirections.end(), g);
for (const auto direction : possibleEscapeDirections)
{
if (IsEscapeDirectionValid(direction) && chanceToEscape && gbWorldSectorZ == 0) // There is no escaping underground! For now..
{
escaped = true;
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_ESCAPE]);
JumpIntoEscapedSector(direction);
break;
}
}
if (!escaped)
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_NO_ESCAPE]);
}
}
void AttemptToCapturePlayerSoldiers()
{
#ifdef JA2UB
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_REFUSE_TAKE_PRISONERS]);
#else
// in order for this to work, there must be no militia present, the enemy must not already have offered asked you to surrender, and certain quests may not be active
if (!(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0)
{
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
{
BeginCaptureSquence();
const UINT8 currentPOWs = gStrategicStatus.ubNumCapturedForRescue;
// Do capture
UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT32 const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID;
for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastID; ++i, ++pSoldier)
{
// Are we active and in sector
if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bAssignment != ASSIGNMENT_POW)
{
if (pSoldier->stats.bLife != 0)
{
EnemyCapturesPlayerSoldier(pSoldier);
}
}
}
EndCaptureSequence();
if (currentPOWs < gStrategicStatus.ubNumCapturedForRescue)
{
gfSurrendered = TRUE;
}
else
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_REFUSE_TAKE_PRISONERS]);
}
}
}
else
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_REFUSE_TAKE_PRISONERS]);
}
if (gfSurrendered == TRUE)
{
// If we have any remaining active mercs in sector after capture, give them a chance to escape from the clutches of Deidranna's soldiers!
bool activeMercs = false;
UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT32 lastId = gTacticalStatus.Team[gbPlayerNum].bLastID;
for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastId; ++i, ++pSoldier)
{
// Are we active and in sector
const bool inSector = (pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ);
if (pSoldier->bActive && inSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->bAssignment != ASSIGNMENT_POW)
{
activeMercs = true;
break;
}
}
if (activeMercs)
{
SetCustomizableTimerCallbackAndDelay(500, EscapeTimerCallback, FALSE);
}
SetCustomizableTimerCallbackAndDelay(500, CaptureTimerCallback, FALSE);
CheckForEndOfBattle(FALSE);
}
#endif
}
void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
{
SOLDIERTYPE *pSoldier = NULL;
@@ -11339,49 +11301,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
return;
}
// in order for this to work, there must be no militia present, the enemy must not already have offered asked you to surrender, and certain quests may not be active
if ( !( gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER ) && gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 )
{
#ifdef JA2UB
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
#else
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_HELD_IN_TIXA] != QUESTINPROGRESS && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
#endif
{
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
// CJC Dec 1 2002: fix multiple captures
BeginCaptureSquence();
// Do capture....
uiCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( pSoldier = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCnt, ++pSoldier)
{
// Are we active and in sector.....
if ( pSoldier->bActive && pSoldier->bInSector )
{
if ( pSoldier->stats.bLife != 0 )
{
EnemyCapturesPlayerSoldier( pSoldier );
RemoveSoldierFromTacticalSector( pSoldier, TRUE );
}
}
}
EndCaptureSequence( );
gfSurrendered = TRUE;
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
success = TRUE;
}
}
if ( !success )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[ STR_PRISONER_REFUSE_TAKE_PRISONERS ] );
}
SetCustomizableTimerCallbackAndDelay(500, AttemptToCapturePlayerSoldiers, FALSE);
}
// we distract the enemy by essentially talking them to death
else if ( ubExitValue == 3 )
+2 -2
View File
@@ -4,7 +4,7 @@
#include <string.h>
#include <stdio.h>
#include "Soldier Control.h"
#include "overhead types.h"
#include <EditorMercs.h>
#include "soldier find.h"
#include "Campaign Types.h" // added by Flugente for SECTORINFO and UNDERGROUND_SECTORINFO
#define ADD_SOLDIER_NO_PROFILE_ID 200
@@ -433,6 +433,6 @@ void VIPFleesToMeduna();
BOOLEAN IsCivFactionMemberAliveInSector( UINT8 usCivilianGroup );
BOOLEAN IsFreeSlotAvailable( int aTeam );
void AttemptToCapturePlayerSoldiers();
#endif
-8
View File
@@ -10,12 +10,6 @@
#define _PATHAI_H
#include "isometric utils.h"
// WANNE: Please do not use ASTAR pathing,
// because it is a HUGH PERFORMANCE KILLER on big maps!!
//#define USE_ASTAR_PATHS
#ifdef USE_ASTAR_PATHS
namespace ASTAR {
#include "BinaryHeap.hpp"
#include <vector>
@@ -188,8 +182,6 @@ private:
};//end namespace ASTAR
#endif// USE_ASTAR_PATHS
BOOLEAN InitPathAI( void );
void ShutDownPathAI( void );
+28 -96
View File
@@ -49,12 +49,12 @@
class OBJECTTYPE;
class SOLDIERTYPE;
#ifdef USE_ASTAR_PATHS
#include "BinaryHeap.hpp"
#include "AIInternals.h"
#include "opplist.h"
#include "weapons.h"
#endif
extern BOOLEAN gubWorldTileInLight[MAX_ALLOWED_WORLD_MAX];
extern BOOLEAN gubIsCorpseThere[MAX_ALLOWED_WORLD_MAX];
extern INT32 gubMerkCanSeeThisTile[MAX_ALLOWED_WORLD_MAX];
//#include "dnlprocesstalk.h"//dnl???
extern UINT16 gubAnimSurfaceIndex[ TOTALBODYTYPES ][ NUMANIMATIONSTATES ];
@@ -454,9 +454,6 @@ UINT32 guiFailedPathChecks = 0;
UINT32 guiUnsuccessfulPathChecks = 0;
#endif
#ifdef USE_ASTAR_PATHS
//ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off,
//but a safer path, usually farther away from an enemy or following behind some cover.
//however it has not been tested and it may need some work, I haven't touched it in a while
@@ -647,7 +644,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
fCloseGoodEnough = ( (fFlags & PATH_CLOSE_GOOD_ENOUGH) != 0);
fConsiderPersonAtDestAsObstacle = (BOOLEAN)( fPathingForPlayer && fPathAroundPeople && !(fFlags & PATH_IGNORE_PERSON_AT_DEST) );
if ( fNonSwimmer && Water( dest ) )
if ( fNonSwimmer && Water( dest, 0 ) )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "ASTAR: path failed, water" ) );
return( 0 );
@@ -708,7 +705,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
guiTotalPathChecks++;
#endif
#ifdef VEHICLE
fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0);
if ( fMultiTile == false)
@@ -758,7 +754,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
fContinuousTurnNeeded = FALSE;
}
}
#endif
if (fContinuousTurnNeeded == false)
{
@@ -802,17 +797,6 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
if (gfDisplayCoverValues && gfDrawPathPoints)
{
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 +885,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 +1065,6 @@ void AStarPathfinder::ExecuteAStarLogic()
continue;
}
#ifdef VEHICLE
//has side effects, including setting loop counters
int retVal = VehicleObstacleCheck();
if (retVal == 1)
@@ -1099,7 +1075,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 );
@@ -1412,7 +1387,7 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction)
}
// Flugente: dragging someone
if ( pSoldier->IsDraggingSomeone( ) )
if ( pSoldier->IsDragging( false ) )
{
movementAPCost *= gItemSettings.fDragAPCostModifier;
}
@@ -1769,7 +1744,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 +1752,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 +2061,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 +2207,6 @@ int AStarPathfinder::VehicleObstacleCheck()
}
return 0;
}
#endif
bool AStarPathfinder::WantToTraverse()
{
@@ -2411,7 +2354,6 @@ bool AStarPathfinder::IsSomeoneInTheWay()
return false;
}
#endif//end ifdef USE_ASTAR_PATHS
INT8 RandomSkipListLevel( void )
{
@@ -2484,27 +2426,29 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT32 sDestination, INT8 bLevel, INT16 usMov
{
s->sPlotSrcGrid = s->sGridNo;
#ifdef USE_ASTAR_PATHS
//ddd
CHAR8 errorBuf[511]; UINT32 b,e;
b=GetJA2Clock();//return s->sGridNo+6;
int retVal = ASTAR::AStarPathfinder::GetInstance().GetPath(s, sDestination, bLevel, usMovementMode, bCopy, fFlags);
e=GetJA2Clock();sprintf(errorBuf, "timefind bestpath= %d",e-b );LiveMessage(errorBuf);
if (retVal || TileIsOutOfBounds(sDestination)) {
return retVal;
}
else {
DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "ASTAR path failed!" ) );
}
// if (TileIsOutOfBounds(sDestination))
if (gGameSettings.fOptions[TOPTION_ALT_PATHFINDING])
{
return 0;
CHAR8 errorBuf[511]; UINT32 b,e;
b=GetJA2Clock();//return s->sGridNo+6;
int retVal = ASTAR::AStarPathfinder::GetInstance().GetPath(s, sDestination, bLevel, usMovementMode, bCopy, fFlags);
e=GetJA2Clock();sprintf(errorBuf, "timefind bestpath= %d",e-b );LiveMessage(errorBuf);
if (retVal || TileIsOutOfBounds(sDestination)) {
return retVal;
}
else {
DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "ASTAR path failed!" ) );
}
// if (TileIsOutOfBounds(sDestination))
{
return 0;
}
}
#else
else
{
//__try
//{
INT32 iDestination = sDestination, iOrigination;
@@ -2523,7 +2467,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 +2477,6 @@ b=GetJA2Clock();//return s->sGridNo+6;
UINT16 usAnimSurface;
//INT32 iCnt2, iCnt3;
BOOLEAN fVehicleIgnoreObstacles = FALSE;
#endif
INT32 iLastDir = 0;
@@ -2636,9 +2578,7 @@ if(!GridNoOnVisibleWorldTile(iDestination))
fTurnBased = ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) );
fPathingForPlayer = ( (s->bTeam == gbPlayerNum) && (!gTacticalStatus.fAutoBandageMode) && !(s->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) );
fNonFenceJumper = !( IS_MERC_BODY_TYPE( s ) ) || (UsingNewInventorySystem() == true && s->inv[BPACKPOCKPOS].exists() == true
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)s->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[s->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[s->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)));//Moa: added backpack check
fNonFenceJumper = !( IS_MERC_BODY_TYPE( s ) ) || (!s->CanClimbWithCurrentBackpack());//Moa: added backpack check
// Flugente: nonswimmers are those who are not mercs and not boats
fNonSwimmer = !(IS_MERC_BODY_TYPE( s ) );
@@ -2759,7 +2699,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
guiTotalPathChecks++;
#endif
#ifdef VEHICLE
fMultiTile = ((s->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0);
if (fMultiTile)
@@ -2819,7 +2758,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
fContinuousTurnNeeded = FALSE;
}
#endif
if (!fContinuousTurnNeeded)
{
@@ -2962,7 +2900,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
#endif
#ifdef VEHICLE
/*
if (fTurnSlow)
{
@@ -2987,7 +2924,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
*/
#endif
if (gubNPCAPBudget)
{
@@ -3048,7 +2984,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
//for ( iCnt = iLoopStart; iCnt != iLoopEnd; iCnt = (iCnt + iLoopIncrement) % MAXDIR )
for ( iCnt = iLoopStart; ; )
{
#ifdef VEHICLE
/*
if (fTurnSlow)
{
@@ -3130,7 +3065,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
}
#endif
newLoc = curLoc + dirDelta[iCnt];
@@ -3479,7 +3413,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
}
#ifdef VEHICLE
if (fMultiTile)
{
// vehicle test for obstacles: prevent movement to next tile if
@@ -3518,7 +3451,6 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
*/
}
#endif
// NEW Apr 21 by Ian: abort if cost exceeds budget
if (gubNPCAPBudget)
@@ -4276,7 +4208,7 @@ ENDOFLOOP:
//{
// return (0);
//}
#endif
}
}
void GlobalReachableTest( INT32 sStartGridNo )
+1 -277
View File
@@ -118,9 +118,7 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, INT8
//CHRISL: We can't jump a fence while wearing a backpack, to consider fences as impassible
// SANDRO - Headrocks change to backpack check implemented
if(sSwitchValue == TRAVELCOST_FENCE && UsingNewInventorySystem() == true && pSoldier->inv[BPACKPOCKPOS].exists() == true
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if(sSwitchValue == TRAVELCOST_FENCE && !pSoldier->CanClimbWithCurrentBackpack())
{
return(-1);
}
@@ -679,7 +677,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 +734,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 +2375,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 +2392,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 +2446,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 +3601,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)
+4 -62
View File
@@ -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;
@@ -2162,12 +2110,9 @@ void HandleMouseRTX1Button( UINT32 *puiNewEvent )
BOOLEAN fNearHeigherLevel;
BOOLEAN fNearLowerLevel;
INT8 bDirection;
// CHRISL: Turn off manual jumping while wearing a backpack
if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
// CHRISL: Turn off manual jumping while wearing a backpack
if (!pjSoldier->CanClimbWithCurrentBackpack())
return;
// Make sure the merc is not collapsed!
@@ -2259,12 +2204,9 @@ void HandleRTJump( void )
BOOLEAN fNearHeigherLevel;
BOOLEAN fNearLowerLevel;
INT8 bDirection;
// CHRISL: Turn off manual jumping while wearing a backpack
if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
// CHRISL: Turn off manual jumping while wearing a backpack
if (!pjSoldier->CanClimbWithCurrentBackpack())
return;
// Make sure the merc is not collapsed!
-50
View File
@@ -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 )
+5 -47
View File
@@ -3206,14 +3206,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
case 762:
{
// CODE: Set off Trigger
INT8 bPanicTrigger;
bPanicTrigger = ClosestPanicTrigger( pSoldier );
SetOffPanicBombs( pSoldier->ubID, bPanicTrigger );
INT8 bPanicTrigger = ClosestPanicTrigger( pSoldier );
if (bPanicTrigger != -1)
{
SetOffPanicBombs( pSoldier->ubID, bPanicTrigger );
}
// any AI guy has been specially given keys for this, now take them
// away
pSoldier->flags.bHasKeys = pSoldier->flags.bHasKeys >> 1;
}
break;
@@ -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 )
{
+197 -475
View File
@@ -13,6 +13,7 @@
#include "Animation Data.h"
#include "Animation Control.h"
#include "container.h"
#define _USE_MATH_DEFINES // for C
#include <math.h>
#include "pathai.h"
#include "Random.h"
@@ -3632,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...
@@ -3794,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) )
@@ -3953,33 +3919,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
if ( !this->flags.fDontChargeAPsForStanceChange )
{
// 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 )
@@ -3998,7 +3937,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;
@@ -4010,53 +3948,25 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// ATE: If we are NOT waiting for prone down...
if ( this->flags.bTurningFromPronePosition < TURNING_FROM_PRONE_START_UP_FROM_MOVE && !this->flags.fDontChargeAPsForStanceChange )
{
// silversurfer: of course we deduct points for stance changes!
// ATE: Don't do this if we are still 'moving'....
// SANDRO - APBPConstants[AP_PRONE] changed to GetAPsProne()
//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 ( UsingNewInventorySystem( ) )
{
if ( usNewState == PRONE_UP )
{
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;
}
sAPCost = GetAPsProne( this, TRUE * 2 );
sBPCost = APBPConstants[BP_PRONE] + 2;
}
else
{
sAPCost = GetAPsProne( this, FALSE );
sBPCost = APBPConstants[BP_PRONE];
sAPCost = GetAPsProne( this, TRUE );
sBPCost = APBPConstants[BP_PRONE] + 1;
}
#else
if ( UsingNewInventorySystem( ) )
{
if ( usNewState == PRONE_UP )
{
sAPCost = GetAPsProne( this, TRUE * 2 );
sBPCost = APBPConstants[BP_PRONE] + 2;
}
else
{
sAPCost = GetAPsProne( this, TRUE );
sBPCost = APBPConstants[BP_PRONE] + 1;
}
}
else
{
sAPCost = GetAPsProne( this, FALSE );
sBPCost = APBPConstants[BP_PRONE];
}
#endif
DeductPoints( this, sAPCost, sBPCost );
//}
}
else
{
sAPCost = GetAPsProne( this, FALSE );
sBPCost = APBPConstants[BP_PRONE];
}
DeductPoints( this, sAPCost, sBPCost );
}
this->flags.fDontChargeAPsForStanceChange = FALSE;
break;
@@ -4392,18 +4302,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// Reset some animation values
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 )
{
@@ -4578,10 +4476,7 @@ void SOLDIERTYPE::EVENT_InternalSetSoldierPosition( FLOAT dNewXPos, FLOAT dNewYP
if ( !(this->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER)) )
{
if ( gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] )
{
this->SetCheckSoldierLightFlag( );
}
this->SetCheckSoldierLightFlag( );
}
// ATE: Mirror calls if we are a vehicle ( for all our passengers )
@@ -5032,18 +4927,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 ) );
@@ -5063,42 +4946,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
@@ -5168,26 +5015,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..
@@ -5883,24 +5710,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:
// <SB> crouch throwing
case THROW_ITEM_CROUCHED:
// <SB> 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 )
@@ -5911,22 +5720,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;
@@ -6250,34 +6043,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) );
@@ -7338,15 +7103,6 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT32 sDestGridNo, UINT16
return(FALSE);
}
// 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);
@@ -8790,32 +8546,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[] =
{
@@ -8844,32 +8574,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[] =
{
@@ -9726,10 +9430,7 @@ void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMo
void SOLDIERTYPE::BeginSoldierClimbUpRoof(void)
{
//CHRISL: Disable climbing up to a roof while wearing a backpack
if ((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!this->CanClimbWithCurrentBackpack())
{
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB]);
return;
@@ -10023,6 +9724,17 @@ UINT32 SleepDartSuccumbChance( SOLDIERTYPE * pSoldier )
return(uiChance);
}
BOOLEAN SOLDIERTYPE::CanClimbWithCurrentBackpack()
{
// only apply backpack climbing limitations to player mercs
if (UsingNewInventorySystem() == true && this->inv[BPACKPOCKPOS].exists() == true && this->bTeam == OUR_TEAM
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
return FALSE;
return TRUE;
}
void SOLDIERTYPE::BeginSoldierGetup( void )
{
// RETURN IF WE ARE BEING SERVICED
@@ -12038,28 +11750,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 )
@@ -12422,22 +12112,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;
@@ -12460,51 +12134,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 )
{
@@ -17688,78 +17317,13 @@ void SOLDIERTYPE::HandleFlashLights( )
fLightChanged = TRUE;
}
// not possible to get this bonus on a roof, due to our lighting system
if ( !this->pathing.bLevel )
{
UINT8 flashlightrange = this->GetBestEquippedFlashLightRange( );
if ( AddBestFlashLight() )
{
// take note: we own a light source
this->usSoldierFlagMask |= SOLDIER_LIGHT_OWNER;
// if no flashlight is found, this will be 0
if ( flashlightrange )
{
// the range at which we create additional light sources to the side
UINT8 firstexpand = 8;
UINT8 secondexpand = 12;
// depending on our direction, alter range
if ( this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST )
{
flashlightrange = sqrt( (FLOAT)flashlightrange*(FLOAT)flashlightrange / 2.0f );
firstexpand = sqrt( (FLOAT)firstexpand*(FLOAT)firstexpand / 2.0f );
secondexpand = sqrt( (FLOAT)secondexpand*(FLOAT)secondexpand / 2.0f );
}
// we determine the height of the next tile in our direction. Because of the way structures are handled, we sometimes have to take the very tile we're occupying right now
INT32 nextGridNoinSight = this->sGridNo;
for ( UINT8 i = 0; i < flashlightrange; ++i )
{
nextGridNoinSight = NewGridNo( nextGridNoinSight, DirectionInc( this->ubDirection ) );
if ( SoldierToVirtualSoldierLineOfSightTest( this, nextGridNoinSight, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, FALSE ) )
CreatePersonalLight( nextGridNoinSight, this->ubID );
// after a certain range, add new lights to the side to simulate a light cone
if ( i > firstexpand )
{
INT8 sidedir1 = (this->ubDirection + 2) % NUM_WORLD_DIRECTIONS;
INT8 sidedir2 = (this->ubDirection - 2) % NUM_WORLD_DIRECTIONS;
INT32 sideGridNo1 = NewGridNo( nextGridNoinSight, DirectionInc( sidedir1 ) );
sideGridNo1 = NewGridNo( sideGridNo1, DirectionInc( sidedir1 ) );
if ( SoldierToVirtualSoldierLineOfSightTest( this, sideGridNo1, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, FALSE, NO_DISTANCE_LIMIT ) )
CreatePersonalLight( sideGridNo1, this->ubID );
if ( i > secondexpand )
{
sideGridNo1 = NewGridNo( sideGridNo1, DirectionInc( sidedir1 ) );
if ( SoldierToVirtualSoldierLineOfSightTest( this, sideGridNo1, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, FALSE, NO_DISTANCE_LIMIT ) )
CreatePersonalLight( sideGridNo1, this->ubID );
}
INT32 sideGridNo2 = NewGridNo( nextGridNoinSight, DirectionInc( sidedir2 ) );
sideGridNo2 = NewGridNo( sideGridNo2, DirectionInc( sidedir2 ) );
if ( SoldierToVirtualSoldierLineOfSightTest( this, sideGridNo2, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, FALSE, NO_DISTANCE_LIMIT ) )
CreatePersonalLight( sideGridNo2, this->ubID );
if ( i > secondexpand )
{
sideGridNo2 = NewGridNo( sideGridNo2, DirectionInc( sidedir2 ) );
if ( SoldierToVirtualSoldierLineOfSightTest( this, sideGridNo2, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, FALSE, NO_DISTANCE_LIMIT ) )
CreatePersonalLight( sideGridNo2, this->ubID );
}
}
}
// take note: we own a light source
this->usSoldierFlagMask |= SOLDIER_LIGHT_OWNER;
fLightChanged = TRUE;
}
}
fLightChanged = TRUE;
}
if ( fLightChanged )
{
@@ -17805,6 +17369,162 @@ UINT8 SOLDIERTYPE::GetBestEquippedFlashLightRange( )
return(bestrange);
}
bool SOLDIERTYPE::AddBestFlashLight()
{
// not possible to get this bonus on a roof, due to our lighting system
if ( this->pathing.bLevel != 0 )
{
return false;
}
UINT8 maxRange = this->GetBestEquippedFlashLightRange();
if ( maxRange < 1 )
{
return false;
}
// we don't use the flashlight to run better at night (light up our shoes), we use it to find enemies!
UINT8 minRange = 4;
if ( minRange > maxRange )
{
minRange = maxRange;
}
float maxAngle = 45;
maxAngle *= PI / 180 / 2; // convert to rad and halven
auto forward = DirectionInc(this->ubDirection);
auto left = DirectionInc(DirectionIfTurnedClockwise(this->ubDirection, 6));
auto leftLeft = DirectionInc(DirectionIfTurnedClockwise(this->ubDirection, 5));
auto right = DirectionInc(DirectionIfTurnedClockwise(this->ubDirection, 2));
auto rightRight = DirectionInc(DirectionIfTurnedClockwise(this->ubDirection, 3));
bool isDiagonal = this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST;
struct position_2d
{
INT16 x, y;
position_2d(INT32 gridNo)
{
ConvertGridNoToXY(gridNo, &x, &y);
}
position_2d(INT16 _x, INT16 _y) : x{_x}, y{_y}
{
}
};
struct vector_2d
{
INT16 dx, dy;
float length;
vector_2d(INT8 direction)
{
ConvertDirectionToVectorInXY(direction, &dx, &dy);
length = CalcLength(dx, dy);
}
vector_2d(position_2d from, position_2d to)
{
dx = to.x - from.x;
dy = to.y - from.y;
length = CalcLength(dx, dy);
}
vector_2d(INT16 _dx, INT16 _dy) : dx{_dx}, dy{_dy}
{
length = CalcLength(dx, dy);
}
float GetAngle( vector_2d other )
{
auto dot = dx * other.dx + dy * other.dy;
return acos(dot / (length * other.length));
}
static float CalcLength(float dx, float dy)
{
return sqrt(powf(dx, 2) + powf(dy, 2));
}
};
position_2d soldierPos(this->sGridNo);
vector_2d soldierDir(this->ubDirection);
auto is_in_area = [&](INT32 sGridNoToTest) -> bool
{
vector_2d v(soldierPos, position_2d(sGridNoToTest));
if (v.length > maxRange)
{
return false;
}
if (v.length < minRange)
{
return false;
}
auto coneAngle = soldierDir.GetAngle( v );
if (coneAngle > maxAngle)
{
return false;
}
return true;
};
auto add_light_if_in_line_of_sight = [&, this]( INT32 sGridNoToTest, bool allowSkip ) -> void
{
if (allowSkip) // improve performance by skipping 3/4 of the lights
{
INT16 sXPos, sYPos;
ConvertGridNoToXY( sGridNoToTest, &sXPos, &sYPos );
if (!(sXPos % 2 == 0 && sYPos % 2 == 0))
{
return;
}
}
if ( SoldierToVirtualSoldierLineOfSightTest( this, sGridNoToTest, this->pathing.bLevel, gAnimControl[this->usAnimState].ubEndHeight, false, NO_DISTANCE_LIMIT ) )
{
CreatePersonalLight( sGridNoToTest, this->ubID );
}
};
auto travel_direction_to_add_light = [&]( INT32 startingGridNo, INT16 directionIncrementer )
{
for ( auto currentGridNo = startingGridNo; !OutOfBounds( currentGridNo, -1 ) && is_in_area( currentGridNo ); currentGridNo += directionIncrementer )
{
add_light_if_in_line_of_sight( currentGridNo, true);
}
};
for ( auto currentGridNo = this->sGridNo; !OutOfBounds( currentGridNo, -1 ); currentGridNo += forward )
{
vector_2d v(soldierPos, position_2d(currentGridNo));
if ( v.length < minRange )
{
continue;
}
else if (v.length > maxRange)
{
break;
}
add_light_if_in_line_of_sight( currentGridNo, false );
travel_direction_to_add_light( currentGridNo, left );
travel_direction_to_add_light( currentGridNo, right );
if ( isDiagonal )
{
travel_direction_to_add_light( NewGridNo( currentGridNo, leftLeft ), left );
travel_direction_to_add_light( NewGridNo( currentGridNo, rightRight ), right );
}
}
return true;
}
// Flugente: soldier profiles
// retrieves the correct sub-array
INT8 SOLDIERTYPE::GetSoldierProfileType( UINT8 usTeam )
@@ -22196,13 +21916,15 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier )
if ( pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY )
{
// sevenfm: bPanicTriggerIsAlarm is always not NULL pointer
//if ( !(gTacticalStatus.bPanicTriggerIsAlarm) && (gTacticalStatus.ubTheChosenOne == pSoldier->ubID) )
if ( gTacticalStatus.ubTheChosenOne == pSoldier->ubID )
{
// replace this guy as the chosen one!
gTacticalStatus.ubTheChosenOne = NOBODY;
MakeClosestEnemyChosenOne( );
auto bPanicTrigger = ClosestPanicTrigger(pSoldier);
if (bPanicTrigger != -1 && !(gTacticalStatus.bPanicTriggerIsAlarm[bPanicTrigger]))
{
// replace this guy as the chosen one!
gTacticalStatus.ubTheChosenOne = NOBODY;
MakeClosestEnemyChosenOne( );
}
}
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) )
+3 -1
View File
@@ -1772,6 +1772,7 @@ public:
void DoNinjaAttack( void );
void PickDropItemAnimation( void );
BOOLEAN CanClimbWithCurrentBackpack();
void BeginSoldierGetup( void );
void BeginSoldierClimbUpRoof( void );
@@ -1935,7 +1936,8 @@ public:
//void AddDrugValues(UINT8 uDrugType, UINT8 usEffect, UINT8 usTravelRate, UINT8 usSideEffect );
void HandleFlashLights();
UINT8 GetBestEquippedFlashLightRange();
bool AddBestFlashLight();
UINT8 GetBestEquippedFlashLightRange();
// Flugente: soldier profiles
INT8 GetSoldierProfileType(UINT8 usTeam); // retrieves the correct sub-array
-15
View File
@@ -355,21 +355,6 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b
pSoldier->flags.fBlockedByAnotherMerc = FALSE;
return( MOVE_TILE_STATIONARY_BLOCKED );
}
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
}
}
// Unset flag for blocked by soldier...
+12 -108
View File
@@ -255,7 +255,6 @@ void CreatePlayerControlledMonster();
void ChangeCurrentSquad( INT32 iSquad );
void HandleSelectMercSlot( UINT8 ubPanelSlot, INT8 bCode );
void EscapeUILock( );
void TestCapture( );
#ifdef JA2BETAVERSION
void ToggleMapEdgepoints();
@@ -2975,14 +2974,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
break;
#if 0//dnl ch75 021113
case '\"':
Testing(1);
break;
case '\'':
Testing(2);
break;
#endif
case '`':
@@ -3872,10 +3863,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( fNearLowerLevel )
{
// No climbing when wearing a backpack!
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB] );
return;
@@ -3891,10 +3879,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( fNearHeigherLevel )
{
// No climbing when wearing a backpack!
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB] );
return;
@@ -3910,10 +3895,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
// Jump over fence
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
//Moa: no jumping whith backpack
//sAPCost = GetAPsToJumpFence( pjSoldier, TRUE );
@@ -3938,10 +3920,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if (gGameExternalOptions.fCanClimbOnWalls == TRUE)
{
// No climbing when wearing a backpack!
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB] );
return;
@@ -3977,10 +3956,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( FindWindowJumpDirection( lSoldier, lSoldier->sGridNo, lSoldier->ubDirection, &bDirection ) )
{
if ((UsingNewInventorySystem() == true) && lSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)lSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[lSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[lSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!lSoldier->CanClimbWithCurrentBackpack())
{
//Moa: no jumping with backpack
//sAPCost = GetAPsToJumpThroughWindows( lSoldier, TRUE );
@@ -4232,21 +4208,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
{
@@ -4499,9 +4460,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
TestCapture( );
//EnterCombatMode( gbPlayerNum );
// Test Capturing Mercs as POW
AttemptToCapturePlayerSoldiers();
}
}
else if ( fCtrl && fShift )
@@ -6559,42 +6519,6 @@ void HandleStealthChangeFromUIKeys( )
}
}
void TestCapture( )
{
INT32 cnt;
SOLDIERTYPE *pSoldier;
UINT32 uiNumChosen = 0;
//StartQuest( QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY );
//EndQuest( QUEST_HELD_IN_ALMA, gWorldSectorX, gWorldSectorY );
BeginCaptureSquence( );
gStrategicStatus.uiFlags &= (~STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE );
// loop through soldiers and pick 3 lucky ones....
for ( cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID, pSoldier=MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++ )
{
if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector )
{
if ( uiNumChosen < 3 )
{
EnemyCapturesPlayerSoldier( pSoldier );
// Remove them from tectical....
pSoldier->RemoveSoldierFromGridNo( );
uiNumChosen++;
}
}
}
EndCaptureSequence( );
}
void PopupAssignmentMenuInTactical( SOLDIERTYPE *pSoldier )
{
// do something
@@ -7667,11 +7591,7 @@ void HandleTBJump( void )
if ( fNearLowerLevel )
{
// CHRISL: Turn off manual jumping while wearing a backpack
if (UsingNewInventorySystem() == true && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, TRUE ), GetBPsToClimbRoof( pjSoldier, TRUE ), FALSE ) )
@@ -7683,11 +7603,7 @@ void HandleTBJump( void )
if ( fNearHeigherLevel )
{
// No climbing when wearing a backpack!
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
return;
if ( EnoughPoints( pjSoldier, GetAPsToClimbRoof( pjSoldier, FALSE ), GetBPsToClimbRoof( pjSoldier, FALSE ), FALSE ) )
@@ -7699,11 +7615,7 @@ void HandleTBJump( void )
// Jump over fence
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
sAPCost = GetAPsToJumpFence( pjSoldier, TRUE );
sBPCost = GetBPsToJumpFence( pjSoldier, TRUE );
@@ -7726,11 +7638,7 @@ void HandleTBJump( void )
if ( FindWallJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
// No climbing when wearing a backpack!
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
return;
if ( EnoughPoints( pjSoldier, GetAPsToJumpWall( pjSoldier, FALSE ), GetBPsToJumpWall( pjSoldier, FALSE ), FALSE ) )
@@ -7754,11 +7662,7 @@ void HandleTBJumpThroughWindow( void ){
{
if ( FindWindowJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
{
if ((UsingNewInventorySystem() == true) && pjSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pjSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pjSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pjSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pjSoldier->CanClimbWithCurrentBackpack())
{
sAPCost = GetAPsToJumpThroughWindows( pjSoldier, TRUE );
sBPCost = GetBPsToJumpThroughWindows( pjSoldier, TRUE );
+32 -7
View File
@@ -136,13 +136,13 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs
// FUNCTIONS FOR CURSOR DETERMINATION!
UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated )
{
SOLDIERTYPE *pSoldier;
UINT32 uiCursorFlags;
BOOLEAN fShowAPs = FALSE;
BOOLEAN fRecalc = FALSE;
SOLDIERTYPE *pSoldier;
UINT32 uiCursorFlags;
BOOLEAN fShowAPs = FALSE;
BOOLEAN fRecalc = FALSE;
INT32 sTargetGridNo = usMapPos;
UINT8 ubCursorID=0;
UINT8 ubItemCursor;
UINT8 ubCursorID=0;
UINT8 ubItemCursor = 0;
pSoldier = MercPtrs[ ubSoldierID ];
@@ -350,6 +350,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA
UINT16 usCursor=0;
BOOLEAN fMaxPointLimitHit = FALSE;
UINT16 usInHand;
extern UINT32 guiNewUICursor;
UINT16 reverse = 0;
@@ -457,6 +458,30 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) );
}
const bool isCursorOnTarget = (
guiNewUICursor == ACTION_SHOOT_UICURSOR || guiNewUICursor == ACTION_TARGETBURST_UICURSOR ||
guiNewUICursor == ACTION_FLASH_SHOOT_UICURSOR || guiNewUICursor == ACTION_FLASH_BURST_UICURSOR ||
guiNewUICursor == ACTION_NOCHANCE_SHOOT_UICURSOR || guiNewUICursor == ACTION_NOCHANCE_BURST_UICURSOR
);
// Start at maximum aiming levels if the option is toggled
if (gGameSettings.fOptions[TOPTION_ALT_START_AIM] && isCursorOnTarget)
{
pSoldier->aiData.bShownAimTime = maxAimLevels;
sAPCosts = CalcTotalAPsToAttack(pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
// Determine if we can afford!
while (!EnoughPoints(pSoldier, sAPCosts, 0, FALSE))
{
pSoldier->aiData.bShownAimTime -= 1;
if (pSoldier->aiData.bShownAimTime < 0)
{
pSoldier->aiData.bShownAimTime = REFINE_AIM_1;
break;
}
sAPCosts = CalcTotalAPsToAttack(pSoldier, usMapPos, TRUE, pSoldier->aiData.bShownAimTime);
}
gsCurrentActionPoints = sAPCosts;
}
// If we don't have any points and we are at the first refine, do nothing but warn!
if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) && (pSoldier->aiData.bShownAimTime == 0))
{
@@ -4004,4 +4029,4 @@ UINT8 DefaultAutofireBulletsByGunClass( SOLDIERTYPE* pSoldier )
}
return ubBullets;
}
}
-14
View File
@@ -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);
-13
View File
@@ -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 );
-10
View File
@@ -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)
{
-9
View File
@@ -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;
}
-13
View File
@@ -1383,19 +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.
sDistVisible = sDistVisible + 5;
}
-19
View File
@@ -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
+1 -4
View File
@@ -784,10 +784,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier, INT8 bAction)
break;
case AI_ACTION_JUMP_WINDOW:
if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true
//JMich.BackpackClimb
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)pSoldier->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[pSoldier->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb )
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[pSoldier->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE)))
if (!pSoldier->CanClimbWithCurrentBackpack())
bMinPointsNeeded = GetAPsToJumpThroughWindows( pSoldier, TRUE );
else
bMinPointsNeeded = GetAPsToJumpFence( pSoldier, FALSE );
+17
View File
@@ -0,0 +1,17 @@
set(TacticalAISrc
"${CMAKE_CURRENT_SOURCE_DIR}/AIList.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AIMain.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/AIUtils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Attacks.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/CreatureDecideAction.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/DecideAction.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FindLocations.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Knowledge.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Medical.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Movement.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/NPC.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PanicButtons.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QuestDebug.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Realtime.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ZombieDecideAction.cpp"
PARENT_SCOPE)
+7 -14
View File
@@ -4974,7 +4974,7 @@ INT16 ubMinAPCost;
bPanicTrigger = ClosestPanicTrigger( pSoldier );
// if it's an alarm trigger and team is alerted, ignore it
if ( !(gTacticalStatus.bPanicTriggerIsAlarm[ bPanicTrigger ] && gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) && PythSpacesAway( pSoldier->sGridNo, gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] ) < 10)
if ( bPanicTrigger != -1 && !(gTacticalStatus.bPanicTriggerIsAlarm[ bPanicTrigger ] && gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) && PythSpacesAway( pSoldier->sGridNo, gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] ) < 10)
{
PossiblyMakeThisEnemyChosenOne( pSoldier );
}
@@ -5161,19 +5161,14 @@ INT16 ubMinAPCost;
}
// offer surrender?
#ifdef JA2UB
#else
#ifndef JA2UB
if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) )
{
if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && gTacticalStatus.Team[ CREATURE_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 )
{
//if( GetWorldDay() > STARTDAY_ALLOW_PLAYER_CAPTURE_FOR_RESCUE && !( gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE ) )
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
{
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] != QUESTINPROGRESS && gubQuest[QUEST_HELD_IN_TIXA] != QUESTINPROGRESS && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED))
{
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
return( AI_ACTION_OFFER_SURRENDER );
}
return( AI_ACTION_OFFER_SURRENDER );
}
}
}
@@ -9586,15 +9581,13 @@ INT8 ArmedVehicleDecideActionBlack( SOLDIERTYPE *pSoldier )
}
// offer surrender?
#ifdef JA2UB
#else
#ifndef JA2UB
if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) )
{
if ( gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0 && gTacticalStatus.Team[CREATURE_TEAM].bMenInSector == 0 && NumPCsInSector( ) < 4 && gTacticalStatus.Team[ENEMY_TEAM].bMenInSector >= NumPCsInSector( ) * 3 )
{
if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || (gubQuest[QUEST_HELD_IN_ALMA] == QUESTDONE && gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) )
if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED)
{
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
return(AI_ACTION_OFFER_SURRENDER);
}
}
@@ -10413,4 +10406,4 @@ void LogKnowledgeInfo(SOLDIERTYPE *pSoldier)
//swprintf( pStrInfo, L"%s[%d] %s %s\n", pStrInfo, oppID, MercPtrs[oppID]->GetName(), SeenStr(pSoldier->aiData.bOppList[oppID]) );
}
}
}
}
-78
View File
@@ -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);

Some files were not shown because too many files have changed in this diff Show More