mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 19:16:21 +00:00
HYPNO: replaced typeid code with enumarated type
This commit is contained in:
parent
3e8117ba9d
commit
00d7a05c94
@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <typeinfo>
|
||||
#include "common/events.h"
|
||||
|
||||
#include "hypno/grammar.h"
|
||||
@ -36,14 +35,23 @@ void HypnoEngine::runMenu(Hotspots hs) {
|
||||
debugC(1, kHypnoDebugScene, "hotspot actions size: %d", h.actions.size());
|
||||
for (Actions::const_iterator itt = h.actions.begin(); itt != h.actions.end(); ++itt) {
|
||||
Action *action = *itt;
|
||||
if (typeid(*action) == typeid(Quit))
|
||||
runQuit((Quit *)action);
|
||||
else if (typeid(*action) == typeid(Background))
|
||||
runBackground((Background *)action);
|
||||
else if (typeid(*action) == typeid(Overlay))
|
||||
runOverlay((Overlay *)action);
|
||||
else if (typeid(*action) == typeid(Ambient))
|
||||
runAmbient((Ambient *)action);
|
||||
switch (action->type) {
|
||||
case QuitAction:
|
||||
runQuit((Quit *)action);
|
||||
break;
|
||||
case BackgroundAction:
|
||||
runBackground((Background *)action);
|
||||
break;
|
||||
case OverlayAction:
|
||||
runOverlay((Overlay *)action);
|
||||
break;
|
||||
case AmbientAction:
|
||||
runAmbient((Ambient *)action);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//else if (typeid(*action) == typeid(Mice))
|
||||
// runMice(h, (Mice*) action);
|
||||
|
@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <typeinfo>
|
||||
#include "common/events.h"
|
||||
|
||||
#include "hypno/grammar.h"
|
||||
@ -129,24 +128,45 @@ void HypnoEngine::clickedHotspot(Common::Point mousePos) {
|
||||
|
||||
for (Actions::const_iterator itt = selected.actions.begin(); itt != selected.actions.end(); ++itt) {
|
||||
Action *action = *itt;
|
||||
if (typeid(*action) == typeid(ChangeLevel))
|
||||
runChangeLevel((ChangeLevel *)action);
|
||||
if (typeid(*action) == typeid(Escape))
|
||||
runEscape((Escape *)action);
|
||||
else if (typeid(*action) == typeid(Cutscene))
|
||||
runCutscene((Cutscene *)action);
|
||||
else if (typeid(*action) == typeid(Play))
|
||||
runPlay((Play *)action);
|
||||
else if (typeid(*action) == typeid(WalN))
|
||||
runWalN((WalN *)action);
|
||||
else if (typeid(*action) == typeid(Global))
|
||||
runGlobal((Global *)action);
|
||||
else if (typeid(*action) == typeid(Talk))
|
||||
runTalk((Talk *)action);
|
||||
else if (typeid(*action) == typeid(Quit))
|
||||
runQuit((Quit *)action);
|
||||
else if (typeid(*action) == typeid(Palette))
|
||||
debugC(1, kHypnoDebugScene, "runPalette unimplemented");
|
||||
switch (action->type) {
|
||||
case ChangeLevelAction:
|
||||
runChangeLevel((ChangeLevel *)action);
|
||||
break;
|
||||
|
||||
case EscapeAction:
|
||||
runEscape((Escape *)action);
|
||||
break;
|
||||
|
||||
case CutsceneAction:
|
||||
runCutscene((Cutscene *)action);
|
||||
break;
|
||||
|
||||
case PlayAction:
|
||||
runPlay((Play *)action);
|
||||
break;
|
||||
|
||||
case WalNAction:
|
||||
runWalN((WalN *)action);
|
||||
break;
|
||||
|
||||
case GlobalAction:
|
||||
runGlobal((Global *)action);
|
||||
break;
|
||||
|
||||
case TalkAction:
|
||||
runTalk((Talk *)action);
|
||||
break;
|
||||
|
||||
case QuitAction:
|
||||
runQuit((Quit *)action);
|
||||
break;
|
||||
case PaletteAction:
|
||||
debugC(1, kHypnoDebugScene, "runPalette unimplemented");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,8 +192,13 @@ bool HypnoEngine::hoverHotspot(Common::Point mousePos) {
|
||||
if (found) {
|
||||
for (Actions::const_iterator itt = selected.actions.begin(); itt != selected.actions.end(); ++itt) {
|
||||
Action *action = *itt;
|
||||
if (typeid(*action) == typeid(Mice))
|
||||
runMice((Mice *)action);
|
||||
switch (action->type) {
|
||||
case MiceAction:
|
||||
runMice((Mice *)action);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user