diff options
-rw-r--r-- | resource.cpp | 3 | ||||
-rw-r--r-- | script_v1.cpp | 4 | ||||
-rw-r--r-- | sdl.cpp | 4 | ||||
-rw-r--r-- | windows.cpp | 14 |
4 files changed, 17 insertions, 8 deletions
diff --git a/resource.cpp b/resource.cpp index f60d7d8671..f9cea74bed 100644 --- a/resource.cpp +++ b/resource.cpp @@ -721,7 +721,8 @@ void Scumm::expireResources(uint32 size) { if (res.mode[i]) { for(j=res.num[i]; --j>=0;) { flag = res.flags[i][j]; - if (!(flag&0x80) && flag >= best_counter && !isResourceInUse(i,j)) { + if (!(flag&0x80) && flag >= best_counter + && res.address[i][j] && !isResourceInUse(i,j)) { best_counter = flag; best_type = i; best_res = j; diff --git a/script_v1.cpp b/script_v1.cpp index a88672230e..3852d6e698 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -1695,8 +1695,8 @@ void Scumm::o5_verbOps() { switch(_opcode&0x1F) { case 1: /* load image */ a = getVarOrDirectWord(0x80); - if (verb) { - setVerbObject(_roomResource, a, verb); + if (slot) { + setVerbObject(_roomResource, a, slot); vs->type = 1; } break; @@ -137,8 +137,10 @@ void waitForTimer(Scumm *s, int delay) { } } - if (!(s->_fastMode&2)) + if (!(s->_fastMode&2)) { + assert(delay<500); SDL_Delay(delay*10); + } } #define MAX_DIRTY_RECTS 40 diff --git a/windows.cpp b/windows.cpp index ca8bd73979..81290c0da6 100644 --- a/windows.cpp +++ b/windows.cpp @@ -145,6 +145,13 @@ byte veryFastMode; void modifyslot(int sel, int what); +int mapKey(int key) { + if (key>=VK_F1 && key<=VK_F9) { + return key - VK_F1 + 315; + } + return key; +} + static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { WndMan *wm = (WndMan*)GetWindowLong(hWnd, GWL_USERDATA); @@ -157,10 +164,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l exit(0); break; - case WM_CHAR: - wm->_scumm->_keyPressed = wParam; - break; - case WM_KEYDOWN: if (wParam>='0' && wParam<='9') { wm->_scumm->_saveLoadSlot = wParam - '0'; @@ -189,6 +192,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l wm->_scumm->resourceStats(); } } + + wm->_scumm->_keyPressed = mapKey(wParam); break; case WM_MOUSEMOVE: @@ -918,6 +923,7 @@ void updateScreen(Scumm *s) { void waitForTimer(Scumm *s, int delay) { wm->handleMessage(); if (!veryFastMode) { + assert(delay<500); Sleep(delay*10); } } |