diff --git a/.github/ISSUE_TEMPLATE/01-build-failure.md b/.github/ISSUE_TEMPLATE/01-build-failure.md new file mode 100644 index 000000000..c636f8bc0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01-build-failure.md @@ -0,0 +1,53 @@ +--- +name: Build Failure +about: Report a failure to build current code in any supported configuration. +labels: 'build-failure' +title: '[Build Failure] ' + +--- + + +### Build Version + + +#### Operating System Environment + +* [ ] Microsoft Windows (32-bit) +* [ ] Microsoft Windows (64-bit) +* [ ] Mac OS X +* [ ] Linux: + +#### CPU Environment + +* [ ] x86 (32-bit Intel/AMD) +* [ ] x86\_64 (64-bit Intel/AMD) +* [ ] ARM (32-bit) +* [ ] ARM64 (64-bit; sometimes called AArch64) +* [ ] Other (RISC V, PPC...) + +### Description + + +#### Regression Status + + +### Steps to Reproduce + diff --git a/.github/ISSUE_TEMPLATE/02-runtime-issue.md b/.github/ISSUE_TEMPLATE/02-runtime-issue.md new file mode 100644 index 000000000..d18bcf0ac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02-runtime-issue.md @@ -0,0 +1,86 @@ +--- +name: Runtime Bug/Crash +about: Report a bug or crash at runtime in any supported configuration. +labels: 'bug' +title: '[Runtime Bug/Crash] ' + +--- + + +### Build Version + + +#### Operating System Environment + +* [ ] Microsoft Windows (32-bit) +* [ ] Microsoft Windows (64-bit) +* [ ] Mac OS X +* [ ] Linux: + +#### CPU Environment + +* [ ] x86 (32-bit Intel/AMD) +* [ ] x86\_64 (64-bit Intel/AMD) +* [ ] ARM (32-bit) +* [ ] ARM64 (64-bit; sometimes called AArch64) +* [ ] Other (RISC V, PPC...) + +#### Game Environment + + +### Description + + +#### Regression Status + + +### Steps to Reproduce + + +* Game modes affected: + * [ ] Single player + * [ ] Multiplayer competitive + * [ ] Anarchy + * [ ] Hyper-Anarchy + * [ ] Robo-Anarchy + * [ ] Team Anarchy + * [ ] Capture the Flag + * [ ] Bounty + * [ ] Entropy + * [ ] Hoard + * [ ] Monsterball + * [ ] Multiplayer cooperative + + +* Players affected by issue: + * [ ] Game host + * [ ] Game guests \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ec0a0af8..fad0a0d3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,6 @@ jobs: - {runner: macos-12, preset: mac} # This is supposed to be Intel for now, and what macos-latest is defaulting to for some reason (as of 04/2024) - {runner: macos-14, preset: mac} # This is supposed to be M1 - {runner: ubuntu-latest, preset: linux} - build_type: [Debug, Release] runs-on: ${{ matrix.os.runner }} @@ -32,21 +31,23 @@ jobs: - name: Install Linux dependencies if: ${{ matrix.os.preset == 'linux' }} run: | - sudo dpkg --add-architecture i386 sudo apt update sudo apt install -y --no-install-recommends \ - ninja-build make cmake g++ libsdl1.2-dev libsdl-image1.2-dev libncurses-dev \ - libxext6:i386 # for ./scripts/hogutils/hogUtils-i686 binary - mkdir ~/Descent3 + ninja-build cmake g++ libsdl1.2-dev libsdl-image1.2-dev libncurses-dev - name: Configure CMake run: cmake --preset ${{ matrix.os.preset }} - - name: Build - run: cmake --build --preset ${{ matrix.os.preset }} --config ${{ matrix.build_type }} + - name: Debug Build + run: cmake --build --preset ${{ matrix.os.preset }} --config Debug --verbose + + - name: Release Build + run: cmake --build --preset ${{ matrix.os.preset }} --config Release --verbose - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: build_${{ matrix.os.runner }}_${{ matrix.build_type }} - path: "${{ github.workspace }}/builds/${{ matrix.os.preset }}/Descent3/${{ matrix.build_type }}" + name: build_${{ matrix.os.runner }} + path: | + ${{ github.workspace }}/builds/${{ matrix.os.preset }}/Descent3/Debug/ + ${{ github.workspace }}/builds/${{ matrix.os.preset }}/Descent3/Release/ diff --git a/.gitignore b/.gitignore index 18c61a086..93164748f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ x86/ #[Aa][Rr][Mm]64/ bld/ [Bb]in/ +[Bb]uilds/ [Oo]bj/ [Ll]og/ [Ll]ogs/ @@ -404,8 +405,4 @@ cmake-build-* # Linux stuff build -*.so - - -# D3 specific -*.hog +builds diff --git a/2dlib/CMakeLists.txt b/2dlib/CMakeLists.txt index 9e59efdb7..a03000921 100644 --- a/2dlib/CMakeLists.txt +++ b/2dlib/CMakeLists.txt @@ -1,13 +1,13 @@ set(HEADERS lib2d.h) set(CPPS - font.cpp - hardsurf.cpp - memsurf.cpp - pen.cpp - pentext.cpp - screen.cpp - surface.cpp - viewport.cpp) + font.cpp + hardsurf.cpp + memsurf.cpp + pen.cpp + pentext.cpp + screen.cpp + surface.cpp + viewport.cpp) add_library(2dlib STATIC ${HEADERS} ${CPPS}) - \ No newline at end of file + diff --git a/AudioEncode/CMakeLists.txt b/AudioEncode/CMakeLists.txt index b1de0b197..8415e67b1 100644 --- a/AudioEncode/CMakeLists.txt +++ b/AudioEncode/CMakeLists.txt @@ -1,6 +1,6 @@ -set(HEADERS ) -set(CPPS - encoder.cpp) - -add_library(AudioEncode STATIC ${HEADERS} ${CPPS}) -target_link_libraries(AudioEncode libacm) \ No newline at end of file +set(HEADERS) +set(CPPS + encoder.cpp) + +add_library(AudioEncode STATIC ${HEADERS} ${CPPS}) +target_link_libraries(AudioEncode libacm) diff --git a/Brewfile b/Brewfile index 4c22bee01..9a10932c6 100644 --- a/Brewfile +++ b/Brewfile @@ -8,4 +8,5 @@ cask "xquartz" brew "sdl12-compat" brew "sdl2_image" +brew "cmake" brew "ninja" diff --git a/CMakeLists.txt b/CMakeLists.txt index 98a49d36d..93c095d09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,136 +1,138 @@ -cmake_minimum_required(VERSION 3.19) - -project(Descent3 VERSION 1.5.500) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -if (UNIX) - set(D3_GAMEDIR "~/Descent3/") - - string(APPEND CMAKE_CXX_FLAGS " -Wno-write-strings -Wno-multichar ${BITS} ${EXTRA_CXX_FLAGS}") - string(APPEND CMAKE_C_FLAGS " ${BITS}") - - find_package(SDL REQUIRED) - if (APPLE) - # Provide FIND_PACKAGE( SDL_image ) below with an include dir and library that work with brew-installed sdl2_image - find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h PATH_SUFFIXES include/SDL2) - find_library(SDL_IMAGE_LIBRARY SDL2_image) - endif() - - find_package(SDL_image REQUIRED) - find_package(Curses REQUIRED) - find_package(OpenGL REQUIRED) -message( "SDL Include Dir is " ${SDL_INCLUDE_DIR} ) -endif() - -if (UNIX AND NOT APPLE) - message("Building for Linux") - add_definitions( -D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES) - set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR} ) -endif() - -if (APPLE) - message("Building for MAC OSX") - add_definitions(-D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES) - set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR} "/usr/X11/include" ) -endif() - -if (WIN32) - set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "lib/win" "lib/win/directx") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc /RTC1 /W3 /nologo /c /Zi /TP /errorReport:prompt") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /FD /EHsc /W3 /nologo /c /Zi /TP /errorReport:prompt") - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") - set(CMAKE_MODULE_LINKER_FLAGS "/SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") - add_definitions(-DIS_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX) - - set(PLATFORM_INCLUDES "lib/win/directx" "lib/win") - - set(CMAKE_FIND_LIBRARY_PREFIXES "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") - - find_library(DSOUND_LIBRARY NAMES dsound "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") - find_library(DINPUT_LIBRARY NAMES dinput "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") - find_library(DXGUID_LIBRARY NAMES dxguid "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") - find_library(DDRAW_LIBRARY NAMES ddraw "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") - - if (MSVC AND CMAKE_CXX_SIMULATE_ID STREQUAL "") - add_compile_options("/we4150") # deletion of pointer to incomplete type 'type'; no destructor called -# add_compile_options("/we4305") # truncation from 'X' to 'Y' - add_compile_options("/we4474") # too many arguments passed for format string - add_compile_options("/we4700") # uninitialized local variable 'X' used - add_compile_options("/we4804") # unsafe use of type 'bool' in operation - add_compile_options("/we4806") # unsafe operation: no value of type 'bool' promoted to type 'int' can equal the given constant - add_compile_options("/we4473") # not enough arguments passed for format string - add_compile_options("/we4477") # format string requires argument of type X but variadic argument Y has type Z - add_compile_options("/we4715") # 'function' : not all control paths return a value - add_compile_options("/we4834") # discarding return value of function with [[nodiscard]] attribute - endif() -endif () - -include_directories("lib" "Descent3" ${PLATFORM_INCLUDES}) - -# file(GLOB_RECURSE INCS "*.h") - -add_subdirectory(2dlib) -add_subdirectory(AudioEncode) -add_subdirectory(bitmap) -add_subdirectory(cfile) -add_subdirectory(czip) -add_subdirectory(d3music) - -if (WIN32) - add_subdirectory(dd_grwin32) - add_subdirectory(dd_vidwin32) - add_subdirectory(win32) - add_subdirectory(dd_sndlib) - add_subdirectory(ddio_win) -endif() - -if (UNIX) - add_subdirectory(linux) - add_subdirectory(ddvid_lnx) - add_subdirectory(dd_lnxsound) - add_subdirectory(lnxcontroller) - add_subdirectory(ddio_lnx) -endif() - -add_subdirectory(ddio_common) -add_subdirectory(fix) -add_subdirectory(manage) -add_subdirectory(grtext) -add_subdirectory(mem) -add_subdirectory(misc) -add_subdirectory(model) -add_subdirectory(module) -add_subdirectory(movie) -add_subdirectory(music) -add_subdirectory(networking) -add_subdirectory(physics) -add_subdirectory(renderer) -add_subdirectory(rtperformance) -add_subdirectory(sndlib) -add_subdirectory(stream_audio) -add_subdirectory(ui) -add_subdirectory(unzip) -add_subdirectory(vecmat) -add_subdirectory(libmve) -add_subdirectory(md5) -add_subdirectory(libacm) -add_subdirectory(Descent3) - -# For now we don't need to build the scripts under windows, so we'll only include -# the directory when building for linux/osx. In the future we may want to to fix bugs, etc. -if(UNIX) - add_subdirectory(netgames) - add_subdirectory(netcon) - add_subdirectory(scripts) -endif() - -# set default cmake build type to Debug (None Debug Release RelWithDebInfo MinSizeRel) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Debug") -endif() +cmake_minimum_required(VERSION 3.19) + +project(Descent3 VERSION 1.5.500) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if(UNIX) + set(D3_GAMEDIR "~/Descent3/") + + string(APPEND CMAKE_CXX_FLAGS " -Wno-write-strings -Wno-multichar ${BITS} ${EXTRA_CXX_FLAGS}") + string(APPEND CMAKE_C_FLAGS " ${BITS}") + + find_package(SDL REQUIRED) + if(APPLE) + # Provide FIND_PACKAGE( SDL_image ) below with an include dir and library that work with brew-installed sdl2_image + find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h PATH_SUFFIXES include/SDL2) + find_library(SDL_IMAGE_LIBRARY SDL2_image) + endif() + + find_package(SDL_image REQUIRED) + find_package(Curses REQUIRED) + find_package(OpenGL REQUIRED) + message("SDL Include Dir is " ${SDL_INCLUDE_DIR}) +endif() + +if(UNIX AND NOT APPLE) + message("Building for Linux") + add_definitions( -D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -D__32BIT__ -DHAVEALLOCA_H -D_USE_OGL_ACTIVE_TEXTURES) + set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR}) +endif() + +if(APPLE) + message("Building for MAC OSX") + add_definitions(-D_DEBUG -D__LINUX__ -DLINUX -D_MAX_PATH=260 -D_MAX_FNAME=256 -D_REENRANT -DMACOSX=1 -D_USE_OGL_ACTIVE_TEXTURES) + set(PLATFORM_INCLUDES "lib/linux" ${SDL_INCLUDE_DIR} "/usr/X11/include") +endif() + +if(WIN32) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "lib/win" "lib/win/directx") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc /RTC1 /W3 /nologo /c /Zi /TP /errorReport:prompt") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /FD /EHsc /W3 /nologo /c /Zi /TP /errorReport:prompt") + + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") + set(CMAKE_MODULE_LINKER_FLAGS "/SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") + add_definitions(-DIS_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX) + + set(PLATFORM_INCLUDES "lib/win/directx" "lib/win") + + set(CMAKE_FIND_LIBRARY_PREFIXES "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + + find_library(DSOUND_LIBRARY NAMES dsound "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") + find_library(DINPUT_LIBRARY NAMES dinput "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") + find_library(DXGUID_LIBRARY NAMES dxguid "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") + find_library(DDRAW_LIBRARY NAMES ddraw "${CMAKE_SOURCE_DIR}/lib/win" "${CMAKE_SOURCE_DIR}/lib/win/directx") + + if(MSVC AND CMAKE_CXX_SIMULATE_ID STREQUAL "") + add_compile_options("/we4150") # deletion of pointer to incomplete type 'type'; no destructor called +# add_compile_options("/we4305") # truncation from 'X' to 'Y' + add_compile_options("/we4474") # too many arguments passed for format string + add_compile_options("/we4700") # uninitialized local variable 'X' used + add_compile_options("/we4804") # unsafe use of type 'bool' in operation + add_compile_options("/we4806") # unsafe operation: no value of type 'bool' promoted to type 'int' can equal the given constant + add_compile_options("/we4473") # not enough arguments passed for format string + add_compile_options("/we4477") # format string requires argument of type X but variadic argument Y has type Z + add_compile_options("/we4715") # 'function' : not all control paths return a value + add_compile_options("/we4834") # discarding return value of function with [[nodiscard]] attribute + endif() +endif() + +include_directories("lib" "Descent3" ${PLATFORM_INCLUDES}) + +# file(GLOB_RECURSE INCS "*.h") + +add_subdirectory(2dlib) +add_subdirectory(AudioEncode) +add_subdirectory(bitmap) +add_subdirectory(cfile) +add_subdirectory(czip) +add_subdirectory(d3music) + +if(WIN32) + add_subdirectory(dd_grwin32) + add_subdirectory(dd_vidwin32) + add_subdirectory(win32) + add_subdirectory(dd_sndlib) + add_subdirectory(ddio_win) +endif() + +if(UNIX) + add_subdirectory(linux) + add_subdirectory(ddvid_lnx) + add_subdirectory(dd_lnxsound) + add_subdirectory(lnxcontroller) + add_subdirectory(ddio_lnx) +endif() + +add_subdirectory(ddio_common) +add_subdirectory(fix) +add_subdirectory(manage) +add_subdirectory(grtext) +add_subdirectory(mem) +add_subdirectory(misc) +add_subdirectory(model) +add_subdirectory(module) +add_subdirectory(movie) +add_subdirectory(music) +add_subdirectory(networking) +add_subdirectory(physics) +add_subdirectory(renderer) +add_subdirectory(rtperformance) +add_subdirectory(sndlib) +add_subdirectory(stream_audio) +add_subdirectory(ui) +add_subdirectory(unzip) +add_subdirectory(vecmat) +add_subdirectory(libmve) +add_subdirectory(md5) +add_subdirectory(libacm) +add_subdirectory(Descent3) + +add_subdirectory(tools) + +# For now we don't need to build the scripts under windows, so we'll only include +# the directory when building for linux/osx. In the future we may want to to fix bugs, etc. +if(UNIX) + add_subdirectory(netgames) + add_subdirectory(netcon) + add_subdirectory(scripts) +endif() + +# set default cmake build type to Debug (None Debug Release RelWithDebInfo MinSizeRel) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() diff --git a/Descent3/AImain.cpp b/Descent3/AImain.cpp index fe5f02129..dbf3660cb 100644 --- a/Descent3/AImain.cpp +++ b/Descent3/AImain.cpp @@ -1573,20 +1573,20 @@ bool compute_dodge_dir(/* vector *dodge_dir, */ object *obj, object *dodge_obj); // Inside walkers will suck resources -extern char *Ai_class_strings[MAX_AI_INIT_CLASSES] = {"Static", "Pure Path", "Fully AIS"}; +const char *const Ai_class_strings[MAX_AI_INIT_CLASSES] = {"Static", "Pure Path", "Fully AIS"}; -extern char *Ai_type_strings[MAX_AI_INIT_TYPES] = { +const char *const Ai_type_strings[MAX_AI_INIT_TYPES] = { "Fly Lander", "Stalker", "Evader 1", "Evader 2", "Stationary Turret", "AIS", "Melee1", "Bird Flock 1", "Herd 1"}; -extern char *Ai_movement_type_strings[MAX_AI_INIT_MOVEMENT_TYPES] = {"Standing", "Flying", "Rolling", "Walking"}; +const char *const Ai_movement_type_strings[MAX_AI_INIT_MOVEMENT_TYPES] = {"Standing", "Flying", "Rolling", "Walking"}; // AI Movement flying types -extern char *Ai_movement_subtype_flying_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES] = { +const char *const Ai_movement_subtype_flying_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES] = { "Normal", "Path", "Helicopter", "Hovercraft", "Jet", "Player", "Buddy"}; // AI Movement walking types -extern char *Ai_movement_subtype_walking_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES] = { +const char *const Ai_movement_subtype_walking_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES] = { "Restricted Flat", "Restricted Low-angle", "Restricted High_angle", "Non-restricted", "Water Only", "", ""}; #define AI_MAX_MELEE_RANGE 5.0f diff --git a/Descent3/CMakeLists.txt b/Descent3/CMakeLists.txt index 595bcfbee..f71586501 100644 --- a/Descent3/CMakeLists.txt +++ b/Descent3/CMakeLists.txt @@ -1,309 +1,311 @@ -set(HEADERS - aiambient.h - AIGoal.h - AIMain.h - aipath.h - aistruct.h - aistruct_external.h - aiterrain.h - ambient.h - args.h - attach.h - audiotaunts.h - bnode.h - BOA.h - Briefing.h - BriefingParse.h - bsp.h - buddymenu.h - buildno.h - cinematics.h - cockpit.h - config.h - ConfigItem.h - controls.h - credits.h - CtlCfgElem.h - ctlconfig.h - ctlconfigtxt.h - D3ForceFeedback.h - d3serial.h - damage.h - damage_external.h - DeathInfo.h - deathinfo_external.h - debuggraph.h - descent.h - difficulty.h - difficulty_external.h - DllWrappers.h - door.h - doorway.h - fireball.h - fireball_external.h - game.h - gamecinematics.h - gamecinematics_external.h - gameevent.h - gamefile.h - gamefont.h - gameloop.h - gamepath.h - gamesave.h - gamesequence.h - gametexture.h - gauges.h - help.h - hotspotmap.h - hud.h - init.h - Inventory.h - levelgoal.h - levelgoal_external.h - lighting.h - lightmap_info.h - list.h - LoadLevel.h - localization.h - marker.h - matcen.h - matcen_external.h - menu.h - Mission.h - mission_download.h - mmItem.h - multi.h - multisafe.h - multi_client.h - multi_dll_mgr.h - multi_external.h - multi_save_settings.h - multi_server.h - multi_ui.h - multi_world_state.h - NewPyroGauges.h - newui.h - newui_core.h - object.h - object_external.h - object_external_struct.h - object_lighting.h - objinfo.h - objinit.h - ObjScript.h - osiris_dll.h - osiris_predefs.h - osiris_share.h - pilot.h - PilotPicsAPI.h - pilot_class.h - player.h - player_external.h - player_external_struct.h - postrender.h - powerup.h - procedurals.h - program.h - render.h - renderobject.h - resource.h - robot.h - robotfire.h - robotfirestruct.h - robotfirestruct_external.h - rocknride.h - room.h - room_external.h - scorch.h - screens.h - ship.h - slew.h - SmallViews.h - soar.h - soar_helpers.h - sounds.h - special_face.h - spew.h - splinter.h - stringtable.h - subtitles.h - TelCom.h - TelComAutoMap.h - TelComCargo.h - TelComEffects.h - TelComEfxStructs.h - TelComGoals.h - terrain.h - trigger.h - vclip.h - vibeinterface.h - viseffect.h - viseffect_external.h - voice.h - weapon.h - weapon_external.h - weather.h) - -set (CPPS - aiambient.cpp - AIGoal.cpp - AImain.cpp - aipath.cpp - aiterrain.cpp - ambient.cpp - args.cpp - attach.cpp - audiotaunts.cpp - bnode.cpp - BOA.cpp - Briefing.cpp - BriefingParse.cpp - bsp.cpp - buddymenu.cpp - cinematics.cpp - cockpit.cpp - config.cpp - ConfigItem.cpp - Controls.cpp - credits.cpp - CtlCfgElem.cpp - ctlconfig.cpp - D3ForceFeedback.cpp - d3serial.cpp - damage.cpp - debuggraph.cpp - dedicated_server.cpp - demofile.cpp - descent.cpp - difficulty.cpp - DllWrappers.cpp - door.cpp - doorway.cpp - fireball.cpp - game.cpp - Game2DLL.cpp - GameCheat.cpp - gamecinematics.cpp - gameevent.cpp - gamefile.cpp - gamefont.cpp - GameLoop.cpp - gamepath.cpp - gamesave.cpp - gamesequence.cpp - gametexture.cpp - gauges.cpp - help.cpp - hotspotmap.cpp - hud.cpp - huddisplay.cpp - hudmessage.cpp - init.cpp - intellivibe.cpp - Inventory.cpp - levelgoal.cpp - lighting.cpp - lightmap_info.cpp - list.cpp - LoadLevel.cpp - loadstate.cpp - localization.cpp - marker.cpp - matcen.cpp - megacell.cpp - menu.cpp - Mission.cpp - mission_download.cpp - mmItem.cpp - multi.cpp - multisafe.cpp - multisafe_server.cpp - multi_client.cpp - multi_connect.cpp - multi_dll_mgr.cpp - multi_save_setting.cpp - multi_server.cpp - multi_ui.cpp - NewPyroGauges.cpp - newui.cpp - newui_core.cpp - newui_filedlg.cpp - object.cpp - object_lighting.cpp - objinfo.cpp - ObjInit.cpp - ObjScript.cpp - OsirisLoadandBind.cpp - osiris_predefs.cpp - pilot.cpp - PilotPicsAPI.cpp - pilot_class.cpp - Player.cpp - postrender.cpp - procedurals.cpp - program.cpp - render.cpp - renderobject.cpp - robotfire.cpp - rocknride.cpp - room.cpp - scorch.cpp - screens.cpp - ship.cpp - SLEW.cpp - SmallViews.cpp - soar.cpp - soar_helpers.cpp - special_face.cpp - spew.cpp - splinter.cpp - subtitles.cpp - TelCom.cpp - TelComAutoMap.cpp - TelComCargo.cpp - TelComEffects.cpp - TelcomEffectsRender.cpp - TelComGoals.cpp - terrain.cpp - terrainrender.cpp - TerrainSearch.cpp - trigger.cpp - vclip.cpp - viseffect.cpp - voice.cpp - weapon.cpp - WeaponFire.cpp - weather.cpp - ) - - -if (WIN32) - set (PLATFORM_LIBS dd_sndlib dd_grwin32 dd_vidwin32 ddio_win win32 wsock32.lib winmm.lib Glu32.lib - ${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY}) - set(PLATFORM_CPPS winmain.cpp ) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") -endif() - -if (UNIX AND NOT APPLE) - set(PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL::SDL m ${CMAKE_DL_LIBS} OpenGL::GLU ${CURSES_LIBRARIES}) - set(PLATFORM_CPPS loki_utils.c lnxmain.cpp) -endif() - -if (APPLE) - set (PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL::SDL ${CURSES_LIBRARIES}) - set (PLATFORM_CPPS loki_utils.c lnxmain.cpp SDLMain.m) - set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon") -endif() - -file(GLOB_RECURSE INCS "../lib/*.h") - -add_executable(Descent3 ${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS}) -target_link_libraries(Descent3 - 2dlib AudioEncode bitmap cfile czip d3music ddio_common libmve libacm - fix grtext manage mem misc model module movie stream_audio - music networking physics renderer rtperformance sndlib ui unzip vecmat md5 - ${PLATFORM_LIBS}) - -if (WIN32) - set_target_properties(Descent3 PROPERTIES WIN32_EXECUTABLE ON) -endif() +set(HEADERS + aiambient.h + AIGoal.h + AIMain.h + aipath.h + aistruct.h + aistruct_external.h + aiterrain.h + ambient.h + args.h + attach.h + audiotaunts.h + bnode.h + BOA.h + Briefing.h + BriefingParse.h + bsp.h + buddymenu.h + buildno.h + cinematics.h + cockpit.h + config.h + ConfigItem.h + controls.h + credits.h + CtlCfgElem.h + ctlconfig.h + ctlconfigtxt.h + D3ForceFeedback.h + d3serial.h + damage.h + damage_external.h + DeathInfo.h + deathinfo_external.h + debuggraph.h + descent.h + difficulty.h + difficulty_external.h + DllWrappers.h + door.h + doorway.h + fireball.h + fireball_external.h + game.h + gamecinematics.h + gamecinematics_external.h + gameevent.h + gamefile.h + gamefont.h + gameloop.h + gamepath.h + gamesave.h + gamesequence.h + gametexture.h + gauges.h + help.h + hotspotmap.h + hud.h + init.h + Inventory.h + levelgoal.h + levelgoal_external.h + lighting.h + lightmap_info.h + list.h + LoadLevel.h + localization.h + marker.h + matcen.h + matcen_external.h + menu.h + Mission.h + mission_download.h + mmItem.h + multi.h + multisafe.h + multi_client.h + multi_dll_mgr.h + multi_external.h + multi_save_settings.h + multi_server.h + multi_ui.h + multi_world_state.h + NewPyroGauges.h + newui.h + newui_core.h + object.h + object_external.h + object_external_struct.h + object_lighting.h + objinfo.h + objinit.h + ObjScript.h + osiris_dll.h + osiris_predefs.h + osiris_share.h + pilot.h + PilotPicsAPI.h + pilot_class.h + player.h + player_external.h + player_external_struct.h + postrender.h + powerup.h + procedurals.h + program.h + render.h + renderobject.h + resource.h + robot.h + robotfire.h + robotfirestruct.h + robotfirestruct_external.h + rocknride.h + room.h + room_external.h + scorch.h + screens.h + ship.h + slew.h + SmallViews.h + soar.h + soar_helpers.h + sounds.h + special_face.h + spew.h + splinter.h + stringtable.h + subtitles.h + TelCom.h + TelComAutoMap.h + TelComCargo.h + TelComEffects.h + TelComEfxStructs.h + TelComGoals.h + terrain.h + trigger.h + vclip.h + vibeinterface.h + viseffect.h + viseffect_external.h + voice.h + weapon.h + weapon_external.h + weather.h) + +set(CPPS + aiambient.cpp + AIGoal.cpp + AImain.cpp + aipath.cpp + aiterrain.cpp + ambient.cpp + args.cpp + attach.cpp + audiotaunts.cpp + bnode.cpp + BOA.cpp + Briefing.cpp + BriefingParse.cpp + bsp.cpp + buddymenu.cpp + cinematics.cpp + cockpit.cpp + config.cpp + ConfigItem.cpp + Controls.cpp + credits.cpp + CtlCfgElem.cpp + ctlconfig.cpp + D3ForceFeedback.cpp + d3serial.cpp + damage.cpp + debuggraph.cpp + dedicated_server.cpp + demofile.cpp + descent.cpp + difficulty.cpp + DllWrappers.cpp + door.cpp + doorway.cpp + fireball.cpp + game.cpp + Game2DLL.cpp + GameCheat.cpp + gamecinematics.cpp + gameevent.cpp + gamefile.cpp + gamefont.cpp + GameLoop.cpp + gamepath.cpp + gamesave.cpp + gamesequence.cpp + gametexture.cpp + gauges.cpp + help.cpp + hotspotmap.cpp + hud.cpp + huddisplay.cpp + hudmessage.cpp + init.cpp + intellivibe.cpp + Inventory.cpp + levelgoal.cpp + lighting.cpp + lightmap_info.cpp + list.cpp + LoadLevel.cpp + loadstate.cpp + localization.cpp + marker.cpp + matcen.cpp + megacell.cpp + menu.cpp + Mission.cpp + mission_download.cpp + mmItem.cpp + multi.cpp + multisafe.cpp + multisafe_server.cpp + multi_client.cpp + multi_connect.cpp + multi_dll_mgr.cpp + multi_save_setting.cpp + multi_server.cpp + multi_ui.cpp + NewPyroGauges.cpp + newui.cpp + newui_core.cpp + newui_filedlg.cpp + object.cpp + object_lighting.cpp + objinfo.cpp + ObjInit.cpp + ObjScript.cpp + OsirisLoadandBind.cpp + osiris_predefs.cpp + pilot.cpp + PilotPicsAPI.cpp + pilot_class.cpp + Player.cpp + postrender.cpp + procedurals.cpp + program.cpp + render.cpp + renderobject.cpp + robotfire.cpp + rocknride.cpp + room.cpp + scorch.cpp + screens.cpp + ship.cpp + SLEW.cpp + SmallViews.cpp + soar.cpp + soar_helpers.cpp + special_face.cpp + spew.cpp + splinter.cpp + subtitles.cpp + TelCom.cpp + TelComAutoMap.cpp + TelComCargo.cpp + TelComEffects.cpp + TelcomEffectsRender.cpp + TelComGoals.cpp + terrain.cpp + terrainrender.cpp + TerrainSearch.cpp + trigger.cpp + vclip.cpp + viseffect.cpp + voice.cpp + weapon.cpp + WeaponFire.cpp + weather.cpp) + +if(WIN32) + set(PLATFORM_LIBS dd_sndlib dd_grwin32 dd_vidwin32 ddio_win win32 wsock32.lib winmm.lib Glu32.lib + ${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY}) + set(PLATFORM_CPPS winmain.cpp) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBC") +endif() + +if(UNIX AND NOT APPLE) + set(PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL::SDL m ${CMAKE_DL_LIBS} OpenGL::GLU ${CURSES_LIBRARIES}) + set(PLATFORM_CPPS loki_utils.c lnxmain.cpp) +endif() + +if(APPLE) + set(PLATFORM_LIBS linux dd_lnxsound ddvid_lnx lnxcontroller ddio_lnx SDL::SDL ${CURSES_LIBRARIES}) + set(PLATFORM_CPPS loki_utils.c lnxmain.cpp SDLMain.m) + set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon") +endif() + +file(GLOB_RECURSE INCS "../lib/*.h") + +add_executable(Descent3 ${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS}) +target_link_libraries(Descent3 + 2dlib AudioEncode bitmap cfile czip d3music ddio_common libmve libacm + fix grtext manage mem misc model module movie stream_audio + music networking physics renderer rtperformance sndlib ui unzip vecmat md5 + ${PLATFORM_LIBS}) + +if(UNIX) + add_dependencies(Descent3 HogLinuxFull) +endif() + +if(WIN32) + set_target_properties(Descent3 PROPERTIES WIN32_EXECUTABLE ON) +endif() diff --git a/Descent3/aistruct.h b/Descent3/aistruct.h index d0f86a652..40353ea2e 100644 --- a/Descent3/aistruct.h +++ b/Descent3/aistruct.h @@ -417,17 +417,17 @@ extern vector ai_lkplayer_velocity; extern float ai_lkplayer_time; #define MAX_AI_INIT_CLASSES 3 -extern char *Ai_class_strings[MAX_AI_INIT_CLASSES]; +extern const char *const Ai_class_strings[MAX_AI_INIT_CLASSES]; #define MAX_AI_INIT_TYPES 9 -extern char *Ai_type_strings[MAX_AI_INIT_TYPES]; +extern const char *const Ai_type_strings[MAX_AI_INIT_TYPES]; #define MAX_AI_INIT_MOVEMENT_TYPES 4 -extern char *Ai_movement_type_strings[MAX_AI_INIT_MOVEMENT_TYPES]; +extern const char *const Ai_movement_type_strings[MAX_AI_INIT_MOVEMENT_TYPES]; #define MAX_AI_INIT_MOVEMENT_SUBTYPES 7 -extern char *Ai_movement_subtype_flying_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES]; -extern char *Ai_movement_subtype_walking_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES]; +extern const char *const Ai_movement_subtype_flying_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES]; +extern const char *const Ai_movement_subtype_walking_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES]; extern float AI_last_time_room_noise_alert_time[MAX_ROOMS + 8]; @@ -879,4 +879,4 @@ extern ai_dynamic_path AIDynamicPath[MAX_DYNAMIC_PATHS]; extern int AIAltPath[MAX_ROOMS]; extern int AIAltPathNumNodes; -#endif \ No newline at end of file +#endif diff --git a/README.md b/README.md index d9be4ea93..58e438c53 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,49 @@ # Descent 3 - -## Update 04/17/2024 - -Thank you for your contributions after only a little over 24 hours! The current short-term roadmap is code cleanup and build verification. As described below, the original release includes the '1.5' patch that never made it to retail. At the time it was written, -it worked--this may or may not be the case at present. We are aiming to clean up the source for improved readability and standards, as well as playability. In short: we'd like to reach a good baseline "vanilla" source. - -We've had several contributions towards this end already. Please remember to check for duplicate issues and pull requests before submitting! - -## Update 04/16/2024 - -I'm so happy to see the amount of interest and participation here! - -Please join the Descent Developer Discord, there's an active community there already. - - - -You can expect some big commits coming soon. We'll be merging in some code that other developers did in parallel and/or after this code was archived. - -## Direction and Decisions - -1. We will support c++17 going forward -2. We are using clang in LLVM mode for code formatting. Please run clang-format before submitting a PR - - -## Original Release -This is the latest version of the Descent 3 source code. This includes the '1.5' patch that Jeff Slutter and Kevin Bentley wrote several years ago. At the time, it worked for Windows, Linux, and Mac. - -Some proprietary sound and video libraries from Interplay have been stripped out (the ACM and MVE format). I have that code if someone wants to help make a converter so the old cutscenes work. It'll take some effort to stub out that code so it compiles. - -The first thing I want to do is get everything compiling again, and ideally some CI/CD actions. After that, the code needs to be cleaned up some, to remove old version control comments, etc. A lot of this code was written by a really great team, but keep in mind we were much younger and less experienced back then. - -If you're interested in helping maintain it, please send me a message. Otherwise, I'm happy to take pull requests. - -This is the last update I put out there showing different architectures playing along. Yikes, that was a long time ago, sorry we never released a 1.5 patch. Some logistics got in the way! - -[![Descent3 1.5 Patch Development update](https://img.youtube.com/vi/oasEAoPHk7I/0.jpg)](https://www.youtube.com/watch?v=oasEAoPHk7I) - -Thanks to Jeff Slutter, who did most of the work modernizing the code from the 90's. I'm looking forward to seeing what the community does with it! +This is the Descent 3 open source engine, licensed under [GPL-3.0](https://github.com/DescentDevelopers/Descent3?tab=GPL-3.0-1-ov-file). It includes the '1.5' patch written by Kevin Bentley and Jeff Slutter several years ago and brought to a stable condition by the Descent community. + +In order to use this, you must provide your own game files. See the **Usage** section for details. + +## Version 1.5 Notes +There is no "release" yet. The current milestone is "1.5 Stable", which is meant to more or less be Descent 3 as it might have been if the 1.5 patch had made it to retail years ago. Artifacts can be downloaded from the [Actions](https://github.com/DescentDevelopers/Descent3/actions) tab. +The milestone needs testing on all platforms. Please report issues when found. + +## Usage +Purchase Descent 3 from a reputable source and install it, then replace the main binary with your build. See your platform below: + +#### Windows +In the install folder, rename `main.exe` to `main.old` and take your built `Descent3.exe`, name it `main.exe`, and add it to the install folder. + +#### MacOS +Right-click Descent3.app, click Show Package Contents. Back up your `Descent3` binary and drop your built `Descent3` binary into the install (Contents/MacOS) folder. + +#### Linux +Back up your `Descent3` binary and drop your built `Descent3` binary into the install folder. + +## Building +Build steps below assume you have already cloned the repository and entered it locally. + +#### Building - Windows +Requires Visual Studio C++ Tools (cmake and nmake) +``` +cmake --preset win +cmake --build --preset win --config [Debug/Release] +``` + +#### Building - MacOS +``` +brew bundle install +cmake --preset mac +cmake --build --preset mac --config [Debug/Release] +``` + +#### Building - Linux +``` +sudo dpkg --add-architecture i386 +sudo apt update +sudo apt install -y --no-install-recommends ninja-build cmake g++ libsdl1.2-dev libsdl-image1.2-dev libncurses-dev libxext6:i386 +cmake --preset linux +cmake --build --preset linux --config [Debug/Release] +``` + +## Contributing +Anyone can contribute! We have an active Discord presence at [Descent Developer Network](https://discord.gg/GNy5CUQ). If you are interested in maintaining the project on a regular basis, please contact Kevin Bentley. diff --git a/acmlib/CMakeLists.txt b/acmlib/CMakeLists.txt index be3b0a067..590033a96 100644 --- a/acmlib/CMakeLists.txt +++ b/acmlib/CMakeLists.txt @@ -1,5 +1,5 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - acmlib.cpp) + acmlib.cpp) -add_library(acmlib STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(acmlib STATIC ${HEADERS} ${CPPS}) diff --git a/bitmap/CMakeLists.txt b/bitmap/CMakeLists.txt index 4114033b4..8258792fa 100644 --- a/bitmap/CMakeLists.txt +++ b/bitmap/CMakeLists.txt @@ -1,10 +1,10 @@ set(HEADERS iff.h) set(CPPS - bitmain.cpp - bumpmap.cpp - iff.cpp - lightmap.cpp - pcx.cpp - tga.cpp) + bitmain.cpp + bumpmap.cpp + iff.cpp + lightmap.cpp + pcx.cpp + tga.cpp) -add_library(bitmap STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(bitmap STATIC ${HEADERS} ${CPPS}) diff --git a/cfile/CMakeLists.txt b/cfile/CMakeLists.txt index 1bfa98cd5..704e3f084 100644 --- a/cfile/CMakeLists.txt +++ b/cfile/CMakeLists.txt @@ -1,7 +1,7 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - CFILE.cpp - hog.cpp - InfFile.cpp) + CFILE.cpp + hog.cpp + InfFile.cpp) -add_library(cfile STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(cfile STATIC ${HEADERS} ${CPPS}) diff --git a/czip/CMakeLists.txt b/czip/CMakeLists.txt index b5fdb773f..a107960bb 100644 --- a/czip/CMakeLists.txt +++ b/czip/CMakeLists.txt @@ -1,8 +1,8 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - BitIO.cpp - CZip.cpp - HuffmanAdapt.cpp - HuffmanBasic.cpp) + BitIO.cpp + CZip.cpp + HuffmanAdapt.cpp + HuffmanBasic.cpp) -add_library(czip STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(czip STATIC ${HEADERS} ${CPPS}) diff --git a/d3music/CMakeLists.txt b/d3music/CMakeLists.txt index d8dc6bb30..9e3ccb65d 100644 --- a/d3music/CMakeLists.txt +++ b/d3music/CMakeLists.txt @@ -1,5 +1,5 @@ set(HEADERS) set(CPPS - musicapi.cpp) + musicapi.cpp) -add_library(d3music STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(d3music STATIC ${HEADERS} ${CPPS}) diff --git a/dd_grwin32/CMakeLists.txt b/dd_grwin32/CMakeLists.txt index 2d8b891b2..64c350692 100644 --- a/dd_grwin32/CMakeLists.txt +++ b/dd_grwin32/CMakeLists.txt @@ -1,11 +1,11 @@ -set(HEADERS - ddgrWin32.h - ddgrWin32DX.h - ddgrWin32GDI.h) +set(HEADERS + ddgrWin32.h + ddgrWin32DX.h + ddgrWin32GDI.h) set(CPPS - ddgrWin32API.cpp - ddgrWin32DX.cpp - ddgrWin32GDI.cpp - ddgrWin32Init.cpp) + ddgrWin32API.cpp + ddgrWin32DX.cpp + ddgrWin32GDI.cpp + ddgrWin32Init.cpp) -add_library(dd_grwin32 STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(dd_grwin32 STATIC ${HEADERS} ${CPPS}) diff --git a/dd_lnxsound/CMakeLists.txt b/dd_lnxsound/CMakeLists.txt index d08af14ba..67c45c174 100644 --- a/dd_lnxsound/CMakeLists.txt +++ b/dd_lnxsound/CMakeLists.txt @@ -1,4 +1,4 @@ -set(HEADERS ddlnxsound.h ) +set(HEADERS ddlnxsound.h) set(CPPS mixer.cpp sdlsound.cpp ../dd_sndlib/ssl_lib.cpp ../dd_sndlib/ddsoundload.cpp) -add_library(dd_lnxsound STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(dd_lnxsound STATIC ${HEADERS} ${CPPS}) diff --git a/dd_sndlib/CMakeLists.txt b/dd_sndlib/CMakeLists.txt index 934dcfa25..6db7ec36f 100644 --- a/dd_sndlib/CMakeLists.txt +++ b/dd_sndlib/CMakeLists.txt @@ -1,18 +1,18 @@ -set(HEADERS - auddev.h - ds3dlib_internal.h - eax.h - eax2.h - ia3dapi.h - Ia3dutil.h - vmanpset.h) +set(HEADERS + auddev.h + ds3dlib_internal.h + eax.h + eax2.h + ia3dapi.h + Ia3dutil.h + vmanpset.h) set(CPPS - aureal3d.cpp - ddsoundload.cpp - Ds3dlib.cpp - dsound3d.cpp - eax.cpp - geometry.cpp - ssl_lib.cpp) + aureal3d.cpp + ddsoundload.cpp + Ds3dlib.cpp + dsound3d.cpp + eax.cpp + geometry.cpp + ssl_lib.cpp) -add_library(dd_sndlib STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(dd_sndlib STATIC ${HEADERS} ${CPPS}) diff --git a/dd_vidwin32/CMakeLists.txt b/dd_vidwin32/CMakeLists.txt index 643e940a9..2ad6692a1 100644 --- a/dd_vidwin32/CMakeLists.txt +++ b/dd_vidwin32/CMakeLists.txt @@ -1,8 +1,8 @@ -set(HEADERS - ddvidlib.h) +set(HEADERS + ddvidlib.h) set(CPPS - video_win32.cpp - vidWin32FS.cpp - vidWin32Win.cpp) + video_win32.cpp + vidWin32FS.cpp + vidWin32Win.cpp) -add_library(dd_vidwin32 STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(dd_vidwin32 STATIC ${HEADERS} ${CPPS}) diff --git a/ddio_common/CMakeLists.txt b/ddio_common/CMakeLists.txt index a87b09999..60d31b734 100644 --- a/ddio_common/CMakeLists.txt +++ b/ddio_common/CMakeLists.txt @@ -1,5 +1,5 @@ set(HEADERS) set(CPPS - ddio.cpp - key.cpp) -add_library(ddio_common STATIC ${HEADERS} ${CPPS}) \ No newline at end of file + ddio.cpp + key.cpp) +add_library(ddio_common STATIC ${HEADERS} ${CPPS}) diff --git a/ddio_lnx/CMakeLists.txt b/ddio_lnx/CMakeLists.txt index 7caf72b7f..8f00107ed 100644 --- a/ddio_lnx/CMakeLists.txt +++ b/ddio_lnx/CMakeLists.txt @@ -1,4 +1,15 @@ set(HEADERS ddio_lnx.h) -set(CPPS lnxfile.cpp lnxforcefeedback.cpp lnxio.cpp sdljoy.cpp lnxkey.cpp lnxkey_null.cpp lnxmouse.cpp lnxtimer.cpp lnxkey_raw.cpp lnxcdrom.cpp lnxkey_sdl.cpp) +set(CPPS + lnxfile.cpp + lnxforcefeedback.cpp + lnxio.cpp + sdljoy.cpp + lnxkey.cpp + lnxkey_null.cpp + lnxmouse.cpp + lnxtimer.cpp + lnxkey_raw.cpp + lnxcdrom.cpp + lnxkey_sdl.cpp) -add_library(ddio_lnx STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(ddio_lnx STATIC ${HEADERS} ${CPPS}) diff --git a/ddio_win/CMakeLists.txt b/ddio_win/CMakeLists.txt index 116f204c6..61e9ca6d4 100644 --- a/ddio_win/CMakeLists.txt +++ b/ddio_win/CMakeLists.txt @@ -1,12 +1,12 @@ -set(HEADERS ddio_win.h ) +set(HEADERS ddio_win.h) set(CPPS - serial.cpp - winfile.cpp - winforcefeedback.cpp - winio.cpp - winjoy.cpp - winkey.cpp - winmouse.cpp - wintimer.cpp) + serial.cpp + winfile.cpp + winforcefeedback.cpp + winio.cpp + winjoy.cpp + winkey.cpp + winmouse.cpp + wintimer.cpp) -add_library(ddio_win STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(ddio_win STATIC ${HEADERS} ${CPPS}) diff --git a/ddvid_lnx/CMakeLists.txt b/ddvid_lnx/CMakeLists.txt index d3ed4a72c..d28fea764 100644 --- a/ddvid_lnx/CMakeLists.txt +++ b/ddvid_lnx/CMakeLists.txt @@ -2,4 +2,4 @@ set(HEADERS) set(CPPS video_lnx.cpp) -add_library(ddvid_lnx STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(ddvid_lnx STATIC ${HEADERS} ${CPPS}) diff --git a/fix/CMakeLists.txt b/fix/CMakeLists.txt index 48a056c07..8fd1cba21 100644 --- a/fix/CMakeLists.txt +++ b/fix/CMakeLists.txt @@ -1,5 +1,5 @@ -set (HEADERS ) -set (CPPS - fix.cpp) +set(HEADERS) +set(CPPS + fix.cpp) -add_library(fix STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(fix STATIC ${HEADERS} ${CPPS}) diff --git a/grtext/CMakeLists.txt b/grtext/CMakeLists.txt index 864a95099..2235cf595 100644 --- a/grtext/CMakeLists.txt +++ b/grtext/CMakeLists.txt @@ -1,7 +1,7 @@ -set(HEADERS grtextlib.h ) +set(HEADERS grtextlib.h) set(CPPS - grfont.cpp - grtext.cpp - textaux.cpp) + grfont.cpp + grtext.cpp + textaux.cpp) -add_library(grtext STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(grtext STATIC ${HEADERS} ${CPPS}) diff --git a/libacm/CMakeLists.txt b/libacm/CMakeLists.txt index 6e6bd44e5..3508cf3fe 100644 --- a/libacm/CMakeLists.txt +++ b/libacm/CMakeLists.txt @@ -1,6 +1,6 @@ -set(HEADERS ) -set(CPPS - aencode.cpp - libacm.cpp) - -add_library(libacm STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +set(HEADERS) +set(CPPS + aencode.cpp + libacm.cpp) + +add_library(libacm STATIC ${HEADERS} ${CPPS}) diff --git a/libmve/CMakeLists.txt b/libmve/CMakeLists.txt index 4b740a630..7b92311a4 100644 --- a/libmve/CMakeLists.txt +++ b/libmve/CMakeLists.txt @@ -1,18 +1,19 @@ -set(HEADERS mvegfx.h - mvelibi.h - mvelibl.h - platform.h - snd8to16.h - SystemInterfaces.h ) +set(HEADERS + mvegfx.h + mvelibi.h + mvelibl.h + platform.h + snd8to16.h + SystemInterfaces.h) set(CPPS - mveasm.cpp - mvelibl.cpp - platform.cpp) + mveasm.cpp + mvelibl.cpp + platform.cpp) -set(PLATFORM_CPPS ) +set(PLATFORM_CPPS) -if (UNIX) - set (PLATFORM_CPPS "lnxdsound.cpp") +if(UNIX) + set(PLATFORM_CPPS "lnxdsound.cpp") endif() add_library(libmve STATIC ${HEADERS} ${CPPS} ${PLATFORM_CPPS}) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 6d36a378d..460e945fa 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,4 +1,4 @@ -set(HEADERS registry.h ) +set(HEADERS registry.h) set(CPPS lnxcon.cpp lnxcon_raw.cpp @@ -9,4 +9,4 @@ set(CPPS lnxmono.cpp registry.cpp) # DynXLib.cpp -add_library(linux STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(linux STATIC ${HEADERS} ${CPPS}) diff --git a/lnxcontroller/CMakeLists.txt b/lnxcontroller/CMakeLists.txt index 8efaf5d45..c306ff025 100644 --- a/lnxcontroller/CMakeLists.txt +++ b/lnxcontroller/CMakeLists.txt @@ -1,6 +1,4 @@ -set (HEADERS ) -set (CPPS - lnxcontroller.cpp -) +set(HEADERS) +set(CPPS lnxcontroller.cpp) -add_library(lnxcontroller STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(lnxcontroller STATIC ${HEADERS} ${CPPS}) diff --git a/lnxmvelib/CMakeLists.txt b/lnxmvelib/CMakeLists.txt index 0a9180c8e..1db72ef6b 100644 --- a/lnxmvelib/CMakeLists.txt +++ b/lnxmvelib/CMakeLists.txt @@ -1,4 +1,13 @@ -set(HEADERS dyna_pthread.h dyna_xext.h dyna_xwin.h lnxdsound.h mvegfx.h mvelibi.h mvelibl.h snd8to16.h ) +set(HEADERS + dyna_pthread.h + dyna_xext.h + dyna_xwin.h + lnxdsound.h + mvegfx.h + mvelibi.h + mvelibl.h + snd8to16.h) + set(CPPS lnxdraw.cpp lnxdsound.cpp @@ -7,4 +16,4 @@ set(CPPS # asmstub.c -add_library(lnxmvelib STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(lnxmvelib STATIC ${HEADERS} ${CPPS}) diff --git a/manage/CMakeLists.txt b/manage/CMakeLists.txt index 42ea5ceb4..36fedf997 100644 --- a/manage/CMakeLists.txt +++ b/manage/CMakeLists.txt @@ -1,23 +1,24 @@ -set(HEADERS doorpage.h - gamefilepage.h - genericpage.h - megapage.h - powerpage.h - robotpage.h - shippage.h - soundpage.h - texpage.h - weaponpage.h ) +set(HEADERS + doorpage.h + gamefilepage.h + genericpage.h + megapage.h + powerpage.h + robotpage.h + shippage.h + soundpage.h + texpage.h + weaponpage.h) set(CPPS - doorpage.cpp - gamefilepage.cpp - generic.cpp - manage.cpp - megapage.cpp - pagelock.cpp - shippage.cpp - soundpage.cpp - texpage.cpp - weaponpage.cpp) + doorpage.cpp + gamefilepage.cpp + generic.cpp + manage.cpp + megapage.cpp + pagelock.cpp + shippage.cpp + soundpage.cpp + texpage.cpp + weaponpage.cpp) -add_library(manage STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(manage STATIC ${HEADERS} ${CPPS}) diff --git a/md5/CMakeLists.txt b/md5/CMakeLists.txt index 3cad9127d..c6dfee75f 100644 --- a/md5/CMakeLists.txt +++ b/md5/CMakeLists.txt @@ -1,7 +1,7 @@ set(HEADERS md5.h) set(CPPS - md5.cpp) + md5.cpp) -set(PLATFORMCPPS ) +set(PLATFORMCPPS) add_library(md5 STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS}) diff --git a/mem/CMakeLists.txt b/mem/CMakeLists.txt index a5204a40a..c36914040 100644 --- a/mem/CMakeLists.txt +++ b/mem/CMakeLists.txt @@ -1,5 +1,5 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - mem.cpp) + mem.cpp) -add_library(mem STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(mem STATIC ${HEADERS} ${CPPS}) diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index 943b1a67c..d0d1c17cd 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -1,10 +1,10 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - endian.cpp - error.cpp - logfile.cpp - psglob.cpp - psrand.cpp - pstring.cpp) + endian.cpp + error.cpp + logfile.cpp + psglob.cpp + psrand.cpp + pstring.cpp) -add_library(misc STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(misc STATIC ${HEADERS} ${CPPS}) diff --git a/model/CMakeLists.txt b/model/CMakeLists.txt index 5f2fe9ac0..9130aef3b 100644 --- a/model/CMakeLists.txt +++ b/model/CMakeLists.txt @@ -1,6 +1,6 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - newstyle.cpp - polymodel.cpp) + newstyle.cpp + polymodel.cpp) -add_library(model STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(model STATIC ${HEADERS} ${CPPS}) diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 5d44dfd86..3b6a0daa6 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -1,5 +1,5 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - module.cpp) + module.cpp) -add_library(module STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(module STATIC ${HEADERS} ${CPPS}) diff --git a/movie/CMakeLists.txt b/movie/CMakeLists.txt index 2568a8f95..4b97cdca8 100644 --- a/movie/CMakeLists.txt +++ b/movie/CMakeLists.txt @@ -1,6 +1,6 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - d3movie.cpp) + d3movie.cpp) add_library(movie STATIC ${HEADERS} ${CPPS}) -target_link_libraries(movie libmve) \ No newline at end of file +target_link_libraries(movie libmve) diff --git a/music/CMakeLists.txt b/music/CMakeLists.txt index 47ee98c22..05b55b555 100644 --- a/music/CMakeLists.txt +++ b/music/CMakeLists.txt @@ -1,8 +1,8 @@ set(HEADERS) set(CPPS - omflex.cpp - sequencer.cpp - streamer.cpp - tracklist.cpp) + omflex.cpp + sequencer.cpp + streamer.cpp + tracklist.cpp) -add_library(music STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(music STATIC ${HEADERS} ${CPPS}) diff --git a/netcon/CMakeLists.txt b/netcon/CMakeLists.txt index f41c7fcaa..52b11b8c6 100644 --- a/netcon/CMakeLists.txt +++ b/netcon/CMakeLists.txt @@ -1,3 +1,3 @@ include_directories("includes") add_subdirectory(inetfile) -add_subdirectory(lanclient) \ No newline at end of file +add_subdirectory(lanclient) diff --git a/netcon/inetfile/CMakeLists.txt b/netcon/inetfile/CMakeLists.txt index 707ba4c2d..2e2edb714 100644 --- a/netcon/inetfile/CMakeLists.txt +++ b/netcon/inetfile/CMakeLists.txt @@ -1,9 +1,8 @@ set(HEADERS) -set(CPPS +set(CPPS CFtp.cpp Chttpget.cpp - inetgetfile.cpp -) + inetgetfile.cpp) add_library(inetfile STATIC ${HEADERS} ${CPPS}) diff --git a/netcon/lanclient/lanclient.cpp b/netcon/lanclient/lanclient.cpp index 008f656be..d60baf041 100644 --- a/netcon/lanclient/lanclient.cpp +++ b/netcon/lanclient/lanclient.cpp @@ -527,7 +527,7 @@ int MainMultiplayerMenu() { net_game_txt_items[k] = DLLCreateNewUITextItem(fmtline, GR_LIGHTGRAY); } - selgame[20] = NULL; + selgame[20] = '\0'; if (strncmp(selgame, DLLNetwork_games[k].name, 19) == 0) { selti = net_game_txt_items[k]; DLLmprintf((0, "Found previously selected game in list, reselecting...\n")); @@ -549,7 +549,7 @@ int MainMultiplayerMenu() { if (selno >= 0) strcpy(selgame, DLLNetwork_games[selno].name); else - selgame[0] = NULL; + selgame[0] = '\0'; } res = DLLPollUI(); @@ -615,7 +615,7 @@ int MainMultiplayerMenu() { if (selno >= 0) strcpy(selgame, DLLNetwork_games[selno].name); else - selgame[0] = NULL; + selgame[0] = '\0'; DLLSearchForLocalGamesTCP(0xffffffffl, htons(DEFAULT_GAME_PORT)); DLLListRemoveAll(main_list); @@ -637,7 +637,7 @@ int MainMultiplayerMenu() { char *pport = strchr(szdip, ':'); if (pport) { - *pport = NULL; + *pport = '\0'; pport++; iport = atoi(pport); } diff --git a/netgames/CMakeLists.txt b/netgames/CMakeLists.txt index aec534586..24314c666 100644 --- a/netgames/CMakeLists.txt +++ b/netgames/CMakeLists.txt @@ -8,4 +8,4 @@ add_subdirectory(hoard) add_subdirectory(hyperanarchy) add_subdirectory(monsterball) add_subdirectory(roboanarchy) -add_subdirectory(tanarchy) \ No newline at end of file +add_subdirectory(tanarchy) diff --git a/netgames/dmfc/CMakeLists.txt b/netgames/dmfc/CMakeLists.txt index b71dd674c..7f75f3724 100644 --- a/netgames/dmfc/CMakeLists.txt +++ b/netgames/dmfc/CMakeLists.txt @@ -1,28 +1,28 @@ -set(HEADERS dmfcdllinit.h +set(HEADERS + dmfcdllinit.h dmfcinputcommands.h dmfcinternal.h - encryption.h -) + encryption.h) -set(CPPS +set(CPPS dmfcbase.cpp dmfccfg.cpp dmfcclient.cpp dmfcfunctions.cpp dmfchudmessages.cpp - dmfcinputcommand.cpp - dmfcmenu.cpp - dmfcpackets.cpp - dmfcpinfo.cpp - dmfcprecord.cpp - dmfcremote.cpp - dmfcserver.cpp - dmfcstats.cpp - dmfctimer.cpp - dmfcui.cpp - dmfcvirtual.cpp - idmfc.cpp - encryption.cpp + dmfcinputcommand.cpp + dmfcmenu.cpp + dmfcpackets.cpp + dmfcpinfo.cpp + dmfcprecord.cpp + dmfcremote.cpp + dmfcserver.cpp + dmfcstats.cpp + dmfctimer.cpp + dmfcui.cpp + dmfcvirtual.cpp + idmfc.cpp + encryption.cpp dmfcinterface.cpp) add_definitions(-DOUTRAGE_VERSION -DDMFC_DLL) diff --git a/netgames/hoard/CMakeLists.txt b/netgames/hoard/CMakeLists.txt index 1c0380f50..60078d3f9 100644 --- a/netgames/hoard/CMakeLists.txt +++ b/netgames/hoard/CMakeLists.txt @@ -1,7 +1,7 @@ set(HEADERS hoardaux.h Hoard.h hoardstr.h) set(CPPS hoard.cpp hoard_ui.cpp) -set (NETGAME_MODULE hoard) +set(NETGAME_MODULE hoard) add_library(${NETGAME_MODULE} SHARED ${CPPS} ${HEADERS}) set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") diff --git a/networking/CMakeLists.txt b/networking/CMakeLists.txt index b020d92e4..10da3f6ff 100644 --- a/networking/CMakeLists.txt +++ b/networking/CMakeLists.txt @@ -1,11 +1,11 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - networking.cpp) + networking.cpp) set(PLATFORMCPPS) if(WIN32) - set(PLATFORMCPPS "directplay.cpp") + set(PLATFORMCPPS "directplay.cpp") endif() -add_library(networking STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS}) \ No newline at end of file +add_library(networking STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS}) diff --git a/physics/CMakeLists.txt b/physics/CMakeLists.txt index 69a6f4699..181cdc021 100644 --- a/physics/CMakeLists.txt +++ b/physics/CMakeLists.txt @@ -1,8 +1,8 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - Collide.cpp - FindIntersection.cpp - newstyle_fi.cpp - physics.cpp) + Collide.cpp + FindIntersection.cpp + newstyle_fi.cpp + physics.cpp) -add_library(physics STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(physics STATIC ${HEADERS} ${CPPS}) diff --git a/renderer/CMakeLists.txt b/renderer/CMakeLists.txt index 1a74acd54..f5639707f 100644 --- a/renderer/CMakeLists.txt +++ b/renderer/CMakeLists.txt @@ -1,29 +1,29 @@ -set(HEADERS - dyna_gl.h - HardwareInternal.h - RendererConfig.h - SoftwareInternal.h) +set(HEADERS + dyna_gl.h + HardwareInternal.h + RendererConfig.h + SoftwareInternal.h) set(CPPS - HardwareClipper.cpp - HardwareDraw.cpp - HardwareGlobalVars.cpp - HardwareInstance.cpp - HardwareOpenGL.cpp - HardwarePoints.cpp - HardwareSetup.cpp - HardwareTransforms.cpp - - SoftwareClipper.cpp - SoftwareDraw.cpp - SoftwareGlobalVars.cpp - SoftwareInstance.cpp - SoftwareOpenGL.cpp - SoftwareOpenGLMeshBuilder.cpp - SoftwarePoints.cpp - SoftwareSetup.cpp) + HardwareClipper.cpp + HardwareDraw.cpp + HardwareGlobalVars.cpp + HardwareInstance.cpp + HardwareOpenGL.cpp + HardwarePoints.cpp + HardwareSetup.cpp + HardwareTransforms.cpp + + SoftwareClipper.cpp + SoftwareDraw.cpp + SoftwareGlobalVars.cpp + SoftwareInstance.cpp + SoftwareOpenGL.cpp + SoftwareOpenGLMeshBuilder.cpp + SoftwarePoints.cpp + SoftwareSetup.cpp) if(UNIX) - set (CPPS ${CPPS} lnxscreenmode.cpp) + set(CPPS ${CPPS} lnxscreenmode.cpp) endif() # These are excluded. @@ -31,4 +31,4 @@ endif() #renderer.cpp #Direct3D.cpp -add_library(renderer STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(renderer STATIC ${HEADERS} ${CPPS}) diff --git a/rtperformance/CMakeLists.txt b/rtperformance/CMakeLists.txt index 2db36b657..52cc2729b 100644 --- a/rtperformance/CMakeLists.txt +++ b/rtperformance/CMakeLists.txt @@ -1,5 +1,5 @@ set(HEADERS) set(CPPS - rtperformance.cpp) + rtperformance.cpp) -add_library(rtperformance STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(rtperformance STATIC ${HEADERS} ${CPPS}) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 583f62c07..a0a308787 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,111 +1,111 @@ - -add_definitions (-DCHECKSUM=2273873307UL) +add_definitions(-DCHECKSUM=2273873307UL) set(HEADERS) set(CPPS) -if(UNIX) - set (CPPS - linux_lib.cpp) -endif() +if (UNIX) + set(CPPS + linux_lib.cpp) +endif () set(SCRIPTS - aigame2 - AIGame3 - aigame4 - AIGame - barney - BatteriesIncluded - BossCamera - CanyonsCTF - CellTestLevel - ChrisTest - clutter - GameGauge - generic - Geodomes - HalfPipe - InfernalBolt - Inversion - LEVEL0 - level10 - level11 - Level12 - level13 - level14 - LEVEL15 - Level16 - level17 - level1 - level2 - level3 - level4 - level5 - Level6 - level7 - level8 - Level9 - LevelS1 - levelS2 - Merc02 - Merc1 - Merc3 - Merc4 - merc5 - Merc6 - Merc7 - myPowerHouse - Mysterious_Isle - orbital - Paranoia - PiccuStation - Polaris - Quadsomniac - RudeAwakening - SewerRat - testscript - TrainingMission - Y2K) + aigame2 + AIGame3 + aigame4 + AIGame + barney + BatteriesIncluded + BossCamera + CanyonsCTF + CellTestLevel + ChrisTest + clutter + GameGauge + generic + Geodomes + HalfPipe + InfernalBolt + Inversion + LEVEL0 + level10 + level11 + Level12 + level13 + level14 + LEVEL15 + Level16 + level17 + level1 + level2 + level3 + level4 + level5 + Level6 + level7 + level8 + Level9 + LevelS1 + levelS2 + Merc02 + Merc1 + Merc3 + Merc4 + merc5 + Merc6 + Merc7 + myPowerHouse + Mysterious_Isle + orbital + Paranoia + PiccuStation + Polaris + Quadsomniac + RudeAwakening + SewerRat + testscript + TrainingMission + Y2K) -foreach(SCRIPT ${SCRIPTS}) - add_library(${SCRIPT} SHARED ${CPPS} "${SCRIPT}.cpp") - set_target_properties(${SCRIPT} PROPERTIES PREFIX "") - if(UNIX) - add_custom_command( - TARGET ${SCRIPT} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/" - COMMENT "Copying file ${SCRIPT} to hogfile directory..." - ) - add_custom_command( - TARGET ${SCRIPT} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/" - ) - endif() -endforeach() +add_custom_target(HogLinuxFull-copy + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog ${CMAKE_BINARY_DIR}/scripts/data/linuxfullhog/ + COMMENT "Copy script/data/linuxfullhog directory" +) -if(UNIX AND NOT APPLE) - set(HOGBUILDCMD "${CMAKE_SOURCE_DIR}/scripts/hogutils/hogUtils-i686") - set(HOGARCH "linux") +#add_custom_target(HogLinuxDemo-copy +# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog ${CMAKE_BINARY_DIR}/scripts/data/linuxdemohog/ +# COMMENT "Copy script/data/linuxdemohog directory" +#) - add_custom_target("FullLinuxHog" - ALL - COMMAND ${HOGBUILDCMD} "--makehog" "d3linuxfullhog.txt" - COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/d3-${HOGARCH}.hog" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/new.hog" "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/d3-${HOGARCH}.hog" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/d3-${HOGARCH}.hog" "${CMAKE_BINARY_DIR}" - COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/new.hog" - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/scripts/data/linuxfullhog/" - DEPENDS ${SCRIPTS} - COMMENT "Building platform specific hog." - ) - add_custom_target("DemoLinuxHog" - ALL - COMMAND ${HOGBUILDCMD} "--makehog" "d3linuxdemohog.txt" - COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/d3-${HOGARCH}.hog" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/new.hog" "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/d3-${HOGARCH}.hog" - COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/new.hog" - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/scripts/data/linuxdemohog/" - DEPENDS ${SCRIPTS} - COMMENT "Building platform specific hog." +foreach(SCRIPT ${SCRIPTS}) + add_library(${SCRIPT} SHARED ${CPPS} "${SCRIPT}.cpp") + add_dependencies(${SCRIPT} HogLinuxFull-copy) # HogLinuxDemo-copy + set_target_properties(${SCRIPT} PROPERTIES PREFIX "") + if (UNIX) + add_custom_command( + TARGET ${SCRIPT} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_BINARY_DIR}/scripts/data/linuxfullhog/" + COMMENT "Copying file ${SCRIPT} to scripts/data/linuxfullhog/..." ) -endif() + # add_custom_command( + # TARGET ${SCRIPT} + # POST_BUILD + # COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_BINARY_DIR}/scripts/data/linuxdemohog/" + # COMMENT "Copying file ${SCRIPT} to scripts/data/linuxdemohog/..." + # ) + endif () +endforeach () + +if (UNIX) + add_custom_target(HogLinuxFull + COMMAND $ "$/d3-linux.hog" "${CMAKE_BINARY_DIR}/scripts/data/linuxfullhog/d3linuxfullhog.txt" + DEPENDS ${SCRIPTS} HogMaker + COMMENT "Generate linuxfullhog/d3-linux.hog" + ) + + # FIXME: there may be only one d3-linux.hog, need deal with demo somehow. + # add_custom_target(HogLinuxDemo + # COMMAND $ "${CMAKE_BINARY_DIR}/scripts/data/linuxdemohog/d3-linux.hog" "${CMAKE_BINARY_DIR}/scripts/data/linuxdemohog/d3linuxdemohog.txt" + # DEPENDS ${SCRIPTS} HogMaker + # COMMENT "Generate linuxdemohog/d3-linux.hog" + # ) + +endif () diff --git a/scripts/hogutils/hogUtils-i686 b/scripts/hogutils/hogUtils-i686 deleted file mode 100755 index 6899d851c..000000000 Binary files a/scripts/hogutils/hogUtils-i686 and /dev/null differ diff --git a/scripts/hogutils/libSDL-1.2.0.dylib b/scripts/hogutils/libSDL-1.2.0.dylib deleted file mode 100644 index 5cb99ef71..000000000 Binary files a/scripts/hogutils/libSDL-1.2.0.dylib and /dev/null differ diff --git a/scripts/osiris_import.h b/scripts/osiris_import.h index 32e91b14d..dbb03b647 100644 --- a/scripts/osiris_import.h +++ b/scripts/osiris_import.h @@ -394,7 +394,7 @@ typedef int (*Obj_Create_fp)(ubyte type, ushort id, int roomnum, vector *pos, co vector *initial_velocity); OSIRISEXTERN Obj_Create_fp Obj_CreateFP; inline int Obj_Create(ubyte type, ushort id, int roomnum, vector *pos, const matrix *orient = NULL, - int parent_handle = NULL, vector *initial_velocity = NULL) { + int parent_handle = 0, vector *initial_velocity = NULL) { return Obj_CreateFP(type, id, roomnum, pos, orient, parent_handle, initial_velocity); } // float Game_GetTime() (void) diff --git a/sndlib/CMakeLists.txt b/sndlib/CMakeLists.txt index 910b879cd..f8ec88b8c 100644 --- a/sndlib/CMakeLists.txt +++ b/sndlib/CMakeLists.txt @@ -1,7 +1,7 @@ -set(HEADERS sndrender.h ) +set(HEADERS sndrender.h) set(CPPS - hlsoundlib.cpp - sndrender.cpp - soundload.cpp) + hlsoundlib.cpp + sndrender.cpp + soundload.cpp) -add_library(sndlib STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(sndlib STATIC ${HEADERS} ${CPPS}) diff --git a/stream_audio/CMakeLists.txt b/stream_audio/CMakeLists.txt index 8983f1288..ca8ebb473 100644 --- a/stream_audio/CMakeLists.txt +++ b/stream_audio/CMakeLists.txt @@ -1,7 +1,7 @@ -set(HEADERS ) -set(CPPS - osfarchive.cpp - streamaudio.cpp) - -add_library(stream_audio STATIC ${HEADERS} ${CPPS}) -target_link_libraries(stream_audio libacm) \ No newline at end of file +set(HEADERS) +set(CPPS + osfarchive.cpp + streamaudio.cpp) + +add_library(stream_audio STATIC ${HEADERS} ${CPPS}) +target_link_libraries(stream_audio libacm) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 000000000..ade81f020 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,9 @@ +if(WIN32) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE") +endif() + +add_executable( + HogMaker + HogMaker/HogFormat.cpp + HogMaker/HogMaker.cpp +) diff --git a/tools/HogMaker/HogFormat.cpp b/tools/HogMaker/HogFormat.cpp new file mode 100644 index 000000000..310ba75c7 --- /dev/null +++ b/tools/HogMaker/HogFormat.cpp @@ -0,0 +1,53 @@ +/* + * Descent 3 + * Copyright (C) 2024 Descent Developers + * + * 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 3 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, see . + */ + +#include "HogFormat.h" +#include "IOOps.h" + +#include + +namespace D3 { + +std::ostream &operator<<(std::ostream &output, HogHeader &header) { + output.write((char *)&header.tag[0], 4); + bin_write(output, header.nfiles); + bin_write(output, header.file_data_offset); + output.write((char *)&header.reserved[0], 56); + + return output; +} + +std::ostream &operator<<(std::ostream &output, HogFileEntry &entry) { + auto tmp = entry.name.c_str(); + output.write((char *)&tmp[0], 36); + bin_write(output, entry.flags); + bin_write(output, entry.len); + bin_write(output, entry.timestamp); + return output; +} + +std::ostream &operator<<(std::ostream &output, HogFormat &format) { + output << format.m_header; + for (auto i : format.m_file_entries) { + output << i; + } + + return output; +} + +} // namespace D3 diff --git a/tools/HogMaker/HogFormat.h b/tools/HogMaker/HogFormat.h new file mode 100644 index 000000000..a6476aa5b --- /dev/null +++ b/tools/HogMaker/HogFormat.h @@ -0,0 +1,70 @@ +/* + * Descent 3 + * Copyright (C) 2024 Descent Developers + * + * 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 3 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, see . + */ +#pragma once + +#include +#include +#include + +#include "IOOps.h" + +namespace D3 { + +/* +HOG FILE FORMAT v2.0 + +HOG_TAG_STR [strlen()] +NFILES [int32] +HDRINFO [HOG_HDR_SIZE] +FILE_TABLE [sizeof(FILE_ENTRY) * NFILES] +FILE 0 [filelen(FILE 0)] +FILE 1 [filelen(FILE 1)] +... +FILE NFILES-1 [filelen(NFILES -1)] +*/ + +struct HogHeader { + std::vector tag = {'H', 'O', 'G', '2'}; // "HOG2" + uint32_t nfiles = 0; // number of files in header + uint32_t file_data_offset = 68; // offset in file to filedata. + std::vector reserved = std::vector(56, -1); // filled with 0xff +}; + +struct HogFileEntry { + std::filesystem::path name; // file name (36 char max) + uint32_t flags; // extra info + uint32_t len; // length of file + uint32_t timestamp; // time of file. +}; + +class HogFormat { +private: + HogHeader m_header; + std::vector m_file_entries; + +public: + void AddEntry(HogFileEntry &entry) { + m_file_entries.push_back(entry); + m_header.nfiles++; + m_header.file_data_offset += 48; + }; + + friend std::ostream &operator<<(std::ostream &output, HogFormat &format); +}; + +} // namespace D3 diff --git a/tools/HogMaker/HogMaker.cpp b/tools/HogMaker/HogMaker.cpp new file mode 100644 index 000000000..f9ae9b6ff --- /dev/null +++ b/tools/HogMaker/HogMaker.cpp @@ -0,0 +1,120 @@ +/* + * Descent 3 + * Copyright (C) 2024 Descent Developers + * + * 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 3 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, see . + */ +#include +#include +#include +#include +#include +#include + +#include "HogFormat.h" + +// TODO: To our descendants from the future: remove it when code will support C++20 +template std::time_t to_time_t(TP tp) { + auto sctp = std::chrono::duration_cast(tp - TP::clock::now()) + + std::chrono::system_clock::now(); + return std::chrono::system_clock::to_time_t(sctp); +} + +std::string str_tolower(std::string s) { + std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::tolower(c); }); + return s; +} + +struct { + bool operator()(const std::filesystem::path &a, const std::filesystem::path &b) const { + return (str_tolower(a.u8string()) < str_tolower(b.u8string())); + } +} customLess; + +int main(int argc, char *argv[]) { + std::vector input_files; + + if (argc != 3) { + std::cout << "Usage:\n" + << " " << argv[0] << " \n" + << std::endl; + return 1; + } + + std::filesystem::path hog_filename{argv[1]}; + std::filesystem::path input_filename{argv[2]}; + if (!is_regular_file(input_filename)) { + std::cout << input_filename << " is not a regular file!" << std::endl; + return 1; + } + + try { + create_directories(absolute(hog_filename).parent_path()); + std::ifstream input(input_filename, std::ios_base::in); + auto parent_input_path = input_filename.parent_path(); + for (std::string line; std::getline(input, line);) { + if (!is_regular_file(parent_input_path / line)) { + std::cout << "Warning! File " << line << " from " << input_filename << " does not exists! Skipping..." + << std::endl; + } else if (std::filesystem::path(line).filename().string().size() > 36) { + std::cout << "Warning! Length of name of file " << line << " is more than 36 symbols! Skipping..." << std::endl; + } else { + input_files.emplace_back(parent_input_path / line); + } + } + + } catch (std::exception &e) { + std::cout << "Exception: " << e.what() << std::endl; + return 1; + } + std::sort(input_files.begin(), input_files.end(), customLess); + + D3::HogFormat hog_table; + + for (const auto &i : input_files) { + try { + D3::HogFileEntry entry; + entry.name = i.filename(); + entry.flags = 0; + entry.len = (uint32_t)file_size(i); + entry.timestamp = (uint32_t)to_time_t(last_write_time(i)); + + hog_table.AddEntry(entry); + + } catch (std::exception &e) { + std::cout << "Exception: " << e.what() << std::endl; + return 1; + } + } + + std::cout << "Creating " << hog_filename << "..." << std::endl; + std::fstream ofs(hog_filename, std::ios_base::out | std::ios_base::binary); + + ofs << hog_table; + for (const auto &i : input_files) { + std::cout << "Adding " << i << "... "; + try { + std::fstream ifs(i, std::ios_base::in | std::ios_base::binary); + std::copy((std::istreambuf_iterator(ifs)), std::istreambuf_iterator(), + std::ostreambuf_iterator(ofs)); + } catch (std::exception &e) { + std::cout << "Exception: " << e.what() << std::endl; + return 1; + } + std::cout << "[ok]" << std::endl; + } + std::cout << "Done!" << std::endl; + + return 0; +} diff --git a/tools/HogMaker/IOOps.h b/tools/HogMaker/IOOps.h new file mode 100644 index 000000000..7e73f8c3b --- /dev/null +++ b/tools/HogMaker/IOOps.h @@ -0,0 +1,65 @@ +/* + * Descent 3 + * Copyright (C) 2024 Descent Developers + * + * 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 3 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, see . + */ +#pragma once + +#include +#include + +#include "byteswap.h" + +namespace D3 { + +// std::byteswap from C++23 +template constexpr T byteswap(T n) { + T m; + for (size_t i = 0; i < sizeof(T); i++) + reinterpret_cast(&m)[i] = reinterpret_cast(&n)[sizeof(T) - 1 - i]; + return m; +} + +/** + * Convert integer to/from BE order + */ +template constexpr T convert_be(T val) { +#ifndef OUTRAGE_BIG_ENDIAN + return byteswap(val); +#else + return (val); +#endif +} + +/** + * Convert integer to/from LE order + */ +template constexpr T convert_le(T val) { +#ifndef OUTRAGE_BIG_ENDIAN + return (val); +#else + return byteswap(val); +#endif +} + +template +inline std::ostream &bin_write(std::ostream &output, T &value, bool is_little_endian = true, size_t n = sizeof(T)) { + value = is_little_endian ? convert_le(value) : convert_be(value); + output.write(reinterpret_cast(&value), n); + + return output; +} + +} // namespace D3 diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 0d2707e19..d1797b180 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,19 +1,19 @@ set(HEADERS UIlib.h) set(CPPS - UIButton.cpp - UICombo.cpp - UIConsole.cpp - UIDraw.cpp - UIEdit.cpp - UIGadget.cpp - UIGroup.cpp - UIHotspot.cpp - UIListBox.cpp - UIObject.cpp - UIRes.cpp - UISlider.cpp - UIStatic.cpp - UISystem.cpp - UIWindow.cpp) + UIButton.cpp + UICombo.cpp + UIConsole.cpp + UIDraw.cpp + UIEdit.cpp + UIGadget.cpp + UIGroup.cpp + UIHotspot.cpp + UIListBox.cpp + UIObject.cpp + UIRes.cpp + UISlider.cpp + UIStatic.cpp + UISystem.cpp + UIWindow.cpp) -add_library(ui STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(ui STATIC ${HEADERS} ${CPPS}) diff --git a/unzip/CMakeLists.txt b/unzip/CMakeLists.txt index 1f166255f..694bfa337 100644 --- a/unzip/CMakeLists.txt +++ b/unzip/CMakeLists.txt @@ -1,21 +1,21 @@ -set(HEADERS infblock.h - infcodes.h - inffast.h - inffixed.h - inftrees.h - infutil.h - zconf.h - zlib.h - zutil.h ) +set(HEADERS + infblock.h + infcodes.h + inffast.h + inffixed.h + inftrees.h + infutil.h + zconf.h + zlib.h + zutil.h) set(CPPS - unzip.cpp - adler32.c - infblock.c - infcodes.c - inffast.c - inflate.c - inftrees.c - infutil.c - ) + unzip.cpp + adler32.c + infblock.c + infcodes.c + inffast.c + inflate.c + inftrees.c + infutil.c) -add_library(unzip STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(unzip STATIC ${HEADERS} ${CPPS}) diff --git a/vecmat/CMakeLists.txt b/vecmat/CMakeLists.txt index e013138a7..dd8543b31 100644 --- a/vecmat/CMakeLists.txt +++ b/vecmat/CMakeLists.txt @@ -1,5 +1,5 @@ -set(HEADERS ) +set(HEADERS) set(CPPS - vector.cpp) + vector.cpp) -add_library(vecmat STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(vecmat STATIC ${HEADERS} ${CPPS}) diff --git a/win32/CMakeLists.txt b/win32/CMakeLists.txt index 3506cdcc8..7b9938535 100644 --- a/win32/CMakeLists.txt +++ b/win32/CMakeLists.txt @@ -1,11 +1,11 @@ -set(HEADERS win32os.h ) +set(HEADERS win32os.h) set(CPPS - winapp.cpp - wincon.cpp - WinController.cpp - windata.cpp - windebug.cpp - winmono.cpp - wintask.cpp) + winapp.cpp + wincon.cpp + WinController.cpp + windata.cpp + windebug.cpp + winmono.cpp + wintask.cpp) -add_library(win32 STATIC ${HEADERS} ${CPPS}) \ No newline at end of file +add_library(win32 STATIC ${HEADERS} ${CPPS})