diff options
author | Travis Howell | 2006-04-15 22:37:48 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-15 22:37:48 +0000 |
commit | 5b388fc48e8293dd4d6bb30538c00c3051f87164 (patch) | |
tree | 39d8b29047adaf3f97a33da6bd8a075a93d0a4e0 | |
parent | 9d703f1fcfd51cc2e074e005ca9a3a3ca59bdb72 (diff) | |
download | scummvm-rg350-5b388fc48e8293dd4d6bb30538c00c3051f87164.tar.gz scummvm-rg350-5b388fc48e8293dd4d6bb30538c00c3051f87164.tar.bz2 scummvm-rg350-5b388fc48e8293dd4d6bb30538c00c3051f87164.zip |
Cleanup
svn-id: r21926
-rw-r--r-- | engines/simon/charset.cpp | 3 | ||||
-rw-r--r-- | engines/simon/items.cpp | 17 | ||||
-rw-r--r-- | engines/simon/oracle.cpp | 11 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 113 | ||||
-rw-r--r-- | engines/simon/simon.h | 17 |
5 files changed, 88 insertions, 73 deletions
diff --git a/engines/simon/charset.cpp b/engines/simon/charset.cpp index 905e38a32b..151f3221a7 100644 --- a/engines/simon/charset.cpp +++ b/engines/simon/charset.cpp @@ -21,6 +21,7 @@ */ #include "common/stdafx.h" + #include "simon/simon.h" #include "simon/intern.h" @@ -1525,11 +1526,13 @@ void SimonEngine::video_putchar_drawchar(WindowBlock *window, uint x, uint y, by dst += y * _dxSurfacePitch + x + window->textColumnOffset; if (getGameType() == GType_FF) { + dst = getFrontBuf() + y * _dxSurfacePitch + x + window->textColumnOffset; h = 13; w = feebleFontSize[chr - 0x20]; src = feeble_video_font + (chr - 0x20) * 13; } else { + dst = getFrontBuf() + y * _dxSurfacePitch + x + window->textColumnOffset; h = 8; w = 6; diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index 63350e061a..648d5b2fc2 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -1972,12 +1972,17 @@ void SimonEngine::o3_restartClock() { } void SimonEngine::o3_setColour() { - // 195: set palette colour? - uint blue = getVarOrByte(); - uint green = getVarOrByte(); - uint red = getVarOrByte(); - uint color = getVarOrByte(); - warning("STUB: script opcode 195 (%d, %d, %d, %d)", blue, green, red, color); + // 195: set palette colour + uint b = getVarOrByte(); + uint g = getVarOrByte(); + uint r = getVarOrByte(); + uint c = getVarOrByte() * 4; + + _palette[c + 0] = _paletteBackup[c + 0] = r; + _palette[c + 1] = _paletteBackup[c + 1] = g; + _palette[c + 2] = _paletteBackup[c + 2] = b; + + debug(0, "o3_setColour (%d, %d, %d, %d)", c, r, g, b); } void SimonEngine::o3_b3Set() { diff --git a/engines/simon/oracle.cpp b/engines/simon/oracle.cpp index 3ee2dfdbec..87c0b745cb 100644 --- a/engines/simon/oracle.cpp +++ b/engines/simon/oracle.cpp @@ -212,15 +212,18 @@ void SimonEngine::scrollOracleDown() { } void SimonEngine::bltOracleText() { - byte *src, *dst; + byte *src, *dst1, *dst2; uint16 h; src = getFrontBuf() + 103 * _screenWidth + 136; - dst = getBackBuf() + 103 * _screenWidth + 136; + dst1 = getFrontBuf() + 103 * _screenWidth + 136; + dst2 = getBackBuf() + 103 * _screenWidth + 136; for (h = 0; h < 104; h++) { - memcpy(dst, src, 360); - dst += _screenWidth; + memcpy(dst1, src, 360); + memcpy(dst2, src, 360); + dst1 += _screenWidth; + dst2 += _screenWidth; src += _screenWidth; } } diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 0d680ba6cd..f614f4c514 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -234,7 +234,7 @@ SimonEngine::SimonEngine(OSystem *syst) _copyPartialMode = 0; _speed = 1; _fastMode = 0; - _dxUse3Or4ForLock = 0; + _useBackGround = 0; _debugMode = 0; _pause = 0; @@ -459,9 +459,9 @@ SimonEngine::SimonEngine(OSystem *syst) _sdlMouseX = 0; _sdlMouseY = 0; - _sdl_buf_3 = 0; - _sdl_buf = 0; - _sdl_buf_attached = 0; + _backGroundBuf = 0; + _frontBuf = 0; + _backBuf = 0; _sdl_buf_scaled = 0; _vc10BasePtrOld = 0; @@ -1368,7 +1368,7 @@ Subroutine *SimonEngine::getSubroutineByID(uint subroutine_id) { return cur; } - debug(1,"getSubroutineByID: subroutine %d not found", subroutine_id); + debug(0,"getSubroutineByID: subroutine %d not found", subroutine_id); return NULL; } @@ -2273,7 +2273,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { if (getGameType() == GType_SIMON1) { _unkPalFlag = true; } else if (getGameType() == GType_SIMON2) { - _dxUse3Or4ForLock = true; + _useBackGround = true; _restoreWindow6 = true; } } @@ -2315,7 +2315,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { if (getGameType() == GType_SIMON1) { if (vga_res_id == 16300) { - dx_clear_attached_from_top(134); + clearBackFromTop(134); _usePaletteDelay = true; } } else { @@ -2346,7 +2346,20 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { _vcPtr = vc_ptr_org; - if (getGameType() == GType_SIMON1) { + if (getGameType() == GType_FF) { + fillFrontFromBack(0, 0, _screenWidth, _screenHeight); + fillBackGroundFromBack(_screenHeight); + _syncFlag2 = 1; + } else if (getGameType() == GType_SIMON2) { + if (!_useBackGround) { + num_lines = _windowNum == 4 ? 134 : 200; + _boxStarHeight = num_lines; + fillFrontFromBack(0, 0, _screenWidth, num_lines); + fillBackGroundFromBack(num_lines); + _syncFlag2 = 1; + } + _useBackGround = false; + } else { // Allow one section of Simon the Sorcerer 1 introduction to be displayed // in lower half of screen if (_subroutine == 2923 || _subroutine == 2926) @@ -2354,24 +2367,11 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { else num_lines = _windowNum == 4 ? 134 : 200; - dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines); - dx_copy_from_attached_to_3(num_lines); + fillFrontFromBack(0, 0, _screenWidth, num_lines); + fillBackGroundFromBack(num_lines); _syncFlag2 = 1; _timer5 = 0; - } else { - if (!_dxUse3Or4ForLock) { - if (getGameType() == GType_FF) - num_lines = 480; - else - num_lines = _windowNum == 4 ? 134 : 200; - - _boxStarHeight = num_lines; - dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines); - dx_copy_from_attached_to_3(num_lines); - _syncFlag2 = 1; - } - _dxUse3Or4ForLock = false; } _lockWord &= ~0x20; @@ -2630,7 +2630,7 @@ void SimonEngine::timer_vga_sprites() { } if (_drawImagesDebug) - memset(_sdl_buf_attached, 0, _screenWidth * _screenHeight); + memset(_backBuf, 0, _screenWidth * _screenHeight); _updateScreen++; _vcPtr = vc_ptr_org; @@ -2685,8 +2685,8 @@ void SimonEngine::scrollEvent() { vcWriteVar(251, _scrollX); } - memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight); - memcpy(_sdl_buf_3, _sdl_buf_attached, _scrollHeight * _screenWidth); + memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight); + memcpy(_backGroundBuf, _backBuf, _scrollHeight * _screenWidth); _scrollFlag = 0; } @@ -2758,12 +2758,12 @@ void SimonEngine::timer_proc1() { timer_vga_sprites_2(); if (_copyPartialMode == 1) { - dx_copy_from_2_to_attached(80, 46, 208 - 80, 94 - 46); + fillBackFromFront(80, 46, 208 - 80, 94 - 46); } if (_copyPartialMode == 2) { // copy partial from attached to 2 - dx_copy_from_attached_to_2(176, 61, _screenWidth - 176, 134 - 61); + fillFrontFromBack(176, 61, _screenWidth - 176, 134 - 61); _copyPartialMode = 0; } @@ -2945,10 +2945,8 @@ void SimonEngine::colorWindow(WindowBlock *window) { _lockWord |= 0x8000; - dst = getFrontBuf(); - if (getGameType() == GType_FF) { - dst += _dxSurfacePitch * window->y + window->x; + dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x; for (h = 0; h < window->height; h++) { for (w = 0; w < window->width; w++) { @@ -2958,7 +2956,7 @@ void SimonEngine::colorWindow(WindowBlock *window) { dst += _screenWidth; } } else { - dst += _dxSurfacePitch * window->y + window->x * 8; + dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x * 8; h = window->height * 8; w = window->width * 8; @@ -3347,7 +3345,7 @@ void SimonEngine::restoreBlock(uint h, uint w, uint y, uint x) { uint i; dst = getFrontBuf(); - src = _sdl_buf_3; + src = _backGroundBuf; dst += y * _dxSurfacePitch; src += y * _dxSurfacePitch; @@ -3362,24 +3360,24 @@ void SimonEngine::restoreBlock(uint h, uint w, uint y, uint x) { } void SimonEngine::dx_clear_surfaces(uint num_lines) { - memset(_sdl_buf_attached, 0, num_lines * _screenWidth); + memset(_backBuf, 0, num_lines * _screenWidth); - _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, num_lines); + _system->copyRectToScreen(_backBuf, _screenWidth, 0, 0, _screenWidth, num_lines); - if (_dxUse3Or4ForLock) { - memset(_sdl_buf, 0, num_lines * _screenWidth); - memset(_sdl_buf_3, 0, num_lines * _screenWidth); + if (_useBackGround) { + memset(_frontBuf, 0, num_lines * _screenWidth); + memset(_backGroundBuf, 0, num_lines * _screenWidth); } } -void SimonEngine::dx_clear_attached_from_top(uint lines) { - memset(_sdl_buf_attached, 0, lines * _screenWidth); +void SimonEngine::clearBackFromTop(uint lines) { + memset(_backBuf, 0, lines * _screenWidth); } -void SimonEngine::dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h) { +void SimonEngine::fillFrontFromBack(uint x, uint y, uint w, uint h) { uint offs = x + y * _screenWidth; - byte *s = _sdl_buf_attached + offs; - byte *d = _sdl_buf + offs; + byte *s = _backBuf + offs; + byte *d = _frontBuf + offs; do { memcpy(d, s, w); @@ -3388,10 +3386,10 @@ void SimonEngine::dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h) { } while (--h); } -void SimonEngine::dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h) { +void SimonEngine::fillBackFromFront(uint x, uint y, uint w, uint h) { uint offs = x + y * _screenWidth; - byte *s = _sdl_buf + offs; - byte *d = _sdl_buf_attached + offs; + byte *s = _frontBuf + offs; + byte *d = _backBuf + offs; do { memcpy(d, s, w); @@ -3400,8 +3398,8 @@ void SimonEngine::dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h) { } while (--h); } -void SimonEngine::dx_copy_from_attached_to_3(uint lines) { - memcpy(_sdl_buf_3, _sdl_buf_attached, lines * _screenWidth); +void SimonEngine::fillBackGroundFromBack(uint lines) { + memcpy(_backGroundBuf, _backBuf, lines * _screenWidth); } void SimonEngine::dx_update_screen_and_palette() { @@ -3415,10 +3413,10 @@ void SimonEngine::dx_update_screen_and_palette() { } } - _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, _screenHeight); + _system->copyRectToScreen(_backBuf, _screenWidth, 0, 0, _screenWidth, _screenHeight); _system->updateScreen(); - memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight); + memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight); if (getGameType() == GType_FF && _scrollFlag) { scrollEvent(); @@ -3482,9 +3480,9 @@ int SimonEngine::go() { _dumpFile = stdout; // allocate buffers - _sdl_buf_3 = (byte *)calloc(_screenWidth * _screenHeight, 1); - _sdl_buf = (byte *)calloc(_screenWidth * _screenHeight, 1); - _sdl_buf_attached = (byte *)calloc(_screenWidth * _screenHeight, 1); + _backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); + _frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); + _backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); _sdl_buf_scaled = (byte *)calloc(_screenWidth * _screenHeight, 1); allocItemHeap(); @@ -3739,12 +3737,17 @@ void SimonEngine::loadMusic(uint music) { byte *SimonEngine::getFrontBuf() { _dxSurfacePitch = _screenWidth; - return _sdl_buf; + return _frontBuf; } byte *SimonEngine::getBackBuf() { _dxSurfacePitch = _screenWidth; - return _dxUse3Or4ForLock ? _sdl_buf_3 : _sdl_buf_attached; + return _useBackGround ? _backGroundBuf : _backBuf; +} + +byte *SimonEngine::getBackGround() { + _dxSurfacePitch = _screenWidth; + return _backGroundBuf; } byte *SimonEngine::getScaleBuf() { diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 0d2e3e9c81..eba645cfc9 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -246,7 +246,7 @@ protected: byte _copyPartialMode; uint _speed; bool _fastMode; - bool _dxUse3Or4ForLock; + bool _useBackGround; uint16 _debugMode; uint16 _language; @@ -452,9 +452,9 @@ protected: int _sdlMouseX, _sdlMouseY; - byte *_sdl_buf_3; - byte *_sdl_buf; - byte *_sdl_buf_attached; + byte *_backGroundBuf; + byte *_frontBuf; + byte *_backBuf; byte *_sdl_buf_scaled; Common::RandomSource _rnd; @@ -1037,6 +1037,7 @@ protected: byte *getFrontBuf(); byte *getBackBuf(); + byte *getBackGround(); byte *getScaleBuf(); byte *read_vga_from_datfile_2(uint id, uint type); @@ -1064,10 +1065,10 @@ protected: void dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base); void dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base); - void dx_clear_attached_from_top(uint lines); - void dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h); - void dx_copy_from_attached_to_3(uint lines); - void dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h); + void clearBackFromTop(uint lines); + void fillFrontFromBack(uint x, uint y, uint w, uint h); + void fillBackGroundFromBack(uint lines); + void fillBackFromFront(uint x, uint y, uint w, uint h); void print_char_helper_1(const byte *src, uint len); void print_char_helper_5(WindowBlock *window); |