Minor things worth mentioning

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Valve presented a way for rendering masked stuff without the odd jagged borders back at SIGGRAPH 2007.
http://www.valvesoftware.com/publicatio ... cation.pdf
The interessting point is, that in it's simplest form it can just be handled at resource creation time and just handled like ordinary alpha testing.

Might also be a way to just have the TTF-sampled fonts for the 1x resolution, which would still look good at 2x. At 3x it would in any case look better compared upsampled ordinary 1x or 2x bitmap fonts.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Typically I would do such things as natives, but I just wanted to have sth. for quick testing.

Code: Select all

// Makeshift Pow for X>0.
static final function float Pow( float X, float Y )
{
	return Exp(y*Loge(X));
}

Code: Select all

static final function vector Compress_sRGB( vector Color )
{
	local vector Result;
	if ( Color.X<=0.0031308 ) Result.X = 12.92*Color.X; else Result.X = 1.055*Pow(Color.X,0.41666)-0.055;
	if ( Color.Y<=0.0031308 ) Result.Y = 12.92*Color.Y; else Result.Y = 1.055*Pow(Color.Y,0.41666)-0.055;
	if ( Color.Z<=0.0031308 ) Result.Z = 12.92*Color.Z; else Result.Z = 1.055*Pow(Color.Z,0.41666)-0.055;
	return Result;
}
static final function vector Decompress_sRGB( vector Color )
{
	local vector Result;
	if ( Color.X<=0.04045 ) Result.X = Color.X/12.92; else Result.X = Pow((Color.X+0.055)/1.055,2.4);
	if ( Color.Y<=0.04045 ) Result.Y = Color.Y/12.92; else Result.Y = Pow((Color.Y+0.055)/1.055,2.4);
	if ( Color.Z<=0.04045 ) Result.Z = Color.Z/12.92; else Result.Z = Pow((Color.Z+0.055)/1.055,2.4);                                      
	return Result;
}
/edit:
Turns out I missed the ** operator, so there is no need for the makeshift pow.
Last edited by Hanfling on Sun Mar 12, 2017 1:00 pm, edited 1 time in total.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
atrey65789
Thug
Posts: 49
Joined: Tue Jun 26, 2012 3:32 am

Re: Minor things worth mentioning

Post by atrey65789 »

Hey Hanfling,

Thanks again for help guide me through working with native code.

I have just one question.


I have one single LNK2001 Error Which says this:

Code: Select all

SampleClass.obj : error LNK2001: unresolved external symbol "public: virtual int * __thiscall AActor::GetOptimizedRepList(unsigned char *,struct FPropertyRetirement *,int *,class UPackageMap *)" (?GetOptimizedRepList@AActor@@UAEPAHPAEPAUFPropertyRet
irement@@PAHPAVUPackageMap@@@Z)

It seems to not have to do with the test function I am importing, but instead a function in the AActor class.

I have both Core.lib and Engine.lib linked with all the necessary headers.

I have researched this exact error with no avail, What would you say the problem is?


Thanks,
Brenden

EDIT: I fixed it, I was using old Core and Engine Libs... Downloaded the official DX ones, recompiled and voila.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

I finally stumbled more or less by accident about some Maya/Max sample files for the ActorX exporter. Sadly I couldn't get the Maya example to open in Maya 2016 Extension 2 and sending over from Max screwed up the Mesh. However, opening the Max example with Max 2016 did work, so I ended up adding Deus Ex vertex mesh export to the Max ActorX plugin and successfully tested it. :) I also added the code to the Maya plugin, but I couldn't test it.

Source:
https://github.com/hanfling/ActorX
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: Minor things worth mentioning

Post by Cybernetic pig »

So we can export vanilla/HDTP DX meshes easy, edit it in max/maya, and then import it back in (using the usual import pipeline that never seems to bloody work)? Is that the purpose of this program?
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Well you still need SkeletalAnimation in Max/Maya to sample from. But yeah, thats the idea, getting rid of having manually sample, export to 3ds, run 3ds2unr/de, but instead directly export out of Max/Maya. However ActorX won't write you the uc file, so one would need to write down number of keyframes per animation. Would be worth to add some sort of support for an ini file, which gets purged if the animation is not appended, otherwise it should get updated and used to create some dummy/sample script file.

But I can't give a full blown user guide, I just have a few links here and there.

Other ideas are to support the ION style material syntax as supported by their lwo23d or how it was called. I liked it.
Yet another idea, and I would really like to get some testmesh in Maya is try to match the 8bit texture coordinates to the pixel center of (virtual) thought of 256x256 textures. At least that would work like a charme for legacy meshes. For the non animated low res meshes this would be a nice way to get the texture alignment straight...
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Turns out there is a 3ds import plugin for Maya as part of the Maya Bonus Tools package.

https://knowledge.autodesk.com/support/ ... -Maya.html
https://apps.autodesk.com/MAYA/en/Detai ... 2702393827
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Just out of curiosity: Are there any (community made) Deus Ex packages with stripped ScriptText out there which would be in particular interessting to have the source for?
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Code: Select all

function TestEmptyWhileUntil()
{
	local int i;

	while ( ++i<10 )
	{
	} until( i>20 );
}
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: Minor things worth mentioning

Post by Cybernetic pig »

What's the purpose of this test? To see what happens when i iterates through 10-21? What is the result?
Made in China
MJ12
Posts: 466
Joined: Thu Apr 02, 2009 7:55 pm

Re: Minor things worth mentioning

