Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c8621a2
Add RtxDrv
leon-bckl May 17, 2024
96875d0
Add FRtxRenderInterface
leon-bckl May 17, 2024
beacea0
Set graphics effects to low at startup
leon-bckl May 18, 2024
f5fb3ab
Restore UD3DRenderDevice variables
leon-bckl May 20, 2024
78f154b
Merge branch 'master' into remix
leon-bckl May 25, 2024
1ca8680
Fix ULodMesh variables
leon-bckl Jun 17, 2024
6e115a6
Draw triangles for specific materials to id them in remix
leon-bckl Jun 17, 2024
0d3a622
Don't use UMaterial::UseFallbacks since the d3d8 renderer also uses it
leon-bckl Jun 18, 2024
481e101
Merge branch 'master' into remix
leon-bckl Jun 30, 2024
8e910eb
Place lights for projectiles using remix bridge api
leon-bckl Jul 30, 2024
ea43bc3
Merge branch 'master' into remix
leon-bckl Jul 30, 2024
b3c7ae7
Merge branch 'master' into remix
leon-bckl Jul 30, 2024
026c134
Draw anchor triangle at world origin; Spawn remix light for projectiles
leon-bckl Aug 6, 2024
1977df3
Make FVector::Fvector(FLOAT) explicit
leon-bckl Aug 9, 2024
22235f4
Create a rtx light for each projectile in the level
leon-bckl Aug 9, 2024
4592a08
Add rtx unrealscript interface
leon-bckl Aug 11, 2024
b9e4bd0
Clean up TArray
leon-bckl Aug 11, 2024
4900c3a
Merge branch 'master' into remix
leon-bckl Aug 11, 2024
3512d0b
Add option to disable all lights
leon-bckl Aug 11, 2024
63695fb
Separate color and radiance for rtx lights
leon-bckl Aug 11, 2024
95119d0
Avoid iterating all lights for each DestroyLight call
leon-bckl Aug 11, 2024
4b6d5b7
Draw a unique anchor triangle per level
leon-bckl Aug 18, 2024
e9500e4
Merge branch 'master' into remix
leon-bckl Aug 18, 2024
c633ed6
Don't reset d3d render interface in Unlock because it might still be …
leon-bckl Aug 18, 2024
426192b
Fix crash when light is added via UI at the end of a non-empty list
leon-bckl Aug 18, 2024
c680208
Move bridge interface out of URtxInterface
leon-bckl Aug 20, 2024
3a44e98
Make anchor triangle color or visibility changes possible without a l…
leon-bckl Aug 24, 2024
0a3af2d
Draw anchor triangle after first depth clear so it shows up in scene …
leon-bckl Sep 8, 2024
2d72b7f
Draw anchor triangle without scaling matrix to avoid issues in remix
leon-bckl Sep 9, 2024
1594b82
Update remix api
leon-bckl Sep 19, 2024
3654205
Add capture mode where everything is drawn without culling
leon-bckl Sep 25, 2024
ee16036
Rename RtxInterface to Rtx
leon-bckl Sep 30, 2024
ab8c6a5
No fatal error when remix api fails to initialize
leon-bckl Sep 30, 2024
54f074f
Add missing HardwareShaderWrapper classes
leon-bckl Oct 2, 2024
c8d46ba
Replace hardware shader materials with fixed function materials
leon-bckl Oct 2, 2024
5594b42
Merge branch 'master' into remix
leon-bckl Oct 8, 2024
fa45e2c
Fix light shaping not applied
leon-bckl Oct 8, 2024
2c127ab
Normalize light direction
leon-bckl Oct 8, 2024
7eebf91
Formatting
leon-bckl Oct 8, 2024
77fce49
Merge branch 'master' into remix
leon-bckl Oct 14, 2024
cffae44
Merge branch 'master' into remix
leon-bckl Oct 14, 2024
aa1c493
Merge branch 'master' into remix
leon-bckl Oct 14, 2024
56bfc15
Add extensible components for rtx features
leon-bckl Oct 17, 2024
518eb6c
Ignore certain materials
leon-bckl Oct 17, 2024
e2a7470
Fix flashlight still being enabled when loading a new map
leon-bckl Oct 18, 2024
0b5f7ab
Add functions to access material flags
leon-bckl Oct 19, 2024
74f75c6
Use INT for 4-byte padding
leon-bckl Oct 25, 2024
b1d3b55
Disable targeted vision mode shaders for night vision
leon-bckl Dec 16, 2024
20f5e60
Don't create lights for grenade projectiles
leon-bckl Dec 16, 2024
02c6453
Merge branch 'master' into remix
leon-bckl Mar 15, 2025
c05c292
Only do light position and direction calculation once instead of per …
leon-bckl Mar 16, 2025
d509650
Merge branch 'master' into remix
leon-bckl May 19, 2025
f67f94d
Add Scipt function and console command to set rtx config variables
leon-bckl May 19, 2025
38ec5ae
Shutdown remix API in URtx::Exit
leon-bckl May 22, 2025
4a1eff0
Add options to disable frustum culling and sky rendering
leon-bckl Jun 17, 2025
602ca38
Remove nonexistent function
leon-bckl Jun 17, 2025
c951ce1
Prevent static names from being garbage collected
leon-bckl Jul 7, 2025
d3f1c79
Add rtx particle component
leon-bckl Jul 11, 2025
0f08053
Make level change check more robust
leon-bckl Jul 17, 2025
6b0121e
Make it possible to create an RtxLight standalone without Rtx::Create…
leon-bckl Jul 17, 2025
893c381
Make sure relevant graphics settings are set to the correct values
leon-bckl Jul 20, 2025
bd43bac
Merge branch 'master' into remix
leon-bckl Sep 4, 2025
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: 3 additions & 1 deletion .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ set errorformat^=%f(%l):\ %m,%f(%l)\ :\ %m,%f\ :\ error\ %m,LINK\ :\ fatal\ erro

