Fixed setting the last script window when the mouse leaves (#376)

This commit is contained in:
NovaRain
2021-05-12 10:41:23 +08:00
parent 3a45d016af
commit 4ec67526a4
4 changed files with 16 additions and 10 deletions
+3 -2
View File
@@ -2939,7 +2939,7 @@ static void __declspec(naked) checkAllRegions_hack() {
static const DWORD checkAllRegions_FixRet = 0x4B6AAB;
__asm {
test eax, eax;
jnz skip;
jnz skip; // != 0
cmp dword ptr ds:[FO_VAR_lastWin], -1;
je skip;
mov fixRegion, 1;
@@ -2955,10 +2955,11 @@ skip:
static void __declspec(naked) checkAllRegions_hook() {
__asm {
test byte ptr fixRegion, 1;
jnz skip;
jnz skip; // == 1
jmp windowCheckRegion_;
skip:
mov fixRegion, 0;
mov dword ptr ds:[FO_VAR_lastWin], -1;
retn;
}
}
+4 -1
View File
@@ -818,8 +818,10 @@ void DrawToSurface(long width, long height, long fromX, long fromY, long fromWid
//}
// Fills the specified interface window with index color
void WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor) {
bool __stdcall WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor) {
WINinfo* win = fo_GNW_find(winID);
if (height > win->height || width > win->width) return true;
BYTE* surf = win->surface + (win->width * y) + x;
long pitch = win->width - width;
while (height--) {
@@ -827,6 +829,7 @@ void WinFillRect(long winID, long x, long y, long width, long height, BYTE index
while (w--) *surf++ = indexColor;
surf += pitch;
};
return false;
}
// Fills the specified interface window with index color 0 (black color)
+1 -1
View File
@@ -577,7 +577,7 @@ void DrawToSurface(long width, long height, long fromX, long fromY, long fromWid
void DrawToSurface(long width, long height, long fromX, long fromY, long fromWidth, BYTE* fromSurf, long toX, long toY, long toWidth, long toHeight, BYTE* toSurf);
// Fills the specified interface window with index color
void WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor);
bool __stdcall WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor);
// Fills the specified interface window with index color 0 (black color)
void ClearWindow(long winID, bool refresh = true);
+8 -6
View File
@@ -832,7 +832,7 @@ static void mf_interface_print() { // same as vanilla PrintRect
}
static void mf_win_fill_color() {
long result = fo_selectWindowID(opHandler.program()->currentScriptWin);
long result = fo_selectWindowID(opHandler.program()->currentScriptWin); // TODO: examine the issue of restoring program->currentScriptWin of the current window in op_pop_flags_
long iWin = *(DWORD*)FO_VAR_currentWindow;
if (!result || iWin == -1) {
opHandler.printOpcodeError("win_fill_color() - no created or selected window.");
@@ -840,11 +840,13 @@ static void mf_win_fill_color() {
return;
}
if (opHandler.numArgs() > 0) {
WinFillRect(ptr_sWindows[iWin].wID,
opHandler.arg(0).rawValue(), opHandler.arg(1).rawValue(), // x, y
opHandler.arg(2).rawValue(), opHandler.arg(3).rawValue(), // w, h
static_cast<BYTE>(opHandler.arg(4).rawValue())
);
if (WinFillRect(ptr_sWindows[iWin].wID,
opHandler.arg(0).rawValue(), opHandler.arg(1).rawValue(), // x, y
opHandler.arg(2).rawValue(), opHandler.arg(3).rawValue(), // w, h
static_cast<BYTE>(opHandler.arg(4).rawValue())))
{
opHandler.printOpcodeError("win_fill_color() - failed to fill the window, the area size exceeds the current window.");
}
} else {
ClearWindow(ptr_sWindows[iWin].wID, false); // full clear
}