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 ASYLUM_RESOURCES_SPECIAL_H
24 #define ASYLUM_RESOURCES_SPECIAL_H
25 
26 #include "common/scummsys.h"
27 #include "common/rect.h"
28 
29 #include "asylum/shared.h"
30 #include "asylum/asylum.h"
31 
32 namespace Asylum {
33 
34 class Object;
35 
36 class Special {
37 public:
38 
39 	Special(AsylumEngine *engine);
~Special()40 	~Special() {};
41 
42 	void run(Object* object, ActorIndex index);
43 
44 	void reset(bool resetPaletteTick2);
45 
46 private:
47 	AsylumEngine* _vm;
48 
49 	// Counters
50 	int32 _chapter5Counter;
51 
52 	bool _paletteFlag;
53 	uint32 _paletteTick1;
54 	uint32 _paletteTick2;
55 
56 	//////////////////////////////////////////////////////////////////////////
57 	// Spec functions
58 	//////////////////////////////////////////////////////////////////////////
59 	void chapter1(Object *object, ActorIndex actorIndex);
60 	void chapter2(Object *object, ActorIndex actorIndex);
61 	void chapter3(Object *object, ActorIndex actorIndex);
62 	void chapter4(Object *object, ActorIndex actorIndex);
63 	void chapter5(Object *object, ActorIndex actorIndex);
64 	void chapter6(Object *object, ActorIndex actorIndex);
65 	void chapter7(Object *object, ActorIndex actorIndex);
66 	void chapter8(Object *object, ActorIndex actorIndex);
67 	void chapter9(Object *object, ActorIndex actorIndex);
68 	void chapter11(Object *object, ActorIndex actorIndex);
69 	void chapter12(Object *object, ActorIndex actorIndex);
70 	void chapter13(Object *object, ActorIndex actorIndex);
71 
72 	//////////////////////////////////////////////////////////////////////////
73 	// Sound logic
74 	//////////////////////////////////////////////////////////////////////////
75 	void playChapterSound(Object *object, ActorIndex actorIndex);
76 	void playSoundChapter1(Object *object, ActorIndex actorIndex);
77 	void playSoundChapter2(Object *object, ActorIndex actorIndex);
78 	void playSoundChapter3(Object *object, ActorIndex actorIndex);
79 	void playSoundChapter4(Object *object, ActorIndex actorIndex);
80 	void playSoundChapter6(Object *object, ActorIndex actorIndex);
81 	void playSoundChapter7(Object *object, ActorIndex actorIndex);
82 	void playSoundChapter8(Object *object, ActorIndex actorIndex);
83 
84 	//////////////////////////////////////////////////////////////////////////
85 	// Misc
86 	//////////////////////////////////////////////////////////////////////////
87 	void setPaletteGamma(ResourceId palette1, ResourceId palette2);
88 
89 	void playSoundPanning(ResourceId resourceId, int32 attenuation, Object *object);
90 	void playSoundPanning(ResourceId resourceId, int32 attenuation, ActorIndex actorIndex);
91 
92 	void updateObjectFlag(ObjectId id);
93 	void checkFlags(ObjectId id, GameFlag flag1, GameFlag flag2, GameFlag flag3, GameFlag flag4, uint32 *val1, uint32*val2, GameFlag flag5, uint32 *val3);
94 
95 	//////////////////////////////////////////////////////////////////////////
96 	// Helpers
97 	//////////////////////////////////////////////////////////////////////////
98 	ResourceId getResourceId(Object *object, ActorIndex actorIndex);
99 	uint32 getCounter(ActorIndex index) const;
chance()100 	bool chance() { return _vm->getRandom(10000) < 30; }
101 
102 	void checkObject(Object *object, GameFlag flagToSet, GameFlag flagToClear, ObjectId objectId = kObjectNone);
103 	void checkOtherObject(Object *object, ObjectId otherObjectId, GameFlag flagToClear, GameFlag flagToSet);
104 
105 	//////////////////////////////////////////////////////////////////////////
106 	// Chapter 11 helpers
107 	//////////////////////////////////////////////////////////////////////////
108 
109 	void tentacle(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFlag flag3, const int16 (*rectPtr)[4]);
110 	void rock(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFlag flag3, GameFlag flag4, const int16 (*rectPtr)[4]);
111 };
112 
113 } // End of namespace Asylum
114 
115 #endif // ASYLUM_RESOURCES_SPECIAL_H
116