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
|
;Set to 2 to also skip loading the game/combat difficulty settings
|
||||||
SkipLoadingGameSettings=0
|
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
|
;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
|
;Set to -1 to disable the special death message when the global variable is set
|
||||||
SpecialDeathGVAR=491
|
SpecialDeathGVAR=491
|
||||||
|
|||||||
@@ -189,19 +189,22 @@ long GetScriptLocalVars(long sid) {
|
|||||||
return (script) ? script->numLocalVars : 0;
|
return (script) ? script->numLocalVars : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns window ID by x/y coordinate (hidden windows are ignored)
|
// Returns window by x/y coordinate (hidden windows are ignored)
|
||||||
long __fastcall GetTopWindowID(long xPos, long yPos) {
|
fo::Window* __fastcall GetTopWindowAtPos(long xPos, long yPos, bool bypassTrans) {
|
||||||
fo::Window* win = nullptr;
|
long num = fo::var::num_windows - 1;
|
||||||
long countWin = fo::var::num_windows - 1;
|
if (num) {
|
||||||
for (int n = countWin; n >= 0; n--) {
|
int cflags = fo::WinFlags::Hidden;
|
||||||
win = fo::var::window[n];
|
if (bypassTrans) cflags |= fo::WinFlags::Transparent;
|
||||||
if (xPos >= win->wRect.left && xPos <= win->wRect.right && yPos >= win->wRect.top && yPos <= win->wRect.bottom) {
|
do {
|
||||||
if (!(win->flags & fo::WinFlags::Hidden)) {
|
fo::Window* win = fo::var::window[num];
|
||||||
break;
|
if (xPos >= win->wRect.left && xPos <= win->wRect.right && yPos >= win->wRect.top && yPos <= win->wRect.bottom) {
|
||||||
|
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) {
|
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;
|
DWORD posOffset = yPos * toWidth + xPos;
|
||||||
__asm {
|
__asm {
|
||||||
xor eax, eax;
|
xor eax, eax;
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ bool IsPartyMember(fo::GameObject* critter);
|
|||||||
// Returns the number of local variables of the object script
|
// Returns the number of local variables of the object script
|
||||||
long GetScriptLocalVars(long sid);
|
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
|
// 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);
|
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
|
// Print text to surface
|
||||||
void PrintText(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(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
|
// gets the height of the currently selected font
|
||||||
DWORD GetTextHeight();
|
DWORD GetTextHeight();
|
||||||
|
|||||||
+15
-11
@@ -742,8 +742,7 @@ public:
|
|||||||
if (isPrimary) {
|
if (isPrimary) {
|
||||||
if (Graphics::GPUBlt) {
|
if (Graphics::GPUBlt) {
|
||||||
D3DLOCKED_RECT buf;
|
D3DLOCKED_RECT buf;
|
||||||
HRESULT hr = mainTex->LockRect(0, &buf, a, 0);
|
if (mainTex->LockRect(0, &buf, a, 0)) goto surface; // fail to lock, use old method
|
||||||
if (hr) goto surface; // lock failed, use old method
|
|
||||||
|
|
||||||
mainTexLock = true;
|
mainTexLock = true;
|
||||||
|
|
||||||
@@ -1147,7 +1146,7 @@ static void __forceinline UpdateDDSurface(BYTE* surface, int width, int height,
|
|||||||
|
|
||||||
primaryDDSurface->Lock(&lockRect, &desc, 0, 0);
|
primaryDDSurface->Lock(&lockRect, &desc, 0, 0);
|
||||||
|
|
||||||
fo::func::buf_to_buf(surface, width, height, widthFrom, (BYTE*)desc.lpSurface, desc.lPitch); // + (desc.lPitch * rect->top) + rect->left
|
fo::func::buf_to_buf(surface, width, height, widthFrom, (BYTE*)desc.lpSurface, desc.lPitch); //+ (desc.lPitch * rect->top) + rect->left
|
||||||
|
|
||||||
primaryDDSurface->Unlock(desc.lpSurface);
|
primaryDDSurface->Unlock(desc.lpSurface);
|
||||||
}
|
}
|
||||||
@@ -1169,12 +1168,17 @@ static void __fastcall sf_GNW_win_refresh(fo::Window* win, RECT* updateRect, BYT
|
|||||||
int w = updateRect->right - updateRect->left + 1;
|
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)) {
|
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) {
|
if (!DeviceLost) {
|
||||||
int h = (updateRect->bottom - updateRect->top) + 1;
|
int h = (updateRect->bottom - updateRect->top) + 1;
|
||||||
UpdateDDSurface(GetBuffer(), w, h, w, updateRect); // update the entire rectangle area
|
UpdateDDSurface(GetBuffer(), w, h, w, updateRect); // update the entire rectangle area
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//fo::func::mouse_show();
|
fo::func::mouse_show(); // for updating background cursor area
|
||||||
RECT mouseRect;
|
RECT mouseRect;
|
||||||
__asm {
|
__asm {
|
||||||
lea eax, mouseRect;
|
lea eax, mouseRect;
|
||||||
@@ -1185,11 +1189,11 @@ static void __fastcall sf_GNW_win_refresh(fo::Window* win, RECT* updateRect, BYT
|
|||||||
mov rects, eax;
|
mov rects, eax;
|
||||||
}
|
}
|
||||||
while (rects) { // updates everything except the cursor area
|
while (rects) { // updates everything except the cursor area
|
||||||
//__asm {
|
/*__asm {
|
||||||
// mov eax, win;
|
mov eax, win;
|
||||||
// mov edx, rects;
|
mov edx, rects;
|
||||||
// call fo::funcoffs::GNW_button_refresh_;
|
call fo::funcoffs::GNW_button_refresh_;
|
||||||
//}
|
}*/
|
||||||
if (!DeviceLost) {
|
if (!DeviceLost) {
|
||||||
int wRect = (rects->wRect.right - rects->wRect.left) + 1;
|
int wRect = (rects->wRect.right - rects->wRect.left) + 1;
|
||||||
int hRect = (rects->wRect.bottom - rects->wRect.top) + 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 {
|
__asm {
|
||||||
push ebx; // toBuffer
|
push ebx; // toBuffer
|
||||||
mov ecx, eax;
|
mov ecx, eax;
|
||||||
@@ -1337,7 +1341,7 @@ void Graphics::init() {
|
|||||||
SafeWrite16(0x4D5D46, 0x9090); // win_init_ (create screen_buffer)
|
SafeWrite16(0x4D5D46, 0x9090); // win_init_ (create screen_buffer)
|
||||||
if (Graphics::mode) {
|
if (Graphics::mode) {
|
||||||
// custom implementation of the GNW_win_refresh function
|
// 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)
|
SafeWrite16(0x4D75E6, 0x9090); // win_clip_ (remove _buffering checking)
|
||||||
} else { // for default or HRP graphics mode
|
} else { // for default or HRP graphics mode
|
||||||
SafeWrite8(0x4D5DAB, 0x1D); // ecx > ebx (enable _buffering)
|
SafeWrite8(0x4D5DAB, 0x1D); // ecx > ebx (enable _buffering)
|
||||||
|
|||||||
@@ -899,6 +899,7 @@ static void SpeedInterfaceCounterAnimsPatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool IFACE_BAR_MODE = false;
|
static bool IFACE_BAR_MODE = false;
|
||||||
|
|
||||||
static long gmouse_handle_event_hook() {
|
static long gmouse_handle_event_hook() {
|
||||||
long countWin = fo::var::num_windows;
|
long countWin = fo::var::num_windows;
|
||||||
long ifaceWin = fo::var::interfaceWindow;
|
long ifaceWin = fo::var::interfaceWindow;
|
||||||
@@ -921,8 +922,11 @@ static long gmouse_handle_event_hook() {
|
|||||||
|
|
||||||
static void __declspec(naked) gmouse_bk_process_hook() {
|
static void __declspec(naked) gmouse_bk_process_hook() {
|
||||||
__asm {
|
__asm {
|
||||||
mov ecx, eax;
|
push 1; // bypass Transparent
|
||||||
jmp fo::GetTopWindowID;
|
mov ecx, eax;
|
||||||
|
call fo::GetTopWindowAtPos;
|
||||||
|
mov eax, [eax]; // wID
|
||||||
|
retn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,8 +946,8 @@ void Interface::init() {
|
|||||||
WorldMapInterfacePatch();
|
WorldMapInterfacePatch();
|
||||||
SpeedInterfaceCounterAnimsPatch();
|
SpeedInterfaceCounterAnimsPatch();
|
||||||
|
|
||||||
// Fix for interface windows with 'Hidden' and 'ScriptWindow' flags
|
// Fix for interface windows with 'Transparent', 'Hidden' and 'ScriptWindow' flags
|
||||||
// Hidden - will not toggle the mouse cursor when the cursor hovers over a hidden window
|
// 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
|
// ScriptWindow - prevents the player from moving when clicking on the window if the 'Transparent' flag is not set
|
||||||
HookCall(0x44B737, gmouse_bk_process_hook);
|
HookCall(0x44B737, gmouse_bk_process_hook);
|
||||||
LoadGameHook::OnBeforeGameInit() += []() {
|
LoadGameHook::OnBeforeGameInit() += []() {
|
||||||
|
|||||||
@@ -686,12 +686,12 @@ static void SkipLoadingGameSettingsPatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void InterfaceDontMoveOnTopPatch() {
|
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);
|
dlog("Applying no MoveOnTop flag for interface patch.", DL_INIT);
|
||||||
SafeWrite8(0x46ECE9, fo::WinFlags::Exclusive); // Player Inventory/Loot/UseOn
|
SafeWrite8(0x46ECE9, fo::WinFlags::Exclusive); // Player Inventory/Loot/UseOn
|
||||||
SafeWrite8(0x41B966, fo::WinFlags::Exclusive); // Automap
|
SafeWrite8(0x41B966, fo::WinFlags::Exclusive); // Automap
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UseWalkDistancePatch() {
|
static void UseWalkDistancePatch() {
|
||||||
|
|||||||
Reference in New Issue
Block a user