[Scummvm-git-logs] scummvm master -> 007ab8c9ffcb0f11020b62df81bb86f85ea9aeee
alxpnv
a04198622 at gmail.com
Thu May 20 12:34:09 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c33604a765 ASYLUM: make actors face each other when interacting
007ab8c9ff ASYLUM: implement fade to grayscale
Commit: c33604a765a3cbae1947e664df48a15c56e997b8
https://github.com/scummvm/scummvm/commit/c33604a765a3cbae1947e664df48a15c56e997b8
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-05-20T15:36:11+03:00
Commit Message:
ASYLUM: make actors face each other when interacting
Changed paths:
engines/asylum/resources/script.cpp
diff --git a/engines/asylum/resources/script.cpp b/engines/asylum/resources/script.cpp
index 48bdbf7d94..99fd348bc2 100644
--- a/engines/asylum/resources/script.cpp
+++ b/engines/asylum/resources/script.cpp
@@ -1716,30 +1716,33 @@ END_OPCODE
//////////////////////////////////////////////////////////////////////////
// Opcode 0x56
IMPLEMENT_OPCODE(Interact)
- Actor *actor = getScene()->getActor(cmd->param2 == 2 ? getSharedData()->getPlayerIndex() : cmd->param1);
+ Actor *player = getScene()->getActor(), *actor = getScene()->getActor((ActorIndex)cmd->param1);
- if (actor->getStatus() == kActorStatusWalkingTo || actor->getStatus() == kActorStatusWalkingTo2) {
- if (cmd->param2 == 2)
+ if (cmd->param2 == 2) {
+ if (player->getStatus() == kActorStatusWalkingTo || player->getStatus() == kActorStatusWalkingTo2) {
_processNextEntry = true;
- return;
- }
+ return;
+ }
- if (cmd->param2 == 2) {
cmd->param2 = 1;
_processNextEntry = false;
- if ((actor->getPoint1()->x + actor->getPoint2()->x == cmd->param6) && (actor->getPoint1()->y + actor->getPoint2()->y == cmd->param7)) {
- getScene()->getActor()->faceTarget((uint32)cmd->param1, kDirectionFromActor);
- actor->updateFromDirection((ActorDirection)((actor->getDirection() + 4) & 7));
+ if ((player->getPoint1()->x + player->getPoint2()->x == cmd->param6)
+ && (player->getPoint1()->y + player->getPoint2()->y == cmd->param7)) {
+ player->faceTarget((uint32)cmd->param1, kDirectionFromActor);
+ actor->updateFromDirection((ActorDirection)((player->getDirection() + 4) & 7));
} else {
_currentQueueEntry->currentLine = cmd->param3;
}
} else {
Common::Point point;
+ if (actor->getStatus() == kActorStatusWalkingTo || actor->getStatus() == kActorStatusWalkingTo2)
+ return;
+
if (actor->canInteract(&point, &cmd->param4)) {
- getScene()->getActor()->processStatus(point.x, point.y, (bool)cmd->param4);
+ player->processStatus(point.x, point.y, (bool)cmd->param4);
cmd->param6 = point.x;
cmd->param7 = point.y;
Commit: 007ab8c9ffcb0f11020b62df81bb86f85ea9aeee
https://github.com/scummvm/scummvm/commit/007ab8c9ffcb0f11020b62df81bb86f85ea9aeee
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-05-20T15:36:11+03:00
Commit Message:
ASYLUM: implement fade to grayscale
Changed paths:
engines/asylum/resources/encounters.cpp
engines/asylum/resources/script.cpp
engines/asylum/system/screen.cpp
engines/asylum/system/screen.h
engines/asylum/views/scene.cpp
diff --git a/engines/asylum/resources/encounters.cpp b/engines/asylum/resources/encounters.cpp
index 3ffd65a196..a263dad1da 100644
--- a/engines/asylum/resources/encounters.cpp
+++ b/engines/asylum/resources/encounters.cpp
@@ -1644,7 +1644,7 @@ void Encounter::runScript() {
case kOpcodePrepareMovie:
if (!getSharedData()->getMatteBarHeight()) {
- getScreen()->loadPalette();
+ getScreen()->loadGrayPalette();
getSharedData()->setMatteBarHeight(1);
getSharedData()->movieIndex = (uint16)getVariableInv(entry.param2);
getSharedData()->setMatteVar1(1);
diff --git a/engines/asylum/resources/script.cpp b/engines/asylum/resources/script.cpp
index 99fd348bc2..9b73879ad3 100644
--- a/engines/asylum/resources/script.cpp
+++ b/engines/asylum/resources/script.cpp
@@ -1024,7 +1024,7 @@ IMPLEMENT_OPCODE(PlayMovie)
if (!getSharedData()->getMatteBarHeight()) {
getCursor()->hide();
- getScreen()->loadPalette();
+ getScreen()->loadGrayPalette();
getSharedData()->setMatteVar1(1);
getSharedData()->setMatteBarHeight(1);
getSharedData()->setMatteVar2(0);
@@ -1187,7 +1187,7 @@ END_OPCODE
// Opcode 0x3B
IMPLEMENT_OPCODE(CreatePalette)
if (!cmd->param2) {
- getScreen()->loadPalette();
+ getScreen()->loadGrayPalette();
cmd->param2 = 1;
}
diff --git a/engines/asylum/system/screen.cpp b/engines/asylum/system/screen.cpp
index 6f48c3e0ee..66c72a43da 100644
--- a/engines/asylum/system/screen.cpp
+++ b/engines/asylum/system/screen.cpp
@@ -264,7 +264,7 @@ byte *Screen::getPaletteData(ResourceId id) {
return (resource->data + resource->getData(12));
}
-void Screen::loadPalette() {
+void Screen::loadGrayPalette() {
// Get the current action palette
ResourceId paletteId = getWorld()->actions[getScene()->getActor()->getActionIndex3()]->paletteResourceId;
if (!paletteId)
@@ -272,9 +272,13 @@ void Screen::loadPalette() {
// Get the data
byte *paletteData = getPaletteData(paletteId);
+ paletteData += 4;
- // Store data into our global palette
- memcpy(&_currentPalette, paletteData, sizeof(_currentPalette));
+ // Store grayscale data into our global palette
+ for (uint32 j = 3; j < ARRAYSIZE(_currentPalette) - 3; j += 3) {
+ uint32 gray = 4 * (paletteData[j] + paletteData[j + 1] + paletteData[j + 2]) / 3;
+ _currentPalette[j] = _currentPalette[j + 1] = _currentPalette[j + 2] = (byte)gray;
+ }
}
void Screen::setPalette(ResourceId id) {
@@ -342,11 +346,14 @@ void Screen::updatePalette(int32 param) {
byte *paletteData = getPaletteData(paletteId);
paletteData += 4;
+ float fParam = param / 20.0;
for (uint32 j = 3; j < ARRAYSIZE(_mainPalette) - 3; j += 3) {
- _mainPalette[j] = (byte)(4 * paletteData[j] + param * (4 * paletteData[j] - _currentPalette[j]));
- _mainPalette[j + 1] = (byte)(4 * paletteData[j + 1] + param * (4 * paletteData[j + 1] - _currentPalette[j + 1]));
- _mainPalette[j + 2] = (byte)(4 * paletteData[j + 2] + param * (4 * paletteData[j + 2] - _currentPalette[j + 2]));
+ _mainPalette[j] = (byte)((1.0 - fParam) * 4 * paletteData[j] + fParam * _currentPalette[j]);
+ _mainPalette[j + 1] = (byte)((1.0 - fParam) * 4 * paletteData[j + 1] + fParam * _currentPalette[j + 1]);
+ _mainPalette[j + 2] = (byte)((1.0 - fParam) * 4 * paletteData[j + 2] + fParam * _currentPalette[j + 2]);
}
+
+ setupPalette(NULL, 0, 0);
}
}
diff --git a/engines/asylum/system/screen.h b/engines/asylum/system/screen.h
index 2b2f56669b..ec585b5895 100644
--- a/engines/asylum/system/screen.h
+++ b/engines/asylum/system/screen.h
@@ -96,7 +96,7 @@ public:
// Palette
void setPalette(ResourceId id);
void setMainPalette(const byte *data);
- void loadPalette();
+ void loadGrayPalette();
void updatePalette();
void updatePalette(int32 param);
void setupPalette(byte *buffer, int start, int count);
diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index 6de99e84ee..55de298b3e 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -363,7 +363,7 @@ bool Scene::init() {
getScreen()->setPalette(paletteResource);
getScreen()->setGammaLevel(paletteResource);
- getScreen()->loadPalette();
+ getScreen()->loadGrayPalette();
getScreen()->setupTransTables(3, _ws->cellShadeMask1, _ws->cellShadeMask2, _ws->cellShadeMask3);
getScreen()->selectTransTable(1);
More information about the Scummvm-git-logs
mailing list