max_object.hh 3.3 KB

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