ScummVM API documentation
path.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 MEDIASTATION_PATH_H
23#define MEDIASTATION_PATH_H
24
25#include "mediastation/actor.h"
26#include "mediastation/mediascript/scriptvalue.h"
27#include "mediastation/mediascript/scriptconstants.h"
28
29namespace MediaStation {
30
31enum PathPlayState {
32 kPathStopped = 1,
33 kPathPlaying = 2,
34 kPathPaused = 3,
35};
36
37class PathActor : public Actor {
38public:
39 PathActor() : Actor(kActorTypePath) {};
40
41 virtual void readParameter(Chunk &chunk, ActorHeaderSectionType paramType) override;
42 virtual ScriptValue callMethod(BuiltInMethod methodId, Common::Array<ScriptValue> &args) override;
43
44 virtual void onEvent(const ActorEvent &event) override;
45 virtual void timerEvent(const TimerEvent &event) override;
46
47private:
48 PathPlayState _playState = kPathStopped;
49 bool _useTimeForCompletion = false;
50 double _duration = 0.0;
51 double _stepRate = 0.0;
52 uint _stepDurationInMilliseconds = 0;
53 uint _currentStep = 0;
54 uint _pauseTime = 0;
55 uint _totalSteps = 0;
56 uint _nextPathStepTime = 0;
57
58 Common::Point _startPoint;
59 Common::Point _endPoint;
60 Common::Point _currentPoint;
61
62 void startPath();
63 void stopPath();
64 void pausePath();
65 void resumePath(bool shouldRestart);
66
67 double getPercentComplete();
68 bool step();
69 void scheduleNextTimerEvent();
70};
71
72} // End of namespace MediaStation
73
74#endif
Definition: actor.h:226
Definition: datafile.h:99
Definition: path.h:37
Definition: scriptvalue.h:35
Definition: rect.h:144
Definition: events.h:103
Definition: events.h:94