source: golgotha/src/golg/objs/smoke_trail.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.1 KB
Line 
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 SMOKE_TRAIL_HH
10#define SMOKE_TRAIL_HH
11
12#include "g1_object.hh"
13#include "player_type.hh"
14#include "path.hh"
15
16class g1_solid_class;
17class g1_map_piece_class;
18class g1_map_class;
19
20/*
21  To create a smoke trail call :
22
23    s=(g1_smoke_trail_class *)g1_create_object(G1_SMOKE_TRAIL);
24    if (s)
25    {
26      s->setup(x, y, h, 0.01, 0.2, 0xffd000, 0xffffff);   // orange to white
27      s->occupy_location(map);
28      smoke_trail.reference_object(0,s);
29    }
30
31
32  when you (the head of the smoke trail, move, call :
33    if (s)
34      s->update_head(map, x,y,h);
35
36  when you die call :
37    if (s)    // delete the smoke trail
38    {
39      s->unoccupy_location(map);
40      map->request_remove(s);
41    }
42
43 */
44
45class g1_smoke_trail_class : public g1_object_class
46{
47public:
48  enum { DATA_VERSION=1 };
49  enum { TAIL_LENGTH=4 };
50  i4_3d_point_class tspots[TAIL_LENGTH];
51
52  w32 last_draw_frame;
53  w32 sc, ec;
54  i4_float sw,ew;
55  w16 ticks_advanced;
56
57  virtual i4_float occupancy_radius() const
58  {
59    float w=(tspots[0].x-tspots[TAIL_LENGTH-1].x);
60    float h=(tspots[0].y-tspots[TAIL_LENGTH-1].y);
61
62    w = (w<0)? w=-w : w;
63    h = (h<0)? h=-h : h;
64
65    return w>h ? w : h;
66  }
67
68
69  virtual void setup(i4_float start_x, i4_float start_y, i4_float start_h,
70             i4_float start_width, i4_float end_width,
71             i4_color start_color, i4_color end_color);
72
73  virtual void update_head(i4_float nx, i4_float ny, i4_float nh);
74
75  g1_smoke_trail_class(g1_object_type id, g1_loader_class *fp);
76  virtual void save(g1_saver_class *fp);
77  virtual void draw(g1_draw_context_class *context);
78  virtual void think();
79};
80
81#endif
Note: See TracBrowser for help on using the repository browser.