Backported "create_win" script function and InterfaceDontMoveOnTop option from the developt branch.

Updated version number.
This commit is contained in:
NovaRain
2018-10-02 12:15:48 +08:00
parent e672db53c7
commit d117296990
10 changed files with 59 additions and 5 deletions
+4 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.8.11
;v3.8.12
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -615,6 +615,9 @@ NumbersInDialogue=0
;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map
WorldMapFontPatch=0
;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
InterfaceDontMoveOnTop=0
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
+2
View File
@@ -189,6 +189,8 @@
#define party_member_list_all party_member_list(1)
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
@@ -388,6 +388,11 @@ Some utility/math functions are available:
> int sfall_func1("get_current_inven_size", object)
- returns the current inventory size of the container or the critter
> 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 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
------------------------
------ MORE INFO -------
------------------------
+14
View File
@@ -265,6 +265,7 @@ const DWORD compute_damage_ = 0x4247B8;
const DWORD config_set_value_ = 0x42C160;
const DWORD container_exit_ = 0x476394;
const DWORD correctFidForRemovedItem_ = 0x45409C;
const DWORD createWindow_ = 0x4B7F3C;
const DWORD credits_ = 0x42C860;
const DWORD credits_get_next_line_ = 0x42CE6C;
const DWORD critter_body_type_ = 0x42DDC4;
@@ -848,3 +849,16 @@ TGameObj* __stdcall InvenRightHand(TGameObj* critter) {
call inven_right_hand_
}
}
int __stdcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, DWORD bgColorIndex, DWORD flags) {
__asm {
push flags
push bgColorIndex
push height
mov ecx, width
mov ebx, y
mov edx, x
mov eax, winName
call createWindow_
}
}
+4
View File
@@ -450,6 +450,7 @@ extern const DWORD compute_damage_;
extern const DWORD config_set_value_;
extern const DWORD container_exit_;
extern const DWORD correctFidForRemovedItem_; // (int critter@<eax>, int oldArmor@<edx>, int removeSlotsFlags@<ebx>)
extern const DWORD createWindow_;
extern const DWORD credits_;
extern const DWORD credits_get_next_line_;
extern const DWORD critter_body_type_;
@@ -941,3 +942,6 @@ void __declspec() DebugPrintf(const char* fmt, ...);
// returns the name of current procedure by program pointer
const char* __stdcall FindCurrentProc(TProgram* program);
// creates a window with the name and flags
int __stdcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, DWORD bgColorIndex, DWORD flags);
+1
View File
@@ -375,6 +375,7 @@ static const SfallOpcodeMetadata opcodeMetaArray[] = {
{sf_spatial_radius, "spatial_radius", {DATATYPE_MASK_VALID_OBJ}},
{sf_critter_inven_obj2, "critter_inven_obj2", {DATATYPE_MASK_VALID_OBJ, DATATYPE_MASK_INT}},
{sf_set_ini_setting, "set_ini_setting", {DATATYPE_MASK_STR, DATATYPE_MASK_INT | DATATYPE_MASK_STR}},
{sf_create_win, "create_win", {DATATYPE_MASK_STR, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT}},
//{op_message_str_game, {}}
};
+18 -1
View File
@@ -466,4 +466,21 @@ static void sf_intface_is_hidden() {
mov isHidden, eax;
}
opHandler.setReturn(isHidden);
}
}
static void sf_create_win() {
int flags;
if (opHandler.numArgs() == 6) {
flags = opHandler.arg(5).asInt();
} else {
flags = 0x4; // MoveOnTop
}
if (CreateWindowFunc(opHandler.arg(0).asString(),
opHandler.arg(1).asInt(), opHandler.arg(2).asInt(), // y, x
opHandler.arg(3).asInt(), opHandler.arg(4).asInt(), // w, h
256, flags) == -1)
{
opHandler.printOpcodeError("create_win() - couldn't create window.");
}
}
+1
View File
@@ -104,6 +104,7 @@ static void sf_get_metarule_table() {
*/
static const SfallMetarule metaruleArray[] = {
{"critter_inven_obj2", sf_critter_inven_obj2, 2, 2},
{"create_win", sf_create_win, 5, 6},
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
{"floor2", sf_floor2, 1, 1},
{"get_current_inven_size", sf_get_current_inven_size, 1, 1},
+7
View File
@@ -1545,6 +1545,13 @@ static void DllMain2() {
dlogr(" Done", DL_INIT);
}
if (GetPrivateProfileIntA("Misc", "InterfaceDontMoveOnTop", 0, ini)) {
dlog("Applying InterfaceDontMoveOnTop patch.", DL_INIT);
SafeWrite8(0x46ECE9, 0x10); // set only Exclusive flag for Player Inventory/Loot/UseOn
SafeWrite8(0x41B966, 0x10); // set only Exclusive flag for Automap
dlogr(" Done", DL_INIT);
}
dlogr("Leave DllMain2", DL_MAIN);
}
+3 -3
View File
@@ -24,13 +24,13 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 8
#define VERSION_BUILD 11
#define VERSION_BUILD 12
#define VERSION_REV 0
#ifdef WIN2K
#define VERSION_STRING "3.8.11 win2k"
#define VERSION_STRING "3.8.12 win2k"
#else
#define VERSION_STRING "3.8.11"
#define VERSION_STRING "3.8.12"
#endif
#define CHECK_VAL (4)