Fixing UI Changes since 1.3.6.?

Moderators: GSH, VSMIT, Red Devil, Commando

User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Fixing UI Changes since 1.3.6.?

Post by TheJamsh »

Just going through the changelog and I spotted this, which might explain why some of *my mods* shells aren't loading up properly in the game:

Code: Select all

- Upscaled the shell UI too -- I got tired of looking at fonts that
were blown up way past any reasonable limit. This uses a different
function in the uirescaler.lua file, one that just looks at the screen
size and tries to do the largest fit within that. This ***IS*** a
breaking change -- MP mods with custom Extra Options pages will need
to have four additional resolutions converted in order to place that
page onscreen in the correct place. I've posted batch file (using
Strawberry Perl) and Cygwin bash script file that expand the stock UI;
modders should be able to figure out how to run that locally.[NM]
This may explain why my custom shell isn't overriding the default one in some places and why my multi_shell pages have gone berserk. Can I ask where that batch files is, and does it simply create the rescaled shells for me? Otherwise; holy **** that's a lot of work for what could have been just replacing the font with a nicer one. I'm presuming it does everything itself, since I can't see anyone on the 1.3 team wanting to take on making a hella-lot of unforgiving .cfg files at different resolutions...

Will simply dragging and dropping my custom .cfg files onto the batch make it do it's job? Or am I still going to have to change things manually afterwards? For those interested, they are additional Extra_Options pages and a few of my own tweaks to the regular shell that IMO make it more appealing and fit together nicer, and also support the mod.
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
GSH
Patch Creator
Posts: 2485
Joined: Fri Feb 18, 2011 4:55 pm
Location: USA
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by GSH »

Before you continue thinking that "replacing the font with a nicer one" was a solution in any way, shape or form, get your now outdated mod out of the picture, and run 1.3.6.5-stock at a high resolution, say 1920x1080. Your approach was the broken one. The 1.3.6.5 approach was far simpler and cleaner. And, it looks much better at 640x480 smoothly up to say 2240x1680; past that it'll be far better than 1.0-1.3.6.4 ever was, but not ideal.

And learn to search. I posted the upscaler link on this board. It's been a while, it's down to the 5th page already.

-- GSH
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by General BlackDragon »

Also note: The UI Scaler resolution files override the old naming scheme. i.e.: bzshell_x2_0.cfg would be used before bzshell_800x600.cfg.

for the in shell ui this works fine. The only place you might want to still use the old file naming system is ingame ui, but you shouldn't really need to unless your doing something specific.

As for fonts, yes, the scaled up fonts look nicer. N1 made a custom Font editor and GSH also made one. TJ should really get on Skype or something with me, I can walk you through making all the needed things, even got some nice customized UI scaler scripts. :)
Battlezone Classic Public Forums
*****General BlackDragon*****
User avatar
Ded10c
Recycler
Posts: 3815
Joined: Sun Feb 20, 2011 11:05 am
Location: Stoke-on-Trent
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by Ded10c »

Side note; why did the font change? I assume Bank Gothic's license doesn't cover what you're doing?
battlezone.wikia.com needs your help!
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by Zero Angel »

Another side note. I wonder if font hinting has changed between versions since the fonts do end up looking slightly different.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by Nielk1 »

This is pretty much the one change in a long time I've hated with a passion.
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: Fixing UI Changes since 1.3.6.?

Post by TheJamsh »

General BlackDragon wrote:Also note: The UI Scaler resolution files override the old naming scheme. i.e.: bzshell_x2_0.cfg would be used before bzshell_800x600.cfg.
Ah interesting, that's not in ze changelog. Do the In-Game ones respond to the new naming conventions? I don't have Skype anymore btw, unless I'm in work and naturally can't get away with it there! So long as I can just quickly update these pages, I'm all fine.

Out of interest, has anybody run into any issues with the upscaler so far, like buttons being in the wrong place at certain resolutions etc?
GSH wrote:And learn to search. I posted the upscaler link on this board. It's been a while, it's down to the 5th page already.
I did search, but the search function of the forum is slightly broken. Whenever I try to click on the next page, it thinks I'm doing a "new search" and I have to wait 30 seconds. At that point it's quicker to write a new thread. Any possibility that can be fixed?
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by General BlackDragon »

No I havn't had buttons in wrong places.

