Release 4.3.4

This commit is contained in:
NovaRain
2022-04-07 20:46:58 +08:00
39 changed files with 403 additions and 934 deletions
+1
View File
@@ -0,0 +1 @@
*.ssl linguist-language=Pascal
+2 -2
View File
@@ -13,11 +13,11 @@ on:
jobs:
Build:
name: sfall
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Clone sfall
uses: actions/checkout@v2
uses: actions/checkout@v3
# Action is used twice for self-testing only
# DevXP build results are intentionally *not* included in artifact
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
+1 -1
View File
@@ -55,7 +55,7 @@ nb-configuration.xml
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Dd]evXP
[Dd]evXP/
[Rr]elease/
[Rr]eleases/
[Rr]eleaseXP/
+9 -3
View File
@@ -1,7 +1,10 @@
# sfall
[![github pages](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml)
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
[![License](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Dev Build](https://github.com/phobos2077/sfall/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/phobos2077/sfall/actions/workflows/build.yml)
[![GitHub Pages](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml)
A set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
**Engine modifications include:**
- Better support for modern operating systems
@@ -11,7 +14,10 @@ A set of engine modifications for the classic game Fallout 2 in form of a DLL, w
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
Original author: timeslip
Original author: **Timeslip**
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
---
#### Fallout Engine IDA Database
**[Download](https://www.dropbox.com/s/tm0nyx0lnk4yui0/Fallout_1_and_2_IDA68.rar "Download from Dropbox")** (comments are in Russian)
+2 -2
View File
@@ -4,10 +4,10 @@
Key=42
; Set to 1 to also highlight containers
Containers=1
Containers=0
; Set to 1 to also highlight lootable corpses
Corpses=1
Corpses=0
; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=0
+2 -5
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.3.3.1
;v4.3.4
[Main]
;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash
@@ -134,9 +134,6 @@ WorldMapTerrainInfo=0
;Set to 0 to leave the default unchanged (i.e. 4). The maximum is 32
NumSoundBuffers=0
;Set to 1 to enable fade effects for background music when stopping and starting the playback
FadeBackgroundMusic=1
;Set to 1 to allow attaching sound files to combat float messages
AllowSoundForFloats=0
@@ -332,7 +329,7 @@ Movie17=credits.mve
;To change the limit of the distance away from the player to which you're allowed to scroll the local maps, uncomment the next two lines
;Defaults are 480 in the x direction and 400 in the y direction.
;Not compatible with the hi-res patch!
;Does not work with the hi-res patch by Mash!
;LocalMapXLimit=480
;LocalMapYLimit=400
Binary file not shown.
+12 -12
View File
@@ -1,14 +1,14 @@
/*
Ammo INI Loader mod for Fallout 2 by NovaRain
---------------------------------------------
Ammo INI Loader mod v1.1 for Fallout 2 by NovaRain
--------------------------------------------------
- modifies ammo protos with data from an INI file:
* AmmoGlovz.ini if DamageFormula=1 or 2 in ddraw.ini
* AmmoYAAM.ini if DamageFormula=5 in ddraw.ini
* AmmoMod.ini if not using any bulit-in damage formula
Requires sfall 3.5 or higher
Requires sfall 4.0/3.8.29 or higher
*/
@@ -23,7 +23,7 @@ variable ammoData;
variable enabled;
procedure start begin
variable i := 1, ammo, ammoPid, dmgMod;
variable i := 1, ammo, ammoSection, dmgMod;
if game_loaded then begin
enabled := get_ini_setting("ddraw.ini|Misc|DamageFormula");
if (enabled == 1 or enabled == 2) then
@@ -37,19 +37,19 @@ procedure start begin
if (enabled <= 0) then return;
ammoData := create_array_map;
ammoPid := enabled; // pid from the first section
while (ammoPid > 0) do begin
ammoSection := get_ini_section(ammoIni, "" + i);
while (ammoSection.pid > 0) do begin
ammo := create_array_map; // create permanent arrays
ammo.ac_adjust := get_ini_setting(ammoIni + "|" + i + "|ac_adjust");
ammo.dr_adjust := get_ini_setting(ammoIni + "|" + i + "|dr_adjust");
ammo.ac_adjust := atoi(ammoSection.ac_adjust);
ammo.dr_adjust := atoi(ammoSection.dr_adjust);
// dam_mult and dam_div must be positive integers
dmgMod := get_ini_setting(ammoIni + "|" + i + "|dam_mult");
dmgMod := atoi(ammoSection.dam_mult);
ammo.dam_mult := dmgMod if (dmgMod > 0) else 1;
dmgMod := get_ini_setting(ammoIni + "|" + i + "|dam_div");
dmgMod := atoi(ammoSection.dam_div);
ammo.dam_div := dmgMod if (dmgMod > 0) else 1;
ammoData[ammoPid] := ammo;
ammoData[atoi(ammoSection.pid)] := ammo;
i++;
ammoPid := get_ini_setting(ammoIni + "|" + i + "|pid");
ammoSection := get_ini_section(ammoIni, "" + i);
end
call map_enter_p_proc;
debug_msg("Ammo INI Loader mod: " + ammoIni + " - set " + (i - 1) + " ammo protos.");
+3 -3
View File
@@ -1,5 +1,5 @@
Ammo INI Loader mod for Fallout 2 by NovaRain
---------------------------------------------
Ammo INI Loader mod v1.1 for Fallout 2 by NovaRain
--------------------------------------------------
- modifies ammo protos with data from an INI file:
* AmmoGlovz.ini if DamageFormula=1 or 2 in ddraw.ini
@@ -7,6 +7,6 @@ Ammo INI Loader mod for Fallout 2 by NovaRain
* AmmoMod.ini if not using any bulit-in damage formula
Requires sfall 3.5 or higher.
Requires sfall 4.0/3.8.29 or higher.
To use, copy gl_ammomod.int to your scripts folder, and copy the INI files to the same directory as sfall.
+2 -2
View File
@@ -21,5 +21,5 @@ This folder contains documentation about sfall scripting extensions.
hookscripts.md - detailed manual for using hook scripts to modify engine behavior
arrays.md - manual for sfall arrays
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in **.\compiler\sslc_readme.txt**.
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting language).
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in **.\compiler\sslc_readme.md**.
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting Language).
+5 -5
View File
@@ -16,10 +16,10 @@ This folder contains documentation about sfall scripting extensions.
lib.strings.h - search in strings, join, repeat, etc.
lib.misc.h - misc stuff
sfall function notes.txt - incomplete reference for new opcodes
sfall function notes.html - incomplete reference for new opcodes
sfall opcode list.txt - list of all sfall opcodes (w/o descriptions)
hookscripts.txt - detailed manual for using hook scripts to modify engine behavior
arrays.txt - manual for sfall arrays
hookscripts.html - detailed manual for using hook scripts to modify engine behavior
arrays.html - manual for sfall arrays
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in .\compiler\sslc_readme.txt.
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting language).
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in .\compiler\sslc_readme.html.
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting Language).
+1 -1
View File
@@ -201,7 +201,7 @@ _*mixed means any type_
#### `mixed scan_array(int arrayID, mixed value)`
- searches for a first occurence of given value inside given array
- if value is found, returns it's index (for lists) or key (for maps)
- if value is found, returns its index (for lists) or key (for maps)
- if value is not found, returns -1 (be careful, as -1 can be a valid key for a map)
#### `int len_array(int arrayID)`
@@ -1,99 +0,0 @@
The executation speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there's the potential for problems again, since sfall's global script system means that you can have a large amount of scripts being run every single frame.
======================
=== sslc -O option ===
======================
The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn't a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It's primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.
There are several levels of optimization available:
-O1 - Basic, only removes unreferenced globals variables and procedures, code itself remains untouched.
-O2 - Full, most code optimizations are on, but only those that were tested on complex scripts.
-O3 - Experimental, provides most efficiency, but tend to break some complex code due to bugs.
The following optimizations are performed:
> constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
a:=2+2; -> a:=4;
> constant variable initialization: All variables are initialised to some value, ('0', if you don't specify anything else,) so sslc attempts to make use of that fact to remove the first assignment to a variable if the first assignment is a constant expression.
variable a; -> variable a:=4;
a:=4; ->
> constant propagation: checks for values assigned to variables which can be computed at compile time, and replaces relevent references to the symbol by the constant. The original store is not removed by this optimization. Global variables are considered for this optimization only if they are not marked import or export, and are not assigned to anywhere in the script.
a:=4 -> a:=4
foo(a); -> foo(4);
> dead code removal: Checks for and removes code which cannot be reached, either because it is hidden behind a return or because the argument to an if statement can be computed at compile time.
if 1 then begin -> display_msg("foo");
display_msg("foo"); ->
end else begin ->
display_msg("bar"); ->
end ->
> unreferenced variable elimination: Checks for variables which are never referenced, and removes them. Also applies to global variables, as long as they are not marked for export.
variable i, j, k; -> variable i;
i:=1; -> i:=1;
return; -> return;
> unreferenced procedure elimination: Checks for any procedures which are never called, and removes them.
procedure foo begin return "foo"; end -> procedure foo begin return "foo"; end
procedure bar begin return "bar"; end -> procedure start begin
procedure start begin -> display_msg(foo);
display_msg(foo); -> end
end ->
> dead store removal: Removes variable assignments if the result of the variable is unused, and if the expression used to compute the value of the variable is provably free of side effects. (See 'pure' keyword)
a:="moo"; -> a:="foo";
a:="foo"; -> display_msg(a);
display_msg(a); ->
a:="bar"; ->
> store combination: Where there are two stores in a row to the same variable, the two expressions are combined.
var1 := var2; -> var1 := var2 + var3;
var1 += var3; ->
> variable combination: Where usage regions of variables do not overlap, combine the variables to provide additional candidates for unreferenced variable elimination. Very useful for scripts containing multiple foreach loops, which generate 2 or 3 hidden variables each.
a:="foo"; -> a:="foo";
display_msg(a); -> display_msg(a);
b:="bar"; -> a:="bar";
display_msg(b); -> display_msg(a);
> namelist compression: Fallout stores the names of all file scope variables and procedures in a namelist which is saved into the .int. Any of these that are unreferenced can be removed, and the names of global variables can be modified to make them shorter.
=============================
=== writing your own code ===
=============================
Don't have global scripts running any more often that you need them to. Not everything needs to be run every single frame.
Never concat constant strings with the '+' operator, as it forces the operation to be done at runtime. The compiler can cope with constant strings being placed next to each other without the need for a +, which results in far more efficient code as the combination is done at lex time.
#define GLOB_PREFIX "ts__" -> #define GLOB_PREFIX "ts__"
procedure start begin -> procedure start begin
set_sfall_global(GLOB_PREFIX + "foo1", 0); -> set_sfall_global(GLOB_PREFIX "foo1", 0);
end -> end
Avoid function calls in while loops. function calls are expensive in comparison to variable lookups, so it's more efficient to move the function call out of the loop and store the result in a variable
while i < len_array(array) do begin -> tmp:= len_array(array);
... -> while i < tmp do begin
end -> ...
-> end
Mark functions with pure or inline where relevent.
'pure' is a hint to the optimizer that a procedure has no side effects. (i.e. there's no way to tell that it's been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn't itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the 'call <procedure>' syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.
'inline' is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a seperate call. inlined procedures cannot use the 'return' command, cannot be predefined, and cannot be used as part of an expression. inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.
@@ -1,411 +0,0 @@
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional script functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
Unlike the original script compiler, this has not been compiled as a dos program. When using this in place of the original compile.exe but still using p.bat, you need to either get rid of the dos4gw.exe reference from p.bat or replace the original dos4gw.exe with the one in this archive.
If you use fallout script editor, you can extract compile.exe and dos4gw.exe to its \binary folder, or extract them somewhere else and change your preferences in FSE to point there. FSE doesn't seem to be able to tell when errors occur when using this compiler though, so I'd recommend either using sfall's script editor instead or compiling by hand if possible.
When compiling global or hook scripts for sfall 3.4 or below, you _must_ include the line 'procedure start;' before any #includes that define procedures to avoid a few weird problems. (this is no longer required starting from 3.5)
This version of compiler was designed primarily for new sfall functions, but it can safely (and is recommended) to be used with non-sfall scripts as well, as long as you don't use any of the arrays syntax and any sfall script functions.
The original unmodified sslc source is over here:
http://www.teamx.ru/eng/files/srcs/index.shtml
============================
=== command line options ===
============================
-q don't wait for input on error
-n no warnings
-b backward compatibility mode
-l no logo
-p preprocess source
-O optimize code (full, see optimization.txt)
-O<N> set specific level of optimization (0 - off, 1 - basic, 2 - full, 3 - experimental)
-d print debug messages
-D output an abstract syntax tree of the program
-o set output path (follows the input file name)
-s enable short-circuit evaluation for all AND, OR operators
-m<macro[=val]> define a macro named "macro" for conditional compilation
-I<path> specify an additional directory to search for include files
The original command line option -w to turn on warnings no longer has an effect, since warnings are now on by default
===================================
=== Additional supported syntax ===
===================================
Syntax which requires sfall for compiled scripts to be interpreted, is marked by asterix (*).
> Optional arguments in user-defined procedures. You can only use constants for default values. It basically puts those constants in place of omitted arguments.
new:
procedure test(variable x, variable y := 0, variable z := -1) begin
...
end
...
call test("value");
old:
procedure test(variable x, variable y, variable z) begin
...
end
...
call test("value", 0, -1);
> New logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions.
Using these operators allow the right part of logical expressions not to be evaluated (executed, computed) if the result is already known. This can improve the performance of running scripts.
Example:
if (obj andAlso obj_pid(obj) == PID_STIMPAK) then ...
if obj is null, the second condition will not be checked and your script won't fail with "obj is null" error in debug.log
This also has an effect that a value of last computed argument is returned as a result of whole expressions, instead of always 0 (false) or 1 (true):
obj := false;
display_msg(obj orElse "something"); // will print "something"
You can also use the -s option to enable short-circuit evaluation for all the AND, OR operators in the script.
NOTE: Be aware that it may break some old scripts because operators behavior is changed slightly.
> Conditional expressions (Python-inspired), also known as ternary operator:
new:
X := value1 if condition else value2
old:
if (condition) then
X := value1;
else
X := value2;
> To assign values, you can use the alternative assignment operator from C/Java instead of Pascal syntax.
new:
x = 5;
old:
x := 5;
> Multiple variable declaration: Multiple variables can be declared on one line, seperated by commas. This is an alterative to the ugly begin/end block, or the bulky single variable per line style.
new:
variable a, b, c;
old:
variable begin a; b; c; end
> Variable initialization with expressions: You can now initialize local variables with complex expressions instead of constants.
new:
variable tile := tile_num(dude_obj);
old:
variable tile;
tile := tile_num(dude_obj);
NOTE: if your expression starts with a constant (eg. 2+2), enclose it in parentheses, otherwise compiler will be confused and give you errors.
> Hexadecimal numerical constants: Simply prefix a number with 0x to create a hexadecimal. The numbers 0 to 9 and a-f are allowed in the number. The number may not have a decimal point.
new:
a := 0x1000;
old:
a := 4096;
> increment/decrement operators: ++ and -- can be used as shorthand for +=1 and -=1 respectively. They are mearly a syntactic shorthand to improve readability, and so their use is only allowed where +=1 would normally be allowed.
new:
a++;
old:
a += 1;
> "break" & "continue" statements: they work just like in most high-level languages. "break" jumps out of the loop. "continue" jumps right to the beginning of the next iteration (see "for" and "foreach" sections for additional details).
new:
while (i < N) begin
// ...
if (/* some condition */) then break;
// ...
end
old:
while (i < N and not(breakFlag)) begin
// ...
if (/* condition */) then breakFlag := true;
// ...
end
new:
for (i := 0; i < N; i++) begin
// ...
if (/* condition */) then begin
// action
continue;
end
// else actions
end
old:
for (i := 0; i < N; i++) begin
// ...
if (/* condition */) then begin
// action
end else begin
// else actions
end
end
> "for" loops: Another piece of syntactic shorthand, to shorten while loops in many cases. Parentheses around the loop statements are recommended but not required (when not using parentheses, a semicolon is required after the 3rd loop statement).
new:
for (i := 0; i < 5; i++) begin
display_msg("i = "+i);
end
old
i := 0;
while (i < 5) do begin
display_msg("i = "+i);
i++;
end
NOTE: "continue" statement in a "for" loop will recognize increment statement (third statement in parentheses) and will execute it before jumping back to the beginning of loop. This way you will not get an endless loop.
> switch statements: A shorthand way of writing big 'if then else if...' blocks
new:
switch get_attack_type begin
case ATKTYPE_PUNCH: display_msg("punch");
case ATKTYPE_KICK: display_msg("kick");
default: display_msg("something else");
end
old:
variable tmp;
tmp := get_attack_type;
if tmp == ATKTYPE_PUNCH then begin
display_msg("punch");
end else if tmp == ATKTYPE_KICK then begin
display_msg("kick");
end else begin
display_msg("something else");
end
> **Does not work currently** empty statements in blocks are allowed: This is just a convenience to save scripters a bit of memory. Some of the macros in the fallout headers include their own semicolons while others do not. With the original compiler you had to remember which was which, and if you got it wrong the script would not compile. Now it's always safe to include your own semicolon, even if the macro already had its own. For example, this would not compile with the original sslc, but will with the sfall edition:
#define my_macro diplay_msg("foo");
procedure start begin
my_macro;
end
> Procedure stringify operator "@": designed to make callback-procedures a better option and allow for basic functional programming. Basically it replaces procedure names preceeded by "@" by a string constant.
Not many people know that since vanilla Fallout you can call procedures by "calling a variable" containing it's name as a string value. There was a couple of problems using this:
- optimizer wasn't aware that you are referencing a procedure, and could remove it, if you don't call it explicitly (can be solved by adding making procedure "critical")
- you couldn't see all references of a procedure from a Script Editor
- it was completely not obvious that you could do such a thing, it was a confusing syntax
old:
callbackVar := "Node000";
callbackVar();
new:
callbackVar := @Node000;
callbackVar();
> *arrays: In vanilla fallout arrays had to be constructed by reserving a block of global/map variables. Since sfall 2.7, specific array targeted functions have been available, but they are fairly messy and long winded to use. The compiler provides additional syntactic shorthand for accessing and setting array variables, as well as for array creation. When declaring an array variable, put a constant integer in []'s to give the number of elements in the array. (before sfall 3.4 you had to specify size in bytes for array elements, now it's not required, see "arrays.txt" for more information)
new:
procedure bingle begin
variable a[2];
a[0] := 5;
a[a[0] - 4] := a[0] + 4;
display_msg("a[0]=" + a[0] + ", a[1]=" + a[1]);
end
old:
procedure bingle begin
variable a;
a := temp_array(2, 4);
set_array(a, 0, 5);
set_array(a, get_array(a, 0) - 4, get_array(a, 0) + 4);
display_msg("a[0]=" + get_array(a, 0) + ", a[1]=" + get_array(a, 1));
end
> *array expressions: sometimes you need to construct an array of elements and you will probably want to do it in just one expression. This is now possible:
new:
list := ["A", "B", "C", "D"];
old:
list := temp_array(4, 2);
list[0] := "A";
list[1] := "B";
list[2] := "C";
list[3] := "D";
Syntax specific for associative arrays is also available. (see "arrays.txt" for full introduction to this type of arrays).
> *map array expressions:
map := {5: "five", 10: "ten", 15: "fifteen", 20: "twelve"};
> * "dot" syntax to access elements of associative arrays. "dot" syntax allows to work with arrays like objects:
trap.radius := 3;
trap.tile := tile_num(dude_obj);
you can chain dot and bracket syntax to access elements of multi-dimensional arrays:
collectionList[5].objectList[5].name += " foo";
NOTE: when using incremental operators like +=, *=, ++, -- compiler will use additional temp variable to get an array at penultimate level in order to avoid making the same chain of "get_array" calls twice.
> * "foreach" loops: A shorthand method of looping over all elements in an array. Syntax is 'foreach (<symbol> in <expression>) '
new:
procedure bingle begin
variable critter;
foreach (critter in list_as_array(LIST_CRITTERS)) begin
display_msg(""+critter);
end
end
old:
procedure bingle begin
variable begin critter; array; len; count; end
array := list_as_array(LIST_CRITTERS);
len := len_array(array);
count := 0;
while count < len do begin
critter := array[count];
display_msg("" + critter);
end
end
If you want an index array element (or key for "maps") at each iteration, use syntax: 'foreach (<symbol>: <symbol> in <expression>) '
foreach (pid: price in itemPriceMap) begin
if (itemPid == pid) then
itemPrice := price;
end
If you want to add additional condition for continuing the loop, use syntax: 'foreach (<symbol> in <expression> while <expression>) '. In this case loop will iterate over elements of an array until last element or until "while" expression is true (whatever comes first).
NOTE: just like "for" loop, "continue" statement will respect increments of a hidden counter variable, so you can safely use it inside "foreach".
====================
=== int2ssl note ===
====================
int2ssl by Anchorite (TeamX) is included in sfall modderspack package. It was updated to support all additional opcodes of sfall, along with some syntax features. You can use it to decompile any sfall or non-sfall script.
=============
=== Fixes ===
=============
playmoviealpharect was using the token for playmoviealpha, breaking both functions in the process.
addbuttonflag had an entry in the token table, and could be parsed, but was missing an entry in the emit list. This resulted in the compiler accepting it as a valid function, but not outputting any code for it into the compiled script.
The function tokenize was missing an entry in the token table, and so would not be recognised by the compiler.
fixed the check for the 'call "foo"' syntax so that non-string constants will no longer be accepted.
==============================
=== Backward compatibility ===
==============================
There are several changes in this version of sslc which may result in problems for previously working scripts. A new command line option '-b' is available, which will turn off all new fixes and features which have the possibility of causing a previously compiling script to change its behaviour. (And only those features; anything which would not compile under the old sslc is not affected.) This includes the following:
- Since 'for', 'foreach', 'break', 'continue', 'in' and 'tokenize' are now hardcoded names, existing scripts that use any of them as a variable or procedure name will no longer compile.
- Missing a semicolon after a variable declaration is now a hard error. (Originally sslc would check for the semicolon, but would not complain if it was missing.)
- The function addbuttonflag used to be recognised by the compiler, but would not emit any code into the int file.
- The function playmoviealpharect compiled as playmoviealpha
=================
=== Changelog ===
=================
> sfall 4.2.9
- added support for additional universal opcodes sfall_func7 and sfall_func8
- fixed a compilation error when the script has a UTF-8 BOM
> sfall 4.2.7
- added ability to declare local variables anywhere in the procedure body
> sfall 4.2.3
- fixed compiler giving "assignment operator expected" error when a variable-like macro is not being defined properly
- added new logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions
- added an alternative (C/Java-style) assignment operator "="
- added support for new "div" operator (unsigned integer division)
> sfall 4.2.2
- added support for new opcode "reg_anim_callback"
> sfall 4.2.1
- the basic optimization is now enabled by default when not specifying any optimization options
- added -m<macro[=val]> option to define a macro named "macro" for conditional compilation
- added -I<path> option to specify an additional directory to search for include files
- unreferenced "critical" procedures and procedures with the names "Node998" and "Node999" are now removed by the optimizer
> sfall 4.2
- now it is possible to run preprocess or optimization passes in backward compatibility mode
- added support for new opcode "register_hook_proc_spec"
> sfall 4.0:
- enabled code for "ceil" math function
- fixed missing argument for "how_much" function
- added "desc_p_proc" (from Fallout 1) to protected procedures that should not be removed by the optimizer
- fixed compiler giving "division by zero" error when using zero as the second factor in multiplication
> sfall 3.8
- added support for new universal opcodes sfall_funcX
> sfall 3.6:
- added Python-style ternary operator (conditional expression)
- added -s short-circuit evalution option for AND, OR expressions
- int2ssl will detect and decompile conditional expressions and short-circuit logical operators
- added -F option to include full file paths in "#line" directives after preprocessing
- added -D option to write abstract syntax tree into .txt file
- fixed compiler crash when number of arguments in procedure declaration does not match definition
- fixed incorrect constant folding of "bwnot" operator
- fixed more invalid results in constant folding
- implemented optional arguments for user-defined procedures
- implemented stringify procedure names using @ operator, which is helpful to pass procedures around to call them from variables (it will properly handle references)
- logic for procedures passed as arguments to script functions was moved from code generation to parsing stage
- now it is possible to call user-defined procedures inside argument list of script functions, without compiler attempting to treat them as procedure references and probably fail (procedures will still be passed, but only to appropriate script functions at appropriate argument positions)
- int2ssl will now place empty parantheses after a call to user-defined procedure - this will distinct calls from passing procedures to some script functions (like giq_option)
- fixed inline procedure "calls" not working when optimization is enabled
- added column numbers to error/warning output
- added code to simplify adding sfall opcodes into compiler (need to add code in 3 places, instead of 7 places for each opcode)
- fixed bug when initializing variable with expression starting from a symbol
- added division by zero constant check
> sfall 3.5:
- completed namespace compression optimization with respect to imported/exported variables
- changed 'for' and 'foreach' syntax to allow parentheses which are easier to read IMHO
- heavy code refactoring - split "parse.c" into several files, replaced all dirty workaround code in "lex()" (some syntax features) with parser-level equivalents
- added syntax to reference elements in multi-dimensional arrays (unlimited sequence of brackets [] and dots . )
- added fully featured "break" and "continue" statements for loops
- moved some optimizations (namely constant propagation and variable reuse) to "experimental" because they were breaking my scripts
- added ability to initialize variables with expressions
> sfall 3.4:
- added "foreach .. while .." syntax
- added array expressions for lists and maps
- added "foreach (key: value in ...)" syntax for convenience
- fixed crash bug in "for" loop parsing function
- added ability to access array elements with string keys using OOP-like dot (".") syntax
+19 -13
View File
@@ -10,7 +10,8 @@
- name: ToHit
id: HOOK_TOHIT
doc: |
Runs when Fallout is calculating the chances of an attack striking a target. Runs after the hit chance is fully calculated normally, including applying the 95% cap.
Runs when Fallout is calculating the chances of an attack striking a target.<br>
Runs after the hit chance is fully calculated normally, including applying the 95% cap.
```
int arg0 - The hit chance (capped)
@@ -45,8 +46,8 @@
- name: CalcAPCost
id: HOOK_CALCAPCOST
doc: |
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player's hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.<br>
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player's hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.<br>
You can get the weapon object by checking item slot based on attack type (`ATKTYPE_LWEP1`, `ATKTYPE_LWEP2`, etc) and then calling `critter_inven_obj`.
```
@@ -63,6 +64,7 @@
id: HOOK_DEATHANIM1
doc: |
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees.
Does not run for critters in the knockdown/out state.
```
@@ -78,8 +80,9 @@
- name: DeathAnim2
id: HOOK_DEATHANIM2
doc: |
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than `HOOK_DEATHANIM1`, but performs no validation.
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than `HOOK_DEATHANIM1`, but performs no validation.<br>
When using `critter_dmg` function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with `obj_art_fid == 0x20001F5`.
Does not run for critters in the knockdown/out state.
```
@@ -136,7 +139,7 @@
- name: FindTarget
id: HOOK_FINDTARGET
doc: |
Runs when the AI is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the AI caps of the attacker.
Runs when the AI is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the AI caps of the attacker.<br>
This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way.
The return values can include critters that weren't in the list of possible targets, but the additional targets may still be discarded later on in the combat turn if they are out of the attackers perception or the chance of a successful hit is too low. The list of possible targets often includes duplicated entries, but this is fixed in sfall 4.2.3/3.8.23.
@@ -169,8 +172,9 @@
1. a critter uses an object from inventory screen AND this object does not have "Use" action flag set and it's not active flare or explosive.
1. player or AI uses any drug
This is fired before the object is used, and the relevant use_obj_on script procedures are run. You can disable default item behavior.
NOTE: you can't remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
This is fired before the object is used, and the relevant `use_obj_on` script procedures are run. You can disable default item behavior.
__NOTE:__ You can't remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
```
Critter arg0 - The target
@@ -291,9 +295,9 @@
- name: AmmoCost
id: HOOK_AMMOCOST
doc: |
Runs when calculating ammo cost for a weapon. Doesn't affect damage, only how much ammo is spent.
By default, weapons can make attacks when at least 1 ammo is left, regardless of ammo cost calculations.
To add proper check for ammo before attacking and proper calculation of the number of burst rounds (hook type 1 and 2 in arg3), set **CheckWeaponAmmoCost=1** in **Misc** section of ddraw.ini.
Runs when calculating ammo cost for a weapon. Doesn't affect damage, only how much ammo is spent.<br>
By default, weapons can make attacks when at least 1 ammo is left, regardless of ammo cost calculations.<br>
To add proper check for ammo before attacking and proper calculation of the number of burst rounds (hook type 1 and 2 in `arg3`), set **CheckWeaponAmmoCost=1** in **Misc** section of ddraw.ini.
```
Item arg0 - The weapon
@@ -342,8 +346,9 @@
Runs when using any skill on any object.
This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use `message_str_game` along with `sprintf`).
Suggested use - override first aid/doctor skills to buff/nerf them, override steal skill to disallow observing NPCs inventories in some cases.
Doesn't seem to run when lock picking.
Suggested use - override First Aid/Doctor skills to buff/nerf them, override Steal skill to disallow observing NPCs inventories in some cases.
Does not run if the script of the object calls `script_overrides` for using the skill.
```
Critter arg0 - The user critter
@@ -351,7 +356,7 @@
int arg2 - skill being used
int arg3 - skill bonus from items such as first aid kits
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override)
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
```
- name: Steal
@@ -586,6 +591,7 @@
doc: |
Runs when using the examine action icon to display the description of an object. You can override the description text.
An example usage would be to add an additional description to the item based on player's stats/skills.
Does not run if the script of the object overrides the description.
```
+5 -4
View File
@@ -291,7 +291,7 @@ int ret0 - overrides hard-coded handler and selects what should happen with
#### `HOOK_REMOVEINVENOBJ (hs_removeinvenobj.int)`
Runs when an object is removed from a container or critter's inventory for any reason
Runs when an object is removed from a container or critter's inventory for any reason.
```
Obj arg0 - the owner that the object is being removed from
@@ -439,8 +439,9 @@ int arg1 - button number (0 - left, 1 - right, up to 7)
Runs when using any skill on any object.
This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use `message_str_game` along with `sprintf`).
Suggested use - override first aid/doctor skills to buff/nerf them, override steal skill to disallow observing NPCs inventories in some cases.
Doesn't seem to run when lock picking.
Suggested use - override First Aid/Doctor skills to buff/nerf them, override Steal skill to disallow observing NPCs inventories in some cases.
Does not run if the script of the object calls `script_overrides` for using the skill.
```
Critter arg0 - The user critter
@@ -448,7 +449,7 @@ Obj arg1 - The target object
int arg2 - skill being used
int arg3 - skill bonus from items such as first aid kits
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override)
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
```
-------------------------------------------
+2 -2
View File
@@ -11,7 +11,7 @@ nav_order: 1
* TOC
{: toc}
Sfall is a set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
Engine modifications include:
@@ -38,4 +38,4 @@ Next, proceed to discover new functions. They are categorized, use the menu to f
## Questions and problems
* Report bugs and suggest features on [Github](https://github.com/phobos2077/sfall/issues).
* Ask questions and discuss on the [forum](http://nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/).
* Ask questions and discuss on the [forum](https://nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/).
+4
View File
@@ -78,6 +78,10 @@ char* GetMsg(fo::MessageList* msgList, int msgNum, int msgType) {
return nullptr;
}
fo::Window* GetWindow(long winID) {
return fo::var::window[fo::var::window_index[winID]];
}
fo::Queue* QueueFind(fo::GameObject* object, long type) {
if (fo::var::queue) {
fo::Queue* queue = fo::var::queue;
+2
View File
@@ -54,6 +54,8 @@ fo::MessageNode* GetMsgNode(fo::MessageList* msgList, int msgNum);
char* GetMsg(fo::MessageList* msgList, int msgNum, int msgType);
fo::Window* GetWindow(long winID);
fo::Queue* QueueFind(fo::GameObject* object, long type);
// returns weapon animation code

Some files were not shown because too many files have changed in this diff Show More