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 | #include "g1_object.hh"
|
---|
10 | #include "math/num_type.hh"
|
---|
11 | #include "math/angle.hh"
|
---|
12 | #include "math/trig.hh"
|
---|
13 | #include "math/random.hh"
|
---|
14 | #include "tile.hh"
|
---|
15 | #include "saver.hh"
|
---|
16 | #include "math/pi.hh"
|
---|
17 | #include "map.hh"
|
---|
18 | #include "map_man.hh"
|
---|
19 | #include "object_definer.hh"
|
---|
20 | #include "resources.hh"
|
---|
21 |
|
---|
22 | #include "objs/buster_rocket.hh"
|
---|
23 | #include "objs/map_piece.hh"
|
---|
24 | #include "objs/smoke_trail.hh"
|
---|
25 | #include "objs/stank.hh"
|
---|
26 | #include "objs/particle_emitter.hh"
|
---|
27 | #include "lisp/lisp.hh"
|
---|
28 | #include "li_objref.hh"
|
---|
29 |
|
---|
30 | static li_symbol_ref li_particle_emitter("particle_emitter");
|
---|
31 | static li_g1_ref_class_member smoke_trail("smoke_trail");
|
---|
32 |
|
---|
33 | enum { DATA_VERSION=2 };
|
---|
34 |
|
---|
35 | g1_object_definer<g1_buster_rocket_class>
|
---|
36 | g1_buster_rocket_def("buster_rocket");
|
---|
37 |
|
---|
38 | g1_object_definer<g1_buster_rocket_class>
|
---|
39 | g1_heavy_rocket_def("heavy_rocket");
|
---|
40 |
|
---|
41 | g1_object_definer<g1_buster_rocket_class>
|
---|
42 | g1_vortex_def("vortex_missile");
|
---|
43 |
|
---|
44 | g1_object_definer<g1_buster_rocket_class>
|
---|
45 | g1_nuke_def("nuke_missile");
|
---|
46 |
|
---|
47 |
|
---|
48 | g1_buster_rocket_class::g1_buster_rocket_class(g1_object_type id,
|
---|
49 | g1_loader_class *fp)
|
---|
50 | : g1_guided_missile_class(id,fp)
|
---|
51 | {
|
---|
52 | }
|
---|
53 |
|
---|
54 | static r1_texture_ref smoke_ref("smoke_particle");
|
---|
55 |
|
---|
56 | void g1_buster_rocket_class::add_smoke()
|
---|
57 | {
|
---|
58 | g1_particle_emitter_params p;
|
---|
59 | g1_particle_emitter_class *emitter;
|
---|
60 | p.defaults();
|
---|
61 | p.start_size=0.05;
|
---|
62 | p.grow_speed=0.01;
|
---|
63 | p.max_speed=0.02;
|
---|
64 | p.air_friction=0.80;
|
---|
65 | p.num_create_attempts_per_tick=1;
|
---|
66 | p.particle_lifetime=20;
|
---|
67 |
|
---|
68 | p.texture=smoke_ref.get();
|
---|
69 |
|
---|
70 | emitter = (g1_particle_emitter_class *)
|
---|
71 | g1_create_object(g1_get_object_type(li_particle_emitter.get()));
|
---|
72 | emitter->setup(x,y,h, p);
|
---|
73 |
|
---|
74 | vars->set(smoke_trail, new li_g1_ref(emitter));
|
---|
75 | }
|
---|
76 |
|
---|
77 | void g1_buster_rocket_class::update_smoke()
|
---|
78 | {
|
---|
79 | li_class_context c(vars);
|
---|
80 |
|
---|
81 | if (!smoke_trail())
|
---|
82 | return;
|
---|
83 |
|
---|
84 | g1_particle_emitter_class *st=(g1_particle_emitter_class *) smoke_trail()->value();
|
---|
85 | if (st)
|
---|
86 | st->move(lx,ly,lh);
|
---|
87 | }
|
---|
88 |
|
---|
89 | void g1_buster_rocket_class::delete_smoke()
|
---|
90 | {
|
---|
91 | li_class_context c(vars);
|
---|
92 |
|
---|
93 | if (!smoke_trail())
|
---|
94 | return;
|
---|
95 |
|
---|
96 | g1_particle_emitter_class *st=(g1_particle_emitter_class *) smoke_trail()->value();
|
---|
97 | if (st)
|
---|
98 | {
|
---|
99 | st->unoccupy_location();
|
---|
100 | st->request_remove();
|
---|
101 | vars->set(smoke_trail, li_g1_null_ref());
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 |
|
---|