animate.cc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #include "lisp/li_init.hh"
  9. #include "m1_info.hh"
  10. #include "max_object.hh"
  11. #include "render.hh"
  12. #include "st_edit.hh"
  13. #include "math/pi.hh"
  14. li_object *m1_frame_add(li_object *o, li_environment *env)
  15. //{{{
  16. {
  17. m1_poly_object_class *obj = m1_info.obj;
  18. obj->add_frame(m1_info.current_animation, m1_info.current_frame);
  19. m1_render_window->request_redraw();
  20. return 0;
  21. }
  22. //}}}
  23. li_object *m1_frame_remove(li_object *o, li_environment *env)
  24. //{{{
  25. {
  26. m1_poly_object_class *obj = m1_info.obj;
  27. obj->remove_frame(m1_info.current_animation, m1_info.current_frame);
  28. m1_render_window->request_redraw();
  29. return 0;
  30. }
  31. //}}}
  32. li_object *m1_frame_rewind(li_object *o, li_environment *env)
  33. //{{{
  34. {
  35. m1_info.current_frame = 0;
  36. m1_info.time = 0;
  37. m1_render_window->update_object(m1_info.time);
  38. m1_st_edit->edit_poly_changed();
  39. m1_render_window->request_redraw();
  40. return 0;
  41. }
  42. //}}}
  43. li_object *m1_frame_advance(li_object *o, li_environment *env)
  44. //{{{
  45. {
  46. m1_poly_object_class *obj = m1_info.obj;
  47. if (++m1_info.current_frame==obj->animation[m1_info.current_animation].num_frames)
  48. m1_info.current_frame = 0;
  49. m1_info.time += 1.0;
  50. m1_render_window->update_object(m1_info.time);
  51. m1_st_edit->edit_poly_changed();
  52. m1_render_window->request_redraw();
  53. return 0;
  54. }
  55. //}}}
  56. li_object *m1_frame_back(li_object *o, li_environment *env)
  57. //{{{
  58. {
  59. m1_poly_object_class *obj = m1_info.obj;
  60. if (--m1_info.current_frame<0)
  61. m1_info.current_frame = obj->animation[m1_info.current_animation].num_frames - 1;
  62. m1_info.time -= 1.0;
  63. m1_render_window->update_object(m1_info.time);
  64. m1_st_edit->edit_poly_changed();
  65. m1_render_window->request_redraw();
  66. return 0;
  67. }
  68. //}}}
  69. li_object *m1_toggle_animation(li_object *o, li_environment *env)
  70. //{{{
  71. {
  72. m1_render_window->set_animation(!m1_render_window->is_animating());
  73. m1_st_edit->edit_poly_changed();
  74. return 0;
  75. }
  76. //}}}
  77. li_automatic_add_function(m1_frame_add, "frame_add");
  78. li_automatic_add_function(m1_frame_remove, "frame_remove");
  79. li_automatic_add_function(m1_frame_rewind, "frame_rewind");
  80. li_automatic_add_function(m1_frame_advance, "frame_advance");
  81. li_automatic_add_function(m1_frame_back, "frame_back");
  82. li_automatic_add_function(m1_toggle_animation, "toggle_animation");
  83. //{{{ Emacs Locals
  84. // Local Variables:
  85. // folded-file: t
  86. // End:
  87. //}}}