Author SHA1 Message Date
Asdow ba270534c6 Revert "Add if conditional for !(uiFlags & TILES_DIRTY)"
This reverts commit b49c37e0a9.
2023-09-27 23:40:46 +03:00
Asdow 0cf0e054ab Remove useless code
Mouse XY position is fetched, but never used
2023-09-27 23:24:20 +03:00
Asdow fc6bdad94b add static keyword 2023-09-27 23:23:37 +03:00
Asdow b49c37e0a9 Add if conditional for !(uiFlags & TILES_DIRTY)
One extra level of nesting, but clears up the scoping for which situations are done if TILES_DIRTY flag is not set
2023-09-27 23:07:55 +03:00
Asdow bbbfdb8bd5 Simplify item blitting
fZBlit was always set to true
bItemOutline was either always true or false depending on the branch
2023-09-27 22:48:40 +03:00
Asdow 195dc57e96 Remove commented out code 2023-09-27 22:46:08 +03:00
Asdow 52f46c60c7 Replace StructZLevel & SoldierZLevel defines with functions 2023-09-27 22:28:28 +03:00
Asdow c1f6000980 Rename original function 2023-09-27 22:27:14 +03:00
Asdow 05582b960d Check for nullptr 2023-09-27 22:26:46 +03:00
932 changed files with 159194 additions and 136330 deletions
+60 -23
View File
@@ -154,7 +154,7 @@ jobs:
cat dist/versions.env
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: versions.env
path: dist/
@@ -179,40 +179,77 @@ jobs:
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
path: dist
pattern: '*_release'
merge-multiple: true
path: artifacts
- name: Move release archives to dist/
shell: bash
run: |
set -eux
mkdir dist/
mv artifacts/*_release/* dist/
- name: Delete Latest Release and Tag
if: github.ref == 'refs/heads/master'
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
delete_release: true
tag_name: "latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repo
uses: actions/checkout@v4
if: github.ref == 'refs/heads/master'
uses: actions/checkout@v3
with:
path: source
fetch-depth: 1
sparse-checkout: 'README.md'
- name: Create latest pre-release
- name: Create Latest Tag
if: github.ref == 'refs/heads/master'
working-directory: source
run: |
gh release delete latest --cleanup-tag || true
git tag -d latest || true
git push --delete origin refs/tags/latest || true
git tag latest
git push --force origin refs/tags/latest
sleep 15 # make sure github can find the tag for gh release
gh release create latest ../dist/* \
--generate-notes \
--title "Latest (unstable)" \
--verify-tag \
--prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
git push origin latest
- id: release_latest
name: Release Latest
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
artifactErrorsFailBuild: true
artifacts: dist/*
generateReleaseNotes: true
makeLatest: true
name: "Latest (unstable)"
prerelease: true
tag: "latest"
- name: Upload to tagged release
- id: release_tag
name: Release Tag
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
working-directory: source
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: dist/*
draft: false
generateReleaseNotes: true
makeLatest: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
- name: Show release outputs
shell: bash
run: |
gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo 'id: '
echo -n '${{ steps.release_tag.outputs.id }}'
echo -n '${{ steps.release_latest.outputs.id }}'
echo ''
echo ''
echo 'url:'
echo -n '${{ steps.release_tag.outputs.html_url }}'
echo -n '${{ steps.release_latest.outputs.html_url }}'
echo ''
+16 -18
View File
@@ -30,10 +30,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Download versions.env
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: versions.env
path: artifacts
@@ -41,7 +41,6 @@ jobs:
shell: bash
run: cat artifacts/versions.env >> $GITHUB_ENV
# TODO: Move this into CMake, just taking the GitHub Actions parameters as -D variables
- name: Update GameVersion.cpp
shell: bash
run: |
@@ -50,16 +49,16 @@ jobs:
GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\')
GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION"
GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\')
sed -i "s|@Version@|${GAME_VERSION:0:15}|" Ja2/GameVersion.cpp
sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp
cat Ja2/GameVersion.cpp
sed -i "s|@Version@|${GAME_VERSION:0:15}|" GameVersion.cpp
sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp
cat GameVersion.cpp
- name: Prepare build properties
shell: bash
run: |
set -eux
touch CMakePresets.json
touch CMakeUserPresets.json
JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]')
JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]')
@@ -69,7 +68,7 @@ jobs:
JA2Application=$JA2Application
" >> $GITHUB_ENV
- uses: microsoft/setup-msbuild@v2
- uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x86
- uses: ilammy/msvc-dev-cmd@v1
@@ -87,7 +86,7 @@ jobs:
find build/
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.language }}_${{ matrix.application }}
path: build/*.exe
@@ -100,7 +99,7 @@ jobs:
steps:
- name: Download versions.env
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: versions.env
path: artifacts
@@ -109,7 +108,7 @@ jobs:
run: cat artifacts/versions.env >> $GITHUB_ENV
- name: Checkout gamedir
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
repository: ${{ env.GAMEDIR_REPOSITORY }}
ref: ${{ env.GAMEDIR_COMMIT_SHA }}
@@ -117,7 +116,7 @@ jobs:
- name: Checkout gamedir-languages
if: inputs.language != 'English'
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }}
ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }}
@@ -131,25 +130,25 @@ jobs:
cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/
- name: Download ja2
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{ inputs.language }}_ja2
path: artifacts/ja2
- name: Download ja2mapeditor
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{ inputs.language }}_ja2mapeditor
path: artifacts/ja2mapeditor
- name: Download ja2ub
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{ inputs.language }}_ja2ub
path: artifacts/ja2ub
- name: Download ja2ubmapeditor
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{ inputs.language }}_ja2ubmapeditor
path: artifacts/ja2ubmapeditor
@@ -199,8 +198,7 @@ jobs:
7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" .
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.language }}_release
path: dist/
compression-level: 0
+1 -1
View File
@@ -6,6 +6,6 @@
/.vs/
/build/
/out/
/CMakePresets.json
/CMakeSettings.json
/CMakeUserPresets.json
/lib/
+125 -110
View File
@@ -9,25 +9,10 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(LTO_OPTION "Enable link-time optimization if supported by compiler" OFF)
include(CheckIPOSupported)
check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX)
if(LinkTimeOptimization AND LTO_OPTION)
message(STATUS "Configuring WITH link-time optimization")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(STATUS "Configuring WITHOUT link-time optimization ${IpoError}")
endif()
option(ADDRESS_SANITIZER OFF)
if(ADDRESS_SANITIZER)
message(STATUS "AddressSanitizer ENABLED for non-Release builds")
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif()
if(MSVC)
add_compile_options("/wd4838")
message(STATUS "AddressSanitizer ENABLED for non-Release builds")
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif()
# whether we are using MSBuild as a generator
@@ -37,24 +22,8 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
# 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 _CRT_SECURE_NO_DEPRECATE)
include_directories(
"${CMAKE_SOURCE_DIR}/Ja2"
"${CMAKE_SOURCE_DIR}/ext/VFS/include"
"${CMAKE_SOURCE_DIR}/Utils"
"${CMAKE_SOURCE_DIR}/TileEngine"
"${CMAKE_SOURCE_DIR}/TacticalAI"
"${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include"
"${CMAKE_SOURCE_DIR}/Tactical"
"${CMAKE_SOURCE_DIR}/Strategic"
"${CMAKE_SOURCE_DIR}/sgp"
"${CMAKE_SOURCE_DIR}/Ja2/Res"
"${CMAKE_SOURCE_DIR}/lua"
"${CMAKE_SOURCE_DIR}/Laptop"
"${CMAKE_SOURCE_DIR}/Multiplayer"
"${CMAKE_SOURCE_DIR}/Editor"
"${CMAKE_SOURCE_DIR}/i18n/include"
)
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")
@@ -65,46 +34,95 @@ target_link_libraries(bfVFS PRIVATE 7z)
# ja2export utility
add_subdirectory("ext/export/src")
# static libraries whose translation units don't rely on Application preprocessor definitions.
add_subdirectory(lua)
add_subdirectory(Multiplayer)
add_subdirectory(wine)
# 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
"${CMAKE_SOURCE_DIR}/binkw32.lib"
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
"${CMAKE_SOURCE_DIR}/lua51.lib"
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
"Winmm.lib"
"ws2_32.lib"
bfVFS
Lua
Multiplayer
wine
"${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"
)
# static libraries whose translation units rely on Application preprocessor definitions.
set(Ja2_Libs
Editor
Ja2
Laptop
ModularizedTacticalAI
sgp
Strategic
Tactical
TacticalAI
TileEngine
Utils
)
foreach(lib IN LISTS Ja2_Libs)
add_subdirectory(${lib})
endforeach()
# language library relies on Application _and_ Language preprocessor definition. very bad.
add_subdirectory(i18n)
# simple function to validate Languages and Application choices
include(cmake/ValidateOptions.cmake)
@@ -118,50 +136,47 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica
# preprocessor definitions for Debug build, per the legacy MSBuild
set(debugFlags $<IF:$<CONFIG:Debug>,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>)
foreach(app IN LISTS ApplicationTargets)
set(isEditor $<STREQUAL:${app},JA2MAPEDITOR>)
set(isUb $<STREQUAL:${app},JA2UB>)
set(isUbEditor $<STREQUAL:${app},JA2UBMAPEDITOR>)
set(compilationFlags
$<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,>
$<IF:${isUb},JA2UB;JA2UBMAPS,>
$<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,>
)
# 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})
foreach(lib IN LISTS Ja2_Libs)
# library for an application, e.g. JA2UB_sgp
set(game_library ${app}_${lib})
add_library(${game_library})
target_sources(${game_library} PRIVATE ${${lib}Src})
target_compile_definitions(${game_library} PRIVATE ${compilationFlags} ${debugFlags})
endforeach()
# executable for an application/language combination, e.g. JA2_ENGLISH.exe
add_executable(${Executable} WIN32)
target_sources(${Executable} PRIVATE ${Ja2Src})
foreach(lang IN LISTS LangTargets)
# executable for an application/language combination, e.g. JA2_ENGLISH.exe
set(exe ${app}_${lang})
add_executable(${exe} WIN32
sgp/sgp.cpp
Ja2/Res/ja2.rc
)
target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${exe} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
target_compile_definitions(${exe} PRIVATE ${compilationFlags} ${debugFlags})
# Good libraries have already been built, can be simply linked here
target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${Executable} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
# language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n
set(language_library ${exe}_i18n)
add_library(${language_library})
target_sources(${language_library} PRIVATE ${i18nSrc})
target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags} ${lang})
target_link_libraries(${exe} PRIVATE ${language_library})
# 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>)
# go through all game libraries again and link them to the app/language executable
foreach(lib IN LISTS Ja2_Libs)
target_link_libraries(${exe} PRIVATE ${app}_${lib})
endforeach()
endforeach()
# static library for an app/lang combination, e.g. JA2_ENGLISH_SGP.lib
add_library(${VeryBadLib})
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
# for SGP only
target_link_libraries(${app}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
target_link_libraries(${app}_sgp PRIVATE libpng)
target_compile_definitions(${app}_sgp PRIVATE NO_ZLIB_COMPRESSION)
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()
+2 -1
View File
@@ -1,6 +1,7 @@
#ifndef _CHEATS__H_
#define _CHEATS__H_
#include "Language Defines.h"
extern UINT8 gubCheatLevel;
@@ -21,4 +22,4 @@ extern UINT8 gubCheatLevel;
#define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 )
#define ACTIVATE_CHEAT_LEVEL() ( gubCheatLevel = 6 )
#endif
#endif
+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)
+81
View File
@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
#ifndef _COMBSTROUT_H_
#define _COMBSTROUT_H_
/////////////////////////////////////////////////////////////////////////////
// CComBSTROut - a class that inherits from CComBSTR and adds Out() method
// that should be used instead of & operator for 'out'
// function parameters
class CComBSTROut : public CComBSTR
{
public:
CComBSTROut()
{
}
/*explicit*/ CComBSTROut(int nSize) : CComBSTR(nSize)
{
}
/*explicit*/ CComBSTROut(int nSize, LPCOLESTR sz) : CComBSTR(nSize, sz)
{
}
/*explicit*/ CComBSTROut(LPCOLESTR pSrc) : CComBSTR(pSrc)
{
}
/*explicit*/ CComBSTROut(const CComBSTROut& src) : CComBSTR(src)
{
}
/*explicit*/ CComBSTROut(REFGUID src) : CComBSTR(src)
{
}
#ifndef OLE2ANSI
CComBSTROut(LPCSTR pSrc) : CComBSTR(pSrc)
{
}
CComBSTROut(int nSize, LPCSTR sz) : CComBSTR(nSize, sz)
{
}
#endif
~CComBSTROut()
{
CComBSTR::~CComBSTR();
}
BSTR* Out()
{
Empty();
return &m_str;
}
};
/////////////////////////////////////////////////////////////////////////////
#endif // _COMBSTROUT_H_
+109
View File
@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
#ifndef _COMVARIANTOUT_H_
#define _COMVARIANTOUT_H_
/////////////////////////////////////////////////////////////////////////////
// CComVariantOut - a class that inherits from CComVariant and adds Out()
// method that should be used instead of & operator for
// 'out' function parameters
class CComVariantOut : public CComVariant
{
public:
CComVariantOut()
{
}
~CComVariantOut()
{
CComVariant::~CComVariant();
}
CComVariantOut(const VARIANT& varSrc) : CComVariant(varSrc)
{
}
CComVariantOut(const CComVariant& varSrc) : CComVariant(varSrc)
{
}
CComVariantOut(BSTR bstrSrc) : CComVariant(bstrSrc)
{
}
CComVariantOut(LPCOLESTR lpszSrc) : CComVariant(lpszSrc)
{
}
#ifndef OLE2ANSI
CComVariantOut(LPCSTR lpszSrc) : CComVariant(lpszSrc)
{
}
#endif
CComVariantOut(bool bSrc) : CComVariant(bSrc)
{
}
CComVariantOut(int nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(BYTE nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(short nSrc) : CComVariant(nSrc)
{
}
CComVariantOut(long nSrc, VARTYPE m_varSrc = VT_I4) : CComVariant(nSrc, m_varSrc)
{
}
CComVariantOut(float fltSrc) : CComVariant(fltSrc)
{
}
CComVariantOut(double dblSrc) : CComVariant(dblSrc)
{
}
CComVariantOut(CY cySrc) : CComVariant(cySrc)
{
}
CComVariantOut(IDispatch* pSrc) : CComVariant(pSrc)
{
}
CComVariantOut(IUnknown* pSrc) : CComVariant(pSrc)
{
}
public:
VARIANT* Out()
{
Clear();
return this;
}
};
/////////////////////////////////////////////////////////////////////////////
#endif // _COMVARIANTOUT_H_
+2876
View File
File diff suppressed because it is too large Load Diff
+746
View File
@@ -0,0 +1,746 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Console.h - console class declaration
#pragma once
#include <string>
#include <vector>
using namespace std;
//#include "include/FreeImagePlus.h"
typedef basic_string<TCHAR> tstring;
#define WM_INPUTREADY WM_USER + 1
// tray icon message
#define WM_TRAY_NOTIFY WM_USER + 0x123
#define TRAY_ICON_ID 1
// timer #defines
#define TIMER_REPAINT_CHANGE 42 // timer that is started after there
// were some changes in the console
#define TIMER_REPAINT_MASTER 43 // master timer (needed to repaint
// for some DOS programs, can be
// disabled for lower CPU usage)
#define TIMER_SHOW_HIDE_CONSOLE 100 // used to hide console window when
// starting shell process after a
// defined period of time (some
// shells, like 4NT need console
// window visible during startup for
// all init options to work properly
// transparency #defines
#define TRANSPARENCY_NONE 0
#define TRANSPARENCY_ALPHA 1
#define TRANSPARENCY_COLORKEY 2
#define TRANSPARENCY_FAKE 3
// cusror style #defines
#define CURSOR_STYLE_NONE 0
#define CURSOR_STYLE_XTERM 1
#define CURSOR_STYLE_BLOCK 2
#define CURSOR_STYLE_NBBLOCK 3
#define CURSOR_STYLE_PULSEBLOCK 4
#define CURSOR_STYLE_BAR 5
#define CURSOR_STYLE_CONSOLE 6
#define CURSOR_STYLE_NBHLINE 7
#define CURSOR_STYLE_HLINE 8
#define CURSOR_STYLE_VLINE 9
#define CURSOR_STYLE_RECT 10
#define CURSOR_STYLE_NBRECT 11
#define CURSOR_STYLE_PULSERECT 12
#define CURSOR_STYLE_FADEBLOCK 13
// docking #defines
#define DOCK_NONE 0
#define DOCK_TOP_LEFT 1
#define DOCK_TOP_RIGHT 2
#define DOCK_BOTTOM_RIGHT 3
#define DOCK_BOTTOM_LEFT 4
// Z-order #defines
#define Z_ORDER_REGULAR 0
#define Z_ORDER_ONTOP 1
#define Z_ORDER_ONBOTTOM 2
// window border defines
#define BORDER_NONE 0
#define BORDER_REGULAR 1
#define BORDER_THIN 2
// window background style
#define BACKGROUND_STYLE_RESIZE 0
#define BACKGROUND_STYLE_CENTER 1
#define BACKGROUND_STYLE_TILE 2
// taskbar button defines
#define TASKBAR_BUTTON_NORMAL 0
#define TASKBAR_BUTTON_HIDE 1
#define TASKBAR_BUTTON_TRAY 2
// new configuration auto-reload defines
#define RELOAD_NEW_CONFIG_PROMPT 0
#define RELOAD_NEW_CONFIG_YES 1
#define RELOAD_NEW_CONFIG_NO 2
#define TEXT_SELECTION_NONE 0
#define TEXT_SELECTION_SELECTING 1
#define TEXT_SELECTION_SELECTED 2
/////////////////////////////////////////////////////////////////////////////
// Console class
class Console {
public: // ctor/dtor
Console(LPCTSTR szConfigFile, LPCTSTR szShellCmdLine, LPCTSTR szConsoleTitle, LPCTSTR pszReloadNewConfig);
~Console();
public:
// creates and shows Console window
BOOL Create(HWND notify);
private:
////////////////////
// message handlers
////////////////////
////////////////////////////////
// windows destruction messages
// destroys GDI stuff and posts a quit message
void OnDestroy();
// deletes Console object
void OnNcDestroy();
/////////////////////
// painting messages
// handles painting from off-screen buffers
void OnPaint();
// handles master and 'change' timers
void OnPaintTimer();
// handles cursor timer (for animated cursors)
void OnCursorTimer();
/////////////////////////
// window state messages
// handles window position changes (for snapping to desktop edges)
void OnWindowPosChanging(WINDOWPOS* lpWndPos);
// handles activation message (used for setting alpha transparency and cursor states)
void OnActivateApp(BOOL bActivate, DWORD dwFlags);
// handles vertical scrolling
void OnVScroll(WPARAM wParam);
// handles keyboard layout change, posts the same message to the windows console window
void OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam);
//////////////////
// mouse messages
// handles text selection start and window mouse drag start
void OnLButtonDown(UINT uiFlags, POINTS points);
// handles text selection end, window mouse drag end and text copy
void OnLButtonUp(UINT uiFlags, POINTS points);
// toggles always on top flag
void OnLButtonDblClick(UINT uiFlags, POINTS points);
// pops up the Console menu
void OnRButtonUp(UINT uiFlags, POINTS points);
// pastes text from clipboard
void OnMButtonDown(UINT uiFlags, POINTS points);
// handles mouse movement for text selection and window mouse drag
void OnMouseMove(UINT uiFlags, POINTS points);
// handles start/stop mouse drag for window border
void OnSetCursor(WORD wHitTest, WORD wMouseMessage);
// handles text input
void OnChar(WORD mychar);
wstring Input;
//////////////////
// other messages
// called before the Console menu or system menu pops up
// (populates config files submenu with filenames)
void OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu);
// handles drag-n-dropped filenames
void OnDropFiles(HDROP hDrop);
// handles commands from the Console popup menu
BOOL OnCommand(WPARAM wParam, LPARAM lParam);
// handles commands from the system popup menu
BOOL OnSysCommand(WPARAM wParam, LPARAM lParam);
// handles tray icon messages
void OnTrayNotify(WPARAM wParam, LPARAM lParam);
// handles WM_SETTINGCHANGE (we handle only wallpaper changes here)
// void OnWallpaperChanged(const TCHAR* pszFilename);
private:
///////////////////////////////////////////
// Console window creation/setup functions
///////////////////////////////////////////
// gets Console options
BOOL GetOptions();
// registers Console window classes
BOOL RegisterWindowClasses();
// adds stuff to system and popup menus
BOOL SetupMenus();
// creates Console window
BOOL CreateConsoleWindow();
// creates new Console font
void CreateNewFont();
// creates new background brush
void CreateNewBrush();
// creates the cursor
void CreateCursor();
// creates offscreen painting buffers
void CreateOffscreenBuffers();
// creates background bitmap
void CreateBackgroundBitmap();
// called by the ::EnumDisplayMonitors to create background for each display
// static BOOL CALLBACK BackgroundEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
// gets character width and height
void GetTextSize();
// gets window borders (X, Y and caption sizes)
void GetBordersDimensions();
// calculates window and client area sizes
void CalcWindowSize();
// sets up window transparency (alpha, color key, fake)
// void SetWindowTransparency();
// sets scrollbar stuff
void SetScrollbarStuff();
// sets default console colors
void SetDefaultConsoleColors();
// sets window size and position
void SetWindowSizeAndPosition();
// sets Console's big, small and tray icons
void SetWindowIcons();
// sets up traybar icon
BOOL SetTrayIcon(DWORD dwMessage);
// destroys Console cursor
void DestroyCursor();
// opens the configuration file in a text editor
void EditConfigFile();
// reloads Console settings
void ReloadSettings();
/////////////////////////////
// windows console functions
/////////////////////////////
// allocates the console and starts the command shell
BOOL StartShellProcess();
// refreshes m_hStdOutFresh handle
void RefreshStdOut();
// gets a fresh console output
void RefreshScreenBuffer();
// sets initial windows console size
void InitConsoleWndSize(DWORD dwColumns);
// resizes the windows console
void ResizeConsoleWindow();
// Allocates the screen buffer
void AllocateBuffer();
//////////////////////
// painting functions
//////////////////////
// repaints the memory hdc
void RepaintWindow();
// repaints the memory hdc (paint only changes)
void RepaintWindowChanges();
// draws the cursor
void DrawCursor(BOOL bOnlyCursor = FALSE);
// two helper functions for DrawCursor method
// returns cursor rectangle
inline void GetCursorRect(RECT& rectCursor);
// draws cursor background and returns the cursor rectangle
inline void DrawCursorBackground(RECT& rectCursor);
// clears text selection
void ClearSelection();
// returns the console text change rate since the last painting
// (using this value we decide whether to repaint entire window
// or just the changes)
DWORD GetChangeRate();
//////////////////////////
// window state functions
//////////////////////////
// shows/hides Console window
void ShowHideWindow();
// shows/hides windows console window
void ShowHideConsole();
// shows/hides windows console window after a timeout (used during
// shell startup)
void ShowHideConsoleTimeout();
// toggles 'always on top' status
void ToggleWindowOnTop();
//////////////////
// menu functions
//////////////////
// called by OnCommand and OnSysCommand to handle menu commands
BOOL HandleMenuCommand(DWORD dwID);
// updates popup and system menus for 'always on top' status
void UpdateOnTopMenuItem();
// updates popup and system menus for 'hide console' status
void UpdateHideConsoleMenuItem();
// updates configuration files submenu
void UpdateConfigFilesSubmenu();
///////////////////////
// clipboard functions
///////////////////////
// copies selected text to the clipboard
void CopyTextToClipboard();
// pastes text from the clipboard
void PasteClipoardText();
//////////////////
// misc functions
//////////////////
// shows Readme.txt file
void ShowReadmeFile();
// shows about dialog
void About();
// sends text to the windows console
void SendTextToConsole(const wchar_t *pszText);
// returns the full filename
tstring GetFullFilename(const tstring& strFilename);
// gets a desktop rectangle
void GetDesktopRect(RECT& rectDesktop);
// Pulls the text from the stdout or stderr handle (both are the same) and sends it to the console
void AddOutput();
///////////////////////
// 'gearbox' functions
///////////////////////
// Console window procedure
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// shell activities monitor
static DWORD WINAPI MonitorThreadStatic(LPVOID lpParam);
DWORD MonitorThread();
// CTRL+C, CTRL+BREAK handler
static BOOL WINAPI CtrlHandler(DWORD dwCtrlType);
public: // public data
// Console window handle
HWND m_hWnd;
HWND m_notifyhWnd;
// console colors
COLORREF m_arrConsoleColors[16];
private: // private data
// readem filename
tstring m_strReadmeFile;
BOOL m_bInitializing;
BOOL m_bReloading;
tstring m_strConfigFile;
tstring m_strConfigEditor;
tstring m_strConfigEditorParams;
// one of the RELOAD_NEW_CONFIG_* constants
// - specifies relaod behaviour when a new configuration is selected
// (auto reload, don't reload, ask user)
DWORD m_dwReloadNewConfigDefault;
DWORD m_dwReloadNewConfig;
tstring m_strShell;
tstring m_strShellCmdLine;
// handle to invisible window - used for hiding the taskbar button in tray and 'hidden' modes
HWND m_hwndInvisParent;
// memory device context that holds console output image
HDC m_hdcConsole;
// memory device context for an off-screen window buffer (used to
// compose an image from m_hdcConsole and m_hdcSelection if text
// selection is active)
HDC m_hdcWindow;
// a bitmap used for drawing in the console memory DC
HBITMAP m_hbmpConsole;
HBITMAP m_hbmpConsoleOld;
// a bitmap used for drawing in the window memory DC
HBITMAP m_hbmpWindow;
HBITMAP m_hbmpWindowOld;
// brush for painting background
HBRUSH m_hBkBrush;
// master repaint timer interval (runs independent of changes in the
// console)
DWORD m_dwMasterRepaintInt;
// change repaint timer interval (when a change occurs, repainting
// will be postponed for this interval)
DWORD m_dwChangeRepaintInt;
// icon filename
tstring m_strIconFilename;
// program icons
HICON m_hSmallIcon;
HICON m_hBigIcon;
// popup menu
HMENU m_hPopupMenu;
// system (taskbar button) menu
HMENU m_hSysMenu;
// submenu for the XML (config) files
HMENU m_hConfigFilesMenu;
// set to TRUE if the popup menu is disabled
BOOL m_bPopupMenuDisabled;
// Console window title variables
// holds the default console title ("console" or the one passed in the cmdline param)
tstring m_strWindowTitleDefault;
// holds the window title (default title, or the one from the config file)
tstring m_strWindowTitle;
// holds the current window title
tstring m_strWindowTitleCurrent;
// font data
tstring m_strFontName;
DWORD m_dwFontSize;
BOOL m_bBold;
BOOL m_bItalic;
BOOL m_bUseFontColor;
COLORREF m_crFontColor;
HFONT m_hFont;
HFONT m_hFontOld;
// window X and Y positions
int m_nX;
int m_nY;
// client area inside border (gives a more 'relaxed' look to windows)
int m_nInsideBorder;
// window width and height
int m_nWindowWidth;
int m_nWindowHeight;
// window border sizes
int m_nXBorderSize;
int m_nYBorderSize;
int m_nCaptionSize;
// client area widht/height
int m_nClientWidth;
int m_nClientHeight;
// char height and width (used in window repainting)
// Note: width is used only for fixed-pitch fonts to speed up
// repainting
int m_nCharHeight;
int m_nCharWidth;
// window border type
// 0 - none
// 1 - regular window
// 2 - 1-pixel thin border
DWORD m_dwWindowBorder;
// scrollbar stuff
BOOL m_bShowScrollbar;
int m_nScrollbarStyle;
COLORREF m_crScrollbarColor;
int m_nScrollbarWidth;
int m_nScrollbarButtonHeight;
int m_nScrollbarThunmbHeight;
// what to do with the taskbar button
// if the taskbar button is hidden, or placed in the traybar, you
// can't ALT-TAB to console (take care when using with color key
// transparency :-)
// 0 - nothing
// 1 - hide it
// 2 - put icon to traybar
DWORD m_dwTaskbarButton;
// set to TRUE if the window can be dragged by left-click hold
BOOL m_bMouseDragable;
// snap distance
int m_nSnapDst;
// window docking position
// 0 - no dock
// 1 - top left
// 2 - top right
// 3 - bottom right
// 4 - bottom left
DWORD m_dwDocked;
// window Z-ordering
// 0 - regular
// 1 - always on top
// 2 - always on bottom
DWORD m_dwOriginalZOrder;
DWORD m_dwCurrentZOrder;
// Win2000/XP transparency
// 0 - none
// 1 - alpha blending
// 2 - colorkey
// 3 - fake transparency
DWORD m_dwTransparency;
// alpha value for alpha blending (Win2000 and later only!)
BYTE m_byAlpha;
// alpha value for inactive window
BYTE m_byInactiveAlpha;
COLORREF m_crBackground;
COLORREF m_crConsoleBackground;
// this is used for tinting background images and fake transparencies
BOOL m_bTintSet;
BYTE m_byTintOpacity;
BYTE m_byTintR;
BYTE m_byTintG;
BYTE m_byTintB;
// used when background is an image
BOOL m_bBitmapBackground;
tstring m_strBackgroundFile;
HDC m_hdcBackground;
HBITMAP m_hbmpBackground;
HBITMAP m_hbmpBackgroundOld;
// background attributes
// one of BACKGROUND_STYLE_ #defines
DWORD m_dwBackgroundStyle;
// set to true for relative background
BOOL m_bRelativeBackground;
// set to true to extend the background to all monitors
BOOL m_bExtendBackground;
// offsets used for multiple monitors and relative backgrounds (fake transparency, too)
int m_nBackgroundOffsetX;
int m_nBackgroundOffsetY;
// used for showing/hiding main window
BOOL m_bHideWindow;
// set to TRUE when the real console is hidden
BOOL m_bHideConsole;
// timeout used when hiding console window for the first time (some
// shells need console window visible during startup)
DWORD m_dwHideConsoleTimeout;
// if set to TRUE, Console will be started minimized
BOOL m_bStartMinimized;
// cursor style
// 0 - none
// 1 - XTerm
// 2 - block cursor
// 3 - bar cursor
// 4 - console cursor
// 5 - horizontal line
// 6 - vertical line
// 7 - pulse rect
// 8 - fading block
DWORD m_dwCursorStyle;
COLORREF m_crCursorColor;
// console screen buffer info for cursor
CONSOLE_SCREEN_BUFFER_INFO m_csbiCursor;
// wether console cursor is visible or not
BOOL m_bCursorVisible;
class Cursor* m_pCursor;
// mouse cursor offset within the window (used for moving the window)
POINT m_mouseCursorOffset;
/////////////////////
// console stuff
// console window handle
HWND m_hWndConsole;
// console screen buffer info for console repainting
CONSOLE_SCREEN_BUFFER_INFO m_csbiConsole;
// console stdouts
HANDLE m_hStdOut;
HANDLE m_hStdOutFresh;
// set when quitting the application
HANDLE m_hQuitEvent;
// set by monitor thread when detects console process exit
HANDLE m_hConsoleProcess;
// handle to monitor thread
HANDLE m_hMonitorThread;
// console rows & columns
DWORD m_dwRows;
DWORD m_dwColumns;
DWORD m_dwBufferRows;
BOOL m_bUseTextBuffer;
// set to one of TEXT_SELECTION_ #defines
int m_nTextSelection;
// X Windows style copy-on-select
BOOL m_bCopyOnSelect;
// Inverse the shift behaviour for selecting and dragging
BOOL m_bInverseShift;
COORD m_coordSelOrigin;
RECT m_rectSelection;
HDC m_hdcSelection;
HBITMAP m_hbmpSelection;
HBITMAP m_hbmpSelectionOld;
HBRUSH m_hbrushSelection;
CHAR_INFO* m_pScreenBuffer;
CHAR_INFO* m_pScreenBufferNew;
DWORD m_nTextColor;
DWORD m_nTextBgColor;
// Console window class names
static const TCHAR m_szConsoleClass[];
static const TCHAR m_szHiddenParentClass[];
// win console window title
static const tstring m_strWinConsoleTitle;
};
/////////////////////////////////////////////////////////////////////////////
+208
View File
@@ -0,0 +1,208 @@
//Microsoft Developer Studio generated resource script.
//
#include "res\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
#define IDC_STATIC 00
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 146, 87
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_CENTER | WS_POPUP |
WS_CAPTION | WS_SYSMENU
CAPTION "About Console"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,48,66,50,14
LTEXT "Console v1.5",IDC_STATIC,51,11,42,8
LTEXT "Copyright© 2001-2005 Marko Bozikovic",IDC_STATIC,9,30,
127,8
LTEXT "bozho@kset.org",IDC_STATIC,46,45,53,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 139
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
END
#endif // APSTUDIO_INVOKED
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
//IDI_ICON2 ICON DISCARDABLE "Console.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_POPUP_MENU MENU DISCARDABLE
BEGIN
POPUP " "
BEGIN
// MENUITEM "Read&me", ID_SHOW_README_FILE
MENUITEM "&About Console", ID_ABOUT
MENUITEM SEPARATOR
MENUITEM "&Copy", ID_COPY
MENUITEM "&Paste", ID_PASTE
MENUITEM SEPARATOR
// MENUITEM "Always on &top", ID_TOGGLE_ONTOP
// MENUITEM "&Hide console", ID_HIDE_CONSOLE
// MENUITEM SEPARATOR
// MENUITEM "&Select configuration file", ID_SEL_CONFIG_FILE
// MENUITEM "&Edit configuration file", ID_EDIT_CONFIG_FILE
// MENUITEM "&Reload settings", ID_RELOAD_SETTINGS
// MENUITEM SEPARATOR
MENUITEM "E&xit", ID_EXIT_CONSOLE
END
END
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Croatian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HRV)
#ifdef _WIN32
LANGUAGE LANG_CROATIAN, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,0,351
PRODUCTVERSION 1,5,0,351
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "A cool console window :-)\0"
VALUE "CompanyName", "Ingenuity Unlimited Ltd.\0"
VALUE "FileDescription", "Console\0"
VALUE "FileVersion", "1.5, Build 351 2005.09.22\0"
VALUE "InternalName", "Console\0"
VALUE "LegalCopyright", "Copyright © 2001-2004 Marko Bozikovic\0"
VALUE "LegalTrademarks", "Copyright © 2001-2004 Marko Bozikovic\0"
VALUE "OriginalFilename", "Console.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Console\0"
VALUE "ProductVersion", "1.5.00.351\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // !_MAC
#endif // Croatian resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+769
View File
@@ -0,0 +1,769 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Cursors.h - cursor classes
//#include "stdafx.h"
#include <Windows.h>
#include <tchar.h>
#include "Cursors.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// XTermCursor
XTermCursor::XTermCursor(HWND hwndConsole, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndConsole, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_hInactiveBrush(::CreateSolidBrush(crCursorColor))
{
}
XTermCursor::~XTermCursor() {
::DeleteObject(m_hActiveBrush);
::DeleteObject(m_hInactiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void XTermCursor::Draw(LPRECT pRect) {
if (m_bActive) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
} else {
::FrameRect(m_hdcWindow, pRect, m_hInactiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void XTermCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BlockCursor
BlockCursor::BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
BlockCursor::~BlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BlockCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BlockCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBBlockCursor
NBBlockCursor::NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
{
}
NBBlockCursor::~NBBlockCursor() {
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBBlockCursor::Draw(LPRECT pRect) {
::FillRect(m_hdcWindow, pRect, m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBBlockCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseBlockCursor
PulseBlockCursor::PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_nSize(0)
, m_nMaxSize(0)
, m_nStep(0)
{
::ZeroMemory(&m_rect, sizeof(RECT));
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
PulseBlockCursor::~PulseBlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseBlockCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nMaxSize == 0) {
if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) {
m_nMaxSize = (pRect->right - pRect->left) >> 1;
} else {
m_nMaxSize = (pRect->bottom - pRect->top) >> 1;
}
}
if (m_bActive) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
rect.left += m_nSize;
rect.top += m_nSize;
rect.right -= m_nSize;
rect.bottom -= m_nSize;
::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseBlockCursor::PrepareNext() {
if (m_nSize == 0) {
m_nStep = 1;
} else if (m_nSize == m_nMaxSize) {
m_nStep = -1;
}
m_nSize += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BarCursor
BarCursor::BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
BarCursor::~BarCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BarCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->top, NULL);
::LineTo(m_hdcWindow, pRect->left, pRect->bottom);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void BarCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ConsoleCursor
ConsoleCursor::ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hStdOut(::CreateFile(_T("CONOUT$"), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0))
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
ConsoleCursor::~ConsoleCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
::CloseHandle(m_hStdOut);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void ConsoleCursor::Draw(LPRECT pRect) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
if (m_bActive && m_bVisible) {
rect.top += (rect.bottom - rect.top) * 80 / 100;
::FillRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void ConsoleCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBHLineCursor
NBHLineCursor::NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
{
}
NBHLineCursor::~NBHLineCursor() {
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBHLineCursor::Draw(LPRECT pRect) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->bottom-1, NULL);
::LineTo(m_hdcWindow, pRect->right, pRect->bottom-1);
::SelectObject(m_hdcWindow, hOldPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBHLineCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// HLineCursor
HLineCursor::HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_nSize(0)
, m_nPosition(0)
, m_nStep(0)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
HLineCursor::~HLineCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void HLineCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nSize != (pRect->bottom - pRect->top - 1)) {
m_nSize = pRect->bottom - pRect->top - 1;
m_nPosition = 0;
m_nStep = 1;
}
if (m_bActive) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left, pRect->top + m_nPosition, NULL);
::LineTo(m_hdcWindow, pRect->right, pRect->top + m_nPosition);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void HLineCursor::PrepareNext() {
if (m_nPosition == 0) {
m_nStep = 1;
} else if (m_nPosition == m_nSize) {
m_nStep = -1;
}
m_nPosition += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// VLineCursor
VLineCursor::VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor))
, m_nSize(0)
, m_nPosition(0)
, m_nStep(0)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
VLineCursor::~VLineCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hPen);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void VLineCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nSize != (pRect->right - pRect->left - 1)) {
m_nSize = pRect->right - pRect->left - 1;
m_nPosition = 0;
m_nStep = 1;
}
if (m_bActive) {
HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen);
::MoveToEx(m_hdcWindow, pRect->left + m_nPosition, pRect->top, NULL);
::LineTo(m_hdcWindow, pRect->left + m_nPosition, pRect->bottom);
::SelectObject(m_hdcWindow, hOldPen);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void VLineCursor::PrepareNext() {
if (m_nPosition == 0) {
m_nStep = 1;
} else if (m_nPosition == m_nSize) {
m_nStep = -1;
}
m_nPosition += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// RectCursor
RectCursor::RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_bVisible(TRUE)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL);
}
RectCursor::~RectCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void RectCursor::Draw(LPRECT pRect) {
if (m_bActive && m_bVisible) {
::FrameRect(m_hdcWindow, pRect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void RectCursor::PrepareNext() {
m_bVisible = !m_bVisible;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBRectCursor
NBRectCursor::NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
{
}
NBRectCursor::~NBRectCursor() {
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBRectCursor::Draw(LPRECT pRect) {
::FrameRect(m_hdcWindow, pRect, m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void NBRectCursor::PrepareNext() {
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseRectCursor
PulseRectCursor::PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_hActiveBrush(::CreateSolidBrush(crCursorColor))
, m_nSize(0)
, m_nMaxSize(0)
, m_nStep(0)
{
::ZeroMemory(&m_rect, sizeof(RECT));
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL);
}
PulseRectCursor::~PulseRectCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
::DeleteObject(m_hActiveBrush);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseRectCursor::Draw(LPRECT pRect) {
// this is called only once, to set the size of the cursor
if (m_nMaxSize == 0) {
if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) {
m_nMaxSize = (pRect->right - pRect->left) >> 1;
} else {
m_nMaxSize = (pRect->bottom - pRect->top) >> 1;
}
}
if (m_bActive) {
RECT rect;
::CopyMemory(&rect, pRect, sizeof(RECT));
rect.left += m_nSize;
rect.top += m_nSize;
rect.right -= m_nSize;
rect.bottom -= m_nSize;
::FrameRect(m_hdcWindow, &rect, m_hActiveBrush);
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void PulseRectCursor::PrepareNext() {
if (m_nSize == 0) {
m_nStep = 1;
} else if (m_nSize == m_nMaxSize) {
m_nStep = -1;
}
m_nSize += m_nStep;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FadeBlockCursor
FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor)
: Cursor(hwndParent, hdcWindow, crCursorColor)
, m_crCursorColor(crCursorColor)
, m_nStep(1)
, m_crBkColor(crBkColor)
, m_nIndex(0)
, m_hUser32(NULL)
, m_hMemDC(NULL)
{
m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL);
FakeBlend();
// }
}
FadeBlockCursor::~FadeBlockCursor() {
if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void FadeBlockCursor::Draw(LPRECT pRect) {
HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]);
::FillRect(m_hdcWindow, pRect, hBrush);
::DeleteObject(hBrush);
// }
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void FadeBlockCursor::PrepareNext() {
if (m_nIndex == 0) {
m_nStep = 1;
} else if (m_nIndex == (FADE_STEPS)) {
m_nStep = -1;
}
m_nIndex += m_nStep;
// }
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// This function is used to create a fake blending for WinNT (uuseful only
// for solid background, though)
void FadeBlockCursor::FakeBlend() {
int nDeltaR = ((GetRValue(m_crCursorColor) - GetRValue(m_crBkColor)) << 8) / FADE_STEPS;
int nDeltaG = ((GetGValue(m_crCursorColor) - GetGValue(m_crBkColor)) << 8) / FADE_STEPS;
int nDeltaB = ((GetBValue(m_crCursorColor) - GetBValue(m_crBkColor)) << 8) / FADE_STEPS;
for (int i = 0; i < FADE_STEPS; ++i) {
m_arrColors[i] = RGB(GetRValue(m_crCursorColor) - (nDeltaR*i >> 8), GetGValue(m_crCursorColor) - (nDeltaG*i >> 8), GetBValue(m_crCursorColor) - (nDeltaB*i >> 8));
}
m_arrColors[FADE_STEPS] = m_crBkColor;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+342
View File
@@ -0,0 +1,342 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Cursors.h - cursor classes
#pragma once
#define CURSOR_TIMER 45
extern BOOL g_bWin2000;
/////////////////////////////////////////////////////////////////////////////
// A base class for all the cursors
class Cursor {
public:
Cursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor)
: m_hwndParent(hwndParent)
, m_hdcWindow(hdcWindow)
, m_crCursorColor(crCursorColor)
, m_bActive(TRUE)
, m_uiTimer(0)
{};
virtual ~Cursor(){};
void SetState(BOOL bActive) {m_bActive = bActive;};
BOOL GetState() { return m_bActive; }
// used to draw current frame of the cursor
virtual void Draw(LPRECT pRect) = 0;
// used to prepare the next frame of cursor animation
virtual void PrepareNext() = 0;
protected:
HWND m_hwndParent;
HDC m_hdcWindow;
COLORREF m_crCursorColor;
BOOL m_bActive;
UINT m_uiTimer;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// XTermCursor
class XTermCursor : public Cursor {
public:
XTermCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~XTermCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
HBRUSH m_hInactiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BlockCursor
class BlockCursor : public Cursor {
public:
BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~BlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBBlockCursor
class NBBlockCursor : public Cursor {
public:
NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseBlockCursor
class PulseBlockCursor : public Cursor {
public:
PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~PulseBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
RECT m_rect;
int m_nSize;
int m_nMaxSize;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// BarCursor
class BarCursor : public Cursor {
public:
BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~BarCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ConsoleCursor
class ConsoleCursor : public Cursor {
public:
ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~ConsoleCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HANDLE m_hStdOut;
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBHLineCursor
class NBHLineCursor : public Cursor {
public:
NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBHLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// HLineCursor
class HLineCursor : public Cursor {
public:
HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~HLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
int m_nSize;
int m_nPosition;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// VLineCursor
class VLineCursor : public Cursor {
public:
VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~VLineCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HPEN m_hPen;
int m_nSize;
int m_nPosition;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// RectCursor
class RectCursor : public Cursor {
public:
RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~RectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
BOOL m_bVisible;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// NBRectCursor
class NBRectCursor : public Cursor {
public:
NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~NBRectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// PulseRectCursor
class PulseRectCursor : public Cursor {
public:
PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor);
~PulseRectCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
HBRUSH m_hActiveBrush;
RECT m_rect;
int m_nSize;
int m_nMaxSize;
int m_nStep;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FadeBlockCursor
#define FADE_STEPS 20
#define ALPHA_STEP 12
#define BLEND_BMP_WIDTH 10
#define BLEND_BMP_HEIGHT 20
class FadeBlockCursor : public Cursor {
public:
FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor);
~FadeBlockCursor();
void Draw(LPRECT pRect);
void PrepareNext();
private:
void FakeBlend();
COLORREF m_crCursorColor;
int m_nStep;
// used under WinNT 4.0
COLORREF m_crBkColor;
COLORREF m_arrColors[FADE_STEPS+1];
int m_nIndex;
// these are used under Win2000 only
HMODULE m_hUser32;
BLENDFUNCTION m_bfn;
HDC m_hMemDC;
};
/////////////////////////////////////////////////////////////////////////////
+134
View File
@@ -0,0 +1,134 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dialogs.h - dialog classes
//
// About dialog class, etc...
//#include "stdafx.h"
#include <Windows.h>
#include "resource.h"
#include "Console.h"
#include "Dialogs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HINSTANCE ghInstance;
/////////////////////////////////////////////////////////////////////////////
// About dialog class
/////////////////////////////////////////////////////////////////////////////
// Ctor/Dtor
CAboutDlg::CAboutDlg(HWND hwndParent)
: m_hWndParent(hwndParent)
{
}
CAboutDlg::~CAboutDlg()
{
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// public methods
/////////////////////////////////////////////////////////////////////////////
// DoModal - shows About dialog
BOOL CAboutDlg::DoModal()
{
::DialogBox(
ghInstance,
MAKEINTRESOURCE(IDD_ABOUT),
m_hWndParent,
CAboutDlg::DialogProc);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// message handlers
/////////////////////////////////////////////////////////////////////////////
// DialogProc - dialog window procedure
int CALLBACK CAboutDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
if (HIWORD(wParam) == BN_CLICKED) {
::EndDialog(hwndDlg, MB_OK);
return TRUE;
}
break;
}
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+64
View File
@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dialogs.h - dialog classes
//
// About dialog class, etc...
#pragma once
/////////////////////////////////////////////////////////////////////////////
// About dialog class
class CAboutDlg {
public:
CAboutDlg(HWND hwndParent);
~CAboutDlg();
// public methods
public:
// shows About dialog
BOOL DoModal();
// public data
public:
// parent window handle
HWND m_hWndParent;
// private methods
private:
/////////////////////////
// message handlers
// dialog window procedure
static int CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
// private data
private:
};
/////////////////////////////////////////////////////////////////////////////
+259
View File
@@ -0,0 +1,259 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream.cpp - implementation of IStream interface on any file
// (not strictly COM, I'm faking it here a bit :-)
//
#undef CINTERFACE
#include "builddefines.h"
//#include "stdafx.h"
//#include <atlbase.h>
#include <Windows.h>
#include <objidl.h>
#include "FileStream.h"
//#ifdef _DEBUG
//#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
//#endif
/////////////////////////////////////////////////////////////////////////////
// CreateFileStream - opens/creates a file and returns an IStream interface
HRESULT CreateFileStream(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile, // handle to template file
IStream** ppStream // pointer to IStream interface
)
{
HANDLE hFile = ::CreateFile(
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile);
if (hFile == INVALID_HANDLE_VALUE) {
// DWORD a = ::GetLastError();
ppStream = NULL;
return E_FAIL;
}
FileStream* pFileStream = new FileStream(hFile);
return pFileStream->QueryInterface(IID_IStream, (void**)ppStream);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream class
/////////////////////////////////////////////////////////////////////////////
// ctor/dtor
FileStream::FileStream(HANDLE hFile)
: m_lRefCount(0)
, m_hFile(hFile)
{
}
FileStream::~FileStream()
{
if (m_hFile) ::CloseHandle(m_hFile);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// IStream methods
/////////////////////////////////////////////////////////////////////////////
// Read - reads a specified number of bytes from the stream object into memory
// starting at the current seek pointer
STDMETHODIMP FileStream::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
if (!::ReadFile(m_hFile, pv, cb, pcbRead, NULL)) return S_FALSE;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Write - writes a specified number of bytes into the stream object starting
// at the current seek pointer
STDMETHODIMP FileStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten)
{
if (!::WriteFile(m_hFile, pv, cb, pcbWritten, NULL)) return S_FALSE;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Seek - changes the seek pointer to a new location relative to the beginning
// of the stream, to the end of the stream, or to the current seek pointer
STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
DWORD dwFileOrigin;
DWORD dwMoveLow = dlibMove.LowPart;
LONG lMoveHigh = dlibMove.HighPart;
switch (dwOrigin) {
case STREAM_SEEK_SET : dwFileOrigin = FILE_BEGIN; break;
case STREAM_SEEK_CUR : dwFileOrigin = FILE_CURRENT; break;
case STREAM_SEEK_END : dwFileOrigin = FILE_END; break;
default:dwFileOrigin = FILE_BEGIN;
}
DWORD dwRet = ::SetFilePointer(m_hFile, dwMoveLow, &lMoveHigh, dwFileOrigin);
if (::GetLastError() != NO_ERROR) return STG_E_INVALIDPOINTER;
plibNewPosition->LowPart = dwRet;
plibNewPosition->HighPart = lMoveHigh;
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// SetSize - not really doing anything here
STDMETHODIMP FileStream::SetSize(ULARGE_INTEGER libNewSize)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CopyTo - copies a specified number of bytes from the current seek pointer
// in the stream to the current seek pointer in another stream
STDMETHODIMP FileStream::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
// later...
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Commit - no work here...
STDMETHODIMP FileStream::Commit(DWORD grfCommitFlags)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Revert - no work here...
STDMETHODIMP FileStream::Revert(void)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// LockRegion - no work here...
STDMETHODIMP FileStream::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// UnlockRegion - no work here...
STDMETHODIMP FileStream::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Stat - no work here...
STDMETHODIMP FileStream::Stat(STATSTG *pstatstg, DWORD grfStatFlag)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Clone - no work here...
STDMETHODIMP FileStream::Clone(IStream **ppstm)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
+107
View File
@@ -0,0 +1,107 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2001-2004 by Marko Bozikovic
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc., and
// I'll try to keep a version up to date. I can be reached as follows:
// marko.bozikovic@alterbox.net
// bozho@kset.org
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream.h - implementation of IStream interface on any file
// (not really COM, I'm faking it here a bit :-)
//
#pragma once
/////////////////////////////////////////////////////////////////////////////
// CreateFileStream - opens/creates a file and returns an IStream interface
HRESULT CreateFileStream(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile, // handle to template file
IStream** ppStream // pointer to IStream interface
);
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FileStream class
class FileStream : public IStream {
public:
FileStream(HANDLE hFile);
~FileStream();
// IUnknown methods
STDMETHOD(QueryInterface)(REFIID riid, void ** ppv) {
if (riid == IID_IUnknown) {
*ppv = static_cast<IStream*>(this);
} else if (riid == IID_IStream) {
*ppv = static_cast<IStream*>(this);
} else {
*ppv = NULL;
return E_NOINTERFACE;
}
static_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
};
STDMETHOD_(ULONG, AddRef)(void) {
return ::InterlockedIncrement(&m_lRefCount);
};
STDMETHOD_(ULONG, Release)(void) {
long l = ::InterlockedDecrement(&m_lRefCount);
if (l == 0) delete this;
return l;
};
// IStream methods
STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead);
STDMETHOD(Write)(void const *pv, ULONG cb, ULONG *pcbWritten);
STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize);
STDMETHOD(CopyTo)(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
STDMETHOD(Commit)(DWORD grfCommitFlags);
STDMETHOD(Revert)(void);
STDMETHOD(LockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
STDMETHOD(UnlockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag);
STDMETHOD(Clone)(IStream **ppstm);
private: // private data
// reference count
long m_lRefCount;
// file handle
HANDLE m_hFile;
};
/////////////////////////////////////////////////////////////////////////////
+1200
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+12 -11
View File
@@ -1,24 +1,25 @@
#include "types.h"
#include "Types.h"
#include "Credits.h"
#include "Language Defines.h"
#include "vsurface.h"
#include "mousesystem.h"
#include "Text.h"
#include "WordWrap.h"
#include "video.h"
#include "Render Dirty.h"
#include "wordwrap.h"
#include "Video.h"
#include "render dirty.h"
#include "local.h"
#include "Utilities.h"
#include "utilities.h"
#include "WCheck.h"
#include "screenids.h"
#include "Font Control.h"
#include "Cursors.h"
#include "Font.h"
#include "WordWrap.h"
#include "cursors.h"
#include "font.h"
#include "wordwrap.h"
#include "sysutil.h"
#include "input.h"
#include "Input.h"
#include "english.h"
#include "Encrypted File.h"
#include "random.h"
#include "encrypted file.h"
#include "Random.h"
//externals
extern HVSURFACE ghFrameBuffer;
View File
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __BUTTON_DEFINES_H
+1 -1
View File
@@ -7,7 +7,7 @@
#include "renderworld.h"
#include "random.h"
#include "worldman.h"
#include "Interface.h"
#include "interface.h"
#include "Isometric Utils.h"
#include "editscreen.h"
#include "EditorDefines.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __CURSOR_MODES_H
@@ -40,4 +40,4 @@ extern BOOLEAN gfCurrentSelectionWithRightButton;
#endif
#endif
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITOR_CALLBACK_PROTOTYPES_H
+1 -1
View File
@@ -17,7 +17,7 @@
#include "environment.h"
#include "worlddef.h"
#include "Exit Grids.h"
#include "worldman.h"
#include "Worldman.h"
BOOLEAN gfShowExitGrids = FALSE;
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITOR_MODES_H
@@ -14,4 +14,4 @@ void ShowExitGrids();
void HideExitGrids();
#endif
#endif
#endif
+2 -2
View File
@@ -5,7 +5,7 @@
//sgp
#include "Button System.h"
#include "Font Control.h"
#include "DEBUG.H"
#include "debug.h"
//editor
#include "EditorDefines.h"
#include "Editor Callback Prototypes.h"
@@ -14,7 +14,7 @@
#include "EditorMapInfo.h"
//tactical
#include "Soldier Create.h"
#include "Overhead Types.h"
#include "overhead types.h"
#include "local.h"
#include "Text.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITOR_TASKBAR_CREATION_H
@@ -7,4 +7,4 @@
void CreateEditorTaskbarInternal();
#endif
#endif
#endif
+2 -2
View File
@@ -11,13 +11,13 @@
#include "WorldDat.h"
#include "Render Dirty.h"
#include "sysutil.h"
#include "WordWrap.h"
#include "wordwrap.h"
#include "environment.h"
#include "Interface Items.h"
#include "Soldier Find.h"
#include "World Items.h"
#include "Text.h"
#include "overhead map.h"
#include "Overhead map.h"
#include "Cursor Modes.h"
#include "editscreen.h"
#include "EditorTerrain.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITOR_TASKBAR_UTILS_H
@@ -67,4 +67,4 @@ extern UINT32 guiMercTempBuffer;
extern INT32 giEditMercImage[2];
#endif
#endif
#endif
+2 -2
View File
@@ -6,7 +6,7 @@
#include "worldman.h"
#include "smooth.h"
#include "input.h"
#include "DEBUG.H"
#include "debug.h"
#include "Isometric Utils.h"
#include "editscreen.h"
@@ -15,7 +15,7 @@
#include "Cursor Modes.h"
#include "Exit Grids.h"
//dnl ch86 110214
#include "Keys.h"
#include "keys.h"
#include "EditorItems.h"
#include "EditorMapInfo.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITOR_UNDO_H
+1 -1
View File
@@ -18,7 +18,7 @@
#include "Editor Modes.h"
#include "Smoothing Utils.h"
#include "Text Input.h"
#include "Keys.h"
#include "keys.h"
#include "environment.h"
#include "selectwin.h"
#include "Simple Render Utils.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITORBUILDINGS_H
+2 -2
View File
@@ -1,10 +1,10 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITORDEFINES_H
#define __EDITORDEFINES_H
#include "types.h"
#include "Types.h"
#include "Button Defines.h"
+12 -12
View File
@@ -9,34 +9,34 @@
#include "vobject.h"
#include "mousesystem.h"
#include "Button System.h"
#include "WCheck.h"
#include "wcheck.h"
#include "vsurface.h"
#include "input.h"
#include "sysutil.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "editscreen.h"
#include "selectwin.h"
#include "video.h"
#include "vobject_blitters.h"
#include "Interface Panels.h"
#include "Interface Items.h"
#include "Text.h"
#include "Utilities.h"
#include "interface panels.h"
#include "interface items.h"
#include "text.h"
#include "utilities.h"
#include "Action Items.h"
#include "World Items.h"
#include "EditorDefines.h"
#include "EditorItems.h"
#include "EditorMercs.h"
#include "Weapons.h"
#include "weapons.h"
#include "Editor Taskbar Utils.h"
#include "WordWrap.h"
#include "wordwrap.h"
#include "Item Statistics.h"
#include "Simple Render Utils.h"
#include "worldman.h"
#include "random.h"
#include "pits.h"
#include "Keys.h"
#include "Pits.h"
#include "keys.h"
#include "InterfaceItemImages.h"
#include "Editor Undo.h"//dnl ch86 220214
@@ -152,7 +152,7 @@ void EntryInitEditorItemsInfo()
item = &Item[i];
//if( Item[i].fFlags & ITEM_NOT_EDITOR )
// continue;
if(ItemIsNotInEditor(i))
if(item->notineditor)
continue;
if( i == SWITCH || i == ACTION_ITEM )
{
@@ -331,7 +331,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
continue;
}
item = &Item[usCounter];
if(ItemIsNotInEditor(usCounter))
if(item->notineditor)
{
usCounter++;
continue;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITORITEMS_H
+9 -9
View File
@@ -9,23 +9,23 @@
#include "vobject.h"
#include "mousesystem.h"
#include "Button System.h"
#include "WCheck.h"
#include "wcheck.h"
#include "vsurface.h"
#include "line.h"
#include "input.h"
#include "sysutil.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "editscreen.h"
#include "selectwin.h"
#include "video.h"
#include "vobject_blitters.h"
#include "Interface Panels.h"
#include "Interface Items.h"
#include "Utilities.h"
#include "interface panels.h"
#include "interface items.h"
#include "utilities.h"
#include "World Items.h"
#include "worldman.h"
#include "Overhead.h" //GetSoldier
#include "overhead.h" //GetSoldier
#include "renderworld.h"
#include "Animation Data.h"
#include "Animation Control.h"
@@ -37,11 +37,11 @@
#include "Soldier Init List.h"
#include "strategicmap.h"
#include "Soldier Add.h"
#include "soldier profile type.h"
#include "Soldier Profile Type.h"
#include "Soldier Profile.h"
#include "Text Input.h"
#include "random.h"
#include "WordWrap.h"
#include "Random.h"
#include "wordwrap.h"
#include "EditorItems.h"
#include "Editor Taskbar Utils.h"
#include "Exit Grids.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITORMAPINFO_H
+15 -15
View File
@@ -9,24 +9,24 @@
#include "vobject.h"
#include "mousesystem.h"
#include "Button System.h"
#include "WCheck.h"
#include "wcheck.h"
#include "vsurface.h"
#include "line.h"
#include "input.h"
#include "sysutil.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "editscreen.h"
#include "selectwin.h"
#include "video.h"
#include "vobject_blitters.h"
#include "Interface Panels.h"
#include "Interface Items.h"
#include "Text.h"
#include "Utilities.h"
#include "interface panels.h"
#include "interface items.h"
#include "text.h"
#include "utilities.h"
#include "World Items.h"
#include "worldman.h"
#include "Overhead.h" //GetSoldier
#include "overhead.h" //GetSoldier
#include "renderworld.h"
#include "Animation Data.h"
#include "Animation Control.h"
@@ -39,11 +39,11 @@
#include "Soldier Init List.h"
#include "strategicmap.h"
#include "Soldier Add.h"
#include "soldier profile type.h"
#include "Soldier Profile Type.h"
#include "Soldier Profile.h"
#include "Text Input.h"
#include "random.h"
#include "WordWrap.h"
#include "Random.h"
#include "wordwrap.h"
#include "EditorItems.h"
#include "Editor Taskbar Utils.h"
#include "Exit Grids.h"
@@ -162,7 +162,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate );
void RenderMercInventoryPanel();
void SetDroppableCheckboxesBasedOnMercsInventory();
extern BOOLEAN InternalAddSoldierToSector( SoldierID ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode );
extern BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode );
//array which keeps track of which item is in which slot. This is dependant on the selected merc, so
//these temp values must be updated when different mercs are selected, and reset when a merc detailed
@@ -559,7 +559,7 @@ void AddMercToWorld( INT32 iMapIndex )
if( IsLocationSittable( iMapIndex, gfRoofPlacement ) )
{
SoldierID ubID;
UINT8 ubID;
INT16 sSectorX, sSectorY;
SOLDIERINITNODE *pNode;
@@ -629,7 +629,7 @@ void HandleRightClickOnMerc( INT32 iMapIndex )
if ( gsSelectedMercID != sThisMercID )
{ // We want to edit a new merc (or different merc)
//We need to avoid the editing of player mercs.
pNode = FindSoldierInitNodeWithID( sThisMercID );
pNode = FindSoldierInitNodeWithID( (UINT8)sThisMercID );
if( !pNode )
return; //this is a player merc (which isn't in the list), or an error in logic.
IndicateSelectedMerc( sThisMercID );
@@ -1634,7 +1634,7 @@ void IndicateSelectedMerc( INT16 sID )
break;
default:
//search for the merc with the specific ID.
gpSelected = FindSoldierInitNodeWithID( sID );
gpSelected = FindSoldierInitNodeWithID( (UINT8)sID );
if( !gpSelected )
{
gsSelectedMercID = -1;
@@ -3783,7 +3783,7 @@ void PasteMercPlacement( INT32 iMapIndex )
if( IsLocationSittable( iMapIndex, gfRoofPlacement ) )
{
SoldierID ubID;
UINT8 ubID;
INT16 sSectorX, sSectorY;
SOLDIERINITNODE *pNode;
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "builddefines.h"
#include "BuildDefines.h"
//-----------------------------------------------
//
+4 -4
View File
@@ -9,18 +9,18 @@
#include "vobject.h"
#include "mousesystem.h"
#include "Button System.h"
#include "WCheck.h"
#include "wcheck.h"
#include "vsurface.h"
#include "input.h"
#include "sysutil.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "editscreen.h"
#include "selectwin.h"
#include "video.h"
#include "vobject_blitters.h"
#include "Interface Panels.h"
#include "Utilities.h"
#include "interface panels.h"
#include "utilities.h"
#include "World Items.h"
#include "EditorDefines.h"
#include "EditorTerrain.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDITORTERRAIN_H
+3 -3
View File
@@ -7,7 +7,7 @@
#include "types.h"
#include "mousesystem.h"
#include "Button System.h"
#include "Font Control.h"
#include "font control.h"
#include "EditorDefines.h"
#include "Editor Taskbar Utils.h"
#include "EditorMercs.h"
@@ -20,10 +20,10 @@
#include "Weapons.h"
#include "Items.h"
#include "editscreen.h"
#include "random.h"
#include "Random.h"
#include "Handle Items.h"
#include "World Items.h"
#include "popupmenu.h"
#include "PopupMenu.h"
#include "pits.h"
#include "Text.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifndef __ITEM_STATISTICS_H
#define __ITEM_STATISTICS_H
+44 -13
View File
@@ -5,8 +5,8 @@
#include <stdio.h>
#include "Font Control.h"
#include "renderworld.h"
#include "Render Dirty.h"
#include "LoadScreen.h"
#include "render dirty.h"
#include "loadscreen.h"
#include "selectwin.h"
#include "EditorDefines.h"
#include "messagebox.h"
@@ -83,7 +83,9 @@ INT32 iCurrFileShown;
INT32 iLastFileClicked;
INT32 iLastClickTime;
#ifdef USE_VFS
CHAR8 gzProfileName[FILENAME_BUFLEN];//dnl ch81 021213
#endif
CHAR16 gzFilename[FILENAME_BUFLEN];//dnl ch39 190909
extern INT16 gsSelSectorX;
extern INT16 gsSelSectorY;
@@ -163,6 +165,7 @@ void LoadSaveScreenEntry()
}
iTopFileShown = iTotalFiles = 0;
#ifdef USE_VFS//dnl ch37 300909
gzProfileName[0] = 0;//dnl ch81 021213
FDLG_LIST* TempFileList = NULL;
vfs::CProfileStack* st = getVFS()->getProfileStack();
@@ -173,15 +176,7 @@ void LoadSaveScreenEntry()
vfs::CVirtualProfile* prof = it.value();
memset(&FileInfo, 0, sizeof(GETFILESTRUCT));
strcpy(FileInfo.zFileName, "< ");
// Cut filename off if it's too long for the buffer
if (strlen(prof->cName.utf8().c_str()) > FILENAME_BUFLEN-4)
{
strncpy(FileInfo.zFileName+1, prof->cName.utf8().c_str(), FILENAME_BUFLEN-4);
}
else
{
strcat(FileInfo.zFileName, prof->cName.utf8().c_str());
}
strcat(FileInfo.zFileName, prof->cName.utf8().c_str());
strcat(FileInfo.zFileName, " >");
FileInfo.zFileName[FILENAME_BUFLEN] = 0;
FileInfo.uiFileAttribs = FILE_IS_DIRECTORY;
@@ -225,6 +220,25 @@ void LoadSaveScreenEntry()
}
while(FileList->pPrev)
FileList = FileList->pPrev;
#else
if(GetFileFirst("MAPS\\*.dat", &FileInfo))
{
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
{
FileList = AddToFDlgList(FileList, &FileInfo);
iTotalFiles++;
}
while(GetFileNext(&FileInfo))
{
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
{
FileList = AddToFDlgList(FileList, &FileInfo);
iTotalFiles++;
}
}
GetFileClose(&FileInfo);
}
#endif
swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" );
swprintf( gzFilename, L"%S", gubFilename );
@@ -269,8 +283,7 @@ UINT32 ProcessLoadSaveScreenMessageBoxResult()
{
if( gfReadOnly )
{
// Other call sites have replaced this with FileDelete(); for VFS, should we do the same here?
//FileClearAttributes( gszCurrFilename );
FileClearAttributes( gszCurrFilename );
gfReadOnly = FALSE;
}
FileDelete( gszCurrFilename );
@@ -455,6 +468,19 @@ UINT32 LoadSaveScreenHandle(void)
}
sprintf(gszCurrFilename, "MAPS\\%S", gzFilename);
gfFileExists = FALSE;
#ifndef USE_VFS
gfReadOnly = FALSE;
if(FileExists(gszCurrFilename))
{
gfFileExists = TRUE;
if(GetFileFirst(gszCurrFilename, &FileInfo))
{
if(FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY))
gfReadOnly = TRUE;
GetFileClose(&FileInfo);
}
}
#else
gfReadOnly = TRUE;
vfs::CProfileStack* st = getVFS()->getProfileStack();
vfs::CProfileStack::Iterator it = st->begin();
@@ -476,6 +502,7 @@ UINT32 LoadSaveScreenHandle(void)
}
it.next();
}
#endif
if(gfReadOnly)
{
CreateMessageBox(L" File is read only! Choose a different name? ");
@@ -699,6 +726,7 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
iLastClickTime = iCurrClickTime;
iLastFileClicked = x;
//dnl ch81 021213
#ifdef USE_VFS
gzProfileName[0] = 0;
while(FListNode = FListNode->pPrev)
{
@@ -709,6 +737,7 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
break;
}
}
#endif
break;
}
FListNode = FListNode->pNext;
@@ -921,6 +950,7 @@ void HandleMainKeyEvents( InputAtom *pEvent )
SetInputFieldStringWith16BitString(0, L"");
wcscpy(gzFilename, L"");
}
#ifdef USE_VFS
gzProfileName[0] = 0;
while(curr = curr->pPrev)
{
@@ -931,6 +961,7 @@ void HandleMainKeyEvents( InputAtom *pEvent )
break;
}
}
#endif
}
}
}
+5 -3
View File
@@ -1,7 +1,7 @@
#include "builddefines.h"
#include "FileMan.h"
#include "BuildDefines.h"
#include "Fileman.h"
#define FILENAME_BUFLEN (30 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213
#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213
#ifdef JA2EDITOR
@@ -51,7 +51,9 @@ extern CHAR16 gzErrorCatchString[ 256 ];
//dnl ch81 031213
extern CHAR16 gzFilename[FILENAME_BUFLEN];
#ifdef USE_VFS
extern CHAR8 gzProfileName[FILENAME_BUFLEN];
#endif
#endif
#endif
+7 -35
View File
@@ -4,7 +4,7 @@
#include "types.h"
#include "Road Smoothing.h"
#include "TileDat.h"
#include "tiledat.h"
#include "worlddef.h"
#include "worldman.h"
#include "Editor Undo.h"
@@ -403,42 +403,14 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID )
while( gRoadMacros[ i ].sMacroID == iMacroID )
{
// need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size
INT32 sdY = gRoadMacros[ i ].sOffset / (OLD_WORLD_COLS);
INT32 sdX = gRoadMacros[ i ].sOffset - (sdY*OLD_WORLD_COLS);
// Take into account the dfference between old and new row size for tiles that are shifted
// by one row due to X offset
// For example:
// {RBR, 159},
//{ RBR, -159 },
//
// Offsets for 160x160 map
// [] [] [-159]
// [] [0] []
// [159] [] []
//
// Converted to 200x200 map
// [] [] [-199]
// [] [0] []
// [199] [] []
//
// Without this the original conversion would output 159 and -159 for X coordinate
if (sdX < -OLD_WORLD_COLS/2)
{
sdX -= WORLD_COLS - OLD_WORLD_COLS;
}
else if (sdX > OLD_WORLD_COLS / 2)
{
sdX += WORLD_COLS - OLD_WORLD_COLS;
}
INT32 sdX = gRoadMacros[ i ].sOffset % OLD_WORLD_COLS;
INT32 sdY = gRoadMacros[ i ].sOffset / OLD_WORLD_COLS;
INT32 sOffset = sdY*WORLD_COLS + sdX;
INT32 newGridNo = iMapIndex + sOffset;
AddToUndoList( newGridNo );
RemoveAllObjectsOfTypeRange( newGridNo, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES );
//
AddToUndoList( iMapIndex + sOffset );
RemoveAllObjectsOfTypeRange( iMapIndex + sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES );
GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex );
AddObjectToHead( newGridNo, usTileIndex );
AddObjectToHead( iMapIndex + sOffset, usTileIndex );
i++;
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
@@ -61,4 +61,4 @@ void InitializeRoadMacros();
#endif
#endif
#endif
+181 -6
View File
@@ -15,22 +15,22 @@
#include "line.h"
#include "input.h"
#include "vobject_blitters.h"
#include "LoadScreen.h"
#include "loadscreen.h"
#include "Text Input.h"
#include "mousesystem.h"
#include "strategicmap.h"
#include "FileMan.h"
#include "Fileman.h"
#include "Exit Grids.h"
#include "Map Information.h"
#include "Summary Info.h"
#include "Animated ProgressBar.h"
#include "worlddef.h"
#include "WorldDat.h"
#include "worlddat.h"
#include "EditorDefines.h"
#include "editscreen.h"
#include "english.h"
#include "World Items.h"
#include "Text.h"
#include "text.h"
#include "Soldier Create.h"
#include "GameVersion.h"
#include "Campaign Types.h"
@@ -1923,14 +1923,40 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent )
void CreateGlobalSummary()
{
#ifndef USE_VFS
FILE *fp;
STRING512 Dir;
STRING512 ExecDir;
#endif
OutputDebugString( "Generating GlobalSummary Information...\n" );
gfGlobalSummaryExists = FALSE;
//Set current directory to JA2\DevInfo which contains all of the summary data
#ifndef USE_VFS
GetExecutableDirectory( ExecDir );
sprintf( Dir, "%s\\DevInfo", ExecDir );
// Snap: save current directory
//GetFileManCurrentDirectory( DataDir );
//Directory doesn't exist, so create it, and continue.
if( !MakeFileManDirectory( Dir ) )
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
if( !SetFileManCurrentDirectory( Dir ) )
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
//Generate a simple readme file.
fp = fopen( "readme.txt", "w" );
Assert( fp );
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
"This directory or it's contents shouldn't be included with final release." );
fclose( fp );
#else
vfs::COpenWriteFile wfile(L"DevInfo\\readme.txt",true,true);
std::string str = "This information is used in conjunction with the editor.\n";
str += "This directory or it's contents shouldn't be included with final release.\n";
SGP_TRYCATCH_RETHROW( wfile->write(str.c_str(), str.length()), L"" );
#endif
// Snap: Restore the data directory once we are finished.
//SetFileManCurrentDirectory( DataDir );
@@ -2177,8 +2203,7 @@ void SummarySaveMapCallback( GUI_BUTTON *btn, INT32 reason )
{
CHAR8 filename[40];
sprintf( filename, "MAPS\\%S", gszDisplayName );
// Other call sites have replaced this with FileDelete(); for VFS, should we do the same here?
//FileClearAttributes( filename );
FileClearAttributes( filename );
}
if( ExternalSaveMap( gszDisplayName ) )
{
@@ -2256,6 +2281,12 @@ void CalculateOverrideStatus()
void LoadGlobalSummary()
{
HWFILE hfile;
#ifndef USE_VFS
STRING512 DataDir;
STRING512 ExecDir;
STRING512 DevInfoDir;
STRING512 MapsDir;
#endif
UINT32 uiNumBytesRead;
FLOAT dMajorVersion;
INT32 x,y;
@@ -2264,16 +2295,34 @@ void LoadGlobalSummary()
OutputDebugString( "Executing LoadGlobalSummary()...\n" );
// Snap: save current directory
#ifndef USE_VFS
GetFileManCurrentDirectory( DataDir );
#endif
gfMustForceUpdateAllMaps = FALSE;
gusNumberOfMapsToBeForceUpdated = 0;
gfGlobalSummaryExists = FALSE;
//Set current directory to JA2\DevInfo which contains all of the summary data
#ifndef USE_VFS
GetExecutableDirectory( ExecDir );
sprintf( DevInfoDir, "%s\\DevInfo", ExecDir );
sprintf( MapsDir, "%s\\Maps", DataDir );
//Check to make sure we have a DevInfo directory. If we don't create one!
if( !SetFileManCurrentDirectory( DevInfoDir ) )
{
OutputDebugString( "LoadGlobalSummary() aborted -- doesn't exist on this local computer.\n");
return;
}
#endif
//TEMP
#ifndef USE_VFS
FileDelete( "_global.sum" );
#else
if(FileExists("DevInfo\\_global.sum"))
{
FileDelete( "DevInfo\\_global.sum" );
}
#endif
gfGlobalSummaryExists = TRUE;
//Analyse all sectors to see if matching maps exist. For any maps found, the information
@@ -2288,12 +2337,19 @@ void LoadGlobalSummary()
sprintf( szSector, "%c%d", 'A' + y, x + 1 );
//main ground level
#ifndef USE_VFS
sprintf( szFilename, "%c%d.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= GROUND_LEVEL_MASK;
@@ -2303,16 +2359,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s.sum", szSector );
#endif
FileDelete( szFilename );
}
//main B1 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b1.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b1.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK;
@@ -2322,16 +2389,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b1.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b1.sum", szSector );
#endif
FileDelete( szFilename );
}
//main B2 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b2.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b2.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK;
@@ -2341,16 +2419,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b2.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b2.sum", szSector );
#endif
FileDelete( szFilename );
}
//main B3 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b3.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b3.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK;
@@ -2360,16 +2449,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b3.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b3.sum", szSector );
#endif
FileDelete( szFilename );
}
//alternate ground level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_a.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK;
@@ -2379,16 +2479,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_a.sum", szSector );
#endif
FileDelete( szFilename );
}
//alternate B1 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b1_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b1_a.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;
@@ -2398,16 +2509,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b1_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b1_a.sum", szSector );
#endif
FileDelete( szFilename );
}
//alternate B2 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b2_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b2_a.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= ALTERNATE_B2_MASK;
@@ -2417,16 +2539,27 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b2_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b2_a.sum", szSector );
#endif
FileDelete( szFilename );
}
//alternate B3 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b3_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b3_a.dat", 'A' + y, x + 1 );
hfile = NULL;
if(FileExists(szFilename))
{
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
}
#endif
if( hfile )
{
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;;
@@ -2436,12 +2569,20 @@ void LoadGlobalSummary()
}
else
{
#ifndef USE_VFS
sprintf( szFilename, "%s_b3_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b3_a.sum", szSector );
#endif
FileDelete( szFilename );
}
}
OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') );
}
#ifndef USE_VFS
// Snap: Restore the data directory once we are finished.
SetFileManCurrentDirectory( DataDir );
#endif
//sprintf( MapsDir, "%s\\Data", ExecDir );
//SetFileManCurrentDirectory( MapsDir );
@@ -2458,6 +2599,39 @@ void LoadGlobalSummary()
void GenerateSummaryList()
{
#ifndef USE_VFS
FILE *fp;
STRING512 DataDir;
STRING512 ExecDir;
STRING512 Dir;
// Snap: save current directory
GetFileManCurrentDirectory( DataDir );
//Set current directory to JA2\DevInfo which contains all of the summary data
GetExecutableDirectory( ExecDir );
sprintf( Dir, "%s\\DevInfo", ExecDir );
if( !SetFileManCurrentDirectory( Dir ) )
{
//Directory doesn't exist, so create it, and continue.
if( !MakeFileManDirectory( Dir ) )
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
if( !SetFileManCurrentDirectory( Dir ) )
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
//Generate a simple readme file.
fp = fopen( "readme.txt", "w" );
Assert( fp );
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
"This directory or it's contents shouldn't be included with final release." );
fclose( fp );
}
// Snap: Restore the data directory once we are finished.
SetFileManCurrentDirectory( DataDir );
//Set current directory back to data directory!
//sprintf( Dir, "%s\\Data", ExecDir );
//SetFileManCurrentDirectory( Dir );
#else
try
{
vfs::COpenWriteFile wfile(L"DevInfo/readme.txt",true,true);
@@ -2469,6 +2643,7 @@ void GenerateSummaryList()
{
SGP_RETHROW(L"Could not create readme.txt", ex);
}
#endif
}
//dnl ch28 260909
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __SECTOR_SUMMARY_H
@@ -35,4 +35,4 @@ void GetSectorFromFileName(STR16 szFileName, INT16& sSectorX, INT16& sSectorY, I
void ResetCustomFileSectorSummary(void);//dnl ch30 150909
#endif
#endif
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __SMARTMETHOD_H
+2 -2
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __SMOOTHING_UTILS_H
@@ -62,4 +62,4 @@ UINT16 GetHorizontalWallClass( INT32 iMapIndex );
BOOLEAN ValidDecalPlacement( INT32 iMapIndex );
#endif
#endif
#endif
+2 -2
View File
@@ -1,10 +1,10 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __SUMMARY_INFO_H
#define __SUMMARY_INFO_H
#include "types.h"
#include "Types.h"
//dnl ch28
#define GLOBAL_SUMMARY_VERSION 15
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __EDIT_SYS_H
+23 -47
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "builddefines.h"
#ifdef JA2EDITOR
@@ -12,22 +12,22 @@
#include "edit_sys.h"
#include "screenids.h"
#include "editscreen.h"
#include "Sys Globals.h"
#include "sys globals.h"
#include "SmartMethod.h"
#include "selectwin.h"
#include "Interface.h"
#include "lighting.h"
#include "Interactive Tiles.h"
#include "Overhead Types.h"
#include "overhead types.h"
#include "Overhead.h"
#include "Handle UI.h"
#include "Event Pump.h"
#include "world items.h"
#include "LoadScreen.h"
#include "Render Dirty.h"
#include "Isometric Utils.h"
#include "loadscreen.h"
#include "render dirty.h"
#include "isometric utils.h"
#include "message.h"
#include "Render Fun.h"
#include "render fun.h"
#include "popupmenu.h"
#include "overhead map.h"
#include "EditorDefines.h"
@@ -39,7 +39,7 @@
#include "newsmooth.h"
#include "Smoothing Utils.h"
#include "messagebox.h"
#include "MessageBoxScreen.h"
#include "messageboxscreen.h"
#include "Soldier Create.h"
#include "Soldier Init List.h"
#include "Text Input.h"
@@ -59,7 +59,7 @@
#include "line.h"
#include "english.h"
#include "random.h"
#include "Scheduling.h"
#include "scheduling.h"
#include "Road Smoothing.h"
#include "strategicmap.h"
#include "message.h"
@@ -70,7 +70,7 @@
#include "GameSettings.h"
#include "Summary Info.h"
#include "connect.h"//dnl
#include "Cursors.h"//dnl ch2 210909
#include "cursors.h"//dnl ch2 210909
#include "Cursor Control.h"//dnl ch2 210909
#include "maputility.h"//dnl ch49 061009
#include "Text.h"
@@ -79,6 +79,8 @@
class OBJECTTYPE;
class SOLDIERTYPE;
extern CHAR8 *szMusicList[NUM_MUSIC];
BOOLEAN gfCorruptMap = FALSE;
BOOLEAN gfCorruptSchedules = FALSE;
BOOLEAN gfProfileDataLoaded = FALSE;
@@ -167,7 +169,6 @@ LEVELNODE *gCursorNode = NULL;
INT32 gsCursorGridNo;
INT32 giMusicID = 0;
NewMusicList gMusicMode = MUSICLIST_MAIN_MENU;
void EraseWorldData( );
@@ -1069,7 +1070,10 @@ void ShowCurrentDrawingMode( void )
// Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on
usFillColor = GenericButtonFillColors[0];
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf );
if(gbPixelDepth==16)
RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf );
else if(gbPixelDepth==8)
RectangleDraw8( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf );
UnLockVideoSurface( FRAME_BUFFER );
@@ -1612,27 +1616,16 @@ void HandleKeyboardShortcuts( )
break;
case F4:
MusicPlay(gMusicMode, giMusicID);
ScreenMsg( FONT_YELLOW, MSG_INTERFACE, L"%S", MusicLists[gMusicMode][giMusicID] );
#ifdef NEWMUSIC
MusicPlay( giMusicID, MUSIC_OLD_TYPE, FALSE );
#else
MusicPlay( giMusicID );
#endif
// Select next track
ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"%S", szMusicList[giMusicID] );
giMusicID++;
if (giMusicID >= MusicLists[gMusicMode].size())
{
if( giMusicID >= NUM_MUSIC )
giMusicID = 0;
for (size_t i = 0; i < MAX_MUSIC; i++)
{
if (gMusicMode == i)
{
gMusicMode = static_cast<NewMusicList>(i + 1);
if (gMusicMode == MAX_MUSIC)
{
gMusicMode = MUSICLIST_MAIN_MENU;
}
break;
}
}
}
break;
case F5:
@@ -2951,23 +2944,6 @@ UINT32 WaitForSelectionWindowResponse( void )
}
}
// Mousewheel scroll
if (_WheelValue > 0)
{
while (_WheelValue--)
{
ScrollSelWinUp();
}
}
else
{
while (_WheelValue++)
{
ScrollSelWinDown();
}
}
_WheelValue = 0;
if ( DoWindowSelection( ) )
{
fSelectionWindow = FALSE;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef EDITSCREEN_H
+1 -1
View File
@@ -4,7 +4,7 @@
#include "vobject.h"
#include "video.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "messagebox.h"
#include "input.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __MESSAGEBOX_H
+1 -1
View File
@@ -14,7 +14,7 @@
#include "Editor Undo.h"
#include "Structure Internals.h"
#include "environment.h"
#include "random.h"
#include "Random.h"
#include "Render Fun.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __NEWSMOOTH_H
+6 -6
View File
@@ -16,18 +16,18 @@
#include "tiledef.h"
#include "sysutil.h"
#include "Font.h"
#include "font.h"
#include "Font Control.h"
#include "line.h"
#include "WorldDat.h"
#include "worlddat.h"
#include "selectwin.h"
#include "popupmenu.h"
#include "EditorDefines.h"
#include "Render Dirty.h"
#include "DEBUG.H"
#include "render dirty.h"
#include "debug.h"
#include "mousesystem.h"
#include "Cursors.h"
#include "Overhead Types.h"
#include "cursors.h"
#include "overhead types.h"
#include "EditorMercs.h"
#include "Scheduling.h"
#include "english.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
//popupmenu.h
+37 -61
View File
@@ -6,7 +6,7 @@
#include "tiledef.h"
#include "vsurface.h"
#include "WorldDat.h"
#include "worlddat.h"
#include "random.h"
#include "sysutil.h"
#include "Font Control.h"
@@ -29,16 +29,6 @@ extern BOOLEAN fDontUseRandom;
extern UINT16 GenericButtonFillColors[40];
struct SelectionWindow
{
SGPRect window;
SGPPoint displayAreaStart; // Area where selectable items are drawn
SGPPoint displayAreaEnd;
SGPPoint spacing; // For displayed items
};
SelectionWindow gSelection;
BOOLEAN gfRenderSquareArea = FALSE;
INT16 iStartClickX,iStartClickY;
INT16 iEndClickX,iEndClickY;
@@ -50,6 +40,7 @@ INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown,iOkWin;
BOOLEAN fAllDone=FALSE;
BOOLEAN fButtonsPresent=FALSE;
SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint;
//These definitions help define the start and end of the various wall indices.
//This needs to be maintained if the walls change.
@@ -181,30 +172,6 @@ UINT16 SelWinHilightFillColor = 0x23BA; //blue, formerly 0x000d a kind of mediu
//
void CreateJA2SelectionWindow( INT16 sWhat )
{
auto selectWinWidth = 600;
const auto selectWinHeight = SCREEN_HEIGHT - 120; // From top edge to taskbar
if (iResolution > _800x600)
{
selectWinWidth = 900;
}
auto tlX = 0;
auto tlY = 0;
auto brX = tlX + selectWinWidth;
auto brY = tlY + selectWinHeight;
gSelection.window.iLeft = tlX;
gSelection.window.iTop = tlY;
gSelection.window.iRight = brX;
gSelection.window.iBottom = brY;
gSelection.displayAreaStart.iX = tlX + 1;
gSelection.displayAreaStart.iY = tlY + 15;
gSelection.displayAreaEnd.iX = brX - 1;
gSelection.displayAreaEnd.iY= brY - 1;
gSelection.spacing.iX = 2;
gSelection.spacing.iY = 2;
iTopWinCutOff = gSelection.displayAreaStart.iY;
iBotWinCutOff = gSelection.displayAreaEnd.iY;
DisplaySpec *pDSpec;
UINT16 usNSpecs;
@@ -218,33 +185,32 @@ void CreateJA2SelectionWindow( INT16 sWhat )
iButtonIcons[ SEL_WIN_DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" );
iButtonIcons[ SEL_WIN_OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" );
iSelectWin = CreateHotSpot(0, 0, selectWinWidth, selectWinHeight, MSYS_PRIORITY_HIGH,
iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, SelWinClkCallback);
iOkWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_OK_ICON], 0,
BUTTON_USE_DEFAULT, selectWinWidth, 0,
BUTTON_USE_DEFAULT, 600, 0,
40, 40, BUTTON_TOGGLE,
MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, OkClkCallback);
SetButtonFastHelpText(iOkWin,pDisplaySelectionWindowButtonText[0]);
iCancelWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_CANCEL_ICON], 0,
BUTTON_USE_DEFAULT, selectWinWidth, 40,
BUTTON_USE_DEFAULT, 600, 40,
40, 40, BUTTON_TOGGLE,
MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, CnclClkCallback);
SetButtonFastHelpText(iCancelWin,pDisplaySelectionWindowButtonText[1]);
iScrollUp = CreateIconButton((INT16)iButtonIcons[SEL_WIN_UP_ICON], 0,
BUTTON_USE_DEFAULT, selectWinWidth, 80,
BUTTON_USE_DEFAULT, 600, 80,
40, 160, BUTTON_NO_TOGGLE,
MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, UpClkCallback);
SetButtonFastHelpText(iScrollUp,pDisplaySelectionWindowButtonText[2]);
iScrollDown = CreateIconButton((INT16)iButtonIcons[SEL_WIN_DOWN_ICON], 0,
BUTTON_USE_DEFAULT, selectWinWidth, 240,
BUTTON_USE_DEFAULT, 600, 240,
40, 160, BUTTON_NO_TOGGLE,
MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, DwnClkCallback);
@@ -252,6 +218,18 @@ void CreateJA2SelectionWindow( INT16 sWhat )
fButtonsPresent = TRUE;
SelWinSpacing.iX = 2;
SelWinSpacing.iY = 2;
SelWinStartPoint.iX = 1;
SelWinStartPoint.iY = 15;
iTopWinCutOff = 15;
SelWinEndPoint.iX = 599;
SelWinEndPoint.iY = 359;
iBotWinCutOff = 359;
switch( sWhat )
{
@@ -369,8 +347,8 @@ void CreateJA2SelectionWindow( INT16 sWhat )
return;
}
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &gSelection.displayAreaStart , &gSelection.displayAreaEnd,
&gSelection.spacing, CLEAR_BACKGROUND);
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint,
&SelWinSpacing, CLEAR_BACKGROUND);
}
@@ -871,14 +849,12 @@ void RenderSelectionWindow( void )
return;
ColorFillVideoSurfaceArea(FRAME_BUFFER,
gSelection.window.iLeft, gSelection.window.iTop, gSelection.window.iRight, gSelection.window.iBottom,
GenericButtonFillColors[0]
);
0, 0, 600, 400,
GenericButtonFillColors[0]);
DrawSelections( );
MarkButtonsDirty();
RenderButtons( );
// Draw selection rectangle
if ( gfRenderSquareArea )
{
button = ButtonList[iSelectWin];
@@ -886,7 +862,7 @@ void RenderSelectionWindow( void )
return;
if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) ||
(abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY)) > 9) )
(abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) )
{
// iSX = (INT32)iStartClickX;
// iEX = (INT32)button->Area.MouseXPos;
@@ -894,7 +870,7 @@ void RenderSelectionWindow( void )
// iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY);
iSX = iStartClickX;
iSY = iStartClickY - iTopWinCutOff + gSelection.displayAreaStart.iY;
iSY = iStartClickY - iTopWinCutOff + SelWinStartPoint.iY;
iEX = gusMouseXPos;
iEY = gusMouseYPos;
@@ -913,10 +889,10 @@ void RenderSelectionWindow( void )
iEY ^= iSY;
}
iEX = min( gSelection.displayAreaEnd.iX, iEX);
iSY = max( gSelection.displayAreaStart.iY, iSY );
iEY = min( gSelection.displayAreaEnd.iY, iEY );
iEY = max( gSelection.displayAreaStart.iY, iEY );
iEX = min( iEX, 600 );
iSY = max( SelWinStartPoint.iY, iSY );
iEY = min( 359, iEY );
iEY = max( SelWinStartPoint.iY, iEY );
usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0));
usFillGreen += usDir;
@@ -952,7 +928,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason )
return;
iClickX = button->Area.MouseXPos;
iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY;
iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY;
if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN)
{
@@ -1059,9 +1035,9 @@ void DisplaySelectionWindowGraphicalInformation()
UINT16 y;
//Determine if there is a valid picture at cursor position.
//iRelX = gusMouseXPos;
//iRelY = gusMouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY;
//iRelY = gusMouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY;
y = gusMouseYPos + iTopWinCutOff - (UINT16)gSelection.displayAreaStart.iY;
y = gusMouseYPos + iTopWinCutOff - (UINT16)SelWinStartPoint.iY;
pNode = pDispList;
fDone = FALSE;
while( (pNode != NULL) && !fDone )
@@ -1494,10 +1470,10 @@ void DrawSelections( void )
{
SGPRect ClipRect, NewRect;
NewRect.iLeft = gSelection.displayAreaStart.iX;
NewRect.iTop = gSelection.displayAreaStart.iY;
NewRect.iRight = gSelection.displayAreaEnd.iX;
NewRect.iBottom = gSelection.displayAreaEnd.iY;
NewRect.iLeft = SelWinStartPoint.iX;
NewRect.iTop = SelWinStartPoint.iY;
NewRect.iRight = SelWinEndPoint.iX;
NewRect.iBottom = SelWinEndPoint.iY;
GetClippingRect(&ClipRect);
SetClippingRect(&NewRect);
@@ -1507,7 +1483,7 @@ void DrawSelections( void )
SetObjectShade( gvoLargeFontType1, 0 );
// SetObjectShade( gvoLargeFont, 0 );
DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &gSelection.displayAreaStart, CLEAR_BACKGROUND );
DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND );
SetObjectShade( gvoLargeFontType1, 4 );
+2 -2
View File
@@ -1,10 +1,10 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef _SELECTION_WIN_H_
#define _SELECTION_WIN_H_
#include "types.h"
#include "Types.h"
#include "vobject.h"
#include "mousesystem.h"
+3 -3
View File
@@ -5,15 +5,15 @@
#include "stdlib.h"
#include "FileMan.h"
#include "time.h"
#include "DEBUG.H"
#include "debug.h"
#include "tiledef.h"
#include "worlddef.h"
#include "worldman.h"
#include "smooth.h"
#include "editscreen.h"
#include "selectwin.h"
#include "Isometric Utils.h"
#include "Structure Wrap.h"
#include "isometric utils.h"
#include "structure wrap.h"
#include "Exit Grids.h"
#include "Editor Undo.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "builddefines.h"
#include "BuildDefines.h"
#ifdef JA2EDITOR
#ifndef __SMOOTH_H
+11 -7
View File
@@ -1,12 +1,12 @@
#include "sgp.h"
#include "screenids.h"
#include "Timer Control.h"
#include "Sys Globals.h"
#include "Fade Screen.h"
#include "sys globals.h"
#include "fade screen.h"
#include "sysutil.h"
#include "vobject_blitters.h"
#include "Cursor Control.h"
#include "Music Control.h"
#include "cursor control.h"
#include "music control.h"
#include "Render Dirty.h"
#include "gameloop.h"
@@ -681,9 +681,13 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void)
pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
if(gbPixelDepth==16)
{
// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
}
UnLockVideoSurface(FRAME_BUFFER);
UnLockVideoSurface(guiSAVEBUFFER);
+1 -1
View File
@@ -37,4 +37,4 @@ BOOLEAN HandleFadeInCallback( );
void FadeInNextFrame( );
void FadeOutNextFrame( );
#endif
#endif
+11 -10
View File
@@ -1,6 +1,6 @@
#include "types.h"
#include "Types.h"
#include "FeaturesScreen.h"
#include "video.h"
#include "Video.h"
#include "Font Control.h"
#include "Game Clock.h"
#include "Text Input.h"
@@ -10,29 +10,30 @@
#include "WordWrap.h"
#include "WCheck.h"
#include "Utilities.h"
#include "DEBUG.H"
#include "Debug.h"
#include "Sound Control.h"
#include "Ambient Control.h"
#include "WorldDat.h"
#include "worlddef.h"
#include "Worlddat.h"
#include "Worlddef.h"
#include "GameSettings.h"
#include "Game Init.h"
#include "english.h"
#include "English.h"
#include "Overhead.h"
#include "GAP.H"
#include "Gap.h"
#include "Cursors.h"
#include "sysutil.h"
#include "SysUtil.h"
#include "Exit Grids.h"
#include "Text.h"
#include "Interface Control.h"
#include "message.h"
#include "Message.h"
#include "Language Defines.h"
#include "Multi Language Graphic Utils.h"
#include "Map Information.h"
#include "Sys Globals.h"
#include "insurance.h"
#include "connect.h"
#include "worldman.h"
#include "WorldMan.h"
#include "Init.h"
#include "Game Events.h"
@@ -1,19 +1,19 @@
#include "types.h"
#include "Types.h"
#include "GameInitOptionsScreen.h"
#include "GameSettings.h"
#include "Utilities.h"
#include "WCheck.h"
#include "wCheck.h"
#include "Font Control.h"
#include "WordWrap.h"
#include "Render Dirty.h"
#include "input.h"
#include "Input.h"
#include "Options Screen.h"
#include "english.h"
#include "sysutil.h"
#include "English.h"
#include "Sysutil.h"
#include "Fade Screen.h"
#include "Cursor Control.h"
#include "Music Control.h"
#include "Cursors.h"
#include "cursors.h"
#include "Intro.h"
#include "Text.h"
#include "_Ja25EnglishText.h"
@@ -21,7 +21,7 @@
#include "gameloop.h"
#include "connect.h"
#include "SaveLoadScreen.h"
#include "saveloadscreen.h"
#ifdef JA2UB
#include "ub_config.h"
@@ -1830,7 +1830,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
UINT8 maxSquadSize = GIO_SQUAD_SIZE_10;
if (iResolution >= _800x600 && iResolution < _1280x720)
if (iResolution >= _800x600 && iResolution < _1024x768)
maxSquadSize = GIO_SQUAD_SIZE_8;
if ( iCurrentSquadSize < maxSquadSize )
@@ -1850,7 +1850,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
btn->uiFlags|=(BUTTON_CLICKED_ON);
UINT8 maxSquadSize = GIO_SQUAD_SIZE_10;
if (iResolution >= _800x600 && iResolution < _1280x720 )
if (iResolution >= _800x600 && iResolution < _1024x768)
maxSquadSize = GIO_SQUAD_SIZE_8;
if ( iCurrentSquadSize < maxSquadSize )
@@ -85,7 +85,7 @@ typedef struct
UINT8 usLevelModifierLowLimit;
UINT8 usLevelModifierHighLimit;
BOOLEAN bAllowUnrestrictedXPLevels;
UINT8 bQueenLosingControlOfSector;
BOOLEAN bQueenLosingControlOfSector;
BOOLEAN bBloodcatAmbush;
BOOLEAN bAirRaidLookForDive;
UINT32 iGetNumberOfTurnsPowerGenFanWillBeStoppedFor; //UB
+38 -52
View File
@@ -1,7 +1,7 @@
#include "types.h"
#include "Types.h"
#include "GameSettings.h"
#include "FileMan.h"
#include "string.h"
#include "String.h"
#include "Sound Control.h"
#include "SaveLoadScreen.h"
#include "Music Control.h"
@@ -9,19 +9,20 @@
#include "Overhead.h"
#include "GameVersion.h"
#include "LibraryDataBase.h"
#include "DEBUG.H"
#include "Debug.h"
#include "Language Defines.h"
#include "HelpScreen.h"
#include "INIReader.h"
#include "Shade Table Util.h"
#include "soldier profile type.h"
#include "random.h"
#include "Random.h"
#include "SaveLoadGame.h"
#include "sgp.h"
#include "screenids.h"
#include "Font Control.h"
#include "message.h"
#include "Campaign.h"
#include "Meanwhile.h"
#include "meanwhile.h"
#include "strategicmap.h"
#include "Queen Command.h"
#include "Game Clock.h"
@@ -44,7 +45,7 @@
#include <vfs/Core/vfs_file_raii.h>
#include <vfs/Core/File/vfs_file.h>
#define GAME_SETTINGS_FILE "Ja2_Settings.ini"
#define GAME_SETTINGS_FILE "Ja2_Settings.INI"
#define FEATURE_FLAGS_FILE "Ja2_Features.ini"
@@ -279,23 +280,23 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[TOPTION_BLOOD_N_GORE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_BLOOD_N_GORE" , TRUE );
gGameSettings.fOptions[TOPTION_DONT_MOVE_MOUSE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_DONT_MOVE_MOUSE" , FALSE );
gGameSettings.fOptions[TOPTION_OLD_SELECTION_METHOD] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_OLD_SELECTION_METHOD" , FALSE );
gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALWAYS_SHOW_MOVEMENT_PATH" , TRUE );
gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALWAYS_SHOW_MOVEMENT_PATH" , FALSE );
gGameSettings.fOptions[TOPTION_SHOW_MISSES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SHOW_MISSES" , FALSE );
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" , 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_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 );
gGameSettings.fOptions[TOPTION_TOGGLE_TREE_TOPS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_TOGGLE_TREE_TOPS" , TRUE );
gGameSettings.fOptions[TOPTION_SMART_TREE_TOPS] = iniReader.ReadBoolean("JA2 Game Settings", "TOPTION_SMART_TREE_TOPS" , TRUE );
gGameSettings.fOptions[TOPTION_SMART_TREE_TOPS] = iniReader.ReadBoolean("JA2 Game Settings", "TOPTION_SMART_TREE_TOPS" , FALSE );
gGameSettings.fOptions[TOPTION_TOGGLE_WIREFRAME] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_TOGGLE_WIREFRAME" , TRUE );
gGameSettings.fOptions[TOPTION_3D_CURSOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_3D_CURSOR" , FALSE );
gGameSettings.fOptions[TOPTION_CTH_CURSOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_CTH_CURSOR" , TRUE );
gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_GL_BURST_CURSOR" , TRUE );
gGameSettings.fOptions[TOPTION_ALLOW_TAUNTS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALLOW_TAUNTS" , TRUE ); // changed from drop all - SANDRO
gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_GL_HIGH_ANGLE" , TRUE );
gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_GL_HIGH_ANGLE" , FALSE );
if (!is_networked)
gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALLOW_REAL_TIME_SNEAK" , FALSE ); // Changed from aim levels restriction - SANDRO
@@ -305,7 +306,7 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[TOPTION_SPACE_SELECTS_NEXT_SQUAD] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SPACE_SELECTS_NEXT_SQUAD" , TRUE );
gGameSettings.fOptions[TOPTION_SHOW_ITEM_SHADOW] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SHOW_ITEM_SHADOW" , TRUE );
gGameSettings.fOptions[TOPTION_SHOW_WEAPON_RANGE_IN_TILES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SHOW_WEAPON_RANGE_IN_TILES" , TRUE );
gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_TRACERS_FOR_SINGLE_FIRE" , TRUE );
gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_TRACERS_FOR_SINGLE_FIRE" , FALSE );
gGameSettings.fOptions[TOPTION_RAIN_SOUND] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_RAIN_SOUND" , TRUE );
if (!is_networked)
@@ -332,12 +333,12 @@ 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" , TRUE); // Start at max aiming level instead of default no aiming
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" , FALSE ); // Flugente: mercenary formations
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
gGameSettings.fOptions[TOPTION_USE_LOGICAL_BODYTYPES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_USE_LOGICAL_BODYTYPES" , TRUE );
gGameSettings.fOptions[TOPTION_USE_LOGICAL_BODYTYPES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_USE_LOGICAL_BODYTYPES" , FALSE );
gGameSettings.fOptions[TOPTION_ALT_MAP_COLOR] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALT_MAP_COLOR" , FALSE ); // HEADROCK HAM 4: Strategic Map Colors
gGameSettings.fOptions[TOPTION_ALTERNATE_BULLET_GRAPHICS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ALTERNATE_BULLET_GRAPHICS" , TRUE );
gGameSettings.fOptions[TOPTION_SHOW_MERC_RANKS] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_SHOW_MERC_RANKS" , FALSE );
@@ -357,13 +358,13 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[NUM_GAME_OPTIONS] = iniReader.ReadBoolean("JA2 Game Settings","NUM_GAME_OPTIONS" , FALSE );
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" , TRUE );
gGameSettings.fOptions[TOPTION_DISABLE_CURSOR_SWAP] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_DISABLE_CURSOR_SWAP" , FALSE );
gGameSettings.fOptions[TOPTION_QUIET_TRAINING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_TRAINING" , FALSE );
gGameSettings.fOptions[TOPTION_QUIET_REPAIRING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_REPAIRING" , FALSE );
gGameSettings.fOptions[TOPTION_QUIET_DOCTORING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_DOCTORING" , FALSE );
if (!is_networked)
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_AUTO_FAST_FORWARD_MODE" , TRUE );
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_AUTO_FAST_FORWARD_MODE" , FALSE );
else
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = FALSE;
@@ -776,17 +777,17 @@ void InitGameSettings()
gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = TRUE;
gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] = FALSE;
gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] = FALSE;
gGameSettings.fOptions[ TOPTION_ALWAYS_SHOW_MOVEMENT_PATH ] = TRUE;
gGameSettings.fOptions[ TOPTION_ALWAYS_SHOW_MOVEMENT_PATH ] = FALSE;
gGameSettings.fOptions[ TOPTION_SHOW_MISSES ] = FALSE;
gGameSettings.fOptions[ TOPTION_RTCONFIRM ] = FALSE;
gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] = FALSE;
gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] = TRUE;
gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] = TRUE;
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;
gGameSettings.fOptions[ TOPTION_TOGGLE_TREE_TOPS ] = TRUE;
gGameSettings.fOptions[ TOPTION_SMART_TREE_TOPS ] = TRUE;
gGameSettings.fOptions[ TOPTION_SMART_TREE_TOPS ] = FALSE;
gGameSettings.fOptions[ TOPTION_TOGGLE_WIREFRAME ] = TRUE;
gGameSettings.fOptions[ TOPTION_3D_CURSOR ] = FALSE;
gGameSettings.fOptions[ TOPTION_CTH_CURSOR ] = TRUE;
@@ -794,14 +795,14 @@ void InitGameSettings()
//Madd:
gGameSettings.fOptions[ TOPTION_GL_BURST_CURSOR ] = TRUE;
gGameSettings.fOptions[ TOPTION_ALLOW_TAUNTS ] = TRUE; // changed - SANDRO
gGameSettings.fOptions[ TOPTION_GL_HIGH_ANGLE ] = TRUE;
gGameSettings.fOptions[ TOPTION_GL_HIGH_ANGLE ] = FALSE;
gGameSettings.fOptions[ TOPTION_ALLOW_REAL_TIME_SNEAK ] = FALSE; // changed - SANDRO
//lalien
gGameSettings.fOptions[ TOPTION_SPACE_SELECTS_NEXT_SQUAD ] = TRUE;
gGameSettings.fOptions[ TOPTION_SHOW_ITEM_SHADOW ] = TRUE;
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] = TRUE;
gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ] = TRUE;
gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ] = FALSE;
gGameSettings.fOptions[ TOPTION_RAIN_SOUND ] = TRUE;
gGameSettings.fOptions[ TOPTION_ALLOW_CROWS ] = TRUE;
gGameSettings.fOptions[ TOPTION_ALLOW_SOLDIER_TOOLTIPS ] = TRUE;
@@ -827,14 +828,14 @@ void InitGameSettings()
gGameSettings.fOptions[ TOPTION_REPORT_MISS_MARGIN ] = FALSE;
// BIO
gGameSettings.fOptions[ TOPTION_USE_LOGICAL_BODYTYPES ] = TRUE;
gGameSettings.fOptions[ TOPTION_USE_LOGICAL_BODYTYPES ] = FALSE;
gGameSettings.fOptions[ TOPTION_DISABLE_CURSOR_SWAP ] = TRUE;
gGameSettings.fOptions[ TOPTION_DISABLE_CURSOR_SWAP ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_TRAINING ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_REPAIRING ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_DOCTORING ] = FALSE;
gGameSettings.fOptions[ TOPTION_AUTO_FAST_FORWARD_MODE ] = TRUE;
gGameSettings.fOptions[ TOPTION_AUTO_FAST_FORWARD_MODE ] = FALSE;
gGameSettings.fOptions[ TOPTION_ZOMBIES ] = FALSE; // Flugente Zombies
@@ -846,7 +847,7 @@ void InitGameSettings()
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_ALT_START_AIM] = TRUE;
gGameSettings.fOptions[TOPTION_ALT_START_AIM] = FALSE;
gGameSettings.fOptions[TOPTION_ALT_PATHFINDING] = FALSE;
// arynn: Cheat/Debug Menu
@@ -991,17 +992,9 @@ void LoadGameExternalOptions()
//Madd: set number of pItem files to be used
gGameExternalOptions.ubNumPItems = iniReader.ReadInteger("Data File Settings","NUM_P_ITEMS", 3, 3, MAX_PITEMS);
//################# Backgrounds #################
// Flugente: backgrounds
gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Backgrounds", "ENABLE_BACKGROUNDS", TRUE );
// Kitty: show additional IMP backgrounds and determine which IMP backgrounds are available at selection based on choices for skills, chararcter traits and disabilities
gGameExternalOptions.fAltIMPCreation = iniReader.ReadBoolean("Backgrounds", "ALTERNATIVE_IMP_CREATION", FALSE);
// Kitty: only show additional IMP backgrounds enabled by AlternativeImpCreation (same rules which are shown as with AlternativeImpCreation)
gGameExternalOptions.fReducedIMPCreation = iniReader.ReadBoolean("Backgrounds", "REDUCED_IMP_CREATION", FALSE);
gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Data File Settings", "BACKGROUNDS", TRUE );
//################# Merc Recruitment Settings #################
// silversurfer: read early recruitment options 1=immediately (control Omerta), 2=early (control 1, 2, 3 towns including Omerta)
@@ -1192,12 +1185,6 @@ void LoadGameExternalOptions()
// Flugente: additional decals on objects (cracked walls, blood spatters etc.)
gGameExternalOptions.fAdditionalDecals = iniReader.ReadBoolean( "Graphics Settings", "ADDITIONAL_DECALS", FALSE );
// anv: map color variants
gGameExternalOptions.ubRadarMapModeDay = iniReader.ReadInteger("Graphics Settings", "RADAR_MAP_MODE_DAY", 0, 0, 2);
gGameExternalOptions.ubRadarMapModeNight = iniReader.ReadInteger("Graphics Settings", "RADAR_MAP_MODE_NIGHT", 3, 0, 3);
gGameExternalOptions.ubOverheadMapModeDay = iniReader.ReadInteger("Graphics Settings", "OVERHEAD_MAP_MODE_DAY", 0, 0, 2);
gGameExternalOptions.ubOverheadMapModeNight = iniReader.ReadInteger("Graphics Settings", "OVERHEAD_MAP_MODE_NIGHT", 0, 0, 3);
//################# Sound Settings #################
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/);
@@ -1679,9 +1666,6 @@ void LoadGameExternalOptions()
//JMich.BackpackClimb
gGameExternalOptions.sBackpackWeightToClimb = iniReader.ReadInteger("Tactical Gameplay Settings", "MAX_BACKPACK_WEIGHT_TO_CLIMB", -1);
gGameExternalOptions.fUseGlobalBackpackSettings = iniReader.ReadBoolean("Tactical Gameplay Settings", "USE_GLOBAL_BACKPACK_SETTINGS", TRUE);
// Buscher
gGameExternalOptions.ubBackPackWeightFactorForAPPenalty = iniReader.ReadInteger("Tactical Gameplay Settings", "BACKPACK_WEIGHT_FACTOR", 50, 1, 250);
// sevenfm
gGameExternalOptions.fShowEnemyWeapon = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_WEAPON", FALSE);
@@ -2001,7 +1985,6 @@ void LoadGameExternalOptions()
gGameExternalOptions.fFoodDecayInSectors = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_DECAY_IN_SECTORS", TRUE);
gGameExternalOptions.sFoodDecayModificator = iniReader.ReadFloat("Tactical Food Settings", "FOOD_DECAY_MODIFICATOR", 1.0f, 0.1f, 10.0f);
gGameExternalOptions.fFoodEatingSounds = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_EATING_SOUNDS", TRUE);
gGameExternalOptions.fAlwaysFood = iniReader.ReadBoolean("Tactical Food Settings", "ALWAYS_FOOD", FALSE);
//################# Disease Settings ##################
gGameExternalOptions.fDisease = iniReader.ReadBoolean( "Disease Settings", "DISEASE", FALSE );
@@ -2101,6 +2084,9 @@ void LoadGameExternalOptions()
//################# Strategic Gameplay Settings ##################
// Allow enemy and militia Strategic Groups to reinforce one another for battles?
// silversurfer: Obsolete. This is now in DifficultySettings.xml and will be set during InitNewGame().
gGameExternalOptions.gfAllowReinforcements = TRUE;
// Allow reinforcements only between City sectors?
gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("Strategic Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",FALSE);
@@ -2602,7 +2588,7 @@ void LoadSkillTraitsExternalSettings()
gSkillTraitValues.ubNumberOfMajorTraitsAllowed = iniReader.ReadInteger( "Generic Traits Settings", "NUMBER_OF_MAJOR_TRAITS_ALLOWED", 3, 2, gSkillTraitValues.ubMaxNumberOfTraits - 1);
gSkillTraitValues.ubMaxNumberOfTraitsForIMP = iniReader.ReadInteger("Generic Traits Settings","MAX_NUMBER_OF_TRAITS_FOR_IMP", 3, 2, 30);
gSkillTraitValues.ubNumberOfMajorTraitsAllowedForIMP = iniReader.ReadInteger( "Generic Traits Settings", "NUMBER_OF_MAJOR_TRAITS_ALLOWED_FOR_IMP", 2, 2, min( gSkillTraitValues.ubNumberOfMajorTraitsAllowed, gSkillTraitValues.ubMaxNumberOfTraitsForIMP ) );
gSkillTraitValues.ubNumberOfMajorTraitsAllowedForIMP = iniReader.ReadInteger( "Generic Traits Settings", "NUMBER_OF_MAJOR_TRAITS_ALLOWED_FOR_IMP", 2, 2, min( gSkillTraitValues.ubNumberOfMajorTraitsAllowed, gSkillTraitValues.ubMaxNumberOfTraitsForIMP - 1 ) );
// Allow an exception in number of traits for Special Merc?
//gSkillTraitValues.fAllowSpecialMercTraitsException = iniReader.ReadBoolean("Generic Traits Settings","ALLOW_EXCEPTION_FOR_SPECIAL_MERC", TRUE);
@@ -2895,7 +2881,7 @@ void LoadSkillTraitsExternalSettings()
gSkillTraitValues.fSNTSnitchLeadershipBonusModifer = iniReader.ReadFloat("Snitch","SNITCH_LEADERSHIP_BONUS_MODIFIER", 0.5, 0.0, 10.0);
gSkillTraitValues.bSNTSociableMercBonus = iniReader.ReadInteger("Snitch","SOCIABLE_MERC_BONUS", 10, -100, 100);
gSkillTraitValues.bSNTLonerMercBonus = iniReader.ReadInteger("Snitch","LONER_MERC_BONUS", -10, -100, 100);
gSkillTraitValues.bSNTSameAssignmentBonus = iniReader.ReadInteger("Snitch","SAME_ASSIGNMENT_BONUS", -20, -100, 100);
gSkillTraitValues.bSNTSameAssignmentBonus = iniReader.ReadInteger("Snitch","LONER_MERC_BONUS", -20, -100, 100);
gSkillTraitValues.bSNTMercOpinionAboutMercTreshold = iniReader.ReadInteger("Snitch","MERC_OPINION_ABOUT_MERC_TRESHOLD", -10, -25, 25);
gSkillTraitValues.ubSNTPassiveReputationGain = iniReader.ReadInteger("Snitch","PASSIVE_REPUTATION_GAIN", 3, 0, 100);
@@ -3611,10 +3597,10 @@ void LoadGameAPBPConstants()
APBPConstants[BP_CRAWL_ENERGYCOSTFACTOR] = iniReader.ReadInteger("BPConstants","BP_CRAWL_ENERGYCOSTFACTOR",4);
APBPConstants[BP_RADIO] = iniReader.ReadInteger("BPConstants","BP_RADIO",0);
APBPConstants[BP_USE_DETONATOR] = iniReader.ReadInteger("BPConstants","BP_USE_DETONATOR",0);
APBPConstants[BP_PER_AP_NO_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("BPConstants","BP_PER_AP_NO_EFFORT",-50),-50, TRUE);
APBPConstants[BP_PER_AP_MIN_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("BPConstants","BP_PER_AP_MIN_EFFORT",-25),-25, TRUE);
APBPConstants[BP_PER_AP_LT_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("BPConstants","BP_PER_AP_LT_EFFORT",-12),-12, TRUE);
APBPConstants[BP_PER_AP_MOD_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("BPConstants","BP_PER_AP_MOD_EFFORT",0),0, TRUE);
APBPConstants[BP_PER_AP_NO_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","BP_PER_AP_NO_EFFORT",-50),-50, TRUE);
APBPConstants[BP_PER_AP_MIN_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","BP_PER_AP_MIN_EFFORT",-25),-25, TRUE);
APBPConstants[BP_PER_AP_LT_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","BP_PER_AP_LT_EFFORT",-12),-12, TRUE);
APBPConstants[BP_PER_AP_MOD_EFFORT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","BP_PER_AP_MOD_EFFORT",0),0, TRUE);
APBPConstants[BP_MOVEMENT_FLAT] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_FLAT",5);
APBPConstants[BP_MOVEMENT_GRASS] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_GRASS",10);
APBPConstants[BP_MOVEMENT_BUSH] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_BUSH",20);
@@ -3794,7 +3780,7 @@ void LoadCTHConstants()
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_WIS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_WIS",1.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AGI = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AGI",1.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_EXP_LEVEL = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_EXP_LEVEL",2.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_TRACER_BONUS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_TRACER_BONUS",10.0, -1000.0, 1000.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_ANTICIPATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_ANTICIPATION",25.0, -1000.0, 1000.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_COMPENSATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_COMPENSATION",2.0, 0.0, 5.0);
+1 -18
View File
@@ -1,7 +1,7 @@
#ifndef _GAME_SETTINGS__H_
#define _GAME_SETTINGS__H_
#include "types.h"
#include "Types.h"
#include "Strategic Status.h"
#include "Morale.h"
#include "GameInitOptionsScreen.h"
@@ -337,7 +337,6 @@ BOOLEAN UsingBackGroundSystem();
BOOLEAN UsingImprovedInterruptSystem();
BOOLEAN UsingInventoryCostsAPSystem();
BOOLEAN IsNIVModeValid(bool checkRes = true);
// Snap: Options read from an INI file in the default of custom Data directory
@@ -506,7 +505,6 @@ typedef struct
FLOAT sFoodDecayModificator;
BOOLEAN fFoodEatingSounds;
BOOLEAN fAlwaysFood;
// Flugente: disease settings
BOOLEAN fDisease;
@@ -954,12 +952,6 @@ typedef struct
BOOLEAN fAdditionalDecals; // Flugente: show additional decals on objects (cracked walls, blood spatters etc.)
// anv: map color variants
UINT8 ubRadarMapModeDay;
UINT8 ubRadarMapModeNight;
UINT8 ubOverheadMapModeDay;
UINT8 ubOverheadMapModeNight;
//enable ext mouse key
BOOLEAN bAltAimEnabled;
BOOLEAN bAimedBurstEnabled;
@@ -1361,9 +1353,6 @@ typedef struct
INT16 sBackpackWeightToClimb;
BOOLEAN fUseGlobalBackpackSettings;
// Buscher
UINT8 ubBackPackWeightFactorForAPPenalty;
// sevenfm: show enemy weapon above soldier in tactical
BOOLEAN fShowEnemyWeapon;
BOOLEAN fShowEnemyExtendedInfo;
@@ -1563,12 +1552,6 @@ typedef struct
// Flugente: backgrounds
BOOLEAN fBackGround;
// Kitty: Alternative IMP Creation (choices in skills/char-traits/disabilities determine available backgrounds, plus additional available backgrounds)
BOOLEAN fAltIMPCreation;
// Kitty: Reduced IMP Backgrounds (same as fAltIMPCreation, but for this only the additional backgrounds)
BOOLEAN fReducedIMPCreation;
// Sandro: Alternative weapon holding (rifles fired from hip / pistols fired one-handed)
UINT8 ubAllowAlternativeWeaponHolding;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "types.h"
#include "Types.h"
#include "GameVersion.h"
//
+1 -3
View File
@@ -23,8 +23,6 @@ extern CHAR16 zBuildInformation[256];
// Keeps track of the saved game version. Increment the saved game version whenever
// you will invalidate the saved game file
#define INCREASED_TEAMSIZES 186 // Asdow: SOLDIERTYPE ubID changed from UINT8 -> UINT16
#define MERC_PROFILE_INSERTION_DATA 185 // Bigmap support for AddProfileToMap function
#define GROWTH_MODIFIERS 184
#define REBELCOMMAND 183
#define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us
@@ -107,7 +105,7 @@ extern CHAR16 zBuildInformation[256];
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
#define SAVE_GAME_VERSION INCREASED_TEAMSIZES
#define SAVE_GAME_VERSION GROWTH_MODIFIERS
//#define RUSSIANGOLD
#ifdef __cplusplus
+7 -7
View File
@@ -1,19 +1,19 @@
#include "sgp.h"
#include "sysutil.h"
#include "vobject_blitters.h"
#include "WCheck.h"
#include "Cursors.h"
#include "Font Control.h"
#include "Cursor Control.h"
#include "Render Dirty.h"
#include "wcheck.h"
#include "cursors.h"
#include "font control.h"
#include "cursor control.h"
#include "render dirty.h"
#include "Text.h"
#include "Utilities.h"
#include "WordWrap.h"
#include "Font Control.h"
#include "Text.h"
#include "text.h"
#include "HelpScreen.h"
#include "HelpScreenText.h"
#include "line.h"
#include "Line.h"
#include "Game Clock.h"
#include "GameSettings.h"
#include "laptop.h"
+1 -1
View File
@@ -72,4 +72,4 @@ void NewScreenSoResetHelpScreen( );
INT8 HelpScreenDetermineWhichMapScreenHelpToShow();
#endif
#endif
+125 -96
View File
@@ -1,7 +1,7 @@
#include "builddefines.h"
#include <stdio.h>
#include "sgp.h"
#include "gameloop.h"
#include "Gameloop.h"
#include "Screens.h"
#include "INIReader.h"
#include "vobject_blitters.h"
@@ -10,7 +10,7 @@
#include "sysutil.h"
#include "worlddef.h"
#include "Animation Data.h"
#include "Overhead.h"
#include "overhead.h"
#include "Font Control.h"
#include "Button System.h"
#include "Timer Control.h"
@@ -21,20 +21,21 @@
#include "Event Pump.h"
#include "lighting.h"
#include "Cursor Control.h"
#include "Music Control.h"
#include "music control.h"
#include "video.h"
#include "mapscreen.h"
#include "Interface Items.h"
#include "maputility.h"
#include "interface items.h"
#include "Maputility.h"
#include "strategic.h"
#include "Dialogue Control.h"
#include "dialogue control.h"
#include "Text.h"
#include "laptop.h"
#include "NPC.h"
#include "MercTextBox.h"
#include "Tile Cache.h"
#include "tile cache.h"
#include "strategicmap.h"
#include "Map Information.h"
#include "laptop.h"
#include "Shade Table Util.h"
#include "Exit Grids.h"
#include "Summary Info.h"
@@ -44,13 +45,12 @@
#include "jascreens.h"
#include "XML.h"
#include "SaveLoadGame.h"
#include "Weapons.h"
#include "weapons.h"
#include "Strategic Movement.h"
#include "Vehicles.h"
#include "Multilingual Text Code Generator.h"
#include "editscreen.h"
#include "Arms Dealer Init.h"
#include "Map Screen Interface Bottom.h"
#include "MPXmlTeams.hpp"
#include "Strategic Mines LUA.h"
#include "UndergroundInit.h"
@@ -76,8 +76,7 @@
#include "AimArchives.h"
#include "connect.h"
#include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes()
#include <language.hpp>
#include "Animation Data.h" // added by Flugente
extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0};
extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08
@@ -135,6 +134,34 @@ static void AddLanguagePrefix(STR fileName, const STR language)
memmove( fileComponent, language, strlen( language) );
}
static const STR GetLanguagePrefix()
{
#ifdef ENGLISH
return "";
#endif
#ifdef GERMAN
return GERMAN_PREFIX;
#endif
#ifdef RUSSIAN
return RUSSIAN_PREFIX;
#endif
#ifdef DUTCH
return DUTCH_PREFIX;
#endif
#ifdef POLISH
return POLISH_PREFIX;
#endif
#ifdef FRENCH
return FRENCH_PREFIX;
#endif
#ifdef ITALIAN
return ITALIAN_PREFIX;
#endif
#ifdef CHINESE
return CHINESE_PREFIX;
#endif
}
static void AddLanguagePrefix(STR fileName)
{
AddLanguagePrefix( fileName, GetLanguagePrefix());
@@ -227,7 +254,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, AMMOFILENAME);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
@@ -241,9 +268,9 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, AMMOFILENAME);
SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME);
}
} else {
#else
SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME);
}
#endif
// Lesh: added this, begin
strcpy(fileName, directoryName);
@@ -267,14 +294,14 @@ if( g_lang != i18n::Lang::en ) {
// the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName);
}
}
#endif
//if(!WriteItemStats())
// return FALSE;
@@ -339,14 +366,14 @@ if( g_lang != i18n::Lang::en ) {
strcat( fileName, DISEASEFILENAME );
SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME );
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME);
}
}
#endif
strcpy(fileName, directoryName);
strcat(fileName, STRUCTUREDECONSTRUCTFILENAME);
@@ -384,14 +411,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, LOADSCREENHINTSFILENAME);
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName);
}
}
#endif
strcpy(fileName, directoryName);
strcat(fileName, ARMOURSFILENAME);
@@ -411,24 +438,22 @@ if( g_lang != i18n::Lang::en ) {
if (isMultiplayer == false)
{
using namespace LogicalBodyTypes;
CHAR8 errorBuf[512]{"Failed loading LogicalBodyTypes external data!"};
SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME), LBT_LAYERSFILENAME);
SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME), LBT_PALETTESFILENAME);
SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME), LBT_ANIMSURFACESFILENAME);
SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME), LBT_FILTERSFILENAME);
SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME), LBT_BODYTYPESFILENAME);
}
}
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName);
}
}
#endif
// THE_BOB : added for pocket popup definitions
LBEPocketPopup.clear();
@@ -436,7 +461,7 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, LBEPOCKETPOPUPFILENAME);
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if (FileExists(fileName))
@@ -451,10 +476,10 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, LBEPOCKETPOPUPFILENAME);
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
}
} else {
#else
// WANNE: Load english file
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
}
#endif
#ifdef JA2UB
@@ -470,14 +495,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, MERCSTARTINGGEARFILENAME);
SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName);
}
}
#endif
#endif
@@ -494,14 +519,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, ATTACHMENTSLOTSFILENAME);
SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName);
}
}
#endif
// Flugente: created separate gun and item choices for different soldier classes - read in different xmls
strcpy(fileName, directoryName);
@@ -675,14 +700,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, CITYTABLEFILENAME);
SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName);
}
}
#endif
// Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp,
// function BOOLEAN InitStrategicMovementCosts();
@@ -733,14 +758,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName);
}
}
#endif
strcpy(fileName, directoryName);
strcat(fileName, DELIVERYMETHODSFILENAME);
@@ -753,14 +778,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName);
}
}
#endif
// HEADROCK HAM 3.4: Read in facility locations
strcpy(fileName, directoryName);
@@ -774,14 +799,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName);
}
}
#endif
// HEADROCK HAM 5: Read in Coolness by Sector
strcpy(fileName, directoryName);
@@ -803,7 +828,7 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -811,7 +836,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInMercProfiles(fileName,TRUE))
return FALSE;
}
}
#endif
}
strcpy(fileName, directoryName);
@@ -829,14 +854,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName);
}
}
#endif
// HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data
strcpy(fileName, directoryName);
@@ -899,14 +924,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName);
}
}
#endif
}
@@ -918,14 +943,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName);
}
}
#endif
}
@@ -935,14 +960,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName);
}
}
#endif
if (gGameExternalOptions.fEnemyRank == TRUE)
{
@@ -952,14 +977,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName);
}
}
#endif
}
// Flugente: backgrounds
@@ -968,14 +993,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME);
}
}
#endif
// Flugente: individual militia
strcpy( fileName, directoryName );
@@ -989,14 +1014,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME);
}
}
#endif
// WANNE: Only in a singleplayer game...
// Externalised taunts
@@ -1017,14 +1042,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, FileInfo.zFileName);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName);
}
}
#endif
while( GetFileNext(&FileInfo) )
{
strcpy(fileName, directoryName);
@@ -1032,14 +1057,14 @@ if( g_lang != i18n::Lang::en ) {
strcat(fileName, FileInfo.zFileName);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName);
}
}
#endif
}
GetFileClose(&FileInfo);
}
@@ -1051,14 +1076,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName);
}
}
#endif
// IMP Portraits List by Jazz
strcpy(fileName, directoryName);
@@ -1066,14 +1091,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName);
}
}
#endif
LoadIMPPortraitsTEMP( );
@@ -1158,14 +1183,14 @@ if( g_lang != i18n::Lang::en ) {
SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME);
//WriteFaceGear();
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName);
}
}
#endif
UINT32 i;
for(i=0; i<NUM_PROFILES; i++)
{
@@ -1179,14 +1204,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,FALSE), AIMAVAILABILITY);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,TRUE), fileName);
}
}
#endif
//Main Menu by Jazz
strcpy(fileName, directoryName);
@@ -1199,7 +1224,7 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInActionItems(fileName,FALSE), ACTIONITEMSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1207,7 +1232,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInActionItems(fileName,TRUE))
return FALSE;
}
}
#endif
if ( ReadXMLEmail == TRUE )
{
@@ -1217,7 +1242,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercAvailable(fileName,FALSE), EMAILMERCAVAILABLE);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1225,7 +1250,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInEmailMercAvailable(fileName,TRUE))
return FALSE;
}
}
#endif
// EMAIL MERC LEVEL UP by Jazz
strcpy(fileName, directoryName);
@@ -1233,7 +1258,7 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercLevelUp(fileName,FALSE), EMAILMERCLEVELUP);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1241,7 +1266,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInEmailMercLevelUp(fileName,TRUE))
return FALSE;
}
}
#endif
}
/*
// EMAIL OTHER by Jazz
@@ -1250,7 +1275,7 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailOther(fileName,FALSE), EMAILOTHER);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1258,7 +1283,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInEmailOther(fileName,TRUE))
return FALSE;
}
}
#endif
*/
//new vehicles by Jazz
@@ -1269,7 +1294,7 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInNewVehicles(fileName,FALSE), VEHICLESFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1277,9 +1302,9 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInNewVehicles(fileName,TRUE))
return FALSE;
}
}
#endif
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
@@ -1287,7 +1312,7 @@ if( g_lang != i18n::Lang::en ) {
if(!ReadInLanguageLocation(fileName,TRUE,zlanguageText,0))
return FALSE;
}
}
#endif
#ifdef ENABLE_BRIEFINGROOM
strcpy(fileName, directoryName);
@@ -1295,14 +1320,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,FALSE,gBriefingRoomData, 4), BRIEFINGROOMFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,TRUE,gBriefingRoomData, 4), fileName);
}
}
#endif
BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
@@ -1314,14 +1339,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMinerals(fileName,FALSE), MINERALSFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMinerals(fileName,TRUE), fileName);
}
}
#endif
// Old AIM Archive
UINT8 p;
@@ -1335,14 +1360,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,FALSE), OLDAIMARCHIVEFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,TRUE), fileName);
}
}
#endif
UINT8 emptyslotsinarchives = 0;
for (p=0;p<NUM_PROFILES;p++)
{
@@ -1392,14 +1417,14 @@ if( g_lang != i18n::Lang::en ) {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,FALSE), DIFFICULTYFILENAME);
if( g_lang != i18n::Lang::en ) {
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,TRUE), fileName);
}
}
#endif
LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true);
g_luaUnderground.LoadScript(GetLanguagePrefix());
@@ -1473,10 +1498,6 @@ UINT32 InitializeJA2(void)
return( ERROR_SCREEN );
}
// InitRadarScreenCoords() depend on Mapscreen Interface Bottom coordinates -> need to initiate them first
// before calling InitTacticalEngine()
InitMapScreenInterfaceBottomCoords();
// Init tactical engine
if ( !InitTacticalEngine( ) )
{
@@ -1493,6 +1514,12 @@ UINT32 InitializeJA2(void)
// INit intensity tables
BuildIntensityTable( );
// Init Event Manager
if ( !InitializeEventManager( ) )
{
return( ERROR_SCREEN );
}
// Initailize World
if ( !InitializeWorld( ) )
{
@@ -1671,6 +1698,8 @@ void ShutdownJA2(void)
ShutdownJA2Sound( );
ShutdownEventManager( );
ShutdownBaseDirtyRectQueue( );
// Unload any text box images!
View File
+8 -9
View File
@@ -1,14 +1,14 @@
#include "sgp.h"
#include "sysutil.h"
#include "vobject_blitters.h"
#include "Font Control.h"
#include "Cursor Control.h"
#include "Render Dirty.h"
#include "font control.h"
#include "cursor control.h"
#include "render dirty.h"
#include "Text.h"
#include "Utilities.h"
#include "WordWrap.h"
#include "Text.h"
#include "line.h"
#include "text.h"
#include "Line.h"
#include "Intro.h"
#include "Cinematics.h"
#include "Cinematics Bink.h"
@@ -36,7 +36,6 @@
#include "LuaInitNPCs.h"
#include "XML.h"
#include <language.hpp>
BOOLEAN Style_JA = TRUE;
extern INT8 Test = 0;
@@ -727,11 +726,11 @@ void DisplaySirtechSplashScreen()
* (2006-10-10, Sergeant_Kolja)
*/
#ifdef _DEBUG
if( g_lang == i18n::Lang::en ) {
# if defined(ENGLISH)
AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) );
} else if( g_lang == i18n::Lang::de ) {
# elif defined(GERMAN)
AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) );
}
# endif
#endif
AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) );
return;
+5 -3
View File
@@ -12,11 +12,13 @@ void StopIntroVideo();
//enums used for when the intro screen can come up, used with 'gbIntroScreenMode'
enum EIntroType
{
#ifdef JA2UB
INTRO_HELI_CRASH,
#endif
INTRO_BEGINNING, //set when viewing the intro at the begining of the game
INTRO_ENDING, //set when viewing the end game video.
INTRO_SPLASH,
// Unfinished Business
INTRO_HELI_CRASH
};
@@ -40,4 +42,4 @@ typedef struct
extern INTRO_NAMES_VALUES zVideoFile[255];
#endif
#endif
+6
View File
@@ -0,0 +1,6 @@
#ifndef _JA2_DEMO_ADS_H
#define _JA2_DEMO_ADS_H
#include "types.h"
#endif
+5 -6
View File
@@ -1,11 +1,10 @@
#include "types.h"
#include "Types.h"
#include "vsurface.h"
#include "mainmenuscreen.h"
#include "video.h"
#include "Video.h"
#include "Timer Control.h"
#include "Multi Language Graphic Utils.h"
#include <stdio.h>
#include <language.hpp>
UINT32 guiSplashFrameFade = 10;
UINT32 guiSplashStartTime = 0;
@@ -14,10 +13,10 @@ extern HVSURFACE ghFrameBuffer;
//Simply create videosurface, load image, and draw it to the screen.
void InitJA2SplashScreen()
{
if( g_lang == i18n::Lang::en ) {
#ifdef ENGLISH
ClearMainMenu();
} else {
#else
UINT32 uiLogoID = 0;
HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions
VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions
@@ -70,7 +69,7 @@ if( g_lang == i18n::Lang::en ) {
GetVideoSurface( &hVSurface, uiLogoID );
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
DeleteVideoSurfaceFromIndex( uiLogoID );
} // ENGLISH
#endif // ENGLISH
InvalidateScreen();
RefreshScreen( NULL );
+1 -1
View File
@@ -6,4 +6,4 @@ void InitJA2SplashScreen();
extern UINT32 guiSplashFrameFade;
extern UINT32 guiSplashStartTime;
#endif
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _JA2PROTOTYPES_H
#define _JA2PROTOTYPES_H
/*
* This header does not define any structures. It simply provides a way for all code that only needs a pointer
* reference to structures, to have it without getting locked into mutual includes and other
* hard-to-trace-and-fix behavior. More class and struct defs can be added as necessary.
*/
class SOLDIERTYPE;
struct AnimationSurfaceType;
#endif
-37
View File
@@ -1,37 +0,0 @@
set(Ja2Src
"${CMAKE_CURRENT_SOURCE_DIR}/aniviewscreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Credits.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Fade Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FeaturesScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameInitOptionsScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gameloop.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gamescreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameSettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameVersion.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/HelpScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Intro.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPChatScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPConnectScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPHostScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPJoinScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPScoreScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPXmlTeams.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Options Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Screens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TimeLogging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
PARENT_SCOPE)
-72
View File
@@ -1,72 +0,0 @@
#include "TimeLogging.h"
#include "time.h"
#include <stdio.h>
clock_t starttime;
clock_t t0;
clock_t t1;
FILE* fp_timelog = nullptr;
static void indent(int n)
{
for (int i = 0; i < n; i++)
fputc('\t', fp_timelog);
}
void TimingLogInitialize(const CHAR8* filename)
{
starttime = clock();
t1 = starttime;
if (!fp_timelog)
{
fp_timelog = fopen(filename, "a");
}
}
void TimingLog(const CHAR8* logEvent, int n)
{
if (fp_timelog)
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "%s", logEvent);
indent(n);
fprintf(fp_timelog, ": %f s\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
}
void TimingLogTotalTime(const CHAR8* logEvent, int n)
{
if (fp_timelog)
{
t1 = clock();
fprintf(fp_timelog, "%s", logEvent);
indent(n);
fprintf(fp_timelog, ": %f s\n", ((float)(t1 - starttime) / CLOCKS_PER_SEC));
}
}
void TimingLogWrite(const CHAR8* text)
{
if (fp_timelog)
{
fprintf(fp_timelog, text);
}
}
void TimingLogStop()
{
if (fp_timelog)
{
fprintf(fp_timelog, "\n");
fclose(fp_timelog);
fp_timelog = nullptr;
}
}
-8
View File
@@ -1,8 +0,0 @@
#pragma once
#include "types.h"
void TimingLogInitialize(const CHAR8* filename);
void TimingLog(const CHAR8* logEvent, int n);
void TimingLogTotalTime(const CHAR8* logEvent, int n);
void TimingLogWrite(const CHAR8* text);
void TimingLogStop();
+19 -18
View File
@@ -4,29 +4,30 @@
#include <string.h>
#include "Render Fun.h"
#include "stdlib.h"
#include "DEBUG.H"
#include "debug.h"
#include "MemMan.h"
#include "Overhead Types.h"
//#include "Soldier Control.h"
#include "Animation Cache.h"
#include "Animation Data.h"
#include "Animation Control.h"
#include "container.h"
#include <math.h>
#include "PATHAI.H"
#include "random.h"
#include "pathai.h"
#include "Random.h"
#include "Isometric Utils.h"
#include "renderworld.h"
#include "video.h"
#include "Weapons.h"
#include "weapons.h"
#include "vobject_blitters.h"
#include "Handle UI.h"
#include "Event Pump.h"
#include "Event pump.h"
#include "ai.h"
#include "Interface.h"
#include "interface.h"
#include "lighting.h"
#include "faces.h"
#include "Soldier Profile.h"
#include "Soldier macros.h"
#include "soldier macros.h"
#include "english.h"
#include "Squads.h"
@@ -34,33 +35,33 @@
#include "Networking.h"
#include "NetworkEvent.h"
#endif
#include "Items.h"
#include "soundman.h"
#include "Utilities.h"
#include "strategic.h"
#include "items.h"
#include "Soundman.h"
#include "utilities.h"
#include "Strategic.h"
#include "soldier tile.h"
#include "Smell.h"
#include "Keys.h"
#include "Dialogue Control.h"
#include "Soldier Functions.h"
#include "dialogue control.h"
#include "soldier functions.h"
#include "Exit Grids.h"
#include "Quests.h"
#include "message.h"
#include "SkillCheck.h"
#include "interface Dialogue.h"
#include "interface dialogue.h"
#include "GameSettings.h"
#include "ShopKeeper Interface.h"
#include "Vehicles.h"
#include "vehicles.h"
#include "strategicmap.h"
#include "Morale.h"
#include "Drugs And Alcohol.h"
#include "morale.h"
#include "drugs and alcohol.h"
#include "SkillCheck.h"
#include "Map Information.h"
#include "Buildings.h"
#include "Text.h"
#include "Campaign Types.h"
#include "Strategic Status.h"
#include "Civ Quotes.h"
#include "civ quotes.h"
#include "Debug Control.h"
#ifdef JA2UB
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JA25UPDATE__C_
#define JA25UPDATE__C_
#include "types.h"
#include "Types.h"
#ifdef JA2UB
+21
View File
@@ -0,0 +1,21 @@
#include "Language Defines.h"
#if defined(ENGLISH)
# pragma message(" (Language set to ENGLISH, You'll need english CDs)")
#elif defined(GERMAN)
# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)")
#elif defined(RUSSIAN)
# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)")
#elif defined(DUTCH)
# pragma message(" (Language set to DUTCH, You'll need dutch CDs)")
#elif defined(POLISH)
# pragma message(" (Language set to POLISH, You'll need polish CDs)")
#elif defined(FRENCH)
# pragma message(" (Language set to FRENCH, You'll need french CDs)")
#elif defined(ITALIAN)
# pragma message(" (Language set to ITALIAN, You'll need italian CDs)")
#elif defined(CHINESE)
# pragma message(" (Language set to CHINESE, You'll need chinese CDs)")
#else
# error "At least You have to specify a Language somewhere. See comments above."
#endif
+119
View File
@@ -0,0 +1,119 @@
#ifndef __LANGUAGE_DEFINES_H
#define __LANGUAGE_DEFINES_H
#pragma once
/* ============================================================================
* ONLY ONE OF THESE LANGUAGES CAN BE DEFINED AT A TIME!
* BUT now You can define it _here_ by uncommenting one _or_ (better):
* You can comment them all out and then set it _global_ in "Preprocessor
* options" (do it for ALL projects in the workspace and both debug & release)
* _or_
* give it do Your MAKEFILE, f.i. make ENGLISH, but keep in mind that some
* weird make tools will require 'make ENGLISH=1' instead
*
* using one of the two later methods will keep this SVN file unchanged for the
* future, only Your private project files (workspace/solution) will differ
* from the SVN stuff.
* (2006-10-10, Sergeant_Kolja)
*/
/* The recommend approach for VS2010 multi-language builds is to use the command line or the ja2.props file.
By default the language is ENGLISH and the Language Prefix is EN.
There are 3 ways you can build the JA2 1.13 executable file:
// -------------------------------------------------------
// 1. Using the command line
// -------------------------------------------------------
For example, where msbuild is located in %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ if not on your path
msbuild.exe /p:Configuration=Release ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=PL /p:JA2Language=POLISH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=RU /p:JA2Language=RUSSIAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=NL /p:JA2Language=DUTCH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=FR /p:JA2Language=FRENCH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=IT /p:JA2Language=ITALIAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=CN /p:JA2Language=CHINESE ja2_VS2010.sln
Note: If you want to build "Unfinished Business" version, just append the /p:JA2Config=JA2UB in the command line
msbuild.exe /p:Configuration=Release /p:JA2Config=JA2UB ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB ja2_VS2010.sln
Note2: You can also specify the target output name with the parameter /p:TargetName
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB /p:TargetName="JA2UB_113" ja2_VS2010.sln
// --------------------------------------------------------
// 2. Editing the ja2.props file and then build in VS 2010
// -------------------------------------------------------
1. Open the "ja2.props" file in a text editor and set the <BuildMacro> tags to your likeing.
For example: If you want to build Russian Version (normal JA2, not UB) then set the following:
<BuildMacro Include="JA2Config">
<Value></Value>
</BuildMacro>
<BuildMacro Include="JA2LangPrefix">
<Value>RU</Value>
</BuildMacro>
<BuildMacro Include="JA2Language">
<Value>RUSSIAN</Value>
</BuildMacro>
2. Save the file
3. Build the project in Visual Studio 2010
// --------------------------------------------------------
// 3. The "old" way for building the executable
// -------------------------------------------------------
1. Enable the "#undef ENGLISH" define below, so English will not be used anymore
2. Set the desired language below
3. If you want to build "Unfinished Business" version, enable "#define JA2UB" and "#define JA2UBMAPS" in builddefines.h"
4. Build the executable in VS 2005 / 2008 / 2010
5. The output will be placed in the "Build\bin\" folder
*/
// Only enable this "undef", if you use the 3. way of building the executable!
#undef ENGLISH
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
/* please set one manually here (by uncommenting) if not willingly to set Workspace wide */
#define ENGLISH
//#define GERMAN
//#define RUSSIAN
//#define DUTCH
//#define FRENCH
//#define ITALIAN
//#define POLISH
// INFO: For Chinese 1.13 version, you also have to set USE_WINFONTS = 1 in ja2.ini inside your JA2 installation directory!
//#define CHINESE
#endif
//**ddd direct link libraries
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "advapi32.lib")
#pragma comment (lib, "shell32.lib")
/* ====================================================================
* Regardless of if we did it Workspace wide or by uncommenting above,
* HERE we must see, what language was selected. If one, we
*/
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
# error "At least You have to specify a Language somewhere. See comments above."
#endif
//if the language represents words as single chars
/*#ifdef TAIWAN
#define SINGLE_CHAR_WORDS
#endif*/
#endif
+2 -2
View File
@@ -4,11 +4,11 @@
#include "Utilities.h"
#include "WCheck.h"
#include "stdio.h"
#include "aim.h"
#include "Aim.h"
#include "Soldier Profile.h"
#include "email.h"
#include "Text.h"
#include "AimSort.h"
#include "aimsort.h"
#include "Assignments.h"
#include "GameSettings.h"
#include "english.h"
+112 -156
View File
@@ -1,30 +1,30 @@
#include "email.h"
#include "laptop.h"
#include "AimMembers.h"
#include "aim.h"
#include "Aim.h"
#include "Utilities.h"
#include "WCheck.h"
#include "DEBUG.H"
#include "Debug.h"
#include "stdio.h"
#include "sysutil.h"
#include "Soldier Profile.h"
#include "Soldier Control.h"
#include "Interface Items.h"
#include "Overhead.h"
#include "InterFace Items.h"
#include "overhead.h"
#include "WordWrap.h"
#include "finances.h"
#include "vsurface.h"
#include "vobject.h"
#include "VObject.h"
#include "Game Clock.h"
#include "Overhead.h"
#include "faces.h"
#include "Dialogue Control.h"
#include "Text.h"
#include "history.h"
#include "overhead.h"
#include "Faces.h"
#include "dialogue control.h"
#include "text.h"
#include "History.h"
#include "Game Event Hook.h"
#include "MercTextBox.h"
#include "Render Dirty.h"
#include "Weapons.h"
#include "weapons.h"
#include "Soldier Add.h"
#include "Merc Hiring.h"
#include "strategic.h"
@@ -32,15 +32,16 @@
#include "LaptopSave.h"
#include "english.h"
#include "GameSettings.h"
#include "random.h"
#include "Random.h"
#include "Strategic Status.h"
#include "Merc Contract.h"
#include "Strategic Merc Handler.h"
#include "Language Defines.h"
#include "Assignments.h"
#include "Sound Control.h"
#include "Quests.h"
#include "strategicmap.h"
#include "personnel.h"
#include "Personnel.h"
#include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item
#include "Strategic Town Loyalty.h"
@@ -49,7 +50,6 @@
#include "Encrypted File.h"
#include "InterfaceItemImages.h"
#include <sstream>
#include <language.hpp>
//
//****** Defines ******
@@ -148,16 +148,10 @@
#define FEE_X PRICE_X + 7
#define FEE_Y NAME_Y
#define FEE_WIDTH 37
#define FEE_X_UB PRICE_X + 40
#define FEE_Y_UB STATS_Y + 28
#define FEE_Y_UB_NSGI STATS_Y
#define AIM_CONTRACT_X PRICE_X + 51
#define AIM_CONTRACT_Y FEE_Y
#define AIM_CONTRACT_WIDTH 59
#define AIM_CONTRACT_X_UB PRICE_X + 19
#define AIM_OFFER_X PRICE_X + 3
#define AIM_OFFER_WIDTH 110
#define ONEDAY_X AIM_CONTRACT_X
#define ONEWEEK_X AIM_CONTRACT_X
@@ -1099,6 +1093,7 @@ BOOLEAN RenderAIMMembers()
HVOBJECT hPriceHandle;
HVOBJECT hWeaponBoxHandle;
UINT16 x, uiPosX;
CHAR16 wTemp[50];
DrawAimDefaults();
@@ -1125,27 +1120,26 @@ BOOLEAN RenderAIMMembers()
UpdateMercInfo();
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
//Draw fee & contract
#ifdef JA2UB
DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
#else
DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X_NSGI, FEE_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X_NSGI, AIM_CONTRACT_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Draw pay period (day, week, 2 week)
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_DAY], ONEDAY_X_NSGI, EXPLEVEL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_DAY], ONEDAY_X_NSGI, EXPLEVEL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
//Display Option Gear Cost text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_MEMBER_OPTIONAL_GEAR_X_NSGI, EXPLOSIVE_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
swprintf(wTemp, L"%d", gMercProfiles[gbCurrentSoldier].usOptionalGearCost);
InsertCommasForDollarFigure( wTemp );
InsertDollarSignInToString( wTemp );
uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X_NSGI + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_M_FONT_STATIC_TEXT) + 5;
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].usOptionalGearCost).data(), AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
#endif // JA2UB
DrawTextToScreen(wTemp, AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
}
else
{
@@ -1169,27 +1163,26 @@ BOOLEAN RenderAIMMembers()
UpdateMercInfo();
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#ifdef JA2UB
DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
#else
//Draw fee & contract
DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X, FEE_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X, AIM_CONTRACT_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Draw pay period (day, week, 2 week)
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_DAY], ONEDAY_X, EXPLEVEL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_DAY], ONEDAY_X, EXPLEVEL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
//Display Option Gear Cost text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_MEMBER_OPTIONAL_GEAR_X, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
swprintf(wTemp, L"%d", gMercProfiles[gbCurrentSoldier].usOptionalGearCost);
InsertCommasForDollarFigure( wTemp );
InsertDollarSignInToString( wTemp );
uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_M_FONT_STATIC_TEXT) + 5;
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].usOptionalGearCost).data(), uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
#endif
DrawTextToScreen(wTemp, uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
}
DisableAimButton();
@@ -1254,6 +1247,19 @@ BOOLEAN DrawNumeralsToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 u
return(TRUE);
}
BOOLEAN DrawMoneyToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 usLocY, UINT32 ulFont, UINT8 ubColor)
{
CHAR16 sStr[10];
swprintf(sStr, L"%d",iNumber);
InsertCommasForDollarFigure( sStr );
InsertDollarSignInToString( sStr );
// DrawTextToScreen(L"$", usLocX, usLocY, 0, ulFont, ubColor, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(sStr, usLocX, usLocY, bWidth, ulFont, ubColor, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
return(TRUE);
}
void SelectFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
@@ -1295,19 +1301,6 @@ void SelectFaceMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
#include "LocalizedStrings.h"
static auto DrawDiscountedDailyCosts() -> void
{
constexpr auto offset{ 65 };
constexpr auto l{ L"(" };
constexpr auto r{ L")" };
const static auto nsgi = gGameExternalOptions.gfUseNewStartingGearInterface;
const auto width = nsgi ? FEE_WIDTH_NSGI : FEE_WIDTH;
const auto xOffset = nsgi ? FEE_X_NSGI : FEE_X;
DrawTextToScreen((l + FormatMoney(gMercProfiles[gbCurrentSoldier].uiWeeklySalary / 7) + r).data(), xOffset + offset, nsgi ? AGILITY_Y_NSGI : AGILITY_Y, width, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawTextToScreen((l + FormatMoney(gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary / 14) + r).data(), xOffset + offset, nsgi ? DEXTERITY_Y_NSGI : DEXTERITY_Y, width, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
}
BOOLEAN UpdateMercInfo(void)
{
//UINT16 PosY = 300;
@@ -1316,24 +1309,23 @@ BOOLEAN UpdateMercInfo(void)
if(gGameExternalOptions.gfUseNewStartingGearInterface)
{
#ifdef JA2UB
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiWeeklySalary).data(), FEE_X_UB, FEE_Y_UB_NSGI, FEE_WIDTH, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DisplayWrappedString(AIM_OFFER_X, AGILITY_Y_NSGI, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#else
//Display the salaries
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].sSalary).data(), FEE_X_NSGI, HEALTH_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiWeeklySalary).data(), FEE_X_NSGI, AGILITY_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary).data(), FEE_X_NSGI, DEXTERITY_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawDiscountedDailyCosts();
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH_NSGI, FEE_X_NSGI, HEALTH_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, AGILITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, DEXTERITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
//if medical deposit is required
if( gMercProfiles[gbCurrentSoldier].bMedicalDeposit )
{
CHAR16 zTemp[40];
CHAR16 sMedicalString[40];
// Display the medical cost
swprintf( sMedicalString, L"%s %s", FormatMoney(gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount).data(), CharacterInfo[AIM_MEMBER_MEDICAL_DEPOSIT_REQ] );
swprintf( zTemp, L"%d", gMercProfiles[ gbCurrentSoldier ].sMedicalDepositAmount );
InsertCommasForDollarFigure( zTemp );
InsertDollarSignInToString( zTemp );
swprintf( sMedicalString, L"%s %s", zTemp, CharacterInfo[AIM_MEMBER_MEDICAL_DEPOSIT_REQ] );
// If the string will be displayed in more then 2 lines, recenter the string
if( ( DisplayWrappedString( 0, 0, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_FONT12ARIAL ) ) > 2 )
@@ -1343,8 +1335,6 @@ BOOLEAN UpdateMercInfo(void)
else
DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X_NSGI, AIM_MEDICAL_DEPOSIT_Y_NSGI, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
}
#endif // JA2UB
if(!g_bUseXML_Strings)
{
// LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString);
@@ -1373,16 +1363,10 @@ BOOLEAN UpdateMercInfo(void)
}
else
{
#ifdef JA2UB
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiWeeklySalary).data(), FEE_X_UB, FEE_Y_UB, FEE_WIDTH, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DisplayWrappedString(AIM_OFFER_X, AGILITY_Y, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#else
//Display the salaries
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].sSalary).data(), FEE_X, HEALTH_Y, FEE_WIDTH, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiWeeklySalary).data(), FEE_X, AGILITY_Y, FEE_WIDTH, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawTextToScreen(FormatMoney(gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary).data(), FEE_X, DEXTERITY_Y, FEE_WIDTH, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
DrawDiscountedDailyCosts();
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH, FEE_X, HEALTH_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X, AGILITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary, FEE_WIDTH, FEE_X, DEXTERITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
//if medical deposit is required
if( gMercProfiles[gbCurrentSoldier].bMedicalDeposit )
@@ -1391,7 +1375,11 @@ BOOLEAN UpdateMercInfo(void)
CHAR16 sMedicalString[40];
// Display the medical cost
swprintf( sMedicalString, L"%s %s", FormatMoney(gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount).data(), CharacterInfo[AIM_MEMBER_MEDICAL_DEPOSIT_REQ] );
swprintf( zTemp, L"%d", gMercProfiles[ gbCurrentSoldier ].sMedicalDepositAmount );
InsertCommasForDollarFigure( zTemp );
InsertDollarSignInToString( zTemp );
swprintf( sMedicalString, L"%s %s", zTemp, CharacterInfo[AIM_MEMBER_MEDICAL_DEPOSIT_REQ] );
// If the string will be displayed in more then 2 lines, recenter the string
if( ( DisplayWrappedString( 0, 0, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_FONT12ARIAL ) ) > 2 )
@@ -1401,7 +1389,6 @@ BOOLEAN UpdateMercInfo(void)
else
DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
}
#endif
if(!g_bUseXML_Strings)
{
// LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString);
@@ -2410,9 +2397,9 @@ INT8 AimMemberHireMerc()
MERC_HIRE_STRUCT HireMercStruct;
// UINT8 ubCurrentSoldier = AimMercArray[gbCurrentIndex];
UINT8 ubCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
INT8 bReturnCode;
SoldierID sSoldierID = NOBODY;
INT8 bTypeOfContract=0;
INT8 bReturnCode;
INT16 sSoldierID=0;
INT8 bTypeOfContract=0;
if( LaptopSaveInfo.iCurrentBalance < giContractAmount )
@@ -2488,10 +2475,9 @@ INT8 AimMemberHireMerc()
//Set the type of contract the merc is on
sSoldierID = GetSoldierIDFromMercID( ubCurrentSoldier );
if( sSoldierID == NOBODY )
if( sSoldierID == -1 )
return( FALSE );
sSoldierID->bTypeOfLastContract = bTypeOfContract;
Menptr[ sSoldierID ].bTypeOfLastContract = bTypeOfContract;
//add an entry in the finacial page for the hiring of the merc
@@ -2542,21 +2528,6 @@ BOOLEAN DisplayVideoConferencingDisplay()
DisplayMercChargeAmount();
#ifdef JA2UB
if (gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE)
{
CHAR16 offerText[190];
swprintf(offerText, zNewTacticalMessages[TACT_MSG__AIMMEMBER_ONE_TIME_FEE], gMercProfiles[gbCurrentSoldier].zNickname);
const auto xCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_X + 115;
const auto yCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_Y + 45;
const auto textAreaWidth = 245;
SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR);
DisplayWrappedString(xCoord, yCoord, textAreaWidth, 2, AIM_M_FONT_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, offerText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
SetFontShadow(DEFAULT_SHADOW);
}
#endif // JA2UB
// if( gfMercIsTalking && !gfIsAnsweringMachineActive)
if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] )
{
@@ -2606,9 +2577,6 @@ BOOLEAN DisplayMercsVideoFace()
void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown)
{
#ifdef JA2UB
return;
#else
UINT16 i, usPosY, usPosX;
//First draw the select light for the contract length buttons
@@ -2662,14 +2630,13 @@ void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown)
usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP;
}
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
#endif // JA2UB
}
UINT32 DisplayMercChargeAmount()
{
CHAR16 wTemp[50];
CHAR16 wDollarTemp[50];
HVOBJECT hImageHandle;
@@ -2686,10 +2653,7 @@ UINT32 DisplayMercChargeAmount()
giContractAmount = 0;
//the contract charge amount
#ifdef JA2UB
// Special offer for a limited time! Act fast!
giContractAmount = gMercProfiles[gbCurrentSoldier].uiWeeklySalary;
#else
// Get the salary rate
if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY)
giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary;
@@ -2711,21 +2675,22 @@ UINT32 DisplayMercChargeAmount()
{
giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost;
}
#endif
}
swprintf( wDollarTemp, L"%d", giContractAmount);
InsertCommasForDollarFigure( wDollarTemp );
InsertDollarSignInToString( wDollarTemp );
//if the merc hasnt just been hired
// if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL )
{
auto contractAmount{ FormatMoney(giContractAmount) };
#ifndef JA2UB
if (gMercProfiles[gbCurrentSoldier].bMedicalDeposit)
contractAmount += L" ";
contractAmount += VideoConfercingText[AIM_MEMBER_WITH_MEDICAL];
#endif
if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit )
swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] );
else
swprintf(wTemp, L"%s", wDollarTemp );
DrawTextToScreen(contractAmount.data(), AIM_CONTRACT_CHARGE_AMOUNNT_X + 1, AIM_CONTRACT_CHARGE_AMOUNNT_Y + 3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
}
return(giContractAmount);
@@ -3922,14 +3887,14 @@ BOOLEAN InitDeleteVideoConferencePopUp( )
MSYS_DisableRegion(&gSelectedShutUpMercRegion);
//Enable the ability to click on the BIG face to go to different screen
MSYS_EnableRegion(&gSelectedFaceRegion);
MSYS_EnableRegion(&gSelectedFaceRegion);
// EnableDisableCurrentVideoConferenceButtons(FALSE);
if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE )
{
// Enable the current video conference buttons
EnableDisableCurrentVideoConferenceButtons(FALSE);
}
if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE )
{
// Enable the current video conference buttons
EnableDisableCurrentVideoConferenceButtons(FALSE);
}
fVideoConferenceCreated = FALSE;
@@ -4120,22 +4085,6 @@ BOOLEAN InitDeleteVideoConferencePopUp( )
// InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT);
DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE );
#ifdef JA2UB
// Disable and hide contract length & gear purchase buttons
gfBuyEquipment = TRUE;
for (size_t i = 0; i < 3; i++)
{
DisableButton(giContractLengthButton[i]);
HideButton(giContractLengthButton[i]);
if (i < 2)
{
DisableButton(giBuyEquipmentButton[i]);
HideButton(giBuyEquipmentButton[i]);
}
}
#endif // JA2UB
}
@@ -5348,17 +5297,11 @@ BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 us
void DemoHiringOfMercs( )
{
INT16 i;
UINT8 MercID[5];
MercID[0] = 7;
MercID[1] = 10;
MercID[2] = 4;
if( g_lang == i18n::Lang::de ) {
MercID[3] = 14;
MercID[4] = 50;
} else {
MercID[3] = 42;
MercID[4] = 33;
}
#ifdef GERMAN
UINT8 MercID[]={ 7, 10, 4, 14, 50 };
#else
UINT8 MercID[]={ 7, 10, 4, 42, 33 };
#endif
MERC_HIRE_STRUCT HireMercStruct;
static BOOLEAN fHaveCalledBefore=FALSE;
@@ -5449,20 +5392,20 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( )
//create the string to display to the user, looks like....
// L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival
if( g_lang == i18n::Lang::de ) {
#ifdef GERMAN
//Germans version has a different argument order
swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ],
gMercProfiles[ pSoldier->ubProfile ].zNickname,
LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440,
zTimeString,
zSectorIDString );
} else {
#else
swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ],
gMercProfiles[ pSoldier->ubProfile ].zNickname,
zSectorIDString,
LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440,
zTimeString );
}
#endif
@@ -5690,15 +5633,28 @@ void EnableWeaponKitSelectionButtons()
{
if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable )
{
bool bShow;
INT16 usItem;
for(int i=0; i<NUM_MERCSTARTINGGEAR_KITS; ++i)
{
bShow = false;
for(int j=INV_START_POS; j<NUM_INV_SLOTS; ++j)
{
if(gMercProfileGear[gbCurrentSoldier][i].inv[j] != NONE)
usItem = gMercProfileGear[gbCurrentSoldier][i].inv[j];
if(usItem != NONE)
{
ShowButton( giWeaponboxSelectionButton[i] );
break;
}
bShow = true;
//shadooow: if any of the item in kit is limited to specific system and this system isn't enabled then disable the whole kit from selection
if (((Item[usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
{
bShow = false;
break;
}
}
}
if (bShow)
{
ShowButton(giWeaponboxSelectionButton[i]);
}
}
}
+1
View File
@@ -9,6 +9,7 @@ BOOLEAN RenderAIMMembers();
BOOLEAN DrawNumeralsToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 usLocY, UINT32 ulFont, UINT8 ubColor);
BOOLEAN DrawMoneyToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 usLocY, UINT32 ulFont, UINT8 ubColor);
void DisplayTextForMercFaceVideoPopUp(STR16 pString);
+1 -1
View File
@@ -1,6 +1,6 @@
#include "laptop.h"
#include "AimSort.h"
#include "aim.h"
#include "Aim.h"
#include "WCheck.h"
#include "Utilities.h"
#include "WordWrap.h"

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