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).
Post Reply
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bird
NSF
Posts: 86
Joined: Sat Sep 19, 2009 3:24 pm
Location: between your synaptic gap

Re: Minor things worth mentioning

Post by Bird »

Hanfling wrote:While working on improving my bitmap font exporter I ended up writing this line:

Code: Select all

guard(HandleTTF);
What this code does, in particular?
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Remember the callstack trace when a crash/voluntary app error occurs, like (when you enter DEBUG GPF):

Code: Select all

Critical: UEngine::Exec
Critical: UGameEngine::Exec
Critical: DDeusExGameEngine::Exec
Critical: UHXGameEngine::Exec
Critical: UPlayer::Exec
Critical: UViewport::Exec
Critical: UWindowsViewportLite::Exec
Critical: UObject::ProcessEvent
Critical: (HXConsole Transient.HXConsole0, Function Engine.Console.Typing.KeyEvent)
Critical: UEngine::InputEvent
Critical: UWindowsViewportLite::CauseInputEvent
Critical: KeyDown
Critical: UWindowsViewportLite::ViewportWndProc
Critical: (Message=WM_KEYDOWN,wParam=13,lParam=1835009)
Critical: WWindow::StaticProc
Critical: (Message=WM_KEYDOWN)
Critical: LaunchMainLoop
The guard[Slow] and corrosponding unguard[Slow|f] macros are responsible for this. And the HandleTTF guard block is around a detection of an imported TTF font and putting out an unsupported image in this case on my bitmap font exporter (which reconstruct those lines seperating the glyphs for import).

The pun is that in DeusEx's Engine\Classes\Canvas.uc is this line:

Code: Select all

#exec new TrueTypeFontFactory Name="LargeFont" FontName="HandelGothic BT" Height=32 AntiAlias=1 XPad=2 CharactersPerPage=64
Which samples the HandleGothic BT TTF font into an imported font.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bird
NSF
Posts: 86
Joined: Sat Sep 19, 2009 3:24 pm
Location: between your synaptic gap

Re: Minor things worth mentioning

Post by Bird »

Neat, thanks for your detailed explanation! I am happy to see there are improvements for localisation-related things in Deus Ex. One thing I was wondering about is DropShadowX/Y parameters does not seem to be implemented for TrueTypeFontFactory, thus one cannot recreate {FONTNAME}_DS Fonts.

Drawing font-sets with realistic dropshadow is extremely hard and tedious to do, how developers did that with that broken parameter is a mystery. Wish I could write proper code so I could help. I am very excited about your QtConEdit too.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Bird wrote:Neat, thanks for your detailed explanation! I am happy to see there are improvements for localisation-related things in Deus Ex. One thing I was wondering about is DropShadowX/Y parameters does not seem to be implemented for TrueTypeFontFactory, thus one cannot recreate {FONTNAME}_DS Fonts.
I never heard about this option.

I used this code for some tests with removing the flash fog when traveling and displaying a small half-life style loading messages with a drop shadow by rendering the same font two times.

Code: Select all

class RevConsole extends Console;

var(ActionMessage) bool bOldActionMessages; /** Use ugly old style action messages. */
var(ActionMessage) bool bShadeActionMessages; /** Whether to draw a fake font shadow for action messages. */
var(ActionMessage) Color ActionColor; /** Color of action messages. */
var(ActionMessage) Color ActionShadeColor; /** Shadow color of fake font shadow for action messages. */
var(ActionMessage) Font ActionFont; /** Font used for action messages. */

