ScummVM API documentation
scene_imp.h
1/* ScummVM - Graphic Adventure Engine
2*
3* ScummVM is the legal property of its developers, whose names
4* are too numerous to list here. Please refer to the COPYRIGHT
5* file distributed with this source distribution.
6*
7* This program is free software: you can redistribute it and/or modify
8* it under the terms of the GNU General Public License as published by
9* the Free Software Foundation, either version 3 of the License, or
10* (at your option) any later version.
11*
12* This program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with this program. If not, see <http://www.gnu.org/licenses/>.
19*
20*/
21
22#ifndef SNATCHER_SCENE_IMP_H
23#define SNATCHER_SCENE_IMP_H
24
25namespace Snatcher {
26
27#define SH_HEAD_BEGIN(id) \
28 class Scene_##id : public SceneHandler { \
29 public: \
30 Scene_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio); \
31 ~Scene_##id() override; \
32 void operator()(GameState &state) override; \
33 private: \
34 typedef Common::Functor1Mem<GameState&, void, Scene_##id> FrameProc; \
35 typedef void(Scene_##id::*FrameProcTblEntry)(GameState&); \
36 Common::Array<FrameProc*> _frameProcs; \
37 static const FrameProcTblEntry frameProcTable[];
38
39#define SH_HEAD_END(id) }; \
40 SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
41#define SH_IMP_FRMTBL(id) \
42 const Scene_##id::FrameProcTblEntry Scene_##id::frameProcTable[] =
43#define SH_FRM(id, no) \
44 &Scene_##id::frameUpdate##no
45#define SH_IMP_CTOR(id) \
46 Scene_##id::Scene_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) : SceneHandler(vm, scn, fio)
47#define SH_CTOR_MAKEPROCS(id) \
48 for (uint i = 0; i < ARRAYSIZE(frameProcTable); ++i) \
49 _frameProcs.push_back(new FrameProc(this, frameProcTable[i]));
50#define SH_IMP_DTOR(id) \
51 Scene_##id::~Scene_##id()
52#define SH_DTOR_DELPROCS(id) \
53 for (uint i = 0; i < _frameProcs.size(); ++i) \
54 delete _frameProcs[i];
55#define SH_IMPL_UPDT(id) \
56 void Scene_##id::operator()(GameState &state)
57#define SH_DCL_FRM(no) \
58 void frameUpdate##no(GameState &state);
59#define SH_IMPL_FRM(id, no) \
60 void Scene_##id::frameUpdate##no(GameState &state)
61} // End of namespace Snatcher
62
63#endif // SNATCHER_SCENE_IMP_H