mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba270534c6 | ||
|
|
0cf0e054ab | ||
|
|
fc6bdad94b | ||
|
|
b49c37e0a9 | ||
|
|
bbbfdb8bd5 | ||
|
|
195dc57e96 | ||
|
|
52f46c60c7 | ||
|
|
c1f6000980 | ||
|
|
05582b960d |
+59
-25
@@ -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/
|
||||
@@ -169,8 +169,6 @@ jobs:
|
||||
with:
|
||||
language: ${{ matrix.language }}
|
||||
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
|
||||
# TODO check if English and German build faster for code changes on master, if not remove caching
|
||||
build-cache-enabled: ${{ matrix.language == 'English' || matrix.language == 'German' }}
|
||||
# at least English and some other lang have to work
|
||||
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
|
||||
|
||||
@@ -181,41 +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
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: actions/checkout@v4
|
||||
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
|
||||
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: |
|
||||
exit 0
|
||||
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 ''
|
||||
|
||||
@@ -13,11 +13,6 @@ on:
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
build-cache-enabled:
|
||||
description: 'enable sscache'
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
continue-on-error:
|
||||
description: 'allows a language to fail, used when building all languages'
|
||||
required: false
|
||||
@@ -32,15 +27,13 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: ${{ inputs.build-cache-enabled }}
|
||||
|
||||
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
|
||||
@@ -48,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: |
|
||||
@@ -57,9 +49,9 @@ 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
|
||||
@@ -76,25 +68,15 @@ 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
|
||||
with:
|
||||
arch: x86
|
||||
- name: Prepare build cache
|
||||
if: ${{ inputs.build-cache-enabled }}
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ inputs.language }}_${{ matrix.application }}
|
||||
save: ${{ github.ref == 'refs/heads/master' }}
|
||||
variant: sccache
|
||||
- name: Prepare build
|
||||
run: >
|
||||
cmake -S . -B build -GNinja
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
|
||||
run: |
|
||||
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build/ -- -v
|
||||
@@ -104,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
|
||||
@@ -117,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
|
||||
@@ -126,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 }}
|
||||
@@ -134,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 }}
|
||||
@@ -148,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
|
||||
@@ -216,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
|
||||
|
||||
+75
-13
@@ -22,8 +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(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console)
|
||||
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")
|
||||
@@ -38,28 +38,90 @@ add_subdirectory("ext/export/src")
|
||||
# by header files do not rely on Applications or Languages preprocessor definitions,
|
||||
# and therefore only need to be compiled once. Good.
|
||||
add_subdirectory(Lua)
|
||||
add_subdirectory(Multiplayer)
|
||||
|
||||
# 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
|
||||
SGP
|
||||
Laptop
|
||||
Editor
|
||||
Console
|
||||
Tactical
|
||||
ModularizedTacticalAI
|
||||
)
|
||||
foreach(lib IN LISTS Ja2_Libs)
|
||||
add_subdirectory(${lib})
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(Ja2)
|
||||
# TODO: Move these units into their own directory to declutter the root dir and CMakeLists.txt file
|
||||
set(Ja2Src
|
||||
"aniviewscreen.cpp"
|
||||
"Credits.cpp"
|
||||
"Fade Screen.cpp"
|
||||
"FeaturesScreen.cpp"
|
||||
"GameInitOptionsScreen.cpp"
|
||||
"gameloop.cpp"
|
||||
"gamescreen.cpp"
|
||||
"GameSettings.cpp"
|
||||
"GameVersion.cpp"
|
||||
"HelpScreen.cpp"
|
||||
"Init.cpp"
|
||||
"Intro.cpp"
|
||||
"JA2 Splash.cpp"
|
||||
"Ja25Update.cpp"
|
||||
"jascreens.cpp"
|
||||
"Language Defines.cpp"
|
||||
"Loading Screen.cpp"
|
||||
"MainMenuScreen.cpp"
|
||||
"MessageBoxScreen.cpp"
|
||||
"MPChatScreen.cpp"
|
||||
"MPConnectScreen.cpp"
|
||||
"MPHostScreen.cpp"
|
||||
"MPJoinScreen.cpp"
|
||||
"MPScoreScreen.cpp"
|
||||
"MPXmlTeams.cpp"
|
||||
"Multiplayer/client.cpp"
|
||||
"Multiplayer/server.cpp"
|
||||
"Multiplayer/transfer_rules.cpp"
|
||||
"Options Screen.cpp"
|
||||
"profiler.cpp"
|
||||
"SaveLoadGame.cpp"
|
||||
"SaveLoadScreen.cpp"
|
||||
"SCREENS.cpp"
|
||||
"Sys Globals.cpp"
|
||||
"ub_config.cpp"
|
||||
"XML_DifficultySettings.cpp"
|
||||
"XML_IntroFiles.cpp"
|
||||
"XML_Layout_MainMenu.cpp"
|
||||
Res/ja2.rc
|
||||
)
|
||||
|
||||
set(Ja2_Libraries
|
||||
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
|
||||
"Dbghelp.lib"
|
||||
Lua
|
||||
"${PROJECT_SOURCE_DIR}/lua51.lib"
|
||||
"${PROJECT_SOURCE_DIR}/lua51.vc9.lib"
|
||||
"Winmm.lib"
|
||||
"${PROJECT_SOURCE_DIR}/SMACKW32.LIB"
|
||||
"${PROJECT_SOURCE_DIR}/binkw32.lib"
|
||||
bfVFS
|
||||
"${PROJECT_SOURCE_DIR}/Multiplayer/raknet/RakNetLibStatic.lib"
|
||||
"ws2_32.lib"
|
||||
)
|
||||
|
||||
# simple function to validate Languages and Application choices
|
||||
include(cmake/ValidateOptions.cmake)
|
||||
@@ -98,7 +160,7 @@ foreach(lang IN LISTS LangTargets)
|
||||
set(isUb $<STREQUAL:${exe},JA2UB>)
|
||||
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
|
||||
|
||||
# static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib
|
||||
# static library for an app/lang combination, e.g. JA2_ENGLISH_SGP.lib
|
||||
add_library(${VeryBadLib})
|
||||
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
|
||||
|
||||
@@ -112,9 +174,9 @@ foreach(lang IN LISTS LangTargets)
|
||||
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)
|
||||
# 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()
|
||||
|
||||
+41
-2
@@ -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();
|
||||
@@ -217,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 );
|
||||
@@ -261,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 );
|
||||
@@ -447,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();
|
||||
@@ -468,6 +502,7 @@ UINT32 LoadSaveScreenHandle(void)
|
||||
}
|
||||
it.next();
|
||||
}
|
||||
#endif
|
||||
if(gfReadOnly)
|
||||
{
|
||||
CreateMessageBox(L" File is read only! Choose a different name? ");
|
||||
@@ -691,6 +726,7 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
|
||||
iLastClickTime = iCurrClickTime;
|
||||
iLastFileClicked = x;
|
||||
//dnl ch81 021213
|
||||
#ifdef USE_VFS
|
||||
gzProfileName[0] = 0;
|
||||
while(FListNode = FListNode->pPrev)
|
||||
{
|
||||
@@ -701,6 +737,7 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
FListNode = FListNode->pNext;
|
||||
@@ -913,6 +950,7 @@ void HandleMainKeyEvents( InputAtom *pEvent )
|
||||
SetInputFieldStringWith16BitString(0, L"");
|
||||
wcscpy(gzFilename, L"");
|
||||
}
|
||||
#ifdef USE_VFS
|
||||
gzProfileName[0] = 0;
|
||||
while(curr = curr->pPrev)
|
||||
{
|
||||
@@ -923,6 +961,7 @@ void HandleMainKeyEvents( InputAtom *pEvent )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+177
-2
@@ -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
|
||||
|
||||
+9
-19
@@ -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( );
|
||||
|
||||
@@ -1615,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:
|
||||
|
||||
@@ -1185,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?*/);
|
||||
@@ -952,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;
|
||||
@@ -1514,6 +1514,12 @@ UINT32 InitializeJA2(void)
|
||||
// INit intensity tables
|
||||
BuildIntensityTable( );
|
||||
|
||||
// Init Event Manager
|
||||
if ( !InitializeEventManager( ) )
|
||||
{
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
|
||||
// Initailize World
|
||||
if ( !InitializeWorld( ) )
|
||||
{
|
||||
@@ -1692,6 +1698,8 @@ void ShutdownJA2(void)
|
||||
|
||||
ShutdownJA2Sound( );
|
||||
|
||||
ShutdownEventManager( );
|
||||
|
||||
ShutdownBaseDirtyRectQueue( );
|
||||
|
||||
// Unload any text box images!
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _JA2_DEMO_ADS_H
|
||||
#define _JA2_DEMO_ADS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
@@ -1,52 +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}/Language Defines.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}/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"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(Ja2_Libraries
|
||||
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
|
||||
"Dbghelp.lib"
|
||||
Lua
|
||||
"${CMAKE_SOURCE_DIR}/lua51.lib"
|
||||
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
|
||||
"Winmm.lib"
|
||||
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
|
||||
"${CMAKE_SOURCE_DIR}/binkw32.lib"
|
||||
bfVFS
|
||||
"ws2_32.lib"
|
||||
Multiplayer
|
||||
PARENT_SCOPE)
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Animation Cache.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Animation Control.h"
|
||||
#include "container.h"
|
||||
#include <math.h>
|
||||
#include "pathai.h"
|
||||
#include "Random.h"
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "QuestText.h" //quest: name
|
||||
#include "laptop.h" //ui positions
|
||||
#include "Utilities.h"
|
||||
#include "Cursors.h"
|
||||
#include "Utils/Cursors.h"
|
||||
#include "sysutil.h" //extra Buffer for scaling image
|
||||
#include "vsurface.h" //fill extra buffer with black color
|
||||
#include "Text.h"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "laptop.h"//UI dimensions, mouse regions
|
||||
#include "Utilities.h"//file names
|
||||
#include "vobject.h"//video objects
|
||||
#include "Cursors.h"
|
||||
#include "Utils/Cursors.h"
|
||||
#include "Text.h"//button text
|
||||
#include "Button System.h"
|
||||
#include "Encyclopedia_new.h"
|
||||
|
||||
@@ -1336,6 +1336,16 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId )
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: Nickname.dat"));
|
||||
|
||||
#ifndef USE_VFS
|
||||
char zFileName[13];
|
||||
char temp;
|
||||
|
||||
for(int i=0;i < 9;i++) // Madd: I couldn't get strcpy or anything to work here... weird... if s/o wants to fix it, go ahead
|
||||
{
|
||||
temp = (char) gMercProfiles[iProfileId].zNickname[i];
|
||||
zFileName[i] = temp;
|
||||
}
|
||||
#else
|
||||
char zFileName[32];
|
||||
if(vfs::Settings::getUseUnicode())
|
||||
{
|
||||
@@ -1345,6 +1355,7 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId )
|
||||
{
|
||||
vfs::String::narrow(gMercProfiles[iProfileId].zNickname, 10, zFileName, 32);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Changed by ADB, rev 1513
|
||||
//strcat(zFileName,IMP_FILENAME_SUFFIX);
|
||||
|
||||
@@ -476,6 +476,7 @@ void GameInitFiles( )
|
||||
{
|
||||
if ( FileExists( FILES_DAT_FILE ) == TRUE )
|
||||
{
|
||||
FileClearAttributes( FILES_DAT_FILE );
|
||||
FileDelete( FILES_DAT_FILE );
|
||||
}
|
||||
|
||||
|
||||
@@ -460,6 +460,7 @@ void GameInitFinances()
|
||||
// unlink Finances data file
|
||||
if( (FileExists( FINANCES_DATA_FILE ) ) )
|
||||
{
|
||||
FileClearAttributes( FINANCES_DATA_FILE );
|
||||
FileDelete( FINANCES_DATA_FILE );
|
||||
}
|
||||
GetBalanceFromDisk( );
|
||||
|
||||
@@ -227,6 +227,7 @@ void GameInitHistory()
|
||||
if( ( FileExists( HISTORY_DATA_FILE ) ) )
|
||||
{
|
||||
// unlink history file
|
||||
FileClearAttributes( HISTORY_DATA_FILE );
|
||||
FileDelete( HISTORY_DATA_FILE );
|
||||
}
|
||||
|
||||
|
||||
@@ -7136,24 +7136,28 @@ void ClearOutTempLaptopFiles( void )
|
||||
// file file
|
||||
if ( (FileExists( "files.dat" ) == TRUE ) )
|
||||
{
|
||||
FileClearAttributes( "files.dat" );
|
||||
FileDelete( "files.dat" );
|
||||
}
|
||||
|
||||
// finances
|
||||
if ( (FileExists( "finances.dat" ) == TRUE ) )
|
||||
{
|
||||
FileClearAttributes( "finances.dat" );
|
||||
FileDelete( "finances.dat" );
|
||||
}
|
||||
|
||||
// email
|
||||
if ( (FileExists( "email.dat" ) == TRUE ) )
|
||||
{
|
||||
FileClearAttributes( "email.dat" );
|
||||
FileDelete( "email.dat" );
|
||||
}
|
||||
|
||||
// history
|
||||
if ( (FileExists( "history.dat" ) == TRUE ) )
|
||||
{
|
||||
FileClearAttributes( "history.dat" );
|
||||
FileDelete( "history.dat" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +248,7 @@ BOOLEAN InitMainMenu( )
|
||||
{
|
||||
is_networked = FALSE;
|
||||
|
||||
#ifdef USE_VFS
|
||||
// remove Multiplayer profile if it exists
|
||||
vfs::CProfileStack *PS = getVFS()->getProfileStack();
|
||||
vfs::CVirtualProfile *pProf = PS->getProfile("_MULTIPLAYER");
|
||||
@@ -255,6 +256,7 @@ BOOLEAN InitMainMenu( )
|
||||
{
|
||||
SGP_THROW_IFFALSE(PS->popProfile(), "Leaving Multiplayer mode : Could not remove \"_MULTIPLAYER\" profile");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
@@ -1,12 +0,0 @@
|
||||
add_library(Multiplayer
|
||||
"client.cpp"
|
||||
"server.cpp"
|
||||
"transfer_rules.cpp"
|
||||
)
|
||||
target_include_directories(Multiplayer PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"raknet"
|
||||
)
|
||||
target_link_libraries(Multiplayer PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/raknet/RakNetLibStatic.lib"
|
||||
)
|
||||
@@ -815,8 +815,10 @@ void recievePATH(RPCParameters *rpcParameters)
|
||||
SendGetNewSoldierPathEvent( pSoldier, SNetPath->sDestGridNo, SNetPath->ubNewState );
|
||||
|
||||
INT16 sCellX, sCellY;
|
||||
ConvertGridNoToCenterCellXY(SNetPath->sAtGridNo, &sCellX, &sCellY);
|
||||
|
||||
|
||||
sCellX = CenterX( SNetPath->sAtGridNo );
|
||||
sCellY = CenterY( SNetPath->sAtGridNo );
|
||||
|
||||
if (( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) ) && !(pSoldier->flags.fNoAPToFinishMove ) )
|
||||
{
|
||||
}
|
||||
@@ -4249,7 +4251,8 @@ void UpdateSoldierFromNetwork (RPCParameters *rpcParameters)
|
||||
pSoldier->stats.bLife=SUpdateNetworkSoldier->bLife;
|
||||
|
||||
INT16 sCellX, sCellY;
|
||||
ConvertGridNoToCenterCellXY(SUpdateNetworkSoldier->sAtGridNo, &sCellX, &sCellY);
|
||||
sCellX = CenterX( SUpdateNetworkSoldier->sAtGridNo );
|
||||
sCellY = CenterY( SUpdateNetworkSoldier->sAtGridNo );
|
||||
|
||||
if( pSoldier->sGridNo != SUpdateNetworkSoldier->sAtGridNo)
|
||||
{
|
||||
@@ -5278,4 +5281,4 @@ void ChatCallback( UINT8 ubResult )
|
||||
void OpenChatMsgBox( void )
|
||||
{
|
||||
DoChatBox((guiCurrentScreen == GAME_SCREEN? true : false),gzMPChatboxText[1],guiCurrentScreen,ChatCallback,NULL);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -3553,6 +3553,33 @@ BOOLEAN Inventory::Save( HWFILE hFile, bool fSavingMap )
|
||||
// The save directory now resides in the data directory (default or custom)
|
||||
BOOLEAN InitSaveDir()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Look for a custom data dir first
|
||||
std::string dataDir = gCustomDataCat.GetRootDir();
|
||||
if( dataDir.empty() || FileGetAttributes( (STR) dataDir.c_str() ) == 0xFFFFFFFF ) {
|
||||
dataDir = gDefaultDataCat.GetRootDir();
|
||||
}
|
||||
|
||||
// The locale-specific save dir location is of the form L"..\\SavedGames"
|
||||
// This has not changed; instead, we strip the ".." at the beginning
|
||||
if(is_networked)
|
||||
{
|
||||
sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 2 );
|
||||
}
|
||||
else
|
||||
sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_SAVEDIRECTORY ] + 2 );
|
||||
|
||||
// This was moved here from SaveGame
|
||||
//Check to see if the save directory exists
|
||||
if( FileGetAttributes( (STR) gSaveDir ) == 0xFFFFFFFF )
|
||||
{
|
||||
//ok the direcotry doesnt exist, create it
|
||||
if( !MakeFileManDirectory( (CHAR8 *)gSaveDir ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(is_networked)
|
||||
{
|
||||
sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 3).c_str() );
|
||||
@@ -3561,6 +3588,7 @@ BOOLEAN InitSaveDir()
|
||||
{
|
||||
sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_SAVEDIRECTORY ] + 3).c_str() );
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -9683,6 +9711,21 @@ BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN DoesUserHaveEnoughHardDriveSpace()
|
||||
{
|
||||
UINT32 uiBytesFree=0;
|
||||
|
||||
uiBytesFree = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
|
||||
|
||||
//check to see if there is enough hard drive space
|
||||
if( uiBytesFree < REQUIRED_FREE_SPACE )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
|
||||
void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID )
|
||||
@@ -9946,6 +9989,69 @@ void UpdateMercMercContractInfo()
|
||||
}
|
||||
}
|
||||
|
||||
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave )
|
||||
{
|
||||
CHAR zFileName1[MAX_PATH];
|
||||
CHAR zFileName2[MAX_PATH];
|
||||
HWFILE hFile;
|
||||
BOOLEAN fFile1Exist, fFile2Exist;
|
||||
SGP_FILETIME CreationTime1, LastAccessedTime1, LastWriteTime1;
|
||||
SGP_FILETIME CreationTime2, LastAccessedTime2, LastWriteTime2;
|
||||
|
||||
fFile1Exist = FALSE;
|
||||
fFile2Exist = FALSE;
|
||||
|
||||
|
||||
//The name of the file
|
||||
sprintf( zFileName1, "%s\\Auto%02d.%S", gSaveDir, 0, pMessageStrings[ MSG_SAVEEXTENSION ] );
|
||||
sprintf( zFileName2, "%s\\Auto%02d.%S", gSaveDir, 1, pMessageStrings[ MSG_SAVEEXTENSION ] );
|
||||
|
||||
if( FileExists( zFileName1 ) )
|
||||
{
|
||||
hFile = FileOpen( zFileName1, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
|
||||
GetFileManFileTime( hFile, &CreationTime1, &LastAccessedTime1, &LastWriteTime1 );
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
fFile1Exist = TRUE;
|
||||
}
|
||||
|
||||
if( FileExists( zFileName2 ) )
|
||||
{
|
||||
hFile = FileOpen( zFileName2, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
|
||||
GetFileManFileTime( hFile, &CreationTime2, &LastAccessedTime2, &LastWriteTime2 );
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
fFile2Exist = TRUE;
|
||||
}
|
||||
|
||||
if( !fFile1Exist && !fFile2Exist )
|
||||
return( -1 );
|
||||
else if( fFile1Exist && !fFile2Exist )
|
||||
{
|
||||
if( fLatestAutoSave )
|
||||
return( 0 );
|
||||
else
|
||||
return( -1 );
|
||||
}
|
||||
else if( !fFile1Exist && fFile2Exist )
|
||||
{
|
||||
if( fLatestAutoSave )
|
||||
return( 1 );
|
||||
else
|
||||
return( -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 )
|
||||
return( 0 );
|
||||
else
|
||||
return( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void HandleOldBobbyRMailOrders()
|
||||
{
|
||||
@@ -93,10 +93,13 @@ BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERT
|
||||
BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||
BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||
|
||||
BOOLEAN DoesUserHaveEnoughHardDriveSpace();
|
||||
|
||||
void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ );
|
||||
|
||||
|
||||
extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav)
|
||||
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave );
|
||||
|
||||
/*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory,
|
||||
but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved
|
||||
@@ -1350,6 +1350,7 @@ BOOLEAN InitSaveGameArray()
|
||||
gbSaveGameArray[VAL_SLOT_START + cnt] = TRUE;
|
||||
|
||||
// anv: read last modified date property of save file
|
||||
#ifdef USE_VFS
|
||||
// get full path to save file
|
||||
vfs::Path vfsPath;
|
||||
vfs::COpenReadFile rfile(zSaveGameName);
|
||||
@@ -1368,6 +1369,7 @@ BOOLEAN InitSaveGameArray()
|
||||
// close
|
||||
CloseHandle( hFile );
|
||||
rfile->close();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1,7 +1,8 @@
|
||||
set(sgpSrc
|
||||
set(SGPSrc
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Button Sound Control.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Button System.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Compression.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Container.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Cursor Control.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/DEBUG.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/debug_util.cpp"
|
||||
@@ -9,11 +10,14 @@ set(sgpSrc
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/DirectDraw Calls.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/DirectX Common.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/English.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/FileCat.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/FileMan.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Flic.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Font.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/himage.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/impTGA.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/input.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Install.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/LibraryDataBase.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/line.cpp"
|
||||
@@ -22,6 +26,8 @@ set(sgpSrc
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PCX.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/PngLoader.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Random.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/readdir.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/RegInst.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sgp.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sgp_logger.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/shading.cpp"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,132 @@
|
||||
//***********************************************
|
||||
//
|
||||
// Filename : Container.h
|
||||
//
|
||||
// Purpose : prototypes for the container file
|
||||
//
|
||||
// Modification History : 25 Nov 96 Creation
|
||||
//
|
||||
//***********************************************
|
||||
|
||||
#ifndef _CONTAINER_H
|
||||
#define _CONTAINER_H
|
||||
|
||||
//***********************************************
|
||||
//
|
||||
// Includes
|
||||
//
|
||||
//
|
||||
//***********************************************
|
||||
|
||||
#include "types.h"
|
||||
|
||||
//***********************************************
|
||||
//
|
||||
// Defines and typedefs
|
||||
//
|
||||
//***********************************************
|
||||
#define ORDLIST_ERROR -1
|
||||
#define ORDLIST_EQUAL 0
|
||||
#define ORDLIST_LEFT_LESS 1
|
||||
#define ORDLIST_RIGHT_LESS 2
|
||||
|
||||
typedef void * HCONTAINER;
|
||||
typedef HCONTAINER HSTACK;
|
||||
typedef HCONTAINER HQUEUE;
|
||||
typedef HCONTAINER HLIST;
|
||||
typedef HCONTAINER HORDLIST;
|
||||
|
||||
//***********************************************
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
//***********************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// call these functions to initialize and shutdown the debug messages for
|
||||
// containers
|
||||
extern void InitializeContainers(void);
|
||||
extern void ShutdownContainers(void);
|
||||
|
||||
// Stack Functions
|
||||
// CreateStack(estimated number of items in stack, size of each item
|
||||
// Push(handle to container returned from CreateStack, data to be passed in (must be void *)
|
||||
// : returns handle to new stack
|
||||
// Pop(handle to container returned from CreateStack, data to be passed in (must be void *)
|
||||
// : returns BOOLEAN
|
||||
// DeleteStack deletes the stack container
|
||||
// StackSize returns size of stack
|
||||
|
||||
extern HSTACK CreateStack(UINT32 num_of_elem , UINT32 siz_of_each);
|
||||
extern HSTACK Push(HSTACK hStack, void *data);
|
||||
extern BOOLEAN Pop(HSTACK hStack, void *data);
|
||||
extern UINT32 StackSize(HSTACK hStack);
|
||||
extern BOOLEAN DeleteStack(HSTACK hStack);
|
||||
extern BOOLEAN PeekStack(HSTACK hStack, void *data);
|
||||
|
||||
// Queue Functions
|
||||
// CreateQueue(estimated number of items in queue, size of each item
|
||||
// AddtoQueue(handle to container returned from CreateQueue, data to be passed in (must be void *))
|
||||
// : returns handle to queue
|
||||
// RemfromQueue(handle to container returned from CreateQueue, variable where data is stored (must be void *))
|
||||
// : returns BOOLEAN
|
||||
// PeekQueue(handle to the queue, variable where peeked data is stored). Item is not deleted.
|
||||
// : returns BOOLEAN
|
||||
// QueueSize(handle to the queue) returns the queue size
|
||||
// DeleteQueue(handle to container) Delete the queue container
|
||||
// : returns BOOLEAN
|
||||
|
||||
extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each);
|
||||
extern HQUEUE AddtoQueue(HQUEUE hQueue, void *data);
|
||||
extern BOOLEAN RemfromQueue(HQUEUE hQueue,void *data);
|
||||
extern BOOLEAN PeekQueue(HQUEUE hQueue, void *data);
|
||||
extern UINT32 QueueSize(HQUEUE hQueue);
|
||||
extern BOOLEAN DeleteQueue(HQUEUE hQueue);
|
||||
|
||||
// List Functions
|
||||
// CreateList(estimated number of items in queue, size of each item
|
||||
// AddtoList(handle to container returned from CreateQueue, data to be passed in (must be void *)
|
||||
// position where data is to be added (0...sizeof(list))
|
||||
// : returns handle to new list
|
||||
// RemfromList(handle to container returned from CreateList, variable where data is stored (must be void *)
|
||||
// position where data is to be deleted (0...sizeof(list)-1)
|
||||
// PeekList(handle to the list, variable where peeked data is stored). Item is not deleted.
|
||||
// position where data is to be peeked (0...sizeof(list)-1)
|
||||
// ListSize(handle to the list) returns the list size
|
||||
// DeleteList(handle to the list) Delete the list container
|
||||
|
||||
extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each);
|
||||
extern HLIST AddtoList(HLIST hList, void *data, UINT32 position);
|
||||
extern BOOLEAN RemfromList(HLIST hList,void *data, UINT32 position);
|
||||
extern BOOLEAN PeekList(HLIST hList, void *data, UINT32 position);
|
||||
extern UINT32 ListSize(HLIST hList);
|
||||
extern BOOLEAN DeleteList(HLIST hList);
|
||||
extern BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos);
|
||||
extern BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos);
|
||||
|
||||
// Ordered List Functions
|
||||
// CreateOrdList(estimated number of items in ordered list, size of each item,
|
||||
// pointer to a compare function that returns info on whether the data in the ordered stack
|
||||
// is < or > the new data to be added into the ordered list.
|
||||
// AddtoOrdList(handle to container returned from CreateOrdList, data to be passed in (must be void *)
|
||||
// RemfromOrdList(handle to container returned from CreateList, variable where data is stored (must be void *)
|
||||
// position where data is to be deleted (0...sizeof(list)-1)
|
||||
// PeekOrdList(handle to the list, variable where peeked data is stored). Item is not deleted.
|
||||
// position where data is to be peeked (0...sizeof(list)-1)
|
||||
// OrdListSize(handle to the list) returns the ordered list size
|
||||
// DeleteOrdList(handle to the list) Delete the ordered list container
|
||||
|
||||
extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32));
|
||||
extern HLIST AddtoOrdList(HLIST hList, void *data);
|
||||
extern BOOLEAN RemfromOrdList(HLIST hList,void *data, UINT32 position);
|
||||
extern BOOLEAN PeekOrdList(HLIST hList, void *data, UINT32 position);
|
||||
extern UINT32 OrdListSize(HLIST hList);
|
||||
extern BOOLEAN DeleteOrdList(HLIST hList);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -252,8 +252,10 @@ namespace sgp
|
||||
// compatibility with std::exception
|
||||
Exception(WString const& msg, std::exception& ex SGP_CALLER_LOCATION);
|
||||
|
||||
#if defined(USE_VFS)
|
||||
// compatibility with vfs::Exception
|
||||
Exception(WString const& msg, vfs::Exception& ex SGP_CALLER_LOCATION);
|
||||
#endif
|
||||
|
||||
virtual const char* what() const throw();
|
||||
|
||||
@@ -562,6 +562,7 @@ sgp::Exception::Exception(sgp::WString const& msg, Exception& ex SGP_CALLER_LOCA
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
sgp::Exception::Exception(sgp::WString const& msg, vfs::Exception& ex SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
vfs::Exception::CALLSTACK::iterator it = ex.m_CallStack.begin();
|
||||
@@ -583,6 +584,7 @@ sgp::Exception::Exception(sgp::WString const& msg, vfs::Exception& ex SGP_CALLER
|
||||
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
#endif
|
||||
|
||||
sgp::Exception::Exception(WString const& msg, std::exception& ex SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// Snap: Implementation of the TFileCat class
|
||||
//
|
||||
#include "FileCat.h"
|
||||
#include "readdir.h"
|
||||
|
||||
|
||||
// Remove a slash or backslash (if any) from the end of a string
|
||||
void ChompSlash(std::string& s)
|
||||
{
|
||||
if ( s.empty() ) return;
|
||||
|
||||
if ( *s.rbegin() == '\\' || *s.rbegin() == '/' ) {
|
||||
s.erase( s.length() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build a new file catalogue by recursively traversing the root directory
|
||||
void TFileCat::NewCat(std::string root)
|
||||
{
|
||||
fRootDir = root;
|
||||
ChompSlash(fRootDir);
|
||||
|
||||
fFileCat.clear();
|
||||
|
||||
TraverseDir(fRootDir);
|
||||
}
|
||||
|
||||
|
||||
// Look for a given file in the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
bool TFileCat::FindFile(std::string path, bool pathIncludesRoot) const
|
||||
{
|
||||
if (pathIncludesRoot) return fFileCat.find(path) != fFileCat.end();
|
||||
else return fFileCat.find(fRootDir + '\\' + path) != fFileCat.end();
|
||||
}
|
||||
|
||||
|
||||
// Delete a given file from the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
size_t TFileCat::RemoveFile(std::string path, bool pathIncludesRoot)
|
||||
{
|
||||
if (pathIncludesRoot) return fFileCat.erase(path);
|
||||
else return fFileCat.erase(fRootDir + '\\' + path);
|
||||
}
|
||||
|
||||
|
||||
// Delete all files from a given directory in the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
size_t TFileCat::RemoveDir(std::string dir, bool pathIncludesRoot)
|
||||
{
|
||||
if ( !pathIncludesRoot ) dir = fRootDir + '\\' + dir;
|
||||
ChompSlash(dir);
|
||||
std::string dirlower = dir + '\\';
|
||||
std::string dirupper = dir + char('\\'+1);
|
||||
|
||||
TCatalogue::iterator upper = fFileCat.upper_bound(dirupper);
|
||||
TCatalogue::iterator lower;
|
||||
|
||||
int deleted = 0;
|
||||
|
||||
while ( ( lower = fFileCat.lower_bound(dirlower) ) != upper) {
|
||||
fFileCat.erase(lower);
|
||||
deleted++;
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
|
||||
// Recursively traverse a directory, adding regular files to the catalogue
|
||||
void TFileCat::TraverseDir(std::string dir, int depth)
|
||||
{
|
||||
using std::string;
|
||||
static string dot( ".");
|
||||
static string dotdot( "..");
|
||||
static string svn( ".svn");
|
||||
|
||||
if (!dir.empty()) dir += '\\';
|
||||
|
||||
TReadDir readDir((dir + "*").c_str());
|
||||
|
||||
char const* fileName;
|
||||
unsigned attrib;
|
||||
|
||||
while ( readDir.NextFile(fileName, attrib) ) {
|
||||
if (dot == fileName || dotdot == fileName || svn == fileName) continue;
|
||||
|
||||
string fullPath = dir + fileName;
|
||||
|
||||
if (attrib & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
if (depth < 0) TraverseDir(fullPath);
|
||||
else if (depth > 0) TraverseDir(fullPath, depth-1);
|
||||
}
|
||||
else {
|
||||
fFileCat.insert(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Snap: Declaration of the TFileCat class
|
||||
//
|
||||
// This class catalogues files in a directory and all its subdirectories
|
||||
//
|
||||
#ifndef FILECAT_H
|
||||
#define FILECAT_H
|
||||
|
||||
#include "stringicmp.h"
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
|
||||
class TFileCat {
|
||||
public:
|
||||
|
||||
TFileCat(std::string root) { NewCat(root); }
|
||||
TFileCat() {}
|
||||
|
||||
// Build a new file catalogue by recursively traversing the root directory
|
||||
void NewCat(std::string root);
|
||||
|
||||
std::string GetRootDir() const { return fRootDir; }
|
||||
|
||||
// Look for a given file in the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
bool FindFile(std::string path, bool pathIncludesRoot = false) const;
|
||||
|
||||
// Delete a given file from the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
size_t RemoveFile(std::string path, bool pathIncludesRoot = false);
|
||||
|
||||
// Delete all files from a given directory in the catalogue
|
||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
||||
size_t RemoveDir(std::string dir, bool pathIncludesRoot = false);
|
||||
|
||||
private:
|
||||
|
||||
typedef std::set<std::string, TStringiLess> TCatalogue;
|
||||
|
||||
std::string fRootDir;
|
||||
TCatalogue fFileCat;
|
||||
|
||||
// Recursively traverse a directory, adding regular files to the catalogue
|
||||
void TraverseDir(std::string dir, int depth = -1);
|
||||
};
|
||||
|
||||
#endif // FILECAT_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,9 +20,12 @@
|
||||
//**************************************************************************
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "Windows.h"
|
||||
|
||||
#include "FileCat.h"
|
||||
|
||||
#include "Container.h"
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
@@ -58,6 +61,17 @@
|
||||
#define FILE_IS_OFFLINE 256
|
||||
|
||||
|
||||
|
||||
//File Attributes settings
|
||||
#define FILE_ATTRIBUTES_ARCHIVE FILE_ATTRIBUTE_ARCHIVE
|
||||
#define FILE_ATTRIBUTES_HIDDEN FILE_ATTRIBUTE_HIDDEN
|
||||
#define FILE_ATTRIBUTES_NORMAL FILE_ATTRIBUTE_NORMAL
|
||||
#define FILE_ATTRIBUTES_OFFLINE FILE_ATTRIBUTE_OFFLINE
|
||||
#define FILE_ATTRIBUTES_READONLY FILE_ATTRIBUTE_READONLY
|
||||
#define FILE_ATTRIBUTES_SYSTEM FILE_ATTRIBUTE_SYSTEM
|
||||
#define FILE_ATTRIBUTES_TEMPORARY FILE_ATTRIBUTE_TEMPORARY
|
||||
#define FILE_ATTRIBUTES_DIRECTORY FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
// Snap, Kaiden: This define duplicates a standard MFC define
|
||||
// Added to resolve some intractable issue with MSVC6
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
@@ -70,15 +84,26 @@ typedef FILETIME SGP_FILETIME;
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
// Snap: At program launch we build two directory catalogues:
|
||||
// one for the default Data directory, the other for the custom Data directory.
|
||||
extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
|
||||
extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp)
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
//**************************************************************************
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
extern BOOLEAN InitializeFileManager( STR strIndexFilename );
|
||||
|
||||
extern void ShutdownFileManager( void );
|
||||
extern void FileDebug( BOOLEAN f );
|
||||
|
||||
|
||||
BOOLEAN FileExists( STR strFilename );
|
||||
@@ -90,6 +115,7 @@ extern void FileClose( HWFILE );
|
||||
|
||||
extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead );
|
||||
extern BOOLEAN FileReadLine( HWFILE hFile, std::string* pDest );
|
||||
extern BOOLEAN FileReadLine( HWFILE hFile, STR8 pDest, UINT32 uiDestSize, UINT32 *puiBytesRead );
|
||||
extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten );
|
||||
extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead );
|
||||
|
||||
@@ -105,6 +131,9 @@ BOOLEAN SetFileManCurrentDirectory( STR pcDirectory );
|
||||
BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory );
|
||||
BOOLEAN GetExecutableDirectory( STRING512 pcDirectory );
|
||||
|
||||
BOOLEAN DirectoryExists( STRING512 pcDirectory );
|
||||
BOOLEAN MakeFileManDirectory( STRING512 pcDirectory );
|
||||
|
||||
// WARNING: THESE DELETE ALL FILES IN THE DIRECTORY ( and all subdirectories if fRecursive is TRUE!! )
|
||||
BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive);
|
||||
BOOLEAN EraseDirectory( STRING512 pcDirectory);
|
||||
@@ -121,9 +150,57 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct );
|
||||
BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct );
|
||||
void GetFileClose( GETFILESTRUCT *pGFStruct );
|
||||
|
||||
BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists);
|
||||
BOOLEAN FileMove(STR strOldName, STR strNewName);
|
||||
|
||||
//Added by Kris Morness
|
||||
BOOLEAN FileSetAttributes( STR filename, UINT32 uiNewAttribs );
|
||||
UINT32 FileGetAttributes( STR filename );
|
||||
|
||||
BOOLEAN FileClearAttributes( STR strFilename );
|
||||
|
||||
//returns true if at end of file, else false
|
||||
BOOLEAN FileCheckEndOfFile( HWFILE hFile );
|
||||
|
||||
|
||||
|
||||
BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime );
|
||||
|
||||
INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_FIND_DATA *pFind );
|
||||
|
||||
|
||||
|
||||
// CompareSGPFileTimes() returns...
|
||||
// -1 if the First file time is less than second file time. ( first file is older )
|
||||
// 0 First file time is equal to second file time.
|
||||
// +1 First file time is greater than second file time ( first file is newer ).
|
||||
INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFileTime );
|
||||
|
||||
// One call comparison of file times, allowing for a certain leeway in cases where
|
||||
// files times may be slightly different due to SourceSafe of copying
|
||||
BOOLEAN FileIsOlderThanFile(CHAR8 *pcFileName1, CHAR8 *pcFileName2, UINT32 ulNumSeconds);
|
||||
|
||||
// Pass in the Fileman file handle of an OPEN file and it will return..
|
||||
// if its a Real File, the return will be the handle of the REAL file
|
||||
// if its a LIBRARY file, the return will be the handle of the LIBRARY
|
||||
HANDLE GetRealFileHandleFromFileManFileHandle( HWFILE hFile );
|
||||
|
||||
BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory);
|
||||
|
||||
|
||||
//Gets the amount of free space on the hard drive that the main executeablt is runnning from
|
||||
UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
|
||||
|
||||
//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ )
|
||||
UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter );
|
||||
|
||||
// Flugente: simple wrapper to check whether an audio file in mp3/ogg/wav format exists
|
||||
BOOLEAN SoundFileExists( STR strFilename, STR zFoundFilename );
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
//**************************************************************************
|
||||
//
|
||||
// Filename : Install.c
|
||||
//
|
||||
// Purpose : install routines
|
||||
//
|
||||
// Modification history :
|
||||
//
|
||||
// 02dec96:HJH - Creation
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Includes
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
#include "types.h"
|
||||
#include <windows.h>
|
||||
#include "Install.h"
|
||||
#include "RegInst.h"
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Typedefs
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
BOOLEAN InstallApplication( STR strAppname, STR strPath )
|
||||
{
|
||||
HKEY hKey;
|
||||
BOOL fRet = TRUE;
|
||||
|
||||
hKey = GetAppRegistryKey();
|
||||
RegCloseKey( hKey );
|
||||
|
||||
//hKeySection = GetSectionKey("Startup");
|
||||
//RegCloseKey( hKeySection );
|
||||
|
||||
fRet = fRet && WriteProfileChar( "Startup", "InstPath", strPath );
|
||||
|
||||
return(fRet);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user