Moved DontDeleteProtos option from MiscPatches.cpp to DebugEditor.cpp.

Updated Auto Doors script mod from Mr.Stalin and ddraw.ini.
This commit is contained in:
NovaRain
2019-02-11 13:58:21 +08:00
parent d64b33a946
commit fe5a148d7f
6 changed files with 53 additions and 28 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ SpeedMulti9=900
;The initial speed at game startup ;The initial speed at game startup
SpeedMultiInitial=100 SpeedMultiInitial=100
;Set to 1 to also affect the playback speed of videos without audio tracks ;Set to 1 to also affect the playback speed of mve video files without an audio track
AffectPlayback=0 AffectPlayback=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Binary file not shown.
@@ -1,7 +1,7 @@
/* /*
Auto Doors mod for Fallout 2 by Mr.Stalin Auto Doors mod v1.1 for Fallout 2 by Mr.Stalin
----------------------------------------- ----------------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat - allows the player to automatically open/walk through unlocked doors when not in combat
@@ -12,66 +12,91 @@ NOTE: this script requires compiler from sfall modderspack with -s option
*/ */
/* Include Files */
#include "..\headers\define.h" #include "..\headers\define.h"
#include "..\headers\command.h" //#include "..\headers\command.h"
#include "..\headers\sfall\sfall.h" #include "..\..\scripting_docs\headers\sfall.h"
#include "..\headers\sfall\define_extra.h" #include "..\..\scripting_docs\headers\define_extra.h"
/* Standard Script Procedures */
procedure start; procedure start;
procedure map_enter_p_proc; procedure map_enter_p_proc;
procedure set_door_flag(variable state); procedure set_door_flag(variable state);
procedure set_door_flag_array(variable state);
procedure combatturn_handler; procedure combatturn_handler;
/* Defines */
#define PORTAL (0) #define PORTAL (0)
#define DOOR_FLAGS (0x24) #define DOOR_FLAGS (0x24)
variable only_once := 0; variable only_once := 0;
variable arrayPid;
procedure start begin procedure start begin
if game_loaded then begin if game_loaded then begin
if (sfall_ver_major >= 4) then if (sfall_ver_major >= 4) then
register_hook_proc(HOOK_COMBATTURN, combatturn_handler); register_hook_proc(HOOK_COMBATTURN, combatturn_handler);
else else
set_global_script_repeat(60); set_global_script_repeat(40); // for sfall 3.x
call map_enter_p_proc; call map_enter_p_proc;
end else begin end else begin
if (only_once == 1 and combat_is_initialized) then begin if (only_once == 1 and combat_is_initialized) then begin
only_once := 2; only_once := 2;
call set_door_flag(false); call set_door_flag(0); // reset flag when entering combat mode
end else if (only_once == 2 and not(combat_is_initialized)) then begin end else if (only_once == 2 and not(combat_is_initialized)) then begin
only_once := 1; only_once := 1;
if (sfall_ver_major >= 4) then if (sfall_ver_major >= 4) then set_global_script_repeat(0);
set_global_script_repeat(0); call set_door_flag(FLAG_WALKTHRU); // set flag after combat mode ends
call set_door_flag(FLAG_WALKTHRU);
end end
end end
end end
procedure map_enter_p_proc begin procedure map_enter_p_proc begin
if (arrayPid) then begin
// when changing maps, delete the current array to create a new one
free_array(arrayPid);
arrayPid := 0;
end
only_once := 1; only_once := 1;
call set_door_flag(FLAG_WALKTHRU); call set_door_flag(FLAG_WALKTHRU); // set flag when entering the map
end end
procedure set_door_flag(variable state) begin procedure set_door_flag(variable state) begin
variable objectMap, obj, objPid, arrayPid, i; variable objectMap, obj, objPid, i;
if (arrayPid) then begin
call set_door_flag_array(state);
return;
end
objectMap := list_as_array(LIST_SCENERY); objectMap := list_as_array(LIST_SCENERY);
arrayPid := temp_array(1, 0); arrayPid := create_array(0, 0);
foreach (obj in objectMap) begin foreach (obj in objectMap) begin
objPid := obj_pid(obj); objPid := obj_pid(obj);
if (proto_data(objPid, sc_type) != PORTAL) or is_in_array(objPid, arrayPid) then if (proto_data(objPid, sc_type) != PORTAL) or is_in_array(objPid, arrayPid) then
continue; continue; // next object
resize_array(arrayPid, i + 1);
arrayPid[i] := objPid; arrayPid[i] := objPid;
i++; i++;
resize_array(arrayPid, i + 1); set_proto_data(objPid, DOOR_FLAGS, state);
end
end
procedure set_door_flag_array(variable state) begin
variable objPid;
foreach (objPid in arrayPid) begin
set_proto_data(objPid, DOOR_FLAGS, state); set_proto_data(objPid, DOOR_FLAGS, state);
end end
end end
procedure combatturn_handler begin procedure combatturn_handler begin
if (only_once == 1) then if (only_once == 1) then begin
only_once := 2;
call set_door_flag_array(0);
set_global_script_repeat(60); set_global_script_repeat(60);
end
end end
+2 -2
View File
@@ -1,5 +1,5 @@
Auto Doors mod for Fallout 2 by Mr.Stalin Auto Doors mod v1.1 for Fallout 2 by Mr.Stalin
----------------------------------------- ----------------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat - allows the player to automatically open/walk through unlocked doors when not in combat
+9
View File
@@ -293,9 +293,18 @@ void DebugModePatch() {
} }
} }
void DontDeleteProtosPatch() {
if (GetPrivateProfileIntA("Debugging", "DontDeleteProtos", 0, ::sfall::ddrawIni)) {
dlog("Applying permanent protos patch.", DL_INIT);
SafeWrite8(0x48007E, 0xEB);
dlogr(" Done", DL_INIT);
}
}
void DebugEditor::init() { void DebugEditor::init() {
if (!isDebug) return; if (!isDebug) return;
DebugModePatch(); DebugModePatch();
DontDeleteProtosPatch();
debugEditorKey = GetConfigInt("Input", "DebugEditorKey", 0); debugEditorKey = GetConfigInt("Input", "DebugEditorKey", 0);
if (debugEditorKey != 0) { if (debugEditorKey != 0) {
-9
View File
@@ -739,14 +739,6 @@ void DialogueFix() {
} }
} }
void DontDeleteProtosPatch() {
if (isDebug && GetPrivateProfileIntA("Debugging", "DontDeleteProtos", 0, ::sfall::ddrawIni)) {
dlog("Applying permanent protos patch.", DL_INIT);
SafeWrite8(0x48007E, 0xEB);
dlogr(" Done", DL_INIT);
}
}
void AlwaysReloadMsgs() { void AlwaysReloadMsgs() {
if (GetConfigInt("Misc", "AlwaysReloadMsgs", 0)) { if (GetConfigInt("Misc", "AlwaysReloadMsgs", 0)) {
dlog("Applying always reload messages patch.", DL_INIT); dlog("Applying always reload messages patch.", DL_INIT);
@@ -932,7 +924,6 @@ void MiscPatches::init() {
CombatProcFix(); CombatProcFix();
NpcAutoLevelPatch(); NpcAutoLevelPatch();
DialogueFix(); DialogueFix();
DontDeleteProtosPatch();
AdditionalWeaponAnimsPatch(); AdditionalWeaponAnimsPatch();
MultiPatchesPatch(); MultiPatchesPatch();
AlwaysReloadMsgs(); AlwaysReloadMsgs();