Merge branch 'master' into dx12-frame-latency

This commit is contained in:
SRSaunders 2024-02-04 18:20:58 -05:00 committed by GitHub
commit dfea03be72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
240 changed files with 40171 additions and 9181 deletions

1
.gitignore vendored
View file

@ -39,6 +39,7 @@ base/video/
base/wads/
base/renderprogs2/
base/generated/
base/env/
GPATH
GRTAGS

View file

@ -411,8 +411,7 @@ This project's GitHub.net Git repository can be checked out through Git with the
Existing repositories can be updated manually:
> git submodule init
> git submodule update --recursive
> git submodule update --init --recursive
@ -424,16 +423,19 @@ Existing repositories can be updated manually:
2. Download and install the latest CMake and make sure cmake.exe is added to your global or user PATH.
3. Generate the VS2022 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
Recommended in this case is `cmake-vs2022-64bit-no-ffmpeg.bat`
3. Download and install the latest Vulkan SDK from LunarG: https://www.lunarg.com/vulkan-sdk/
You can skip this step if you compile with DX12 only by adding -DUSE_VULKAN=OFF to the CMake options.
4. Use the VS2022 solution to compile what you need:
4. Generate the VS2022 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
Recommended in this case is `cmake-vs2022-win64-no-ffmpeg.bat`
5. Use the VS2022 solution to compile what you need:
RBDOOM-3-BFG/build/RBDoom3BFG.sln
## Optional if you want to use FFmpeg
6. Download ffmpeg-4.2.2-win64-shared.zip from ffmpeg.zeranoe.com/builds/win64/shared
6. Download ffmpeg-4.2.2-win64-shared.zip from https://github.com/advancedfx/ffmpeg.zeranoe.com-builds-mirror/releases
7. Extract the FFmpeg DLLs to your current build directory under RBDOOM-3-BFG/build/
@ -442,6 +444,10 @@ Recommended in this case is `cmake-vs2022-64bit-no-ffmpeg.bat`
# Compiling on Linux <a name="compile_linux"></a>
1. Go to https://github.com/microsoft/DirectXShaderCompiler and download the DXC binaries for Linux and put them into your local PATH.
E.g. Unpack dxc-artifacts.tar.gz to your home directory and add this to your ~/.profile
> # DXC compiler
> PATH="~/dxc-artifacts/bin:$PATH"
2. You need the following dependencies in order to compile RBDoom3BFG with all features:
@ -504,7 +510,7 @@ Recommended in this case is `cmake-vs2022-64bit-no-ffmpeg.bat`
Xcode release and universal builds now automatically package the executable into a macOS app bundle, defining an Info.plist file and copying the base directory and custom icon into the application bundle's Contents/Resources folder. This is controlled by adding -DMACOSX_BUNDLE=ON to the CMake options.
Depending on which package manager you install (Homebrew or MacPorts) you may need to change the openal-soft library and include paths specified in the cmake shell scripts. For single architecture builds (debug, release, retail) the default openal-soft paths are set for Homebrew on x86, while for universal builds the default paths are set for MacPorts on x86 or Apple Silicon. If you want to build using the single architecture shell scripts (debug, release, retail) on Apple Silicon, you will need to change the openal-soft paths from `/usr/local/...` to either `/opt/homebrew/...` (Homebrew) or `/opt/local/...` (MacPorts).
For single architecture builds (debug, release, retail) the default openal-soft paths are set for Homebrew, while for universal builds the default paths are set for MacPorts. The single architecture build scripts are now portable and automatically detect Homebrew's openal-soft path prefix for x86 and Apple Silicon. The universal build script remains portable since MacPorts uses the same openal-soft installation path on x86 and Apple Silicon.
4. Compile RBDOOM-3-BFG targets:
@ -633,8 +639,10 @@ r_graphicsAPI | Default DX12, can be either DX12 or Vul
r_antiAliasing | Different Anti-Aliasing modes
r_exposure [0 .. 1] | Default 0.5, controls brightness and affects HDR -> sRGB Rec. 709 exposure key. This is what you change in the video brightness options
r_useSSAO [0 .. 1] | Use Screen Space Ambient Occlusion to darken the corners in the scene and give it more depth
r_useFilmicPostProcessing [0, 1] | Apply several post process effects to mimic a filmic look
r_forceAmbient | Default 0.5, controls additional brightness by Global Illumination
r_useFilmicPostFX [0, 1] | Apply several post process effects to mimic a filmic look
r_useCRTPostFX [0, 1] | CRT monitor/TV filter
r_renderMode [0 .. 5] | Default 0 = Doom 3, 1 = Commodore 64, 2 = Commodore 64 Highres, 3 = Sega Genesis, 4 = Sega Genesis Highres, 5 = Sony PSX
## Modding Support
Name | Description

View file

@ -15,12 +15,172 @@ Thank you for downloading RBDOOM-3-BFG.
_______________________________________
TDB - RBDOOM-3-BFG 1.5.1
TBD - RBDOOM-3-BFG 1.6.0
_______________________________
## .plan - Mai 22, 2023
This is just a bugfix build that addresses several crashes and minor changes
## .plan - January 20, 2024
Cudos to Stephen Saunders for this build and to reeFridge for finding the issue.
This fixes a number of multiplayer issues. Create Private Match with clients now works reliably. The missing functionality of the online game browser and leaderboards hasn't been fixed.
Changelog:
* Fixes regression Multiplayer: Accessing memory after it has been freed #846 caused by an earlier, but broken memory leak fix on my part. The fix is almost identical to PR Free idLobby memory inside destructor #847
* Fixes a critical issue with mis-reading network snapshot data on the client side, which caused no end of problems with mis-rendering, slowdowns, unstable connections, etc. The client was ignoring the entity network-synced flag which tells it whether it should read entity class-specific data. It was trying to read it all the time and sometimes coming up with null data which caused tons of problems with rendering and physics calculations (e.g. operations on NaN numbers). Simple fix was to respect the entity's network-synced flag on the client side but it makes all the difference.
* Fixes an incorrect assert on multiplayer VoiceChat shutdown
* Allows r_useScissor and r_useParallelAdd cvars to be changed in multiplayer mode for use in bake* operations on multiplayer maps
* Fixed a couple of uninitialized variables that showed up in valgrind when in multiplayer mode
* Added Amstrad CPC 6128 Retro rendering mode
## .plan - January 03, 2024
This is a preview build of the new Retro 8-bit/16-bit/PSX rendering modes.
The new rendering modes can be set in the menu options but it's controlled mainly r_renderMode.
The values are 0 = Doom, 1 = Commodore 64, 2 = Commodore 64 Highres, 3 = Sega Genesis, 4 = Sega Genesis Highres, 5 = Sony PSX
The Commodore 64 mode regulates all colors down to the original 16 color palette.
The Sega mode mimics 9 bit color HW which means 3 bit per color channel resulting in a total of 512 colors.
The PSX mode only turns off linear filtering for the textures and applies a screen space dithering effect.
All retro rendering modes try to mimic the 320x240 resolution but it is extended to 16:9 so it is 480 x 270.
Highres modes only apply a higher resolution dithering on the pixelated output.
The PSX mode has no additional artifacts yet like wiggling vertices or textures.
There are also 2 new CRT filters that are drawn on top of everything else (even the console) for more arcade vibes.
Changelog:
* Fixed scissor clipping issues of regular surfaces like light flares #651
* Duplicating lights with Ctrl+D works now
* Merged script interpreter improvements from Dhewm3, especially that fixes https://github.com/dhewm/dhewm3/issues/303
* Doubled MAX_GLOBALS for the Runners 2.6 mod
* Crash fix between level switching and loading of new textures for D3HDP and other mods
* Fixed many small memory leaks (thanks to Steve Saunders)
* Reduced console spam and got rid of the depth-stencil is read-only warnings
* Added image_pixelLook to disable texture filtering on most textures regardless of the render mode
* Changed devtools.cfg so you can easily switch between the new render modes with F7 and F8
Changelog TrenchBroomBFG:
* Added Show patches option to View Options
## .plan - October 27, 2023
This is a preview build of the new WIP ingame Light Editor with some important bugfixes in the convertMapToValve220 command.
The Light editor can be opened using the `editLights` command in the console. Just bind F1 editLights.
It docked into certain screen areas.
It features a gizmos for translation, rotation and scaling lights and a experimental menu bar.
Light transforms can also be edited directly.
Gizmos can use snapping with defaults: 4 units for grid snapping, 15 degrees for angle snapping and 10% for scale snapping.
It also provides a few keyboard shortcuts:
G: Change to the translation gizmo
R: Change to rotation gizmo
Alt + R: Reset the current rotation
s: Change to scaling gizmo
Ctrl + S - Save all changed lights
Ctrl + D - Duplicate the existing light (Should not be used yet beause it adds a light every frame. It is better to add lights in TrenchBroom)
Steven Pridham also fixed the game related post-processing fullscreen FX effects.
Steven Saunders fixed many Linux/macOS specific compiler warnings and extended the renderer to support the Optick profiler using the Vulkan backend.
That feature is for coders and not part of the binary.
Changelog:
* Added new helper entityDefs like func_elevator_model in base/def/_tb_helpers.def for TrenchBroomBFG
* Prioritize .wav and .ogg files over shipped .idwav files so overriding existing sounds works better
* Fixed some critical bugs in the convertMapToValve220 command. Added origin brushes
* Light editor can use the rotation/scale gizmos
* Light editor can use the translation gizmo
* Fixed Imgui and light scissor clipping issues. Closes #651
* Wrote simple exportMaterialsToBlender command which saves all materials to base/_bl/materials.json
* Started to simplify the light editor
* Use same Instance pattern of AF editor for light editor
* Always draw the console after Imgui
* Added code to load UE5 editor themes into Imgui
* Imgui ingame tools can use the docking feature now
* Updated Imgui to newest docking release v1.89.9
* Fix fullscreen warp FX for grabber and various effects like Berserker (Thanks Steven Pridham)
* Fixed HLSL code to compile with newer versions of DXC
* Fix system vs. bundled library logic, suppress gcc/clang warnings for some third party source libs (jpeg, zlib, minizip)
* Fix MSVC warnings, suppress for some third party source libs (jpeg, png, oggvorbis)
* Update CMakeLists to add clang -Wno-shorten-64-to-32 flag to suppress flood of int conversion warnings
* Update rapidjson lib to remove deprecated std::iterator template and replace with required iterator types
* Update jpeglib's format_message() error routine to use snprintf() for buffer security
* Replace sprintf() / vsprintf() with idStr::snPrintf() / idStr::vsnPrintf() for buffer security
* BFG Resource File Manager under tools/bfgpakexplorer has been updated
Changelog TrenchBroomBFG:
* Updated FGDs exported from the engine which can be found in base/_tb/fgd/*
* Bezier patches can be duplicated and copy pasted within a map and copied from another TrenchBroomBFG instance
* the DOOM-3-models.fgd has been restored
_______________________________________
23 May 2023 - RBDOOM-3-BFG 1.5.1
_______________________________
# RBDOOM-3-BFG 1.5.1 Hotfix Patch
This is just a bugfix build that addresses several crashes and minor changes.
## Quick Installation Guide for Beginners
1. Make a new DoomBFG folder
2. Copy base/ from your Steam Doom 3 BFG folder into DoomBFG
3. Download the RBDOOM-3-BFG 1.3.0 full package from the [RBDOOM-3-BFG ModDB page](https://www.moddb.com/mods/rbdoom-3-bfg) and extract it over DoomBFG.
4. Do the same with the 1.5.1 patch.
If you already have a version of RBDOOM-3-BFG then you can just unpack this patch over it.
Changelog:
@ -30,6 +190,9 @@ Changelog:
* Disable DXGI automatic display mode switching for alt-enter borderless fullscreen
* Fixed crash in Delta Labs Sector 3 with Vulkan on Linux (Radeon RX 6700)
_______________________________________
29 April 2023 - RBDOOM-3-BFG 1.5.0

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.0
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.1
@PointClass base(cin_base) model({ "path": "_tb/models/md5/cinematics/admin/overhearcaseontable.obj" }) = admin_bfgcase : "No description"
[
@ -5789,7 +5789,7 @@ trigger will toggle the activator on and off. Activator will disable itself whe
width(string) : "Width of the beam."
]
@PointClass color(0 127 204) = func_bobbing : "Generic bobbing entity. It will bob on the Z axis by default.
@SolidClass color(0 127 204) = func_bobbing : "Generic bobbing entity. It will bob on the Z axis by default.
"
[
spawnclass(string) : "" : "idBobber"
@ -5804,6 +5804,17 @@ trigger will toggle the activator on and off. Activator will disable itself whe
snd_opened(string) : "looping sound for it's opened state."
]
@PointClass base(func_bobbing) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_bobbing_model : "Inherits from a func_bobbing but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
model(string) : "Model Selection (ex mapobjects/model.obj)"
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@PointClass color(0 127 204) size(-16 -16 0, 16 16 32) model({ "path": "_tb/model to use.obj" }) = func_camera_anim : "Camera controlled by animation.
"
[
@ -5837,7 +5848,7 @@ trigger will toggle the activator on and off. Activator will disable itself whe
spawnfunc(string) : "" : "func_clipmodel"
]
@PointClass color(0 127 204) = func_damagable : "Breakable object. Fires targets and changes shader parms and model when damaged.
@SolidClass color(0 127 204) = func_damagable : "Breakable object. Fires targets and changes shader parms and model when damaged.
When damaged, shader parm 3 is set to the current time, and shader parm 7 is set
to either a random number from 1 to 'numstates', or to the value in 'forcestate' if
it is non-zero. If you want an invisible texture, use common/collision. Make sure
@ -5915,7 +5926,7 @@ Use it to place all kinds of models
triggered(string) : "waits to be triggered before quaking"
]
@PointClass color(0 127 204) = func_elevator : "Elevators move to predefined floors and activate door teams based on floor number.
@SolidClass color(0 127 204) = func_elevator : "Elevators move to predefined floors and activate door teams based on floor number.
Use the default elevator gui to control them
Repeat floor1_ height and door info with floor2_ etc.. for as many floors as you want.
"
@ -5937,6 +5948,15 @@ Repeat floor1_ height and door info with floor2_ etc.. for as many floors as you
statusgui(string) : "entity name to update floor info, can use statusgui2..3..4..etc. for multiple updates. if appended with _num it will target an optional specific gui number on the entity this is handy for models with multiple guis."
]
@PointClass base(func_elevator) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_elevator_model : "Inherits from a func_elevator but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
]
@PointClass base(func_static) color(0 127 204) size(-12 -12 -12, 12 12 12) model({ "path": "sprites/bonfire.png", "scale": 0.03125 }) = func_emitter : "Inherits from a func_static but is fixed size and shows a rotation arrow.
Use it to orient particle models
Trigger it to fade it in and/or out
@ -6064,7 +6084,18 @@ Trigger it to fade it in and/or out
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@PointClass color(0 127 204) = func_pendulum : "Pendulums always swing north / south on unrotated models. Add an angles field to the model to allow rotation in other directions.
@PointClass base(func_mover) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_mover_model : "Inherits from a func_mover but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
model(string) : "Model Selection (ex mapobjects/model.obj)"
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@SolidClass color(0 127 204) = func_pendulum : "Pendulums always swing north / south on unrotated models. Add an angles field to the model to allow rotation in other directions.
Pendulum frequency is a physical constant based on the length of the beam and gravity.
"
[
@ -7181,7 +7212,10 @@ PDA's contain vidoes, audio, e-mail, and security clearances.
snd_acquire(string) : "" : "videocd_pickup"
]
@PointClass color(0 255 0) size(-8 -8 -8, 8 8 8) model({ "path": "sprites/light-bulb.png", "scale": 0.03125 }) = light : "Light source. If health is set, light becomes breakable and turns off when shot.
@PointClass color(0 255 0) size(-8 -8 -8, 8 8 8) model({{
proxymodel -> { "path": proxymodel },
{ "path": "sprites/light-bulb.png", "scale": 0.03125 }
}})= light : "Light source. If health is set, light becomes breakable and turns off when shot.
"
[
style(Choices) : "Appearance" : 0 =
@ -12613,7 +12647,7 @@ Use it to place all kinds of models
damageWhenActive(string) : "" : "1"
]
@SolidClass color(0 127 204) = moveable_base : "Moveable object. Will drop to the floor and rest untill activated.
@PointClass color(0 127 204) = moveable_base : "Moveable object. Will drop to the floor and rest untill activated.
The visual model set with the 'model' key can also be used for
collision detection. However the model may not be too complex.
max vertices = 32
@ -12654,7 +12688,7 @@ model for collision detection. Such a collision model is specified with the
broken(string) : "Visual model to be used when the health drops down to or below zero."
]
@SolidClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_barrel : "Moveable barrel. Works just like a moveable_base. However the barrel
@PointClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_barrel : "Moveable barrel. Works just like a moveable_base. However the barrel
has special handling to make it appear more round.
"
[
@ -12665,7 +12699,7 @@ has special handling to make it appear more round.
snd_bounce(string) : "" : "barrel_impact"
]
@SolidClass base(moveable_base) = moveable_base_boulder : "No description"
@PointClass base(moveable_base) = moveable_base_boulder : "No description"
[
density(string) : "" : "0.05"
friction(string) : "" : "0.2"
@ -12681,14 +12715,14 @@ has special handling to make it appear more round.
snd_bounce(string) : "" : "stone_impact"
]
@SolidClass base(moveable_base) = moveable_base_domino : "No description"
@PointClass base(moveable_base) = moveable_base_domino : "No description"
[
density(string) : "" : "0.005"
friction(string) : "" : "0.6"
bouncyness(string) : "" : "0.2"
]
@SolidClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_fixed : "No description"
@PointClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_fixed : "No description"
[
]
@ -13378,7 +13412,7 @@ Only add model, model_detonate or model_burn or health to override defaults
damageWhenActive(string) : "" : "1"
]
@PointClass base(moveable_base_brick) = moveable_guardian_brick : "No description"
@SolidClass base(moveable_base_brick) = moveable_guardian_brick : "No description"
[
density(string) : "" : "0.001"
friction(string) : "" : "0.2"

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.0
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.1
@PointClass base(ammo_belt_small) = ammo_belt_small_mp : "No description"
[

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.0
// DOOM 3 BFG game definition file (.fgd) generated by RBDOOM 3 BFG 1.5.1
@PointClass color(127 76 0) size(-24 -24 0, 24 24 82) model({ "path": "sprites/ai.png", "scale": 0.03125 }) = ai_attackcone : "
"
@ -2381,7 +2381,7 @@ trigger will toggle the activator on and off. Activator will disable itself whe
width(string) : "Width of the beam."
]
@PointClass color(0 127 204) = func_bobbing : "Generic bobbing entity. It will bob on the Z axis by default.
@SolidClass color(0 127 204) = func_bobbing : "Generic bobbing entity. It will bob on the Z axis by default.
"
[
spawnclass(string) : "" : "idBobber"
@ -2396,6 +2396,17 @@ trigger will toggle the activator on and off. Activator will disable itself whe
snd_opened(string) : "looping sound for it's opened state."
]
@PointClass base(func_bobbing) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_bobbing_model : "Inherits from a func_bobbing but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
model(string) : "Model Selection (ex mapobjects/model.obj)"
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@PointClass color(0 127 204) size(-16 -16 0, 16 16 32) model({ "path": "_tb/model to use.obj" }) = func_camera_anim : "Camera controlled by animation.
"
[
@ -2429,7 +2440,7 @@ trigger will toggle the activator on and off. Activator will disable itself whe
spawnfunc(string) : "" : "func_clipmodel"
]
@PointClass color(0 127 204) = func_damagable : "Breakable object. Fires targets and changes shader parms and model when damaged.
@SolidClass color(0 127 204) = func_damagable : "Breakable object. Fires targets and changes shader parms and model when damaged.
When damaged, shader parm 3 is set to the current time, and shader parm 7 is set
to either a random number from 1 to 'numstates', or to the value in 'forcestate' if
it is non-zero. If you want an invisible texture, use common/collision. Make sure
@ -2507,7 +2518,7 @@ Use it to place all kinds of models
triggered(string) : "waits to be triggered before quaking"
]
@PointClass color(0 127 204) = func_elevator : "Elevators move to predefined floors and activate door teams based on floor number.
@SolidClass color(0 127 204) = func_elevator : "Elevators move to predefined floors and activate door teams based on floor number.
Use the default elevator gui to control them
Repeat floor1_ height and door info with floor2_ etc.. for as many floors as you want.
"
@ -2529,6 +2540,15 @@ Repeat floor1_ height and door info with floor2_ etc.. for as many floors as you
statusgui(string) : "entity name to update floor info, can use statusgui2..3..4..etc. for multiple updates. if appended with _num it will target an optional specific gui number on the entity this is handy for models with multiple guis."
]
@PointClass base(func_elevator) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_elevator_model : "Inherits from a func_elevator but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
]
@PointClass base(func_static) color(0 127 204) size(-12 -12 -12, 12 12 12) model({ "path": "sprites/bonfire.png", "scale": 0.03125 }) = func_emitter : "Inherits from a func_static but is fixed size and shows a rotation arrow.
Use it to orient particle models
Trigger it to fade it in and/or out
@ -2656,7 +2676,18 @@ Trigger it to fade it in and/or out
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@PointClass color(0 127 204) = func_pendulum : "Pendulums always swing north / south on unrotated models. Add an angles field to the model to allow rotation in other directions.
@PointClass base(func_mover) size(-8 -8 0, 8 8 16) model({{
proxymodel -> { "path": proxymodel },
{ "path": model }
}})= func_mover_model : "Inherits from a func_mover but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom.
Use it to place all kinds of models
"
[
model(string) : "Model Selection (ex mapobjects/model.obj)"
proxymodel(string) : "A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
]
@SolidClass color(0 127 204) = func_pendulum : "Pendulums always swing north / south on unrotated models. Add an angles field to the model to allow rotation in other directions.
Pendulum frequency is a physical constant based on the length of the beam and gravity.
"
[
@ -3344,7 +3375,10 @@ PDA's contain vidoes, audio, e-mail, and security clearances.
snd_acquire(string) : "" : "videocd_pickup"
]
@PointClass color(0 255 0) size(-8 -8 -8, 8 8 8) model({ "path": "sprites/light-bulb.png", "scale": 0.03125 }) = light : "Light source. If health is set, light becomes breakable and turns off when shot.
@PointClass color(0 255 0) size(-8 -8 -8, 8 8 8) model({{
proxymodel -> { "path": proxymodel },
{ "path": "sprites/light-bulb.png", "scale": 0.03125 }
}})= light : "Light source. If health is set, light becomes breakable and turns off when shot.
"
[
style(Choices) : "Appearance" : 0 =
@ -6747,7 +6781,7 @@ Use it to place all kinds of models
damageWhenActive(string) : "" : "1"
]
@SolidClass color(0 127 204) = moveable_base : "Moveable object. Will drop to the floor and rest untill activated.
@PointClass color(0 127 204) = moveable_base : "Moveable object. Will drop to the floor and rest untill activated.
The visual model set with the 'model' key can also be used for
collision detection. However the model may not be too complex.
max vertices = 32
@ -6788,7 +6822,7 @@ model for collision detection. Such a collision model is specified with the
broken(string) : "Visual model to be used when the health drops down to or below zero."
]
@SolidClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_barrel : "Moveable barrel. Works just like a moveable_base. However the barrel
@PointClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_barrel : "Moveable barrel. Works just like a moveable_base. However the barrel
has special handling to make it appear more round.
"
[
@ -6799,7 +6833,7 @@ has special handling to make it appear more round.
snd_bounce(string) : "" : "barrel_impact"
]
@SolidClass base(moveable_base) = moveable_base_boulder : "No description"
@PointClass base(moveable_base) = moveable_base_boulder : "No description"
[
density(string) : "" : "0.05"
friction(string) : "" : "0.2"
@ -6815,14 +6849,14 @@ has special handling to make it appear more round.
snd_bounce(string) : "" : "stone_impact"
]
@SolidClass base(moveable_base) = moveable_base_domino : "No description"
@PointClass base(moveable_base) = moveable_base_domino : "No description"
[
density(string) : "" : "0.005"
friction(string) : "" : "0.6"
bouncyness(string) : "" : "0.2"
]
@SolidClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_fixed : "No description"
@PointClass base(moveable_base) color(255 127 0) size(-8 -8 -8, 8 8 8) = moveable_base_fixed : "No description"
[
]
@ -7512,7 +7546,7 @@ Only add model, model_detonate or model_burn or health to override defaults
damageWhenActive(string) : "" : "1"
]
@PointClass base(moveable_base_brick) = moveable_guardian_brick : "No description"
@SolidClass base(moveable_base_brick) = moveable_guardian_brick : "No description"
[
density(string) : "" : "0.001"
friction(string) : "" : "0.2"

View file

@ -10,6 +10,15 @@ entityDef misc_model
"editor_usage1" "Use it to place all kinds of models"
}
entityDef func_bobbing_model
{
"inherit" "func_bobbing"
"editor_mins" "-8 -8 0"
"editor_maxs" "8 8 16"
"editor_usage" "Inherits from a func_bobbing but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom."
"editor_usage1" "Use it to place all kinds of models"
}
entityDef func_door_model
{
"inherit" "func_door"
@ -19,6 +28,24 @@ entityDef func_door_model
"editor_usage1" "Use it to place all kinds of models"
}
entityDef func_elevator_model
{
"inherit" "func_elevator"
"editor_mins" "-8 -8 0"
"editor_maxs" "8 8 16"
"editor_usage" "Inherits from a func_elevator but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom."
"editor_usage1" "Use it to place all kinds of models"
}
entityDef func_mover_model
{
"inherit" "func_mover"
"editor_mins" "-8 -8 0"
"editor_maxs" "8 8 16"
"editor_usage" "Inherits from a func_mover but uses a model and is a FGD PointClass so it displays correctly in TrenchBroom."
"editor_usage1" "Use it to place all kinds of models"
}
entityDef func_rotating_model
{
"inherit" "func_rotating"

File diff suppressed because it is too large Load diff

View file

@ -3,14 +3,14 @@ bind "I" "toggle r_showSurfaceInfo"
bind "N" "noclip"
bind "M" "spawn moveable_macbethchart"
bind "F1" "toggle r_showViewEnvprobes 1 2 3 0"
bind "F2" "toggle r_showTris 1 2 3 0"
bind "F1" "toggle editLights"
bind "F2" "toggle r_showTris 1 2 0"
bind "F3" "toggle r_forceAmbient 0.5 1.0 0"
bind "F4" "toggle r_skipInteractions"
bind "F5" "savegame quick"
bind "F6" "toggle r_showLightGrid 1 3 4 0"
bind "F7" "toggle r_useSSAO"
bind "F8" "toggle r_useFilmicPostProcessing"
bind "F7" "toggle r_renderMode 0 1 2 3 4 5 6 7"
bind "F8" "toggle r_useCRTPostFX 0 1 2"
bind "F9" "loadgame quick"
bind "F10" "toggle com_fixedTic"
bind "F11" "toggle r_pbrDebug"
//bind "F10" "toggle com_fixedTic"
bind "F11" "toggle r_useFilmicPostFX"

View file

@ -1032,39 +1032,41 @@ particle heatHazeWithMaskAndVertex {
//==============================================
shaderDemos/bumpyReflect
{
{
vertexProgram bumpyEnvironment.vfp
vertexParm 0 1 // color modulation
fragmentProgram bumpyEnvironment.vfp
fragmentMap 0 cubeMap env/soulz
// RB: commented out because it breaks exportMaterials
//shaderDemos/bumpyReflect
//{
// {
// vertexProgram bumpyEnvironment.vfp
// vertexParm 0 1 // color modulation
// fragmentProgram bumpyEnvironment.vfp
// fragmentMap 0 cubeMap env/soulz
// fragmentMap 1 addnormals( models/monsters/pinky/pinky_local.tga, heightmap( models/monsters/pinky/pinky_b.tga, 9 ) )
fragmentMap 1 models/monsters/pinky/pinky_local.tga
}
}
// fragmentMap 1 models/monsters/pinky/pinky_local.tga
// }
//}
skin bumpyReflect {
//skin bumpyReflect {
// models/monsters/pinky/pinky_metal shaderDemos/bumpyReflect
* shaderDemos/bumpyReflect
}
// * shaderDemos/bumpyReflect
//}
//==============================================
shaderDemos/pinch
{
{
vertexProgram pinch.cg
vertexParm 0 sinTable[ time * 0.1 ] // pinch factorcolor modulation
fragmentProgram pinch.cg
fragmentMap 0 _currentRender
}
}
// RB: commented out because it breaks exportMaterials as the shader is not available
//shaderDemos/pinch
//{
// {
// vertexProgram pinch.cg
// vertexParm 0 sinTable[ time * 0.1 ] // pinch factorcolor modulation
// fragmentProgram pinch.cg
// fragmentMap 0 _currentRender
// }
//}
skin pinch {
* shaderDemos/pinch
}
//skin pinch {
// * shaderDemos/pinch
//}
//==============================================

View file

@ -113,28 +113,21 @@ textures/smf/chiglass1blue2
}
}
textures/smf/chiglass1blue
{
translucent
// polygonOffset
{
privatePolygonOffset
Program heatHaze_smf.vfp
fragmentProgram heatHaze_smf.vfp
}
}
// RB: commented out because it breaks exportMaterials as the shader is not available
//textures/smf/chiglass1blue
//{
// translucent
// {
// privatePolygonOffset
// Program heatHaze_smf.vfp
// fragmentProgram heatHaze_smf.vfp
// }
//}
/*
textures/smf/chiglass1blue
{
// noshadows
// translucent
// twoSided
// sort nearest
// glass
// polygonOffset
{
// privatePolygonOffset
Program heatHaze_smf.vfp
vertexParm 0 0.5 + time*0.1, 0.12 // texture scrolling
vertexParm 1 3 // magnitude of the distortion
@ -145,20 +138,21 @@ textures/smf/chiglass1blue
}
*/
textures/smf/window_scratch2
{
noshadows
translucent
twoSided
// RB: commented out because it breaks exportMaterials as the shader is not available
//textures/smf/window_scratch2
//{
// noshadows
// translucent
// twoSided
// polygonOffset
{
Program xray.vfp
vertexParm 0 0.5 + time*0.1, 0.12 // texture scrolling
vertexParm 1 3 // magnitude of the distortion
fragmentProgram xray.vfp
fragmentMap 0 _scratch2
}
}
// {
// Program xray.vfp
// vertexParm 0 0.5 + time*0.1, 0.12 // texture scrolling
// vertexParm 1 3 // magnitude of the distortion
// fragmentProgram xray.vfp
// fragmentMap 0 _scratch2
// }
//}
textures/smf/window_scratch
{
@ -625,7 +619,8 @@ textures/decals/berserk2
// RB: commented out because it breaks exportMaterials as the shader is not available
/*
textures/smf/bloodorb1
{
{
@ -667,6 +662,7 @@ textures/smf/bloodorb2_init
fragmentMap 2 clamp textures/smf/bloodorb2.tga
}
}
*/
textures/smf/bloodorb3_preblend
{
@ -676,6 +672,9 @@ textures/smf/bloodorb3_preblend
map textures/smf/bloodorb2.tga
}
}
// RB: commented out because it breaks exportMaterials as the shader is not available
/*
textures/smf/bloodorb3
{
{
@ -696,7 +695,7 @@ textures/smf/bloodorb3_init
fragmentMap 2 clamp _scratch2
}
}
*/
@ -1133,36 +1132,35 @@ textures/smf/basic/green
}
}
textures/smf/basic/tester
{
{
// vprog
vertexProgram tester.vfp
vertexParm 0 0
vertexParm 1 0, sintable[time*0.2], sintable[(time+3.14159)*0.2]
// RB: commented out because it breaks exportMaterials as the shader is not available
//textures/smf/basic/tester
//{
// {
// // vprog
// vertexProgram tester.vfp
// vertexParm 0 0
// vertexParm 1 0, sintable[time*0.2], sintable[(time+3.14159)*0.2]
// fprog
fragmentProgram tester.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/monitor_glass2.tga
}
}
// fragmentProgram tester.vfp
// fragmentMap 0 _currentRender
// fragmentMap 1 textures/sfx/monitor_glass2.tga
// }
//}
// ==============
// MOTION BLUR
// ==============
textures/smf/motionblur
{
{
vertexProgram motionblur.vfp
vertexParm 0 0
vertexParm 1 sintable[time*0.3+0.5]*0.5+0.5, sintable[time*0.3+0.5]*0.5+0.5, 0
fragmentProgram motionblur.vfp
fragmentMap 0 _currentRender
}
}
//textures/smf/motionblur
//{
// {
// vertexProgram motionblur.vfp
// vertexParm 0 0
// vertexParm 1 sintable[time*0.3+0.5]*0.5+0.5, sintable[time*0.3+0.5]*0.5+0.5, 0
// fragmentProgram motionblur.vfp
// fragmentMap 0 _currentRender
// }
//}
// ==============
// ANAMORPHIC FLARES
@ -1210,21 +1208,22 @@ textures/smf/flares/illumination
}
}
textures/smf/flares/glass
{
twoSided
// RB: commented out because it breaks exportMaterials as the shader is not available
//textures/smf/flares/glass
//{
// twoSided
//
// {
// vertexProgram flare.vfp
// vertexParm 0 0
// vertexParm 1 1
{
vertexProgram flare.vfp
vertexParm 0 0
vertexParm 1 1
fragmentProgram flare.vfp
fragmentMap 0 _currentRender
fragmentMap 1 _scratch
fragmentMap 2 textures/smf/flare/test.tga
}
}
// fragmentProgram flare.vfp
// fragmentMap 0 _currentRender
// fragmentMap 1 _scratch
// fragmentMap 2 textures/smf/flare/test.tga
// }
//}