map <silent> <F3> :wa <bar> let &makeprg='..\GameData\System\UCC.exe' <bar> make! make "ini=../../Code/UCC/UCC.ini" -noprompt -fullsourcepath -noincremental <bar> :cwindow<CR>
map <silent> <F4> :wa <bar> let &makeprg='build.bat' <bar> make! debug <bar> :cwindow<CR>
map <F5> :!start "../GameData/System/CT.exe" dm_canyon?game=mpgame.dmgame?maxplayers=32?Listen -windowed -log -nosaveconfig -rendev=opengl<CR>

" map <F5> :!start "../GameData/System/CT.exe" dm_canyon?game=mpgame.dmgame?maxplayers=32?Listen -windowed -log -nosaveconfig -rendev=rtx<CR>
map <F5> :!start "../GameData/System/CT.exe" geo_01a -windowed -log -nosaveconfig -rendev=rtx<CR>
map <F6> :!start "../GameData/System/CTEditor.exe"<CR>

augroup customhighlight
Expand Down
4 changes: 4 additions & 0 deletions CT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModEd", "ModEd\ModEd.vcproj
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtxDrv", "RtxDrv\RtxDrv.vcproj", "{D7878929-5402-468A-811D-1591523609F3}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Expand Down
52 changes: 30 additions & 22 deletions CT/Src/Launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@

#pragma comment(lib, "Winmm.lib") // timeBeginPeriod, timeEndPeriod

// Allow short form of known render devices.
static FStringTemp GetFullRenderDeviceClassName(const FString& RenderDeviceClass)
{
if(RenderDeviceClass == "D3D")
return "D3DDrv.D3DRenderDevice";
else if(RenderDeviceClass == "OpenGL")
return "OpenGLDrv.OpenGLRenderDevice";
else if(RenderDeviceClass == "Mod")
return "Mod.ModRenderDevice";
else if(RenderDeviceClass == "Rtx")
return "RtxDrv.RtxRenderDevice";

return RenderDeviceClass;
}

