1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef G1_MISCOBJS_HH
|
---|
10 | #define G1_MISCOBJS_HH
|
---|
11 |
|
---|
12 | #include "g1_object.hh"
|
---|
13 | #include "lisp/li_types.hh"
|
---|
14 | #include "objs/structure_death.hh"
|
---|
15 |
|
---|
16 | g1_object_type g1_create_deco_object(char *name);
|
---|
17 |
|
---|
18 | class g1_deco_definition_class;
|
---|
19 |
|
---|
20 | class g1_deco_type_manager_class : public i4_init_class
|
---|
21 | {
|
---|
22 | i4_array<g1_deco_definition_class *> deco_objs;
|
---|
23 | public:
|
---|
24 | g1_deco_type_manager_class() : deco_objs(0,32) {}
|
---|
25 | void uninit();
|
---|
26 |
|
---|
27 | const char *find_name(const char *name);
|
---|
28 | void add_type(g1_deco_definition_class *def)
|
---|
29 | {
|
---|
30 | int i;
|
---|
31 | for (i=0; i<deco_objs.size() && deco_objs[i]; i++) ;
|
---|
32 |
|
---|
33 | if (i==deco_objs.size())
|
---|
34 | deco_objs.add(def);
|
---|
35 | else
|
---|
36 | deco_objs[i] = def;
|
---|
37 | }
|
---|
38 |
|
---|
39 | void remove_type(g1_deco_definition_class *def)
|
---|
40 | {
|
---|
41 | for (int i=0; i<deco_objs.size(); i++)
|
---|
42 | if (deco_objs[i]==def)
|
---|
43 | deco_objs[i]=0;
|
---|
44 | }
|
---|
45 | };
|
---|
46 |
|
---|
47 | extern g1_deco_type_manager_class g1_deco_type_manager;
|
---|
48 |
|
---|
49 | class g1_deco_object_class : public g1_object_class
|
---|
50 | {
|
---|
51 | protected:
|
---|
52 | g1_structure_death_class death;
|
---|
53 | public:
|
---|
54 | sw16 health; // the health its got left
|
---|
55 | w8 collision_type;
|
---|
56 |
|
---|
57 | enum { DATA_VERSION=2 };
|
---|
58 | const char *model_name;
|
---|
59 |
|
---|
60 | static g1_deco_object_class *cast(g1_object_class *o)
|
---|
61 | {
|
---|
62 | if (o->get_type()->get_flag(g1_object_definition_class::TO_DECO_OBJECT))
|
---|
63 | return (g1_deco_object_class *)o;
|
---|
64 | else return 0;
|
---|
65 | }
|
---|
66 |
|
---|
67 | g1_deco_object_class(g1_object_type id, g1_loader_class *fp);
|
---|
68 |
|
---|
69 | virtual i4_bool check_collision(const i4_3d_vector &start,
|
---|
70 | i4_3d_vector &ray);
|
---|
71 |
|
---|
72 | void save(g1_saver_class *fp);
|
---|
73 |
|
---|
74 | // void occupy_location()
|
---|
75 | // {
|
---|
76 | // h=g1_get_map()->terrain_height(x,y);
|
---|
77 | // lh=h;
|
---|
78 | // g1_object_class::occupy_location();
|
---|
79 | // }
|
---|
80 |
|
---|
81 |
|
---|
82 | virtual i4_bool occupy_location()
|
---|
83 | {
|
---|
84 | if (occupancy_radius()<0.6)
|
---|
85 | return occupy_location_corners();
|
---|
86 | else
|
---|
87 | return occupy_location_model(draw_params);
|
---|
88 | }
|
---|
89 |
|
---|
90 | virtual void think();
|
---|
91 |
|
---|
92 | virtual void damage(g1_object_class *who_is_hurting,
|
---|
93 | int how_much_hurt, i4_3d_vector damage_dir);
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif
|
---|