Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP T5xRadiant #1

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
with:
name: ${{matrix.configuration}} binaries
path: |
build/bin/${{matrix.configuration}}/iw3r.dll
build/bin/${{matrix.configuration}}/iw3r.pdb
build/bin/${{matrix.configuration}}/t5xr.dll
build/bin/${{matrix.configuration}}/t5xr.pdb
build/bin/${{matrix.configuration}}/PhysX_32.dll
build/bin/${{matrix.configuration}}/PhysXCommon_32.dll
build/bin/${{matrix.configuration}}/PhysXCooking_32.dll
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
with:
name: ${{matrix.configuration}} binaries
path: |
build/bin/${{matrix.configuration}}/iw3r.dll
build/bin/${{matrix.configuration}}/iw3r.pdb
build/bin/${{matrix.configuration}}/t5xr.dll
build/bin/${{matrix.configuration}}/t5xr.pdb
build/bin/${{matrix.configuration}}/PhysX_32.dll
build/bin/${{matrix.configuration}}/PhysXCommon_32.dll
build/bin/${{matrix.configuration}}/PhysXCooking_32.dll
Expand Down
10 changes: 5 additions & 5 deletions .vscode/readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
1.) Install C++ Build tools (msbuild)
2.) Add msbuild to the "PATH" environment variable (eg. "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin")
3.) Add "COD4_ROOT" environment variable with path to your cod4 directory (eg. "COD4_ROOT" "D:\COD4-Modtools")
2.) Add msbuild to the "PATH" environment variable (eg. "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin")
3.) Add "BO1_ROOT" environment variable with path to your bo1 directory (eg. "BO1_ROOT" "D:\BO1-Modtools")
4.) Drag and drop all files from ".vscode/tracked\" into ".vscode\ (we ignore all files in .vscode/ besides the readme)
5.) Open "iw3xo-radiant.code-workspace"
5.) Open "t5xo-radiant.code-workspace"
6.) Run task "update_submodules" or open "update_submodules.bat"
7.) Run task "generate-buildfiles" or open "generate-buildfiles.bat"

Use provided build-tasks to build debug/release builds with the option to copy iw3r.dll and iw3r.pdb to %COD4_ROOT%/bin.
Run->Start Debugging will build and copy a debug build to to %COD4_ROOT%/bin and launch IW3xRadiant.
Use provided build-tasks to build debug/release builds with the option to copy t5xr.dll and t5xr.pdb to %BO1_ROOT%/bin.
Run->Start Debugging will build and copy a debug build to to %BO1_ROOT%/bin and launch T5xRadiant.
4 changes: 2 additions & 2 deletions .vscode/tracked/copy-to-cod4-dir.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set path=%~1
cd ../build/bin/%path%

@echo on
copy iw3r.dll "%COD4_ROOT%\bin\"
copy iw3r.pdb "%COD4_ROOT%\bin\"
copy t5xr.dll "%BO1_ROOT%\bin\"
copy t5xr.pdb "%BO1_ROOT%\bin\"
4 changes: 2 additions & 2 deletions .vscode/tracked/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"name": "(Windows) Start",
"type": "cppvsdbg",
"request": "launch",
"program": "IW3xRadiant.exe",
"program": "T5xRadiant.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${env:COD4_ROOT}\\bin",
"cwd": "${env:BO1_ROOT}\\bin",
"environment": [],
"preLaunchTask": "debug-build-copy"
}
Expand Down
12 changes: 6 additions & 6 deletions .vscode/tracked/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"label": "debug-build",
"command": "msbuild.exe",
"args": [
"build/iw3xo-radiant.sln",
"build/t5xo-radiant.sln",
"/p:Configuration=Debug;Platform=Win32",
],
"problemMatcher": "$msCompile",
Expand All @@ -61,7 +61,7 @@
"label": "release-build",
"command": "msbuild.exe",
"args": [
"build/iw3xo-radiant.sln",
"build/t5xo-radiant.sln",
"/p:Configuration=Release;Platform=Win32",
],
"problemMatcher": ["$msCompile"],
Expand All @@ -72,22 +72,22 @@
// *
// copy to dir

