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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NEVERHOOD_DISKPLAYERSCENE_H
24 #define NEVERHOOD_DISKPLAYERSCENE_H
25 
26 #include "neverhood/neverhood.h"
27 #include "neverhood/resourceman.h"
28 #include "neverhood/scene.h"
29 
30 namespace Neverhood {
31 
32 class DiskplayerScene;
33 class SmackerPlayer;
34 
35 class AsDiskplayerSceneKey : public AnimatedSprite {
36 public:
37 	AsDiskplayerSceneKey(NeverhoodEngine *vm);
38 	void stDropKey();
39 protected:
40 	uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
41 	void stDropKeyDone();
42 };
43 
44 class DiskplayerPlayButton : public StaticSprite {
45 public:
46 	DiskplayerPlayButton(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene);
47 	void press();
48 	void release();
49 protected:
50 	DiskplayerScene *_diskplayerScene;
51 	bool _isPlaying;
52 	uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
53 };
54 
55 class DiskplayerSlot : public Entity {
56 public:
57 	DiskplayerSlot(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene, int slotIndex, bool isAvailable);
58 	void activate();
59 	void stop();
60 	void appear();
61 	void play();
setLocked(bool isLocked)62 	void setLocked(bool isLocked) { _isLocked = isLocked; }
63 protected:
64 	DiskplayerScene *_diskplayerScene;
65 	Sprite *_inactiveSlot;
66 	Sprite *_appearSlot;
67 	Sprite *_activeSlot;
68 	int _initialBlinkCountdown;
69 	int _blinkCountdown;
70 	bool _isLocked;
71 	bool _isBlinking;
72 	void update();
73 };
74 
75 enum {
76 	kUSStopped		= 0,
77 	kUSTuningIn		= 1,
78 	kUSPlaying		= 2,
79 	kUSPlayingFinal	= 3
80 };
81 
82 class DiskplayerScene : public Scene {
83 public:
84 	DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int paletteIndex);
getDropKey()85 	bool getDropKey() const { return _dropKey; }
86 protected:
87 	SmackerPlayer *_diskSmackerPlayer;
88 	DiskplayerPlayButton *_ssPlayButton;
89 	AsDiskplayerSceneKey *_asKey;
90 	DiskplayerSlot *_diskSlots[20];
91 	DiskplayerSlot *_finalDiskSlot;
92 	int _updateStatus;
93 	bool _diskAvailable[20];
94 	int _diskIndex;
95 	int _appearCountdown;
96 	int _tuneInCountdown;
97 	bool _hasAllDisks;
98 	bool _inputDisabled;
99 	bool _dropKey;
100 	void update();
101 	uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
102 	void openSmacker(uint32 fileHash, bool keepLastFrame);
103 	void stop();
104 	void tuneIn();
105 	void playDisk();
106 	void playStatic();
107 };
108 
109 } // End of namespace Neverhood
110 
111 #endif /* NEVERHOOD_DISKPLAYERSCENE_H */
112