/** Renders the level action like LOADING or PRECACHING on screen. */
function DrawLevelAction( canvas C )
{
	local string BigMessage;

	// DEUS_EX AJY - don't want to print any text 
	// if the game is paused because we're in a menu
	if (Viewport.Actor.bShowMenu )
	{
		BigMessage = "";
		return;
	}
	if ( (Viewport.Actor.Level.Pauser != "") && (Viewport.Actor.Level.LevelAction == LEVACT_None) )
	{
		if ( bOldActionMessages )
		{
			C.Font = C.BigFont;
			C.Style = 1;
			C.DrawColor.R = 255;
			C.DrawColor.G = 255;
			C.DrawColor.B = 255;

			BigMessage = PausedMessage; // Add pauser name?
			PrintActionMessage(C, BigMessage);
		}
		else
			PrintShadedActionMessage( C, BigMessage );
		return;
	}
	else if ( Viewport.Actor.Level.LevelAction==LEVACT_Loading )
		BigMessage = LoadingMessage;
	else if ( Viewport.Actor.Level.LevelAction==LEVACT_Saving )
		BigMessage = SavingMessage;
	else if ( Viewport.Actor.Level.LevelAction==LEVACT_Connecting )
		BigMessage = ConnectingMessage;
	else if ( Viewport.Actor.Level.LevelAction==LEVACT_Precaching )
		BigMessage = PrecachingMessage;
	
	if ( BigMessage != "" )
	{
		if ( bOldActionMessages )
		{
			C.Style = 3;
			C.DrawColor.R = 0;
			C.DrawColor.G = 0;
			C.DrawColor.B = 255;
			C.Font = C.LargeFont;	
			PrintActionMessage(C, BigMessage);
		}
		else
			PrintShadedActionMessage( C, BigMessage );
	}
}

/** Helper for DrawLevelAction(), Location of action message is set here. */
function PrintActionMessage( Canvas C, string BigMessage )
{
	local float XL, YL;

	C.bCenter = False;
	C.StrLen( BigMessage, XL, YL );
	//C.SetPos( FrameX/2 - XL/2, FrameY/2 - YL/2 );
	// REV_HAN: Move this slightly over crosshair.
	// Probably 16-24 is better for 1x, but would conflict on 2x.
	C.SetPos( FrameX/2 - XL/2, FrameY/2 - YL/2 - 32);
	C.DrawText( BigMessage, False );
}

