Merge branch 'RobertBeckebans:master' into master

This commit is contained in:
CodeLikeCXK 2024-05-09 21:51:32 +08:00 committed by GitHub
commit 0f5030e31a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 355 additions and 387 deletions

View file

@ -449,6 +449,8 @@ Recommended in this case is `cmake-vs2022-win64-no-ffmpeg.bat`
> # DXC compiler
> PATH="~/dxc-artifacts/bin:$PATH"
As an alternative to modifying your PATH, you can add -DDXC\_CUSTOM_PATH=\<path-to-dxc-binary> to the CMake options.
2. You need the following dependencies in order to compile RBDoom3BFG with all features:
On Debian or Ubuntu:

View file

@ -1,65 +1,66 @@
extractResourceFile _common.resources basedev 1
extractResourceFile _ordered.resources basedev 1
extractResourceFile _sound_pc.resources basedev 1
extractResourceFile _sound_pc_en.resources basedev 1
extractResourceFile _common.resources baseref
extractResourceFile _ordered.resources baseref
extractResourceFile _sound_pc.resources baseref copysound
extractResourceFile _sound_pc_en.resources baseref copysound
extractResourceFile _sound_pc_gr.resources baseref copysound
extractResourceFile maps/admin.resources basedev 1
extractResourceFile maps/alphalabs1.resources basedev 1
extractResourceFile maps/alphalabs2.resources basedev 1
extractResourceFile maps/alphalabs3.resources basedev 1
extractResourceFile maps/alphalabs4.resources basedev 1
extractResourceFile maps/caverns1.resources basedev 1 1
extractResourceFile maps/caverns2.resources basedev 1
extractResourceFile maps/comm1.resources basedev 1
extractResourceFile maps/commoutside.resources basedev 1
extractResourceFile maps/cpu.resources basedev 1
extractResourceFile maps/cpuboss.resources basedev 1
extractResourceFile maps/d3ctf1.resources basedev 1
extractResourceFile maps/d3ctf2.resources basedev 1
extractResourceFile maps/d3ctf3.resources basedev 1
extractResourceFile maps/d3ctf4.resources basedev 1
extractResourceFile maps/d3dm1.resources basedev 1
extractResourceFile maps/d3dm2.resources basedev 1
extractResourceFile maps/d3dm3.resources basedev 1
extractResourceFile maps/d3dm4.resources basedev 1
extractResourceFile maps/d3dm5.resources basedev 1
extractResourceFile maps/d3xpdm1.resources basedev 1
extractResourceFile maps/d3xpdm2.resources basedev 1
extractResourceFile maps/d3xpdm3.resources basedev 1
extractResourceFile maps/d3xpdm4.resources basedev 1
extractResourceFile maps/delta1.resources basedev 1
extractResourceFile maps/delta2a.resources basedev 1
extractResourceFile maps/delta2b.resources basedev 1
extractResourceFile maps/delta3.resources basedev 1
extractResourceFile maps/delta4.resources basedev 1
extractResourceFile maps/delta5.resources basedev 1
extractResourceFile maps/deltax.resources basedev 1
extractResourceFile maps/enpro.resources basedev 1
extractResourceFile maps/erebus1.resources basedev 1
extractResourceFile maps/erebus2.resources basedev 1
extractResourceFile maps/erebus3.resources basedev 1
extractResourceFile maps/erebus4.resources basedev 1
extractResourceFile maps/erebus5.resources basedev 1
extractResourceFile maps/erebus6.resources basedev 1
extractResourceFile maps/hell.resources basedev 1
extractResourceFile maps/hell1.resources basedev 1
extractResourceFile maps/hellhole.resources basedev 1
extractResourceFile maps/le_enpro1.resources basedev 1
extractResourceFile maps/le_enpro2.resources basedev 1
extractResourceFile maps/le_exis1.resources basedev 1
extractResourceFile maps/le_exis2.resources basedev 1
extractResourceFile maps/le_hell.resources basedev 1
extractResourceFile maps/le_hell_post.resources basedev 1
extractResourceFile maps/le_underground.resources basedev 1
extractResourceFile maps/le_underground2.resources basedev 1
extractResourceFile maps/mars_city1.resources basedev 1
extractResourceFile maps/mars_city2.resources basedev 1
extractResourceFile maps/mc_underground.resources basedev 1
extractResourceFile maps/monorail.resources basedev 1
extractResourceFile maps/phobos1.resources basedev 1
extractResourceFile maps/phobos2.resources basedev 1
extractResourceFile maps/phobos3.resources basedev 1
extractResourceFile maps/phobos4.resources basedev 1
extractResourceFile maps/recycling1.resources basedev 1
extractResourceFile maps/recycling2.resources basedev 1
extractResourceFile maps/site3.resources basedev 1
extractResourceFile maps/admin.resources baseref
extractResourceFile maps/alphalabs1.resources baseref
extractResourceFile maps/alphalabs2.resources baseref
extractResourceFile maps/alphalabs3.resources baseref
extractResourceFile maps/alphalabs4.resources baseref
extractResourceFile maps/caverns1.resources baseref 1
extractResourceFile maps/caverns2.resources baseref
extractResourceFile maps/comm1.resources baseref
extractResourceFile maps/commoutside.resources baseref
extractResourceFile maps/cpu.resources baseref
extractResourceFile maps/cpuboss.resources baseref
extractResourceFile maps/d3ctf1.resources baseref
extractResourceFile maps/d3ctf2.resources baseref
extractResourceFile maps/d3ctf3.resources baseref
extractResourceFile maps/d3ctf4.resources baseref
extractResourceFile maps/d3dm1.resources baseref
extractResourceFile maps/d3dm2.resources baseref
extractResourceFile maps/d3dm3.resources baseref
extractResourceFile maps/d3dm4.resources baseref
extractResourceFile maps/d3dm5.resources baseref
extractResourceFile maps/d3xpdm1.resources baseref
extractResourceFile maps/d3xpdm2.resources baseref
extractResourceFile maps/d3xpdm3.resources baseref
extractResourceFile maps/d3xpdm4.resources baseref
extractResourceFile maps/delta1.resources baseref
extractResourceFile maps/delta2a.resources baseref
extractResourceFile maps/delta2b.resources baseref
extractResourceFile maps/delta3.resources baseref
extractResourceFile maps/delta4.resources baseref
extractResourceFile maps/delta5.resources baseref
extractResourceFile maps/deltax.resources baseref
extractResourceFile maps/enpro.resources baseref
extractResourceFile maps/erebus1.resources baseref
extractResourceFile maps/erebus2.resources baseref
extractResourceFile maps/erebus3.resources baseref
extractResourceFile maps/erebus4.resources baseref
extractResourceFile maps/erebus5.resources baseref
extractResourceFile maps/erebus6.resources baseref
extractResourceFile maps/hell.resources baseref
extractResourceFile maps/hell1.resources baseref
extractResourceFile maps/hellhole.resources baseref
extractResourceFile maps/le_enpro1.resources baseref
extractResourceFile maps/le_enpro2.resources baseref
extractResourceFile maps/le_exis1.resources baseref
extractResourceFile maps/le_exis2.resources baseref
extractResourceFile maps/le_hell.resources baseref
extractResourceFile maps/le_hell_post.resources baseref
extractResourceFile maps/le_underground.resources baseref
extractResourceFile maps/le_underground2.resources baseref
extractResourceFile maps/mars_city1.resources baseref
extractResourceFile maps/mars_city2.resources baseref
extractResourceFile maps/mc_underground.resources baseref
extractResourceFile maps/monorail.resources baseref
extractResourceFile maps/phobos1.resources baseref
extractResourceFile maps/phobos2.resources baseref
extractResourceFile maps/phobos3.resources baseref
extractResourceFile maps/phobos4.resources baseref
extractResourceFile maps/recycling1.resources baseref
extractResourceFile maps/recycling2.resources baseref
extractResourceFile maps/site3.resources baseref