View file

@ -429,7 +429,7 @@ void AM_loadPics( void )
for( i = 0; i < 10; i++ )
{
sprintf( namebuf, "AMMNUM%d", i );
idStr::snPrintf( namebuf, sizeof( namebuf ), "AMMNUM%d", i );
::g->marknums[i] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
}
@ -635,7 +635,7 @@ AM_Responder
::g->amap_plr->message = ::g->grid ? AMSTR_GRIDON : AMSTR_GRIDOFF;
break;
case AM_MARKKEY:
sprintf( ::g->buffer, "%s %d", AMSTR_MARKEDSPOT, ::g->markpointnum );
idStr::snPrintf( ::g->buffer, sizeof( ::g->buffer ), "%s %d", AMSTR_MARKEDSPOT, ::g->markpointnum );
::g->amap_plr->message = ::g->buffer;
AM_addMark();
break;

View file

@ -612,39 +612,39 @@ void D_DoomMain( void )
switch( ::g->gamemode )
{
case retail:
sprintf( ::g->title,
" "
"The Ultimate DOOM Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
idStr::snPrintf( ::g->title, sizeof( ::g->title ),
" "
"The Ultimate DOOM Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
break;
case shareware:
sprintf( ::g->title,
" "
"DOOM Shareware Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
idStr::snPrintf( ::g->title, sizeof( ::g->title ),
" "
"DOOM Shareware Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
break;
case registered:
sprintf( ::g->title,
" "
"DOOM Registered Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
idStr::snPrintf( ::g->title, sizeof( ::g->title ),
" "
"DOOM Registered Startup v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
break;
case commercial:
sprintf( ::g->title,
" "
"DOOM 2: Hell on Earth v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
idStr::snPrintf( ::g->title, sizeof( ::g->title ),
" "
"DOOM 2: Hell on Earth v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
break;
default:
sprintf( ::g->title,
" "
"Public DOOM - v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
idStr::snPrintf( ::g->title, sizeof( ::g->title ),
" "
"Public DOOM - v%i.%i"
" ",
VERSION / 100, VERSION % 100 );
break;
}
@ -686,7 +686,7 @@ void D_DoomMain( void )
if( p && p < ::g->myargc - 1 )
{
sprintf( file, "d:\\%s.lmp", ::g->myargv[p + 1] );
idStr::snPrintf( file, sizeof( file ), "d:\\%s.lmp", ::g->myargv[p + 1] );
D_AddFile( file );
I_Printf( "Playing demo %s.lmp.\n", ::g->myargv[p + 1] );
}
@ -918,11 +918,11 @@ bool D_DoomMainPoll( void )
{
if( M_CheckParm( "-cdrom" ) )
{
sprintf( file, "c:\\doomdata\\" SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
idStr::snPrintf( file, sizeof( file ), "c:\\doomdata\\" SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
}
else
{
sprintf( file, SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
idStr::snPrintf( file, sizeof( file ), SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
}
G_LoadGame( file );
}

View file

@ -327,7 +327,7 @@ void DoomInterface::SetMultiplayerPlayers( int localPlayerIndex, int playerCount
strcpy( mpArgV[localPlayerIndex][2], "1" );
strcpy( mpArgV[localPlayerIndex][3], "-net" );
sprintf( mpArgV[localPlayerIndex][4], "%d", localPlayer );
idStr::snPrintf( mpArgV[localPlayerIndex][4], sizeof( mpArgV[localPlayerIndex][4] ), "%d", localPlayer );
strcpy( mpArgV[localPlayerIndex][5], playerAddresses[localPlayer].c_str() );
int currentArg = 6;

View file

@ -884,7 +884,7 @@ void F_BunnyScroll( void )
::g->laststage = stage;
}
snprintf( name, name_len, "END%i", stage );
idStr::snPrintf( name, name_len, "END%i", stage );
V_DrawPatch( ( ORIGINAL_WIDTH - 13 * 8 ) / 2, ( ORIGINAL_HEIGHT - 8 * 8 ) / 2, 0, ( patch_t* )W_CacheLumpName( name, PU_CACHE_SHARED ) );
}

View file

@ -1587,7 +1587,7 @@ qboolean G_DoLoadGame()
// skip the description field
memset( vcheck, 0, sizeof( vcheck ) );
sprintf( vcheck, "version %i", VERSION );
idStr::snPrintf( vcheck, sizeof( vcheck ), "version %i", VERSION );
if( strcmp( ( char* )::g->save_p, vcheck ) )
{
loadingGame = false;
@ -1679,17 +1679,17 @@ qboolean G_DoSaveGame( void )
if( common->GetCurrentGame() == DOOM_CLASSIC )
{
sprintf( name, "DOOM\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
idStr::snPrintf( name, sizeof( name ), "DOOM\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
}
else
{
if( DoomLib::expansionSelected == doom2 )
{
sprintf( name, "DOOM2\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
idStr::snPrintf( name, sizeof( name ), "DOOM2\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
}
else
{
sprintf( name, "DOOM2_NRFTL\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
idStr::snPrintf( name, sizeof( name ), "DOOM2_NRFTL\\%s%d.dsg", SAVEGAMENAME, ::g->savegameslot );
}
}
@ -1700,7 +1700,7 @@ qboolean G_DoSaveGame( void )
::g->save_p += SAVESTRINGSIZE;
memset( name2, 0, sizeof( name2 ) );
sprintf( name2, "version %i", VERSION );
idStr::snPrintf( name2, sizeof( name2 ), "version %i", VERSION );
memcpy( ::g->save_p, name2, VERSIONSIZE );
::g->save_p += VERSIONSIZE;

View file

@ -328,7 +328,7 @@ void HU_Init( void )
j = HU_FONTSTART;
for( i = 0; i < HU_FONTSIZE; i++ )
{
snprintf( buffer, buffer_len, "STCFN%03d", j++ );
idStr::snPrintf( buffer, buffer_len, "STCFN%03d", j++ );
::g->hu_font[i] = ( patch_t* ) W_CacheLumpName( buffer, PU_STATIC_SHARED );
}

View file

@ -163,7 +163,7 @@ void* getsfx( const char* sfxname, int* len )
//float scale = 1.0f;
// Get the sound data from the WAD
sprintf( name, "ds%s", sfxname );
idStr::snPrintf( name, sizeof( name ), "ds%s", sfxname );
// Scale down the plasma gun, it clips
//if ( strcmp( sfxname, "plasma" ) == 0 ) {
@ -243,7 +243,7 @@ I_GetSfxLumpNum
int I_GetSfxLumpNum( sfxinfo_t* sfx )
{
char namebuf[9];
sprintf( namebuf, "ds%s", sfx->name );
idStr::snPrintf( namebuf, sizeof( namebuf ), "ds%s", sfx->name );
return W_GetNumForName( namebuf );
}

View file

@ -135,7 +135,7 @@ void I_Printf( const char* msg, ... )
if( debugOutput )
{
va_start( argptr, msg );
vsprintf( pmsg, msg, argptr );
idStr::vsnPrintf( pmsg, sizeof( pmsg ), msg, argptr );
safeOutputDebug( pmsg );
@ -153,7 +153,7 @@ void I_PrintfE( const char* msg, ... )
if( debugOutput )
{
va_start( argptr, msg );
vsprintf( pmsg, msg, argptr );
idStr::vsnPrintf( pmsg, sizeof( pmsg ), msg, argptr );
safeOutputDebug( "ERROR: " );
safeOutputDebug( pmsg );

View file

@ -261,17 +261,17 @@ void M_ReadSaveStrings( void )
{
if( common->GetCurrentGame() == DOOM_CLASSIC )
{
sprintf( name, "DOOM\\%s%d.dsg", SAVEGAMENAME, i );
idStr::snPrintf( name, sizeof( name ), "DOOM\\%s%d.dsg", SAVEGAMENAME, i );
}
else
{
if( DoomLib::idealExpansion == doom2 )
{
sprintf( name, "DOOM2\\%s%d.dsg", SAVEGAMENAME, i );
idStr::snPrintf( name, sizeof( name ), "DOOM2\\%s%d.dsg", SAVEGAMENAME, i );
}
else
{
sprintf( name, "DOOM2_NRFTL\\%s%d.dsg", SAVEGAMENAME, i );
idStr::snPrintf( name, sizeof( name ), "DOOM2_NRFTL\\%s%d.dsg", SAVEGAMENAME, i );
}
}
@ -520,7 +520,7 @@ void M_QuickSave( void )
::g->quickSaveSlot = -2; // means to pick a slot now
return;
}
sprintf( ::g->tempstring, QSPROMPT, ::g->savegamestrings[::g->quickSaveSlot] );
idStr::snPrintf( ::g->tempstring, sizeof( ::g->tempstring ), QSPROMPT, ::g->savegamestrings[::g->quickSaveSlot] );
M_StartMessage( ::g->tempstring, M_QuickSaveResponse, true );
}
@ -552,7 +552,7 @@ void M_QuickLoad( void )
M_StartMessage( QSAVESPOT, NULL, false );
return;
}
sprintf( ::g->tempstring, QLPROMPT, ::g->savegamestrings[::g->quickSaveSlot] );
idStr::snPrintf( ::g->tempstring, sizeof( ::g->tempstring ), QLPROMPT, ::g->savegamestrings[::g->quickSaveSlot] );
M_StartMessage( ::g->tempstring, M_QuickLoadResponse, true );
}

View file

@ -618,7 +618,7 @@ extern "C" {
::g->linetarget->x, ::g->linetarget->y );
if( angle - player->mo->angle > ANG180 )
{
if( angle - player->mo->angle < -ANG90 / 20 )
if( angle - player->mo->angle < UINT_MAX - ANG90 / 20 + 1 ) // SRS - make uint math explicit
{
player->mo->angle = angle + ANG90 / 21;
}

View file

@ -687,11 +687,11 @@ P_SetupLevel
{
if( map < 10 )
{
sprintf( lumpname, "map0%i", map % 100 );
idStr::snPrintf( lumpname, sizeof( lumpname ), "map0%i", map % 100 );
}
else
{
sprintf( lumpname, "map%i", map % 100 );
idStr::snPrintf( lumpname, sizeof( lumpname ), "map%i", map % 100 );
}
}
else

View file

@ -225,7 +225,7 @@ void P_DeathThink( player_t* player )
delta = angle - player->mo->angle;
if( delta < ANG5 || delta > ( unsigned ) - ANG5 )
if( delta < ANG5 || delta > UINT_MAX - ANG5 + 1 ) // SRS - make uint math explicit
{
// Looking at killer,
// so fade damage flash down.

View file

@ -308,7 +308,7 @@ void R_AddLine( seg_t* line )
{
return;
}
angle2 = -::g->clipangle; // ALANHACK UNSIGNED
angle2 = UINT_MAX - ::g->clipangle + 1; // ALANHACK UNSIGNED, SRS - make uint math explicit
}
// The seg is in the view range,
@ -477,7 +477,7 @@ qboolean R_CheckBBox( fixed_t* bspcoord )
return false;
}
angle2 = -::g->clipangle;// ALANHACK UNSIGNED
angle2 = UINT_MAX - ::g->clipangle + 1; // ALANHACK UNSIGNED, SRS - make uint math explicit
}

View file

@ -331,7 +331,7 @@ R_PointToAngle
if( x > y )
{
// octant 8
return -tantoangle[SlopeDiv( y, x )]; // // ALANHACK UNSIGNED
return UINT_MAX - tantoangle[SlopeDiv( y, x )] + 1; // ALANHACK UNSIGNED, SRS - make uint math explicit
}
else
{

View file

@ -638,7 +638,7 @@ R_StoreWallRange
if( offsetangle > ANG180 )
{
offsetangle = -offsetangle; // ALANHACK UNSIGNED
offsetangle = UINT_MAX - offsetangle + 1; // ALANHACK UNSIGNED, SRS - make uint math explicit
}
if( offsetangle > ANG90 )

View file

@ -540,10 +540,10 @@ ST_Responder( event_t* ev )
else if( cht_CheckCheat( &cheat_mypos, ev->data1 ) )
{
static char buf[ST_MSGWIDTH];
sprintf( buf, "ang=0x%x;x,y=(0x%x,0x%x)",
::g->players[::g->consoleplayer].mo->angle,
::g->players[::g->consoleplayer].mo->x,
::g->players[::g->consoleplayer].mo->y );
idStr::snPrintf( buf, sizeof( buf ), "ang=0x%x;x,y=(0x%x,0x%x)",
::g->players[::g->consoleplayer].mo->angle,
::g->players[::g->consoleplayer].mo->x,
::g->players[::g->consoleplayer].mo->y );
::g->plyr->message = buf;
}
}
@ -1069,7 +1069,7 @@ void ST_loadGraphics( void )
// key cards
for( i = 0; i < NUMCARDS; i++ )
{
sprintf( namebuf, "STKEYS%d", i );
idStr::snPrintf( namebuf, sizeof( namebuf ), "STKEYS%d", i );
::g->keys[i] = ( patch_t* ) W_CacheLumpName( namebuf, PU_STATIC_SHARED );
}
@ -1079,7 +1079,7 @@ void ST_loadGraphics( void )
// ::g->arms ownership widgets
for( i = 0; i < 6; i++ )
{
sprintf( namebuf, "STGNUM%d", i + 2 );
idStr::snPrintf( namebuf, sizeof( namebuf ), "STGNUM%d", i + 2 );
// gray #
::g->arms[i][0] = ( patch_t* ) W_CacheLumpName( namebuf, PU_STATIC_SHARED );
@ -1089,7 +1089,7 @@ void ST_loadGraphics( void )
}
// face backgrounds for different color ::g->players
sprintf( namebuf, "STFB%d", ::g->consoleplayer );
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFB%d", ::g->consoleplayer );
::g->faceback = ( patch_t* ) W_CacheLumpName( namebuf, PU_STATIC_SHARED );
// status bar background bits
@ -1101,18 +1101,18 @@ void ST_loadGraphics( void )
{
for( j = 0; j < ST_NUMSTRAIGHTFACES; j++ )
{
sprintf( namebuf, "STFST%d%d", i, j );
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFST%d%d", i, j );
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
}
sprintf( namebuf, "STFTR%d0", i ); // turn right
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFTR%d0", i ); // turn right
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
sprintf( namebuf, "STFTL%d0", i ); // turn left
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFTL%d0", i ); // turn left
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
sprintf( namebuf, "STFOUCH%d", i ); // ouch!
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFOUCH%d", i ); // ouch!
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
sprintf( namebuf, "STFEVL%d", i ); // evil grin ;)
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFEVL%d", i ); // evil grin ;)
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
sprintf( namebuf, "STFKILL%d", i ); // pissed off
idStr::snPrintf( namebuf, sizeof( namebuf ), "STFKILL%d", i ); // pissed off
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( namebuf, PU_STATIC_SHARED );
}
::g->faces[facenum++] = ( patch_t* )W_CacheLumpName( "STFGOD0", PU_STATIC_SHARED );
@ -1516,10 +1516,10 @@ CONSOLE_COMMAND_SHIP( idmypos, "for player position", 0 )
}
static char buf[ST_MSGWIDTH];
sprintf( buf, "ang=0x%x;x,y=(0x%x,0x%x)",
::g->players[::g->consoleplayer].mo->angle,
::g->players[::g->consoleplayer].mo->x,
::g->players[::g->consoleplayer].mo->y );
idStr::snPrintf( buf, sizeof( buf ), "ang=0x%x;x,y=(0x%x,0x%x)",
::g->players[::g->consoleplayer].mo->angle,
::g->players[::g->consoleplayer].mo->x,
::g->players[::g->consoleplayer].mo->y );
::g->plyr->message = buf;
DoomLib::SetPlayer( oldPlayer );

View file

@ -1720,7 +1720,7 @@ void WI_loadData( void )
::g->lnames = ( patch_t** ) DoomLib::Z_Malloc( sizeof( patch_t* ) * ( NUMMAPS ), PU_LEVEL_SHARED, 0 );
for( i = 0 ; i < NUMMAPS ; i++ )
{
sprintf( name, "WILV%d%d", ::g->wbs->epsd, i );
idStr::snPrintf( name, sizeof( name ), "WILV%d%d", ::g->wbs->epsd, i );
::g->lnames[i] = ( patch_t* )W_CacheLumpName( name, PU_LEVEL_SHARED );
}
@ -1763,7 +1763,7 @@ void WI_loadData( void )
for( i = 0; i < 10; i++ )
{
// numbers 0-9
sprintf( name, "WINUM%d", i );
idStr::snPrintf( name, sizeof( name ), "WINUM%d", i );
::g->num[i] = ( patch_t* )W_CacheLumpName( name, PU_LEVEL_SHARED );
}
@ -1820,11 +1820,11 @@ void WI_loadData( void )
for( i = 0 ; i < MAXPLAYERS ; i++ )
{
// "1,2,3,4"
sprintf( name, "STPB%d", i );
idStr::snPrintf( name, sizeof( name ), "STPB%d", i );
::g->wistuff_p[i] = ( patch_t* )W_CacheLumpName( name, PU_LEVEL_SHARED );
// "1,2,3,4"
sprintf( name, "WIBP%d", i + 1 );
idStr::snPrintf( name, sizeof( name ), "WIBP%d", i + 1 );
::g->wistuff_bp[i] = ( patch_t* )W_CacheLumpName( name, PU_LEVEL_SHARED );
}

View file

@ -182,8 +182,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# add clang-specific settings for warnings (the second one make sure clang doesn't complain
# about unknown -W flags, like -Wno-unused-but-set-variable)
# SRS - Add -Wno-expansion-to-defined to list of warning settings
add_definitions(-Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete -Wno-switch-enum -Wno-expansion-to-defined -Wno-nullability-completeness)
# SRS - Add -Wno-expansion-to-defined, Wno-nullability-completeness and -Wno-shorten-64-to-32 to list of warning settings
add_definitions(-Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete -Wno-switch-enum -Wno-expansion-to-defined -Wno-nullability-completeness -Wno-shorten-64-to-32)
endif()
if(NOT CMAKE_CROSSCOMPILING AND ONATIVE)
@ -314,33 +314,10 @@ if(STANDALONE)
set(DOOM_CLASSIC OFF)
endif()
if (USE_SYSTEM_ZLIB)
find_package(ZLIB REQUIRED)
endif(USE_SYSTEM_ZLIB)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
else (ZLIB_FOUND)
include_directories("libs/zlib")
set(ZLIB_LIBRARY "" )
endif (ZLIB_FOUND)
if(USE_SYSTEM_LIBPNG)
find_package(PNG REQUIRED)
endif (USE_SYSTEM_LIBPNG)
if (PNG_FOUND)
include_directories(${PNG_INCLUDE_DIRS})
set(PNG_LIBRARY ${PNG_LIBRARIES})
else (PNG_FOUND)
include_directories("libs/png")
set(PNG_LIBRARY "" )
endif (PNG_FOUND)
if(USE_SYSTEM_LIBJPEG)
find_package(JPEG REQUIRED)
endif(USE_SYSTEM_LIBJPEG)
# SRS - set libjpeg as first include path to prioritize bundled format_message() fix
if (USE_SYSTEM_LIBJPEG)
find_package(JPEG)
endif (USE_SYSTEM_LIBJPEG)
if (JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIRS})
@ -351,6 +328,44 @@ else (JPEG_FOUND)
set(JPEG_LIBRARY "" )
endif (JPEG_FOUND)
if (USE_SYSTEM_LIBPNG)
find_package(PNG)
endif (USE_SYSTEM_LIBPNG)
# SRS - if system libpng was found, then system zlib was also found via cmake dependency
if (PNG_FOUND)
include_directories(${PNG_INCLUDE_DIRS})
set(PNG_LIBRARY ${PNG_LIBRARIES})
else (PNG_FOUND)
include_directories("libs/png")
set(PNG_LIBRARY "" )
# SRS - search for system zlib only if we have not already searched via system libpng
if (USE_SYSTEM_ZLIB AND NOT USE_SYSTEM_LIBPNG)
find_package(ZLIB)
endif (USE_SYSTEM_ZLIB AND NOT USE_SYSTEM_LIBPNG)
if (USE_SYSTEM_ZLIB AND ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
else (USE_SYSTEM_ZLIB AND ZLIB_FOUND)
include_directories("libs/zlib")
set(ZLIB_LIBRARY "" )
endif (USE_SYSTEM_ZLIB AND ZLIB_FOUND)
endif (PNG_FOUND)
#SRS - move rapidjson before vulkan and other includes to prioritize bundled iterator fixes
if (USE_SYSTEM_RAPIDJSON)
find_package(rapidjson)
endif (USE_SYSTEM_RAPIDJSON)
if (RAPIDJSON_FOUND)
include_directories("${RAPIDJSON_INCLUDE_DIRS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}")
else (RAPIDJSON_FOUND)
include_directories("libs/rapidjson/include")
endif (RAPIDJSON_FOUND)
include_directories("libs/imgui")
macro(SET_OPTION option value)
@ -414,6 +429,8 @@ if(USE_VULKAN)
if(USE_VMA)
add_definitions(-DUSE_AMD_ALLOCATOR)
include_directories("libs/vma/include")
file(GLOB VMA_INCLUDES libs/vma/include/*.h)
source_group("libs\\vma" FILES ${VMA_INCLUDES})
endif()
endif()
@ -441,19 +458,6 @@ endif()
include_directories(${NVRHI_DIR}/include)
if(USE_SYSTEM_RAPIDJSON)
find_package(rapidjson REQUIRED)
endif(USE_SYSTEM_RAPIDJSON)
if (RAPIDJSON_FOUND)
include_directories("${RAPIDJSON_INCLUDE_DIRS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}")
else (RAPIDJSON_FOUND)
include_directories("libs/rapidjson/include")
endif (RAPIDJSON_FOUND)
include_directories("libs/optick")
if(OPTICK)
@ -1302,6 +1306,7 @@ set(RBDOOM3_INCLUDES
#${FREETYPE_SOURCES}
${SOUND_INCLUDES}
${OGGVORBIS_INCLUDES}
${VMA_INCLUDES}
${OPTICK_INCLUDES}
${UI_INCLUDES}
${SWF_INCLUDES}
@ -1539,6 +1544,15 @@ if(MSVC)
)
endif()
# SRS - disable certain MSVC warnings for select third-party source libraries, consider updating versions in the future?
set_source_files_properties(
${JPEG_SOURCES}
${PNG_SOURCES}
${OGGVORBIS_SOURCES}
PROPERTIES
COMPILE_FLAGS "/wd4101 /wd4267" # C4101: unreferenced local variable, C4267: type conversion with possible loss of data
)
list(APPEND RBDOOM3_SOURCES ${WIN32_RESOURCES})
add_executable(RBDoom3BFG WIN32 ${RBDOOM3_INCLUDES} ${RBDOOM3_SOURCES})
@ -1676,7 +1690,25 @@ else()
LIST(APPEND _compiler_FLAGS " -I${item}")
ENDFOREACH(item)
endif()
# SRS - disable certain gcc/clang warnings for select third-party source libraries, consider updating versions in the future?
set_source_files_properties(
${JPEG_SOURCES}
${ZLIB_SOURCES}
${MINIZIP_SOURCES}
PROPERTIES
COMPILE_FLAGS "-Wno-stringop-overread -Wno-deprecated-non-prototype"
)
# SRS - if using gcc compiler enable gnu extensions for ##__VA_ARGS__ support within optick profiler (i.e. __STRICT_ANSI__ not set)
if(CMAKE_COMPILER_IS_GNUCC)
set_source_files_properties(
${OPTICK_SOURCES}
PROPERTIES
COMPILE_FLAGS "-std=gnu++${CMAKE_CXX_STANDARD}"
)
endif()
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
LIST(APPEND _compiler_FLAGS ${_directory_flags})
SEPARATE_ARGUMENTS(_compiler_FLAGS)
@ -1685,6 +1717,11 @@ else()
# we need to recreate the precompiled header for RBDoom3BFG
# (i.e. can't use the one created for idlib before)
# because some definitions (e.g. -D__IDLIB__ -D__DOOM_DLL__) differ
if(OPTICK)
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
else()
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
endif()
add_custom_target(precomp_header_rbdoom3bfg ALL
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header idlib/precompiled.h -o idlib/precompiled.h.gch
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@ -1742,7 +1779,8 @@ else()
# delete precompiled header file after executable is compiled: IDE build case (e.g. Xcode)
else()
add_custom_command(TARGET RBDoom3BFG POST_BUILD
COMMAND ${remove_command} "idlib/precompiled.h.gch"
# SRS - added wildcards to remove tmp files from cmake ZERO_CHECK regeneration
COMMAND ${remove_command} "idlib/precompiled.h*.gch*"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "remove idlib/precompiled.h.gch"
)

View file

@ -511,11 +511,11 @@ void idCollisionModelManagerLocal::DebugOutput( const idVec3& origin )
total_translation += t;
if( cm_testTimes.GetInteger() > 9999 )
{
sprintf( buf, "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
idStr::snPrintf( buf, sizeof( buf ), "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
}
else
{
sprintf( buf, "%4d", cm_testTimes.GetInteger() );
idStr::snPrintf( buf, sizeof( buf ), "%4d", cm_testTimes.GetInteger() );
}
common->Printf( "%s translations: %4d milliseconds, (min = %d, max = %d, av = %1.1f)\n", buf, t, min_translation, max_translation, ( float ) total_translation / num_translation );
@ -571,11 +571,11 @@ void idCollisionModelManagerLocal::DebugOutput( const idVec3& origin )
total_rotation += t;
if( cm_testTimes.GetInteger() > 9999 )
{
sprintf( buf, "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
idStr::snPrintf( buf, sizeof( buf ), "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
}
else
{
sprintf( buf, "%4d", cm_testTimes.GetInteger() );
idStr::snPrintf( buf, sizeof( buf ), "%4d", cm_testTimes.GetInteger() );
}
common->Printf( "%s rotation: %4d milliseconds, (min = %d, max = %d, av = %1.1f)\n", buf, t, min_rotation, max_rotation, ( float ) total_rotation / num_rotation );
}

View file

@ -3558,11 +3558,15 @@ cm_model_t* idCollisionModelManagerLocal::LoadBinaryModelFromFile( idFile* file,
}
file->ReadBig( model->polygonMemory );
// SRS - Boost polygonMemory to handle in-memory (ptr) vs. on-disk (int) size for cm_polygon_t.material, otherwise AllocPolygon() leaks
model->polygonMemory += ( sizeof( idMaterial* ) - sizeof( int ) ) * model->numPolygons;
model->polygonBlock = ( cm_polygonBlock_t* ) Mem_ClearedAlloc( sizeof( cm_polygonBlock_t ) + model->polygonMemory, TAG_COLLISION );
model->polygonBlock->bytesRemaining = model->polygonMemory;
model->polygonBlock->next = ( ( byte* ) model->polygonBlock ) + sizeof( cm_polygonBlock_t );
file->ReadBig( model->brushMemory );
// SRS - Boost brushMemory to handle in-memory (ptr) vs. on-disk (int) size for cm_brush_t.material, otherwise AllocBrush() leaks
model->brushMemory += ( sizeof( idMaterial* ) - sizeof( int ) ) * model->numBrushes;
model->brushBlock = ( cm_brushBlock_t* ) Mem_ClearedAlloc( sizeof( cm_brushBlock_t ) + model->brushMemory, TAG_COLLISION );
model->brushBlock->bytesRemaining = model->brushMemory;
model->brushBlock->next = ( ( byte* ) model->brushBlock ) + sizeof( cm_brushBlock_t );

View file

@ -2,5 +2,16 @@ cd ..
rm -rf build
mkdir build
cd build
# asemarafa/SRS - Determine the Homebrew path prefix for openal-soft
if [ -z "$OPENAL_PREFIX" ]; then
OPENAL_PREFIX=$(brew --prefix openal-soft 2>/dev/null)
if [ -z "$OPENAL_PREFIX" ]; then
echo "Error: openal-soft is not installed via Homebrew."
echo "Either install it using 'brew install openal-soft' or define the path prefix via OPENAL_PREFIX."
exit 1
fi
fi
# change or remove -DCMAKE_OSX_DEPLOYMENT_TARGET=<version> to match supported runtime targets
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.1 -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.1 -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DOPENAL_LIBRARY=$OPENAL_PREFIX/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=$OPENAL_PREFIX/include ../neo -Wno-dev

View file

@ -2,5 +2,16 @@ cd ..
rm -rf build
mkdir build
cd build
# asemarafa/SRS - Determine the Homebrew path prefix for openal-soft
if [ -z "$OPENAL_PREFIX" ]; then
OPENAL_PREFIX=$(brew --prefix openal-soft 2>/dev/null)
if [ -z "$OPENAL_PREFIX" ]; then
echo "Error: openal-soft is not installed via Homebrew."
echo "Either install it using 'brew install openal-soft' or define the path prefix via OPENAL_PREFIX."
exit 1
fi
fi
# change or remove -DCMAKE_OSX_DEPLOYMENT_TARGET=<version> to match supported runtime targets
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG -DID_RETAIL" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.1 -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG -DID_RETAIL" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.1 -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DOPENAL_LIBRARY=$OPENAL_PREFIX/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=$OPENAL_PREFIX/include ../neo -Wno-dev

View file

@ -0,0 +1,6 @@
cd ..
del /s /q build
mkdir build
cd build
cmake -G "Visual Studio 16" -A x64 -DFFMPEG=OFF -DBINKDEC=ON -DUSE_VULKAN=OFF ../neo
pause

View file

@ -0,0 +1,6 @@
cd ..
del /s /q build
mkdir build
cd build
cmake -G "Visual Studio 17" -A x64 -DFFMPEG=OFF -DBINKDEC=ON -DSTANDALONE=ON ../neo
pause

View file

@ -2,10 +2,22 @@ cd ..
rm -rf xcode-debug
mkdir xcode-debug
cd xcode-debug
# asemarafa/SRS - Determine the Homebrew path prefix for openal-soft
if [ -z "$OPENAL_PREFIX" ]; then
OPENAL_PREFIX=$(brew --prefix openal-soft 2>/dev/null)
if [ -z "$OPENAL_PREFIX" ]; then
echo "Error: openal-soft is not installed via Homebrew."
echo "Either install it using 'brew install openal-soft' or define the path prefix via OPENAL_PREFIX."
exit 1
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
# 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)
# 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
# note 5: env variable MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=2 enables MoltenVK's use of Metal argument buffers only if VK_EXT_descriptor_indexing is enabled
cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENVIRONMENT="MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1;MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS=0;MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=2" -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev
# 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
# note 5: env variable MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=2 enables MoltenVK's use of Metal argument buffers only if VK_EXT_descriptor_indexing is enabled - only used for VulkanSDK < 1.3.275
# note 6: env variable MVK_CONFIG_TIMESTAMP_PERIOD_LOWPASS_ALPHA=1.0 disables MoltenVK's timestampPeriod lowpass filter for non-Apple GPUs - only used for VulkanSDK < 1.3.275
cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENVIRONMENT="MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1;MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS=0;MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=2;MVK_CONFIG_TIMESTAMP_PERIOD_LOWPASS_ALPHA=1.0" -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

View file

@ -2,7 +2,18 @@ cd ..
rm -rf xcode-release
mkdir xcode-release
cd xcode-release
# asemarafa/SRS - Determine the Homebrew path prefix for openal-soft
if [ -z "$OPENAL_PREFIX" ]; then
OPENAL_PREFIX=$(brew --prefix openal-soft 2>/dev/null)
if [ -z "$OPENAL_PREFIX" ]; then
echo "Error: openal-soft is not installed via Homebrew."
echo "Either install it using 'brew install openal-soft' or define the path prefix via OPENAL_PREFIX."
exit 1
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=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev
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

View file

@ -2,6 +2,15 @@ cd ..
rm -rf xcode-universal
mkdir xcode-universal
cd xcode-universal
# SRS - Determine if openal-soft universal variant is installed via MacPorts
OPENAL_VARIANTS=$(port info --variants openal-soft 2>/dev/null)
if [[ $OPENAL_VARIANTS != *universal* ]]; then
echo "Error: openal-soft universal variant is not installed via MacPorts."
echo "Please install it using 'sudo port install openal-soft +universal'"
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

View file

@ -4668,6 +4668,12 @@ idVec3 idEntity::GetOriginBrushOffset() const
return spawnArgs.GetVector( BRUSH_ORIGIN_KEY, "0 0 0" );
}
idVec3 idEntity::GetEditOrigin() const
{
return GetPhysics()->GetOrigin();
}
/***********************************************************************
Events

View file

@ -346,58 +346,83 @@ public:
// physics
// set a new physics object to be used by this entity
void SetPhysics( idPhysics* phys );
// get the physics object used by this entity
idPhysics* GetPhysics() const;
// restore physics pointer for save games
void RestorePhysics( idPhysics* phys );
// run the physics for this entity
bool RunPhysics();
// Interpolates the physics, used on MP clients.
void InterpolatePhysics( const float fraction );
// InterpolatePhysics actually calls evaluate, this version doesn't.
void InterpolatePhysicsOnly( const float fraction, bool updateTeam = false );
// set the origin of the physics object (relative to bindMaster if not NULL)
void SetOrigin( const idVec3& org );
// set the axis of the physics object (relative to bindMaster if not NULL)
void SetAxis( const idMat3& axis );
// use angles to set the axis of the physics object (relative to bindMaster if not NULL)
void SetAngles( const idAngles& ang );
// get the floor position underneath the physics object
bool GetFloorPos( float max_dist, idVec3& floorpos ) const;
// retrieves the transformation going from the physics origin/axis to the visual origin/axis
virtual bool GetPhysicsToVisualTransform( idVec3& origin, idMat3& axis );
// retrieves the transformation going from the physics origin/axis to the sound origin/axis
virtual bool GetPhysicsToSoundTransform( idVec3& origin, idMat3& axis );
// called from the physics object when colliding, should return true if the physics simulation should stop
virtual bool Collide( const trace_t& collision, const idVec3& velocity );
// retrieves impact information, 'ent' is the entity retrieving the info
virtual void GetImpactInfo( idEntity* ent, int id, const idVec3& point, impactInfo_t* info );
// apply an impulse to the physics object, 'ent' is the entity applying the impulse
virtual void ApplyImpulse( idEntity* ent, int id, const idVec3& point, const idVec3& impulse );
// add a force to the physics object, 'ent' is the entity adding the force
virtual void AddForce( idEntity* ent, int id, const idVec3& point, const idVec3& force );
// activate the physics object, 'ent' is the entity activating this entity
virtual void ActivatePhysics( idEntity* ent );
// returns true if the physics object is at rest
virtual bool IsAtRest() const;
// returns the time the physics object came to rest
virtual int GetRestStartTime() const;
// add a contact entity
virtual void AddContactEntity( idEntity* ent );
// remove a touching entity
virtual void RemoveContactEntity( idEntity* ent );
// damage
// returns true if this entity can be damaged from the given origin
virtual bool CanDamage( const idVec3& origin, idVec3& damagePoint ) const;
// applies damage to this entity
virtual void Damage( idEntity* inflictor, idEntity* attacker, const idVec3& dir, const char* damageDefName, const float damageScale, const int location );
// adds a damage effect like overlays, blood, sparks, debris etc.
virtual void AddDamageEffect( const trace_t& collision, const idVec3& velocity, const char* damageDefName );
// callback function for when another entity received damage from this entity. damage can be adjusted and returned to the caller.
virtual void DamageFeedback( idEntity* victim, idEntity* inflictor, int& damage );
// notifies this entity that it is in pain
virtual bool Pain( idEntity* inflictor, idEntity* attacker, int damage, const idVec3& dir, int location );
// notifies this entity that is has been killed
virtual void Killed( idEntity* inflictor, idEntity* attacker, int damage, const idVec3& dir, int location );
@ -557,8 +582,10 @@ private:
// physics
// initialize the default physics
void InitDefaultPhysics( const idVec3& origin, const idMat3& axis, const idDeclEntityDef* def );
// update visual position from the physics
void UpdateFromPhysics( bool moveBack );
// get physics timestep
virtual int GetPhysicsTimeStep() const;
@ -573,13 +600,14 @@ private:
// events
public:
// jmarshall
idVec3 GetOrigin();
idVec3 GetOrigin() const;
float DistanceTo( idEntity* ent );
float DistanceTo( const idVec3& pos ) const;
idStr GetNextKey( const char* prefix, const char* lastMatch );
// jmarshall end
idVec3 GetOriginBrushOffset() const;
virtual idVec3 GetEditOrigin() const; // RB: used by idEditEntities
void Event_GetName();
void Event_SetName( const char* name );

View file

@ -82,10 +82,7 @@ void idGameEdit::ParseSpawnArgsToRenderEnvprobe( const idDict* args, renderEnvir
memset( renderEnvprobe, 0, sizeof( *renderEnvprobe ) );
if( !args->GetVector( "light_origin", "", renderEnvprobe->origin ) )
{
args->GetVector( "origin", "", renderEnvprobe->origin );
}
args->GetVector( "origin", "", renderEnvprobe->origin );
// check for other attributes
args->GetVector( "_color", "1 1 1", color );
@ -554,7 +551,6 @@ EnvironmentProbe::ClientThink
*/
void EnvironmentProbe::ClientThink( const int curTime, const float fraction, const bool predict )
{
InterpolatePhysics( fraction );
if( baseColor != nextBaseColor )
@ -567,20 +563,6 @@ void EnvironmentProbe::ClientThink( const int curTime, const float fraction, con
Present();
}
/*
================
EnvironmentProbe::GetPhysicsToSoundTransform
================
*/
bool EnvironmentProbe::GetPhysicsToSoundTransform( idVec3& origin, idMat3& axis )
{
//origin = localEnvprobeOrigin + renderEnvprobe.lightCenter;
//axis = localLightAxis * GetPhysics()->GetAxis();
//return true;
return false;
}
/*
================
EnvironmentProbe::FreeEnvprobeDef

View file

@ -55,7 +55,6 @@ public:
virtual void Think();
virtual void ClientThink( const int curTime, const float fraction, const bool predict );
virtual void FreeEnvprobeDef();
virtual bool GetPhysicsToSoundTransform( idVec3& origin, idMat3& axis );
void Present();
void SaveState( idDict* args );

View file

@ -300,6 +300,7 @@ public:
virtual void PlayerGetAxis( idMat3& axis ) const;
virtual void PlayerGetViewAngles( idAngles& angles ) const;
virtual void PlayerGetEyePosition( idVec3& org ) const;
virtual bool PlayerGetRenderView( renderView_t& rv ) const;
// In game map editing support.
virtual const idDict* MapGetEntityDict( const char* name ) const;

View file

@ -711,7 +711,7 @@ void idEditEntities::DisplayEntities()
// RB: use renderer backend to display light properties
if( ent->fl.selected )
{
drawArrows = true;
//drawArrows = true;
idLight* light = static_cast<idLight*>( ent );
@ -738,7 +738,7 @@ void idEditEntities::DisplayEntities()
globalLightOrigin = renderLight.origin + renderLight.axis * renderLight.lightCenter;
}
idVec3 start = ent->GetPhysics()->GetOrigin();
idVec3 start = ent->GetEditOrigin();
idVec3 end = globalLightOrigin;
gameRenderWorld->DebugArrow( colorYellow, start, end, 2 );
@ -749,12 +749,12 @@ void idEditEntities::DisplayEntities()
}
}
if( !viewBounds.ContainsPoint( ent->GetPhysics()->GetOrigin() ) )
if( !viewBounds.ContainsPoint( ent->GetEditOrigin() ) )
{
continue;
}
gameRenderWorld->DebugBounds( color, idBounds( ent->GetPhysics()->GetOrigin() ).Expand( 8 ) );
gameRenderWorld->DebugBounds( color, idBounds( ent->GetEditOrigin() ).Expand( 8 ) );
if( drawArrows )
{
idVec3 start = ent->GetPhysics()->GetOrigin();
@ -781,9 +781,9 @@ void idEditEntities::DisplayEntities()
if( textKey.Length() )
{
const char* text = ent->spawnArgs.GetString( textKey );
if( viewTextBounds.ContainsPoint( ent->GetPhysics()->GetOrigin() ) )
if( viewTextBounds.ContainsPoint( ent->GetEditOrigin() ) )
{
gameRenderWorld->DrawText( text, ent->GetPhysics()->GetOrigin() + idVec3( 0, 0, 12 ), 0.25, colorWhite, axis, 1 );
gameRenderWorld->DrawText( text, ent->GetEditOrigin() + idVec3( 0, 0, 12 ), 0.25, colorWhite, axis, 1 );
}
}
}
@ -1159,6 +1159,18 @@ void idGameEdit::PlayerGetEyePosition( idVec3& org ) const
org = gameLocal.GetLocalPlayer()->GetEyePosition();
}
// RB
bool idGameEdit::PlayerGetRenderView( renderView_t& rv ) const
{
renderView_t* view = gameLocal.GetLocalPlayer()->GetRenderView();
if( view )
{
rv = *view;
return true;
}
return false;
}
/*
================

View file

@ -168,7 +168,7 @@ TestGameAPI
*/
void TestGameAPI()
{
gameImport_t testImport;
gameImport_t testImport = {};
gameExport_t testExport;
testImport.sys = ::sys;
@ -4312,7 +4312,21 @@ idEntity* idGameLocal::FindTraceEntity( idVec3 start, idVec3 end, const idTypeIn
bestScale = 1.0f;
for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() )
{
if( ent->IsType( c ) && ent != skip )
// RB: use edit origin for lights
if( ent->IsType( idLight::Type ) && ent->IsType( c ) && ent != skip )
{
b[0] = b[1] = ent->GetEditOrigin();
b = b.Expand( 16 );
if( b.RayIntersection( start, end - start, scale ) )
{
if( scale >= 0.0f && scale < bestScale )
{
bestEnt = ent;
bestScale = scale;
}
}
}
else if( ent->IsType( c ) && ent != skip )
{
b = ent->GetPhysics()->GetAbsBounds().Expand( 16 );
if( b.RayIntersection( start, end - start, scale ) )

View file

@ -983,8 +983,8 @@ void idGameLocal::ClientReadSnapshot( const idSnapShot& ss )
ent->FlagNewSnapshot();
// read the class specific data from the snapshot
if( msg.GetRemainingReadBits() > 0 )
// read the class specific data from the snapshot; SRS - only if network-synced
if( msg.GetRemainingReadBits() > 0 && ent->fl.networkSync )
{
ent->ReadFromSnapshot_Ex( msg );
ent->snapshotBits = msg.GetSize();

View file

@ -131,10 +131,19 @@ void idGameEdit::ParseSpawnArgsToRenderLight( const idDict* args, renderLight_t*
{
if( !args->GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", mat ) )
{
// RB: light_angles is specific for lights that have been modified by the editLights command
// these lights have a static model and are not proper grouped using func_group
if( args->GetAngles( "light_angles", "0 0 0", angles ) )
{
angles[ 0 ] = idMath::AngleNormalize360( angles[ 0 ] );
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
angles[ 2 ] = idMath::AngleNormalize360( angles[ 2 ] );
mat = angles.ToMat3();
}
// RB: TrenchBroom interop
// support "angles" like in Quake 3
if( args->GetAngles( "angles", "0 0 0", angles ) )
else if( args->GetAngles( "angles", "0 0 0", angles ) )
{
angles[ 0 ] = idMath::AngleNormalize360( angles[ 0 ] );
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
@ -1052,7 +1061,6 @@ idLight::ClientThink
*/
void idLight::ClientThink( const int curTime, const float fraction, const bool predict )
{
InterpolatePhysics( fraction );
if( baseColor != nextBaseColor )
@ -1077,6 +1085,12 @@ bool idLight::GetPhysicsToSoundTransform( idVec3& origin, idMat3& axis )
return true;
}
// RB
idVec3 idLight::GetEditOrigin() const
{
return ( GetPhysics()->GetOrigin() + GetPhysics()->GetAxis() * localLightOrigin );
}
/*
================
idLight::FreeLightDef

View file

@ -104,6 +104,7 @@ public:
{
return baseColor;
}
virtual idVec3 GetEditOrigin() const;
void SetShader( const char* shadername );
void SetLightParm( int parmnum, float value );
void SetLightParms( float parm0, float parm1, float parm2, float parm3 );

View file

@ -653,7 +653,7 @@ const char* idMultiplayerGame::GameTime()
}
else
{
sprintf( buff, "WMP %i", s );
idStr::snPrintf( buff, sizeof( buff ), "WMP %i", s );
}
}
else

View file

@ -429,7 +429,6 @@ idPlayerView::SingleView
*/
void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudManager )
{
// normal rendering
if( !view )
{
@ -1075,8 +1074,8 @@ void FullscreenFX_Helltime::AccumPass( const renderView_t* view )
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
float t0 = 1.0f;
float t1 = 0.0f;
float t0 = 0.0f;
float t1 = 1.0f;
// capture pass
if( clearAccumBuffer )
@ -1097,8 +1096,8 @@ FullscreenFX_Helltime::HighQuality
*/
void FullscreenFX_Helltime::HighQuality()
{
float t0 = 1.0f;
float t1 = 0.0f;
float t0 = 0.0f;
float t1 = 1.0f;
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
@ -1200,8 +1199,8 @@ void FullscreenFX_Multiplayer::AccumPass( const renderView_t* view )
{
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
float t0 = 1.0f;
float t1 = 0.0f;
float t0 = 0.0f;
float t1 = 1.0f;
// capture pass
if( clearAccumBuffer )
@ -1222,8 +1221,8 @@ FullscreenFX_Multiplayer::HighQuality
*/
void FullscreenFX_Multiplayer::HighQuality()
{
float t0 = 1.0f;
float t1 = 0.0f;
float t0 = 0.0f;
float t1 = 1.0f;
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
@ -1323,27 +1322,27 @@ void FullscreenFX_Warp::DrawWarp( WarpPolygon_t wp, float interp )
drawPts[0].Set( trans.outer1.x, trans.outer1.y );
drawPts[1].Set( mid2.x, mid2.y );
drawPts[2].Set( mid1.x, mid1.y );
drawPts[3].Set( trans.outer1.z, trans.outer1.w );
drawPts[4].Set( mid2_uv.z, mid2_uv.w );
drawPts[5].Set( mid1_uv.z, mid1_uv.w );
drawPts[3].Set( trans.outer1.z, 1 - trans.outer1.w );
drawPts[4].Set( mid2_uv.z, 1 - mid2_uv.w );
drawPts[5].Set( mid1_uv.z, 1 - mid1_uv.w );
renderSystem->DrawStretchTri( drawPts[0], drawPts[1], drawPts[2], drawPts[3], drawPts[4], drawPts[5], material );
// draw [outer1, outer2, mid2]
drawPts[0].Set( trans.outer1.x, trans.outer1.y );
drawPts[1].Set( trans.outer2.x, trans.outer2.y );
drawPts[2].Set( mid2.x, mid2.y );
drawPts[3].Set( trans.outer1.z, trans.outer1.w );
drawPts[4].Set( trans.outer2.z, trans.outer2.w );
drawPts[5].Set( mid2_uv.z, mid2_uv.w );
drawPts[3].Set( trans.outer1.z, 1 - trans.outer1.w );
drawPts[4].Set( trans.outer2.z, 1 - trans.outer2.w );
drawPts[5].Set( mid2_uv.z, 1 - mid2_uv.w );
renderSystem->DrawStretchTri( drawPts[0], drawPts[1], drawPts[2], drawPts[3], drawPts[4], drawPts[5], material );
// draw [mid1, mid2, center]
drawPts[0].Set( mid1.x, mid1.y );
drawPts[1].Set( mid2.x, mid2.y );
drawPts[2].Set( trans.center.x, trans.center.y );
drawPts[3].Set( mid1_uv.z, mid1_uv.w );
drawPts[4].Set( mid2_uv.z, mid2_uv.w );
drawPts[5].Set( trans.center.z, trans.center.w );
drawPts[3].Set( mid1_uv.z, 1 - mid1_uv.w );
drawPts[4].Set( mid2_uv.z, 1 - mid2_uv.w );
drawPts[5].Set( trans.center.z, 1 - trans.center.w );
renderSystem->DrawStretchTri( drawPts[0], drawPts[1], drawPts[2], drawPts[3], drawPts[4], drawPts[5], material );
}
@ -1439,9 +1438,9 @@ void FullscreenFX_EnviroSuit::HighQuality()
{
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
float s0 = 0.0f;
float t0 = 1.0f;
float t0 = 0.0f;
float s1 = 1.0f;
float t1 = 0.0f;
float t1 = 1.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
}
@ -1527,9 +1526,9 @@ void FullscreenFX_DoubleVision::HighQuality()
// uv coordinates
float s0 = shift;
float t0 = 1.0f;
float t0 = 0.0f;
float s1 = 1.0f;
float t1 = 0.0f;
float t1 = 1.0f;
renderSystem->SetColor4( color.x, color.y, color.z, 1.0f );
@ -1537,9 +1536,9 @@ void FullscreenFX_DoubleVision::HighQuality()
renderSystem->SetColor4( color.x, color.y, color.z, 0.5f );
s0 = 0.0f;
t0 = 1.0f;
t0 = 0.0f;
s1 = ( 1.0 - shift );
t1 = 0.0f;
t1 = 1.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
}
@ -1884,9 +1883,9 @@ void FullscreenFXManager::Blendback( float alpha )
{
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f - alpha );
float s0 = 0.0f;
float t0 = 1.0f;
float t0 = 0.0f;
float s1 = 1.0f;
float t1 = 0.0f;
float t1 = 1.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, blendBackMaterial );
}
}
@ -1947,9 +1946,6 @@ void FullscreenFXManager::Process( const renderView_t* view )
return;
}
// RB: skip for now so the game is playable. These old effects really suck with modern APIs
#if !defined( USE_NVRHI )
// do the process
for( int i = 0; i < fx.Num(); i++ )
{
@ -1977,9 +1973,10 @@ void FullscreenFXManager::Process( const renderView_t* view )
// handle the accum pass if we have one
if( pfx->HasAccum() )
{
// we need to crop the accum pass
renderSystem->CropRenderSize( 512, 512 );
pfx->AccumPass( view );
// we need to crop the accum pass
//
renderSystem->CropRenderSize( 512, 512 );
renderSystem->CaptureRenderToImage( "_accum" );
renderSystem->UnCrop();
}
@ -1991,7 +1988,6 @@ void FullscreenFXManager::Process( const renderView_t* view )
Blendback( pfx->GetFadeAlpha() );
}
}
#endif
}

View file

@ -1290,6 +1290,17 @@ idTrigger_Touch::idTrigger_Touch()
clipModel = NULL;
}
/*
================
idTrigger_Touch::~idTrigger_Touch
================
*/
idTrigger_Touch::~idTrigger_Touch()
{
// SRS - Delete clipModel on cleanup, otherwise will leak
delete clipModel;
}
/*
================
idTrigger_Touch::Spawn

View file

@ -272,6 +272,7 @@ private:
class idTrigger_Touch : public idTrigger
{
public:
~idTrigger_Touch();
CLASS_PROTOTYPE( idTrigger_Touch );

View file

@ -3052,7 +3052,7 @@ const char* idWeapon::GetAmmoNameForNum( ammo_t ammonum )
return NULL;
}
sprintf( text, "%d", ammonum );
idStr::snPrintf( text, sizeof( text ), "%d", ammonum );
num = ammoDict->GetNumKeyVals();
for( i = 0; i < num; i++ )

View file

@ -190,8 +190,8 @@ void idAASLocal::CalculateAreaTravelTimes()
}
}
// RB: 64 bit fixes, changed unsigned int to ptrdiff_t
assert( ( ( ptrdiff_t ) bytePtr - ( ptrdiff_t ) areaTravelTimes ) <= numAreaTravelTimes * sizeof( unsigned short ) );
// RB: 64 bit fixes, changed unsigned int to ptrdiff_t, SRS - added ptrdiff_t casts on RHS for type consistency across compare operator
assert( ( ( ptrdiff_t ) bytePtr - ( ptrdiff_t ) areaTravelTimes ) <= ( ptrdiff_t ) numAreaTravelTimes * ( ptrdiff_t ) sizeof( unsigned short ) );
// RB end
}

View file

@ -953,7 +953,7 @@ float PathLength( idVec2 optimizedPath[MAX_OBSTACLE_PATH], int numPathPoints, co
}
// add penalty if this path does not go in the current direction
if( curDir * ( optimizedPath[1] - optimizedPath[0] ) < 0.0f )
if( numPathPoints > 1 && curDir * ( optimizedPath[1] - optimizedPath[0] ) < 0.0f )
{
pathLength += 100.0f;
}

View file

@ -84,7 +84,7 @@ idEventDef::idEventDef( const char* command, const char* formatspec, char return
if( numargs > D_EVENT_MAXARGS )
{
eventError = true;
sprintf( eventErrorMsg, "idEventDef::idEventDef : Too many args for '%s' event.", name );
idStr::snPrintf( eventErrorMsg, sizeof( eventErrorMsg ), "idEventDef::idEventDef : Too many args for '%s' event.", name );
return;
}
@ -138,7 +138,7 @@ idEventDef::idEventDef( const char* command, const char* formatspec, char return
default :
eventError = true;
sprintf( eventErrorMsg, "idEventDef::idEventDef : Invalid arg format '%s' string for '%s' event.", formatspec, name );
idStr::snPrintf( eventErrorMsg, sizeof( eventErrorMsg ), "idEventDef::idEventDef : Invalid arg format '%s' string for '%s' event.", formatspec, name );
return;
break;
}
@ -158,16 +158,16 @@ idEventDef::idEventDef( const char* command, const char* formatspec, char return
if( strcmp( formatspec, ev->formatspec ) != 0 )
{
eventError = true;
sprintf( eventErrorMsg, "idEvent '%s' defined twice with same name but differing format strings ('%s'!='%s').",
command, formatspec, ev->formatspec );
idStr::snPrintf( eventErrorMsg, sizeof( eventErrorMsg ), "idEvent '%s' defined twice with same name but differing format strings ('%s'!='%s').",
command, formatspec, ev->formatspec );
return;
}
if( ev->returnType != returnType )
{
eventError = true;
sprintf( eventErrorMsg, "idEvent '%s' defined twice with same name but differing return types ('%c'!='%c').",
command, returnType, ev->returnType );
idStr::snPrintf( eventErrorMsg, sizeof( eventErrorMsg ), "idEvent '%s' defined twice with same name but differing return types ('%c'!='%c').",
command, returnType, ev->returnType );
return;
}
// Don't bother putting the duplicate event in list.
@ -181,7 +181,7 @@ idEventDef::idEventDef( const char* command, const char* formatspec, char return
if( numEventDefs >= MAX_EVENTS )
{
eventError = true;
sprintf( eventErrorMsg, "numEventDefs >= MAX_EVENTS" );
idStr::snPrintf( eventErrorMsg, sizeof( eventErrorMsg ), "numEventDefs >= MAX_EVENTS" );
return;
}
eventDefList[numEventDefs] = ev;

View file

@ -1085,7 +1085,7 @@ void idRestoreGame::Error( const char* fmt, ... )
char text[ 1024 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
objects.DeleteContents( true );

View file

@ -1437,7 +1437,7 @@ static void PrintFloat( float f )
char buf[128];
int i;
for( i = sprintf( buf, "%3.2f", f ); i < 7; i++ )
for( i = idStr::snPrintf( buf, sizeof( buf ), "%3.2f", f ); i < 7; i++ )
{
buf[i] = ' ';
}

View file

@ -43,7 +43,7 @@ All game cvars should be defined here.
*/
struct gameVersion_s {
gameVersion_s() { sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
gameVersion_s() { idStr::snPrintf( string, sizeof( string ), "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); }
char string[256];
} gameVersion;

View file

@ -1368,9 +1368,11 @@ public:
SYSTEM_FIELD_VSYNC,
SYSTEM_FIELD_ANTIALIASING,
// RB begin
SYSTEM_FIELD_POSTFX,
SYSTEM_FIELD_SSAO,
SYSTEM_FIELD_RENDERMODE,
SYSTEM_FIELD_AMBIENT_BRIGHTNESS,
SYSTEM_FIELD_SSAO,
SYSTEM_FIELD_FILMIC_POSTFX,
SYSTEM_FIELD_CRT_POSTFX,
// RB end
SYSTEM_FIELD_BRIGHTNESS,
SYSTEM_FIELD_VOLUME,

View file

@ -34,7 +34,7 @@ const static int NUM_SYSTEM_OPTIONS_OPTIONS = 8;
extern idCVar r_graphicsAPI;
extern idCVar r_antiAliasing;
extern idCVar r_useFilmicPostProcessing;
extern idCVar r_useFilmicPostFX;
extern idCVar r_swapInterval;
extern idCVar s_volume_dB;
extern idCVar r_exposure; // RB: use this to control HDR exposure or brightness in LDR mode
@ -119,10 +119,19 @@ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
// RB begin
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "Filmic VFX" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
control->SetLabel( "Render Mode" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_RENDERMODE );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_RENDERMODE );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_BAR );
control->SetLabel( "Ambient Lighting" );
control->SetDescription( "Sets the amount of indirect lighting. Needed for modern PBR reflections" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
control->SetupEvents( 2, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
@ -142,12 +151,19 @@ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
options->AddChild( control );*/
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_BAR );
control->SetLabel( "Ambient Lighting" );
control->SetDescription( "Sets the amount of indirect lighting. Needed for modern PBR reflections" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
control->SetupEvents( 2, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SSAO );
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "Filmic Post FX" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FILMIC_POSTFX );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FILMIC_POSTFX );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "CRT Filter" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_CRT_POSTFX );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_CRT_POSTFX );
options->AddChild( control );
// RB end
@ -421,7 +437,7 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData
//originalShadowMapping = r_useShadowMapping.GetInteger();
originalSSAO = r_useSSAO.GetInteger();
originalAmbientBrightness = r_forceAmbient.GetFloat();
originalPostProcessing = r_useFilmicPostProcessing.GetInteger();
originalPostProcessing = r_useFilmicPostFX.GetInteger();
// RB end
const int fullscreen = r_fullscreen.GetInteger();
@ -593,11 +609,25 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi
break;
}
// RB begin
case SYSTEM_FIELD_POSTFX:
case SYSTEM_FIELD_RENDERMODE:
{
static const int numValues = 8;
static const int values[numValues] = { 0, 1, 2, 3, 4, 5, 6, 7 };
r_renderMode.SetInteger( AdjustOption( r_renderMode.GetInteger(), values, numValues, adjustAmount ) );
break;
}
case SYSTEM_FIELD_FILMIC_POSTFX:
{
static const int numValues = 2;
static const int values[numValues] = { 0, 1 };
r_useFilmicPostProcessing.SetInteger( AdjustOption( r_useFilmicPostProcessing.GetInteger(), values, numValues, adjustAmount ) );
r_useFilmicPostFX.SetInteger( AdjustOption( r_useFilmicPostFX.GetInteger(), values, numValues, adjustAmount ) );
break;
}
case SYSTEM_FIELD_CRT_POSTFX:
{
static const int numValues = 3;
static const int values[numValues] = { 0, 1, 2 };
r_useCRTPostFX.SetInteger( AdjustOption( r_useCRTPostFX.GetInteger(), values, numValues, adjustAmount ) );
break;
}
/*
@ -759,21 +789,27 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
return values[ r_antiAliasing.GetInteger() ];
}
case SYSTEM_FIELD_POSTFX:
if( r_useFilmicPostProcessing.GetInteger() > 0 )
case SYSTEM_FIELD_RENDERMODE:
{
static const int numValues = 8;
static const char* values[numValues] =
{
return "#str_swf_enabled";
}
else
{
return "#str_swf_disabled";
}
//return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) );
// RB begin
"Doom 3",
"Commodore 64",
"Commodore 64 Hi",
"Amstrad CPC 6128",
"Amstrad CPC 6128 Hi",
"Sega Genesis",
"Sega Genesis Highres",
"Sony PSX",
};
/*
case SYSTEM_FIELD_SHADOWMAPPING:
if( r_useShadowMapping.GetInteger() == 1 )
compile_time_assert( numValues == ( RENDERMODE_PSX + 1 ) );
return values[ r_renderMode.GetInteger() ];
}
case SYSTEM_FIELD_FILMIC_POSTFX:
if( r_useFilmicPostFX.GetInteger() > 0 )
{
return "#str_swf_enabled";
}
@ -781,7 +817,19 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
{
return "#str_swf_disabled";
}
*/
case SYSTEM_FIELD_CRT_POSTFX:
{
static const int numValues = 3;
static const char* values[numValues] =
{
"#str_swf_disabled",
"Mattias CRT",
"Newpixie CRT",
};
return values[ r_useCRTPostFX.GetInteger() ];
}
//case SYSTEM_FIELD_LODBIAS:
// return LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
@ -798,7 +846,6 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
case SYSTEM_FIELD_AMBIENT_BRIGHTNESS:
return LinearAdjust( r_forceAmbient.GetFloat(), 0.0f, 1.0f, 0.0f, 100.0f );
// RB end
case SYSTEM_FIELD_BRIGHTNESS:
return LinearAdjust( r_exposure.GetFloat(), 0.0f, 1.0f, 0.0f, 100.0f );
@ -848,7 +895,7 @@ bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataCh
return true;
}
if( originalPostProcessing != r_useFilmicPostProcessing.GetInteger() )
if( originalPostProcessing != r_useFilmicPostFX.GetInteger() )
{
return true;
}

View file

@ -90,34 +90,45 @@ public:
public: // common physics interface
// set pointer to entity using physics
virtual void SetSelf( idEntity* e ) = 0;
// clip models
virtual void SetClipModel( idClipModel* model, float density, int id = 0, bool freeOld = true ) = 0;
virtual void SetClipBox( const idBounds& bounds, float density );
virtual idClipModel* GetClipModel( int id = 0 ) const = 0;
virtual int GetNumClipModels() const = 0;
// get/set the mass of a specific clip model or the whole physics object
virtual void SetMass( float mass, int id = -1 ) = 0;
virtual float GetMass( int id = -1 ) const = 0;
// get/set the contents of a specific clip model or the whole physics object
virtual void SetContents( int contents, int id = -1 ) = 0;
virtual int GetContents( int id = -1 ) const = 0;
// get/set the contents a specific clip model or the whole physics object collides with
virtual void SetClipMask( int mask, int id = -1 ) = 0;
virtual int GetClipMask( int id = -1 ) const = 0;
// get the bounds of a specific clip model or the whole physics object
virtual const idBounds& GetBounds( int id = -1 ) const = 0;
virtual const idBounds& GetAbsBounds( int id = -1 ) const = 0;
// evaluate the physics with the given time step, returns true if the object moved
virtual bool Evaluate( int timeStepMSec, int endTimeMSec ) = 0;
// Interpolate between the two known snapshots with the given fraction, used for MP clients.
// returns true if the object moved.
virtual bool Interpolate( const float fraction ) = 0;
// resets the prev and next states to the parameters.
virtual void ResetInterpolationState( const idVec3& origin, const idMat3& axis ) = 0;
// update the time without moving
virtual void UpdateTime( int endTimeMSec ) = 0;
// get the last physics update time
virtual int GetTime() const = 0;
// collision interaction between different physics objects
virtual void GetImpactInfo( const int id, const idVec3& point, impactInfo_t* info ) const = 0;
virtual void ApplyImpulse( const int id, const idVec3& point, const idVec3& impulse ) = 0;
@ -127,38 +138,49 @@ public: // common physics interface
virtual bool IsAtRest() const = 0;
virtual int GetRestStartTime() const = 0;
virtual bool IsPushable() const = 0;
// save and restore the physics state
virtual void SaveState() = 0;
virtual void RestoreState() = 0;
// set the position and orientation in master space or world space if no master set
virtual void SetOrigin( const idVec3& newOrigin, int id = -1 ) = 0;
virtual void SetAxis( const idMat3& newAxis, int id = -1 ) = 0;
// translate or rotate the physics object in world space
virtual void Translate( const idVec3& translation, int id = -1 ) = 0;
virtual void Rotate( const idRotation& rotation, int id = -1 ) = 0;
// get the position and orientation in world space
virtual const idVec3& GetOrigin( int id = 0 ) const = 0;
virtual const idMat3& GetAxis( int id = 0 ) const = 0;
// set linear and angular velocity
virtual void SetLinearVelocity( const idVec3& newLinearVelocity, int id = 0 ) = 0;
virtual void SetAngularVelocity( const idVec3& newAngularVelocity, int id = 0 ) = 0;
// get linear and angular velocity
virtual const idVec3& GetLinearVelocity( int id = 0 ) const = 0;
virtual const idVec3& GetAngularVelocity( int id = 0 ) const = 0;
// gravity
virtual void SetGravity( const idVec3& newGravity ) = 0;
virtual const idVec3& GetGravity() const = 0;
virtual const idVec3& GetGravityNormal() const = 0;
// get first collision when translating or rotating this physics object
virtual void ClipTranslation( trace_t& results, const idVec3& translation, const idClipModel* model ) const = 0;
virtual void ClipRotation( trace_t& results, const idRotation& rotation, const idClipModel* model ) const = 0;
virtual int ClipContents( const idClipModel* model ) const = 0;
// disable/enable the clip models contained by this physics object
virtual void DisableClip() = 0;
virtual void EnableClip() = 0;
// link/unlink the clip models contained by this physics object
virtual void UnlinkClip() = 0;
virtual void LinkClip() = 0;
// contacts
virtual bool EvaluateContacts() = 0;
virtual int GetNumContacts() const = 0;
@ -166,22 +188,28 @@ public: // common physics interface
virtual void ClearContacts() = 0;
virtual void AddContactEntity( idEntity* e ) = 0;
virtual void RemoveContactEntity( idEntity* e ) = 0;
// ground contacts
virtual bool HasGroundContacts() const = 0;
virtual bool IsGroundEntity( int entityNum ) const = 0;
virtual bool IsGroundClipModel( int entityNum, int id ) const = 0;
// set the master entity for objects bound to a master
virtual void SetMaster( idEntity* master, const bool orientated = true ) = 0;
// set pushed state
virtual void SetPushed( int deltaTime ) = 0;
virtual const idVec3& GetPushedLinearVelocity( const int id = 0 ) const = 0;
virtual const idVec3& GetPushedAngularVelocity( const int id = 0 ) const = 0;
// get blocking info, returns NULL if the object is not blocked
virtual const trace_t* GetBlockingInfo() const = 0;
virtual idEntity* GetBlockingEntity() const = 0;
// movement end times in msec for reached events at the end of predefined motion
virtual int GetLinearEndTime() const = 0;
virtual int GetAngularEndTime() const = 0;
// networking
virtual void WriteToSnapshot( idBitMsg& msg ) const = 0;
virtual void ReadFromSnapshot( const idBitMsg& msg ) = 0;

View file

@ -196,7 +196,7 @@ private:
waterLevel_t waterLevel;
int waterType;
bool clientPusherLocked;
bool clientPusherLocked = false; // SRS - initialize to unlocked at start
private:
float CmdScale( const usercmd_t& cmd ) const;

View file

@ -264,7 +264,7 @@ void idCompiler::Error( const char* message, ... ) const
char string[ 1024 ];
va_start( argptr, message );
vsprintf( string, message, argptr );
idStr::vsnPrintf( string, sizeof( string ), message, argptr );
va_end( argptr );
#if defined(USE_EXCEPTIONS)
@ -287,7 +287,7 @@ void idCompiler::Warning( const char* message, ... ) const
char string[ 1024 ];
va_start( argptr, message );
vsprintf( string, message, argptr );
idStr::vsnPrintf( string, sizeof( string ), message, argptr );
va_end( argptr );
parserPtr->Warning( "%s", string );
@ -1255,6 +1255,26 @@ idVarDef* idCompiler::EmitFunctionParms( int op, idVarDef* func, int startarg, i
// need arg size separate since script object may be NULL
statement_t& statement = gameLocal.program.GetStatement( gameLocal.program.NumStatements() - 1 );
statement.c = SizeConstant( func->value.functionPtr->parmTotal );
// DG: before changes I did to ParseFunctionDef(), func->value.functionPtr->parmTotal was 0
// if the function declaration/prototype has been parsed already, but the
// definition/implementation hadn't been parsed yet. That was wrong and sometimes
// (with debug game DLLs) lead to assertions in custom scripts, because the
// stack space reserved for function parameters was wrong.
// Now func->value.functionPtr->parmTotal is calculated when parsing the prototype,
// but func->value.functionPtr->parmSize[i] is still only calculated when parsing
// the implementation (as it's not needed before and so we can tell the cases apart here).
// However, savegames from before the change have script checksums
// (by idProgram::CalculateChecksum()) from statements with the wrong size, so
// loading them would fail as the checksum doesn't match.
// Setting this flag allows using the parmTotal argSize 0 when calculating the checksum
// so it matches the one from old savegames (unless something else has also changed in
// the script state so they really are incompatible). That's only done when actually
// loading old savegames (detected via BUILD_NUMBER/savegame.GetBuildNumber())
if( op == OP_OBJECTCALL && func->value.functionPtr->parmTotal > 0
&& func->value.functionPtr->parmSize.Num() == 0 )
{
statement.flags = statement_t::FLAG_OBJECTCALL_IMPL_NOT_PARSED_YET;
}
}
else
{
@ -2638,16 +2658,38 @@ void idCompiler::ParseFunctionDef( idTypeDef* returnType, const char* name )
}
}
// check if this is a prototype or declaration
// DG: make sure parmTotal gets calculated when parsing prototype (not just when parsing
// implementation) so calling this function/method before the implementation has been parsed
// works without getting Assertions in IdInterpreter::Execute() and ::LeaveFunction()
// ("st->c->value.argSize == func->parmTotal", "localstackUsed == localstackBase", see #303 and #344)
// calculate stack space used by parms
numParms = type->NumParameters();
if( !CheckToken( "{" ) )
{
// it's just a prototype, so get the ; and move on
ExpectToken( ";" );
// DG: BUT only after calculating the stack space for the arguments because this
// function might be called before the implementation is parsed (see #303 and #344)
// which otherwise causes Assertions in IdInterpreter::Execute() and ::LeaveFunction()
// ("st->c->value.argSize == func->parmTotal", "localstackUsed == localstackBase")
func->parmTotal = 0;
for( i = 0; i < numParms; i++ )
{
parmType = type->GetParmType( i );
int size = parmType->Inherits( &type_object ) ? type_object.Size() : parmType->Size();
func->parmTotal += size;
// NOTE: Don't set func->parmSize[] yet, the workaround to keep compatibility
// with old savegames checks for func->parmSize.Num() == 0
// (see EmitFunctionParms() for more explanation of that workaround)
// Also not defining the parms yet, otherwise they're defined in a different order
// than before, so their .num is different which breaks compat with old savegames
}
return;
}
// calculate stack space used by parms
numParms = type->NumParameters();
int totalSize = 0; // DG: totalsize might already have been calculated for the prototype, see a few lines above
func->parmSize.SetNum( numParms );
for( i = 0; i < numParms; i++ )
{
@ -2660,8 +2702,11 @@ void idCompiler::ParseFunctionDef( idTypeDef* returnType, const char* name )
{
func->parmSize[ i ] = parmType->Size();
}
func->parmTotal += func->parmSize[ i ];
totalSize += func->parmSize[ i ];
}
// DG: if parmTotal has been calculated before, it shouldn't have changed
assert( ( func->parmTotal == 0 || totalSize == func->parmTotal ) && "function parameter sizes differ between protype vs implementation?!" );
func->parmTotal = totalSize;
// define the parms
for( i = 0; i < numParms; i++ )
@ -3175,6 +3220,8 @@ void idCompiler::CompileFile( const char* text, const char* filename, bool toCon
compile_time.Start();
idStr origFileName = filename; // DG: filename pointer might become invalid when calling NextToken() below
scope = &def_namespace;
basetype = NULL;
callthread = false;
@ -3258,6 +3305,11 @@ void idCompiler::CompileFile( const char* text, const char* filename, bool toCon
compile_time.Stop();
if( !toConsole )
{
gameLocal.Printf( "Compiled '%s': %.1f ms\n", filename, compile_time.Milliseconds() );
// DG: filename can be overwritten by NextToken() (via gameLocal.program.GetFilenum()), so
// use a copy, origFileName, that's still valid here. Furthermore, the path is nonsense,
// as idProgram::CompileText() called fileSystem->RelativePathToOSPath() on it
// which does not return the *actual* full path of that file but invents one,
// so revert that to the relative filename which at least isn't misleading
gameLocal.Printf( "Compiled '%s': %u ms\n", fileSystem->OSPathToRelativePath( origFileName ), compile_time.Milliseconds() );
}
}

View file

@ -214,9 +214,9 @@ bool idInterpreter::GetRegisterValue( const char* name, idStr& out, int scopeDep
idVarDef* d;
char funcObject[ 1024 ];
char* funcName;
const idVarDef* scope;
const idVarDef* scope = NULL;
const idVarDef* scopeObj;
const idTypeDef* field;
const idScriptObject* obj;
const function_t* func;
out.Empty();
@ -244,42 +244,46 @@ bool idInterpreter::GetRegisterValue( const char* name, idStr& out, int scopeDep
if( funcName )
{
*funcName = '\0';
scope = gameLocal.program.GetDef( NULL, funcObject, &def_namespace );
scopeObj = gameLocal.program.GetDef( NULL, funcObject, &def_namespace );
funcName += 2;
if( scopeObj )
{
scope = gameLocal.program.GetDef( NULL, funcName, scopeObj );
}
}
else
{
funcName = funcObject;
scope = &def_namespace;
scope = gameLocal.program.GetDef( NULL, func->Name(), &def_namespace );
scopeObj = NULL;
}
// Get the function from the object
d = gameLocal.program.GetDef( NULL, funcName, scope );
if( !d )
if( !scope )
{
return false;
}
// Get the variable itself and check various namespaces
d = gameLocal.program.GetDef( NULL, name, d );
d = gameLocal.program.GetDef( NULL, name, scope );
// Check the objects for it if it wasnt local to the function
if( !d )
{
if( scope == &def_namespace )
for( ; scopeObj && scopeObj->TypeDef()->SuperClass(); scopeObj = scopeObj->TypeDef()->SuperClass()->def )
{
return false;
}
d = gameLocal.program.GetDef( NULL, name, scope );
if( !d )
{
d = gameLocal.program.GetDef( NULL, name, &def_namespace );
if( !d )
d = gameLocal.program.GetDef( NULL, name, scopeObj );
if( d )
{
return false;
break;
}
}
}
if( !d )
{
out = "???";
return false;
}
reg = GetVariable( d );
switch( d->Type() )
{
@ -320,15 +324,25 @@ bool idInterpreter::GetRegisterValue( const char* name, idStr& out, int scopeDep
break;
case ev_field:
{
idEntity* entity;
idScriptObject* obj;
if( scope == &def_namespace )
{
// should never happen, but handle it safely anyway
return false;
}
field = scope->TypeDef()->GetParmType( reg.ptrOffset )->FieldType();
obj = *reinterpret_cast<const idScriptObject**>( &localstack[ callStack[ callStackDepth ].stackbase ] );
if( !field || !obj )
field = d->TypeDef()->FieldType();
entity = GetEntity( *( ( int* )&localstack[ localstackBase ] ) );
if( !entity || !field )
{
return false;
}
obj = &entity->scriptObject;
if( !obj )
{
return false;
}
@ -343,10 +357,29 @@ bool idInterpreter::GetRegisterValue( const char* name, idStr& out, int scopeDep
out = va( "%g", *( reinterpret_cast<float*>( &obj->data[ reg.ptrOffset ] ) ) );
return true;
case ev_string:
{
const char* str;
str = reinterpret_cast<const char*>( &obj->data[ reg.ptrOffset ] );
if( !str )
{
out = "\"\"";
}
else
{
out = "\"";
out += str;
out += "\"";
}
return true;
}
default:
return false;
}
break;
}
case ev_string:
if( reg.stringPtr )
@ -504,7 +537,7 @@ void idInterpreter::Error( const char* fmt, ... ) const
char text[ 1024 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
StackTrace();
@ -533,7 +566,7 @@ void idInterpreter::Warning( const char* fmt, ... ) const
char text[ 1024 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
if( ( instructionPointer >= 0 ) && ( instructionPointer < gameLocal.program.NumStatements() ) )

View file

@ -207,11 +207,11 @@ ID_INLINE const char* idInterpreter::FloatToString( float value )
if( value == ( float )( int )value )
{
sprintf( text, "%d", ( int )value );
idStr::snPrintf( text, sizeof( text ), "%d", ( int )value );
}
else
{
sprintf( text, "%f", value );
idStr::snPrintf( text, sizeof( text ), "%f", value );
}
return text;
}

View file

@ -1914,7 +1914,9 @@ statement_t* idProgram::AllocStatement()
gameLocal.Error( "Exceeded maximum allowed number of statements (%d)", statements.Max() );
#endif
}
return statements.Alloc();
statement_t* ret = statements.Alloc();
ret->flags = 0; // DG: initialize the added flags (that are rarely set/used otherwise) to 0
return ret;
}
/*
@ -2142,7 +2144,7 @@ bool idProgram::CompileText( const char* source, const char* text, bool console
try
#endif
{
compiler.CompileFile( text, filename, console );
compiler.CompileFile( text, ospath.c_str(), console );
// check to make sure all functions prototyped have code
for( i = 0; i < varDefs.Num(); i++ )
@ -2343,7 +2345,7 @@ void idProgram::Save( idSaveGame* savefile ) const
savefile->WriteByte( variables[i] );
}
int checksum = CalculateChecksum();
int checksum = CalculateChecksum( false );
savefile->WriteInt( checksum );
}
@ -2381,10 +2383,12 @@ bool idProgram::Restore( idRestoreGame* savefile )
int saved_checksum, checksum;
savefile->ReadInt( saved_checksum );
checksum = CalculateChecksum();
bool isOldSavegame = savefile->GetBuildNumber() <= BUILD_NUMBER_SAVE_VERSION_CHANGE;
checksum = CalculateChecksum( isOldSavegame );
if( saved_checksum != checksum )
{
gameLocal.Warning( "WARNING: Real Script checksum didn't match the one from the savegame!" );
result = false;
}
@ -2396,7 +2400,7 @@ bool idProgram::Restore( idRestoreGame* savefile )
idProgram::CalculateChecksum
================
*/
int idProgram::CalculateChecksum() const
int idProgram::CalculateChecksum( bool forOldSavegame ) const
{
int i, result;
@ -2414,6 +2418,20 @@ int idProgram::CalculateChecksum() const
memset( statementList, 0, ( sizeof( statementBlock_t ) * statements.Num() ) );
// DG hack: get the vardef for the argSize == 0 constant for savegame-compat
int constantZeroNum = -1;
if( forOldSavegame )
{
for( idVarDef* def = GetDefList( "<IMMEDIATE>" ); def != NULL; def = def->Next() )
{
if( def->Type() == ev_argsize && def->value.argSize == 0 )
{
constantZeroNum = def->num;
break;
}
}
}
// Copy info into new list, using the variable numbers instead of a pointer to the variable
for( i = 0; i < statements.Num(); i++ )
{
@ -2437,7 +2455,18 @@ int idProgram::CalculateChecksum() const
}
if( statements[i].c )
{
statementList[i].c = statements[i].c->num;
// DG: old savegames wrongly assumed argSize 0 for some statements.
// So for the checksums to match we need to use the corresponding vardef num here
// See idCompiler::EmitFunctionParms() and ParseFunctionDef() for more details.
if( forOldSavegame && statements[i].op == OP_OBJECTCALL
&& statements[i].flags == statement_t::FLAG_OBJECTCALL_IMPL_NOT_PARSED_YET )
{
statementList[i].c = constantZeroNum;
}
else
{
statementList[i].c = statements[i].c->num;
}
}
else
{

View file

@ -40,11 +40,9 @@ class idSaveGame;
class idRestoreGame;
#define MAX_STRING_LEN 128
#define MAX_GLOBALS 296608 // in bytes
#define MAX_GLOBALS 296608*2 // in bytes, RB: doubled for Runners 2 mod #835
#define MAX_STRINGS 1024
#define MAX_FUNCS 3584
#define MAX_STATEMENTS 131072 // statement_t - 18 bytes last I checked
typedef enum
@ -317,9 +315,9 @@ typedef union varEval_s
float* floatPtr;
idVec3* vectorPtr;
function_t* functionPtr;
int* intPtr;
int* intPtr;
byte* bytePtr;
int* entityNumberPtr;
int* entityNumberPtr;
int virtualFunction;
int jumpOffset;
int stackOffset; // offset in stack for local variables
@ -335,9 +333,9 @@ class idVarDef
friend class idVarDefName;
public:
int num;
int num; // global index/ID of variable
varEval_t value;
idVarDef* scope; // function, namespace, or object the var was defined in
idVarDef* scope; // function, namespace, or object the var was defined in
int numUsers; // number of users if this is a constant
typedef enum
@ -464,11 +462,20 @@ extern idVarDef def_boolean;
typedef struct statement_s
{
unsigned short op;
unsigned short flags; // DG: added this for ugly hacks
enum
{
// op is OP_OBJECTCALL and when the statement was created the function/method
// implementation hasn't been parsed yet (only the declaration/prototype)
// see idCompiler::EmitFunctionParms() and idProgram::CalculateChecksum()
FLAG_OBJECTCALL_IMPL_NOT_PARSED_YET = 1,
};
// DG: moved linenumber and file up here to prevent wasting 8 bytes of padding on 64bit
unsigned short linenumber;
unsigned short file;
idVarDef* a;
idVarDef* b;
idVarDef* c;
unsigned short linenumber;
unsigned short file;
} statement_t;
/***********************************************************************
@ -509,6 +516,8 @@ private:
int top_files;
void CompileStats();
byte* ReserveDefMemory( int size );
idVarDef* AllocVarDef( idTypeDef* type, const char* name, idVarDef* scope );
public:
idVarDef* returnDef;
@ -520,7 +529,7 @@ public:
// save games
void Save( idSaveGame* savefile ) const;
bool Restore( idRestoreGame* savefile );
int CalculateChecksum() const; // Used to insure program code has not
int CalculateChecksum( bool forOldSavegame ) const; // Used to insure program code has not
// changed between savegames
void Startup( const char* defaultScript );
@ -544,13 +553,6 @@ public:
idTypeDef* GetType( idTypeDef& type, bool allocate );
idTypeDef* FindType( const char* name );
// RB begin
private:
byte* ReserveDefMemory( int size );
idVarDef* AllocVarDef( idTypeDef* type, const char* name, idVarDef* scope );
public:
// RB end
idVarDef* AllocDef( idTypeDef* type, const char* name, idVarDef* scope, bool constant );
idVarDef* GetDef( const idTypeDef* type, const char* name, const idVarDef* scope ) const;
void FreeDef( idVarDef* d, const idVarDef* scope );

View file

@ -892,7 +892,7 @@ void idThread::Error( const char* fmt, ... ) const
char text[ 1024 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
interpreter.Error( text );
@ -909,7 +909,7 @@ void idThread::Warning( const char* fmt, ... ) const
char text[ 1024 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
interpreter.Warning( text );

View file

@ -26,8 +26,9 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
const int BUILD_NUMBER_SAVE_VERSION_BEFORE_SKIP_CINEMATIC = 1400;
const int BUILD_NUMBER_SAVE_VERSION_CHANGE = 1401; // Altering saves so that the version goes in the Details file that we read in during the enumeration phase
const int BUILD_NUMBER_SAVE_VERSION_BEFORE_SKIP_CINEMATIC = 1400;
const int BUILD_NUMBER_SAVE_VERSION_CHANGE = 1401; // Altering saves so that the version goes in the Details file that we read in during the enumeration phase
const int BUILD_NUMBER_SAVE_VERSION_SCRIPT_CHANGES1 = 1402; // RB: Merged script compiler changes from Dhewm3 so functions don't need declarations before used
const int BUILD_NUMBER = BUILD_NUMBER_SAVE_VERSION_CHANGE;
const int BUILD_NUMBER = BUILD_NUMBER_SAVE_VERSION_SCRIPT_CHANGES1;
const int BUILD_NUMBER_MINOR = 0;

View file

@ -63,7 +63,7 @@ struct version_s
{
version_s()
{
sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ );
idStr::snPrintf( string, sizeof( string ), "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ );
}
char string[256];
} version;
@ -920,6 +920,7 @@ void idCommonLocal::RenderBink( const char* path )
materialText.Format( "{ translucent { videoMap %s } }", path );
idMaterial* material = const_cast<idMaterial*>( declManager->FindMaterial( "splashbink" ) );
material->FreeData(); // SRS - always free data before parsing, otherwise leaks occur
material->Parse( materialText.c_str(), materialText.Length(), false );
material->ResetCinematicTime( Sys_Milliseconds() );

View file

@ -164,6 +164,9 @@ void idCommonLocal::StopPlayingRenderDemo()
readDemo->Close();
// SRS - free entity joints allocated by demo playback, otherwise will leak
R_FreeDerivedData();
soundWorld->StopAllSounds();
soundSystem->SetPlayingSoundWorld( menuSoundWorld );
@ -301,7 +304,6 @@ idCommonLocal::TimeRenderDemo
*/
void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit )
{
extern idCVar com_smp;
idStr demo = demoName;
StartPlayingRenderDemo( demo );
@ -310,9 +312,6 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
{
timeDemo = TD_YES; // SRS - Set timeDemo to TD_YES to disable time demo playback pause when window not in focus
bool smp_mode = com_smp.GetBool();
com_smp.SetBool( false ); // SRS - First pass of timedemo is effectively in com_smp == 0 mode, so set this for ImGui timings to be correct
while( readDemo )
{
BusyWait(); // SRS - BusyWait() calls UpdateScreen() which draws and renders out-of-sequence but still supports frame timing
@ -321,8 +320,7 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
// ** End of current logical frame **
// ** Start of next logical frame **
commonLocal.frameTiming.startSyncTime = Sys_Microseconds();
commonLocal.frameTiming.finishSyncTime = commonLocal.frameTiming.startSyncTime;
commonLocal.frameTiming.finishSyncTime = Sys_Microseconds();
commonLocal.frameTiming.startGameTime = commonLocal.frameTiming.finishSyncTime;
AdvanceRenderDemo( true ); // SRS - Advance demo commands to manually run the next game frame during first pass of the timedemo
@ -331,8 +329,6 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
eventLoop->RunEventLoop( false ); // SRS - Run event loop (with no commands) to allow keyboard escape to cancel first pass of the timedemo
}
com_smp.SetBool( smp_mode ); // SRS - Restore original com_smp mode before second pass of timedemo which runs within normal rendering loop
StartPlayingRenderDemo( demo );
}
@ -559,4 +555,4 @@ Common_TimeDemoQuit_f
CONSOLE_COMMAND_SHIP( timeDemoQuit, "times a demo and quits", idCmdSystem::ArgCompletion_DemoName )
{
commonLocal.TimeRenderDemo( va( "demos/%s", args.Argv( 1 ) ), ( args.Argc() > 2 ), true ); // SRS - fixed missing "twice" argument
}
}

View file

@ -380,14 +380,26 @@ public:
// RB end
// SRS start
uint64 GetRendererStartFrameSyncMicroseconds() const
void SetRendererMvkEncodeMicroseconds( uint64 mvkEncodeMicroSeconds )
{
return mainFrameTiming.finishSyncTime - mainFrameTiming.startSyncTime;
metal_encode = mvkEncodeMicroSeconds;
return;
}
uint64 GetRendererEndFrameSyncMicroseconds() const
uint64 GetRendererMvkEncodeMicroseconds() const
{
return mainFrameTiming.finishSyncTime_EndFrame - mainFrameTiming.startRenderTime;
return metal_encode;
}
void SetRendererGpuMemoryMB( int gpuMemoryMB )
{
gpu_memory = gpuMemoryMB;
return;
}
int GetRendererGpuMemoryMB() const
{
return gpu_memory;
}
// SRS end
@ -604,6 +616,11 @@ private:
backEndCounters_t stats_backend;
performanceCounters_t stats_frontend;
// SRS - MoltenVK's Vulkan to Metal command buffer encoding time, set default to 0 for non-macOS platforms (Windows and Linux)
uint64 metal_encode = 0;
// SRS - Cross-platform GPU Memory usage counter, set default to 0 in case platform or graphics API does not support queries
int gpu_memory = 0;
// Used during loading screens
int lastPacifierSessionTime;
int lastPacifierGuiTime;

View file

@ -739,6 +739,65 @@ CONSOLE_COMMAND( convertMapToValve220, "Convert .map file to the Valve 220 map f
common->SetRefreshOnPrint( false );
}
CONSOLE_COMMAND( checkMapsForBrushEntities, "List all brush entities in all .map files", idCmdSystem::ArgCompletion_MapNameNoJson )
{
//int totalImagesCount = 0;
idFileList* files = fileSystem->ListFilesTree( "maps/game", ".map", true, true );
idDict classTypeOverview;
for( int f = 0; f < files->GetList().Num(); f++ )
{
idStr mapName = files->GetList()[ f ];
idMapFile map;
if( map.Parse( mapName, true, false ) )
{
map.ClassifyEntitiesForTrenchBroom( classTypeOverview );
}
}
fileSystem->FreeFileList( files );
int n = classTypeOverview.GetNumKeyVals();
idLib::Printf( "BrushClasses:\n" );
for( int i = 0; i < n; i++ )
{
const idKeyValue* kv = classTypeOverview.GetKeyVal( i );
if( kv->GetValue() == "BrushClass" )
{
idLib::Printf( "'%s'\n", kv->GetKey().c_str() );
}
}
/*
idLib::Printf( "\nPointClasses:\n" );
for( int i = 0; i < n; i++ )
{
const idKeyValue* kv = classTypeOverview.GetKeyVal( i );
if( kv->GetValue() == "PointClass" )
{
idLib::Printf( "'%s'\n", kv->GetKey().c_str() );
}
}
*/
idLib::Printf( "\nMixedClasses:\n" );
for( int i = 0; i < n; i++ )
{
const idKeyValue* kv = classTypeOverview.GetKeyVal( i );
if( kv->GetValue() == "Mixed" )
{
idLib::Printf( "'%s'\n", kv->GetKey().c_str() );
}
}
}
CONSOLE_COMMAND( convertMapQuakeToDoom, "Convert Quake .map in Valve 220 map format for Doom 3 BFG", idCmdSystem::ArgCompletion_MapNameNoJson )
{

View file

@ -125,11 +125,11 @@ void idCommonLocal::VPrintf( const char* fmt, va_list args )
int t = Sys_Milliseconds();
if( com_timestampPrints.GetInteger() == 1 )
{
sprintf( msg, "[%5.2f]", t * 0.001f );
idStr::snPrintf( msg, sizeof( msg ), "[%5.2f]", t * 0.001f );
}
else
{
sprintf( msg, "[%i]", t );
idStr::snPrintf( msg, sizeof( msg ), "[%i]", t );
}
}
timeLength = strlen( msg );

View file

@ -200,6 +200,10 @@ void idConsoleLocal::DrawTextRightAlign( float x, float& y, const char* text, ..
va_start( argptr, text );
int i = idStr::vsnPrintf( string, sizeof( string ), text, argptr );
va_end( argptr );
if( i < 0 )
{
i = sizeof( string ) - 1;
}
renderSystem->DrawSmallStringExt( x - i * SMALLCHAR_WIDTH, y + 2, string, colorWhite, true );
y += SMALLCHAR_HEIGHT + 4;
}
@ -221,8 +225,10 @@ float idConsoleLocal::DrawFPS( float y )
extern idCVar r_swapInterval;
static float previousTimes[FPS_FRAMES];
static float previousCpuUsage[FPS_FRAMES] = {};
static float previousGpuUsage[FPS_FRAMES] = {};
static float previousTimesNormalized[FPS_FRAMES_HISTORY];
static int index;
static int index = 0;
static int previous;
static int valuesOffset = 0;
@ -235,6 +241,8 @@ float idConsoleLocal::DrawFPS( float y )
previous = t;
int fps = 0;
float cpuUsage = 0.0;
float gpuUsage = 0.0;
const float milliSecondsPerFrame = 1000.0f / com_engineHz_latched;
@ -249,6 +257,8 @@ float idConsoleLocal::DrawFPS( float y )
for( int i = 0 ; i < FPS_FRAMES ; i++ )
{
total += previousTimes[i];
cpuUsage += previousCpuUsage[i];
gpuUsage += previousGpuUsage[i];
}
if( !total )
{
@ -256,6 +266,8 @@ float idConsoleLocal::DrawFPS( float y )
}
fps = 1000000 * FPS_FRAMES / total;
fps = ( fps + 500 ) / 1000;
cpuUsage /= FPS_FRAMES;
gpuUsage /= FPS_FRAMES;
const char* s = va( "%ifps", fps );
int w = strlen( s ) * BIGCHAR_WIDTH;
@ -305,12 +317,26 @@ float idConsoleLocal::DrawFPS( float y )
const int64 frameIdleTime = int64( commonLocal.mainFrameTiming.startGameTime ) - int64( commonLocal.mainFrameTiming.finishSyncTime );
const int64 frameBusyTime = int64( commonLocal.frameTiming.finishSyncTime ) - int64( commonLocal.mainFrameTiming.startGameTime );
// SRS - Frame sync time represents swap buffer synchronization + game thread wait + other time spent outside of rendering
const int64 frameSyncTime = int64( commonLocal.frameTiming.finishSyncTime ) - int64( commonLocal.mainFrameTiming.startRenderTime ) - int64( rendererBackEndTime );
// SRS - Frame sync time represents swap buffer synchronization + other frame time spent outside of game thread and renderer backend
const int64 gameThreadWaitTime = int64( commonLocal.mainFrameTiming.finishSyncTime_EndFrame ) - int64( commonLocal.mainFrameTiming.finishRenderTime );
const int64 frameSyncTime = int64( commonLocal.frameTiming.finishSyncTime ) - int64( commonLocal.mainFrameTiming.startRenderTime + rendererBackEndTime ) - gameThreadWaitTime;
// SRS - GPU idle time is simply the difference between measured frame-over-frame time and GPU busy time (directly from GPU timers)
const int64 rendererGPUIdleTime = frameBusyTime + frameIdleTime - rendererGPUTime;
// SRS - Estimate CPU busy time measured from start of game thread until completion of game thread and renderer backend (including excess MoltenVK encoding time if applicable)
#if defined(__APPLE__) && defined( USE_MoltenVK )
const int64 rendererMvkEncodeTime = commonLocal.GetRendererMvkEncodeMicroseconds();
const int64 rendererQueueSubmitTime = int64( commonLocal.mainFrameTiming.finishRenderTime - commonLocal.mainFrameTiming.startRenderTime ) - int64( rendererBackEndTime );
const int64 rendererCPUBusyTime = int64( commonLocal.mainFrameTiming.finishSyncTime_EndFrame - commonLocal.mainFrameTiming.startGameTime ) + Min( Max( int64( 0 ), rendererMvkEncodeTime - rendererQueueSubmitTime - gameThreadWaitTime ), frameSyncTime - rendererQueueSubmitTime );
#else
const int64 rendererCPUBusyTime = int64( commonLocal.mainFrameTiming.finishSyncTime_EndFrame - commonLocal.mainFrameTiming.startGameTime );
#endif
// SRS - Save current CPU and GPU usage factors in ring buffer to calculate smoothed averages for future frames
previousCpuUsage[( index - 1 ) % FPS_FRAMES] = float( rendererCPUBusyTime ) / float( frameBusyTime + frameIdleTime ) * 100.0;
previousGpuUsage[( index - 1 ) % FPS_FRAMES] = float( rendererGPUTime ) / float( rendererGPUTime + rendererGPUIdleTime ) * 100.0;
#if 1
// RB: use ImGui to show more detailed stats about the scene loads
@ -423,7 +449,7 @@ float idConsoleLocal::DrawFPS( float y )
ImGui::TextColored( colorCyan, "API: %s, AA[%i, %i]: %s, %s", API, width, height, aaMode, resolutionText.c_str() );
ImGui::TextColored( colorGold, "Device: %s", deviceManager->GetRendererString() );
ImGui::TextColored( colorGold, "Device: %s, Memory: %i MB", deviceManager->GetRendererString(), commonLocal.GetRendererGpuMemoryMB() );
ImGui::TextColored( colorLtGrey, "GENERAL: views:%i draws:%i tris:%i",
commonLocal.stats_frontend.c_numViews,
@ -473,7 +499,7 @@ float idConsoleLocal::DrawFPS( float y )
if( com_showFPS.GetInteger() > 2 )
{
const char* overlay = va( "Average FPS %i", fps );
const char* overlay = va( "Average FPS %-4i", fps );
ImGui::PlotLines( "Relative\nFrametime ms", previousTimesNormalized, FPS_FRAMES_HISTORY, valuesOffset, overlay, -10.0f, 10.0f, ImVec2( 0, 50 ) );
}
@ -490,12 +516,20 @@ float idConsoleLocal::DrawFPS( float y )
ImGui::TextColored( gameThreadRenderTime > maxTime ? colorRed : colorWhite, "RF: %5llu us SSR: %5llu us", gameThreadRenderTime, rendererGPU_SSRTime );
ImGui::TextColored( rendererBackEndTime > maxTime ? colorRed : colorWhite, "RB: %5llu us Ambient Pass: %5llu us", rendererBackEndTime, rendererGPUAmbientPassTime );
ImGui::TextColored( rendererGPUShadowAtlasTime > maxTime ? colorRed : colorWhite, "Shadows: %5llu us Shadow Atlas: %5llu us", rendererShadowsTime, rendererGPUShadowAtlasTime );
#if defined(__APPLE__) && defined( USE_MoltenVK )
// SRS - For more recent versions of MoltenVK with enhanced performance statistics (v1.2.6 and later), display the Vulkan to Metal encoding thread time on macOS
ImGui::TextColored( rendererMvkEncodeTime > maxTime || rendererGPUInteractionsTime > maxTime ? colorRed : colorWhite, "Encode: %5lld us Interactions: %5llu us", rendererMvkEncodeTime, rendererGPUInteractionsTime );
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, "Sync: %5lld us Shader Pass: %5llu us", frameSyncTime, rendererGPUShaderPassesTime );
#else
ImGui::TextColored( rendererGPUInteractionsTime > maxTime ? colorRed : colorWhite, "Sync: %5lld us Interactions: %5llu us", frameSyncTime, rendererGPUInteractionsTime );
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, " Shader Pass: %5llu us", rendererGPUShaderPassesTime );
#endif
ImGui::TextColored( rendererGPU_TAATime > maxTime ? colorRed : colorWhite, " TAA: %5llu us", rendererGPU_TAATime );
ImGui::TextColored( rendererGPUPostProcessingTime > maxTime ? colorRed : colorWhite, " PostFX: %5llu us", rendererGPUPostProcessingTime );
ImGui::TextColored( frameBusyTime > maxTime || rendererGPUTime > maxTime ? colorRed : colorWhite, "Total: %5lld us Total: %5lld us", frameBusyTime, rendererGPUTime );
ImGui::TextColored( colorWhite, "Idle: %5lld us Idle: %5lld us", frameIdleTime, rendererGPUIdleTime );
// SRS - Show CPU and GPU overall usage statistics
//ImGui::TextColored( colorWhite, "Usage: %3.0f %% Usage: %3.0f %%", cpuUsage, gpuUsage );
ImGui::End();
}

View file

@ -250,7 +250,7 @@ const char* idAFVector::ToString( idStr& str, const int precision )
case idAFVector::VEC_COORDS:
{
char format[128];
sprintf( format, "( %%.%df, %%.%df, %%.%df )", precision, precision, precision );
idStr::snPrintf( format, sizeof( format ), "( %%.%df, %%.%df, %%.%df )", precision, precision, precision );
sprintf( str, format, vec.x, vec.y, vec.z );
break;
}

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2015-2022 Robert Beckebans
Copyright (C) 2015-2023 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -265,8 +265,9 @@ private:
static void ReloadDecls_f( const idCmdArgs& args );
static void TouchDecl_f( const idCmdArgs& args );
// RB begin
static void ExportDeclsToBlender_f( const idCmdArgs& args );
static void ExportDeclsToTrenchBroom_f( const idCmdArgs& args );
static void ExportEntityDefsToBlender_f( const idCmdArgs& args );
static void ExportMaterialsToBlender_f( const idCmdArgs& args );
static void ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args );
static void ExportModelsToTrenchBroom_f( const idCmdArgs& args );
static void ExportImagesToTrenchBroom_f( const idCmdArgs& args );
@ -966,8 +967,9 @@ void idDeclManagerLocal::Init()
cmdSystem->AddCommand( "convertPDAsToStrings", ConvertPDAsToStrings_f, CMD_FL_SYSTEM, "Converts *.pda files to text which can be plugged into *.lang files." );
// RB begin
cmdSystem->AddCommand( "exportEntityDefsToBlender", ExportDeclsToBlender_f, CMD_FL_SYSTEM, "exports all entity and model defs to exported/entities.json" );
cmdSystem->AddCommand( "exportFGD", ExportDeclsToTrenchBroom_f, CMD_FL_SYSTEM, "exports all entity and model defs to _tb/fgd/DOOM-3-*.fgd" );
cmdSystem->AddCommand( "exportEntitiesToBlender", ExportEntityDefsToBlender_f, CMD_FL_SYSTEM, "exports all entity and model defs to _bl/entities.json" );
cmdSystem->AddCommand( "exportMaterialsToBlender", ExportMaterialsToBlender_f, CMD_FL_SYSTEM, "exports all materials to _bl/entities.json" );
cmdSystem->AddCommand( "exportFGD", ExportEntityDefsToTrenchBroom_f, CMD_FL_SYSTEM, "exports all entity and model defs to _tb/fgd/DOOM-3-*.fgd" );
cmdSystem->AddCommand( "exportModelsToTrenchBroom", ExportModelsToTrenchBroom_f, CMD_FL_SYSTEM, "exports all generated models like blwo, base .. to _tb/*.obj" );
cmdSystem->AddCommand( "exportImagesToTrenchBroom", ExportImagesToTrenchBroom_f, CMD_FL_SYSTEM, "exports all generated bimages to _tb/*.png" );
@ -1303,15 +1305,14 @@ const idDecl* idDeclManagerLocal::FindType( declType_t type, const char* name, b
}
#endif
decl->ParseLocal();
// SRS - set non-purgeable flag only after ParseLocal(), don't reset if declState is parsed or defaulted
decl->parsedOutsideLevelLoad = !insideLevelLoad;
}
// mark it as referenced
decl->referencedThisLevel = true;
decl->everReferenced = true;
if( insideLevelLoad )
{
decl->parsedOutsideLevelLoad = false;
}
return decl->self;
}
@ -1451,7 +1452,11 @@ void idDeclManagerLocal::ListType( const idCmdArgs& args, declType_t type )
continue;
}
if( decl->referencedThisLevel )
if( decl->parsedOutsideLevelLoad )
{
common->Printf( "!" );
}
else if( decl->referencedThisLevel )
{
common->Printf( "*" );
}
@ -1757,7 +1762,7 @@ void idDeclManagerLocal::WritePrecacheCommands( idFile* f )
}
char str[1024];
sprintf( str, "touch %s %s\n", declTypes[i]->typeName.c_str(), decl->GetName() );
idStr::snPrintf( str, sizeof( str ), "touch %s %s\n", declTypes[i]->typeName.c_str(), decl->GetName() );
common->Printf( "%s", str );
f->Printf( "%s", str );
}
@ -1973,7 +1978,7 @@ void idDeclManagerLocal::TouchDecl_f( const idCmdArgs& args )
}
// RB begin
void idDeclManagerLocal::ExportDeclsToBlender_f( const idCmdArgs& args )
void idDeclManagerLocal::ExportEntityDefsToBlender_f( const idCmdArgs& args )
{
idStr jsonStringsFileName = "_bl/entities.json";
idFileLocal file( fileSystem->OpenFileWrite( jsonStringsFileName, "fs_basepath" ) );
@ -2024,6 +2029,58 @@ void idDeclManagerLocal::ExportDeclsToBlender_f( const idCmdArgs& args )
idLib::Printf( "Wrote %d Models.\n", totalModelsCount );
}
void idDeclManagerLocal::ExportMaterialsToBlender_f( const idCmdArgs& args )
{
idStr jsonStringsFileName = "_bl/materials.json";
idFileLocal file( fileSystem->OpenFileWrite( jsonStringsFileName, "fs_basepath" ) );
if( file == NULL )
{
idLib::Printf( "Failed to entity declarations data to JSON.\n" );
}
int totalMaterialsCount = 0;
// avoid media cache
com_editors |= EDITOR_EXPORTDEFS;
file->Printf( "{\n\t\"materials\": {" );
int count = declManagerLocal.linearLists[ DECL_MATERIAL ].Num();
CommandlineProgressBar progressBar( count, renderSystem->GetWidth(), renderSystem->GetHeight() );
progressBar.Start();
for( int i = 0; i < count; i++ )
{
const idMaterial* material = static_cast< const idMaterial* >( declManagerLocal.FindType( DECL_MATERIAL, declManagerLocal.linearLists[ DECL_MATERIAL ][ i ]->GetName(), false ) );
#if 0
const char* matName = material->GetName();
if( idStr::FindText( matName, "textures/base_floor/ghotile3", false ) != -1 )
{
totalMaterialsCount++;
}
#endif
material->ExportJSON( file, i == ( count - 1 ) );
totalMaterialsCount++;
progressBar.Increment( true );
}
file->Printf( "\t}\n" );
file->Printf( "}\n" );
file->Flush();
com_editors &= ~EDITOR_EXPORTDEFS;
idLib::Printf( "\nData written to %s\n", jsonStringsFileName.c_str() );
idLib::Printf( "----------------------------\n" );
idLib::Printf( "Wrote %d Materials.\n", totalMaterialsCount );
}
class idSort_CompareEntityDefEntity : public idSort_Quick< const idDeclEntityDef*, idSort_CompareEntityDefEntity >
{
public:
@ -2077,7 +2134,7 @@ struct LocalEvar_t
#include <d3xp/anim/Anim.h> // idDeclModelDef
void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
void idDeclManagerLocal::ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args )
{
extern idCVar postLoadExportModels;
@ -2171,21 +2228,33 @@ void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
idStrList solidClassNames;
solidClassNames.AddUnique( "worldspawn" );
solidClassNames.AddUnique( "func_aas_obstacle" );
solidClassNames.AddUnique( "func_aas_portal" );
solidClassNames.AddUnique( "func_clipmodel" );
solidClassNames.AddUnique( "func_damagable" );
solidClassNames.AddUnique( "func_forcefield" );
solidClassNames.AddUnique( "func_fracture" );
solidClassNames.AddUnique( "func_liquid" );
solidClassNames.AddUnique( "func_plat" );
solidClassNames.AddUnique( "func_rotating" );
solidClassNames.AddUnique( "func_splinemover" );
solidClassNames.AddUnique( "func_static" );
solidClassNames.AddUnique( "func_mover" );
solidClassNames.AddUnique( "func_door" );
solidClassNames.AddUnique( "moveable_base" );
solidClassNames.AddUnique( "func_pendulum" );
solidClassNames.AddUnique( "func_plat" );
solidClassNames.AddUnique( "moveable_base_brick" );
solidClassNames.AddUnique( "moveable_guardian_brick" );
solidClassNames.AddUnique( "trigger_" );
// mixed classes that need extra _model pendants
solidClassNames.AddUnique( "func_door" );
solidClassNames.AddUnique( "func_bobbing" );
solidClassNames.AddUnique( "func_mover" );
solidClassNames.AddUnique( "func_rotating" );
solidClassNames.AddUnique( "func_elevator" );
solidClassNames.AddUnique( "func_static" ); // misc_model
for( int f = 0; f < filenames.Num(); f++ )
{
int totalEntitiesCount = 0;
@ -2461,7 +2530,9 @@ void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
if( idStr::Icmp( decl->GetName(), "light" ) == 0 ||
idStr::Icmp( decl->GetName(), "misc_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_bobbing_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_door_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_mover_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_mover_amodel" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_plat_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_rotating_model" ) == 0 )
@ -2550,7 +2621,10 @@ void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
if( idStr::Icmp( decl->GetName(), "light" ) != 0 &&
idStr::Icmp( decl->GetName(), "misc_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_bobbing_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_door_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_elevator_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_mover_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_mover_amodel" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_plat_model" ) != 0 &&
idStr::Icmp( decl->GetName(), "func_rotating_model" ) != 0 )
@ -2595,7 +2669,10 @@ void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
file->Printf( "model({ \"path\": \"%s\" }) ", exportedModelFileName.c_str() );
}
else if( idStr::Icmp( decl->GetName(), "misc_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_bobbing_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_door_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_elevator_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_mover_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_mover_amodel" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_plat_model" ) == 0 ||
idStr::Icmp( decl->GetName(), "func_rotating_model" ) == 0 )
@ -2606,7 +2683,9 @@ void idDeclManagerLocal::ExportDeclsToTrenchBroom_f( const idCmdArgs& args )
else if( idStr::Icmp( decl->GetName(), "light" ) == 0 )
{
// default light sprite for TB editor sprites branch
file->Printf( "model({ \"path\": \"sprites/light-bulb.png\", \"scale\": 0.03125 }) " );
//file->Printf( "model({ \"path\": \"sprites/light-bulb.png\", \"scale\": 0.03125 }) " );
file->Printf( "model({{\n\tproxymodel -> { \"path\": proxymodel },\n\t{ \"path\": \"sprites/light-bulb.png\", \"scale\": 0.03125 }\n}})" );
}
else if( idStr::Icmp( decl->GetName(), "speaker" ) == 0 )
{
@ -3095,7 +3174,7 @@ void idDeclManagerLocal::ExportModelsToTrenchBroom_f( const idCmdArgs& args )
// make an OBJ version of the model for TrenchBroom
idRenderModel* renderModel = renderModelManager->FindModel( modelName );
#if 1
#if 0
if( idStr::Icmpn( modelName, "models/mapobjects", 17 ) != 0 )
{
continue;
@ -4056,7 +4135,8 @@ idDeclLocal* idDeclManagerLocal::FindTypeWithoutParsing( declType_t type, const
decl->sourceFile = &implicitDecls;
decl->referencedThisLevel = false;
decl->everReferenced = false;
decl->parsedOutsideLevelLoad = !insideLevelLoad;
// SRS - initialize to false, otherwise all decls will be set to non-purgeable during Init()
decl->parsedOutsideLevelLoad = false; // !insideLevelLoad;
// add it to the linear list and hash table
decl->index = linearLists[typeIndex].Num();

View file

@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
FS_WriteFloatString
=================
*/
int FS_WriteFloatString( char* buf, const char* fmt, va_list argPtr )
int FS_WriteFloatString( char* buf, int bufsize, const char* fmt, va_list argPtr )
{
// DG: replaced long with int for 64bit compatibility in the whole function
int i;
@ -77,44 +77,44 @@ int FS_WriteFloatString( char* buf, const char* fmt, va_list argPtr )
sprintf( tmp, "%1.10f", f );
tmp.StripTrailing( '0' );
tmp.StripTrailing( '.' );
index += sprintf( buf + index, "%s", tmp.c_str() );
index += idStr::snPrintf( buf + index, bufsize - index, "%s", tmp.c_str() );
}
else
{
index += sprintf( buf + index, format.c_str(), f );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), f );
}
break;
case 'd':
case 'i':
i = va_arg( argPtr, int );
index += sprintf( buf + index, format.c_str(), i );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), i );
break;
case 'u':
u = va_arg( argPtr, unsigned int );
index += sprintf( buf + index, format.c_str(), u );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), u );
break;
case 'o':
u = va_arg( argPtr, unsigned int );
index += sprintf( buf + index, format.c_str(), u );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), u );
break;
case 'x':
u = va_arg( argPtr, unsigned int );
index += sprintf( buf + index, format.c_str(), u );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), u );
break;
case 'X':
u = va_arg( argPtr, unsigned int );
index += sprintf( buf + index, format.c_str(), u );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), u );
break;
case 'c':
i = va_arg( argPtr, int );
index += sprintf( buf + index, format.c_str(), ( char ) i );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), ( char ) i );
break;
case 's':
str = va_arg( argPtr, char* );
index += sprintf( buf + index, format.c_str(), str );
index += idStr::snPrintf( buf + index, bufsize - index, format.c_str(), str );
break;
case '%':
index += sprintf( buf + index, "%s", format.c_str() );
index += idStr::snPrintf( buf + index, bufsize - index, "%s", format.c_str() );
break;
default:
common->Error( "FS_WriteFloatString: invalid format %s", format.c_str() );
@ -127,16 +127,16 @@ int FS_WriteFloatString( char* buf, const char* fmt, va_list argPtr )
switch( *fmt )
{
case 't':
index += sprintf( buf + index, "\t" );
index += idStr::snPrintf( buf + index, bufsize - index, "\t" );
break;
case 'v':
index += sprintf( buf + index, "\v" );
index += idStr::snPrintf( buf + index, bufsize - index, "\v" );
break;
case 'n':
index += sprintf( buf + index, "\n" );
index += idStr::snPrintf( buf + index, bufsize - index, "\n" );
break;
case '\\':
index += sprintf( buf + index, "\\" );
index += idStr::snPrintf( buf + index, bufsize - index, "\\" );
break;
default:
common->Error( "FS_WriteFloatString: unknown escape character \'%c\'", *fmt );
@ -145,7 +145,7 @@ int FS_WriteFloatString( char* buf, const char* fmt, va_list argPtr )
fmt++;
break;
default:
index += sprintf( buf + index, "%c", *fmt );
index += idStr::snPrintf( buf + index, bufsize - index, "%c", *fmt );
fmt++;
break;
}
@ -285,7 +285,7 @@ int idFile::Printf( const char* fmt, ... )
va_list argptr;
va_start( argptr, fmt );
length = idStr::vsnPrintf( buf, MAX_PRINT_MSG - 1, fmt, argptr );
length = idStr::vsnPrintf( buf, sizeof( buf ), fmt, argptr );
va_end( argptr );
// so notepad formats the lines correctly
@ -305,7 +305,11 @@ int idFile::VPrintf( const char* fmt, va_list args )
char buf[MAX_PRINT_MSG];
int length;
length = idStr::vsnPrintf( buf, MAX_PRINT_MSG - 1, fmt, args );
length = idStr::vsnPrintf( buf, sizeof( buf ), fmt, args );
if( length < 0 )
{
length = sizeof( buf ) - 1;
}
return Write( buf, length );
}
@ -321,7 +325,7 @@ int idFile::WriteFloatString( const char* fmt, ... )
va_list argPtr;
va_start( argPtr, fmt );
len = FS_WriteFloatString( buf, fmt, argPtr );
len = FS_WriteFloatString( buf, sizeof( buf ), fmt, argPtr );
va_end( argPtr );
return Write( buf, len );

View file

@ -2881,6 +2881,7 @@ int idFileSystemLocal::AddResourceFile( const char* resourceFileName )
common->Printf( "Loaded resource file %s\n", resourceFile.c_str() );
return resourceFiles.Num() - 1;
}
delete rc;
return -1;
}

View file

@ -71,8 +71,6 @@ class idSGFcompressThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFcompressThread" );
sgf->CompressBlock();
return 0;
}
@ -83,8 +81,6 @@ class idSGFdecompressThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFdecompressThread" );
sgf->DecompressBlock();
return 0;
}
@ -95,8 +91,6 @@ class idSGFwriteThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFwriteThread" );
sgf->WriteBlock();
return 0;
}
@ -107,8 +101,6 @@ class idSGFreadThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFreadThread" );
sgf->ReadBlock();
return 0;
}

