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 //=============================================================================
24 //
25 // Runtime room object definition.
26 //
27 //=============================================================================
28 
29 #ifndef AGS_ENGINE_AC_ROOM_OBJECT_H
30 #define AGS_ENGINE_AC_ROOM_OBJECT_H
31 
32 #include "ags/shared/core/types.h"
33 #include "ags/shared/ac/common_defines.h"
34 
35 namespace AGS3 {
36 
37 namespace AGS {
38 namespace Shared {
39 class Stream;
40 } // namespace Shared
41 } // namespace AGS
42 
43 using namespace AGS; // FIXME later
44 
45 // IMPORTANT: exposed to plugin API as AGSObject!
46 // keep that in mind if extending this struct, and dont change existing fields
47 // unless you plan on adjusting plugin API as well.
48 struct RoomObject {
49 	int   x, y;
50 	int   transparent;    // current transparency setting
51 	short tint_r, tint_g;   // specific object tint
52 	short tint_b, tint_level;
53 	short tint_light;
54 	short zoom;           // zoom level, either manual or from the current area
55 	short last_width, last_height;   // width/height last time drawn
56 	uint16_t num;            // sprite slot number
57 	short baseline;       // <=0 to use Y co-ordinate; >0 for specific baseline
58 	uint16_t view, loop, frame; // only used to track animation - 'num' holds the current sprite
59 	short wait, moving;
60 	int8  cycling;        // is it currently animating?
61 	int8  overall_speed;
62 	int8  on;
63 	int8  flags;
64 	short blocking_width, blocking_height;
65 
66 	RoomObject();
67 
68 	int get_width();
69 	int get_height();
70 	int get_baseline();
71 
has_explicit_lightRoomObject72 	inline bool has_explicit_light() const {
73 		return (flags & OBJF_HASLIGHT) != 0;
74 	}
has_explicit_tintRoomObject75 	inline bool has_explicit_tint()  const {
76 		return (flags & OBJF_HASTINT) != 0;
77 	}
78 
79 	void UpdateCyclingView(int ref_id);
80 	void update_cycle_view_forwards();
81 	void update_cycle_view_backwards();
82 
83 	void ReadFromFile(Shared::Stream *in);
84 	void WriteToFile(Shared::Stream *out) const;
85 };
86 
87 } // namespace AGS3
88 
89 #endif
90