Re: zBase (32bpp base set by Zephyris) - Coder needed!
Posted: 17 Jul 2012 20:15
just a quick test, the following powershell 3.0 script ran from your \infrastructure\road\roadbits\road_stations directory produced the following output
Code: Select all
$grfName = "TestCompile"
$GFXdir = ".\"
Write-Output "grf {
grfid: `"AB\01\01`";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
version: 0;
min_compatible_version: 0;
}" | out-file -FilePath .\$($grfName).nml -Encoding "UTF8" -Append
$si = (Get-ChildItem .\ -Recurse -Include *.png -Exclude *m_*.png|
select fullname, basename,
@{n='Index'; e={($_.BaseName).split("_")[1]}},
@{n='ZM'; e={($_.BaseName).split("_")[0]}}|
Group-Object -Property Index -AsHashTable).GetEnumerator() | sort {[int]$_.Key}
foreach ($i in $si) {
Write-Output "replace hd_$($i.Name) ($($i.Name)) {[0, 0, `".\gfx\empty.png`"]}" | out-file -FilePath .\$($grfName).nml -Encoding "UTF8" -Append
foreach ($z in $i.Value.GetEnumerator()) {
switch (($z.BaseName).Split("_")[0]){
"256" {$zm = "IN_4X"
$xoffset = -124
$yoffset = -132}
"128" {$zm = "IN_2X"
$xoffset = -62
$yoffset = -66}
default {$zm = "NORMAL"
$xoffset = -31
$yoffset = -33}
}
if ((Test-Path (".\$($z.ZM)m_$($z.Index).png")) -eq $true){
$mk = ", `".\$($z.ZM)m_$($z.Index).png`""
}
else {$mk = ""}
Write-Output "alternative_sprites (hd_$($z.Index), ZOOM_LEVEL_$($zm), BIT_DEPTH_32BPP)
{
[$($xoffset), $($yoffset), `"$($z.FullName)`"$($mk)]
}" | out-file -FilePath .\$($grfName).nml -Encoding "UTF8" -Append
}
}