-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48a3448
commit 534c708
Showing
118 changed files
with
2,346 additions
and
2,230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
|
||
Wrapper for HANDLE_CHARSETS with UFT8 as default. Code taken from charset_wrapper by DavidW. | ||
|
||
Features: | ||
- UFT8 as default | ||
- out_path changed to weidu_external/%MOD_FOLDER%/lang | ||
- support 'lang', 'language, or 'tra' out-of-the-box | ||
- no dependencies and ability to run without AUTO_EVAL_STRINGS | ||
- copies files over to weidu_external/%MOD_FOLDER%/lang, whether or not conversion is required | ||
- makes sure all tra are present by using default-language ones if preferred-language ones aren't available | ||
|
||
Usage: | ||
- default_language: the language the mod is written in, if it's not English | ||
- tra_path: the location of your tra files if it's not 'lang', 'language, or 'tra' | ||
- setup_tra: the tra file you keep component names in, if it's not setup.tra | ||
- load: a space-separated list of tra files you want always to load (the .tra is optional) | ||
|
||
Returns: | ||
- out_path: is where the language files are copied to, changed to weidu_external/%MOD_FOLDER%/lang. | ||
|
||
*/ | ||
|
||
DEFINE_ACTION_FUNCTION handle_charsets_utf8 | ||
STR_VAR | ||
default_language="english" // set to whatever language you wrote the mod in | ||
setup_tra="setup" // set to whatever you're keeping your WEIDU installation strings in | ||
load="" // set to a space-separated list of any tra files you want loaded | ||
tra_path="" // if it's not 'lang', 'language, or 'tra' | ||
RET | ||
out_path | ||
BEGIN | ||
OUTER_SPRINT out_path "weidu_external/%MOD_FOLDER%/lang" | ||
// find the tra location | ||
ACTION_IF "%tra_path%" STR_EQ "" BEGIN | ||
// try to guess 'lang', 'language, or 'tra' | ||
ACTION_IF DIRECTORY_EXISTS "%MOD_FOLDER%/lang" BEGIN | ||
OUTER_SPRINT tra_path "%MOD_FOLDER%/lang" | ||
END ELSE | ||
ACTION_IF DIRECTORY_EXISTS "%MOD_FOLDER%/language" BEGIN | ||
OUTER_SPRINT tra_path "%MOD_FOLDER%/language" | ||
END ELSE | ||
ACTION_IF DIRECTORY_EXISTS "%MOD_FOLDER%/tra" BEGIN | ||
OUTER_SPRINT tra_path "%MOD_FOLDER%/tra" | ||
END ELSE BEGIN | ||
FAIL "handle_charsets_utf8 error: you didn't specify tra_path and it's not 'lang', 'language, or 'tra'." | ||
END | ||
END ELSE | ||
// add '%MOD_FOLDER%' if it's not there already | ||
ACTION_IF !(INDEX ("%MOD_FOLDER%" "%tra_path%")=0) BEGIN | ||
OUTER_SPRINT tra_path "%MOD_FOLDER%/%tra_path%" | ||
END | ||
// set the no-copy array | ||
ACTION_CLEAR_ARRAY noconvert_array | ||
OUTER_SPRINT $noconvert_array(0) "%setup_tra%" | ||
// set the reload array | ||
ACTION_CLEAR_ARRAY reload_array | ||
OUTER_PATCH "%load% " BEGIN | ||
ind=0 | ||
REPLACE_EVALUATE "\([^ ]+\) " BEGIN | ||
SPRINT $reload_array("%ind%") "%MATCH1%" | ||
++ind | ||
END | ||
"" | ||
END | ||
// are we on enhanced edition? | ||
// later versions of EE have bgee.lua. Very early versions of BGEE have monkfist.2da | ||
OUTER_SET enhanced_edition=( FILE_EXISTS_IN_GAME bgee.lua || FILE_EXISTS_IN_GAME monkfist.2da ) | ||
// are we converting? | ||
OUTER_SET convert=!(enhanced_edition) | ||
ACTION_IF convert AND !FILE_EXISTS "%tra_path%/iconv/iconv.exe" BEGIN | ||
OUTER_SET convert=0 | ||
WARN "handle_charsets_utf8 warning: can't find iconv.exe" | ||
END | ||
ACTION_IF convert BEGIN | ||
OUTER_SPRINT iconv_path "%tra_path%/iconv" | ||
LAF HANDLE_CHARSETS | ||
INT_VAR from_utf8=1 | ||
infer_charsets=1 | ||
STR_VAR tra_path = EVAL "%tra_path%" | ||
out_path = EVAL "%out_path%" | ||
noconvert_array = noconvert_array | ||
reload_array = reload_array | ||
default_language = EVAL "%default_language%" | ||
END | ||
|
||
// run it again for the default language | ||
ACTION_IF !("%default_language%" STR_EQ "%LANGUAGE%") BEGIN | ||
LAF HANDLE_CHARSETS | ||
INT_VAR from_utf8=1 | ||
infer_charsets=1 | ||
STR_VAR tra_path = EVAL "%tra_path%" | ||
out_path = EVAL "%out_path%" | ||
noconvert_array = noconvert_array | ||
reload_array = reload_array | ||
language = EVAL "%default_language%" | ||
END | ||
END | ||
END ELSE BEGIN | ||
// do our own copies | ||
MKDIR "%out_path%/%LANGUAGE%" | ||
MKDIR "%out_path%/%default_language%" | ||
ACTION_BASH_FOR "%tra_path%/%default_language%" ".*\.tra$" BEGIN | ||
ACTION_IF !"%BASH_FOR_RES%" STR_EQ "%setup_tra%" BEGIN // don't bother copying this | ||
COPY "%tra_path%/%default_language%/%BASH_FOR_FILE%" "%out_path%/%default_language%" | ||
ACTION_IF !("%default_language%" STR_EQ "%LANGUAGE%") BEGIN | ||
ACTION_IF FILE_EXISTS "%tra_path%/%LANGUAGE%/%BASH_FOR_FILE%" BEGIN | ||
OUTER_SPRINT tra "%tra_path%/%LANGUAGE%/%BASH_FOR_FILE%" | ||
END ELSE BEGIN | ||
OUTER_SPRINT tra "%tra_path%/%default_language%/%BASH_FOR_FILE%" | ||
END | ||
COPY "%tra%" "%out_path%/%LANGUAGE%" | ||
END | ||
END | ||
END | ||
// do our own reloads | ||
ACTION_PHP_EACH reload_array AS int=>tra BEGIN | ||
ACTION_IF "%tra%" STRING_MATCHES_REGEXP ".+\.tra$" = 0 BEGIN | ||
LOAD_TRA "%out_path%/%LANGUAGE%/%tra%" | ||
END ELSE BEGIN | ||
LOAD_TRA "%out_path%/%LANGUAGE%/%tra%.tra" | ||
END | ||
END | ||
END | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
BACKUP ~tod/backup~ | ||
BACKUP ~weidu_external/tod/backup~ | ||
|
||
//AUTHOR ~Valiant ([email protected])~ | ||
SUPPORT ~http://forums.blackwyrmlair.net/index.php?showforum=117, http://gibberlings3.net/forums, http://www.shsforums.net, https://forums.beamdog.com~ | ||
|
||
VERSION ~v4.0.7~ | ||
VERSION ~v4.0.8~ | ||
|
||
README ~%MOD_FOLDER%/tod-readme.htm~ | ||
|
||
AUTO_TRA ~%MOD_FOLDER%/Tra/%s~ | ||
|
||
ALWAYS | ||
// Convert strings to UTF-8 for Enhanced Edition | ||
|
||
// setup.tra needs to be reloaded after conversion | ||
ACTION_DEFINE_ARRAY va#reload BEGIN setup END | ||
|
||
LAF HANDLE_CHARSETS // recursively converts all tra files found in tra_path | ||
INT_VAR | ||
infer_charsets = 1 | ||
STR_VAR | ||
tra_path = EVAL ~%MOD_FOLDER%/tra~ | ||
reload_array = va#reload | ||
END | ||
INCLUDE "%MOD_FOLDER%/lib/handle_charsets_utf8.tph" | ||
LAF handle_charsets_utf8 RET out_path END | ||
END | ||
|
||
AUTO_TRA "%out_path%/%s" | ||
|
||
// Don't use %MOD_FOLDER% for LANGUAGE until it will be fixed, https://forums.pocketplane.net/index.php?topic=29956.msg340386#msg340386 | ||
LANGUAGE ~English~ ~English~ ~tod/tra/English/setup.tra~ | ||
LANGUAGE ~Castellano (traducido por Clan REO y RPG-Bardo.com)~ ~Spanish~ ~tod/tra/Spanish/setup.tra~ | ||
|
@@ -36,26 +27,26 @@ LANGUAGE ~Polish (translated by Grzebul and Cuttooth)~ ~Polis | |
LANGUAGE ~Chinese~ ~Schinese~ ~tod/tra/Schinese/setup.tra~ | ||
|
||
BEGIN @100 | ||
REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | ||
REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | ||
|
||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
///// \\\\\ | ||
///// Tower of Deception Mod \\\\\ | ||
///// \\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
///// \\\\\ | ||
///// Tower of Deception Mod \\\\\ | ||
///// \\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ | ||
|
||
//////////////////////// | ||
// Appending MASTAREA // | ||
//////////////////////// | ||
//////////////////////// | ||
// Appending MASTAREA // | ||
//////////////////////// | ||
|
||
APPEND ~MASTAREA.2da~ ~va#mov value~ | ||
APPEND ~MASTAREA.2da~ ~va#001 value~ | ||
|
||
/////////////////// | ||
// Copying Files // | ||
/////////////////// | ||
/////////////////// | ||
// Copying Files // | ||
/////////////////// | ||
|
||
COPY ~%MOD_FOLDER%/Are~ ~override~ | ||
COPY ~%MOD_FOLDER%/Bam~ ~override~ | ||
|
@@ -66,9 +57,9 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
COPY ~%MOD_FOLDER%/Wav~ ~override~ | ||
COPY ~%MOD_FOLDER%/Wed~ ~override~ | ||
|
||
//////////////////// | ||
// Compiling Bafs // | ||
//////////////////// | ||
//////////////////// | ||
// Compiling Bafs // | ||
//////////////////// | ||
|
||
APPEND ~State.ids~ ~0x8010202D RZ_STATE_DISABLED~ //helpless, stunned, sleeping, charmed, feeblemindnes, confusion, panic | ||
UNLESS ~0x8010202D[ %TAB%]+RZ_STATE_DISABLED~ | ||
|
@@ -84,8 +75,8 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
|
||
COPY_EXISTING ~damages.ids~ ~override~ | ||
REPLACE_TEXTUALLY ~^0x0001 \(.+\)$~ | ||
~IDS V1.0 | ||
0x0001 \1~ | ||
~IDS V1.0 | ||
0x0001 \1~ | ||
UNLESS ~^IDS V1\.0~ | ||
|
||
APPEND ~Spell.ids~ ~4732 HELM_TRUE_SIGHT~ | ||
|
@@ -96,9 +87,9 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
|
||
COMPILE ~%MOD_FOLDER%/Baf~ | ||
|
||
//////////////////////////////// | ||
// Extending Existing Scripts // | ||
//////////////////////////////// | ||
//////////////////////////////// | ||
// Extending Existing Scripts // | ||
//////////////////////////////// | ||
|
||
PRINT @102 | ||
|
||
|
@@ -110,15 +101,15 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
|
||
EXTEND_TOP ~ar0021.bcs~ ~%MOD_FOLDER%/AppendBaf/ar0004.baf~ // also add to AR0021.bcs in case a mod patches AR0021.ARE to point to it instead | ||
|
||
/////////////////////// | ||
// Compiling Dialogs // | ||
/////////////////////// | ||
/////////////////////// | ||
// Compiling Dialogs // | ||
/////////////////////// | ||
|
||
COMPILE ~%MOD_FOLDER%/Dialog~ | ||
|
||
/////////////////// | ||
// Copying Items // | ||
/////////////////// | ||
/////////////////// | ||
// Copying Items // | ||
/////////////////// | ||
|
||
COPY ~%MOD_FOLDER%/Itm/va#book.itm~ ~override/va#book.itm~ | ||
SAY NAME1 @200 | ||
|
@@ -134,14 +125,14 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
COPY ~%MOD_FOLDER%/Itm/%res%.itm~ ~override/%res%.itm~ | ||
END | ||
|
||
/////////////////////// | ||
// Copying Creatures // | ||
/////////////////////// | ||
/////////////////////// | ||
// Copying Creatures // | ||
/////////////////////// | ||
|
||
COPY ~%MOD_FOLDER%/Cre/copy~ ~override~ | ||
|
||
ACTION_DEFINE_ASSOCIATIVE_ARRAY cre_assoc_array BEGIN | ||
//uniq-id, name1, name2 => cre | ||
//uniq-id, name1, name2 => cre | ||
a, 400, 400 => va#astsd // Astral Shard | ||
b, 401, 401 => va#balor // Baloar | ||
c, 403, 404 => va#gulin // Gulin, Gulin Murth | ||
|
@@ -169,9 +160,9 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
SAY NAME2 ( AT "%values_2%" ) // e.g. @404 for va#gulin | ||
END | ||
|
||
//////////////////////// | ||
// EE JOURNAL ENTRIES // | ||
//////////////////////// | ||
//////////////////////// | ||
// EE JOURNAL ENTRIES // | ||
//////////////////////// | ||
|
||
ACTION_IF GAME_IS ~BG2EE EET~ THEN BEGIN | ||
ADD_JOURNAL @17 @18 @19 @28 @30 @40 @41 @42 @43 @44 @45 @46 @47 @48 @49 | ||
|
@@ -183,9 +174,9 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
// @30 - va#panda.tra | ||
// @40 @41 @42 @43 @44 @45 @46 @47 @48 @49 - va#tian.tra | ||
|
||
//////////////////////// | ||
// Movie Installation // | ||
//////////////////////// | ||
//////////////////////// | ||
// Movie Installation // | ||
//////////////////////// | ||
|
||
PRINT @103 | ||
|
||
|
@@ -199,21 +190,21 @@ REQUIRE_PREDICATE GAME_IS ~BGT TOB BG2EE EET~ @101 // ToB required | |
|
||
PRINT @105 | ||
|
||
//////////////////////////////////// | ||
// Improved Astral Shard Guardian // | ||
//////////////////////////////////// | ||
//////////////////////////////////// | ||
// Improved Astral Shard Guardian // | ||
//////////////////////////////////// | ||
|
||
BEGIN @106 | ||
REQUIRE_FILE ~override/va#tod.nul~ @107 // ToD required | ||
REQUIRE_FILE ~override/va#tod.nul~ @107 // ToD required | ||
|
||
COMPILE ~%MOD_FOLDER%/ImpASG/va#maril.baf~ ~override/va#maril.bcs~ | ||
|
||
//////////////////////////// | ||
// Encounter with Ustrain // | ||
//////////////////////////// | ||
//////////////////////////// | ||
// Encounter with Ustrain // | ||
//////////////////////////// | ||
|
||
BEGIN @108 | ||
REQUIRE_FILE ~override/va#tod.nul~ @107 // ToD required | ||
REQUIRE_FILE ~override/va#tod.nul~ @107 // ToD required | ||
|
||
EXTEND_TOP ~baldur.BCS~ ~tod\Ustrain2\baldur.BAF~ | ||
EXTEND_TOP ~baldur25.BCS~ ~tod\Ustrain2\baldur.BAF~ | ||
|
Oops, something went wrong.