2 * common_object_stage.h
4 * Created on: 25 avr. 2009
8 #ifndef COMMON_OBJECT_STAGE_H_
9 #define COMMON_OBJECT_STAGE_H_
11 #include "common__ob_object.h"
14 /*\internal*********************************************
15 ******** OBJECT RELATED TO Stages FILES
16 ******************************************************/
17 class ob_stage_object
;
19 //////////////////////////////////////////
22 * The object which hold the datas about a stage of a game
24 // Possibles stage direction
27 STAGE_UNDEF_DIRECTION
,
36 class ob_stage
: public ob_object_container
39 static ob_object
* Guess_and_ConstructNewObject(MyLine
* line
, const int num_line
);
40 static ob_object
* Guess_and_ConstructNewObject(const wxString
& _name
, const wxString
& token0
);
42 static bool IsHeaderTag( const wxString
& name
);
43 static bool Is_Stage_At_Type( ob_object
* _obj
);
44 static bool Is_Stage_Spawn_Type( ob_object
* _obj
);
48 virtual void pClone(ob_object
*& res
);
51 int Direction_ComputeAndCache();
54 wxSize
GetDefScrollzBounds(ob_object
* st_declar
);
55 ob_stage_panel
** Get_Panels( size_t& nb_panels
);
56 wxString
Get_Panels_Order();
58 std::list
<ob_stage_object
*>*
59 Get_SubObj_With_StageType( const int stage_object_type
);
61 virtual bool Add_SubObj( ob_object
* temp
);
62 virtual bool Add_SubObj( ob_object
* temp
, bool b_sort_at
);
64 bool Set_Tag(const wxString
& _tag
, const wxString
& _token
);
65 bool Set_Tag(const wxString
& _tag
, wxArrayString _tokens
);
68 ob_object
* Get_LastHeaderObj();
69 ob_object
* Get_First_AT_Obj();
72 bool Add_SubObj_AT( ob_object
* _obj
, bool b_after
= true );
73 bool Insert_SubObj_AT( ob_object
* _obj
);
74 bool Add_SubObj_WallHole( ob_object
* _obj
, bool b_after
= true );
75 bool Add_SubObj_Panel( ob_object
* _obj
, bool b_after
= true );
76 bool Add_SubObj_FrontLayer( ob_object
* _obj
, bool b_after
= true );
77 bool Add_SubObj_BGs( ob_object
* _obj
, bool b_after
= true );
78 bool Add_SubObj_Header( ob_object
* _obj
, bool b_after
= true );
83 * A background layer of the stage
86 class ob_BG_Layer
: public ob_object
, Image_Holder
89 ob_BG_Layer( MyLine
* line
= NULL
, const int num_line
= -1 );
90 ob_BG_Layer( const wxString
& _name
, wxArrayString
& _tokens
);
91 virtual void pClone(ob_object
*& res
);
92 virtual ~ob_BG_Layer();
93 virtual void Validate();
94 bool Update_With( ob_BG_Layer
* oLay
);
96 virtual void SetToDefault();
98 int Get_RepeatingVal(int direction
);
101 virtual wxFileName
GetFileName();
107 * A front panel of the stage
110 class ob_front_panel
: public ob_object
, Image_Holder
113 ob_front_panel( MyLine
* line
= NULL
, const int num_line
= -1 );
114 ob_front_panel( const wxString
& _name
, wxArrayString
& _tokens
);
115 virtual void pClone(ob_object
*& res
);
116 virtual ~ob_front_panel();
117 virtual void Validate();
118 bool Update_With( ob_front_panel
* oPan
);
121 virtual wxFileName
GetFileName();
126 * A panel of the stage
129 class ob_stage_panel
: public ob_object
, public Image_Holder
132 ob_stage_panel( MyLine
* line
= NULL
, const int num_line
= -1 );
133 ob_stage_panel(const wxString
& _name
, wxArrayString
& _tokens
);
134 virtual void pClone(ob_object
*& res
);
135 virtual ~ob_stage_panel();
136 virtual void Validate();
141 virtual wxFileName
GetFileName();
146 /**---------------------------------------------------------------------
147 *---------------------------------------------------------------
148 *---------------------------------------------------------------
149 *---------------------------------------------------------------
150 *---------------------------------------------------------------
151 * An object holded by a stage object
155 STAGETYPE_NONE
= 1000,
156 SOBJ_PLAYER_SPAWN
= 1002, // Other
157 SOBJ_WALL
= 1004, // Geometry
158 SOBJ_HOLE
= 1006, // Geometry
161 class ob_stage_object
: public ob_object
164 static int Get_StageObjectType( const wxString
& );
167 ob_stage_object( MyLine
* line
= NULL
, const int num_line
= -1 );
168 ob_stage_object( const wxString
& _name
, wxArrayString
& _tokens
);
169 virtual void pClone(ob_object
*& res
);
171 virtual ~ob_stage_object();
172 virtual void Validate();
174 virtual wxString
ToStr();
175 virtual wxString
Get_ScreenList_Name(){return name
;};
179 virtual bool Get_Coords(int& x
, int& y
);
180 wxString
CoordsToStr(); // used for object which use coords for screen name
182 virtual void Coords_Decal( const wxSize
& _decal
);
183 virtual void Init_and_Center( wxSize
& _decal
);
187 /**---------------------------------------------------------------------
191 class ob_wall
: public ob_stage_object
194 ob_wall( MyLine
* line
= NULL
, const int num_line
= -1 );
195 ob_wall(const wxString
& _name
, wxArrayString
& _tokens
);
196 virtual void pClone(ob_object
*& res
);
199 virtual void Validate();
201 virtual bool Get_Coords(int& x
, int& y
);
203 virtual void Coords_Decal( const wxSize
& _decal
);
204 virtual void Init_and_Center( wxSize
& _decal
);
208 /**---------------------------------------------------------------------
212 class ob_hole
: public ob_stage_object
215 ob_hole( MyLine
* line
= NULL
, const int num_line
= -1 );
216 ob_hole( const wxString
& _name
, wxArrayString
& _tokens
);
217 virtual void pClone(ob_object
*& res
);
220 virtual void Validate();
222 virtual bool Get_Coords(int& x
, int& y
);
224 virtual void Coords_Decal( const wxSize
& _decal
);
225 virtual void Init_and_Center( wxSize
& _decal
);
229 /**---------------------------------------------------------------------
230 * An player spawn location which contain X Y Z and no AT tag
233 class ob_player_spawn
: public ob_stage_object
236 static int Get_StageObjectType( const wxString
&);
239 ob_player_spawn( MyLine
* line
= NULL
, const int num_line
= -1 );
240 ob_player_spawn( const wxString
& _name
, wxArrayString
& _tokens
);
241 virtual void pClone(ob_object
*& res
);
243 virtual ~ob_player_spawn();
244 virtual void Validate();
246 virtual bool Get_Coords(int& x
, int& y
);
248 virtual void Coords_Decal( const wxSize
& _decal
);
249 virtual void Init_and_Center( wxSize
& _decal
);
253 /**----------------------------------------------------------------------
254 * An object that hold a <AT> tag
259 SOBJ_WAIT
= 1026, // Control
260 SOBJ_NOJOIN
= 1028, // Control
261 SOBJ_CANJOIN
= 1030, // Control
262 SOBJ_SHADOWCOLOR
= 1018, // Visual Effect
263 SOBJ_SHADOWALPHA
= 1020, // Visual Effect
264 SOBJ_LIGHT
= 1014, // Visual Effect
265 SOBJ_SCROLLZ
= 1010, // Geometry
266 SOBJ_BLOCKADE
= 1024, // Control
267 SOBJ_SETPALETTE
= 1022, // Other
268 SOBJ_GROUP
= 1012, // Control
271 class ob_stage_at
: public ob_stage_object
274 static int Get_StageObjectType( const wxString
& );
277 ob_stage_at( MyLine
* line
= NULL
, const int num_line
= -1 );
278 ob_stage_at( const wxString
& _name
, wxArrayString
& _tokens
);
279 virtual void pClone(ob_object
*& res
);
281 virtual ~ob_stage_at();
283 virtual bool Eat( MyLine
* line
, const int num_line
);
284 virtual void Validate();
286 virtual bool Get_Coords(int& x
, int& y
);
289 void SetAt(int _here
);
290 virtual void Coords_Decal( const wxSize
& _decal
);
291 virtual void Init_and_Center( wxSize
& _decal
);
293 // Replace this object at his right position in the AT list of the stage
296 virtual bool Add_SubObj( ob_object
* temp
);
301 /**----------------------------------------------------------------------
302 * Class for spawned objects
303 * This objects must have <coords> and <at>, alos have an <entity> object associated
308 SOBJ_NONE
= 1100, // Decoration
309 SOBJ_STEAMER
= 1102, // Decoration
310 SOBJ_PANEL
= 1104, // Decoration
311 SOBJ_TEXT
= 1106, // Other
312 SOBJ_TRAP
= 1108, // Stuffs
313 SOBJ_SHOT
= 1110, // Stuffs
317 class ob_spawn
: public ob_stage_at
320 static int Get_StageObjectType( const wxString
& _name
, const wxString
& entity_name
);
321 static int Get_Entity_StageType( const wxString
& ent_name
);
324 ob_spawn( MyLine
* line
= NULL
, const int num_line
= -1 );
325 ob_spawn(const wxString
& _name
, wxArrayString
& _tokens
);
326 virtual void pClone(ob_object
*& res
);
329 virtual bool Eat( MyLine
* line
, const int num_line
);
330 virtual bool Is_AcceptedTag(const wxString
& _name
);
331 virtual void Validate();
333 obFileEntity
* entity_ref
;
335 virtual wxString
Get_ScreenList_Name();
336 virtual bool Get_Coords(int& x
, int& y
);
338 virtual void Coords_Decal( const wxSize
& _decal
);
339 virtual void Init_and_Center( wxSize
& _decal
);
343 /**-----------------------------------------------------------------
349 SOBJ_OBSTACLE
= 1200, // Stuffs
350 SOBJ_NPC
= 1202, // Livings
351 SOBJ_ENEMY
= 1204, // Livings
354 class ob_spawn_healthy
: public ob_spawn
357 static int Get_StageObjectType( const wxString
& _name
, const wxString
& entity_name
);
358 static bool IsItemHoldedTag( const wxString
& _tag
);
361 ob_spawn_healthy( MyLine
* line
= NULL
, const int num_line
= -1 );
362 ob_spawn_healthy(const wxString
& _name
, wxArrayString
& _tokens
);
363 virtual void pClone(ob_object
*& res
);
364 virtual ~ob_spawn_healthy();
366 virtual void Validate();
367 virtual bool Is_AcceptedTag(const wxString
& _name
);
371 /**-----------------------------------------------------------------
372 * An item spawned (not dropped)
377 SOBJ_ITEM
= 1300, // item
378 SOBJ_ENDLEVEL
= 1302, // end level item
381 class ob_spawn_item
: public ob_spawn
384 static int Get_StageObjectType( const wxString
& _name
, const wxString
& entity_name
);
387 ob_spawn_item( MyLine
* line
= NULL
, const int num_line
= -1 );
388 ob_spawn_item(const wxString
& _name
, wxArrayString
& _tokens
);
389 virtual void pClone(ob_object
*& res
);
390 virtual ~ob_spawn_item();
392 virtual bool Is_AcceptedTag(const wxString
& _name
);
393 virtual void Validate();
397 /**-----------------------------------------------------------------
398 * Stage Super Types enum for sorting types
411 SST_MAX
= 7, // Used for fillings Lists
414 int Stage__SuperType_ToInt( const wxString
& _sst
);
415 wxString
Stage__SuperType_ToStr( const int _sst
);
416 const int* Stage__SuperType_Get_Type_Array( const int _sst
, size_t& arr_size
);
418 int Stage__Type_ToInt( const wxString
& _sst
);
419 wxString
Stage__Type_ToStr( const int _sst
);
420 int Stage__Type__Get_SuperType( const int _sobj_type
);
421 bool Stage__Type_Is_in_SuperType( const int _sobj_type
, const int _sst
);
423 #endif /* COMMON_OBJECT_STAGE_H_ */