Post by Made in China »

It doesn't seem to do that? I only know C, but it seems like it initializes i without giving it a value - so i equals whatever value was in its memory address beforehand (junk value).
If i is less than 9, it'll count to 9.
otherwise, it'll terminate:
If it's larger than 9, it'll never enter the loop.
If it's larger than 20, it both will never enter the loop and even if it will it will encounter the termination condition, so... yay for redundancy?

I have no idea what purpose this code might have.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: Minor things worth mentioning

Post by Cybernetic pig »

No need to initialize variables in UScript, only declaration. It's beautiful. everything is defaulted to 0/false/none unless defined otherwise. Remember - no memory management. Has automated garbage collection.

But yeah, I was thinking since i defaults to 0 it will never have the chance to iterate past ten, but then I thought maybe it does via until, otherwise what would be the point in that parameter/condition? Consider us both stumped.

disclaimer: only used a while loop a few times, like the shotguns reloading one shell at a time. Despite my achievements and five+ years coding I'm still probably barely intermediate.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Made in China wrote:It doesn't seem to do that? I only know C, but it seems like it initializes i without giving it a value
As cypig pointed out, local variables are explicit zero initialized, instance variables are initialized by their default value (which is also zero by default).

I posted it more as sort of some: WAIT, WHAT, THIS COMPILES.

By pure accident, though that happened at the perfect time, I stumbled upon that these while-unil loops compile in UnrealScript. Before I thought that only for/while/do-until loops are possible in UnrealScript. while-until loops also seem to work in C++, but I have no idea about the speficis there, and no real interesst in figuring them out.

As for details about how the execution of the while-until, the following disassembly should shed some light on it. I probably later post some example with break or continue in. Especially how continue works in these while-until loops would be interessting (Offsets are relative to start of the function/rep/state, not relative to the instruction they are part of).

Code: Select all

	//
	// 0x0000: EX_JumpIfNot (JumpOffset=0x001A)
	// 0x0003:   EX_Native (iNative=150,Function=Core.Object.Less_IntInt,OperatorType=1)
	// 0x0004:     EX_Native (iNative=163,Function=Core.Object.AddAdd_PreInt,OperatorType=2)
	// 0x0005:       EX_LocalVariable (Property=ScriptRaysTestPackage.ScriptRaysTestFunctions.TestEmptyWhileUntil.i)
	// 0x000B:     EX_IntConstByte (IntConst=10)
	// 0x000E: EX_JumpIfNot (JumpOffset=0x0000)
	// 0x0011:   EX_Native (iNative=151,Function=Core.Object.Greater_IntInt,OperatorType=1)
	// 0x0012:     EX_LocalVariable (Property=ScriptRaysTestPackage.ScriptRaysTestFunctions.TestEmptyWhileUntil.i)
	// 0x0017:     EX_IntConstByte (IntConst=20)
	// 0x001A: EX_Return
	// 0x001B:   EX_Nothing
	//
/edit:
Update for continue: continue jumps to the lower condition.

Code: Select all


function TestEmptyWhileUntilContinue()
{
	local int i;

	while ( ++i<10 )
	{
		continue;
	} until( i>20 );

	//
	// 0x0000: EX_JumpIfNot (JumpOffset=0x001D)
	// 0x0003:   EX_Native (iNative=150,Function=Core.Object.Less_IntInt,OperatorType=1)
	// 0x0004:     EX_Native (iNative=163,Function=Core.Object.AddAdd_PreInt,OperatorType=2)
	// 0x0005:       EX_LocalVariable (Property=ScriptRaysTestPackage.ScriptRaysTestFunctions.TestEmptyWhileUntilContinue.i)
	// 0x000B:     EX_IntConstByte (IntConst=10)
	// 0x000E: EX_Jump (JumpOffset=0x0011)
	// 0x0011: EX_JumpIfNot (JumpOffset=0x0000)
	// 0x0014:   EX_Native (iNative=151,Function=Core.Object.Greater_IntInt,OperatorType=1)
	// 0x0015:     EX_LocalVariable (Property=ScriptRaysTestPackage.ScriptRaysTestFunctions.TestEmptyWhileUntilContinue.i)
	// 0x001A:     EX_IntConstByte (IntConst=20)
	// 0x001D: EX_Return
	// 0x001E:   EX_Nothing
	//
}
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

I always had this mysterious bug in my OpenGLDrv, which was already in the ut436-opengldrv-src-090602 where the black background bars of the third person convervation windows had the wrong size.

Turns out, this was in the caused by a missing Frame->ComputeRenderSize() (which will invoke RenDev->SetSceneNode()) inside the XRootWindow::PostRender() after the original FSceneNode data was restored there, so RenDev never knew that it actually changed again. This wasn't an issue in SoftDrv nor D3DDrv as these directly use the data out of FSceneNode passed in along the drawcalls, while OpenGLDrv relied on getting notified of this (e.g. by the SetSceneNode() call). Sadly this SetSceneNode() stuff was later added to the Engine (it's missing in KHG) and seems to never have really been fully hocked in. There were SetSceneNode() calls missing in URender::DrawWorld() which are relevant especially for NearClip plane changes/and if you don't let C++ code in Render transform into Viewspace before handling it. Also there is one SetSceneNode() call missing after the drone window is drawn and I currently for DeusEx check if the passed in FSceneNode pointer changed in DrawTile, which works in this case, but isn't great either.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Yep, Viewport window misses a call to ComputeRenderSize() and hack to work around it is gone.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Post Reply