// debug: copy build to cod4/bin
// debug: copy build to bo1/bin
{
"type": "shell",
"label": "z-copy-debug",
"command": "copy-to-cod4-dir.bat",
"command": "copy-to-bo1-dir.bat",
"options":
{
"cwd": "${workspaceFolder}\\.vscode"
},
"args": ["debug"],
},
// release: copy build to cod4/bin
// release: copy build to bo1/bin
{
"type": "shell",
"label": "z-copy-release",
"command": "copy-to-cod4-dir.bat",
"command": "copy-to-bo1-dir.bat",
"options":
{
"cwd": "${workspaceFolder}\\.vscode"
Expand Down
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ If you want to buy me a coffee:
___
<br>

### New features not found within the original cod4 radiant:
### New features not found within the original bo1 radiant:
+ completely revamped user interface with docking, tabs, saved layouts and more (Dear ImGui)
+ [play](https://xoxor4d.github.io/tutorials/iw3xradiant-using-effects/) && [edit / create](https://xoxor4d.github.io/tutorials/iw3xradiant-effects-editor/) && [export effects as CreateFX](https://xoxor4d.github.io/tutorials/iw3xradiant-createfx/) files right from within radiant (__makes effectsEd completely obsolete__)
+ Nvidia PhysX integration for [dynamic placement of prefabs](https://xoxor4d.github.io/tutorials/iw3xradiant-physx-prefabs) or [physics-enabled effects](https://xoxor4d.github.io/tutorials/iw3xradiant-physx-effects) (can be turned into misc_models)
+ Nvidia PhysX enabled character movement with cod4 movement mechanics (bouncing) [character movement](https://xoxor4d.github.io/tutorials/iw3xradiant-physx-movement)
+ Nvidia PhysX enabled character movement with bo1 movement mechanics (bouncing) [character movement](https://xoxor4d.github.io/tutorials/iw3xradiant-physx-movement)
+ [d3dbsp loading](https://xoxor4d.github.io/tutorials/iw3xradiant-d3dbsp) and bsp/light compilation from within radiant
+ [automatically generate reflections](https://xoxor4d.github.io/tutorials/iw3xradiant-d3dbsp-reflections) within radiant when compiling the maps bsp
+ [live link](https://xoxor4d.github.io/tutorials/iw3xradiant-livelink) (sync. brushes (with collision), camera and worldspawn settings between cod4 and radiant)
+ [live link](https://xoxor4d.github.io/tutorials/iw3xradiant-livelink) (sync. brushes (with collision), camera and worldspawn settings between bo1 and radiant)
+ [mesh painting](https://xoxor4d.github.io/tutorials/iw3xradiant-mesh-painting) (xmodels/prefabs) with per object settings, random size, angles, weight etc.
+ 3D guizmo to precisely manipulate entities and brushes from the camera window (ImGuizmo)
+ a prefab browser with the ability to generate thumbnails + drag and drop prefabs into the scene
Expand Down Expand Up @@ -112,12 +112,12 @@ ___

<br>

1. Install the CoD4 Modtools
1. Install the bo1 Modtools
2. Download the latest [release](https://github.com/xoxor4d/iw3xo-radiant/releases)
3. Copy the contents into your cod4 root directory
4. Start `bin/IW3xRadiant.exe`
3. Copy the contents into your bo1 root directory
4. Start `bin/T5xRadiant.exe`

- [NIGHTLY]&ensp; &ensp; install latest release, download nightly, unpack and replace `iw3r.dll` within the `bin` folder
- [NIGHTLY]&ensp; &ensp; install latest release, download nightly, unpack and replace `t5xr.dll` within the `bin` folder
&ensp; &ensp; &ensp; &ensp; &ensp; &ensp; &ensp; &ensp; -> check for additional assets in the __#nightly-builds__ channel (📍) on the [iw3xo discord](https://discord.gg/t5jRGbj)
- [OPTIONAL]&ensp; __bo3-tool-textures.zip__ (unpack and place `.iwi's` into `bin\IW3xRadiant\images`)

Expand All @@ -130,41 +130,42 @@ ___

### How to build / compile the project using Visual Studio
1. Clone the repo! __(zip does not include deps!)__
2. Copy everything within the assets folder into your cod4-root folder
2. Copy everything within the assets folder into your bo1-root folder
3. Use __update_submodules.bat__ to update submodules
4. Use __generate-buildfiles.bat__ to build project files with premake
5. Load the solution `(build/iw3xo-radiant.sln)` and open the iw3r project-settings to setup paths:
> - General &ensp; &ensp; &ensp; output directory path -> `path-to-cod4-root\bin\`
> - Debugging &ensp; command -> `path-to-cod4-root\bin\IW3xRadiant.exe`
> - Debugging &ensp; working directory -> `path-to-cod4-root\bin\`
> + Preferred: Create a new environment variable called `COD4_ROOT` that points to your cod4 directory and re-generate the project files.
> - General &ensp; &ensp; &ensp; output directory path -> `path-to-bo1-root\bin\`
> - Debugging &ensp; command -> `path-to-bo1-root\bin\T5xRadiant.exe`
> - Debugging &ensp; working directory -> `path-to-bo1-root\bin\`
> + Preferred: Create a new environment variable called `BO1_ROOT` that points to your bo1 directory and re-generate the project files.
6. Build -> Build Solution or run with debugger

<br>

### How to build the project using VSCode
1. Install C++ Build tools (msbuild)
2. Add msbuild folder to the "PATH" environment variable:
> `%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin`
3. Add `COD4_ROOT` environment variable with path to your cod4 directory
> `"COD4_ROOT" "D:\COD4-Modtools"`
> `%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin`
3. Add `BO1_ROOT` environment variable with path to your bo1 directory
> `"BO1_ROOT" "D:\BO1-Modtools"`
4. Clone the repo (zip does not include deps!)
5. Copy everything within the assets folder into your cod4-root folder
5. Copy everything within the assets folder into your bo1-root folder
6. Drag and drop all files from `.vscode/tracked\` into `.vscode\`
7. Open __iw3xo-radiant.code-workspace__
7. Open __t5xo-radiant.code-workspace__
8. Run task: `update_submodules` or open __update_submodules.bat__
9. Run task: `generate-buildfiles` or open __generate-buildfiles.bat__

Use provided build-tasks with the option to copy `iw3r.dll` and `iw3r.pdb` to `%COD4_ROOT%/bin`
__Run->Start Debugging__ will build and copy a debug build to to `%COD4_ROOT%/bin` and launch IW3xRadiant.
Use provided build-tasks with the option to copy `t5xr.dll` and `t5xr.pdb` to `%BO1_ROOT%/bin`
__Run->Start Debugging__ will build and copy a debug build to to `%BO1_ROOT%/bin` and launch T5xRadiant.

<br>

___

<br>

### Optional:
### Optional:

https://github.com/xoxor4d/iw3xo-dev

### Project Page:
Expand Down Expand Up @@ -210,7 +211,7 @@ ___
### Effect Browser and Playback
![image](readme/feat_effect_browser.gif)

### In-Editor cod4 based movement with bouncing :>
### In-Editor bo1 based movement with bouncing :>
![image](readme/feat_movement.gif)
<br>

Expand Down
4 changes: 2 additions & 2 deletions assets/bin/IW3xRadiant/batch/compile_bsp.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if "%compileBSP%" == "1" (
echo.

copy "%mapsourcepath%%mapname%.map" "%bsppath%%mapname%.map"
"%treepath%bin\cod4map" -platform pc -loadFrom "%mapsourcepath%%mapname%.map" %parmBSPOptions% "%bsppath%%mapname%"
"%treepath%bin\bo1map" -platform pc -loadFrom "%mapsourcepath%%mapname%.map" %parmBSPOptions% "%bsppath%%mapname%"
)

if "%compileLight%" == "1" (
Expand All @@ -47,7 +47,7 @@ if "%compileLight%" == "1" (
echo.

IF EXIST "%mapsourcepath%%mapname%.grid" copy "%mapsourcepath%%mapname%.grid" "%bsppath%%mapname%.grid"
"%treepath%bin\cod4rad" -platform pc %parmLightOptions% "%bsppath%%mapname%"
"%treepath%bin\bo1rad" -platform pc %parmLightOptions% "%bsppath%%mapname%"
)

IF EXIST "%bsppath%%mapname%.map" del "%bsppath%%mapname%.map"
Expand Down
2 changes: 1 addition & 1 deletion assets/bin/iw3xradiant.def
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ NO_STATIC_SHADOWS - the opaque surfaces will not cast static light map shadows

/*QUAKED fx_origin (0.45 0.3 0.2) (-2 -2 -2) (2 2 2)
used for createFX generation and general effect handling.
default: "fx" "iw3xradiant_def"
default: "fx" "t5xradiant_def"

fx - effect definition
fxloop - make createFX gen. use loopfx instead of createOneshotEffect
Expand Down
4 changes: 2 additions & 2 deletions assets/bin/iw3xradiant.prj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"basepath" ".."
"mapspath" "..\\map_source"
"entitypath" ".\\iw3xradiant.def"
"entitypath" ".\\t5xradiant.def"
"autosave" "autosave.map"
"game" ""
"basegame" ""
"layeredmaterials" "cod4_layered_material_library.txt"
"layeredmaterials" "bo1_layered_material_library.txt"
}
16 changes: 8 additions & 8 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ end

dependencies.load()

workspace "iw3xo-radiant"
workspace "T5xRadiant"

startproject "iw3r"
startproject "t5xr"
location "./build"
objdir "%{wks.location}/obj"
targetdir "%{wks.location}/bin/%{cfg.buildcfg}"
Expand Down Expand Up @@ -283,7 +283,7 @@ workspace "iw3xo-radiant"

-- Project

project "iw3r"
project "t5xr"
kind "SharedLib"
language "C++"

Expand Down Expand Up @@ -313,11 +313,11 @@ workspace "iw3xo-radiant"
"/Zm100 -Zm100"
}

if(os.getenv("COD4_ROOT")) then
print ("Setup paths using environment variable 'COD4_ROOT' :: '" .. os.getenv("COD4_ROOT") .. "'")
targetdir(os.getenv("COD4_ROOT") .. "/bin/")
debugdir (os.getenv("COD4_ROOT") .. "/bin/")
debugcommand (os.getenv("COD4_ROOT") .. "/bin/" .. "IW3xRadiant.exe")
if(os.getenv("BO1_ROOT")) then
print ("Setup paths using environment variable 'BO1_ROOT' :: '" .. os.getenv("BO1_ROOT") .. "'")
targetdir(os.getenv("BO1_ROOT") .. "/bin/")
debugdir (os.getenv("BO1_ROOT") .. "/bin/")
debugcommand (os.getenv("BO1_ROOT") .. "/bin/" .. "T5xRadiant.exe")
end

-- Specific configurations
Expand Down
14 changes: 7 additions & 7 deletions src/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", ""
VALUE "CompanyName", "Gungnir Studios LLC"
#ifdef _DEBUG
VALUE "FileDescription", "Radiant modification built for IW3xo"
VALUE "FileDescription", "Radiant modification built for T5xo-dev"
#else
VALUE "FileDescription", "Radiant modification built for IW3xo"
VALUE "FileDescription", "Radiant modification built for T5xo-dev"
#endif
VALUE "FileVersion", VERSION_FILE
VALUE "InternalName", "iw3r"
VALUE "LegalCopyright", "xoxor4d.github.io"
VALUE "OriginalFilename", "iw3r.dll"
VALUE "ProductName", "IW3xRadiant"
VALUE "InternalName", "t5xr"
VALUE "LegalCopyright", "Copyright (C) 2023 Gungnir Studios LLC"
VALUE "OriginalFilename", "t5xr.dll"
VALUE "ProductName", "T5xRadiant"
VALUE "ProductVersion", VERSION_PRODUCT
END
END
Expand Down
6 changes: 3 additions & 3 deletions src/common/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void __declspec(naked) hk_on_createclient()
}
}

// auto load iw3xradiant.prj
// auto load t5xradiant.prj
void create_qe_children(cmainframe* mainframe)
{
char app_path[_MAX_PATH + 1];
Expand All @@ -216,7 +216,7 @@ void create_qe_children(cmainframe* mainframe)

if(!bProjectLoaded)
{
game::Com_Error("Unable to load project file <iw3xradiant.prj>");
game::Com_Error("Unable to load project file <t5xradiant.prj>");
}

auto* m_camera_origin = reinterpret_cast<float*>(0x241A5A4);
Expand Down Expand Up @@ -882,7 +882,7 @@ void cmainframe::hooks()
// handle wm_char events for non-focused subwindows
utils::hook(0x421A7B, cmainframe::windowproc, HOOK_CALL).install()->quick();

// automatically load iw3xradiant.prj
// automatically load t5xradiant.prj
utils::hook(0x422984, hk_create_qe_children_stub, HOOK_JUMP).install()->quick();

// hook end of createclient
Expand Down
16 changes: 8 additions & 8 deletions src/common/radiantapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool on_exit_instance()
void registery_save([[maybe_unused]] CPrefsDlg* prefs)
{
const auto state = afx::get_module_state();
CWinApp_WriteProfileInt(state->m_pCurrentWinApp, "Prefs", "iw3x_mainframe_menubar_enabled", ggui::mainframe_menubar_enabled);
CWinApp_WriteProfileInt(state->m_pCurrentWinApp, "Prefs", "t5x_mainframe_menubar_enabled", ggui::mainframe_menubar_enabled);
CWinApp_WriteProfileInt(state->m_pCurrentWinApp, "Prefs", "lights_max_intensity", game::g_qeglobals->preview_at_max_intensity);
CWinApp_WriteProfileInt(state->m_pCurrentWinApp, "Prefs", "force_zero_dropheight", prefs->m_bForceZeroDropHeight);
CWinApp_WriteProfileInt(state->m_pCurrentWinApp, "Prefs", "discord_rpc", components::discord::g_enable_discord_rpc);
Expand All @@ -111,7 +111,7 @@ void registery_save([[maybe_unused]] CPrefsDlg* prefs)
void registery_load()
{
const auto state = afx::get_module_state();
ggui::mainframe_menubar_enabled = CWinApp_GetProfileIntA(state->m_pCurrentWinApp, "Prefs", "iw3x_mainframe_menubar_enabled", 0);
ggui::mainframe_menubar_enabled = CWinApp_GetProfileIntA(state->m_pCurrentWinApp, "Prefs", "t5x_mainframe_menubar_enabled", 0);

// always bothered me ..
game::g_qeglobals->preview_at_max_intensity = CWinApp_GetProfileIntA(state->m_pCurrentWinApp, "Prefs", "lights_max_intensity", 0);
Expand Down Expand Up @@ -147,7 +147,7 @@ BOOL LoadRegistryInfo(const char* pszName, void* pvBuf, long* plSize)
}
else
{
RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\iw\\IW3xRadiant\\IW3xRadiant", 0, KEY_READ, &hKey);
RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\iw\\T5xRadiant\\T5xRadiant", 0, KEY_READ, &hKey);
}

RegQueryValueExA(hKey, pszName, NULL, (unsigned long*)&lType, (unsigned char*)pvBuf, (unsigned long*)plSize);
Expand Down Expand Up @@ -424,11 +424,11 @@ void radiantapp::hooks()
// show/hide mainframe menubar on startup 03 :: CMainFrame::OnCreate
utils::hook(0x421057, menubar_stub_03, HOOK_JUMP).install()->quick();

// do not use or overwrite stock radiant registry keys - create seperate ones for IW3xRadiant
utils::hook::write_string(0x6EBA58, R"(Software\iw\IW3xRadiant\IW3xRadiant)"s);
utils::hook::write_string(0x6E2320, R"(iw\IW3xRadiant)"s);
utils::hook::write_string(0x6E22F0, R"(Software\iw\IW3xRadiant\IniPrefs)"s);
utils::hook::write_string(0x6DC1EC, R"(Software\iw\IW3xRadiant\MRU)"s);
// do not use or overwrite stock radiant registry keys - create seperate ones for T5xRadiant
utils::hook::write_string(0x6EBA58, R"(Software\iw\T5xRadiant\T5xRadiant)"s);
utils::hook::write_string(0x6E2320, R"(iw\T5xRadiant)"s);
utils::hook::write_string(0x6E22F0, R"(Software\iw\T5xRadiant\IniPrefs)"s);
utils::hook::write_string(0x6DC1EC, R"(Software\iw\T5xRadiant\MRU)"s);

#ifdef HIDE_MAINFRAME_MENUBAR
// -----------------------------------------------------------------------
Expand Down
Loading