View file

@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms
// RB: changed home folder so we don't break the savegame of the original game
#define SAVE_PATH "\\id Software\\RBDOOM 3 BFG"
#define ENGINE_VERSION "RBDOOM 3 BFG 1.5.1" // printed in console
#define ENGINE_VERSION "RBDOOM 3 BFG 1.6.0 preview" // printed in console
// RB end
// jmarshall

View file

@ -252,7 +252,7 @@ void idTokenParser::Error( VERIFY_FORMAT_STRING const char* str, ... )
va_list ap;
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
idLib::common->Warning( text );
@ -263,7 +263,7 @@ void idTokenParser::Warning( VERIFY_FORMAT_STRING const char* str, ... )
va_list ap;
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
idLib::common->Warning( text );

View file

@ -90,8 +90,6 @@ be called directly in the foreground thread for comparison.
*/
int idGameThread::Run()
{
OPTICK_THREAD( "idGameThread" );
commonLocal.frameTiming.startGameTime = Sys_Microseconds();
// debugging tool to test frame dropping behavior
@ -390,6 +388,9 @@ void idCommonLocal::Draw()
{
SCOPED_PROFILE_EVENT( "Post-Draw" );
// draw Imgui before the console
ImGuiHook::Render();
// draw the wipe material on top of this if it hasn't completed yet
DrawWipeModel();
@ -397,6 +398,8 @@ void idCommonLocal::Draw()
// draw the half console / notify console on top of everything
console->Draw( false );
renderSystem->DrawCRTPostFX();
}
}
@ -437,10 +440,10 @@ void idCommonLocal::UpdateScreen( bool captureToImage, bool releaseMouse )
}
// this should exit right after vsync, with the GPU idle and ready to draw
frameTiming.startRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu, &stats_backend, &stats_frontend );
// get the GPU busy with new commands
frameTiming.startRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
renderSystem->RenderCommandBuffers( cmd );
frameTiming.finishRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
@ -879,13 +882,13 @@ void idCommonLocal::Frame()
}
frameTiming.finishRenderTime = Sys_Microseconds();
// SRS - Use finishSyncTime_EndFrame to record timing just before gameThread.WaitForThread() for com_smp = 1
frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
// make sure the game / draw thread has completed
// This may block if the game is taking longer than the render back end
gameThread.WaitForThread();
// SRS - Use finishSyncTime_EndFrame to record timing just after gameThread.WaitForThread()
frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
// Send local usermds to the server.
// This happens after the game frame has run so that prediction data is up to date.
SendUsercmds( Game()->GetLocalClientNum() );

