mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2b3529ed0 | ||
|
|
f77cd85f95 | ||
|
|
39c5ab3674 | ||
|
|
7d75023b81 | ||
|
|
bd629b5460 | ||
|
|
5b180286d1 | ||
|
|
814c280432 | ||
|
|
c5f52105ec | ||
|
|
18cc3f7aa9 | ||
|
|
fda97ffefb | ||
|
|
00508adfb1 | ||
|
|
e906be67ab | ||
|
|
abe2430495 | ||
|
|
de51b6838b | ||
|
|
52126bf62d | ||
|
|
be7c1210a0 | ||
|
|
08a96bc27e | ||
|
|
f94085be93 | ||
|
|
89a49b4f32 | ||
|
|
cf5952c031 | ||
|
|
ac058ee4d7 | ||
|
|
b31f29a324 | ||
|
|
750d88ea9a | ||
|
|
68389d9474 | ||
|
|
97f3d3eb5f | ||
|
|
b187c8359b | ||
|
|
93f6131592 | ||
|
|
5a9edb9723 | ||
|
|
d14e7ccd9f | ||
|
|
c5baecfdad | ||
|
|
c1dc31a919 | ||
|
|
8e3e49b281 | ||
|
|
44411309f8 | ||
|
|
a35a4e034b | ||
|
|
21c85b298b | ||
|
|
5151ea312a | ||
|
|
def3e52302 | ||
|
|
06f35e10fb | ||
|
|
588abd2a4b | ||
|
|
c6813bdd74 | ||
|
|
53c0517268 | ||
|
|
81f112063e |
Generated
+8
@@ -23,6 +23,7 @@
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -34,6 +35,7 @@
|
||||
this.bSGlobals = new System.Windows.Forms.Button();
|
||||
this.bArrays = new System.Windows.Forms.Button();
|
||||
this.bEdit = new System.Windows.Forms.Button();
|
||||
this.redrawTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.bCrittersLvar = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@@ -154,6 +156,11 @@
|
||||
this.bEdit.UseVisualStyleBackColor = true;
|
||||
this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
|
||||
//
|
||||
// redrawTimer
|
||||
//
|
||||
this.redrawTimer.Interval = 200;
|
||||
this.redrawTimer.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// bCrittersLvar
|
||||
//
|
||||
this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
@@ -202,6 +209,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
internal System.Windows.Forms.Timer redrawTimer;
|
||||
private System.Windows.Forms.Button bCrittersLvar;
|
||||
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ namespace FalloutClient {
|
||||
sr.Close();
|
||||
}
|
||||
Redraw();
|
||||
redrawTimer.Start();
|
||||
}
|
||||
|
||||
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
@@ -188,6 +189,7 @@ namespace FalloutClient {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
redrawTimer.Stop();
|
||||
if (e.ColumnIndex == 2) {
|
||||
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
|
||||
int val;
|
||||
@@ -211,11 +213,13 @@ namespace FalloutClient {
|
||||
connection.WriteInt(converter.GetAsInt(val));
|
||||
}
|
||||
}
|
||||
redrawTimer.Start();
|
||||
}
|
||||
|
||||
private void bEdit_Click(object sender, EventArgs e) {
|
||||
if (dataGridView1.SelectedRows.Count == 0) return;
|
||||
int i = (int)dataGridView1.SelectedRows[0].Tag;
|
||||
redrawTimer.Stop();
|
||||
switch (mode) {
|
||||
case Mode.Arrays: {
|
||||
DataType[] types = new DataType[connection.ArrayLengths[i]];
|
||||
@@ -333,6 +337,7 @@ namespace FalloutClient {
|
||||
}
|
||||
break;
|
||||
}
|
||||
redrawTimer.Start();
|
||||
}
|
||||
|
||||
private void bCrittersLvar_Click(object sender, EventArgs e) {
|
||||
@@ -381,5 +386,9 @@ namespace FalloutClient {
|
||||
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) {
|
||||
dataGridView1.Rows[e.RowIndex].Tag = e.RowIndex;
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e) {
|
||||
connection.WriteDataType(DataTypeSend.RedrawGame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,4 +129,7 @@
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="redrawTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -48,8 +48,10 @@ namespace FalloutClient {
|
||||
}
|
||||
|
||||
public static string[] ShowEditor(DebugEditor form, string[] names, DataType[] types, string[] values, bool isMap = false) {
|
||||
form.redrawTimer.Start();
|
||||
EditorWindow editor = new EditorWindow(names, types, values, isMap);
|
||||
editor.ShowDialog();
|
||||
form.redrawTimer.Stop();
|
||||
if (editor.save) {
|
||||
if (valueInHex) editor.ConvertValues(false);
|
||||
return editor.values;
|
||||
@@ -70,8 +72,10 @@ namespace FalloutClient {
|
||||
}
|
||||
|
||||
public static string[] ShowEditor(DebugEditor form, string[] lvalues) {
|
||||
form.redrawTimer.Start();
|
||||
EditorWindow editor = new EditorWindow(lvalues);
|
||||
editor.ShowDialog();
|
||||
form.redrawTimer.Stop();
|
||||
if (editor.save) {
|
||||
if (valueInHex) editor.ConvertValues(false);
|
||||
return editor.values;
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace FalloutClient {
|
||||
SetArray = 10,
|
||||
GetLocal = 11,
|
||||
SetLocal = 12,
|
||||
Exit = 254
|
||||
Exit = 254,
|
||||
RedrawGame = 255
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("sfall")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyCopyright("Copyright (C) 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("4.1.9.0")]
|
||||
[assembly: AssemblyFileVersion("4.1.9.0")]
|
||||
[assembly: AssemblyVersion("4.1.9.1")]
|
||||
[assembly: AssemblyFileVersion("4.1.9.1")]
|
||||
|
||||
+12
-17
@@ -1,8 +1,9 @@
|
||||
;sfall configuration settings
|
||||
;v3.8.32
|
||||
;v3.8.33
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
;Set to 1 if you want to use command line arguments to tell sfall to use another ini file
|
||||
;This option is always enabled in 4.3.3/3.8.33 or later. The information is left for reference only
|
||||
UseCommandLine=0
|
||||
|
||||
;Uncomment and point to a file to get alternate translations for some sfall messages
|
||||
@@ -157,7 +158,7 @@ BackgroundMouse=0
|
||||
SpeedModKey=-1
|
||||
|
||||
;A key to press to toggle the speed tweak on or off
|
||||
;Specify 0 if you don't want a toggle key, or a DX scancode otherwise
|
||||
;Set to 0 if you don't want a toggle key, or a DX scancode otherwise
|
||||
SpeedToggleKey=0
|
||||
|
||||
;The keys corresponding to the 10 speed slots
|
||||
@@ -248,8 +249,8 @@ WorldMapEncounterFix=0
|
||||
WorldMapEncounterRate=5
|
||||
|
||||
;The number of slots available in the locations list panel of the world map
|
||||
;Set to 0 to leave unchanged. 17 is default.
|
||||
;Setting this greater than 17 requires a replacement background FRM, or you'll get glitched graphics
|
||||
;Set to 0 to leave the default unchanged (i.e. 17). The maximum is 127
|
||||
;Setting this greater than 17 requires a replacement WMTABS.frm file in art\intrface\, or you'll get glitched graphics
|
||||
WorldMapSlots=0
|
||||
|
||||
;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
|
||||
@@ -273,7 +274,7 @@ UseFileSystemOverride=0
|
||||
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
|
||||
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
|
||||
;This option is always enabled in 4.3/3.8.30 or later. The information is left for reference only
|
||||
;DataLoadOrderPatch=1
|
||||
DataLoadOrderPatch=1
|
||||
|
||||
;Set to 1 to load alternative dialog msg files from text\<language>\dialog_female\ for female PC
|
||||
;Set to 2 to also load subtitle files from text\<language>\cuts_female\ for female PC
|
||||
@@ -455,9 +456,6 @@ Doctor=293
|
||||
Science=293
|
||||
Repair=293
|
||||
|
||||
;Set to 1 to remove window position rounding for script-created windows
|
||||
RemoveWindowRounding=1
|
||||
|
||||
;Set to 1 to add scroll buttons to the pipboy quest list, and remove the quests per area limit
|
||||
;Set to 2 to use a different set of scroll buttons
|
||||
UseScrollingQuestsList=1
|
||||
@@ -612,10 +610,6 @@ ExplosionsEmitLight=0
|
||||
;MovieTimer_artimer3=270
|
||||
;MovieTimer_artimer4=360
|
||||
|
||||
;Set to 1 to enable the new arrays behavior (default behavior)
|
||||
;Set to 0 for backward compatibility with pre-3.4 scripts
|
||||
ArraysBehavior=1
|
||||
|
||||
;Set to 1 to add proper check for ammo before attacking and proper calculation of the number of burst rounds
|
||||
;By default, weapons can make attacks when at least one ammo is left, regardless of ammo cost calculations
|
||||
;Note that enabling this option will prevent super cattle prods and mega power fists from attacking with only one ammo left
|
||||
@@ -826,11 +820,8 @@ AllowUnsafeScripting=0
|
||||
;Does not require sfall debugging mode
|
||||
;ExtraCRC=0x00000000,0x00000000
|
||||
|
||||
;Set to 1 to skip the executable file size check
|
||||
;Set to 1 to skip the compatibility mode check
|
||||
;Does not require sfall debugging mode
|
||||
SkipSizeCheck=0
|
||||
|
||||
;Change to 1 to skip the compatibility mode check
|
||||
SkipCompatModeCheck=0
|
||||
|
||||
;Fallout 2 Debug Patch
|
||||
@@ -853,6 +844,10 @@ DebugMode=0
|
||||
;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
|
||||
HideObjIsNullMsg=0
|
||||
|
||||
;A key to press to toggle the display of the hex grid on the map on or off
|
||||
;Set to 0 to disable, or a DX scancode otherwise
|
||||
MapGridToggleKey=0
|
||||
|
||||
;Set to 1 to stop Fallout from deleting non read-only protos at startup
|
||||
;Has pretty nasty side effects when saving/reloading, so don't use for regular gameplay
|
||||
DontDeleteProtos=0
|
||||
|
||||
@@ -45,7 +45,7 @@ Both array types have their pros and cons and are suited for different tasks.
|
||||
___
|
||||
### ARRAYS SYNTAX
|
||||
|
||||
Basically arrays are implemented using number of new operators (scripting functions). But for ease of use, there are some new syntax elements:
|
||||
Basically arrays are implemented using number of new operators (script functions). But for ease of use, there are some new syntax elements:
|
||||
|
||||
* Accessing elements. Use square brackets:
|
||||
```js
|
||||
@@ -67,8 +67,8 @@ Basically arrays are implemented using number of new operators (scripting functi
|
||||
// create map:
|
||||
{5: "Five", "health": 50, "speed": 0.252}
|
||||
```
|
||||
__NOTES:__
|
||||
Make sure to call `fix_array` if you want new array to be available in the next frame or `save_array` if you want to use it for a longer period (see next section for details).
|
||||
__NOTE:__
|
||||
Make sure to call `fix_array` if you want the new array to be available in the next frame or `save_array` if you want to use it for a longer period (see next section for details).
|
||||
|
||||
* Iterating in loop. Use `foreach` key word like this:
|
||||
```js
|
||||
@@ -82,7 +82,7 @@ Basically arrays are implemented using number of new operators (scripting functi
|
||||
end
|
||||
```
|
||||
|
||||
See **sslc_readme.txt** file for full information on new SSL syntax features.
|
||||
See **sslc_readme.md** file for full information on new SSL syntax features.
|
||||
|
||||
___
|
||||
### STORING ARRAYS
|
||||
@@ -94,7 +94,7 @@ There a 3 types of arrays:
|
||||
Arrays of this type are auto-deleted at the end of the frame. So, for example, if you have a global script which runs at regular intervals, where you create a temporary array, it will not be available next time your global script is executed.
|
||||
|
||||
* **Permanent**. They are created using `create_array` function or `fix_array` (from pre-existing temporary array).
|
||||
This type of arrays are always available (by their ID) until you start a new game or load a saved game (at which point they are deleted).
|
||||
This type of arrays are always available (by their IDs) until you start a new game or load a saved game (at which point they are deleted).
|
||||
|
||||
* **Saved**. If you want your array to really stay for a while, use function `save_array` to make any array "saved". However, they are, like permanent arrays, "deleted" from memory when loading game. In order to use them properly, you must load them from the savegame using `load_array` whenever you want to use them.
|
||||
|
||||
@@ -236,9 +236,11 @@ ___
|
||||
|
||||
For those who used arrays in their mods before sfall 3.4:
|
||||
|
||||
* There is an INI parameter **arraysBehavior** in **Misc** section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that `create_array` will create permanent arrays which are "saved" by default and their ID is also permanent. It is 1 by default.
|
||||
* There is an INI parameter **ArraysBehavior** in **Misc** section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that `create_array` will create permanent arrays which are "saved" by default and their IDs are also permanent. It is 1 by default.
|
||||
|
||||
* __NOTE:__ Starting from sfall 4.3.3/3.8.33, the **ArraysBehavior** option is removed, and arrays always work in **ArraysBehavior=1** mode. Make sure to review your scripts if you need to save arrays into savegames.
|
||||
|
||||
* How savegame compatibility is handled?\
|
||||
Saved arrays are stored in **sfallgv.sav** file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), game shouldn't crash, but all arrays will be lost.
|
||||
Saved arrays are stored in **sfallgv.sav** file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn't crash, but all arrays will be lost.
|
||||
|
||||
* Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SSLC
|
||||
----
|
||||
|
||||
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional scripting functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
|
||||
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.
|
||||
|
||||
@@ -9,7 +9,7 @@ If you use Fallout Script Editor, you can extract `compile.exe` and `dos4gw.exe`
|
||||
|
||||
When compiling global or hook scripts for sfall 3.4 or below, you _must_ include the line `procedure start;` before any `#include` files 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 scripting functions.
|
||||
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/site_arc/utils/index.html](http://www.teamx.ru/site_arc/utils/index.html)
|
||||
|
||||
@@ -405,9 +405,9 @@ There are several changes in this version of sslc which may result in problems f
|
||||
- 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 scripting functions was moved from code generation to parsing stage
|
||||
- now it is possible to call user-defined procedures inside argument list of scripting functions, without compiler attempting to treat them as procedure references and probably fail (procedures will still be passed, but only to appropriate scripting 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 scripting functions (like `giq_option`)
|
||||
- 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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional scripting functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
|
||||
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.
|
||||
|
||||
@@ -6,7 +6,7 @@ If you use fallout script editor, you can extract compile.exe and dos4gw.exe to
|
||||
|
||||
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 scripting functions.
|
||||
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
|
||||
@@ -385,9 +385,9 @@ There are several changes in this version of sslc which may result in problems f
|
||||
- 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 scripting functions was moved from code generation to parsing stage
|
||||
- now it is possible to call user-defined procedures inside argument list of scripting functions, without compiler attempting to treat them as procedure references and probably fail (procedures will still be passed, but only to appropriate scripting 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 scripting functions (like giq_option)
|
||||
- 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)
|
||||
|
||||
@@ -96,8 +96,8 @@ Critter arg1 - The attacker
|
||||
Critter arg2 - The target of the attack
|
||||
int arg3 - The targeted bodypart
|
||||
int arg4 - Source tile (may differ from attacker's tile, when AI is considering potential fire position)
|
||||
int arg5 - Attack Type (one of ATKTYPE_*)
|
||||
int arg6 - Ranged flag. 1 means the hit chance is calculated by taking into account the bonuses/penalties of the distance to the target
|
||||
int arg5 - Attack Type (see ATKTYPE_* constants)
|
||||
int arg6 - Ranged flag. 1 if the hit chance calculation takes into account the distance to the target. This does not mean the attack is a ranged attack
|
||||
int arg7 - The raw hit chance before applying the cap
|
||||
|
||||
int ret0 - the new hit chance
|
||||
@@ -496,7 +496,7 @@ int arg3 - Type of hook:
|
||||
int ret0 - overrides the returned result of the function:
|
||||
0 - not in range (can't see)
|
||||
1 - in range (will see if not blocked)
|
||||
2 - forced detection (will see regardless, only used in obj_can_see_obj scripting function which is called by every critter in the game)
|
||||
2 - forced detection (will see regardless, only used in obj_can_see_obj script function which is called by every critter in the game)
|
||||
```
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
@@ -74,7 +74,7 @@ The `play_sfall_sound` and `stop_sfall_sound` are used to play **mp3/wav/wma** f
|
||||
Starting from sfall 4.2.8/3.8.28, you can pass a value in the **mode** argument for a reduced sound volume. To set the volume, You need to convert the number to hexadecimal and use the argument format `0xZZZZ000Y`, where `ZZZZ` is the volume reduction value in range from 0 to 32767 (the value 32767 is muted), and `Y` is the playback mode.
|
||||
|
||||
Arrays are created and manipulated with the `xxx_array` functions. An array must first be created with `create_array` or `temp_array`, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The ID returned by `create_array` or `temp_array` can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call `create_array` from one script, and then use the returned ID from another script.) They are also saved across savegames. Arrays created with `temp_array` will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. `create_array` is the only function that returns a permanent array, all other functions which return arrays (`string_split`, `list_as_array`, etc,) all return temp arrays. You can use `fix_array` to make a temp array permanent.\
|
||||
__NOTE:__ the above description only applies when **arraysBehavior** is set to 0 in ddraw.ini. Refer to **arrays.md** for detailed description of new arrays behavior.
|
||||
__NOTE:__ refer to **arrays.md** for detailed description of the array behavior and function usage.
|
||||
|
||||
The `force_aimed_shots` and `disable_aimed_shots` allow overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) `force_aimed_shots` will allow a weapon to make aimed shots even if it normally couldn't, and `disable_aimed_shots` stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and NPCs alike. `force_aimed_shots` does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the functions once at each reload. Use a pid of 0 to represent unarmed.
|
||||
|
||||
@@ -452,7 +452,7 @@ FUNCTION REFERENCE
|
||||
|
||||
-----
|
||||
##### `any sfall_funcX(string funcName, ...)`
|
||||
- These opcodes allows to use additional scripting functions, that do not require new opcode.
|
||||
- These opcodes allows to use additional script functions, that do not require new opcode.
|
||||
- First argument is always function name (string).
|
||||
- There are 9 versions of this opcode for different number of additional arguments (for convenience).
|
||||
- Opcodes have return value, but it is not necessary to use it.
|
||||
@@ -464,7 +464,7 @@ sfall_funcX metarule functions
|
||||
|
||||
#### get_metarule_table
|
||||
`array sfall_func0("get_metarule_table")`
|
||||
- Returns names of all currently available scripting functions (via `sfall_funcX`)
|
||||
- Returns names of all currently available script functions (via `sfall_funcX`)
|
||||
|
||||
----
|
||||
#### metarule_exist
|
||||
@@ -661,7 +661,7 @@ sfall_funcX metarule functions
|
||||
|
||||
----
|
||||
#### inventory_redraw
|
||||
`void sfall_func0("inventory_redraw")`<br>
|
||||
`void sfall_func0("inventory_redraw")`\
|
||||
`void sfall_func1("inventory_redraw", int invSide)`
|
||||
- Redraws inventory list in the inventory/use inventory item on/loot/barter screens
|
||||
- `invSide` specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument)
|
||||
@@ -673,7 +673,7 @@ sfall_funcX metarule functions
|
||||
|
||||
----
|
||||
#### create_win
|
||||
`void sfall_func5("create_win", string winName, int x, int y, int width, int height)`<br>
|
||||
`void sfall_func5("create_win", string winName, int x, int y, int width, int height)`\
|
||||
`void sfall_func6("create_win", string winName, int x, int y, int width, int height, int flags)`
|
||||
- Works just like vanilla `CreateWin` function, but creates a window with `MoveOnTop` flag if the flags argument is not specified, and allows to set additional flags for the created window
|
||||
- `MoveOnTop` flag allows the created window to be placed on top of the game interface
|
||||
|
||||
+39
-29
@@ -28,14 +28,18 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
static const DWORD ExpectedSize = 0x00122800;
|
||||
static const DWORD ExpectedCRC[] = {0xe1680293, 0xef34f989};
|
||||
static const DWORD ExpectedSize = 1189888;
|
||||
static const DWORD ExpectedCRC[] = {
|
||||
0xE1680293, // US 1.02d
|
||||
0xEF34F989 // US 1.02d + HRP
|
||||
};
|
||||
|
||||
static void inline MessageFail(const char* a) {
|
||||
MessageBoxA(0, a, "Error", MB_TASKMODAL | MB_ICONERROR);
|
||||
static void inline ExitMessageFail(const char* a) {
|
||||
MessageBoxA(0, a, 0, MB_TASKMODAL | MB_ICONERROR);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
// Precomputed CRC32C table
|
||||
static const DWORD CRC_table[256] = {
|
||||
0x00000000, 0x0A5F4D75, 0x14BE9AEA, 0x1EE1D79F, 0x14C5EB57, 0x1E9AA622, 0x007B71BD, 0x0A243CC8,
|
||||
0x1433082D, 0x1E6C4558, 0x008D92C7, 0x0AD2DFB2, 0x00F6E37A, 0x0AA9AE0F, 0x14487990, 0x1E1734E5,
|
||||
@@ -71,12 +75,23 @@ static const DWORD CRC_table[256] = {
|
||||
0x1886B265, 0x12D9FF10, 0x0C38288F, 0x066765FA, 0x0C435932, 0x061C1447, 0x18FDC3D8, 0x12A28EAD
|
||||
};
|
||||
|
||||
static DWORD crcInternal(BYTE* data, DWORD size) {
|
||||
DWORD crc = 0xffffffff;
|
||||
static DWORD CalcCRCInternal(BYTE* data, DWORD size) {
|
||||
DWORD crc = 0xFFFFFFFF;
|
||||
for (DWORD i = 0; i < size; i++) {
|
||||
crc = CRC_table[(((BYTE)(crc)) ^ data[i])] ^ (crc >> 8);
|
||||
}
|
||||
return crc ^ 0xffffffff;
|
||||
return crc ^ 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
static bool CheckExtraCRC(DWORD crc) {
|
||||
std::vector<std::string> extraCrcList = IniReader::GetListDefaultConfig("Debugging", "ExtraCRC", "", 512, ',');
|
||||
if (!extraCrcList.empty()) {
|
||||
return std::any_of(extraCrcList.begin(), extraCrcList.end(), [crc](const std::string& testCrcStr) -> bool {
|
||||
DWORD testedCrc = strtoul(testCrcStr.c_str(), 0, 16);
|
||||
return testedCrc && crc == testedCrc; // return for lambda
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CRC(const char* filepath) {
|
||||
@@ -84,47 +99,42 @@ bool CRC(const char* filepath) {
|
||||
|
||||
HANDLE h = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
MessageFail("Cannot open fallout2.exe for CRC check.");
|
||||
ExitMessageFail("Cannot open the game executable for CRC check.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD size = GetFileSize(h, 0);
|
||||
|
||||
if (size != ExpectedSize && GetIntDefaultConfig("Debugging", "SkipSizeCheck", 0) == 0) {
|
||||
CloseHandle(h);
|
||||
sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n"
|
||||
"Was expecting '" TARGETVERSION "'.\n\n"
|
||||
"fallout2.exe has an unexpected size. Expected %d bytes but got %d bytes.", ExpectedSize, size);
|
||||
MessageFail(buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD crc;
|
||||
BYTE* bytes = new BYTE[size];
|
||||
ReadFile(h, bytes, size, &crc, 0);
|
||||
CloseHandle(h);
|
||||
|
||||
crc = crcInternal(bytes, size);
|
||||
crc = CalcCRCInternal(bytes, size);
|
||||
delete[] bytes;
|
||||
|
||||
for (int i = 0; i < sizeof(ExpectedCRC) / 4; i++) {
|
||||
if (crc == ExpectedCRC[i]) return true;
|
||||
}
|
||||
|
||||
bool matchedCRC = false;
|
||||
|
||||
std::vector<std::string> extraCrcList = GetListDefaultConfig("Debugging", "ExtraCRC", "", 512, ',');
|
||||
if (!extraCrcList.empty()) {
|
||||
matchedCRC = std::any_of(extraCrcList.begin(), extraCrcList.end(), [crc](const std::string& testCrcStr) -> bool {
|
||||
DWORD testedCrc = strtoul(testCrcStr.c_str(), 0, 16);
|
||||
return testedCrc && crc == testedCrc; // return for lambda
|
||||
});
|
||||
}
|
||||
Retry:
|
||||
bool matchedCRC = CheckExtraCRC(crc);
|
||||
if (!matchedCRC) {
|
||||
sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n"
|
||||
"Was expecting '" TARGETVERSION "'.\n\n"
|
||||
"fallout2.exe has an unexpected CRC. Expected 0x%x but got 0x%x.", ExpectedCRC[0], crc);
|
||||
MessageFail(buf);
|
||||
"%s has an unexpected CRC.\nExpected 0x%x but got 0x%x.", filepath, ExpectedCRC[0], crc);
|
||||
|
||||
if (size == ExpectedSize) {
|
||||
switch (MessageBoxA(0, buf, "CRC Mismatch", MB_TASKMODAL | MB_ICONWARNING | MB_ABORTRETRYIGNORE)) {
|
||||
case IDABORT:
|
||||
ExitProcess(1);
|
||||
break;
|
||||
case IDRETRY:
|
||||
goto Retry;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
ExitMessageFail(buf);
|
||||
}
|
||||
return matchedCRC;
|
||||
}
|
||||
|
||||
@@ -28,35 +28,6 @@
|
||||
- use this macros outside of other __asm {} blocks (obviously)
|
||||
*/
|
||||
|
||||
// Macros for quick replacement of pushad/popad in script opcodes
|
||||
#define pushaop __asm push ebx __asm push ecx __asm push edx __asm push esi __asm push edi __asm push ebp
|
||||
#define popaop __asm pop ebp __asm pop edi __asm pop esi __asm pop edx __asm pop ecx __asm pop ebx
|
||||
|
||||
// rscript - 32-bit register where script pointer will be put (it is used for several related functions)
|
||||
#define _OP_BEGIN(rscript) __asm { \
|
||||
pushaop \
|
||||
__asm mov rscript, eax \
|
||||
}
|
||||
|
||||
#define _OP_END __asm { \
|
||||
popaop \
|
||||
__asm retn \
|
||||
}
|
||||
|
||||
/*
|
||||
Gets next argument from stack and puts its type to "rtype" and value to "rval"
|
||||
arguments come in reverse order (from last to first)
|
||||
all arguments should be valid r32 registers
|
||||
*/
|
||||
#define _GET_ARG_R32(rscript, rtype, rval) __asm { \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPopShort_ \
|
||||
__asm mov rtype, eax \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPopLong_ \
|
||||
__asm mov rval, eax \
|
||||
}
|
||||
|
||||
/*
|
||||
Gets argument from stack to eax and puts its type to edx register
|
||||
eax register must contain the script_ptr
|
||||
@@ -80,35 +51,6 @@
|
||||
__asm mov outVal, eax \
|
||||
}
|
||||
|
||||
/*
|
||||
checks argument (which may be any type) if it's a string and retrieves it (overwrites value in rval)
|
||||
num - any number, but it must be unique (used for label names)
|
||||
r16type - 16bit register where value type is stored
|
||||
rval - r32 where value is stored
|
||||
*/
|
||||
#define _CHECK_PARSE_STR(num, rscript, r16type, rval) __asm { \
|
||||
__asm cmp r16type, VAR_TYPE_STR2 \
|
||||
__asm jz skipgetstr##num \
|
||||
__asm cmp r16type, VAR_TYPE_STR \
|
||||
__asm jnz notstring##num \
|
||||
__asm skipgetstr##num: \
|
||||
__asm mov edx, e##r16type \
|
||||
__asm mov ebx, rval \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretGetString_ \
|
||||
__asm mov rval, eax } \
|
||||
notstring##num:
|
||||
|
||||
// must be immediately after C function call
|
||||
#define _RET_VAL_INT32(rscript) __asm { \
|
||||
__asm mov edx, eax \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPushLong_ \
|
||||
__asm mov edx, VAR_TYPE_INT \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPushShort_ \
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the value to the script
|
||||
eax and ebx register must contain the script_ptr
|
||||
@@ -127,49 +69,3 @@ notstring##num:
|
||||
__asm mov eax, ebx \
|
||||
__asm jmp fo::funcoffs::interpretPushShort_ \
|
||||
}
|
||||
|
||||
/*
|
||||
handle return value which may be of any type
|
||||
num - any unique number
|
||||
type - register or other expression (like memory address) where value type is stored (usually [esp])
|
||||
*/
|
||||
#define _RET_VAL_POSSIBLY_STR(num, rscript, type) __asm { \
|
||||
__asm mov ecx, eax \
|
||||
__asm mov edx, type \
|
||||
__asm cmp edx, VAR_TYPE_STR \
|
||||
__asm jne resultnotstr##num \
|
||||
__asm mov edx, eax \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretAddString_ \
|
||||
__asm mov ecx, eax \
|
||||
__asm resultnotstr##num: \
|
||||
__asm mov edx, ecx \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPushLong_ \
|
||||
__asm mov edx, type \
|
||||
__asm mov eax, rscript \
|
||||
__asm call fo::funcoffs::interpretPushShort_ \
|
||||
}
|
||||
|
||||
/*
|
||||
better way of handling new opcodes:
|
||||
- no ASM code required
|
||||
- all type checks should be done in the wrapped C-function
|
||||
- use opArgs, opArgTypes to access arguments
|
||||
- use opRet, opRetType to set return value
|
||||
|
||||
func - C-function to call (should not have arguments)
|
||||
argnum - number of opcode arguments
|
||||
isExpression - 1 if opcode has return value, 0 otherwise
|
||||
*/
|
||||
#define _WRAP_OPCODE(func, argnum, isExpression) __asm { \
|
||||
__asm push ecx \
|
||||
__asm push isExpression \
|
||||
__asm push argnum \
|
||||
__asm push func \
|
||||
__asm push eax \
|
||||
__asm lea ecx, opHandler \
|
||||
__asm call OpcodeHandler::handleOpcode \
|
||||
__asm pop ecx \
|
||||
__asm retn \
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ long GetItemType(fo::GameObject* item) {
|
||||
return GetProto(item->protoId)->item.type;
|
||||
}
|
||||
|
||||
__declspec(noinline) fo::GameObject* __stdcall GetItemPtrSlot(fo::GameObject* critter, fo::InvenType slot) {
|
||||
__declspec(noinline) fo::GameObject* GetItemPtrSlot(fo::GameObject* critter, fo::InvenType slot) {
|
||||
fo::GameObject* itemPtr = nullptr;
|
||||
switch (slot) {
|
||||
case fo::InvenType::INVEN_TYPE_LEFT_HAND:
|
||||
@@ -214,6 +214,29 @@ bool HeroIsFemale() {
|
||||
return (fo::func::stat_level(*fo::ptr::obj_dude, fo::Stat::STAT_gender) == fo::Gender::GENDER_FEMALE);
|
||||
}
|
||||
|
||||
// Alternative implementation of item_d_check_addict_ engine function with critter argument and returned addict queue data
|
||||
fo::QueueAddictData* __fastcall CheckAddictByPid(fo::GameObject* critter, long pid) {
|
||||
if (pid == -1) {
|
||||
// return queue of player addiction
|
||||
return (fo::QueueAddictData*)fo::func::queue_find_first(*fo::ptr::obj_dude, fo::QueueType::addict_event);
|
||||
}
|
||||
|
||||
fo::QueueAddictData* queue = (fo::QueueAddictData*)fo::func::queue_find_first(critter, fo::QueueType::addict_event);
|
||||
while (queue && queue->drugPid != pid) {
|
||||
queue = (fo::QueueAddictData*)fo::func::queue_find_next(critter, fo::QueueType::addict_event);
|
||||
}
|
||||
return queue; // return null or pointer to queue_addict
|
||||
}
|
||||
|
||||
fo::QueueRadiationData* __fastcall GetRadiationEvent(long type) {
|
||||
fo::QueueRadiationData* queue = (fo::QueueRadiationData*)fo::func::queue_find_first(*fo::ptr::obj_dude, fo::radiation_event);
|
||||
while (queue) {
|
||||
if (queue->init == type) return queue;
|
||||
queue = (fo::QueueRadiationData*)fo::func::queue_find_next(*fo::ptr::obj_dude, fo::radiation_event);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Checks whether the player is under the influence of negative effects of radiation
|
||||
long __fastcall IsRadInfluence() {
|
||||
fo::QueueRadiationData* queue = (fo::QueueRadiationData*)fo::func::queue_find_first(*fo::ptr::obj_dude, fo::radiation_event);
|
||||
@@ -266,7 +289,7 @@ void GetObjectsTileRadius(std::vector<fo::GameObject*> &objs, long sourceTile, l
|
||||
fo::GameObject* obj = fo::func::obj_find_first_at_tile(elev, tile);
|
||||
while (obj) {
|
||||
if (type == -1 || type == obj->Type()) {
|
||||
bool multiHex = (obj->flags & fo::ObjectFlag::MultiHex) ? true : false;
|
||||
char multiHex = (obj->flags & fo::ObjectFlag::MultiHex) ? 1 : 0;
|
||||
if (fo::func::tile_dist(sourceTile, obj->tile) <= (radius + multiHex)) {
|
||||
objs.push_back(obj);
|
||||
}
|
||||
@@ -394,7 +417,7 @@ void DrawToSurface(long width, long height, long fromX, long fromY, long fromWid
|
||||
//}
|
||||
|
||||
// Fills the specified interface window with index color
|
||||
bool __stdcall WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor) {
|
||||
bool WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor) {
|
||||
fo::Window* win = fo::func::GNW_find(winID);
|
||||
bool result = false;
|
||||
if ((x + width) > win->width) {
|
||||
@@ -433,8 +456,8 @@ void PrintFloatText(fo::GameObject* object, const char* text, long colorText, lo
|
||||
}
|
||||
|
||||
// print text to surface
|
||||
void __stdcall PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface) {
|
||||
DWORD posOffset = yPos * toWidth + xPos;
|
||||
void PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface) {
|
||||
DWORD posOffset = (yPos * toWidth) + xPos;
|
||||
__asm {
|
||||
xor eax, eax;
|
||||
mov al, colorIndex;
|
||||
@@ -444,12 +467,12 @@ void __stdcall PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD y
|
||||
mov eax, toSurface;
|
||||
mov ecx, toWidth;
|
||||
add eax, posOffset;
|
||||
call dword ptr ds:[FO_VAR_text_to_buf];
|
||||
call dword ptr ds:[FO_VAR_text_to_buf]; // calls FMtext_to_buf_ or GNW_text_to_buf_
|
||||
}
|
||||
}
|
||||
|
||||
void __stdcall PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface) {
|
||||
DWORD posOffset = yPos * toWidth + xPos;
|
||||
void PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface) {
|
||||
DWORD posOffset = (yPos * toWidth) + xPos;
|
||||
__asm {
|
||||
xor eax, eax;
|
||||
mov al, colorIndex;
|
||||
@@ -465,7 +488,7 @@ void __stdcall PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos,
|
||||
|
||||
//---------------------------------------------------------
|
||||
//gets the height of the currently selected font
|
||||
DWORD __stdcall GetTextHeight() {
|
||||
DWORD GetTextHeight() {
|
||||
// DWORD TxtHeight;
|
||||
__asm {
|
||||
call dword ptr ds:[FO_VAR_text_height]; //get text height
|
||||
@@ -476,27 +499,27 @@ DWORD __stdcall GetTextHeight() {
|
||||
|
||||
//---------------------------------------------------------
|
||||
//gets the length of a string using the currently selected font
|
||||
DWORD __stdcall GetTextWidth(const char* TextMsg) {
|
||||
DWORD GetTextWidth(const char* TextMsg) {
|
||||
__asm {
|
||||
mov eax, TextMsg;
|
||||
call dword ptr ds:[FO_VAR_text_width]; //get text width
|
||||
}
|
||||
}
|
||||
|
||||
DWORD __stdcall GetTextWidthFM(const char* TextMsg) {
|
||||
DWORD GetTextWidthFM(const char* TextMsg) {
|
||||
return fo::func::FMtext_width(TextMsg); //get text width
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
//get width of Char for current font
|
||||
DWORD __stdcall GetCharWidth(BYTE charVal) {
|
||||
DWORD GetCharWidth(BYTE charVal) {
|
||||
__asm {
|
||||
mov al, charVal;
|
||||
call dword ptr ds:[FO_VAR_text_char_width];
|
||||
}
|
||||
}
|
||||
|
||||
DWORD __stdcall GetCharWidthFM(BYTE charVal) {
|
||||
DWORD GetCharWidthFM(BYTE charVal) {
|
||||
__asm {
|
||||
mov al, charVal;
|
||||
call fo::funcoffs::FMtext_char_width_;
|
||||
@@ -505,7 +528,7 @@ DWORD __stdcall GetCharWidthFM(BYTE charVal) {
|
||||
|
||||
//---------------------------------------------------------
|
||||
//get maximum string length for current font - if all characters were maximum width
|
||||
DWORD __stdcall GetMaxTextWidth(const char* TextMsg) {
|
||||
DWORD GetMaxTextWidth(const char* TextMsg) {
|
||||
// DWORD msgWidth;
|
||||
__asm {
|
||||
mov eax, TextMsg;
|
||||
@@ -517,7 +540,7 @@ DWORD __stdcall GetMaxTextWidth(const char* TextMsg) {
|
||||
|
||||
//---------------------------------------------------------
|
||||
//get number of pixels between characters for current font
|
||||
DWORD __stdcall GetCharGapWidth() {
|
||||
DWORD GetCharGapWidth() {
|
||||
// DWORD gapWidth;
|
||||
__asm {
|
||||
call dword ptr ds:[FO_VAR_text_spacing];
|
||||
@@ -528,7 +551,7 @@ DWORD __stdcall GetCharGapWidth() {
|
||||
|
||||
//---------------------------------------------------------
|
||||
//get maximum character width for current font
|
||||
DWORD __stdcall GetMaxCharWidth() {
|
||||
DWORD GetMaxCharWidth() {
|
||||
// DWORD charWidth = 0;
|
||||
__asm {
|
||||
call dword ptr ds:[FO_VAR_text_max];
|
||||
|
||||
@@ -76,7 +76,7 @@ void SkillSetTags(long* tags, long num);
|
||||
|
||||
long GetItemType(fo::GameObject* item);
|
||||
|
||||
__declspec(noinline) fo::GameObject* __stdcall GetItemPtrSlot(fo::GameObject* critter, fo::InvenType slot);
|
||||
__declspec(noinline) fo::GameObject* GetItemPtrSlot(fo::GameObject* critter, fo::InvenType slot);
|
||||
|
||||
fo::AttackType GetHandSlotPrimaryAttack(fo::HandSlot slot);
|
||||
fo::AttackType GetHandSlotSecondaryAttack(fo::HandSlot slot);
|
||||
@@ -97,6 +97,11 @@ long ObjIsOpenable(fo::GameObject* object);
|
||||
|
||||
bool HeroIsFemale();
|
||||
|
||||
// Alternative implementation of item_d_check_addict_ engine function with critter argument and returned addict queue data
|
||||
fo::QueueAddictData* __fastcall CheckAddictByPid(fo::GameObject* critter, long pid);
|
||||
|
||||
fo::QueueRadiationData* __fastcall GetRadiationEvent(long type);
|
||||
|
||||
// Checks whether the player is under the influence of negative effects of radiation
|
||||
long __fastcall IsRadInfluence();
|
||||
|
||||
@@ -125,7 +130,7 @@ void DrawToSurface(long width, long height, long fromX, long fromY, long fromWid
|
||||
void DrawToSurface(long width, long height, long fromX, long fromY, long fromWidth, BYTE* fromSurf, long toX, long toY, long toWidth, long toHeight, BYTE* toSurf);
|
||||
|
||||
// Fills the specified interface window with index color
|
||||
bool __stdcall WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor);
|
||||
bool WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor);
|
||||
|
||||
// Fills the specified interface window with index color 0 (black color)
|
||||
void ClearWindow(long winID, bool refresh = true);
|
||||
@@ -133,28 +138,28 @@ void ClearWindow(long winID, bool refresh = true);
|
||||
void PrintFloatText(fo::GameObject* object, const char* text, long colorText, long colorOutline = 207, long font = 101);
|
||||
|
||||
// Print text to surface
|
||||
void __stdcall PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
|
||||
void __stdcall PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
|
||||
void PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
|
||||
void PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
|
||||
|
||||
// gets the height of the currently selected font
|
||||
DWORD __stdcall GetTextHeight();
|
||||
DWORD GetTextHeight();
|
||||
|
||||
// gets the length of a string using the currently selected font
|
||||
DWORD __stdcall GetTextWidth(const char* textMsg);
|
||||
DWORD __stdcall GetTextWidthFM(const char* textMsg);
|
||||
DWORD GetTextWidth(const char* textMsg);
|
||||
DWORD GetTextWidthFM(const char* textMsg);
|
||||
|
||||
// get width of Char for current font
|
||||
DWORD __stdcall GetCharWidth(BYTE charVal);
|
||||
DWORD __stdcall GetCharWidthFM(BYTE charVal);
|
||||
DWORD GetCharWidth(BYTE charVal);
|
||||
DWORD GetCharWidthFM(BYTE charVal);
|
||||
|
||||
// get maximum string length for current font - if all characters were maximum width
|
||||
DWORD __stdcall GetMaxTextWidth(const char* textMsg);
|
||||
DWORD GetMaxTextWidth(const char* textMsg);
|
||||
|
||||
// get number of pixels between characters for current font
|
||||
DWORD __stdcall GetCharGapWidth();
|
||||
DWORD GetCharGapWidth();
|
||||
|
||||
// get maximum character width for current font
|
||||
DWORD __stdcall GetMaxCharWidth();
|
||||
DWORD GetMaxCharWidth();
|
||||
|
||||
// Redraw the given object on screen (does not always redraws the whole object)
|
||||
void RedrawObject(fo::GameObject* obj);
|
||||
|
||||
+13
-45
@@ -19,6 +19,8 @@
|
||||
#pragma once
|
||||
#pragma warning(disable: 4482) // nonstandard extension used: enum 'name' used in qualified name (C++11)
|
||||
|
||||
#include "GamePids.h"
|
||||
|
||||
namespace fo
|
||||
{
|
||||
|
||||
@@ -288,43 +290,6 @@ enum ArtType : char
|
||||
OBJ_TYPE_SKILLDEX = 10
|
||||
};
|
||||
|
||||
// Some FO2 PIDs possibly used by engine
|
||||
enum ProtoID : unsigned long
|
||||
{
|
||||
PID_POWERED_ARMOR = 3,
|
||||
PID_STIMPAK = 40,
|
||||
PID_BOTTLE_CAPS = 41,
|
||||
PID_DYNAMITE = 51,
|
||||
PID_GEIGER_COUNTER = 52,
|
||||
PID_STEALTH_BOY = 54,
|
||||
PID_MOTION_SENSOR = 59,
|
||||
PID_PLASTIC_EXPLOSIVES = 85,
|
||||
PID_SUPER_STIMPAK = 144,
|
||||
PID_ACTIVE_DYNAMITE = 206,
|
||||
PID_ACTIVE_GEIGER_COUNTER = 207,
|
||||
PID_ACTIVE_PLASTIC_EXPLOSIVE = 209,
|
||||
PID_ACTIVE_STEALTH_BOY = 210,
|
||||
PID_HARDENED_POWER_ARMOR = 232,
|
||||
PID_JET = 259,
|
||||
PID_HEALING_POWDER = 273,
|
||||
PID_ADVANCED_POWER_ARMOR = 348,
|
||||
PID_ADVANCED_POWER_ARMOR_MK2 = 349,
|
||||
PID_SOLAR_SCORCHER = 390,
|
||||
PID_CAR_TRUNK = 455,
|
||||
PID_JESSE_CONTAINER = 467,
|
||||
|
||||
// critter
|
||||
PID_Player = 0x01000000,
|
||||
|
||||
// scenery
|
||||
PID_RAD_GOO_1 = 0x020003D9,
|
||||
PID_RAD_GOO_4 = 0x020003DC,
|
||||
PID_DRIVABLE_CAR = 0x020003F1, // index 1009
|
||||
|
||||
// misc type
|
||||
PID_CORPSE_BLOOD = 0x05000004,
|
||||
};
|
||||
|
||||
//XXXXXXXXXXXXXXXXXXXXX
|
||||
//XX Critter defines XX
|
||||
//XXXXXXXXXXXXXXXXXXXXX
|
||||
@@ -851,8 +816,9 @@ namespace WinFlags {
|
||||
}
|
||||
|
||||
namespace AIpref {
|
||||
enum distance : long
|
||||
enum Distance : long
|
||||
{
|
||||
DIST_unset = -1,
|
||||
DIST_stay_close = 0, // the attacker will stay at a distance no more than 5 hexes from the player (behavior only for party members, defined in ai_move_steps_closer, cai_perform_distance_prefs)
|
||||
DIST_charge = 1, // AI will always try to get close to its target before or after attack
|
||||
DIST_snipe = 2, // keep distance, when the distance between the attacker and the target decreases, the attacker will try to move away from the target to a distance of up to 10 hexes
|
||||
@@ -861,7 +827,7 @@ namespace AIpref {
|
||||
};
|
||||
|
||||
// presets for party members
|
||||
enum disposition : long
|
||||
enum Disposition : long
|
||||
{
|
||||
DISP_none = -1,
|
||||
DISP_custom = 0,
|
||||
@@ -871,7 +837,7 @@ namespace AIpref {
|
||||
DISP_berserk = 4
|
||||
};
|
||||
|
||||
enum attack_who : long
|
||||
enum AttackWho : long
|
||||
{
|
||||
ATKWHO_no_attack_mode = -1,
|
||||
ATKWHO_whomever_attacking_me = 0, // attack the target that the player is attacking (only for party members)
|
||||
@@ -881,7 +847,7 @@ namespace AIpref {
|
||||
ATKWHO_closest = 4, // only attack near targets
|
||||
};
|
||||
|
||||
enum run_away_mode : long
|
||||
enum RunAway : long
|
||||
{
|
||||
AWAY_none = -1, // get the value from the cap.min_hp (in cai_get_min_hp_)
|
||||
AWAY_coward = 0, // 0%
|
||||
@@ -892,9 +858,10 @@ namespace AIpref {
|
||||
AWAY_never = 5 // 100%
|
||||
};
|
||||
|
||||
enum weapon_pref : long
|
||||
enum WeaponPref : long
|
||||
{
|
||||
WEAPON_no_pref = 0,
|
||||
WEAPON_unset = -1, // same as no_pref
|
||||
WEAPON_no_pref = 0, // Guns > ...
|
||||
WEAPON_melee = 1,
|
||||
WEAPON_melee_over_ranged = 2,
|
||||
WEAPON_ranged_over_melee = 3,
|
||||
@@ -904,7 +871,7 @@ namespace AIpref {
|
||||
WEAPON_random = 7 // not available for party member in control panel
|
||||
};
|
||||
|
||||
enum area_attack_mode : long
|
||||
enum AreaAttack : long
|
||||
{
|
||||
AREA_no_pref = -1, // special logic for NPC (not available for party member in control panel)
|
||||
AREA_always = 0,
|
||||
@@ -914,8 +881,9 @@ namespace AIpref {
|
||||
AREA_be_absolutely_sure = 4, // 95% hit chance
|
||||
};
|
||||
|
||||
enum chem_use_mode : long
|
||||
enum ChemUse : long
|
||||
{
|
||||
CHEM_unset = -1,
|
||||
CHEM_clean = 0,
|
||||
CHEM_stims_when_hurt_little = 1,
|
||||
CHEM_stims_when_hurt_lots = 2,
|
||||
|
||||
@@ -143,6 +143,7 @@ FUNC(critter_name_, 0x42D0A8)
|
||||
FUNC(critter_pc_set_name_, 0x42D138)
|
||||
FUNC(critter_wake_clear_, 0x42E460)
|
||||
FUNC(critter_wake_up_, 0x42E424)
|
||||
FUNC(cscale_, 0x4D33F0)
|
||||
FUNC(datafileConvertData_, 0x42EE84)
|
||||
FUNC(db_access_, 0x4390B4)
|
||||
FUNC(db_dir_entry_, 0x4C5D68)
|
||||
@@ -258,6 +259,7 @@ FUNC(gmouse_is_scrolling_, 0x44B54C)
|
||||
FUNC(gmouse_set_cursor_, 0x44C840)
|
||||
FUNC(gmovieIsPlaying_, 0x44EB14)
|
||||
FUNC(gmovie_play_, 0x44E690)
|
||||
FUNC(grid_toggle_, 0x4B2E60)
|
||||
FUNC(gsnd_anim_sound_, 0x4514F0)
|
||||
FUNC(gsnd_build_weapon_sfx_name_, 0x451760)
|
||||
FUNC(gsound_background_pause_, 0x450B50)
|
||||
@@ -325,7 +327,7 @@ FUNC(item_c_curr_size_, 0x479A20)
|
||||
FUNC(item_c_max_size_, 0x479A00)
|
||||
FUNC(item_caps_total_, 0x47A6A8)
|
||||
FUNC(item_count_, 0x47808C)
|
||||
FUNC(item_d_check_addict_, 0x47A640)
|
||||
FUNC(item_d_check_addict_, 0x47A640) // only for dude
|
||||
FUNC(item_d_take_drug_, 0x479F60)
|
||||
FUNC(item_drop_all_, 0x477804)
|
||||
FUNC(item_get_type_, 0x477AFC)
|
||||
@@ -391,6 +393,8 @@ FUNC(map_get_short_name_, 0x48261C)
|
||||
FUNC(map_load_, 0x482A68)
|
||||
FUNC(map_load_file_, 0x482B74)
|
||||
FUNC(map_load_idx_, 0x482B34)
|
||||
FUNC(map_scroll_refresh_game_, 0x483EE4)
|
||||
FUNC(map_scroll_refresh_mapper_, 0x483F44)
|
||||
FUNC(map_set_elevation_, 0x482158)
|
||||
FUNC(map_target_load_area_, 0x48358C)
|
||||
FUNC(mem_free_, 0x4C5C24)
|
||||
@@ -416,6 +420,8 @@ FUNC(movieStop_, 0x487150)
|
||||
FUNC(movieUpdate_, 0x487BEC)
|
||||
FUNC(my_free_, 0x4C5C2C)
|
||||
FUNC(new_obj_id_, 0x4A386C)
|
||||
FUNC(nfree_, 0x4EF2B4)
|
||||
FUNC(nmalloc_, 0x4EF1C5)
|
||||
FUNC(nrealloc_, 0x4F1669)
|
||||
FUNC(objPMAttemptPlacement_, 0x49D628)
|
||||
FUNC(obj_ai_blocking_at_, 0x48BA20)
|
||||
@@ -518,6 +524,8 @@ FUNC(rect_clip_, 0x4C6AAC)
|
||||
FUNC(rect_malloc_, 0x4C6BB8)
|
||||
FUNC(refresh_all_, 0x4D7814)
|
||||
FUNC(refresh_box_bar_win_, 0x4614CC)
|
||||
FUNC(refresh_game_, 0x4B15E8)
|
||||
FUNC(refresh_mapper_, 0x4B1554)
|
||||
FUNC(register_begin_, 0x413AF4)
|
||||
FUNC(register_clear_, 0x413C4C)
|
||||
FUNC(register_end_, 0x413CCC)
|
||||
|
||||
@@ -69,6 +69,14 @@ void dev_printf(...) {}
|
||||
__asm push arg7 \
|
||||
WRAP_WATCOM_CALL6(offs, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define WRAP_WATCOM_CALL8(offs, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
|
||||
__asm push arg8 \
|
||||
WRAP_WATCOM_CALL7(offs, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
||||
|
||||
#define WRAP_WATCOM_CALL9(offs, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
|
||||
__asm push arg9 \
|
||||
WRAP_WATCOM_CALL8(offs, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
||||
|
||||
// defines wrappers for __fastcall
|
||||
#define WRAP_WATCOM_FCALL1(offs, arg1) \
|
||||
__asm mov eax, ecx \
|
||||
@@ -113,7 +121,7 @@ void __declspec(naked) debug_printf(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::debug_printf_;
|
||||
}
|
||||
|
||||
void __stdcall interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType) {
|
||||
void interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType) {
|
||||
__asm {
|
||||
mov esi, scriptPtr;
|
||||
mov edx, val;
|
||||
@@ -137,6 +145,11 @@ void __declspec(naked) interpretError(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::interpretError_;
|
||||
}
|
||||
|
||||
long __fastcall db_init(const char* path_dat, const char* path_patches) {
|
||||
__asm mov ebx, edx; // don't delete
|
||||
WRAP_WATCOM_FCALL2(db_init_, path_dat, path_patches);
|
||||
}
|
||||
|
||||
long __fastcall tile_num(long x, long y) {
|
||||
__asm xor ebx, ebx; // don't delete (bug in tile_num_)
|
||||
WRAP_WATCOM_FCALL2(tile_num_, x, y);
|
||||
@@ -437,6 +450,21 @@ long __fastcall get_game_config_string(const char** outValue, const char* sectio
|
||||
WRAP_WATCOM_CALL6(name##_, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
}
|
||||
|
||||
#define WRAP_WATCOM_FUNC7(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7) { \
|
||||
WRAP_WATCOM_CALL7(name##_, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
|
||||
}
|
||||
|
||||
#define WRAP_WATCOM_FUNC8(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7, arg8t, arg8) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7, arg8t arg8) { \
|
||||
WRAP_WATCOM_CALL8(name##_, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
|
||||
}
|
||||
|
||||
#define WRAP_WATCOM_FUNC9(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7, arg8t, arg8, arg9t, arg9) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7, arg8t arg8, arg9t arg9) { \
|
||||
WRAP_WATCOM_CALL9(name##_, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
|
||||
}
|
||||
|
||||
|
||||
#define WRAP_WATCOM_FFUNC1(retType, name, arg1t, arg1) \
|
||||
retType __fastcall name(arg1t arg1) { \
|
||||
|
||||
@@ -44,12 +44,14 @@ void dev_printf(...);
|
||||
// prints message to debug.log file
|
||||
void __declspec() debug_printf(const char* fmt, ...);
|
||||
|
||||
void __stdcall interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType);
|
||||
void interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType);
|
||||
|
||||
// prints scripting error in debug.log and stops current script execution by performing longjmp
|
||||
// USE WITH CAUTION
|
||||
void __declspec() interpretError(const char* fmt, ...);
|
||||
|
||||
long __fastcall db_init(const char* path_dat, const char* path_patches);
|
||||
|
||||
long __fastcall tile_num(long x, long y);
|
||||
|
||||
GameObject* __fastcall obj_blocking_at_wrapper(GameObject* obj, DWORD tile, DWORD elevation, void* func);
|
||||
@@ -104,6 +106,15 @@ long __fastcall get_game_config_string(const char** outValue, const char* sectio
|
||||
#define WRAP_WATCOM_FUNC6(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6);
|
||||
|
||||
#define WRAP_WATCOM_FUNC7(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7);
|
||||
|
||||
#define WRAP_WATCOM_FUNC8(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7, arg8t, arg8) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7, arg8t arg8);
|
||||
|
||||
#define WRAP_WATCOM_FUNC9(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7, arg8t, arg8, arg9t, arg9) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7, arg8t arg8, arg9t arg9);
|
||||
|
||||
|
||||
#define WRAP_WATCOM_FFUNC1(retType, name, arg1t, arg1) \
|
||||
retType __fastcall name(arg1t arg1);
|
||||
@@ -141,7 +152,9 @@ long __fastcall get_game_config_string(const char** outValue, const char* sectio
|
||||
#undef WRAP_WATCOM_FUNC4
|
||||
#undef WRAP_WATCOM_FUNC5
|
||||
#undef WRAP_WATCOM_FUNC6
|
||||
//#undef WRAP_WATCOM_FUNC7
|
||||
#undef WRAP_WATCOM_FUNC7
|
||||
#undef WRAP_WATCOM_FUNC8
|
||||
#undef WRAP_WATCOM_FUNC9
|
||||
|
||||
#undef WRAP_WATCOM_FFUNC1
|
||||
#undef WRAP_WATCOM_FFUNC2
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user