ScummVM API documentation
ambient.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 * Copyright 2020 Google
21 *
22 */
23#include "common/str.h"
24#include "common/rect.h"
25#include "common/noncopyable.h"
26
27#ifndef HADESCH_AMBIENT_H
28#define HADESCH_AMBIENT_H
29
30namespace Hadesch {
32public:
33 struct AmbientDesc {
34 Common::String _animName;
35 Common::String _soundName;
36 AmbientDesc(Common::String animName, Common::String soundName) {
37 _animName = animName;
38 _soundName = soundName;
39 }
40 };
41
42 enum PanType {
43 PAN_ANY,
44 PAN_LEFT,
45 PAN_RIGHT
46 };
47
48 enum AnimType {
49 DISAPPEAR,
50 KEEP_LOOP,
51 BACK_AND_FORTH
52 };
53
54 AmbientAnim(const Common::String &animName,
55 const Common::String &sound, int zValue,
56 int minint, int maxint, AnimType loop,
57 Common::Point offset, PanType pan);
58 AmbientAnim(const Common::Array<AmbientDesc> &descs, int zValue,
59 int minint, int maxint, AnimType loop,
60 Common::Point offset, PanType pan);
61 AmbientAnim();
62 void play(bool reschedule);
63 void schedule();
64 void start();
65 void pause();
66 void unpause();
67 void hide();
68 void unpauseAndFirstFrame();
69 void selectFirstFrame();
70 void playFinished(bool reschedule);
71 bool isReady();
72private:
73 class AmbiantAnimInternal : Common::NonCopyable {
74 public:
76 int _minInterval, _maxInterval;
77 int _zValue;
78 AnimType _loopType;
79 bool _isFwd;
80 Common::Point _offset;
81 bool _playing;
82 bool _paused;
83 PanType _pan;
84 };
85
86 bool isPanOK();
87
89};
90
91
93public:
94 void readTableFilePriamSFX(const TextTable &table);
95 void readTableFileSFX(const TextTable &table, AmbientAnim::PanType pan);
96 void tick();
97 void firstFrame();
98 void pause(const Common::String &name);
99 void unpause(const Common::String &name);
100 void unpauseAndFirstFrame(const Common::String &name);
101 void hide(const Common::String &name);
102 void play(const Common::String &name, bool reschedule);
103private:
104 struct AmbientAnimWeightedSetElement {
105 AmbientAnim anim;
106 int weight;
107 bool valid;
108 Common::String name;
109 };
111};
112
114public:
115 void playNext(const Common::String &name, const EventHandlerWrapper &event);
116 void playChosen(const Common::String &name, int counter, const EventHandlerWrapper &event);
117 void setTable(const TextTable table) {
118 _table = table;
119 }
120 void readTable(Common::SharedPtr<Hadesch::VideoRoom> room,
121 const Common::String &name,
122 const TranscribedSound *transcriptionTable);
123
124private:
125 TextTable _table;
128};
129
130
131}
132#endif
Definition: array.h:52
Definition: noncopyable.h:39
Definition: str.h:59
Definition: ambient.h:31
Definition: ambient.h:92
Definition: ambient.h:113
Definition: event.h:34
Definition: table.h:43
Definition: rect.h:144
Definition: ambient.h:33
Definition: video.h:146