blob: 4ba11f774752f8a904a4f9cfbf7c7c5224c32eeb (
plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#!/bin/sh
# Filename: set-effects.sh
# Locations: https://gitlab.com/bgstack15/aoe2de-seteffects
# /mnt/public/Support/Games/aoe2de-on-linux/seteffects/
# Author: bgstack15@gmail.com
# Startdate: 2021-04-08
# SPDX-License-Identifier: CC-BY-SA-4.0
# Title: Set Effects for AoE2DE on Linux
# Purpose: Make it easy to enable or disable the specific effects in-game and in-menu
# Usage:
# ./set-effects.sh -i # to initialize
# ./set-effects.sh trim # to select trimmed effects
# ./set-effects.sh orig # to select original, full effects list
# Reference:
# https://github.com/gregstein/SenseiDE
# specifically its MO.zip and DF.zip files.
# and the logic for manipulating these zip files and also the atlases/*json files
# Improve:
# Documentation:
test -z "${SE_COMMON_DIR}" && SE_COMMON_DIR=~/.local/share/Steam/steamapps/common/AoE2DE/resources/_common
SE_WPFG_DIR="${SE_COMMON_DIR}/wpfg"
SE_WPFG_ORIG_DIR="${SE_COMMON_DIR}/wpfg-orig"
SE_WPFG_DF_DIR="${SE_COMMON_DIR}/wpfg-df"
SE_WPFG_MO_DIR="${SE_COMMON_DIR}/wpfg-mo"
SE_DF_ZIP="/mnt/public/Support/Games/aoe2de-on-linux/seteffects/DF.zip" # DF_ZIP is the bog-standard menu objects
SE_MO_ZIP="/mnt/public/Support/Games/aoe2de-on-linux/seteffects/MO.zip" # MO_ZIP is the stripped-down menu objects that are the value-add from SenseiDE
SE_STATUS_FILE="${SE_COMMON_DIR}/.set-effects.txt"
SE_ATLASES_DIR="${SE_COMMON_DIR}/particles/textures/atlases"
init() {
echo "Initializing."
# validate all inputs first
if test ! -r "${SE_DF_ZIP}" || test ! -r "${SE_MO_ZIP}" || test ! -d "${SE_WPFG_DIR}" || \
test ! -d "${SE_ATLASES_DIR}" ;
then
{
echo "Not all dependencies are met. Ensure:"
echo "${SE_DF_ZIP} is a zip."
echo "${SE_MO_ZIP} is a zip."
echo "${SE_WPFG_DIR} exists as a dir."
echo "${SE_ATLASES_DIR} exists as a dir."
} 1>&2
exit 1
fi
# backup orig dir
if test -d "${SE_WPFG_ORIG_DIR}" ;
then
# we are initializing, but a backup dir already exists...
export SE_WPFG_ORIG_DIR="${SE_WPFG_ORIG_DIR}.$( date "+%F" )"
echo "Using a backup dirname of ${SE_WPFG_ORIG_DIR}"
fi
# starting fresh. Let's back up the orig files.
cd "$( dirname "${SE_WPFG_ORIG_DIR}" )" ; cp -pr "${SE_WPFG_DIR}" "$( basename "${SE_WPFG_ORIG_DIR}" )"
cd "$( dirname "${SE_ATLASES_DIR}" )" ; cp -pr "$( basename "${SE_ATLASES_DIR}" )" "$( basename "${SE_ATLASES_DIR}" ).$( date "+%F" )"
# explode MO zip
mkdir -p "${SE_WPFG_MO_DIR}"
cd "${SE_WPFG_MO_DIR}" ; 7za -aoa x "${SE_MO_ZIP}"
# explode DF zip, and fix filenames
mkdir -p "${SE_WPFG_DF_DIR}"
cd "${SE_WPFG_DF_DIR}" ; 7za -aoa x "${SE_DF_ZIP}"
cd dialog ; for word in * ; do newword="$( echo "${word}" | sed -r -e 's/^dialogDialog/Dialog/;' -e 's/^dialogdialog/dialog/;' )" ; test "${newword}" != "${word}" && mv "${word}" "${newword}" ; done
# touch status file
date -u "+%FT%TZ" > "${SE_STATUS_FILE}"
echo "Done with initialization."
}
switch_to() {
# call: switch_to trim
# or switch_to orig
___st_target="${1}"
case "${___st_target}" in
"trim"|"MO")
# the good stuff
cd "${SE_WPFG_DIR}"
for word in screen dialog ;
do
cd "${word}" ; cp -pr "${SE_WPFG_MO_DIR}/${word}"/* .
cd ..
done
# disable in-game effects
cd "${SE_ATLASES_DIR}" ; mkdir -p off
mv -f *.json off/
cd off
# hardcoded effects I want to keep.
mv -i villager_* trails* upgrade* water_des* laser* fire* explos* unit_dust* snow_* \
impact_petard* impact_explo* impact_treb* research* spawn* \
..
;;
"orig"|"DF")
# original menu assets
cd "${SE_WPFG_DIR}"
for word in screen dialog ;
do
cd "${word}" ; cp -pr "${SE_WPFG_DF_DIR}/${word}"/* .
cd ..
done
# re-enable all in-game effects
cd "${SE_ATLASES_DIR}"
if ! test -d "off" ;
then
echo "No in-game effects to re-enable."
else
mv -f off/*.json .
rmdir off
fi
;;
*)
echo "Choose orig or trim, to set the menu effects and some in-game effects for AoE2DE."
#echo "Option ${___st_target} not supported yet. Aborted." 1>&2 ; exit 1
;;
esac
}
# MAIN
# initialize if necessary
if test ! -f "${SE_STATUS_FILE}" || echo " ${@} " | grep -qE -e ' -i\>| --init(ialize)?\>' ;
then
init
fi
switch_to "${1}"
|