mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added DivisionOperatorFix option for signed integer division (#278)
* it changes the behavior of vanilla division operator to use signed integer division. Before it used signed division for floats but unsigned for integers. Added a new "div" operator for unsigned integer division. Moved mathematical script functions from ScriptUtils.hpp to new MathOps. Added include guard to sfall.h and main.h in modders pack.
This commit is contained in:
@@ -568,6 +568,9 @@ StartGDialogFix=0
|
||||
;attacker_results - unused, must be 0 or not equal to the target_results argument when specifying result flags for the target
|
||||
AttackComplexFix=0
|
||||
|
||||
;Set to 1 to fix the issue with the division operator treating negative integers as unsigned
|
||||
DivisionOperatorFix=1
|
||||
|
||||
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
|
||||
ComputeSprayMod=0
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include "..\scripting\headers\sfall.h"
|
||||
#include "..\scripting\headers\define_lite.h"
|
||||
@@ -71,3 +73,5 @@ end
|
||||
procedure InitConfigs begin
|
||||
translationIni := GetIniConfigStr("Main", "TranslationsINI", "Translations.ini", "ddraw.ini");
|
||||
end
|
||||
|
||||
#endif
|
||||
|
||||
@@ -344,6 +344,7 @@ There are several changes in this version of sslc which may result in problems f
|
||||
- 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"
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#define below(a, b) (unsigned_comp(a, b) < 0)
|
||||
#define below_equal(a, b) (unsigned_comp(a, b) <= 0)
|
||||
|
||||
procedure unsigned_comp(variable a, variable b) begin
|
||||
// for sfall 4.2.3/3.8.23
|
||||
pure procedure unsigned_comp(variable a, variable b) begin
|
||||
if ((a bwxor b) == 0) then return 0; // a == b
|
||||
if (b == 0) then return 1;
|
||||
return 1 if (a / b) else -1;
|
||||
return 1 if ((b == 0) orElse a div b) else -1;
|
||||
end
|
||||
|
||||
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef SFALL_H
|
||||
#define SFALL_H
|
||||
|
||||
//Recognised modes for set_shader_mode and get_game_mode
|
||||
#define WORLDMAP (0x1)
|
||||
#define DIALOG (0x4)
|
||||
@@ -305,3 +308,5 @@
|
||||
#define unjam_lock(obj) sfall_func1("unjam_lock", obj)
|
||||
#define unset_unique_id(obj) sfall_func2("set_unique_id", obj, -1)
|
||||
#define unwield_slot(critter, slot) sfall_func2("unwield_slot", critter, slot)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -360,6 +360,8 @@
|
||||
0x827d - void register_hook_proc_spec(int hook, procedure proc)
|
||||
0x827e - void reg_anim_callback(procedure proc)
|
||||
|
||||
0x827f - div operator (unsigned integer division)
|
||||
|
||||
|
||||
* These functions require AllowUnsafeScripting to be enabled in ddraw.ini
|
||||
|
||||
|
||||
Reference in New Issue
Block a user