[Scummvm-git-logs] scummvm master -> dce8a98a18f4880b5d88d3b1ff31c05a72d370c0

bonki bonki at users.noreply.github.com
Fri Mar 2 17:26:38 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dce8a98a18 TUCKER: Add CursorStyle and CursorState enums


Commit: dce8a98a18f4880b5d88d3b1ff31c05a72d370c0
    https://github.com/scummvm/scummvm/commit/dce8a98a18f4880b5d88d3b1ff31c05a72d370c0
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-03-02T17:26:12+01:00

Commit Message:
TUCKER: Add CursorStyle and CursorState enums

Changed paths:
    engines/tucker/locations.cpp
    engines/tucker/resource.cpp
    engines/tucker/saveload.cpp
    engines/tucker/sequences.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h


diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index 0c31b98..fee989c 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -3021,11 +3021,11 @@ void TuckerEngine::execData3PreUpdate_locationNum70() {
 		_updateLocation70StringLen = 0;
 		_forceRedrawPanelItems = true;
 		_panelState = 1;
-		setCursorType(2);
+		setCursorState(kCursorStateDisabledHidden);
 	}
 	_forceRedrawPanelItems = true;
 	_panelState = 1;
-	setCursorType(2);
+	setCursorState(kCursorStateDisabledHidden);
 	int pos = getPositionForLine(22, _infoBarBuf);
 	const int yPos = (_flagsTable[143] == 0) ? 90 : 72;
 	drawStringAlt(88, yPos, color, &_infoBarBuf[pos]);
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 82be9ab..c2c84b9 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -693,7 +693,7 @@ void TuckerEngine::loadData4() {
 			d->_standX = t.getNextInteger();
 			d->_standY = t.getNextInteger();
 			d->_textNum = t.getNextInteger();
-			d->_cursorNum = t.getNextInteger();
+			d->_cursorStyle = (CursorStyle)t.getNextInteger();
 			d->_locationNum = t.getNextInteger();
 			if (d->_locationNum > 0) {
 				d->_toX = t.getNextInteger();
@@ -983,7 +983,7 @@ void TuckerEngine::loadActionsTable() {
 			}
 			_forceRedrawPanelItems = true;
 			_panelState = 1;
-			setCursorType(2);
+			setCursorState(kCursorStateDisabledHidden);
 			_tableInstructionsPtr = _csDataBuf + t._pos + 1;
 			_csDataLoaded = true;
 			_csDataHandled = true;
@@ -1032,7 +1032,7 @@ void TuckerEngine::loadActionsTable() {
 				_nextAction = _nextTableToLoadTable[_nextTableToLoadIndex];
 				_csDataLoaded = false;
 				 _conversationOptionsCount = 0;
-				setCursorType(2);
+				setCursorState(kCursorStateDisabledHidden);
 			}
 			break;
 		}
@@ -1045,7 +1045,7 @@ void TuckerEngine::loadActionsTable() {
 		_csDataLoaded = false;
 		_forceRedrawPanelItems = true;
 		_panelState = 0;
-		setCursorType(0);
+		setCursorState(kCursorStateNormal);
 		_csDataHandled = false;
 		_actionVerbLocked = false;
 		_mouseClick = 1;
diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp
index e48e4fd..08a4dfa 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -119,11 +119,11 @@ Common::Error TuckerEngine::saveGameState(int num, const Common::String &descrip
 
 
 bool TuckerEngine::canLoadGameStateCurrently() {
-	return !_player && _cursorType < 2;
+	return !_player && _cursorState != kCursorStateDisabledHidden;
 }
 
 bool TuckerEngine::canSaveGameStateCurrently() {
-	return !_player && _cursorType < 2;
+	return !_player && _cursorState != kCursorStateDisabledHidden;
 }
 
 bool TuckerEngine::existsSavegame() {
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 0151c55..184b70b 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -414,11 +414,11 @@ void TuckerEngine::handleMapSequence() {
 	if (_nextLocationNum == 9 && _noPositionChangeAfterMap) {
 		_backgroundSpriteCurrentAnimation = 2;
 		_backgroundSpriteCurrentFrame = 0;
-		setCursorType(2);
+		setCursorState(kCursorStateDisabledHidden);
 	} else if (_nextLocationNum == 66 && _noPositionChangeAfterMap) {
 		_backgroundSpriteCurrentAnimation = 1;
 		_backgroundSpriteCurrentFrame = 0;
-		setCursorType(2);
+		setCursorState(kCursorStateDisabledHidden);
 	}
 	_noPositionChangeAfterMap = false;
 	_xPosCurrent = xPos;
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 8e11e22..b182b34 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -207,8 +207,8 @@ void TuckerEngine::resetVariables() {
 	_leftMouseButtonPressed = _rightMouseButtonPressed = false;
 	_lastKeyPressed = 0;
 	memset(_inputKeys, 0, sizeof(_inputKeys));
-	_cursorNum = 0;
-	_cursorType = 0;
+	_cursorStyle = kCursorNormal;
+	_cursorState = kCursorStateNormal;
 	_updateCursorFlag = false;
 
 	_panelNum = 1;
@@ -377,8 +377,8 @@ void TuckerEngine::mainLoop() {
 
 	loadBudSpr();
 	loadCursor();
-	setCursorNum(_cursorNum);
-	setCursorType(_cursorType);
+	setCursorStyle(_cursorStyle);
+	setCursorState(_cursorState);
 
 	_flagsTable[219] = 1;
 	_flagsTable[105] = 1;
@@ -422,7 +422,7 @@ void TuckerEngine::mainLoop() {
 			setupNewLocation();
 		}
 		updateCharPosition();
-		if (_cursorType == 0) {
+		if (_cursorState == kCursorStateNormal) {
 			updateCursor();
 		} else if (_panelState == 2) {
 			handleMouseOnPanel();
@@ -713,16 +713,16 @@ void TuckerEngine::updateCursorPos(int x, int y) {
 	_mousePosY = y;
 }
 
-void TuckerEngine::setCursorNum(int num) {
-	_cursorNum = num;
+void TuckerEngine::setCursorStyle(CursorStyle style) {
+	_cursorStyle = style;
 	static const int cursorW = 16;
 	static const int cursorH = 16;
-	CursorMan.replaceCursor(_cursorGfxBuf + _cursorNum * 256, cursorW, cursorH, 1, 1, 0);
+	CursorMan.replaceCursor(_cursorGfxBuf + _cursorStyle * 256, cursorW, cursorH, 1, 1, 0);
 }
 
-void TuckerEngine::setCursorType(int type) {
-	_cursorType = type;
-	CursorMan.showMouse(_cursorType < 2);
+void TuckerEngine::setCursorState(CursorState state) {
+	_cursorState = state;
+	CursorMan.showMouse(_cursorState != kCursorStateDisabledHidden);
 }
 
 void TuckerEngine::showCursor(bool visible) {
@@ -792,7 +792,7 @@ void TuckerEngine::copyLocBitmap(const char *filename, int offset, bool isMask)
 }
 
 void TuckerEngine::updateMouseState() {
-	if (_cursorType < 2) {
+	if (_cursorState != kCursorStateDisabledHidden) {
 		_leftMouseButtonPressed = (_mouseButtonsMask & 1) != 0;
 		if (_leftMouseButtonPressed) {
 			_mouseIdleCounter = 0;
@@ -809,9 +809,9 @@ void TuckerEngine::updateMouseState() {
 			_gameHintsStringNum = 0;
 		}
 	}
-	if (_cursorType == 1) {
+	if (_cursorState == kCursorStateDialog) {
 		if (_panelState == 1) {
-			setCursorNum(1);
+			setCursorStyle(kCursorTalk);
 		}
 		if (_mousePosY < 140) {
 			_mousePosY = 140;
@@ -820,7 +820,7 @@ void TuckerEngine::updateMouseState() {
 }
 
 void TuckerEngine::updateCharPositionHelper() {
-	setCursorType(2);
+	setCursorState(kCursorStateDisabledHidden );
 	_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 	_currentActionVerb = 0;
 	startSpeechSound(_speechSoundNum, _speechVolume);
@@ -1033,7 +1033,7 @@ void TuckerEngine::setBlackPalette() {
 }
 
 void TuckerEngine::updateCursor() {
-	setCursorNum(0);
+	setCursorStyle(kCursorNormal);
 	if (_backgroundSpriteCurrentAnimation == -1 && !_panelLockedFlag && _selectedObject._locationObjectLocationNum > 0) {
 		_selectedObject._locationObjectLocationNum = 0;
 	}
@@ -1396,7 +1396,7 @@ void TuckerEngine::saveOrLoad() {
 			}
 			_forceRedrawPanelItems = true;
 			_panelState = 0;
-			setCursorType(0);
+			setCursorState(kCursorStateNormal);
 			return;
 		}
 	}
@@ -1425,7 +1425,7 @@ void TuckerEngine::handleMouseOnPanel() {
 		} else if (_mousePosX < 218) {
 			_forceRedrawPanelItems = true;
 			_panelState = 0;
-			setCursorType(0);
+			setCursorState(kCursorStateNormal);
 		} else {
 			_quitGame = true;
 		}
@@ -2119,7 +2119,7 @@ void TuckerEngine::updateCharacterAnimation() {
 			_characterAnimationIndex = -1;
 			_backgroundSpriteCurrentAnimation = -1;
 			if (_nextAction == 0) {
-				setCursorType(0);
+				setCursorState(kCursorStateNormal);
 			}
 		} else {
 			_backgroundSpriteCurrentFrame = _characterAnimationsTable[_characterAnimationIndex];
@@ -2143,7 +2143,7 @@ void TuckerEngine::updateCharacterAnimation() {
 					_backgroundSpriteCurrentFrame = 0;
 					_changeBackgroundSprite = false;
 					if (_nextAction == 0) {
-						setCursorType(0);
+						setCursorState(kCursorStateNormal);
 					}
 				}
 			}
@@ -2162,7 +2162,7 @@ void TuckerEngine::updateCharacterAnimation() {
 					_backgroundSpriteCurrentAnimation = -1;
 					_backgroundSpriteCurrentFrame = 0;
 					if (_nextAction == 0 && _panelState == 0) {
-						setCursorType(0);
+						setCursorState(kCursorStateNormal);
 					}
 				}
 			}
@@ -2181,7 +2181,7 @@ void TuckerEngine::updateCharacterAnimation() {
 				_actionPosY = _yPosCurrent - 64;
 				_actionTextColor = 1;
 				_actionCharacterNum = 99;
-				setCursorType(2);
+				setCursorState(kCursorStateDisabledHidden);
 				_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 			}
 		}
@@ -2392,7 +2392,7 @@ void TuckerEngine::handleMap() {
 		}
 	}
 	if (!_panelLockedFlag && (_backgroundSpriteCurrentAnimation == -1 || _locationNum == 25) && _locationMaskType == 3) {
-		setCursorType(0);
+		setCursorState(kCursorStateNormal);
 		if (_locationMaskCounter == 1) {
 			_characterFacingDirection = 0;
 			_locationMaskType = 0;
@@ -2403,7 +2403,7 @@ void TuckerEngine::handleMap() {
 		if (_locationNum == 25 || _backgroundSpriteCurrentAnimation != 4) {
 			if (_locationMaskType == 0) {
 				_locationMaskType = 1;
-				setCursorType(2);
+				setCursorState(kCursorStateDisabledHidden);
 				if (_selectedObject._locationObjectToWalkX2 > 800) {
 					_backgroundSpriteCurrentAnimation = _selectedObject._locationObjectToWalkX2 - 900;
 					if (_selectedObject._locationObjectToWalkY2 > 499) {
@@ -2431,7 +2431,7 @@ void TuckerEngine::handleMap() {
 			}
 			_locationMaskType = 2;
 			_panelState = 0;
-			setCursorType(0);
+			setCursorState(kCursorStateNormal);
 			if (_selectedObject._locationObjectLocationNum == 99) {
 				_noPositionChangeAfterMap = true;
 				handleMapSequence();
@@ -3001,7 +3001,7 @@ void TuckerEngine::updateCharSpeechSound(bool displayText) {
 		}
 	}
 	if (_charSpeechSoundCounter == 0 && !_csDataHandled) {
-		setCursorType(0);
+		setCursorState(kCursorStateNormal);
 	} else if (displayText) {
 		drawSpeechText(_actionPosX, _actionPosY, _characterSpeechDataPtr, _speechSoundNum, _actionTextColor);
 	}
@@ -3364,7 +3364,7 @@ int TuckerEngine::executeTableInstruction() {
 			_nextTableToLoadTable[i] = readTableInstructionParam(3);
 		}
 		_nextTableToLoadIndex = -1;
-		setCursorType(1);
+		setCursorState(kCursorStateDialog);
 		return 1;
 	case kCode_opf:
 		_conversationOptionsCount = 0;
@@ -3384,7 +3384,7 @@ int TuckerEngine::executeTableInstruction() {
 			}
 		}
 		_nextTableToLoadIndex = -1;
-		setCursorType(1);
+		setCursorState(kCursorStateDialog);
 		return 1;
 	case kCode_ofg:
 		i = readTableInstructionParam(3);
@@ -3512,7 +3512,7 @@ int TuckerEngine::getObjectUnderCursor() {
 		}
 		_selectedObjectType = 0;
 		_selectedCharacterNum = i;
-		setCursorNum(_locationObjectsTable[i]._cursorNum);
+		setCursorStyle(_locationObjectsTable[i]._cursorStyle);
 		return i;
 	}
 	return -1;
@@ -3669,7 +3669,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() {
 			_actionVerbLocked = false;
 			_forceRedrawPanelItems = true;
 			_panelState = 2;
-			setCursorType(1);
+			setCursorState(kCursorStateDialog);
 		}
 		break;
 	case 1:
@@ -3681,7 +3681,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() {
 				_actionPosY = _yPosCurrent - 64;
 				_actionTextColor = 1;
 				_actionCharacterNum = 99;
-				setCursorType(2);
+				setCursorState(kCursorStateDisabledHidden);
 				_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 				_currentActionVerb = 0;
 				_speechSoundNum = 2235;
@@ -3794,7 +3794,7 @@ void TuckerEngine::setActionForInventoryObject() {
 		_actionPosY = _yPosCurrent - 64;
 		_actionTextColor = 1;
 		_actionCharacterNum = 99;
-		setCursorType(2);
+		setCursorState(kCursorStateDisabledHidden);
 		_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 		_actionVerbLocked = false;
 		_actionRequiresTwoObjects = false;
@@ -3860,7 +3860,7 @@ void TuckerEngine::playSpeechForAction(int i) {
 		_actionPosY = _yPosCurrent - 64;
 		_actionTextColor = 1;
 		_actionCharacterNum = 99;
-		setCursorType(2);
+		setCursorState(kCursorStateDisabledHidden);
 		_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 	}
 }
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index d458d80..a0d1b7c 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -52,6 +52,34 @@ class RewindableAudioStream;
  */
 namespace Tucker {
 
+enum CursorStyle {
+	kCursorNormal     = 0,
+	kCursorTalk       = 1,
+	kCursorArrowRight = 2,
+	kCursorArrowUp    = 3,
+	kCursorArrowLeft  = 4,
+	kCursorArrowDown  = 5,
+	kCursorMap        = 6
+};
+
+enum CursorState {
+	kCursorStateNormal         = 0,
+	kCursorStateDialog         = 1,
+	kCursorStateDisabledHidden = 2
+};
+
+enum Verb {
+	kVerbWalk  = 0,
+	kVerbLook  = 1,
+	kVerbTalk  = 2,
+	kVerbOpen  = 3,
+	kVerbClose = 4,
+	kVerbGive  = 5,
+	kVerbTake  = 6,
+	kVerbMove  = 7,
+	kVerbUse   = 8
+};
+
 struct Action {
 	int _key;
 	int _testFlag1Num;
@@ -157,7 +185,7 @@ struct LocationObject {
 	int _toWalkY2;
 	int _standX;
 	int _standY;
-	int _cursorNum;
+	CursorStyle _cursorStyle;
 };
 
 struct LocationSound {
@@ -194,18 +222,6 @@ enum {
 	kLastSaveSlot = 99
 };
 
-enum Verb {
-	kVerbWalk  = 0,
-	kVerbLook  = 1,
-	kVerbTalk  = 2,
-	kVerbOpen  = 3,
-	kVerbClose = 4,
-	kVerbGive  = 5,
-	kVerbTake  = 6,
-	kVerbMove  = 7,
-	kVerbUse   = 8
-};
-
 enum InputKey {
 	kInputKeyPause = 0,
 	kInputKeyEscape,
@@ -299,8 +315,8 @@ protected:
 	void waitForTimer(int ticksCount);
 	void parseEvents();
 	void updateCursorPos(int x, int y);
-	void setCursorNum(int num);
-	void setCursorType(int type);
+	void setCursorStyle(CursorStyle num);
+	void setCursorState(CursorState state);
 	void showCursor(bool visible);
 	void setupNewLocation();
 	void copyLocBitmap(const char *filename, int offset, bool isMask);
@@ -688,8 +704,8 @@ protected:
 	bool _mouseWheelDown;
 	int _lastKeyPressed;
 	bool _inputKeys[kInputKeyCount];
-	int _cursorNum;
-	int _cursorType;
+	CursorStyle _cursorStyle;
+	CursorState _cursorState;
 	bool _updateCursorFlag;
 
 	int _panelNum;





More information about the Scummvm-git-logs mailing list