[Scummvm-git-logs] scummvm master -> 3b53255a42ca082ae73c27b7a7223a3161dfd18d
elasota
noreply at scummvm.org
Thu Apr 6 22:28:03 UTC 2023
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
46f9af6d98 VCRUISE: Add tray map and compass
18e4369448 VCRUISE: Use correct cursor when panning down
6104ce1480 VCRUISE: Fix inventory not displaying after loading a saved game
5de4359523 VCRUISE: Fix wrong handling of string args.
3b53255a42 VCRUISE: Fix saves not loading correctly in areas with random sounds
Commit: 46f9af6d9870ac1980f07c1c33dc02b1077af8ad
https://github.com/scummvm/scummvm/commit/46f9af6d9870ac1980f07c1c33dc02b1077af8ad
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T18:27:42-04:00
Commit Message:
VCRUISE: Add tray map and compass
Changed paths:
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index a562c17a52d..db1a8685f73 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -891,6 +891,7 @@ bool Runtime::runIdle() {
_havePendingReturnToIdleState = false;
returnToIdleState();
+ drawCompass();
return true;
}
@@ -931,9 +932,10 @@ bool Runtime::runIdle() {
detectPanoramaMouseMovement(osEvent.timestamp);
bool changedState = dischargeIdleMouseMove();
- if (changedState)
+ if (changedState) {
+ drawCompass();
return true;
-
+ }
} else if (osEvent.type == kOSEventTypeLButtonUp) {
PanoramaState oldPanoramaState = _panoramaState;
_panoramaState = kPanoramaStateInactive;
@@ -943,8 +945,10 @@ bool Runtime::runIdle() {
if (_lmbReleaseWasClick) {
bool changedState = dischargeIdleClick();
- if (changedState)
+ if (changedState) {
+ drawCompass();
return true;
+ }
}
// If the released from panorama mode, pick up any interactions at the new mouse location, and change the mouse back
@@ -956,13 +960,17 @@ bool Runtime::runIdle() {
_idleIsOnInteraction = false;
bool changedState = dischargeIdleMouseMove();
- if (changedState)
+ if (changedState) {
+ drawCompass();
return true;
+ }
}
} else if (osEvent.type == kOSEventTypeLButtonDown) {
bool changedState = dischargeIdleMouseDown();
- if (changedState)
+ if (changedState) {
+ drawCompass();
return true;
+ }
}
}
@@ -1501,6 +1509,8 @@ void Runtime::terminateScript() {
return;
}
+ drawCompass();
+
if (_havePendingScreenChange)
changeToScreen(_roomNumber, _screenNumber);
}
@@ -2882,6 +2892,73 @@ void Runtime::drawInventory(uint slot) {
commitSectionToScreen(_traySection, sliceRect);
}
+void Runtime::drawCompass() {
+ bool haveHorizontalRotate = false;
+ bool haveUp = false;
+ bool haveDown = false;
+ bool haveLocation = false;
+
+ switch (_gameState) {
+ case kGameStateIdle:
+ case kGameStateGyroIdle:
+ case kGameStateGyroAnimation:
+ haveHorizontalRotate = _haveHorizPanAnimations;
+ haveUp = _havePanUpFromDirection[_direction];
+ haveDown = _havePanDownFromDirection[_direction];
+ break;
+ case kGameStatePanLeft:
+ case kGameStatePanRight:
+ haveHorizontalRotate = _haveHorizPanAnimations;
+ break;
+ default:
+ break;
+ }
+
+ haveLocation = (haveUp || haveDown || haveHorizontalRotate);
+
+ const Common::Rect blackoutRects[4] = {
+ Common::Rect(0, 40, 36, 62), // Left
+ Common::Rect(52, 40, 88, 62), // Right
+ Common::Rect(35, 12, 53, 38), // Up
+ Common::Rect(35, 56, 54, 78), // Down
+ };
+
+ const bool drawSections[4] = {haveHorizontalRotate, haveHorizontalRotate, haveUp, haveDown};
+
+ Common::Rect compassRect = Common::Rect(0, 0, _trayCompassGraphic->w, _trayCompassGraphic->h);
+
+ int16 vertOffset = (_traySection.rect.height() - compassRect.height()) / 2;
+ const int horizOffset = 0;
+
+ compassRect.translate(horizOffset, vertOffset);
+
+ _traySection.surf->blitFrom(*_trayCompassGraphic, Common::Point(compassRect.left, compassRect.top));
+
+ const uint32 blackColor = _traySection.surf->format.ARGBToColor(255, 0, 0, 0);
+
+ for (uint i = 0; i < 4; i++) {
+ if (!drawSections[i]) {
+ Common::Rect blackoutRect = blackoutRects[i];
+ blackoutRect.translate(horizOffset, vertOffset);
+
+ _traySection.surf->fillRect(blackoutRect, blackColor);
+ }
+ }
+
+ Common::Rect lowerRightRect = Common::Rect(_traySection.rect.right - 88, 0, _traySection.rect.right, 88);
+
+ if (haveLocation) {
+ if (_gameID == GID_REAH)
+ _traySection.surf->blitFrom(*_trayCornerGraphic, Common::Point(lowerRightRect.left, lowerRightRect.top));
+ } else {
+ if (_gameID == GID_REAH)
+ _traySection.surf->blitFrom(*_trayBackgroundGraphic, lowerRightRect, lowerRightRect);
+ }
+
+ commitSectionToScreen(_traySection, compassRect);
+ commitSectionToScreen(_traySection, lowerRightRect);
+}
+
void Runtime::resetInventoryHighlights() {
for (uint slot = 0; slot < kNumInventorySlots; slot++) {
InventoryItem &item = _inventory[slot];
@@ -3324,7 +3401,6 @@ void Runtime::scriptOpAnimR(ScriptArg_t arg) {
isRight = true;
}
-
uint cursorID = 0;
if (_haveHorizPanAnimations) {
uint panCursor = kPanCursorDraggableHoriz;
@@ -3338,6 +3414,7 @@ void Runtime::scriptOpAnimR(ScriptArg_t arg) {
}
changeToCursor(_cursors[cursorID]);
+ drawCompass();
}
void Runtime::scriptOpAnimF(ScriptArg_t arg) {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 19fe91b5c36..e73596b750d 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -662,6 +662,7 @@ private:
void inventoryAddItem(uint item);
void inventoryRemoveItem(uint item);
void drawInventory(uint slot);
+ void drawCompass();
void resetInventoryHighlights();
Common::String getFileNameForItemGraphic(uint itemID) const;
Commit: 18e4369448f343a73b7a1b28c593db360138cd75
https://github.com/scummvm/scummvm/commit/18e4369448f343a73b7a1b28c593db360138cd75
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T18:27:42-04:00
Commit Message:
VCRUISE: Use correct cursor when panning down
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index db1a8685f73..2f83ac7a3c5 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -3511,7 +3511,14 @@ void Runtime::scriptOpAnim(ScriptArg_t arg) {
_direction = stackArgs[kAnimDefStackArgs + 1];
_havePendingScreenChange = true;
- changeToCursor(_cursors[kCursorArrow]);
+
+ uint cursorID = kCursorArrow;
+ if (_scriptEnv.panInteractionID == kPanUpInteraction)
+ cursorID = _panCursors[kPanCursorDraggableUp | kPanCursorDirectionUp];
+ else if (_scriptEnv.panInteractionID == kPanDownInteraction)
+ cursorID = _panCursors[kPanCursorDraggableDown | kPanCursorDirectionDown];
+
+ changeToCursor(_cursors[cursorID]);
}
void Runtime::scriptOpStatic(ScriptArg_t arg) {
Commit: 6104ce148014e7fe36129105568a68b0c6bbff63
https://github.com/scummvm/scummvm/commit/6104ce148014e7fe36129105568a68b0c6bbff63
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T18:27:42-04:00
Commit Message:
VCRUISE: Fix inventory not displaying after loading a saved game
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 2f83ac7a3c5..ae48bb350b7 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -3202,6 +3202,9 @@ void Runtime::restoreSaveGameSnapshot() {
_havePendingScreenChange = true;
_forceScreenChange = true;
+
+ for (uint slot = 0; slot < kNumInventorySlots; slot++)
+ drawInventory(slot);
}
void Runtime::saveGame(Common::WriteStream *stream) const {
Commit: 5de43595236e66678e9e0ede3f786b878c768471
https://github.com/scummvm/scummvm/commit/5de43595236e66678e9e0ede3f786b878c768471
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T18:27:42-04:00
Commit Message:
VCRUISE: Fix wrong handling of string args.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index ae48bb350b7..6e63566c1d5 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -136,6 +136,8 @@ Runtime::StackValue &Runtime::StackValue::operator=(const StackValue &other) {
if (other.type == StackValue::kString)
new (&value) ValueUnion(other.value.s);
+ type = other.type;
+
return *this;
}
@@ -148,6 +150,8 @@ Runtime::StackValue &Runtime::StackValue::operator=(StackValue &&other) {
if (other.type == StackValue::kString)
new (&value) ValueUnion(Common::move(other.value.s));
+ type = other.type;
+
return *this;
}
@@ -1274,8 +1278,6 @@ void Runtime::continuePlayingAnimation(bool loop, bool useStopFrame, bool &outAn
return;
}
- debug(4, "Decoding animation frame %u", _animPendingDecodeFrame);
-
const Graphics::Surface *surface = _animDecoder->decodeNextFrame();
if (!surface) {
outAnimationEnded = true;
@@ -3275,7 +3277,7 @@ LoadGameOutcome Runtime::loadGame(Common::ReadStream *stream) {
} \
const StackValue *stackArgsPtr = &this->_scriptStack[stackSize - (n)]; \
for (uint i = 0; i < (n); i++) { \
- if (stackArgsPtr[i].type != StackValue::kNumber) \
+ if (stackArgsPtr[i].type != StackValue::kString) \
error("Expected op argument %u to be a string", i); \
arrayName[i] = Common::move(stackArgsPtr[i].value.s); \
} \
Commit: 3b53255a42ca082ae73c27b7a7223a3161dfd18d
https://github.com/scummvm/scummvm/commit/3b53255a42ca082ae73c27b7a7223a3161dfd18d
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T18:27:42-04:00
Commit Message:
VCRUISE: Fix saves not loading correctly in areas with random sounds
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 6e63566c1d5..ebe53eb11b0 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -650,6 +650,7 @@ LoadGameOutcome SaveGameSnapshot::read(Common::ReadStream *stream) {
inventory.resize(numInventory);
sounds.resize(numSounds);
triggeredOneShots.resize(numOneShots);
+ randomAmbientSounds.resize(numRandomAmbientSounds);
for (uint i = 0; i < numInventory; i++)
inventory[i].read(stream);
@@ -660,6 +661,9 @@ LoadGameOutcome SaveGameSnapshot::read(Common::ReadStream *stream) {
for (uint i = 0; i < numOneShots; i++)
triggeredOneShots[i].read(stream);
+ for (uint i = 0; i < numRandomAmbientSounds; i++)
+ randomAmbientSounds[i].read(stream);
+
for (uint i = 0; i < numVars; i++) {
uint32 key = stream->readUint32BE();
int32 value = stream->readSint32BE();
More information about the Scummvm-git-logs
mailing list