And yes, the search limit thing is annoying, If I search for something and i need to "tweak" the key words to refine it, it doesnt let me do it immediately. :(
Battlezone Classic Public Forums
*****General BlackDragon*****
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by Zero Angel »

If the forum's built-in search is too restrictive/slow then Google may be your friend.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: Fixing UI Changes since 1.3.6.?

Post by TheJamsh »

So the only question remains, how on earth do I use it?

I've installed Cygwin & Strawberry Perl. Tried running the .bat by double clicking it with my files in the same directory, no avail. Tried dragging and dropping, no avail. Does it read from specific directories or something?

Edit: No, it doesn't.
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
Red Devil
Recycler
Posts: 4398
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains

Re: Fixing UI Changes since 1.3.6.?

Post by Red Devil »

you may need to modify the .bat file to pull in your own names.
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: Fixing UI Changes since 1.3.6.?

Post by TheJamsh »

Hmm, I'm also overriding some of the default pages and it's not creating those either, and I'm sure they're already in the batch file.

Man... I have to edit it? It's like 25 rows and 1,000 columns of pure text :/
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by General BlackDragon »

This is where my version a lot easier to use, it just runs over an entire folder. :D

Here is the script I use, modified with extensive help from Ken.

Changes: Takes in 2 parameters now, Width and Height, and runs over an entire folder with the source CFGs, and creates the appropriate versions in the appropriate foldres.

Code: Select all

#!/usr/bin/perl

use POSIX;

############################## Start Script ###################################

$numArgs = $#ARGV + 1;

if($numArgs < 3)
{
	print STDERR "Expected expandui.pl scaleNumberX scaleNumberY fileNameModifier <input.cfg >output.cfg\n";
	print STDERR " e.g.   expandui.pl 2 2 _x2_0 <bzgame_command.cfg >bzgame_command_x2_0.cfg\n";
	exit(1);
}

my $xScaleMultiplier = $ARGV[0];
my $yScaleMultiplier = $ARGV[1];

my $filenameModifier = $ARGV[2];

# Read from standard input
my $line;
while($line = <STDIN>)
{
	$line =~ s/\n//;
	$line =~ s/\r//;
	chomp($line);

	# Handle various types of lines

	if(($line =~ /^\s*BorderSize\(/i) || 
	   ($line =~ /^\s*BevelSize\(/i) || 
	   ($line =~ /^\s*SliderPadding\(/i))
	{
		# Has 1 parameter, needing upscaling
		my $indexopen = index($line, "(");
		my $indexclose = index($line, ")");
		if(($indexopen == -1) || ($indexclose == -1) || ($indexclose < $indexopen))
		{
			# Doesn't have parens in right place. Print this line out as-is
			print "$line\n";
		}
		else
		{
			# Move the actual parens inside what's in left/right chunks
			$indexopen++;

			my $lineLeft = substr($line, 0, $indexopen); # up to (
			my $lineMid = substr($line, $indexopen, $indexclose - $indexopen); # between (), i.e. '10'
			my $lineRight = substr($line, $indexclose, 999999); # ) to end of line
			$lineMid = floor(($lineMid * $xScaleMultiplier) + 0.5);
			print "$lineLeft$lineMid$lineRight\n";
		}
	}
	elsif(($line =~ /^\s*Pos\(/i) || 
	   ($line =~ /^\s*Position\(/i) || 
	   ($line =~ /^\s*TabSize\(/i) || 
	   ($line =~ /^\s*CellSize\(/i) || 
	   ($line =~ /^\s*Size\(/i) || 
	   ($line =~ /^\s*Hotspot\(/i))
	{
		# Has 2 parameters, needing upscaling
		my $indexopen = index($line, "(");
		my $indexclose = index($line, ")");
		if(($indexopen == -1) || ($indexclose == -1) || ($indexclose < $indexopen))
		{
			# Doesn't have parens in right place. Print this line out as-is
			print "$line\n";
		}
		else
		{
			# Move the actual parens inside what's in left/right chunks
			$indexopen++;

			my $lineLeft = substr($line, 0, $indexopen); # up to (
			my $lineMid = substr($line, $indexopen, $indexclose - $indexopen); # between (), i.e. '5, 5'
			my $lineRight = substr($line, $indexclose, 999999); # ) to end of line

			# Read all parameters in the middle of the line
			my @myarray = split(',', $lineMid);

			$myarray[0] = floor(($myarray[0] * $xScaleMultiplier) + 0.5);
			$myarray[1] = floor(($myarray[1] * $yScaleMultiplier) + 0.5);

			# Reassemble the middle piece of the line, then the whole
			# line for output.
			$lineMid = join(', ', @myarray);
			print "$lineLeft$lineMid$lineRight\n";
		}
	}
	elsif($line =~ /^\s*Image\(/i)
	{
		my $indexopen = index($line, "(");
		my $indexclose = index($line, ")");
		if(($indexopen == -1) || ($indexclose == -1) || ($indexclose < $indexopen))
		{
			# Doesn't have parens in right place. Print this line out as-is
			print "$line\n";
		}
		else
		{
			# Move the actual parens inside what's in left/right chunks
			$indexopen++;
			my $lineLeft = substr($line, 0, $indexopen); # up to (
			my $lineMid = substr($line, $indexopen, $indexclose - $indexopen); # between (), i.e. '"colorize.tga", 7, 0'
			my $lineRight = substr($line, $indexclose, 999999); # ) to end of line

			my @myarray = split(',', $lineMid);

			my $arrayCount = scalar @myarray;

			# Upscale the image filename and texture coords, for colorize.tga ONLY
			if($myarray[0] =~ /colorize.tga/i)
			{
				$myarray[0] =~ s/\.tga/$filenameModifier\.tga/;
				# Has 1, 3 or 5 arguments. If 3 or 5, upscale the params past the first
				if($arrayCount == 5)
				{
					$myarray[3] = floor(($myarray[3] * $xScaleMultiplier) + 0.5);
					$myarray[4] = floor(($myarray[4] * $yScaleMultiplier) + 0.5);
				}
				if($arrayCount >= 3)
				{
					$myarray[1] = floor(($myarray[1] * $xScaleMultiplier) + 0.5);
					$myarray[2] = floor(($myarray[2] * $yScaleMultiplier) + 0.5);
				}
			}
			# Reassemble the middle piece of the line, then the whole
			# line for output.
			$lineMid = join(',',@myarray);
			print "$lineLeft$lineMid$lineRight\n";
		}
	}
	elsif($line =~ /^\s*Exec\(/i)
	{
		# Warn out if not on input filenames
		my $checkIndex = 2;
		my $bFound = 0;
		my @myarray = split('"', $line);
		for($checkIndex = 2; $checkIndex < ($numArgs); ++$checkIndex)
		{
			if($ARGV[$checkIndex] =~ /$myarray[1]/i)
			{
				$bFound = 1;
				break;
			}
		}
		if(!$bFound)
		{
			print STDERR " Extra file included: $line\n";
		}
		$line =~ s/.cfg/$filenameModifier.cfg/;
		print "$line\n";
	}
	else
	{
		# print this line out as-is
		print "$line\n";
	}
} # while($line = <INFILE>)

exit(0);
Run with a BAT file like something similar:

Code: Select all

pushd .\Shell\

REM Do main shell components:

mkdir  Shell_x1_5 
FOR %%A IN ("*.cfg") DO perl ..\Scripts\expandui.pl 1.5 1.5 _x1_5 <"%%A" >"Shell_x1_5\%%~nA_x1_5%%~xA"

mkdir  Shell_x2_0 
FOR %%A IN ("*.cfg") DO perl ..\Scripts\expandui.pl 2.0 2.0 _x2_0 <"%%A" >"Shell_x2_0\%%~nA_x2_0%%~xA"

mkdir  Shell_x2_5 
FOR %%A IN ("*.cfg") DO perl ..\Scripts\expandui.pl 2.5 2.5 _x2_5 <"%%A" >"Shell_x2_5\%%~nA_x2_5%%~xA"

mkdir  Shell_x3_0 
FOR %%A IN ("*.cfg") DO perl ..\Scripts\expandui.pl 3.0 3.0 _x3_0 <"%%A" >"Shell_x3_0\%%~nA_x3_0%%~xA"

PAUSE

REM Back to starting directory
popd
Last edited by General BlackDragon on Mon Jun 30, 2014 2:08 pm, edited 1 time in total.
Battlezone Classic Public Forums
*****General BlackDragon*****
User avatar
GSH
Patch Creator
Posts: 2485
Joined: Fri Feb 18, 2011 4:55 pm
Location: USA
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by GSH »

What part of the BZ2 toolchain has ever had drag-and-drop? You must be mistaking BZ2 for a project with a lot more programmers.

-- GSH
User avatar
GSH
Patch Creator
Posts: 2485
Joined: Fri Feb 18, 2011 4:55 pm
Location: USA
Contact:

Re: Fixing UI Changes since 1.3.6.?

Post by GSH »

Side note; why did the font change? I assume Bank Gothic's license doesn't cover what you're doing?
Because we don't know what font (and settings) was originally used. There's a bunch of variants that are similar, but nobody has been able to satisfactorily reconstruct the BZ2 bitmap fonts with any of the Truetype fonts, and the program(s) available. Hint: this is a challenge that anyone can undertake: rebuild the existing font files, getting them looking as close as possible, and document how it was used. Bonus points for not using the piece-of-junk font converter from the 1990s that crashes early and often nowadays.

The tiny font was never Bank Gothic. It used a Windows bitmap font that's only available in a few sizes. That's why I switched to the Droid Sans font -- it's close enough, freely available, and available in any size. Challenge #2 to everyone: do better, document it. Everyone will benefit.

-- GSH
Post Reply