[Scummvm-git-logs] scummvm master -> b61db5daa4ebd7c5f7edf6e279f35941a815fcfc
neuromancer
noreply at scummvm.org
Wed Jan 26 17:52:01 UTC 2022
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:
b61db5daa4 HYPNO: used clang-format to make the code more readable
Commit: b61db5daa4ebd7c5f7edf6e279f35941a815fcfc
https://github.com/scummvm/scummvm/commit/b61db5daa4ebd7c5f7edf6e279f35941a815fcfc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-01-26T18:52:04+01:00
Commit Message:
HYPNO: used clang-format to make the code more readable
Changed paths:
engines/hypno/actions.cpp
engines/hypno/scene.cpp
engines/hypno/spider/arcade.cpp
diff --git a/engines/hypno/actions.cpp b/engines/hypno/actions.cpp
index 5e8daebf211..b12fbb5f58e 100644
--- a/engines/hypno/actions.cpp
+++ b/engines/hypno/actions.cpp
@@ -26,7 +26,7 @@
namespace Hypno {
-//Actions
+// Actions
void HypnoEngine::runMenu(Hotspots *hs) {
Hotspot *h = hs->begin();
@@ -35,36 +35,36 @@ void HypnoEngine::runMenu(Hotspots *hs) {
for (Actions::const_iterator itt = h->actions.begin(); itt != h->actions.end(); ++itt) {
Action *action = *itt;
switch (action->type) {
- case QuitAction:
- runQuit((Quit *)action);
+ case QuitAction:
+ runQuit((Quit *)action);
break;
- case TimerAction:
- runTimer((Timer *)action);
+ case TimerAction:
+ runTimer((Timer *)action);
break;
- case BackgroundAction:
- runBackground((Background *)action);
+ case BackgroundAction:
+ runBackground((Background *)action);
break;
- case OverlayAction:
- runOverlay((Overlay *)action);
+ case OverlayAction:
+ runOverlay((Overlay *)action);
break;
- case AmbientAction:
- runAmbient((Ambient *)action);
+ case AmbientAction:
+ runAmbient((Ambient *)action);
break;
- case IntroAction:
- runIntro((Intro *)action);
+ case IntroAction:
+ runIntro((Intro *)action);
break;
- case CutsceneAction:
- runCutscene((Cutscene *)action);
+ case CutsceneAction:
+ runCutscene((Cutscene *)action);
break;
- case PaletteAction:
- runPalette((Palette *)action);
+ case PaletteAction:
+ runPalette((Palette *)action);
break;
- default:
+ default:
break;
}
- //else if (typeid(*action) == typeid(Mice))
+ // else if (typeid(*action) == typeid(Mice))
// runMice(h, (Mice*) action);
}
@@ -73,11 +73,11 @@ void HypnoEngine::runMenu(Hotspots *hs) {
void HypnoEngine::drawBackToMenu(Hotspot *h) {}
-void HypnoEngine::runBackground(Background *a) {
+void HypnoEngine::runBackground(Background *a) {
if (a->condition.size() > 0) {
bool condition = _sceneState[a->condition];
- if (a->flag1 == "/NSTATE" || a->flag2 == "/NSTATE")
+ if (a->flag1 == "/NSTATE" || a->flag2 == "/NSTATE")
condition = !condition;
if (!condition)
@@ -91,7 +91,7 @@ void HypnoEngine::runTimer(Timer *a) {
if (_timerStarted)
return; // Do not start another timer
- uint32 delay = a->delay/1000;
+ uint32 delay = a->delay / 1000;
debugC(1, kHypnoDebugScene, "Starting timer with %d secons", delay);
if (delay == 0 || !startCountdown(delay))
@@ -126,7 +126,6 @@ void HypnoEngine::runIntro(Intro *a) {
runIntro(v);
}
-
void HypnoEngine::runCutscene(Cutscene *a) {
stopSound();
defaultCursor();
@@ -178,7 +177,7 @@ void HypnoEngine::runAmbient(Ambient *a) {
else
sframe = frame;
drawImage(*sframe, a->origin.x, a->origin.y, true);
- if (a->fullscreen){
+ if (a->fullscreen) {
frame->free();
delete frame;
}
@@ -209,7 +208,7 @@ void HypnoEngine::runWalN(WalN *a) {
void HypnoEngine::runSave(Save *a) {
// TODO: enable this when saving in the main menu is available
- //saveGameDialog();
+ // saveGameDialog();
}
void HypnoEngine::runLoad(Load *a) {
@@ -227,7 +226,7 @@ void HypnoEngine::runQuit(Quit *a) {
}
void HypnoEngine::runChangeLevel(ChangeLevel *a) {
- debugC(1, kHypnoDebugScene, "Next level is '%s'", a->level.c_str());
+ debugC(1, kHypnoDebugScene, "Next level is '%s'", a->level.c_str());
_nextLevel = a->level;
}
@@ -237,4 +236,3 @@ void HypnoEngine::runTalk(Talk *a) {
}
} // End of namespace Hypno
-
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index ce82ed3faa1..7de14d2d6ce 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -55,8 +55,7 @@ const char *sceneVariables[] = {
"GS_COMBATJSON",
"GS_COMBATLEVEL",
"GS_PUZZLELEVEL",
- nullptr
-};
+ nullptr};
void HypnoEngine::loadSceneLevel(const Common::String ¤t, const Common::String &next, const Common::String &prefix) {
debugC(1, kHypnoDebugParser, "Parsing %s", current.c_str());
@@ -144,57 +143,59 @@ void HypnoEngine::clickedHotspot(Common::Point mousePos) {
for (Actions::const_iterator itt = selected.actions.begin(); itt != selected.actions.end() && cont; ++itt) {
Action *action = *itt;
switch (action->type) {
- case ChangeLevelAction:
- runChangeLevel((ChangeLevel *)action);
+ case ChangeLevelAction:
+ runChangeLevel((ChangeLevel *)action);
break;
- case EscapeAction:
- runEscape();
+ case EscapeAction:
+ runEscape();
break;
- case CutsceneAction:
- runCutscene((Cutscene *)action);
+ case CutsceneAction:
+ runCutscene((Cutscene *)action);
break;
- case PlayAction:
- runPlay((Play *)action);
+ case PlayAction:
+ runPlay((Play *)action);
break;
- case WalNAction:
- runWalN((WalN *)action);
+ case WalNAction:
+ runWalN((WalN *)action);
break;
-
- case GlobalAction:
- cont = runGlobal((Global *)action);
+
+ case GlobalAction:
+ cont = runGlobal((Global *)action);
break;
- case TalkAction:
- runTalk((Talk *)action);
+ case TalkAction:
+ runTalk((Talk *)action);
break;
- case SaveAction:
- runSave((Save *)action);
+ case SaveAction:
+ runSave((Save *)action);
break;
- case LoadAction:
- runLoad((Load *)action);
+ case LoadAction:
+ runLoad((Load *)action);
break;
- case LoadCheckpointAction:
- runLoadCheckpoint((LoadCheckpoint *)action);
+ case LoadCheckpointAction:
+ runLoadCheckpoint((LoadCheckpoint *)action);
break;
- case QuitAction:
- runQuit((Quit *)action);
+ case QuitAction:
+ runQuit((Quit *)action);
break;
- case AmbientAction:
- runAmbient((Ambient *)action);
+
+ case AmbientAction:
+ runAmbient((Ambient *)action);
break;
- case PaletteAction:
- runPalette((Palette *)action);
+
+ case PaletteAction:
+ runPalette((Palette *)action);
break;
- default:
+ default:
break;
}
}
@@ -223,10 +224,10 @@ bool HypnoEngine::hoverHotspot(Common::Point mousePos) {
for (Actions::const_iterator itt = selected.actions.begin(); itt != selected.actions.end(); ++itt) {
Action *action = *itt;
switch (action->type) {
- case MiceAction:
- runMice((Mice *)action);
+ case MiceAction:
+ runMice((Mice *)action);
break;
- default:
+ default:
break;
}
}
@@ -257,7 +258,6 @@ void HypnoEngine::runTransition(Transition *trans) {
_nextLevel = nextLevel;
}
-
void HypnoEngine::runScene(Scene *scene) {
_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
_refreshConversation = false;
@@ -277,23 +277,23 @@ void HypnoEngine::runScene(Scene *scene) {
defaultCursor();
while (!shouldQuit() && _nextLevel.empty()) {
-
+
if (_timerStarted && _videosPlaying.empty() && !_nextHotsToRemove) {
- if (lastCountdown == _countdown) {}
- else if (_countdown > 0) {
+ if (lastCountdown == _countdown) {
+ } else if (_countdown > 0) {
uint32 c = _pixelFormat.RGBToColor(255, 0, 0);
runMenu(stack.back());
uint32 minutes = _countdown / 60;
uint32 seconds = _countdown % 60;
- _font->drawString(_compositeSurface, Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
+ _font->drawString(_compositeSurface, Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
drawScreen();
} else {
assert(!scene->levelIfLose.empty());
_nextLevel = scene->levelIfLose;
debugC(1, kHypnoDebugScene, "Finishing level and jumping to %s", _nextLevel.c_str());
resetSceneState();
- continue;
+ continue;
}
lastCountdown = _countdown;
}
@@ -312,7 +312,6 @@ void HypnoEngine::runScene(Scene *scene) {
drawScreen();
}
}
-
}
_videosPlaying.clear();
@@ -350,7 +349,7 @@ void HypnoEngine::runScene(Scene *scene) {
case Common::EVENT_MOUSEMOVE:
// Reset cursor to default
- //changeCursor("default");
+ // changeCursor("default");
// The following functions will return true
// if the cursor is changed
@@ -369,8 +368,8 @@ void HypnoEngine::runScene(Scene *scene) {
}
}
- if (_refreshConversation && !_conversation.empty() &&
- _nextSequentialVideoToPlay.empty() &&
+ if (_refreshConversation && !_conversation.empty() &&
+ _nextSequentialVideoToPlay.empty() &&
_nextParallelVideoToPlay.empty() &&
_videosPlaying.empty()) {
showConversation();
@@ -391,7 +390,7 @@ void HypnoEngine::runScene(Scene *scene) {
}
if (!_nextSequentialVideoToPlay.empty() && _videosPlaying.empty()) {
- MVideo *it = _nextSequentialVideoToPlay.begin();
+ MVideo *it = _nextSequentialVideoToPlay.begin();
playVideo(*it);
if (it->loop)
_videosLooping.push_back(*it);
@@ -406,7 +405,7 @@ void HypnoEngine::runScene(Scene *scene) {
if (it->loop && enableLoopingVideos) {
it->decoder->rewind();
it->decoder->start();
- }
+ }
} else if (it->decoder->needsUpdate()) {
updateScreen(*it);
}
@@ -419,7 +418,7 @@ void HypnoEngine::runScene(Scene *scene) {
if (it->decoder) {
if (it->decoder->endOfVideo()) {
- if (it->scaled ||
+ if (it->scaled ||
( it->currentFrame->w == _screenW
&& it->currentFrame->h == _screenH
&& it->decoder->getCurFrame() > 0)) {
@@ -451,7 +450,7 @@ void HypnoEngine::runScene(Scene *scene) {
}
if (checkSceneCompleted() || checkLevelWon()) {
- if(!checkLevelWon() && stack.size() > 1) {
+ if (!checkLevelWon() && stack.size() > 1) {
debugC(1, kHypnoDebugScene, "Executing escape instead of ending the scene");
runEscape();
_sceneState["GS_LEVELCOMPLETE"] = 0;
@@ -460,9 +459,9 @@ void HypnoEngine::runScene(Scene *scene) {
// Make sure all the videos are played before we finish
enableLoopingVideos = false;
- if (_conversation.empty() &&
- _videosPlaying.empty() &&
- _nextSequentialVideoToPlay.empty() &&
+ if (_conversation.empty() &&
+ _videosPlaying.empty() &&
+ _nextSequentialVideoToPlay.empty() &&
_nextParallelVideoToPlay.empty()) {
if (_nextLevel.empty()) {
@@ -548,6 +547,4 @@ void HypnoEngine::rightClickedConversation(const Common::Point &mousePos) { erro
void HypnoEngine::leftClickedConversation(const Common::Point &mousePos) { error("Function \"%s\" not implemented", __FUNCTION__); }
bool HypnoEngine::hoverConversation(const Common::Point &mousePos) { error("Function \"%s\" not implemented", __FUNCTION__); }
-
} // End of namespace Hypno
-
diff --git a/engines/hypno/spider/arcade.cpp b/engines/hypno/spider/arcade.cpp
index 0d32751f5fb..92457f9ae35 100644
--- a/engines/hypno/spider/arcade.cpp
+++ b/engines/hypno/spider/arcade.cpp
@@ -34,7 +34,7 @@ static const int shootOriginIndex[9][2] = {
{41, 3}, {51, 3}, {65, 6}, {68, 9}, {71, 22}, {57, 20}, {37, 14}, {37, 11}, {57, 20}};
void SpiderEngine::hitPlayer() {
- if ( _playerFrameSep < (int)_playerFrames.size()){
+ if (_playerFrameSep < (int)_playerFrames.size()) {
if (_playerFrameIdx < _playerFrameSep)
_playerFrameIdx = _playerFrameSep;
} else {
@@ -42,11 +42,10 @@ void SpiderEngine::hitPlayer() {
_compositeSurface->fillRect(Common::Rect(0, 0, 640, 480), c);
drawScreen();
}
- //if (!_hitSound.empty())
+ // if (!_hitSound.empty())
// playSound(_soundPath + _hitSound, 1);
}
-
void SpiderEngine::drawShoot(const Common::Point &target) {
uint32 c = 248; // white
uint32 ox = 0;
@@ -54,12 +53,12 @@ void SpiderEngine::drawShoot(const Common::Point &target) {
if (_arcadeMode == "YC" || _arcadeMode == "YD") {
return; // Nothing to shoot
- } else if (_arcadeMode == "YE" || _arcadeMode == "YF") {
- ox = _screenW/2;
- oy = _screenH - _playerFrames[0]->h/2;
+ } else if (_arcadeMode == "YE" || _arcadeMode == "YF") {
+ ox = _screenW / 2;
+ oy = _screenH - _playerFrames[0]->h / 2;
} else if (_arcadeMode == "YB") {
uint32 idx = MIN(2, target.x / (_screenW / 3)) + 3 * MIN(2, target.y / (_screenH / 3));
- ox = 60 + shootOriginIndex[idx][0];
+ ox = 60 + shootOriginIndex[idx][0];
oy = 129 + shootOriginIndex[idx][1];
} else
error("Invalid arcade mode %s", _arcadeMode.c_str());
@@ -84,67 +83,67 @@ void SpiderEngine::drawPlayer() {
_playerFrameIdx = 0;
else if (_lastPlayerPosition != _currentPlayerPosition && (_playerFrameIdx % 4 == 0 || _playerFrameIdx % 4 == 3)) {
- switch(_lastPlayerPosition) {
- case kPlayerLeft:
- switch(_currentPlayerPosition) {
- case kPlayerTop:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 1;
- break;
- case kPlayerBottom:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 13;
- break;
- case kPlayerRight:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 45;
- break;
- }
- break;
+ switch (_lastPlayerPosition) {
+ case kPlayerLeft:
+ switch (_currentPlayerPosition) {
+ case kPlayerTop:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 1;
+ break;
+ case kPlayerBottom:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 13;
+ break;
case kPlayerRight:
- switch(_currentPlayerPosition) {
- case kPlayerTop:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 5;
- break;
- case kPlayerBottom:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 17;
- break;
- case kPlayerLeft:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 33;
- break;
- }
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 45;
+ break;
+ }
break;
+ case kPlayerRight:
+ switch (_currentPlayerPosition) {
+ case kPlayerTop:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 5;
+ break;
case kPlayerBottom:
- switch(_currentPlayerPosition) {
- case kPlayerTop:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 9;
- break;
- case kPlayerLeft:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 29;
- break;
- case kPlayerRight:
- _lastPlayerPosition = _currentPlayerPosition;
- _playerFrameIdx = 41;
- break;
- }
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 17;
+ break;
+ case kPlayerLeft:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 33;
+ break;
+ }
break;
+ case kPlayerBottom:
+ switch (_currentPlayerPosition) {
case kPlayerTop:
- switch(_currentPlayerPosition) {
- case kPlayerBottom:
- _playerFrameIdx = 21;
- break;
- case kPlayerLeft:
- _playerFrameIdx = 25;
- break;
- case kPlayerRight:
- _playerFrameIdx = 37;
- break;
- }
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 9;
+ break;
+ case kPlayerLeft:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 29;
+ break;
+ case kPlayerRight:
+ _lastPlayerPosition = _currentPlayerPosition;
+ _playerFrameIdx = 41;
+ break;
+ }
+ break;
+ case kPlayerTop:
+ switch (_currentPlayerPosition) {
+ case kPlayerBottom:
+ _playerFrameIdx = 21;
+ break;
+ case kPlayerLeft:
+ _playerFrameIdx = 25;
+ break;
+ case kPlayerRight:
+ _playerFrameIdx = 37;
+ break;
+ }
break;
}
_lastPlayerPosition = _currentPlayerPosition;
@@ -170,7 +169,7 @@ void SpiderEngine::drawPlayer() {
if (_playerFrameIdx >= (int)_playerFrames.size())
_playerFrameIdx = 0;
}
- } else
+ } else
error("Invalid arcade mode %s", _arcadeMode.c_str());
drawImage(*_playerFrames[_playerFrameIdx], ox, oy, true);
@@ -196,7 +195,7 @@ void SpiderEngine::drawHealth() {
_compositeSurface->fillRect(r, c);
r = Common::Rect(256, 152, 272, 174);
- c = 252; // blue
+ c = 252; // blue
_compositeSurface->frameRect(r, c);
drawString("ENERGY", 248, 180, 38, c);
@@ -218,7 +217,7 @@ bool SpiderEngine::checkArcadeLevelCompleted(MVideo &background) {
return false;
return true;
- }
+ }
return !background.decoder || background.decoder->endOfVideo();
}
More information about the Scummvm-git-logs
mailing list