source: golgotha/src/maxtool/max_object.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: 3.3 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 M1_MAX_OBJECT_HH
10#define M1_MAX_OBJECT_HH
11
12#include "obj3d.hh"
13#include "memory/array.hh"
14#include "string/string.hh"
15
16class i4_saver_class;
17
18class m1_poly_object_class : public g1_quad_object_class
19{
20  void save_quads(i4_saver_class *fp);
21  void save_texture_names(i4_saver_class *fp);
22  void save_vert_animations(i4_saver_class *fp);
23  void save_mount_points(i4_saver_class *fp);
24  void save_specials(i4_saver_class *fp);
25  void calc_quad_normal(g1_vert_class *v, g1_quad_class &q);
26
27public:
28  void calc_texture_scales();
29  void calc_vert_normals();
30
31  enum { INVALID_QUAD = (1<<7) };  // g1_quad_class flag (*NOTE: bit 7 must be available)
32  enum { MAX_ANIMATIONS=20 };
33  enum { MAX_TEXTURE_NAMES=MAX_ANIMATIONS * 200 };
34
35  enum { POLY_SELCTED=1 };
36
37  i4_array<i4_str *> texture_names;
38  i4_array<i4_str *> animation_names;
39  i4_array<i4_str *> mount_names;
40  i4_array<w32>      vert_flags;
41
42  i4_array<animation_class>      anim_store;
43  i4_array<g1_vert_class>        vert_store;
44  i4_array<g1_quad_class>        quad_store;
45  i4_array<i4_3d_vector>         mount_store;
46  i4_array<w32>                  mount_id_store;
47  i4_array<g1_texture_animation> special_store;
48 
49  ~m1_poly_object_class()
50  //{{{
51  {
52    w32 i;
53    for (i=0; i<texture_names.size(); i++)
54      delete texture_names[i];
55     
56    for (i=0; i<animation_names.size(); i++)
57      delete animation_names[i];
58     
59    for (i=0; i<mount_names.size(); i++)
60      delete mount_names[i];
61  }
62  //}}}
63
64  int get_poly_vert_flag(int poly_num, int flag)
65  //{{{
66  {
67    if (poly_num>=vert_flags.size())
68      return 0;
69    else return vert_flags[poly_num]&flag ? 1 : 0;
70  }
71  //}}}
72
73  void set_poly_vert_flag(int poly_num, int flag, int value)
74  //{{{
75  {
76    while (vert_flags.size()<=poly_num) vert_flags.add();
77    if (value)
78      vert_flags[poly_num] |= flag;
79    else
80      vert_flags[poly_num] &= ~flag;
81  }
82  //}}}
83
84  void add_animation(m1_poly_object_class *other, w32 animation_number);
85  void delete_animation(w32 animation_number);
86
87  void add_frame(w32 anim, w32 frame);
88  void remove_frame(w32 anim, w32 frame);
89 
90  w32 add_vertex();
91  void remove_vertex(w32 num);
92
93  w32 add_quad();
94  void remove_quad(w32 num);
95
96  w32 add_mount();
97  void remove_mount(w32 num);
98
99  w32 add_special(w32 quad_number);
100  void remove_special(w32 num);
101
102  void save(i4_saver_class *fp);
103  void change_animation_name(w32 animation_number, const i4_const_str &st);
104
105  m1_poly_object_class()
106    : anim_store(0,1), vert_store(0,100), quad_store(0,100),
107      mount_store(0,10), mount_id_store(0,10), special_store(0,10),
108      texture_names(0, 32), animation_names(0,32), vert_flags(0,32), mount_names(0,32) {}
109};
110                                   
111#endif
112
113//{{{ Emacs Locals
114// Local Variables:
115// folded-file: t
116// End:
117//}}}
Note: See TracBrowser for help on using the repository browser.