mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed InterfaceDontMoveOnTop from ddraw.ini (always enabled)
Added a fix to prevent toggling the cursor for a Transparent window.
This commit is contained in:
@@ -730,9 +730,6 @@ PartyMemberSkillFix=0
|
||||
;Set to 2 to also skip loading the game/combat difficulty settings
|
||||
SkipLoadingGameSettings=0
|
||||
|
||||
;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
|
||||
InterfaceDontMoveOnTop=0
|
||||
|
||||
;Overrides the global variable number used to show the special death message of the Modoc toilet explosion
|
||||
;Set to -1 to disable the special death message when the global variable is set
|
||||
SpecialDeathGVAR=491
|
||||
|
||||
@@ -189,19 +189,22 @@ long GetScriptLocalVars(long sid) {
|
||||
return (script) ? script->numLocalVars : 0;
|
||||
}
|
||||
|
||||
// Returns window ID by x/y coordinate (hidden windows are ignored)
|
||||
long __fastcall GetTopWindowID(long xPos, long yPos) {
|
||||
fo::Window* win = nullptr;
|
||||
long countWin = fo::var::num_windows - 1;
|
||||
for (int n = countWin; n >= 0; n--) {
|
||||
win = fo::var::window[n];
|
||||
// Returns window by x/y coordinate (hidden windows are ignored)
|
||||
fo::Window* __fastcall GetTopWindowAtPos(long xPos, long yPos, bool bypassTrans) {
|
||||
long num = fo::var::num_windows - 1;
|
||||
if (num) {
|
||||
int cflags = fo::WinFlags::Hidden;
|
||||
if (bypassTrans) cflags |= fo::WinFlags::Transparent;
|
||||
do {
|
||||
fo::Window* win = fo::var::window[num];
|
||||
if (xPos >= win->wRect.left && xPos <= win->wRect.right && yPos >= win->wRect.top && yPos <= win->wRect.bottom) {
|
||||
if (!(win->flags & fo::WinFlags::Hidden)) {
|
||||
break;
|
||||
if (!(win->flags & cflags)) {
|
||||
return win;
|
||||
}
|
||||
}
|
||||
} while (--num);
|
||||
}
|
||||
return win->wID;
|
||||
return fo::var::window[0];
|
||||
}
|
||||
|
||||
static long GetRangeTileNumbers(long sourceTile, long radius, long &outEnd) {
|
||||
@@ -371,7 +374,7 @@ void PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD
|
||||
}
|
||||
}
|
||||
|
||||
void PrintTextFM(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) {
|
||||
DWORD posOffset = yPos * toWidth + xPos;
|
||||
__asm {
|
||||
xor eax, eax;
|
||||
|
||||
@@ -90,7 +90,8 @@ bool IsPartyMember(fo::GameObject* critter);
|
||||
// Returns the number of local variables of the object script
|
||||
long GetScriptLocalVars(long sid);
|
||||
|
||||
long __fastcall GetTopWindowID(long xPos, long yPos);
|
||||
// Returns window by x/y coordinate (hidden windows are ignored)
|
||||
fo::Window* __fastcall GetTopWindowAtPos(long xPos, long yPos, bool bypassTrans = false);
|
||||
|
||||
// Returns an array of objects within the specified radius from the source tile
|
||||
void GetObjectsTileRadius(std::vector<fo::GameObject*> &objs, long sourceTile, long radius, long elev, long type = -1);
|
||||
@@ -115,7 +116,7 @@ void ClearWindow(long winID, bool refresh = true);
|
||||
|
||||
// Print text to surface
|
||||
void PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
|
||||
void PrintTextFM(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 GetTextHeight();
|
||||
|
||||
+14
-10
@@ -742,8 +742,7 @@ public:
|
||||
if (isPrimary) {
|
||||
if (Graphics::GPUBlt) {
|
||||
D3DLOCKED_RECT buf;
|
||||
HRESULT hr = mainTex->LockRect(0, &buf, a, 0);
|
||||
if (hr) goto surface; // lock failed, use old method
|
||||
if (mainTex->LockRect(0, &buf, a, 0)) goto surface; // fail to lock, use old method
|
||||
|
||||
mainTexLock = true;
|
||||
|
||||
@@ -1169,12 +1168,17 @@ static void __fastcall sf_GNW_win_refresh(fo::Window* win, RECT* updateRect, BYT
|
||||
int w = updateRect->right - updateRect->left + 1;
|
||||
|
||||
if (fo::var::mouse_is_hidden || !fo::func::mouse_in(updateRect->left, updateRect->top, updateRect->right, updateRect->bottom)) {
|
||||
/*__asm {
|
||||
mov eax, win;
|
||||
mov edx, updateRect;
|
||||
call fo::funcoffs::GNW_button_refresh_;
|
||||
}*/
|
||||
if (!DeviceLost) {
|
||||
int h = (updateRect->bottom - updateRect->top) + 1;
|
||||
UpdateDDSurface(GetBuffer(), w, h, w, updateRect); // update the entire rectangle area
|
||||
}
|
||||
} else {
|
||||
//fo::func::mouse_show();
|
||||
fo::func::mouse_show(); // for updating background cursor area
|
||||
RECT mouseRect;
|
||||
__asm {
|
||||
lea eax, mouseRect;
|
||||
@@ -1185,11 +1189,11 @@ static void __fastcall sf_GNW_win_refresh(fo::Window* win, RECT* updateRect, BYT
|
||||
mov rects, eax;
|
||||
}
|
||||
while (rects) { // updates everything except the cursor area
|
||||
//__asm {
|
||||
// mov eax, win;
|
||||
// mov edx, rects;
|
||||
// call fo::funcoffs::GNW_button_refresh_;
|
||||
//}
|
||||
/*__asm {
|
||||
mov eax, win;
|
||||
mov edx, rects;
|
||||
call fo::funcoffs::GNW_button_refresh_;
|
||||
}*/
|
||||
if (!DeviceLost) {
|
||||
int wRect = (rects->wRect.right - rects->wRect.left) + 1;
|
||||
int hRect = (rects->wRect.bottom - rects->wRect.top) + 1;
|
||||
@@ -1283,7 +1287,7 @@ static void __fastcall sf_GNW_win_refresh(fo::Window* win, RECT* updateRect, BYT
|
||||
}
|
||||
}
|
||||
|
||||
static __declspec(naked) void GNW_win_refresh_hack(void* from, int widthFrom, int heightFrom, int xFrom, int yFrom, int width, int height, int x, int y) {
|
||||
static __declspec(naked) void GNW_win_refresh_hack() {
|
||||
__asm {
|
||||
push ebx; // toBuffer
|
||||
mov ecx, eax;
|
||||
@@ -1337,7 +1341,7 @@ void Graphics::init() {
|
||||
SafeWrite16(0x4D5D46, 0x9090); // win_init_ (create screen_buffer)
|
||||
if (Graphics::mode) {
|
||||
// custom implementation of the GNW_win_refresh function
|
||||
MakeJump(0x4D6FD9, GNW_win_refresh_hack);
|
||||
MakeJump(0x4D6FD9, GNW_win_refresh_hack, 1);
|
||||
SafeWrite16(0x4D75E6, 0x9090); // win_clip_ (remove _buffering checking)
|
||||
} else { // for default or HRP graphics mode
|
||||
SafeWrite8(0x4D5DAB, 0x1D); // ecx > ebx (enable _buffering)
|
||||
|
||||
@@ -899,6 +899,7 @@ static void SpeedInterfaceCounterAnimsPatch() {
|
||||
}
|
||||
|
||||
static bool IFACE_BAR_MODE = false;
|
||||
|
||||
static long gmouse_handle_event_hook() {
|
||||
long countWin = fo::var::num_windows;
|
||||
long ifaceWin = fo::var::interfaceWindow;
|
||||
@@ -921,8 +922,11 @@ static long gmouse_handle_event_hook() {
|
||||
|
||||
static void __declspec(naked) gmouse_bk_process_hook() {
|
||||
__asm {
|
||||
push 1; // bypass Transparent
|
||||
mov ecx, eax;
|
||||
jmp fo::GetTopWindowID;
|
||||
call fo::GetTopWindowAtPos;
|
||||
mov eax, [eax]; // wID
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -942,8 +946,8 @@ void Interface::init() {
|
||||
WorldMapInterfacePatch();
|
||||
SpeedInterfaceCounterAnimsPatch();
|
||||
|
||||
// Fix for interface windows with 'Hidden' and 'ScriptWindow' flags
|
||||
// Hidden - will not toggle the mouse cursor when the cursor hovers over a hidden window
|
||||
// Fix for interface windows with 'Transparent', 'Hidden' and 'ScriptWindow' flags
|
||||
// Transparent/Hidden - will not toggle the mouse cursor when the cursor hovers over a transparent/hidden window
|
||||
// ScriptWindow - prevents the player from moving when clicking on the window if the 'Transparent' flag is not set
|
||||
HookCall(0x44B737, gmouse_bk_process_hook);
|
||||
LoadGameHook::OnBeforeGameInit() += []() {
|
||||
|
||||
@@ -686,12 +686,12 @@ static void SkipLoadingGameSettingsPatch() {
|
||||
}
|
||||
|
||||
static void InterfaceDontMoveOnTopPatch() {
|
||||
if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) { // TODO: remove option? (obsolete)
|
||||
//if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) {
|
||||
dlog("Applying no MoveOnTop flag for interface patch.", DL_INIT);
|
||||
SafeWrite8(0x46ECE9, fo::WinFlags::Exclusive); // Player Inventory/Loot/UseOn
|
||||
SafeWrite8(0x41B966, fo::WinFlags::Exclusive); // Automap
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
static void UseWalkDistancePatch() {
|
||||
|
||||
Reference in New Issue
Block a user