static void EndFullscreen()
{
if(GEngine && GEngine->Client && GEngine->Client->Viewports.Num() > 0 && GEngine->Client->Viewports[0])
Expand Down Expand Up @@ -393,18 +408,18 @@ static struct FExecHook : public FExec, FNotifyHook{
SetFocus(Preferences->hWnd);

return 1;
}
else if(!GIsEditor && GIsClient && ParseCommand(&Cmd, "USERENDEV"))
{
FString RenderDeviceClass = Cmd;

if(RenderDeviceClass == "D3D")
RenderDeviceClass = "D3DDrv.D3DRenderDevice";
else if(RenderDeviceClass == "OpenGL")
RenderDeviceClass = "OpenGLDrv.OpenGLRenderDevice";
else if(RenderDeviceClass == "Mod")
RenderDeviceClass = "Mod.ModRenderDevice";
}else if(GIsClient && ParseCommand(&Cmd, "GETRES")){
Ar.Logf("%ix%i", GEngine->Client->Viewports[0]->SizeX, GEngine->Client->Viewports[0]->SizeY);
return 1;
}else if(ParseCommand(&Cmd, "GETRENDEV")){
if(GEngine && GEngine->GRenDev)
Ar.Log(GEngine->GRenDev->GetClass()->GetPathName());
else
Ar.Logf("No render device in use");

return 1;
}else if(!GIsEditor && GIsClient && ParseCommand(&Cmd, "USERENDEV")){
FString RenderDeviceClass = GetFullRenderDeviceClassName(Cmd);
UClass* Class = LoadClass<URenderDevice>(NULL, *RenderDeviceClass, NULL, LOAD_NoWarn | LOAD_Quiet, NULL);

if(Class)
Expand Down Expand Up @@ -459,16 +474,8 @@ static void InitEngine()

FString RenderDeviceClass;

if(Parse(appCmdLine(), "RenDev=", RenderDeviceClass))
{
// Allow short form of known render devices.
if(RenderDeviceClass == "D3D")
RenderDeviceClass = "D3DDrv.D3DRenderDevice";
else if(RenderDeviceClass == "OpenGL")
RenderDeviceClass = "OpenGLDrv.OpenGLRenderDevice";
else if(RenderDeviceClass == "Mod")
RenderDeviceClass = "Mod.ModRenderDevice";

if(Parse(appCmdLine(), "RenDev=", RenderDeviceClass)){
RenderDeviceClass = GetFullRenderDeviceClassName(RenderDeviceClass);
debugf("RenderDevice set on command line: %s", *RenderDeviceClass);
GConfig->SetString("Engine.Engine", "RenderDevice", *RenderDeviceClass);
RenDevSetOnCommandLine = true;
Expand Down Expand Up @@ -668,7 +675,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
appPreExit();

GIsGuarded = 0;
}catch(...)
}
catch(...)
{
GIsGuarded = 0;
ExitCode = EXIT_FAILURE;
Expand Down
6 changes: 6 additions & 0 deletions Core/Inc/UnClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ class CORE_API UStruct : public UField{
UStruct* GetSuperStruct() const;
bool StructCompare(const void* A, const void* B);

template<typename T>
bool IsChildOf()
{
return IsChildOf(T::StaticClass());
}

protected:
// Cheat Protection
BYTE FunctionMD5Digest[16]; // Holds a MD5 digest for this function
Expand Down
1 change: 0 additions & 1 deletion Core/Inc/UnObjBas.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ class CORE_API UObject{
UBOOL IsA(FName SomeBaseClassName) const;
UBOOL IsIn(UObject* SomeOuter) const;
UBOOL IsProbing(FName ProbeName);
UField* FindObjectField(FName InName, UBOOL Global = 0);
UFunction* FindFunction(FName InName, UBOOL Global = 0);
UFunction* FindFunctionChecked(FName InName, UBOOL Global = 0);
UState* FindState(FName InName);
Expand Down
33 changes: 31 additions & 2 deletions D3DDrv/Inc/D3DDrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,39 @@ struct IDirect3DDevice8;
class D3DDRV_API UD3DRenderDevice : public URenderDevice{
DECLARE_CLASS(UD3DRenderDevice,URenderDevice,CLASS_Config,D3DDrv);
public:
char Padding1[17920];
char Padding1[16412]; // Padding
UBOOL UsePrecaching;
UBOOL UseTrilinear;
INT Padding2; // Padding
UBOOL UseVSync;
UBOOL UseHardwareTL;
UBOOL UseHardwareVS;
UBOOL UseCubemaps;
char PADDING3[16]; // Padding
UBOOL UseTripleBuffering;
UBOOL ReduceMouseLag;
UBOOL UseXBoxFSAA;
char Padding4[16]; // Padding
UBOOL CheckForOverflow;
UBOOL UseNPatches;
UBOOL DecompressTextures;
UBOOL AvoidHitches;
UBOOL OverrideDesktopRefreshRate;
INT Padding5; // Padding
INT AdapterNumber;
INT Padding6; // Padding
INT MaxPixelShaderVersion;
INT LevelOfAnisotropy;
FLOAT DetailTexMipBias;
FLOAT DefaultTexMipBias;
FLOAT TesselationFactor;
FLOAT DesiredRefreshRate;
INT VideoResetAttempts;
UBOOL StateCachingDisabled;
char Padding7[1370]; // Padding
IDirect3D8* Direct3D8;
IDirect3DDevice8* Direct3DDevice8;
char Padding2[47868];
char Padding8[47868]; // Padding

//Overrides
virtual UBOOL Exec(const TCHAR* Cmd, FOutputDevice& Ar);
Expand Down
119 changes: 119 additions & 0 deletions Engine/Inc/EngineClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -5968,6 +5968,105 @@ class ENGINE_API UHardwareShaderWrapper : public URenderedMaterial{
}
};

/*
* HsBumpDiffBlend
*/

class ENGINE_API UHsBumpDiffBlend : public UHardwareShaderWrapper{
public:
class UTexture* DiffuseTexture;
class UTexture* BlendTexture;
class UTexture* NormalMap;
FLOAT DiffUVScale;
FLOAT BlendUVScale;
FLOAT BumpUVScale;

DECLARE_CLASS(UHsBumpDiffBlend,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsBumpDiffBlendMask
*/

class ENGINE_API UHsBumpDiffBlendMask : public UHardwareShaderWrapper{
public:
class UTexture* DiffuseTexture;
class UTexture* BlendTexture;
class UTexture* NormalMap;
FLOAT DiffUVScale;
FLOAT BlendUVScale;
FLOAT BumpUVScale;
BYTE VertexToTextureBlend;

DECLARE_CLASS(UHsBumpDiffBlendMask,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsBumpDiffBlendMaskIllum
*/

class ENGINE_API UHsBumpDiffBlendMaskIllum : public UHardwareShaderWrapper{
public:
class UTexture* DiffuseTexture;
class UTexture* BlendTexture;
class UTexture* NormalMap;
FLOAT DiffUVScale;
FLOAT BlendUVScale;
FLOAT BumpUVScale;
BYTE VertexToTextureBlend;

DECLARE_CLASS(UHsBumpDiffBlendMaskIllum,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsBumpDiffSpec
*/

class ENGINE_API UHsBumpDiffSpec : public UHardwareShaderWrapper{
public:
class UTexture* DiffuseTexture;
class UTexture* NormalMap;
FLOAT DiffUVScale;
FLOAT BumpUVScale;
BYTE Specularity;
FColor SpecularTint;

DECLARE_CLASS(UHsBumpDiffSpec,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsFalloff
*/

class ENGINE_API UHsFalloff : public UHardwareShaderWrapper{
public:
class UTexture* DiffuseTexture;
class UTexture* FalloffGradient;
FLOAT UPanRate;
FLOAT VPanRate;
FLOAT UOscilationRate;
FLOAT VOscilationRate;
FLOAT GradientBlendMode;
FColor DiffuseTint;
FColor GradientTint;
BYTE SrcBlend;
BYTE DestBlend;
BITFIELD ZTest:1;
BITFIELD ZWrite:1;

DECLARE_CLASS(UHsFalloff,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsHologram
*/
Expand All @@ -5983,6 +6082,26 @@ class ENGINE_API UHsHologram : public UHardwareShaderWrapper{
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* HsWorldDistortion
*/

class ENGINE_API UHsWorldDistortion : public UHardwareShaderWrapper{
public:
FColor ColorAdd;
FColor ColorVariation;
float WorldDistortion;
FLOAT WobbleScale;
FLOAT WobbleSpeed;
FLOAT WobbleAmplitute;
BITFIELD VortexEffect:1;
BYTE Alpha;

DECLARE_CLASS(UHsWorldDistortion,UHardwareShaderWrapper,0,Engine)
// Make sure to implement this function in UnHardwareShaderWrapper.cpp
virtual INT SetupShaderWrapper(class FRenderInterface* RI);
};

/*
* ParticleMaterial
*/
Expand Down
2 changes: 1 addition & 1 deletion Engine/Inc/UnRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ENGINE_API FLevelSceneNode : public FSceneNode{
// Virtual functions
virtual FConvexVolume GetViewFrustum();
virtual UBOOL FilterActor(AActor* Actor);
virtual UBOOL FilterAttachment(AActor* AttachedActor){ return 1; }
virtual UBOOL FilterAttachment(AActor* AttachedActor){ return 1; }
virtual UBOOL FilterProjector(AProjector* Actor);
};

Expand Down
2 changes: 2 additions & 0 deletions Mod/PropertyOverrides/CTInventory.BattleDroidBlasterProj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LightHue=255
LightSaturation=40
2 changes: 2 additions & 0 deletions Mod/PropertyOverrides/CTInventory.DC17BlasterProj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LightHue=170
LightSaturation=40
2 changes: 2 additions & 0 deletions Mod/PropertyOverrides/Properties.BattleDroidBlasterProjTM.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LightHue=255
LightSaturation=40
44 changes: 44 additions & 0 deletions ModEd/Src/ModEd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,33 @@ static WWindow* GetMainWindow()
return *reinterpret_cast<WWindow**>(0x10FE39D4);
}

static WNDPROC OriginalMainWindowProc = NULL;

LRESULT CALLBACK MainWindowProcOverride(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if(Msg == WM_INPUT)
{
RAWINPUT RawInput;
UINT RawInputSize = sizeof(RawInput);

if(GET_RAWINPUT_CODE_WPARAM(wParam) != RIM_INPUT)
return 0;

if(GetRawInputData((HRAWINPUT)(lParam), RID_INPUT, &RawInput, &RawInputSize, sizeof(RAWINPUTHEADER)) != (UINT)-1)
{
if(RawInput.header.dwType == RIM_TYPEMOUSE)
{

}
}

DefWindowProcA(hWnd, Msg, wParam, lParam);
return 0;
}

return OriginalMainWindowProc(hWnd, Msg, wParam, lParam);
}

static void(__fastcall*OriginalUUnrealEdEngineTick)(UEditorEngine*, DWORD, FLOAT) = NULL;

/*
Expand Down Expand Up @@ -113,6 +140,22 @@ static void __fastcall UnrealEdEngineTickOverride(UEditorEngine* Self, DWORD Edx
SendMessageA(GetMainWindow()->hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
}

OriginalMainWindowProc = reinterpret_cast<WNDPROC>(GetWindowLongA(GetMainWindow()->hWnd, GWLP_WNDPROC));
SetWindowLongA(GetMainWindow()->hWnd, GWLP_WNDPROC, reinterpret_cast<LONG>(MainWindowProcOverride));

#ifndef HID_USAGE_PAGE_GENERIC
#define HID_USAGE_PAGE_GENERIC ((USHORT)0x01)
#define HID_USAGE_GENERIC_MOUSE ((USHORT)0x02)
#endif

RAWINPUTDEVICE RawInput;
RawInput.usUsagePage = HID_USAGE_PAGE_GENERIC;
RawInput.usUsage = HID_USAGE_GENERIC_MOUSE;
RawInput.dwFlags = 0;
RawInput.hwndTarget = GetMainWindow()->hWnd;

RegisterRawInputDevices(&RawInput, 1, sizeof(RAWINPUTDEVICE));

// Restore original tick function now that the initial setup is done.
PatchVTable(Self, 32, OriginalUUnrealEdEngineTick);
}
Expand Down Expand Up @@ -168,5 +211,6 @@ DLL_EXPORT void ModEdInit(const TCHAR* InPackage, const TCHAR* InCmdLine, FOutpu

InitSWRCFix();

// Hook UUnrealEdEngine::Tick for initialization
OriginalUUnrealEdEngineTick = static_cast<void(__fastcall*)(UEditorEngine*, DWORD, FLOAT)>(PatchDllClassVTable(*(FString(appPackage()) + ".exe"), "UUnrealEdEngine", "UObject", 32, UnrealEdEngineTickOverride));
}
Loading