ASYLUM: minor fixes (mostly formatting)

This commit is contained in:
alxpnv 2021-04-21 13:02:12 +03:00 committed by Eugene Sandulenko
parent 380950a300
commit a6140c4944
No known key found for this signature in database
GPG key ID: 014D387312D34F08
8 changed files with 25 additions and 23 deletions

View file

@ -331,7 +331,7 @@ void AsylumEngine::playIntro() {
do { do {
// Poll events (this ensures we don't freeze the screen) // Poll events (this ensures we don't freeze the screen)
Common::Event ev; Common::Event ev;
while(_eventMan->pollEvent(ev)) { while (_eventMan->pollEvent(ev)) {
switch (ev.type) { switch (ev.type) {
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:

View file

@ -211,7 +211,7 @@ void Connector::turn(bool updpos) {
if (_nextConnector) { if (_nextConnector) {
if (_isConnected) { if (_isConnected) {
if(!(_nextConnectorPosition & _state)) if (!(_nextConnectorPosition & _state))
disconnect(_nextConnector); disconnect(_nextConnector);
} else if (_nextConnectorPosition & _state && _nextConnector->isReadyForConnection()) { } else if (_nextConnectorPosition & _state && _nextConnector->isReadyForConnection()) {
connect(_nextConnector); connect(_nextConnector);

View file

@ -187,7 +187,7 @@ bool PuzzleWheel::update(const AsylumEvent &) {
// Blinking red light // Blinking red light
getScreen()->draw(getWorld()->graphicResourceIds[12], (uint32)_frameIndexes[11], puzzleWheelPoints[12]); getScreen()->draw(getWorld()->graphicResourceIds[12], (uint32)_frameIndexes[11], puzzleWheelPoints[12]);
_frameIndexes[11] = (_frameIndexes[11] + 1 ) % (int32)GraphicResource::getFrameCount(_vm, getWorld()->graphicResourceIds[12]); _frameIndexes[11] = (_frameIndexes[11] + 1) % (int32)GraphicResource::getFrameCount(_vm, getWorld()->graphicResourceIds[12]);
// Clock // Clock
if (_showTurnedClock) if (_showTurnedClock)

View file

@ -924,7 +924,7 @@ bool Encounter::drawPortraits() {
} }
// Portrait 1 // Portrait 1
if (_portrait1.transTableNum == 3 ) if (_portrait1.transTableNum == 3)
getScreen()->draw(_portrait1.resourceId, getScreen()->draw(_portrait1.resourceId,
_portrait1.frameIndex, _portrait1.frameIndex,
_point + Common::Point(5, 5)); _point + Common::Point(5, 5));

View file

@ -1395,7 +1395,9 @@ IMPLEMENT_OPCODE(PlaySpeechScene2)
cmd->param7 = 1; cmd->param7 = 1;
return; return;
} }
} if (!cmd->param7) { }
if (!cmd->param7) {
_vm->clearGameFlag(kGameFlag219); _vm->clearGameFlag(kGameFlag219);
cmd->param7 = 1; cmd->param7 = 1;
return; return;
@ -1639,7 +1641,7 @@ IMPLEMENT_OPCODE(JumpObjectFrame)
cmd->param2 = object->getFrameCount() - 1; cmd->param2 = object->getFrameCount() - 1;
if (cmd->param3) { if (cmd->param3) {
if(object->getFrameIndex() == (uint32)cmd->param2) if (object->getFrameIndex() == (uint32)cmd->param2)
return; return;
} else if (cmd->param4) { } else if (cmd->param4) {
if (object->getFrameIndex() < (uint32)cmd->param2) if (object->getFrameIndex() < (uint32)cmd->param2)

View file

@ -306,9 +306,9 @@ void Screen::setupPalette(byte *buffer, int start, int count) {
palette += start; palette += start;
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
palette[0] = (byte )(buffer[0] * 4); palette[0] = (byte)(buffer[0] * 4);
palette[1] = (byte )(buffer[1] * 4); palette[1] = (byte)(buffer[1] * 4);
palette[2] = (byte )(buffer[2] * 4); palette[2] = (byte)(buffer[2] * 4);
buffer += 3; buffer += 3;
palette += 3; palette += 3;
@ -713,7 +713,7 @@ void Screen::clearGraphicsInQueue() {
void Screen::graphicsSelectionSort() { void Screen::graphicsSelectionSort() {
uint32 maxIdx; uint32 maxIdx;
for (uint32 i = 0; i < _queueItems.size(); i++) { for (uint32 i = 0; i < _queueItems.size() - 1; i++) {
maxIdx = i; maxIdx = i;
for (uint32 j = i + 1; j < _queueItems.size(); j++) for (uint32 j = i + 1; j < _queueItems.size(); j++)
@ -1215,7 +1215,7 @@ void Screen::copyToBackBufferWithTransparency(byte *buffer, int32 pitch, int16 x
for (int32 curX = left; curX < right; curX++) { for (int32 curX = left; curX < right; curX++) {
uint32 offset = (uint32)((mirrored ? right - (curX + 1) : curX) + curY * pitch); uint32 offset = (uint32)((mirrored ? right - (curX + 1) : curX) + curY * pitch);
if (buffer[offset] != 0 ) if (buffer[offset] != 0)
dest[x + curX + (y + curY) * 640] = buffer[offset]; dest[x + curX + (y + curY) * 640] = buffer[offset];
} }
} }

View file

@ -1127,7 +1127,7 @@ void Menu::updateViewMovies() {
if (index >= ARRAYSIZE(_movieList)) if (index >= ARRAYSIZE(_movieList))
break; break;
if (_movieList[index] != -1 ) { if (_movieList[index] != -1) {
sprintf((char *)&text, "%d. %s ", index + 1, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieList[index]))); sprintf((char *)&text, "%d. %s ", index + 1, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieList[index])));
sprintf((char *)&text2, getText()->get(MAKE_RESOURCE(kResourcePackText, 1356)), moviesCd[_movieList[index]]); sprintf((char *)&text2, getText()->get(MAKE_RESOURCE(kResourcePackText, 1356)), moviesCd[_movieList[index]]);
strcat((char *)&text, (char *)&text2); strcat((char *)&text, (char *)&text2);
@ -1152,7 +1152,7 @@ void Menu::updateViewMovies() {
if (index >= ARRAYSIZE(_movieList)) if (index >= ARRAYSIZE(_movieList))
break; break;
if (_movieList[index] != -1 ) { if (_movieList[index] != -1) {
sprintf((char *)&text, "%d. %s ", index + 1, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieList[index]))); sprintf((char *)&text, "%d. %s ", index + 1, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieList[index])));
sprintf((char *)&text2, getText()->get(MAKE_RESOURCE(kResourcePackText, 1356)), moviesCd[_movieList[index]]); sprintf((char *)&text2, getText()->get(MAKE_RESOURCE(kResourcePackText, 1356)), moviesCd[_movieList[index]]);
strcat((char *)&text, (char *)&text2); strcat((char *)&text, (char *)&text2);

View file

@ -664,23 +664,23 @@ bool Scene::updateScreen() {
bool Scene::updateScene() { bool Scene::updateScene() {
#ifdef DEBUG_SCENE_TIMES #ifdef DEBUG_SCENE_TIMES
#define MESURE_TICKS(func) { \ #define MEASURE_TICKS(func) { \
int32 startTick =_vm->getTick(); \ int32 startTick =_vm->getTick(); \
func(); \ func(); \
debugC(kDebugLevelScene, "[Scene] " #func " - Time: %d", _vm->getTick() - startTick); \ debugC(kDebugLevelScene, "[Scene] " #func " - Time: %d", _vm->getTick() - startTick); \
} }
#else #else
#define MESURE_TICKS(func) func(); #define MEASURE_TICKS(func) func();
#endif #endif
// Update each part of the scene // Update each part of the scene
if (getSharedData()->getMatteBarHeight() != 170 || getSharedData()->getMattePlaySound()) { if (getSharedData()->getMatteBarHeight() != 170 || getSharedData()->getMattePlaySound()) {
MESURE_TICKS(updateMouse); MEASURE_TICKS(updateMouse);
MESURE_TICKS(updateActors); MEASURE_TICKS(updateActors);
MESURE_TICKS(updateObjects); MEASURE_TICKS(updateObjects);
MESURE_TICKS(updateAmbientSounds); MEASURE_TICKS(updateAmbientSounds);
MESURE_TICKS(updateMusic); MEASURE_TICKS(updateMusic);
MESURE_TICKS(updateAdjustScreen); MEASURE_TICKS(updateAdjustScreen);
} }
return getScript()->process(); return getScript()->process();
@ -801,7 +801,7 @@ void Scene::updateMouse() {
newDirection = kDirectionE; newDirection = kDirectionE;
} }
} }
} else if ( player->getDirection() == kDirectionS) { } else if (player->getDirection() == kDirectionS) {
if ((mouse.x - actorRect.right) > 10) if ((mouse.x - actorRect.right) > 10)
newDirection = kDirectionSE; newDirection = kDirectionSE;
} else if ((player->getDirection() != kDirectionE || (mouse.y - actorRect.bottom) > 10)) { } else if ((player->getDirection() != kDirectionE || (mouse.y - actorRect.bottom) > 10)) {
@ -1343,7 +1343,7 @@ int32 Scene::hitTestActionArea() {
int32 targetIdx = findActionArea(kActionAreaType2, Common::Point(_ws->xLeft + pt.x, _ws->yTop + pt.y)); int32 targetIdx = findActionArea(kActionAreaType2, Common::Point(_ws->xLeft + pt.x, _ws->yTop + pt.y));
if ( targetIdx == -1 || !(_ws->actions[targetIdx]->actionType & (kActionTypeFind | kActionTypeTalk | kActionTypeGrab | kActionType16))) if (targetIdx == -1 || !(_ws->actions[targetIdx]->actionType & (kActionTypeFind | kActionTypeTalk | kActionTypeGrab | kActionType16)))
return -1; return -1;
return targetIdx; return targetIdx;