1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef LASTEXPRESS_ACTION_H
#define LASTEXPRESS_ACTION_H
#include "lastexpress/shared.h"
#include "common/array.h"
#include "common/func.h"
#include "common/system.h"
namespace LastExpress {
#define DECLARE_ACTION(name) \
SceneIndex action_##name(const SceneHotspot &hotspot) const
#define ADD_ACTION(name) \
_actions.push_back(new Functor1MemConst<const SceneHotspot &, SceneIndex, Action>(this, &Action::action_##name));
#define IMPLEMENT_ACTION(name) \
SceneIndex Action::action_##name(const SceneHotspot &hotspot) const { \
debugC(6, kLastExpressDebugLogic, "Hotspot action: " #name "%s", hotspot.toString().c_str());
class LastExpressEngine;
class SceneHotspot;
class Action {
public:
Action(LastExpressEngine *engine);
~Action();
// Hotspot action
SceneIndex processHotspot(const SceneHotspot &hotspot);
// Cursor
CursorStyle getCursor(const SceneHotspot &hotspot) const;
// Animation
void playAnimation(EventIndex index, bool debugMode = false) const;
// Compartment action
bool handleOtherCompartment(ObjectIndex object, bool doPlaySound, bool doLoadScene) const;
private:
typedef Common::Functor1<const SceneHotspot &, SceneIndex> ActionFunctor;
LastExpressEngine *_engine;
Common::Array<ActionFunctor *> _actions;
// Each action is of the form action_<name>(SceneHotspot *hotspot)
// - a pointer to each action is added to the _actions array
// - processHotspot simply calls the proper function given by the hotspot->action value
//
// Note: even though there are 44 actions, only 41 are used in processHotspot
DECLARE_ACTION(inventory);
DECLARE_ACTION(savePoint);
DECLARE_ACTION(playSound);
DECLARE_ACTION(playMusic);
DECLARE_ACTION(knock);
DECLARE_ACTION(compartment);
DECLARE_ACTION(playSounds);
DECLARE_ACTION(playAnimation);
DECLARE_ACTION(openCloseObject);
DECLARE_ACTION(setModel);
DECLARE_ACTION(setItem);
DECLARE_ACTION(knockInside);
DECLARE_ACTION(pickItem);
DECLARE_ACTION(dropItem);
DECLARE_ACTION(enterCompartment);
DECLARE_ACTION(leanOutWindow);
DECLARE_ACTION(almostFall);
DECLARE_ACTION(climbInWindow);
DECLARE_ACTION(climbLadder);
DECLARE_ACTION(climbDownTrain);
DECLARE_ACTION(kronosSanctum);
DECLARE_ACTION(escapeBaggage);
DECLARE_ACTION(enterBaggage);
DECLARE_ACTION(bombPuzzle);
DECLARE_ACTION(27);
DECLARE_ACTION(kronosConcert);
DECLARE_ACTION(29);
DECLARE_ACTION(catchBeetle);
DECLARE_ACTION(exitCompartment);
DECLARE_ACTION(outsideTrain);
DECLARE_ACTION(firebirdPuzzle);
DECLARE_ACTION(openMatchBox);
DECLARE_ACTION(openBed);
DECLARE_ACTION(dialog);
DECLARE_ACTION(eggBox);
DECLARE_ACTION(39);
DECLARE_ACTION(bed);
DECLARE_ACTION(playMusicChapter);
DECLARE_ACTION(playMusicChapterSetupTrain);
DECLARE_ACTION(switchChapter);
DECLARE_ACTION(44);
// Special dummy function
DECLARE_ACTION(dummy);
// Helpers
void pickGreenJacket(bool process) const;
void pickScarf(bool process) const;
void pickCorpse(ObjectLocation bedPosition, bool process) const;
void dropCorpse(bool process) const;
void playCompartmentSoundEvents(ObjectIndex object) const;
};
} // End of namespace LastExpress
#endif // LASTEXPRESS_ACTION_H
|