View file

@ -375,7 +375,7 @@ if(USE_VULKAN)
endif()
if(APPLE)
# SRS - Enable Beta extensions for VULKAN_SDK portability subset features on OSX
# SRS - Enable Beta extensions for Vulkan portability subset features on macOS
add_definitions(-DVK_ENABLE_BETA_EXTENSIONS)
# SRS - Optionally link directly to MoltenVK headers/library for runtime config functions on OSX
if(USE_MoltenVK)
@ -386,6 +386,19 @@ if(USE_VULKAN)
else()
message(FATAL_ERROR "Must define VULKAN_SDK location if USE_MoltenVK option enabled!")
endif()
else()
# If using Xcode and the Vulkan loader's environment variables are defined, make them available within Xcode scheme
if(CMAKE_GENERATOR MATCHES "Xcode")
if(DEFINED ENV{VK_ADD_LAYER_PATH})
set(CMAKE_XCODE_SCHEME_ENVIRONMENT "${CMAKE_XCODE_SCHEME_ENVIRONMENT};VK_ADD_LAYER_PATH=$ENV{VK_ADD_LAYER_PATH}")
endif()
if(DEFINED ENV{VK_ICD_FILENAMES})
set(CMAKE_XCODE_SCHEME_ENVIRONMENT "${CMAKE_XCODE_SCHEME_ENVIRONMENT};VK_ICD_FILENAMES=$ENV{VK_ICD_FILENAMES}")
endif()
if(DEFINED ENV{VK_DRIVER_FILES})
set(CMAKE_XCODE_SCHEME_ENVIRONMENT "${CMAKE_XCODE_SCHEME_ENVIRONMENT};VK_DRIVER_FILES=$ENV{VK_DRIVER_FILES}")
endif()
endif()
endif()
endif()
message(STATUS "Using Vulkan: " ${Vulkan_LIBRARY})
@ -718,7 +731,6 @@ set(GAMED3XP_INCLUDES
d3xp/AimAssist.h
d3xp/BrittleFracture.h
d3xp/Camera.h
#d3xp/EndLevel.h
d3xp/Entity.h
d3xp/EnvironmentProbe.h
d3xp/Fx.h
@ -756,7 +768,6 @@ set(GAMED3XP_SOURCES
d3xp/AimAssist.cpp
d3xp/BrittleFracture.cpp
d3xp/Camera.cpp
#d3xp/EndLevel.cpp
d3xp/Entity.cpp
d3xp/EnvironmentProbe.cpp
d3xp/Fx.cpp

View file

@ -2,5 +2,5 @@ cd ..
del /s /q build
mkdir build
cd build
cmake -G "Visual Studio 16" -A x64 -DUSE_OPENAL=ON ../neo
cmake -G "Visual Studio 16" -A x64 -DOPENAL=ON ../neo
pause

View file

@ -13,8 +13,8 @@ if [ -z "$OPENAL_PREFIX" ]; then
fi
fi
# note 1: remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds
# however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur
# note 1: remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to enable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds
# however, if ZERO_CHECK is enabled **must** add Vulkan's VK_ADD_LAYER_PATH, VK_ICD_FILENAMES, and VK_DRIVER_FILES locations to Xcode Custom Paths (under Settings/Locations) otherwise runtime failures may occur
# note 2: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later
# note 3: env variable MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1 enables MoltenVK's image view swizzle which may be required on older macOS versions or hardware (see vulkaninfo) - only used for VulkanSDK < 1.3.275
# note 4: env variable MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS=0 disables synchronous queue submits which is optimal for the synchronization method used by the game - only used for VulkanSDK < 1.3.275

View file

@ -13,7 +13,5 @@ if [ -z "$OPENAL_PREFIX" ]; then
fi
fi
# note 1: remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds
# however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur
# note 2: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later
cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=$OPENAL_PREFIX/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=$OPENAL_PREFIX/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev
# note 1: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later
cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DOPENAL_LIBRARY=$OPENAL_PREFIX/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=$OPENAL_PREFIX/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev

View file

@ -11,8 +11,6 @@ if [[ $OPENAL_VARIANTS != *universal* ]]; then
exit 1
fi
# note 1: remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds
# however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur
# note 2: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later
# note 3: universal openal-soft library and include paths assume MacPorts install locations
cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/opt/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/opt/local/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev
# note 1: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later
# note 2: universal openal-soft library and include paths assume MacPorts install locations
cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DOPENAL_LIBRARY=/opt/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/opt/local/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev

View file

@ -405,8 +405,8 @@ void idCameraAnim::LoadAnim()
// check for generated file
idStrStatic< MAX_OSPATH > generatedFileName = key;
generatedFileName.Insert( "generated/", 0 );
idStrStatic< MAX_OSPATH > generatedFileName = "generated/cameraanim/";
generatedFileName.AppendPath( key );
generatedFileName.SetFileExtension( CAMERA_ANIM_BINARYFILE_EXT );
ID_TIME_T currentTimeStamp = FILE_NOT_FOUND_TIMESTAMP;
@ -491,8 +491,8 @@ void idCameraAnim::LoadAnim()
cameraCuts.SetNum( numCuts );
for( i = 0; i < numCuts; i++ )
{
cameraCuts[i] = parser.ParseInt();
if( ( cameraCuts[i] < 1 ) || ( cameraCuts[i] >= numFrames ) )
cameraCuts[ i ] = parser.ParseInt();
if( ( cameraCuts[ i ] < 1 ) || ( cameraCuts[ i ] >= numFrames ) )
{
parser.Error( "Invalid camera cut" );
}
@ -505,9 +505,9 @@ void idCameraAnim::LoadAnim()
camera.SetNum( numFrames );
for( i = 0; i < numFrames; i++ )
{
parser.Parse1DMatrix( 3, camera[i].t.ToFloatPtr() );
parser.Parse1DMatrix( 3, camera[i].q.ToFloatPtr() );
camera[i].fov = parser.ParseFloat();
parser.Parse1DMatrix( 3, camera[ i ].t.ToFloatPtr() );
parser.Parse1DMatrix( 3, camera[ i ].q.ToFloatPtr() );
camera[ i ].fov = parser.ParseFloat();
}
parser.ExpectTokenString( "}" );
}
@ -754,6 +754,7 @@ void idCameraAnim::Event_Activate( idEntity* _activator )
}
}
// HarrievG begin
void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
{
GLTF_Parser gltf;
@ -887,6 +888,7 @@ void idCameraAnim::gltfLoadAnim( idStr gltfFileName, idStr animName )
camera[i].fov = ( float )( *lensFrameValues )[i];
}
}
//Dont forget to free! normally a gltfPropertyArray destructor frees the itemdata
delete CameraLensFrames->item;
}
@ -920,7 +922,6 @@ void idCameraAnim::WriteBinaryCamAnim( idFile* file, ID_TIME_T* _timeStamp /*= N
file->WriteVec3( cam.t );
}
}
}
bool idCameraAnim::LoadBinaryCamAnim( idFile* file, const ID_TIME_T sourceTimeStamp )
@ -960,8 +961,10 @@ bool idCameraAnim::LoadBinaryCamAnim( idFile* file, const ID_TIME_T sourceTimeSt
assert( i == count );
return true;
}
return false;
}
// HarrievG end
/*
===============

View file

@ -1,202 +0,0 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code 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.
Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "../idlib/precompiled.h"
#pragma hdrstop
#include "Game_local.h"
/*
game_endlevel.cpp
This entity is targeted to complete a level, and it also handles
running the stats and moving the camera.
*/
CLASS_DECLARATION( idEntity, idTarget_EndLevel )
EVENT( EV_Activate, idTarget_EndLevel::Event_Trigger )
END_CLASS
/*
================
idTarget_EndLevel::Spawn
================
*/
void idTarget_EndLevel::Spawn()
{
idStr guiName;
gui = NULL;
noGui = spawnArgs.GetBool( "noGui" );
if( !noGui )
{
spawnArgs.GetString( "guiName", "guis/EndLevel.gui", guiName );
if( guiName.Length() )
{
gui = idUserInterface::FindGui( guiName, true, false, true );
}
}
buttonsReleased = false;
readyToExit = false;
exitCommand = "";
}
/*
================
idTarget_EndLevel::~idTarget_EndLevel()
================
*/
idTarget_EndLevel::~idTarget_EndLevel()
{
//FIXME: need to go to smart ptrs for gui allocs or the unique method
//delete gui;
}
/*
================
idTarget_EndLevel::Event_Trigger
================
*/
void idTarget_EndLevel::Event_Trigger( idEntity* activator )
{
if( gameLocal.endLevel )
{
return;
}
// mark the endLevel, which will modify some game actions
// and pass control to us for drawing the stats and camera position
gameLocal.endLevel = this;
// grab the activating player view position
idPlayer* player = ( idPlayer* )( activator );
initialViewOrg = player->GetEyePosition();
initialViewAngles = idVec3( player->viewAngles[0], player->viewAngles[1], player->viewAngles[2] );
// kill all the sounds
gameSoundWorld->StopAllSounds();
if( noGui )
{
readyToExit = true;
}
}
/*
================
idTarget_EndLevel::Draw
================
*/
void idTarget_EndLevel::Draw()
{
if( noGui )
{
return;
}
renderView_t renderView;
memset( &renderView, 0, sizeof( renderView ) );
renderView.width = SCREEN_WIDTH;
renderView.height = SCREEN_HEIGHT;
renderView.x = 0;
renderView.y = 0;
renderView.fov_x = 90;
renderView.fov_y = gameLocal.CalcFovY( renderView.fov_x );
renderView.time = gameLocal.time;
#if 0
renderView.vieworg = initialViewOrg;
renderView.viewaxis = idAngles( initialViewAngles ).toMat3();
#else
renderView.vieworg = renderEntity.origin;
renderView.viewaxis = renderEntity.axis;
#endif
gameRenderWorld->RenderScene( &renderView );
// draw the gui on top of the 3D view
gui->Redraw( gameLocal.time );
}
/*
================
idTarget_EndLevel::PlayerCommand
================
*/
void idTarget_EndLevel::PlayerCommand( int buttons )
{
if( !( buttons & BUTTON_ATTACK ) )
{
buttonsReleased = true;
return;
}
if( !buttonsReleased )
{
return;
}
// we will exit at the end of the next game frame
readyToExit = true;
}
/*
================
idTarget_EndLevel::ExitCommand
================
*/
const char* idTarget_EndLevel::ExitCommand()
{
if( !readyToExit )
{
return NULL;
}
idStr nextMap;
if( spawnArgs.GetString( "nextMap", "", nextMap ) )
{
sprintf( exitCommand, "map %s", nextMap.c_str() );
}
else
{
exitCommand = "";
}
return exitCommand;
}

View file

@ -1,67 +0,0 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code 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.
Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
class idTarget_EndLevel : public idEntity
{
public:
CLASS_PROTOTYPE( idTarget_EndLevel );
void Spawn();
~idTarget_EndLevel();
void Draw();
// the endLevel will be responsible for drawing the entire screen
// when it is active
void PlayerCommand( int buttons );
// when an endlevel is active, plauer buttons get sent here instead
// of doing anything to the player, which will allow moving to
// the next level
const char* ExitCommand();
// the game will check this each frame, and return it to the
// session when there is something to give
private:
idStr exitCommand;
idVec3 initialViewOrg;
idVec3 initialViewAngles;
// set when the player triggers the exit
idUserInterface* gui;
bool buttonsReleased;
// don't skip out until buttons are released, then pressed
bool readyToExit;
bool noGui;
void Event_Trigger( idEntity* activator );
};

View file

@ -2656,14 +2656,31 @@ void idFileSystemLocal::ExtractResourceFile_f( const idCmdArgs& args )
{
if( args.Argc() < 3 )
{
common->Printf( "Usage: extractResourceFile <resource file> <outpath> <copysound>\n" );
common->Printf( "Usage: extractResourceFile <resource file> <outpath> <copysound> <all>\n" );
return;
}
idStr filename = args.Argv( 1 );
idStr outPath = args.Argv( 2 );
bool copyWaves = ( args.Argc() > 3 );
idResourceContainer::ExtractResourceFile( filename, outPath, copyWaves );
bool copyWaves = false;
bool allFileTypes = false;
for( int i = 1; i < args.Argc(); i++ )
{
idStr option = args.Argv( i );
option.StripLeading( '-' );
if( option.Icmp( "copysound" ) == 0 )
{
copyWaves = true;
}
else if( option.Icmp( "all" ) == 0 )
{
allFileTypes = true;
}
}
idResourceContainer::ExtractResourceFile( filename, outPath, copyWaves, allFileTypes );
}
/*

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2024 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -29,6 +30,9 @@ If you have questions concerning this license or the applicable additional terms
#include "precompiled.h"
#pragma hdrstop
#include "../sound/WaveFile.h"
#include "../renderer/CmdlineProgressbar.h"
/*
================================================================================================
@ -330,7 +334,7 @@ void idResourceContainer::SetContainerIndex( const int& _idx )
idResourceContainer::ExtractResourceFile
========================
*/
void idResourceContainer::ExtractResourceFile( const char* _fileName, const char* _outPath, bool _copyWavs )
void idResourceContainer::ExtractResourceFile( const char* _fileName, const char* _outPath, bool _copyWavs, bool _all )
{
idFile* inFile = fileSystem->OpenFileRead( _fileName );
@ -348,6 +352,8 @@ void idResourceContainer::ExtractResourceFile( const char* _fileName, const char
return;
}
common->Printf( "extracting resource file %s\n", _fileName );
int _tableOffset;
int _tableLength;
inFile->ReadBig( _tableOffset );
@ -361,6 +367,12 @@ void idResourceContainer::ExtractResourceFile( const char* _fileName, const char
int _numFileResources;
memFile.ReadBig( _numFileResources );
CommandlineProgressBar progressBar( _numFileResources, renderSystem->GetWidth(), renderSystem->GetHeight() );
if( _copyWavs )
{
progressBar.Start();
}
for( int i = 0; i < _numFileResources; i++ )
{
idResourceCacheEntry rt;
@ -368,29 +380,123 @@ void idResourceContainer::ExtractResourceFile( const char* _fileName, const char
rt.filename.BackSlashesToSlashes();
rt.filename.ToLower();
byte* fbuf = NULL;
if( _copyWavs && ( rt.filename.Find( ".idwav" ) >= 0 || rt.filename.Find( ".idxma" ) >= 0 || rt.filename.Find( ".idmsf" ) >= 0 ) )
{
rt.filename.SetFileExtension( "wav" );
rt.filename.Replace( "generated/", "" );
int len = fileSystem->GetFileLength( rt.filename );
fbuf = ( byte* )Mem_Alloc( len, TAG_RESOURCE );
fileSystem->ReadFile( rt.filename, ( void** )&fbuf, NULL );
idFileLocal fileIn( fileSystem->OpenFileReadMemory( rt.filename ) );
if( fileIn != NULL )
{
struct sampleBuffer_t
{
void* buffer;
int bufferSize;
int numSamples;
};
ID_TIME_T timestamp;
bool loaded;
int playBegin;
int playLength;
idWaveFile::waveFmt_t format;
idList<byte, TAG_AMPLITUDE> amplitude;
int totalBufferSize;
idList<sampleBuffer_t, TAG_AUDIO> buffers;
uint32 magic;
fileIn->ReadBig( magic );
fileIn->ReadBig( timestamp );
fileIn->ReadBig( loaded );
fileIn->ReadBig( playBegin );
fileIn->ReadBig( playLength );
idWaveFile::ReadWaveFormatDirect( format, fileIn );
int num;
fileIn->ReadBig( num );
amplitude.Clear();
amplitude.SetNum( num );
fileIn->Read( amplitude.Ptr(), amplitude.Num() );
fileIn->ReadBig( totalBufferSize );
fileIn->ReadBig( num );
buffers.SetNum( num );
for( int i = 0; i < num; i++ )
{
fileIn->ReadBig( buffers[ i ].numSamples );
fileIn->ReadBig( buffers[ i ].bufferSize );
buffers[ i ].buffer = Mem_Alloc( buffers[ i ].bufferSize, TAG_AUDIO );
fileIn->Read( buffers[ i ].buffer, buffers[ i ].bufferSize );
//buffers[ i ].buffer = GPU_CONVERT_CPU_TO_CPU_CACHED_READONLY_ADDRESS( buffers[ i ].buffer );
}
// write it as .wav file
if( format.basic.formatTag == idWaveFile::FORMAT_ADPCM )
{
rt.filename.SetFileExtension( "wav" );
rt.filename.Replace( "generated/", "" );
idStr outName = _outPath;
outName.AppendPath( rt.filename );
idFileLocal fileOut( fileSystem->OpenExplicitFileWrite( outName ) );
if( fileOut != NULL )
{
//common->Printf( "writing %s\n", outName.c_str() );
uint32 fileSize = 12 + 24 + 2 + format.extraSize + 8 + totalBufferSize;
fileSize -= 8;
idWaveFile::WriteHeaderDirect( fileSize, fileOut );
idWaveFile::WriteWaveFormatDirect( format, fileOut, true );
idWaveFile::WriteDataDirect( ( char* ) buffers[ 0 ].buffer, totalBufferSize, fileOut );
}
}
for( int i = 0; i < num; i++ )
{
Mem_Free( buffers[ i ].buffer );
}
}
}
else
{
// RB: filter out all unwanted binary files
if( !_all && (
rt.filename.IcmpPrefix( "renderprogs" ) == 0 ||
rt.filename.IcmpPrefix( "generated" ) == 0 )
/*
rt.filename.Find( ".bcmodel") >= 0 ||
rt.filename.Find( ".bcanim") >= 0 ||
rt.filename.Find( ".bmd5mesh") >= 0 ||
rt.filename.Find( ".bmd5anim") >= 0 ||
rt.filename.Find( ".bimage") >= 0 ||
rt.filename.Find( ".base") >= 0 ||
rt.filename.Find( ".blwo") >= 0 ||
rt.filename.Find( ".bprt") >= 0 ||
rt.filename.Find( ".bswf") >= 0 )*/ )
{
continue;
}
inFile->Seek( rt.offset, FS_SEEK_SET );
fbuf = ( byte* )Mem_Alloc( rt.length, TAG_RESOURCE );
inFile->Read( fbuf, rt.length );
idStr outName = _outPath;
outName.AppendPath( rt.filename );
idFile* outFile = fileSystem->OpenExplicitFileWrite( outName );
if( outFile != NULL )
{
outFile->Write( ( byte* )fbuf, rt.length );
delete outFile;
}
Mem_Free( fbuf );
}
idStr outName = _outPath;
outName.AppendPath( rt.filename );
idFile* outFile = fileSystem->OpenExplicitFileWrite( outName );
if( outFile != NULL )
if( _copyWavs )
{
outFile->Write( ( byte* )fbuf, rt.length );
delete outFile;
progressBar.Increment( true );
}
Mem_Free( fbuf );
}
delete inFile;
Mem_Free( buf );

View file

@ -95,7 +95,7 @@ public:
static void WriteResourceFile( const char* fileName, const idStrList& manifest, const bool& _writeManifest );
static void WriteManifestFile( const char* name, const idStrList& list );
static int ReadManifestFile( const char* filename, idStrList& list );
static void ExtractResourceFile( const char* fileName, const char* outPath, bool copyWavs );
static void ExtractResourceFile( const char* fileName, const char* outPath, bool copyWavs, bool all );
static void UpdateResourceFile( const char* filename, const idStrList& filesToAdd );
idFile* OpenFile( const char* fileName );
const char* GetFileName() const

View file

@ -1785,6 +1785,13 @@ bool idMapFile::Parse( const char* filename, bool ignoreRegion, bool osPath )
}
}
if( valve220Format )
{
// it might be possible that the level designer missed to set the name/model keys to be protected
// so the game code would fail to load the map because entities have then the same name
FixDuplicatedNamesInGroupInstances();
}
// RB: <name>_extraents.map allows to add and override existing entities
idMapFile extrasMap;
fullName = name;
@ -3216,11 +3223,10 @@ void idMapFile::ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview )
bool idMapFile::ConvertQuakeToDoom()
{
idDict classTypeOverview;
idStrList textureCollections;
int count = GetNumEntities();
for( int j = 0; j < count; j++ )
for( int j = 1; j < count; j++ )
{
idMapEntity* ent = GetEntity( j );
if( ent )
@ -3296,11 +3302,7 @@ bool idMapFile::ConvertQuakeToDoom()
if( ent->GetNumPrimitives() > 0 )
{
if( j > 0 )
{
const idKeyValue* namePair = ent->epairs.FindKey( "name" );
ent->epairs.Set( "model", namePair->GetValue() );
}
ent->epairs.Set( "model", namePair->GetValue() );
// map Wad brushes names to proper Doom 3 compatible material names
for( int i = 0; i < ent->GetNumPrimitives(); i++ )
@ -3317,6 +3319,8 @@ bool idMapFile::ConvertQuakeToDoom()
idStr matName;
WadTextureToMaterial( side->GetMaterial(), matName );
side->SetMaterial( matName );
idMapFile::AddMaterialToCollection( side->GetMaterial(), textureCollections );
}
}
else if( mapPrim->GetType() == idMapPrimitive::TYPE_PATCH )
@ -3356,6 +3360,80 @@ bool idMapFile::ConvertQuakeToDoom()
return true;
}
void idMapFile::FixDuplicatedNamesInGroupInstances()
{
int count = GetNumEntities();
for( int j = 1; j < count; j++ )
{
idMapEntity* ent = GetEntity( j );
if( ent )
{
idStr classname = ent->epairs.GetString( "classname" );
// only fix names in linked group lists
const idKeyValue* groupPair = ent->epairs.FindKey( "_tb_group" );
if( !groupPair )
{
continue;
}
const idKeyValue* namePair = ent->epairs.FindKey( "name" );
if( !namePair )
{
idStr uniqueName = GetUniqueEntityName( classname );
ent->epairs.Set( "name", uniqueName );
}
else
{
// is there a name clash with another entity?
bool clash = false;
for( int i = 1; i < count; i++ )
{
if( i == j )
{
continue;
}
idMapEntity* otherEnt = GetEntity( i );
const idKeyValue* otherNamePair = otherEnt->epairs.FindKey( "name" );
if( otherNamePair && !otherNamePair->GetValue().IsEmpty() && idStr::Cmp( namePair->GetValue(), otherNamePair->GetValue() ) == 0 )
{
// both entities have the same name, give this one a new name
idStr uniqueName = GetUniqueEntityName( classname );
ent->epairs.Set( "name", uniqueName );
if( ent->GetNumPrimitives() > 0 )
{
ent->epairs.Set( "model", uniqueName );
}
break;
}
}
}
// fix light color range
if( idStr::Icmp( classname, "light" ) == 0 )
{
idVec3 color;
ent->epairs.GetVector( "_color", "1 1 1", color );
if( color.x > 1 || color.y > 1 || color.z > 1 )
{
color.x *= 1.0f / 255;
color.y *= 1.0f / 255;
color.z *= 1.0f / 255;
ent->epairs.SetVector( "_color", color );
}
}
}
}
}
void idMapFile::AddMaterialToCollection( const char* material, idStrList& textureCollections )
{
idStr withoutPath = material;

View file

@ -508,6 +508,7 @@ public:
// converts Wad texture names to valid Doom 3 materials and gives every entity a unique name
bool ConvertQuakeToDoom();
void FixDuplicatedNamesInGroupInstances();
// RB end
// get the number of entities in the map

View file

@ -585,6 +585,9 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
AllocImage();
// default it again because it was unset by AllocImage().PurgeImage()
defaulted = true;
// clear the data so it's not left uninitialized
idTempArray<byte> clear( opts.width * opts.height * 4 );
memset( clear.Ptr(), 0, clear.Size() );

View file

@ -532,7 +532,7 @@ static void R_FindClosestEnvironmentProbes()
RenderEnvprobeLocal* nearest = viewEnvprobes[0];
tr.viewDef->globalProbeBounds = nearest->globalProbeBounds;
if( !nearest->irradianceImage->IsDefaulted() )
if( nearest->irradianceImage->IsLoaded() && !nearest->irradianceImage->IsDefaulted() )
{
tr.viewDef->irradianceImage = nearest->irradianceImage;
}

View file

@ -107,7 +107,7 @@ void idSoundSample_OpenAL::WriteGeneratedSample( idFile* fileOut )
fileOut->WriteBig( loaded );
fileOut->WriteBig( playBegin );
fileOut->WriteBig( playLength );
idWaveFile::WriteWaveFormatDirect( format, fileOut );
idWaveFile::WriteWaveFormatDirect( format, fileOut, false );
fileOut->WriteBig( ( int )amplitude.Num() );
fileOut->Write( amplitude.Ptr(), amplitude.Num() );
fileOut->WriteBig( totalBufferSize );

View file

@ -417,7 +417,7 @@ idWaveFile::WriteWaveFormatDirect
Writes a wave format header to a file ptr,
========================
*/
bool idWaveFile::WriteWaveFormatDirect( waveFmt_t& format, idFile* file )
bool idWaveFile::WriteWaveFormatDirect( waveFmt_t& format, idFile* file, bool wavFile )
{
//idSwapClass<waveFmt_t::basic_t> swap;
//swap.Little( format.basic.formatTag );
@ -426,6 +426,23 @@ bool idWaveFile::WriteWaveFormatDirect( waveFmt_t& format, idFile* file )
//swap.Little( format.basic.avgBytesPerSec );
//swap.Little( format.basic.blockSize );
//swap.Little( format.basic.bitsPerSample );
// RB: this is also called by .idwav saving code and it was missing
if( wavFile )
{
file->WriteBig( format.id );
if( format.basic.formatTag != FORMAT_PCM )
{
file->WriteUnsignedInt( sizeof( format.basic ) + 2 + format.extraSize );
}
else
{
file->WriteUnsignedInt( sizeof( format.basic ) );
}
}
// RB end
file->Write( &format.basic, sizeof( format.basic ) );
if( format.basic.formatTag == FORMAT_PCM )
{
@ -453,6 +470,7 @@ bool idWaveFile::WriteWaveFormatDirect( waveFmt_t& format, idFile* file )
{
return false;
}
return true;
}
@ -509,7 +527,8 @@ bool idWaveFile::WriteDataDirect( char* _data, uint32 size, idFile* file )
static const uint32 data = 'data';
file->WriteBig( data );
file->Write( &size, sizeof( uint32 ) );
file->WriteBigArray( _data, size );
//file->WriteBigArray( _data, size ); // RB: this is super slow
file->Write( _data, size );
return true;
}
@ -526,7 +545,7 @@ bool idWaveFile::WriteHeaderDirect( uint32 fileSize, idFile* file )
static const uint32 riff = 'RIFF';
static const uint32 wave = 'WAVE';
file->WriteBig( riff );
file->WriteBig( fileSize );
file->WriteUnsignedInt( fileSize );
file->WriteBig( wave );
return true;
}

View file

@ -220,7 +220,7 @@ public:
const char* ReadWaveFormat( waveFmt_t& waveFmt );
static bool ReadWaveFormatDirect( waveFmt_t& format, idFile* file );
static bool WriteWaveFormatDirect( waveFmt_t& format, idFile* file );
static bool WriteWaveFormatDirect( waveFmt_t& format, idFile* file, bool wavFile );
static bool WriteSampleDataDirect( idList< sampleData_t >& sampleData, idFile* file );
static bool WriteDataDirect( char* _data, uint32 size, idFile* file );
static bool WriteHeaderDirect( uint32 fileSize, idFile* file );

View file

@ -102,7 +102,7 @@ void idSoundSample_XAudio2::WriteGeneratedSample( idFile* fileOut )
fileOut->WriteBig( loaded );
fileOut->WriteBig( playBegin );
fileOut->WriteBig( playLength );
idWaveFile::WriteWaveFormatDirect( format, fileOut );
idWaveFile::WriteWaveFormatDirect( format, fileOut, false );
fileOut->WriteBig( ( int )amplitude.Num() );
fileOut->Write( amplitude.Ptr(), amplitude.Num() );
fileOut->WriteBig( totalBufferSize );