Added MapGridToggleKey debug option from 4.x

Fixed db_init function wrapper.
Minor edits to ddraw.ini.
This commit is contained in:
NovaRain
2021-12-21 09:51:09 +08:00
parent 97f3d3eb5f
commit 68389d9474
10 changed files with 45 additions and 10 deletions
+9 -5
View File
@@ -2,7 +2,7 @@
;v3.8.33 ;v3.8.33
[Main] [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 args 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 ;This option is always enabled in 4.3.3/3.8.33 or later. The information is left for reference only
UseCommandLine=0 UseCommandLine=0
@@ -158,7 +158,7 @@ BackgroundMouse=0
SpeedModKey=-1 SpeedModKey=-1
;A key to press to toggle the speed tweak on or off ;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 SpeedToggleKey=0
;The keys corresponding to the 10 speed slots ;The keys corresponding to the 10 speed slots
@@ -249,8 +249,8 @@ WorldMapEncounterFix=0
WorldMapEncounterRate=5 WorldMapEncounterRate=5
;The number of slots available in the locations list panel of the world map ;The number of slots available in the locations list panel of the world map
;Set to 0 to leave unchanged. 17 is default. ;Set to 0 to leave the default unchanged (i.e. 17). The maximum is 127
;Setting this greater than 17 requires a replacement background FRM, or you'll get glitched graphics ;Setting this greater than 17 requires a replacement WMTABS.frm file in art\intrface\, or you'll get glitched graphics
WorldMapSlots=0 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 ;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
@@ -831,7 +831,7 @@ AllowUnsafeScripting=0
;Does not require sfall debugging mode ;Does not require sfall debugging mode
SkipSizeCheck=0 SkipSizeCheck=0
;Change to 1 to skip the compatibility mode check ;Set to 1 to skip the compatibility mode check
SkipCompatModeCheck=0 SkipCompatModeCheck=0
;Fallout 2 Debug Patch ;Fallout 2 Debug Patch
@@ -854,6 +854,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 ;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
HideObjIsNullMsg=0 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 ;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 ;Has pretty nasty side effects when saving/reloading, so don't use for regular gameplay
DontDeleteProtos=0 DontDeleteProtos=0
@@ -259,6 +259,7 @@ FUNC(gmouse_is_scrolling_, 0x44B54C)
FUNC(gmouse_set_cursor_, 0x44C840) FUNC(gmouse_set_cursor_, 0x44C840)
FUNC(gmovieIsPlaying_, 0x44EB14) FUNC(gmovieIsPlaying_, 0x44EB14)
FUNC(gmovie_play_, 0x44E690) FUNC(gmovie_play_, 0x44E690)
FUNC(grid_toggle_, 0x4B2E60)
FUNC(gsnd_anim_sound_, 0x4514F0) FUNC(gsnd_anim_sound_, 0x4514F0)
FUNC(gsnd_build_weapon_sfx_name_, 0x451760) FUNC(gsnd_build_weapon_sfx_name_, 0x451760)
FUNC(gsound_background_pause_, 0x450B50) FUNC(gsound_background_pause_, 0x450B50)
@@ -392,6 +393,8 @@ FUNC(map_get_short_name_, 0x48261C)
FUNC(map_load_, 0x482A68) FUNC(map_load_, 0x482A68)
FUNC(map_load_file_, 0x482B74) FUNC(map_load_file_, 0x482B74)
FUNC(map_load_idx_, 0x482B34) FUNC(map_load_idx_, 0x482B34)
FUNC(map_scroll_refresh_game_, 0x483EE4)
FUNC(map_scroll_refresh_mapper_, 0x483F44)
FUNC(map_set_elevation_, 0x482158) FUNC(map_set_elevation_, 0x482158)
FUNC(map_target_load_area_, 0x48358C) FUNC(map_target_load_area_, 0x48358C)
FUNC(mem_free_, 0x4C5C24) FUNC(mem_free_, 0x4C5C24)
@@ -521,6 +524,8 @@ FUNC(rect_clip_, 0x4C6AAC)
FUNC(rect_malloc_, 0x4C6BB8) FUNC(rect_malloc_, 0x4C6BB8)
FUNC(refresh_all_, 0x4D7814) FUNC(refresh_all_, 0x4D7814)
FUNC(refresh_box_bar_win_, 0x4614CC) FUNC(refresh_box_bar_win_, 0x4614CC)
FUNC(refresh_game_, 0x4B15E8)
FUNC(refresh_mapper_, 0x4B1554)
FUNC(register_begin_, 0x413AF4) FUNC(register_begin_, 0x413AF4)
FUNC(register_clear_, 0x413C4C) FUNC(register_clear_, 0x413C4C)
FUNC(register_end_, 0x413CCC) FUNC(register_end_, 0x413CCC)
+5
View File
@@ -145,6 +145,11 @@ void __declspec(naked) interpretError(const char* fmt, ...) {
__asm jmp fo::funcoffs::interpretError_; __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) { long __fastcall tile_num(long x, long y) {
__asm xor ebx, ebx; // don't delete (bug in tile_num_) __asm xor ebx, ebx; // don't delete (bug in tile_num_)
WRAP_WATCOM_FCALL2(tile_num_, x, y); WRAP_WATCOM_FCALL2(tile_num_, x, y);
+2
View File
@@ -50,6 +50,8 @@ void interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType);
// USE WITH CAUTION // USE WITH CAUTION
void __declspec() interpretError(const char* fmt, ...); 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); long __fastcall tile_num(long x, long y);
GameObject* __fastcall obj_blocking_at_wrapper(GameObject* obj, DWORD tile, DWORD elevation, void* func); GameObject* __fastcall obj_blocking_at_wrapper(GameObject* obj, DWORD tile, DWORD elevation, void* func);
-1
View File
@@ -262,7 +262,6 @@ WRAP_WATCOM_FUNC2(long, db_dir_entry, const char*, fileName, DWORD*, sizeOut) //
// Searches files in DB by given path/filename mask and stores result in fileList // Searches files in DB by given path/filename mask and stores result in fileList
// fileList is a pointer to a variable, that will be assigned with an address of an array of char* strings // fileList is a pointer to a variable, that will be assigned with an address of an array of char* strings
WRAP_WATCOM_FUNC2(long, db_get_file_list, const char*, searchMask, char***, fileList) // Returns number of elements in *fileList WRAP_WATCOM_FUNC2(long, db_get_file_list, const char*, searchMask, char***, fileList) // Returns number of elements in *fileList
WRAP_WATCOM_FUNC2(long, db_init, const char*, path_dat, const char*, path_patches)
WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName) WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName)
WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr) WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr)
+2
View File
@@ -170,6 +170,7 @@
#define FO_VAR_map_global_vars 0x51956C #define FO_VAR_map_global_vars 0x51956C
#define FO_VAR_map_name 0x631D58 #define FO_VAR_map_name 0x631D58
#define FO_VAR_map_number 0x631D88 #define FO_VAR_map_number 0x631D88
#define FO_VAR_map_scroll_refresh 0x519540
#define FO_VAR_map_state 0x631D28 #define FO_VAR_map_state 0x631D28
#define FO_VAR_mapEntranceElevation 0x519558 #define FO_VAR_mapEntranceElevation 0x519558
#define FO_VAR_mapEntranceTileNum 0x51955C #define FO_VAR_mapEntranceTileNum 0x51955C
@@ -291,6 +292,7 @@
#define FO_VAR_text_to_buf 0x51E3B8 #define FO_VAR_text_to_buf 0x51E3B8
#define FO_VAR_text_width 0x51E3C0 #define FO_VAR_text_width 0x51E3C0
#define FO_VAR_tile 0x631D30 #define FO_VAR_tile 0x631D30
#define FO_VAR_tile_refresh 0x51D964
#define FO_VAR_title_color 0x56D750 #define FO_VAR_title_color 0x56D750
#define FO_VAR_title_font 0x56D748 #define FO_VAR_title_font 0x56D748
#define FO_VAR_trait_data 0x51DB84 #define FO_VAR_trait_data 0x51DB84
+16 -2
View File
@@ -51,7 +51,8 @@ enum DECode {
static const char* debugLog = "LOG"; static const char* debugLog = "LOG";
static const char* debugGnw = "GNW"; static const char* debugGnw = "GNW";
static DWORD debugEditorKey = 0; static DWORD debugEditorKey;
static DWORD mapGridToggleKey;
struct sArray { struct sArray {
DWORD id; DWORD id;
@@ -518,6 +519,13 @@ void CheckTimerResolution() {
} }
*/ */
void DebugEditor::OnAfterGameInit() {
if (mapGridToggleKey) {
fo::var::setInt(FO_VAR_tile_refresh) = fo::funcoffs::refresh_mapper_;
//fo::var::setInt(FO_VAR_map_scroll_refresh) = fo::funcoffs::map_scroll_refresh_mapper_;
}
}
void DebugEditor::init() { void DebugEditor::init() {
DebugModePatch(); DebugModePatch();
@@ -536,12 +544,18 @@ void DebugEditor::init() {
DontDeleteProtosPatch(); DontDeleteProtosPatch();
debugEditorKey = IniReader::GetConfigInt("Input", "DebugEditorKey", 0); debugEditorKey = IniReader::GetConfigInt("Input", "DebugEditorKey", 0);
mapGridToggleKey = IniReader::GetIntDefaultConfig("Debugging", "MapGridToggleKey", 0);
} }
void DebugEditor::KeyPressedHook(DWORD scanCode, bool pressed) { void DebugEditor::KeyPressedHook(DWORD scanCode, bool pressed) {
if (debugEditorKey != 0 && scanCode == debugEditorKey && pressed && IsGameLoaded()) { if (debugEditorKey && scanCode == debugEditorKey && pressed && IsGameLoaded()) {
RunDebugEditor(); RunDebugEditor();
} }
if (mapGridToggleKey && scanCode == mapGridToggleKey && pressed && IsGameLoaded()) {
__asm call fo::funcoffs::grid_toggle_;
fo::func::tile_refresh_display();
}
} }
} }
+2
View File
@@ -8,6 +8,8 @@ public:
static const char* name() { return "Debug Editor"; } static const char* name() { return "Debug Editor"; }
static void init(); static void init();
static void OnAfterGameInit();
static void KeyPressedHook(DWORD scanCode, bool pressed); static void KeyPressedHook(DWORD scanCode, bool pressed);
}; };
+2 -2
View File
@@ -36,8 +36,8 @@ namespace sfall
static DWORD sizeLimitMode; static DWORD sizeLimitMode;
static DWORD invSizeMaxLimit; static DWORD invSizeMaxLimit;
static DWORD reloadWeaponKey = 0; static DWORD reloadWeaponKey;
static DWORD itemFastMoveKey = 0; static DWORD itemFastMoveKey;
static DWORD skipFromContainer = 0; static DWORD skipFromContainer = 0;
void Inventory::KeyPressedHook(DWORD dxKey, bool pressed) { void Inventory::KeyPressedHook(DWORD dxKey, bool pressed) {
+2
View File
@@ -29,6 +29,7 @@
#include "Combat.h" #include "Combat.h"
#include "Console.h" #include "Console.h"
#include "Criticals.h" #include "Criticals.h"
#include "DebugEditor.h"
#include "Explosions.h" #include "Explosions.h"
#include "ExtraSaveSlots.h" #include "ExtraSaveSlots.h"
#include "FileSystem.h" #include "FileSystem.h"
@@ -385,6 +386,7 @@ static void __stdcall GameInitialized(int initResult) { // OnAfterGameInit
Sound::OnAfterGameInit(); Sound::OnAfterGameInit();
if (TalkingHeads::Use32Bit) TalkingHeads::OnAfterGameInit(); if (TalkingHeads::Use32Bit) TalkingHeads::OnAfterGameInit();
BuildSortedIndexList(); BuildSortedIndexList();
DebugEditor::OnAfterGameInit();
} }
static void __stdcall GameExit() { // OnGameExit static void __stdcall GameExit() { // OnGameExit