View file

@ -130,6 +130,11 @@ else()
SEPARATE_ARGUMENTS(_compiler_FLAGS)
if (USE_PRECOMPILED_HEADERS)
if(OPTICK)
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
else()
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
endif()
add_custom_target(precomp_header_idlib ALL
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header precompiled.h -o precompiled.h.gch
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -644,6 +644,22 @@ void idDict::Delete( const char* key )
#endif
}
// RB
void idDict::DeleteEmptyKeys()
{
idList<idKeyValue> orig = args;
for( int i = 0; i < orig.Num(); i++ )
{
const idKeyValue& kv = orig[ i ];
if( kv.GetValue().Length() == 0 )
{
Delete( kv.GetKey() );
}
}
}
/*
================
idDict::MatchPrefix

View file

@ -104,20 +104,28 @@ public:
// set the granularity for the index
void SetGranularity( int granularity );
// set hash size
void SetHashSize( int hashSize );
// clear existing key/value pairs and copy all key/value pairs from other
idDict& operator=( const idDict& other );
// copy from other while leaving existing key/value pairs in place
void Copy( const idDict& other );
// clear existing key/value pairs and transfer key/value pairs from other
void TransferKeyValues( idDict& other );
// parse dict from parser
bool Parse( idParser& parser );
// copy key/value pairs from other dict not present in this dict
void SetDefaults( const idDict* dict );
// clear dict freeing up memory
void Clear();
// print the dict
void Print() const;
@ -167,17 +175,25 @@ public:
int GetNumKeyVals() const;
const idKeyValue* GetKeyVal( int index ) const;
// returns the key/value pair with the given key
// returns NULL if the key/value pair does not exist
const idKeyValue* FindKey( const char* key ) const;
// returns the index to the key/value pair with the given key
// returns -1 if the key/value pair does not exist
int FindKeyIndex( const char* key ) const;
// delete the key/value pair with the given key
void Delete( const char* key );
// RB: delete all keys with a "" value
void DeleteEmptyKeys();
// finds the next key/value pair with the given key prefix.
// lastMatch can be used to do additional searches past the first match.
const idKeyValue* MatchPrefix( const char* prefix, const idKeyValue* lastMatch = NULL ) const;
// randomly chooses one of the key/value pairs with the given key prefix and returns it's value
const char* RandomPrefix( const char* prefix, idRandom& random ) const;

View file

@ -67,6 +67,10 @@ void* Mem_ClearedAlloc( const size_t size, const memTag_t tag );
char* Mem_CopyString( const char* in );
// RB end
#ifdef _MSC_VER // SRS: #pragma warning is MSVC specific
#pragma warning( push )
#pragma warning( disable : 4595 ) // C4595: non-member operator new or delete functions may not be declared inline
#endif
ID_INLINE void* operator new( size_t s )
{
return Mem_Alloc( s, TAG_NEW );
@ -87,6 +91,9 @@ ID_INLINE void operator delete[]( void* p ) noexcept
{
Mem_Free( p );
}
#ifdef _MSC_VER
#pragma warning( pop )
#endif
ID_INLINE void* operator new( size_t s, memTag_t tag )
{

View file

@ -247,7 +247,7 @@ void idLexer::Error( const char* str, ... )
}
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
if( idLexer::flags & LEXFL_NOFATALERRORS )
@ -276,7 +276,7 @@ void idLexer::Warning( const char* str, ... )
}
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
idLib::common->Warning( "file %s, line %d: %s", idLexer::filename.c_str(), idLexer::line, text );
}

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2015-2022 Robert Beckebans
Copyright (C) 2015-2023 Robert Beckebans
Copyright (C) 2020 Admer (id Tech Fox)
Copyright (C) 2022 Harrie van Ginneken
@ -943,6 +943,8 @@ bool idMapBrush::WriteValve220( idFile* fp, int primitiveNum, const idVec3& orig
return true;
}
/*
===============
idMapBrush::GetGeometryCRC
@ -1151,7 +1153,11 @@ bool idMapEntity::Write( idFile* fp, int entityNum, bool valve220 ) const
fp->WriteFloatString( "\"%s\" \"%s\"\n", epairs.GetKeyVal( i )->GetKey().c_str(), epairs.GetKeyVal( i )->GetValue().c_str() );
}
epairs.GetVector( "origin", "0 0 0", origin );
// RB: the "origin" key might have been replaced by the origin brush
if( !epairs.GetVector( "origin", "0 0 0", origin ) )
{
origin += originOffset;
}
// write pritimives
for( i = 0; i < GetNumPrimitives(); i++ )
@ -2777,7 +2783,7 @@ void MapPolygonMesh::SetContents()
unsigned int MapPolygonMesh::GetGeometryCRC() const
{
unsigned int i;
int i;
unsigned int crc = 0;
for( i = 0; i < verts.Num(); i++ )
{
@ -2967,24 +2973,30 @@ bool idMapFile::ConvertToValve220Format()
ent->epairs.Set( "proxymodel", model );
}
#endif
bool isBrushModel = ( ent->GetNumPrimitives() > 0 ) && ( idStr::Icmp( model.c_str(), name.c_str() ) == 0 );
// is this oldschool brushes & patches?
if( ent->GetNumPrimitives() > 0 )
if( isBrushModel )
{
#if 1
bool removedOrigin = false;
if( !transform.IsIdentity() &&
idStr::Icmp( classname, "func_static" ) != 0 &&
//idStr::Icmp( classname, "func_static" ) != 0 &&
idStr::Icmp( classname, "light" ) != 0 )
{
ent->epairs.Delete( "origin" );
ent->epairs.Delete( "rotation" );
ent->epairs.Delete( "angles" );
ent->epairs.Delete( "angle" );
}
#endif
if( idStr::Icmp( classname, "func_static" ) == 0 && idStr::Icmp( model.c_str(), classname.c_str() ) == 0 )
removedOrigin = true;
}
// purge flare patches from lights because we can't select lights in TrenchBroom
// that still have primitives
if( idStr::Icmp( classname, "light" ) == 0 )
{
ent->epairs.Delete( "model" );
ent->RemovePrimitiveData();
}
// convert brushes
@ -3009,6 +3021,16 @@ bool idMapFile::ConvertToValve220Format()
}
}
// add origin brush as a replacement for the removed "origin" key
if( removedOrigin && ( origin != vec3_origin ) )
{
idMapBrush* originBrush = idMapBrush::MakeOriginBrush( origin, vec3_one );
ent->AddPrimitive( originBrush );
//ent->CalculateBrushOrigin();
ent->originOffset = origin;
}
// collect some statistics
const idKeyValue* kv = classTypeOverview.FindKey( classname );
@ -3033,10 +3055,18 @@ bool idMapFile::ConvertToValve220Format()
{
ent->epairs.Set( "classname", "misc_model" );
}
else if( idStr::Icmp( classname, "func_bobbing" ) == 0 && idStr::Icmp( model.c_str(), classname.c_str() ) != 0 )
{
ent->epairs.Set( "classname", "func_bobbing_model" );
}
else if( idStr::Icmp( classname, "func_door" ) == 0 && idStr::Icmp( model.c_str(), classname.c_str() ) != 0 )
{
ent->epairs.Set( "classname", "func_door_model" );
}
else if( idStr::Icmp( classname, "func_elevator" ) == 0 && idStr::Icmp( model.c_str(), classname.c_str() ) != 0 )
{
ent->epairs.Set( "classname", "func_elevator_model" );
}
else if( idStr::Icmp( classname, "func_mover" ) == 0 && idStr::Icmp( model.c_str(), classname.c_str() ) != 0 )
{
ent->epairs.Set( "classname", "func_mover_amodel" );
@ -3059,17 +3089,6 @@ bool idMapFile::ConvertToValve220Format()
ent->epairs.SetAngles( "angles", angles );
}
// TODO use angles instead of angle
#if 0
if( ent->epairs.FindKey( "angle" ) )
{
ent->epairs.Delete( "angle" );
idAngles angles = rot.ToAngles();
ent->epairs.SetAngles( "angles", angles );
}
#endif
const idKeyValue* kv = classTypeOverview.FindKey( classname );
if( kv && kv->GetValue().Length() )
{
@ -3144,6 +3163,57 @@ bool idMapFile::ConvertToValve220Format()
return true;
}
void idMapFile::ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview )
{
int count = GetNumEntities();
for( int j = 0; j < count; j++ )
{
idMapEntity* ent = GetEntity( j );
if( ent )
{
idStr classname = ent->epairs.GetString( "classname" );
idStr name = ent->epairs.GetString( "name" );
const idKeyValue* modelPair = ent->epairs.FindKey( "model" );
idStr model = ent->epairs.GetString( "model" );
bool isBrushModel = ( ent->GetNumPrimitives() > 0 ) && ( idStr::Icmp( model.c_str(), name.c_str() ) == 0 );
// is this oldschool brushes & patches?
if( isBrushModel )
{
const idKeyValue* kv = classTypeOverview.FindKey( classname );
if( kv && kv->GetValue().Length() )
{
if( idStr::Icmp( kv->GetValue().c_str(), "PointClass" ) == 0 && idStr::Icmp( kv->GetValue().c_str(), "Mixed" ) != 0 )
{
classTypeOverview.Set( classname, "Mixed" );
}
}
else
{
classTypeOverview.Set( classname, "BrushClass" );
}
}
else
{
const idKeyValue* kv = classTypeOverview.FindKey( classname );
if( kv && kv->GetValue().Length() )
{
if( idStr::Icmp( kv->GetValue().c_str(), "BrushClass" ) == 0 && idStr::Icmp( kv->GetValue().c_str(), "Mixed" ) != 0 )
{
classTypeOverview.Set( classname, "Mixed" );
}
}
else
{
classTypeOverview.Set( classname, "PointClass" );
}
}
}
}
}
bool idMapFile::ConvertQuakeToDoom()
{
idDict classTypeOverview;
@ -3226,8 +3296,11 @@ bool idMapFile::ConvertQuakeToDoom()
if( ent->GetNumPrimitives() > 0 )
{
const idKeyValue* namePair = ent->epairs.FindKey( "name" );
ent->epairs.Set( "model", namePair->GetValue() );
if( j > 0 )
{
const idKeyValue* namePair = ent->epairs.FindKey( "name" );
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++ )
@ -3311,4 +3384,64 @@ void idMapFile::WadTextureToMaterial( const char* material, idStr& matName )
}
/*
============
RB idMapBrush::MakeOriginBrush
moved it here so Astyle won't mess up this file
============
*/
idMapBrush* idMapBrush::MakeOriginBrush( const idVec3& origin, const idVec3& scale )
{
/*
TrenchBroom
// brush 0
{
( -1 -64 -16 ) ( -1 -63 -16 ) ( -1 -64 -15 ) rock/lfwall15_lanrock1 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( -64 -1 -16 ) ( -64 -1 -15 ) ( -63 -1 -16 ) rock/lfwall15_lanrock1 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( -64 -64 -1 ) ( -63 -64 -1 ) ( -64 -63 -1 ) rock/lfwall15_lanrock1 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 0.5 0.5
( 64 64 1 ) ( 64 65 1 ) ( 65 64 1 ) rock/lfwall15_lanrock1 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 0.5 0.5
( 64 1 16 ) ( 65 1 16 ) ( 64 1 17 ) rock/lfwall15_lanrock1 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( 1 64 16 ) ( 1 64 17 ) ( 1 65 16 ) rock/lfwall15_lanrock1 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
}
*/
const char* tbUnitBrush = R"(
( -1 -64 -16 ) ( -1 -63 -16 ) ( -1 -64 -15 ) common/origin [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( -64 -1 -16 ) ( -64 -1 -15 ) ( -63 -1 -16 ) common/origin [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( -64 -64 -1 ) ( -63 -64 -1 ) ( -64 -63 -1 ) common/origin [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 0.5 0.5
( 64 64 1 ) ( 64 65 1 ) ( 65 64 1 ) common/origin [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 0.5 0.5
( 64 1 16 ) ( 65 1 16 ) ( 64 1 17 ) common/origin [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
( 1 64 16 ) ( 1 64 17 ) ( 1 65 16 ) common/origin [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 0.5 0.5
}
}
)";
idLexer src( LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS | LEXFL_ALLOWPATHNAMES );
src.LoadMemory( tbUnitBrush, strlen( tbUnitBrush), "Origin Brush" );
idMapBrush* brush = idMapBrush::ParseValve220( src, origin );
idMat3 axis;
axis.Identity();
axis[0][0] = scale.x;
axis[1][1] = scale.y;
axis[2][2] = scale.z;
idMat4 transform( axis, origin );
for( int i = 0; i < brush->GetNumSides(); i++ )
{
auto side = brush->GetSide( i );
side->planepts[0] *= transform;
side->planepts[1] *= transform;
side->planepts[2] *= transform;
}
return brush;
}
// RB end

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2015-2021 Robert Beckebans
Copyright (C) 2015-2023 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -187,6 +187,11 @@ public:
static idMapBrush* ParseValve220( idLexer& src, const idVec3& origin ); // RB
bool Write( idFile* fp, int primitiveNum, const idVec3& origin ) const;
bool WriteValve220( idFile* fp, int primitiveNum, const idVec3& origin ) const; // RB
// returns an origin brush with the size of (2, 2, 2) by default
// so we can center the brush on a grid size of 1 in TrenchBroom
static idMapBrush* MakeOriginBrush( const idVec3& origin, const idVec3& scale = vec3_one );
int GetNumSides() const
{
return sides.Num();
@ -499,6 +504,8 @@ public:
bool ConvertToPolygonMeshFormat();
bool ConvertToValve220Format();
void ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview );
// converts Wad texture names to valid Doom 3 materials and gives every entity a unique name
bool ConvertQuakeToDoom();
// RB end

View file

@ -1145,8 +1145,6 @@ idJobThread::Run
*/
int idJobThread::Run()
{
OPTICK_THREAD( GetName() );
threadJobListState_t threadJobListState[MAX_JOBLISTS];
int numJobLists = 0;
int lastStalledJobList = -1;

View file

@ -367,7 +367,7 @@ void idParser::Error( const char* str, ... ) const
va_list ap;
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
if( idParser::scriptstack )
{
@ -386,7 +386,7 @@ void idParser::Warning( const char* str, ... ) const
va_list ap;
va_start( ap, str );
vsprintf( text, str, ap );
idStr::vsnPrintf( text, sizeof( text ), str, ap );
va_end( ap );
if( idParser::scriptstack )
{
@ -836,7 +836,7 @@ int idParser::ExpandBuiltinDefine( idToken* deftoken, define_t* define, idToken*
{
case BUILTIN_LINE:
{
sprintf( buf, "%d", deftoken->line );
idStr::snPrintf( buf, sizeof( buf ), "%d", deftoken->line );
( *token ) = buf;
token->intvalue = deftoken->line;
token->floatvalue = deftoken->line;
@ -2680,7 +2680,7 @@ int idParser::Directive_eval()
token.whiteSpaceEnd_p = NULL;
token.linesCrossed = 0;
token.flags = 0;
sprintf( buf, "%d", abs( value ) );
idStr::snPrintf( buf, sizeof( buf ), "%d", abs( value ) );
token = buf;
token.type = TT_NUMBER;
token.subtype = TT_INTEGER | TT_LONG | TT_DECIMAL;
@ -2713,7 +2713,7 @@ int idParser::Directive_evalfloat()
token.whiteSpaceEnd_p = NULL;
token.linesCrossed = 0;
token.flags = 0;
sprintf( buf, "%1.2f", idMath::Fabs( value ) );
idStr::snPrintf( buf, sizeof( buf ), "%1.2f", idMath::Fabs( value ) );
token = buf;
token.type = TT_NUMBER;
token.subtype = TT_FLOAT | TT_LONG | TT_DECIMAL;
@ -2850,7 +2850,7 @@ int idParser::DollarDirective_evalint()
token.whiteSpaceEnd_p = NULL;
token.linesCrossed = 0;
token.flags = 0;
sprintf( buf, "%d", abs( value ) );
idStr::snPrintf( buf, sizeof( buf ), "%d", abs( value ) );
token = buf;
token.type = TT_NUMBER;
token.subtype = TT_INTEGER | TT_LONG | TT_DECIMAL | TT_VALUESVALID;
@ -2885,7 +2885,7 @@ int idParser::DollarDirective_evalfloat()
token.whiteSpaceEnd_p = NULL;
token.linesCrossed = 0;
token.flags = 0;
sprintf( buf, "%1.2f", fabs( value ) );
idStr::snPrintf( buf, sizeof( buf ), "%1.2f", fabs( value ) );
token = buf;
token.type = TT_NUMBER;
token.subtype = TT_FLOAT | TT_LONG | TT_DECIMAL | TT_VALUESVALID;

View file

@ -734,11 +734,11 @@ void idStr::Format( const char* fmt, ... )
char text[MAX_PRINT_MSG];
va_start( argptr, fmt );
int len = idStr::vsnPrintf( text, sizeof( text ) - 1, fmt, argptr );
// SRS - using idStr::vsnPrintf() guarantees size and null termination
int len = idStr::vsnPrintf( text, sizeof( text ), fmt, argptr );
va_end( argptr );
text[ sizeof( text ) - 1 ] = '\0';
if( ( size_t )len >= sizeof( text ) - 1 )
if( len < 0 )
{
idLib::common->FatalError( "Tried to set a large buffer using %s", fmt );
}
@ -1917,7 +1917,8 @@ void idStr::Copynz( char* dest, const char* src, int destsize )
return;
}
strncpy( dest, src, destsize - 1 );
// SRS - added size_t cast for 64-bit type consistency
strncpy( dest, src, ( size_t )destsize - 1 );
dest[destsize - 1] = 0;
}
@ -2247,21 +2248,16 @@ int idStr::snPrintf( char* dest, int size, const char* fmt, ... )
{
int len;
va_list argptr;
char buffer[32000]; // big, but small enough to fit in PPC stack
va_start( argptr, fmt );
len = vsprintf( buffer, fmt, argptr );
// SRS - using idStr::vsnPrintf() guarantees size and null termination
len = idStr::vsnPrintf( dest, size, fmt, argptr );
va_end( argptr );
if( len >= sizeof( buffer ) )
if( len < 0 )
{
idLib::common->Error( "idStr::snPrintf: overflowed buffer" );
idLib::common->Warning( "idStr::snPrintf: overflow of %i in %i\n", len, size - 1 );
len = size - 1;
}
if( len >= size )
{
idLib::common->Warning( "idStr::snPrintf: overflow of %i in %i\n", len, size );
len = size;
}
idStr::Copynz( dest, buffer, size );
return len;
}
@ -2290,7 +2286,8 @@ int idStr::vsnPrintf( char* dest, int size, const char* fmt, va_list argptr )
// RB begin
#ifdef _WIN32
#undef _vsnprintf
ret = _vsnprintf( dest, size - 1, fmt, argptr );
// SRS - added size_t cast for 64-bit type consistency
ret = _vsnprintf( dest, ( size_t )size - 1, fmt, argptr );
#define _vsnprintf use_idStr_vsnPrintf
#else
#undef vsnprintf
@ -2321,9 +2318,13 @@ int sprintf( idStr& string, const char* fmt, ... )
char buffer[32000];
va_start( argptr, fmt );
l = idStr::vsnPrintf( buffer, sizeof( buffer ) - 1, fmt, argptr );
// SRS - using idStr::vsnPrintf() guarantees size and null termination
l = idStr::vsnPrintf( buffer, sizeof( buffer ), fmt, argptr );
va_end( argptr );
buffer[sizeof( buffer ) - 1] = '\0';
if( l < 0 )
{
l = sizeof( buffer ) - 1;
}
string = buffer;
return l;
@ -2341,8 +2342,12 @@ int vsprintf( idStr& string, const char* fmt, va_list argptr )
int l;
char buffer[32000];
l = idStr::vsnPrintf( buffer, sizeof( buffer ) - 1, fmt, argptr );
buffer[sizeof( buffer ) - 1] = '\0';
// SRS - using idStr::vsnPrintf() guarantees size and null termination
l = idStr::vsnPrintf( buffer, sizeof( buffer ), fmt, argptr );
if( l < 0 )
{
l = sizeof( buffer ) - 1;
}
string = buffer;
return l;
@ -2364,12 +2369,14 @@ char* va( const char* fmt, ... )
char* buf;
buf = string[index];
index = ( index + 1 ) & 3;
va_start( argptr, fmt );
vsprintf( buf, fmt, argptr );
// SRS - using idStr::vsnPrintf() guarantees size and null termination
idStr::vsnPrintf( buf, sizeof( string[index] ), fmt, argptr );
va_end( argptr );
index = ( index + 1 ) & 3;
return buf;
}

View file

@ -610,7 +610,7 @@ ID_INLINE idStr::idStr( const int i )
char text[ 64 ];
int l;
l = sprintf( text, "%d", i );
l = idStr::snPrintf( text, sizeof( text ), "%d", i );
EnsureAlloced( l + 1 );
strcpy( data, text );
len = l;
@ -622,7 +622,7 @@ ID_INLINE idStr::idStr( const unsigned u )
char text[ 64 ];
int l;
l = sprintf( text, "%u", u );
l = idStr::snPrintf( text, sizeof( text ), "%u", u );
EnsureAlloced( l + 1 );
strcpy( data, text );
len = l;
@ -758,7 +758,7 @@ ID_INLINE idStr operator+( const idStr& a, const float b )
char text[ 64 ];
idStr result( a );
sprintf( text, "%f", b );
idStr::snPrintf( text, sizeof( text ), "%f", b );
result.Append( text );
return result;
@ -769,7 +769,7 @@ ID_INLINE idStr operator+( const idStr& a, const int b )
char text[ 64 ];
idStr result( a );
sprintf( text, "%d", b );
idStr::snPrintf( text, sizeof( text ), "%d", b );
result.Append( text );
return result;
@ -780,7 +780,7 @@ ID_INLINE idStr operator+( const idStr& a, const unsigned b )
char text[ 64 ];
idStr result( a );
sprintf( text, "%u", b );
idStr::snPrintf( text, sizeof( text ), "%u", b );
result.Append( text );
return result;
@ -790,7 +790,7 @@ ID_INLINE idStr& idStr::operator+=( const float a )
{
char text[ 64 ];
sprintf( text, "%f", a );
idStr::snPrintf( text, sizeof( text ), "%f", a );
Append( text );
return *this;
@ -800,7 +800,7 @@ ID_INLINE idStr& idStr::operator+=( const int a )
{
char text[ 64 ];
sprintf( text, "%d", a );
idStr::snPrintf( text, sizeof( text ), "%d", a );
Append( text );
return *this;
@ -810,7 +810,7 @@ ID_INLINE idStr& idStr::operator+=( const unsigned a )
{
char text[ 64 ];
sprintf( text, "%u", a );
idStr::snPrintf( text, sizeof( text ), "%u", a );
Append( text );
return *this;

View file

@ -237,12 +237,18 @@ int idSysThread::ThreadProc( idSysThread* thread )
break;
}
// SRS - generalize thread instrumentation with correct Run() scope
OPTICK_THREAD( thread->GetName() );
retVal = thread->Run();
}
thread->signalWorkerDone.Raise();
}
else
{
// SRS - generalize thread instrumentation with correct Run() scope
OPTICK_THREAD( thread->GetName() );
retVal = thread->Run();
}
}

View file

@ -48,6 +48,12 @@ public:
explicit idPolynomial( float a, float b, float c, float d );
explicit idPolynomial( float a, float b, float c, float d, float e );
// SRS - Added destructor, otherwise idPolynomial() will leak memory
~idPolynomial()
{
Mem_Free16( coefficient );
};
float operator[]( int index ) const;
float& operator[]( int index );

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