ScummVM API documentation
GameMusicHandler.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/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of Penumbra Overture.
26 */
27
28#ifndef GAME_GAME_MUSIC_HANDLER_H
29#define GAME_GAME_MUSIC_HANDLER_H
30
31#include "hpl1/engine/engine.h"
32
33#include "hpl1/penumbra-overture/GameTypes.h"
34
35using namespace hpl;
36
37class cInit;
38class cMapHandler;
40class iGameEnemy;
41
42//----------------------------------------
43
45 friend class cGameMusicHandler;
46
47public:
48 cGameMusic();
49
50 void Reset();
51
52private:
53 tString msFile;
54
55 bool mbLoop;
56 float mfVolume;
57};
58
59//----------------------------------------
60
62typedef tAttackerSet::iterator tAttackerSetIt;
63
65public:
66 cGameMusicHandler(cInit *apInit);
68
69 void OnStart();
70 void Update(float afTimeStep);
71 void Reset();
72
73 void OnWorldLoad();
74 void OnWorldExit();
75
76 void LoadFromGlobal(cGameMusicHandler_GlobalSave *apSave);
77 void SaveToGlobal(cGameMusicHandler_GlobalSave *apSave);
78
79 void Play(const tString &asFile, bool abLoop, float afVolume, float afFade, int alPrio);
80 void Stop(float afFade, int alPrio);
81
82 void AddAttacker(iGameEnemy *apEntity);
83 void RemoveAttacker(iGameEnemy *apEntity);
84 bool AttackerExist(iGameEnemy *apEntity);
85
86private:
87 void PlayHighestPriority();
88
89 cInit *mpInit;
90 cMusicHandler *mpMusicHandler;
91
92 Common::Array<cGameMusic> mvGameMusic;
93 int mlMaxPrio;
94
95 int mlCurrentMaxPrio;
96
97 tAttackerSet m_setAttackers;
98
99 bool mbAttackPlaying;
100 float mfAttackPlayCount;
101 float mfAttackStopCount;
102
103 bool mbEnemyClosePlaying;
104 float mfEnemyCloseCount;
105 float mfEnemyGoneCount;
106};
107
108#endif // GAME_GAME_MUSIC_HANDLER_H
Definition: str.h:59
Definition: SaveHandler.h:58
Definition: GameMusicHandler.h:64
Definition: GameMusicHandler.h:44
Definition: Init.h:70
Definition: MapHandler.h:155
Definition: MusicHandler.h:78
Definition: Updateable.h:35
Definition: GameEnemy.h:189