diff options
author | Max Horn | 2002-12-04 22:31:36 +0000 |
---|---|---|
committer | Max Horn | 2002-12-04 22:31:36 +0000 |
commit | df594d41fff6ae4edc7212a697556b82854d3aeb (patch) | |
tree | 04350ece936fefa9956f26f0aac02a56372d52b8 /scumm | |
parent | 45534e7698dac0d42ee95209902bec6ad2dc2c06 (diff) | |
download | scummvm-rg350-df594d41fff6ae4edc7212a697556b82854d3aeb.tar.gz scummvm-rg350-df594d41fff6ae4edc7212a697556b82854d3aeb.tar.bz2 scummvm-rg350-df594d41fff6ae4edc7212a697556b82854d3aeb.zip |
even more cleanup
svn-id: r5839
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/gfx.cpp | 46 | ||||
-rw-r--r-- | scumm/saveload.cpp | 12 | ||||
-rw-r--r-- | scumm/script_v1.cpp | 10 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 12 | ||||
-rw-r--r-- | scumm/scumm.h | 22 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 27 |
6 files changed, 61 insertions, 68 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 6a6958cbbf..bd760fa38d 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -2734,8 +2734,8 @@ void Scumm::setPalColor(int idx, int r, int g, int b) void Scumm::setCursorHotspot2(int x, int y) { - _cursorHotspotX = x; - _cursorHotspotY = y; + _cursor.hotspotX = x; + _cursor.hotspotY = y; } byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) @@ -2902,9 +2902,9 @@ void Scumm::grabCursor(byte *ptr, int width, int height) if (size > sizeof(_grabbedCursor)) error("grabCursor: grabbed cursor too big"); - _cursorWidth = width; - _cursorHeight = height; - _cursorAnimate = 0; + _cursor.width = width; + _cursor.height = height; + _cursor.animate = 0; dst = _grabbedCursor; for (; height; height--) { @@ -2938,17 +2938,17 @@ void Scumm::useIm01Cursor(byte *im, int w, int h) void Scumm::updateCursor() { - _system->set_mouse_cursor(_grabbedCursor, _cursorWidth, _cursorHeight, - _cursorHotspotX, _cursorHotspotY); + _system->set_mouse_cursor(_grabbedCursor, _cursor.width, _cursor.height, + _cursor.hotspotX, _cursor.hotspotY); } void Scumm::animateCursor() { - if (_cursorAnimate) { - if (!(_cursorAnimateIndex & 0x3)) { - decompressDefaultCursor((_cursorAnimateIndex >> 2) & 3); + if (_cursor.animate) { + if (!(_cursor.animateIndex & 0x3)) { + decompressDefaultCursor((_cursor.animateIndex >> 2) & 3); } - _cursorAnimateIndex++; + _cursor.animateIndex++; } } @@ -2964,9 +2964,9 @@ void Scumm::useBompCursor(byte *im, int width, int height) if (size > sizeof(_grabbedCursor)) error("useBompCursor: cursor too big"); - _cursorWidth = width; - _cursorHeight = height; - _cursorAnimate = 0; + _cursor.width = width; + _cursor.height = height; + _cursor.animate = 0; decompressBomp(_grabbedCursor, im + 10, width, height); @@ -3010,10 +3010,10 @@ void Scumm::decompressDefaultCursor(int idx) if (_gameId == GID_LOOM256) { int w; - _cursorWidth = 8; - _cursorHeight = 8; - _cursorHotspotX = 0; - _cursorHotspotY = 0; + _cursor.width = 8; + _cursor.height = 8; + _cursor.hotspotX = 0; + _cursor.hotspotY = 0; for (i = 0, w = 0; i < 8; i++) { w += (i >= 6) ? -2 : 1; @@ -3021,10 +3021,10 @@ void Scumm::decompressDefaultCursor(int idx) _grabbedCursor[i * 8 + j] = color; } } else { - _cursorWidth = 16; - _cursorHeight = 16; - _cursorHotspotX = default_cursor_hotspots[2 * _currentCursor]; - _cursorHotspotY = default_cursor_hotspots[2 * _currentCursor + 1]; + _cursor.width = 16; + _cursor.height = 16; + _cursor.hotspotX = default_cursor_hotspots[2 * _currentCursor]; + _cursor.hotspotY = default_cursor_hotspots[2 * _currentCursor + 1]; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { @@ -3041,7 +3041,7 @@ void Scumm::makeCursorColorTransparent(int a) { int i, size; - size = _cursorWidth * _cursorHeight; + size = _cursor.width * _cursor.height; for (i = 0; i < size; i++) if (_grabbedCursor[i] == (byte)a) diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 8be9d988c1..5c227d8e33 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -396,7 +396,7 @@ void Scumm::saveOrLoad(Serializer *s) /* nest */ MKLINE(Scumm, _numNestedScripts, sleByte), MKLINE(Scumm, _userPut, sleByte), - MKLINE(Scumm, _cursorState, sleByte), + MKLINE(Scumm, _cursor.state, sleByte), MKLINE(Scumm, gdi._cursorActive, sleByte), MKLINE(Scumm, _currentCursor, sleByte), @@ -444,10 +444,10 @@ void Scumm::saveOrLoad(Serializer *s) MKLINE(Scumm, _screenB, sleUint16), MKLINE(Scumm, _screenH, sleUint16), - MKLINE(Scumm, _cd_track, sleInt16), - MKLINE(Scumm, _cd_loops, sleInt16), - MKLINE(Scumm, _cd_frame, sleInt16), - MKLINE(Scumm, _cd_end, sleInt16), + MKLINE(Scumm, _cd_track, sleInt16), // FIXME - remove next time save format changes + MKLINE(Scumm, _cd_loops, sleInt16), // FIXME - remove next time save format changes + MKLINE(Scumm, _cd_frame, sleInt16), // FIXME - remove next time save format changes + MKLINE(Scumm, _cd_end, sleInt16), // FIXME - remove next time save format changes MKEND() }; @@ -511,7 +511,7 @@ void Scumm::saveOrLoad(Serializer *s) /* nest */ MKLINE(Scumm, _numNestedScripts, sleByte), MKLINE(Scumm, _userPut, sleByte), - MKLINE(Scumm, _cursorState, sleByte), + MKLINE(Scumm, _cursor.state, sleByte), MKLINE(Scumm, gdi._cursorActive, sleByte), MKLINE(Scumm, _currentCursor, sleByte), diff --git a/scumm/script_v1.cpp b/scumm/script_v1.cpp index 13c07e060f..d1f2741131 100644 --- a/scumm/script_v1.cpp +++ b/scumm/script_v1.cpp @@ -594,11 +594,11 @@ void Scumm::o5_cursorCommand() int16 table[16]; switch ((_opcode = fetchScriptByte()) & 0x1F) { case 1: /* cursor show */ - _cursorState = 1; + _cursor.state = 1; verbMouseOver(0); break; case 2: /* cursor hide */ - _cursorState = 0; + _cursor.state = 0; verbMouseOver(0); break; case 3: /* userput on */ @@ -608,11 +608,11 @@ void Scumm::o5_cursorCommand() _userPut = 0; break; case 5: /* cursor soft on */ - _cursorState++; + _cursor.state++; verbMouseOver(0); break; case 6: /* cursor soft off */ - _cursorState--; + _cursor.state--; verbMouseOver(0); break; case 7: /* userput soft on */ @@ -647,7 +647,7 @@ void Scumm::o5_cursorCommand() break; } - _vars[VAR_CURSORSTATE] = _cursorState; + _vars[VAR_CURSORSTATE] = _cursor.state; _vars[VAR_USERPUT] = _userPut; } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 49beb10f1a..0edfcbb590 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -814,11 +814,11 @@ void Scumm::o6_cursorCommand() switch (fetchScriptByte()) { case 0x90: - _cursorState = 1; + _cursor.state = 1; verbMouseOver(0); break; case 0x91: - _cursorState = 0; + _cursor.state = 0; verbMouseOver(0); break; case 0x92: @@ -828,13 +828,13 @@ void Scumm::o6_cursorCommand() _userPut = 0; break; case 0x94: - _cursorState++; - if (_cursorState > 1) + _cursor.state++; + if (_cursor.state > 1) error("Cursor state greater than 1 in script"); verbMouseOver(0); break; case 0x95: - _cursorState--; + _cursor.state--; verbMouseOver(0); break; case 0x96: @@ -867,7 +867,7 @@ void Scumm::o6_cursorCommand() error("o6_cursorCommand: default case"); } - _vars[VAR_CURSORSTATE] = _cursorState; + _vars[VAR_CURSORSTATE] = _cursor.state; _vars[VAR_USERPUT] = _userPut; } diff --git a/scumm/scumm.h b/scumm/scumm.h index 733be25364..cb85ab6edf 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -314,8 +314,6 @@ public: /* Init functions, etc */ byte _fastMode; - /* system call object */ - /* Scumm main loop */ void mainRun(); @@ -404,8 +402,7 @@ public: byte _leftBtnPressed, _rightBtnPressed; int16 _virtual_mouse_x, _virtual_mouse_y, _bootParam; - uint16 _debugMode, _currentDrive, _soundCardType; - byte _mousePresent; + uint16 _debugMode, _soundCardType; /* Not sure where this stuff goes */ byte isMaskActiveAt(int l, int t, int r, int b, byte *mem); @@ -702,9 +699,12 @@ public: bool _fullRedraw, _BgNeedsRedraw, _shakeEnabled, _verbRedraw; bool _screenEffectFlag, _completeScreenRedraw; - int _cursorHotspotX, _cursorHotspotY, _cursorWidth, _cursorHeight; - byte _cursorAnimate, _cursorAnimateIndex, _grabbedCursor[2048]; - int8 _cursorState; + struct { + int hotspotX, hotspotY, width, height; + byte animate, animateIndex; + int8 state; + } _cursor; + byte _grabbedCursor[2048]; byte _currentCursor; byte _newEffect, _switchRoomEffect2, _switchRoomEffect; @@ -769,7 +769,7 @@ public: void grabCursor(int x, int y, int w, int h); void grabCursor(byte *ptr, int width, int height); void makeCursorColorTransparent(int a); - void setupCursor() { _cursorAnimate = 1; } + void setupCursor() { _cursor.animate = 1; } void decompressDefaultCursor(int index); void useIm01Cursor(byte *im, int w, int h); void useBompCursor(byte *im, int w, int h); @@ -855,8 +855,8 @@ public: int tempMusic; bool _silentDigitalImuse; int _saveSound; - uint16 _soundParam, _soundParam2, _soundParam3; - int current_cd_sound, _cd_loops, _cd_frame, _cd_track, _cd_end; + int current_cd_sound; + int _cd_loops, _cd_frame, _cd_track, _cd_end; // FIXME - these are not used anymore /* Walkbox / Navigation class */ int _maxBoxVertexHeap, _boxPathVertexHeapIndex, _boxMatrixItem; @@ -923,8 +923,6 @@ public: void translateText(byte *text, byte *trans_buff); byte _transText[256]; - bool checkFixedDisk(); - #if defined(SCUMM_LITTLE_ENDIAN) uint32 fileReadDword() { return _fileHandle.readUint32LE(); } #elif defined(SCUMM_BIG_ENDIAN) diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index ab41c5131f..ae6f4d8e1c 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -87,7 +87,6 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _game_name = (char*)detector->_gameFileName.c_str(); _gameId = detector->_gameId; _features = detector->_features; - _soundCardType = detector->_soundCardType; _noSubtitles = detector->_noSubtitles; _defaultTalkDelay = detector->_talkSpeed; _use_adlib = detector->_use_adlib; @@ -312,7 +311,7 @@ void Scumm::scummInit() _keepText = false; _currentCursor = 0; - _cursorState = 0; + _cursor.state = 0; _userPut = 0; _newEffect = 129; @@ -354,15 +353,15 @@ void Scumm::scummInit() void Scumm::initScummVars() { if (!(_features & GF_AFTER_V7)) { - _vars[VAR_CURRENTDRIVE] = _currentDrive; - _vars[VAR_FIXEDDISK] = checkFixedDisk(); - _vars[VAR_SOUNDCARD] = _soundCardType; + _vars[VAR_CURRENTDRIVE] = 0; + _vars[VAR_FIXEDDISK] = true; + _vars[VAR_SOUNDCARD] = 3; _vars[VAR_VIDEOMODE] = 0x13; _vars[VAR_HEAPSPACE] = 1400; - _vars[VAR_MOUSEPRESENT] = _mousePresent; - _vars[VAR_SOUNDPARAM] = _soundParam; - _vars[VAR_SOUNDPARAM2] = _soundParam2; - _vars[VAR_SOUNDPARAM3] = _soundParam3; + _vars[VAR_MOUSEPRESENT] = true; // FIXME - used to be 0, but that seems odd?!? + _vars[VAR_SOUNDPARAM] = 0; + _vars[VAR_SOUNDPARAM2] = 0; + _vars[VAR_SOUNDPARAM3] = 0; if (_features & GF_AFTER_V6) _vars[VAR_V6_EMSSPACE] = 10000; } else { @@ -548,7 +547,7 @@ int Scumm::scummLoop(int delta) clearClickedStatus(); } - if (_cursorState > 0) { + if (_cursor.state > 0) { verbMouseOver(checkMouseOver(mouse.x, mouse.y)); } @@ -570,7 +569,7 @@ int Scumm::scummLoop(int delta) animateCursor(); /* show or hide mouse */ - _system->show_mouse(_cursorState > 0); + _system->show_mouse(_cursor.state > 0); _vars[VAR_TIMER] = 0; return _vars[VAR_TIMER_NEXT]; @@ -1199,7 +1198,7 @@ int Scumm::getKeyInput(int a) void Scumm::convertKeysToClicks() { - if (_lastKeyHit && _cursorState > 0) { + if (_lastKeyHit && _cursor.state > 0) { if (_lastKeyHit == 9) { _mouseButStat = MBS_RIGHT_CLICK; } else if (_lastKeyHit == 13) { @@ -1613,7 +1612,3 @@ byte Scumm::getDefaultGUIColor(int color) return getStringAddress(21)[color]; } } - -bool Scumm::checkFixedDisk() { - return true; -} |