-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOMPILE.ps1
More file actions
68 lines (50 loc) · 2.09 KB
/
COMPILE.ps1
File metadata and controls
68 lines (50 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env powershell
echo 'Compiler for Pak.Basic'
echo '--------------------------------------------------------'
function compile($paksize, $msg, $glob) {
echo '--------------------------------------------------------'
echo "Compiling $msg..."
$index=1
$dats=Get-ChildItem $glob
$size=($dats | Measure-Object).Count
foreach ($dat in $dats) {
# convert to linux style for compatibility between systems
$relative=($dat | Resolve-Path -Relative).Substring(2).Replace('\', '/')
./makeobj.exe "pak$paksize" ./compiled/ "$relative" > $null 2> $null
if ($LASTEXITCODE -gt 0) {
echo "Error: Makeobj returned an error for $relative. Aborting..."
exit $LASTEXITCODE
}
Write-Progress -Activity "Compiling $msg" -Status "$relative" -PercentComplete (100*$index/$size)
$index++
}
}
Write-Host -NoNewline 'Checking for makeobj... '
if (!(Test-Path makeobj.exe)) {
echo 'ERROR: makeobj not found in root folder.'
exit 2
}
echo 'OK'
# Create folder for *.paks or delete all old paks if folder already exists
if (!(Test-Path compiled)) {
mkdir compiled > $null
echo 'created "compiled" dir'
}
compile '192' 'Buildings' 'buildings/*.dat'
compile '192' 'Industry' 'industry/*.dat'
compile '192' 'Infrastructure' 'infrastructure/*.dat'
compile '192' 'Landscape' 'landscape/ground/*.dat'
compile '192' 'Landscape' 'landscape/ground_objects/*.dat'
compile '192' 'Landscape' 'landscape/tree/*.dat'
compile '48' 'Landscape' 'landscape/pedestrians/*.dat'
#echo '--------------------------------------------------------'
echo "Moving Trunk (configs, sound, text)`n"
Copy-Item trunk/* compiled -Recurse -Force
compile '32' 'User Interface' 'UI/32/*.dat'
compile '64' 'User Interface' 'UI/64/*.dat'
compile '128' 'User Interface' 'UI/128/*.dat'
compile '192' 'User Interface' 'UI/192/*.dat'
compile '192' 'Vehicles' 'vehicles/*.dat'
echo '========================================================'
echo 'Pakset Complete!'
echo '========================================================'