/** Helper for DrawLevelAction() with shading support, Location of action message is set here. */
function PrintShadedActionMessage( Canvas C, string BigMessage )
{
	local float X, Y, XL, YL;

	// All style related properties here.
	C.Style   = 1;
	C.Font    = ActionFont;
	C.bCenter = False;
	C.StrLen( BigMessage, XL, YL );

	// Move this slightly over crosshair. Probably 16-24 is better for 1x, but would conflict on 2x.
	X = FrameX/2 - XL/2;
	Y = FrameY/2 - YL/2 - 32;

	// Draw fake shadow first.
	if ( bShadeActionMessages )
	{
		C.DrawColor = ActionShadeColor;
		C.SetPos( X+1, Y+1 );
		C.DrawText( BigMessage, False );
	}

	// Draw action message.
	C.DrawColor = ActionColor;
	C.SetPos( X, Y );
	C.DrawText( BigMessage, False );
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

defaultproperties
{
	bShadeActionMessages=False
	bOldActionMessages=True
	ActionColor=(R=127,G=127,B=127)
	ActionShadeColor=(R=0,G=0,B=0)
	ActionFont=Font'Engine.SmallFont'
}
But for an art only solution, you could try by copying the font and just move the font by (1px,1px) and making it black, but dont use your mask palette index for it. Because you sound like you use the TTF font importer, you could use batchexport to export the fontpages textures, do this copy, black & move, and reimport the texture in Editor afterwards. If that doesnt work over GUI, just use the commandline in the logwindow.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bird
NSF
Posts: 86
Joined: Sat Sep 19, 2009 3:24 pm
Location: between your synaptic gap

Re: Minor things worth mentioning

Post by Bird »

DropShadow stuff: https://wiki.beyondunreal.com/Legacy:Tr ... ontFactory
Long ago, I was working on some code-improvements to get that dropshadow effect in-game. Just copy and compile. Works best with newly-imported TTF.
Attachments
backport_shadow.zip
DropShadow ramblings.
(15.5 KiB) Downloaded 596 times
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Well the Wiki entry clearly says only UT2003.

If you can get me the exact calculations UT2003 uses for the offset, e.g. how DropShadowX/Y relates to the offset itsself, I'll try to make a subclass of the existing truetype font factory and do the shadow adding as a post process step as i can easily use the XPad/YPad options to get more space for the shadow itsself on the texture.

/edit:
At the same time i should add an option for premultiplying alpha, as the PF_Highlighted rendering mode used for antialiased TTF fonts is pre multiplied alpha blending, while the font textures themself seem to be non premultiplied alpha, though this can be an issue when the texture is not stored in an sRGB format, which in turn would require a dependency on my renderdevice. Maybe I add an sRGB option too.

/edit2:
Looks like they use a Compress option and passing the texture format id, that looks resonble. I want to add code for this anyway to HTK, so this perfectly fits in.
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 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 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 »

So we had yesterday a discussion about the PSX2 version of Deus Ex.

Some findings:
The *.RAW files are loading screens stored as raw 640x480 24bpp data. You can use IrfanViews open raw option to view those.
The *.PSS files are videos with MPEG2 video and PS2 PCM data. You can play them back with the proper codecs installed on your system.
For the music files one should try out ea's sx.exe and see if one can convert those with it (left in release version of Brother Bear), or maybe find some codec/converter/program which can handle them.

Now to the fun part. The game data is apparently stored in three *.UMD files, while one of those (the most interessting one) is somehow hidden or sth.
These *.UMD files contain the unreal packages, and are "arc" files. There is some FFileManagerArc.h header in ut432pubsrc. The code is enough to know how to extract them (I just wrote some commandlet for HTK to do it). To my huge suprise these packages seem to be at least partially binary compatible with the PC version of Deus Ex. DeusExUIDynamic.u contains the datavault images and some ui screens and can just be extracted with batchexport. The DeusExTextData.u assumes the ExtString class to be in DeusExText package instead of beeing in Extension package. I made up some new DeusExText.dll with some basic implementation of ExtString (just implementing Serialize() should be enough). Afterward I just used my HTK ExtString exporter code to export it. Apparently not much has changed compared to DeusExText, though they have some tags for keycodes and logins inside the text files. Seems like a nice idea to copy for making the login stuff a bit more automatic (for controller support). Fun fact: The quotes file seems to be in spanish in the english version. Some further packages failed to load due to unsatisfied dependencies, so adding these and trying to load the packages again might for. The level files have the extension *.lin and crash upon load, haven't yet checked into this in detail yet though.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bird
NSF
Posts: 86
Joined: Sat Sep 19, 2009 3:24 pm
Location: between your synaptic gap

Re: Minor things worth mentioning

Post by Bird »

Interesting stuff! I used to have a Spanish version of Deus Ex (had no chance to look at the files back then).

I wonder if conversation audio files would be the same 8000 Hz quality MP3's as on the PC version.

This was exciting to read, thanks for posting it.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

New HTK build. Changes include, but are not limited too:

UnArcCommandlet
Extract those PSX2LINS.UMD/PSX2SHIP.UMD of the PSX2 version of Deus Ex.

FullBatchExportCommandlet
Extracts what it can out of package and places the contents into the appropreciate directory structure for build commandlet.

FontExporter
Reconstructs the source texture of bitmap fonts (NOT TTF!). As far as I can tell this works perfectly for Nerf and Deus Ex. After import you get exact the same result as it was before (so no screwups with characters in the CP850 to Latin1 range anymore).

FontPageDiffCommandlet
Compares the glypth texture coordinates of two fonts. I created this to make sure the FontExporter works correct as this can be used to make sure the font ended up as before after reimport.

http://coding.hanfling.de/launch/releas ... 160618.zip
Last edited by Hanfling on Mon Jun 20, 2016 5:59 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.
User avatar
Andrievskaya Veronika
UNATCO
Posts: 151
Joined: Wed Mar 21, 2007 5:36 am
Location: Somewhere in Russia
Contact:

Re: Minor things worth mentioning

Post by Andrievskaya Veronika »

The link is broken :?
User avatar
Bird
NSF
Posts: 86
Joined: Sat Sep 19, 2009 3:24 pm
Location: between your synaptic gap

Re: Minor things worth mentioning

Post by Bird »

That sounds fantastic. I need to get FontExporter a spin when I have the chance.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Minor things worth mentioning

Post by Hanfling »

Andrievskaya Veronika wrote:The link is broken :?
Fixed it now.

Maybe worth to mention, if you use batchexport commandlet, you need some ucc executable which autoloads UExporters by int entries. The LCC inside my Launch release does that, links should be above. If you use the HTK fullbatchallexport commandlet it gets autoloaded as the native dll gets bounds, so it's not needed for the fullbatchexport commandlet.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Post Reply