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_WORLDSTATS_H
24 #define ASYLUM_RESOURCES_WORLDSTATS_H
25 
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/serializer.h"
29 
30 #include "asylum/system/sound.h"
31 
32 namespace Asylum {
33 
34 #define ACTORS_MAX_COUNT   50
35 #define OBJECTS_MAX_COUNT 400
36 #define ACTIONS_MAX_COUNT 400
37 
38 #define ACTORS_SIZE       2468
39 #define ACTORDATA_SIZE    1448
40 #define OBJECTS_SIZE      1704
41 #define ACTIONS_SIZE      180
42 
43 class Actor;
44 class Object;
45 class AsylumEngine;
46 
47 struct ActionArea;
48 
49 enum CursorResourceType {
50 	kCursorResourceScrollUp = 0,
51 	kCursorResourceScrollUpLeft,
52 	kCursorResourceScrollLeft,
53 	kCursorResourceScrollDownLeft,
54 	kCursorResourceScrollDown,
55 	kCursorResourceScrollDownRight,
56 	kCursorResourceScrollRight,
57 	kCursorResourceScrollUpRight,
58 	kCursorResourceHand,
59 	kCursorResourceMagnifyingGlass,
60 	kCursorResourceTalkNPC,
61 	kCursorResourceGrabPointer,
62 	kCursorResourceTalkNPC2
63 };
64 
65 class WorldStats : public Common::Serializable {
66 public:
67 	WorldStats(AsylumEngine *engine);
68 	virtual ~WorldStats();
69 
70 	/**
71 	 * Loads the data
72 	 *
73 	 * @param stream If non-null, the Common::SeekableReadStream * to load from
74 	 */
75 	void load(Common::SeekableReadStream *stream);
76 
77 	int32 size;
78 	int32 numEntries;
79 	ChapterIndex chapter;
80 	int16 xLeft; // scene start x position
81 	int16 yTop;  // scene start y position
82 	Common::Rect boundingRect;
83 	ResourceId backgroundImage;
84 	ResourceId cursorResources[13];
85 	ResourceId font1;
86 	ResourceId font2;
87 	ResourceId font3;
88 	ResourceId currentPaletteId;
89 	int32 cellShadeMask1;
90 	int32 cellShadeMask2;
91 	int32 cellShadeMask3;
92 	int32 unused;
93 	int32 smallCurUp;
94 	int32 smallCurDown;
95 	ResourceId encounterFrameBg;
96 	int16 width;
97 	int16 height;
98 	int32 motionStatus;
99 	int32 field_8C;
100 	//uint32 numActions;
101 	//uint32 numObjects;
102 	int16 coordinates[7];
103 	//uint32 numActors;
104 	int32 reverseStereo;
105 	Common::Rect sceneRects[6]; // including scene size rect
106 	uint8 sceneRectIdx;
107 	uint8 field_11D[3];
108 	int32 field_120;
109 	int32 scriptIndex;	 // actionList start index
110 	ResourceId graphicResourceIds[100];
111 	ResourceId sceneTitleGraphicResourceId;
112 	ResourceId sceneTitlePaletteResourceId;
113 	int32 actorType;
114 	ResourceId soundResourceIds[50];
115 	AmbientSoundItem ambientSounds[15];
116 	uint32 numAmbientSounds;
117 	int32 musicStatus;
118 	int32 musicCurrentResourceIndex;
119 	int32 musicFlag;
120 	int32 musicResourceIndex;
121 	int32 musicStatusExt;
122 	Common::Array<Object*>     objects;   // maxsize 400
123 	Common::Array<Actor*>      actors;   // maxsize 50
124 	// ActorData is stored in each actor instance
125 	uint32 numScripts;
126 	uint32 numPolygons;
127 	ResourceId inventoryIconsActive[16];
128 	ResourceId inventoryIconsNormal[16];
129 	ResourceId inventoryCursorsNormal[16];
130 	ResourceId inventoryCursorsBlinking[16];
131 	Common::Array<ActionArea*> actions;  // maxsize 400
132 	int32 field_E848C;
133 	int32 field_E8490;
134 	int32 field_E8494;
135 	int32 field_E8498;
136 	int32 field_E849C; // ActorIndex???
137 	int32 tickValueArray[30];
138 	int32 field_E8518;
139 	int32 field_E851C[30];
140 	int32 field_E8594[30];
141 	ActorIndex nextPlayer;
142 	uint32 field_E8610[6];
143 	uint32 field_E8628[6];
144 	Object *wheels[7];
145 	uint32 tickCount1;
146 	uint32 field_E8660[6];
147 	int32 dword_4563A0;
148 
149 	void setWheelObjects();
150 
151 	int32 getActionAreaIndexById(int32 id);
152 	int32 getRandomActionAreaIndexById(int32 id);
153 	ActionArea* getActionAreaById(int32 id);
154 
155 	Object* getObjectById(ObjectId id);
156 
157 	Common::String toString();
158 
159 	// Serializable
160 	void saveLoadWithSerializer(Common::Serializer &s);
161 
162 private:
163 	AsylumEngine *_vm;
164 };
165 
166 } // end of namespace Asylum
167 
168 #endif // ASYLUM_RESOURCES_WORLDSTATS_H
169