home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / source / theatrix / scenedir.cpp < prev    next >
C/C++ Source or Header  |  1995-05-08  |  1KB  |  67 lines

  1. // ------------- scenedir.cpp
  2.  
  3. #include "scenedir.h"
  4. #include "ascii.h"
  5.  
  6. SceneDirector *SceneDirector::thisscene;
  7.  
  8. SceneDirector::SceneDirector(char *scfile, short int trans) :
  9.         SceneryDirector(scfile, trans)
  10. {
  11.     thisscene = this;
  12.     snapshot = 0;
  13. }
  14.  
  15. void SceneDirector::display()
  16. {
  17.     SceneryDirector::display();
  18.     Player *pl = plist.FirstEntry();
  19.     while (pl)    {
  20.         pl->ticker = pl->interval;
  21.         pl = plist.NextEntry();
  22.     }
  23.     request_timer_cue(CLOCKTICKS, (callback)&SceneDirector::on_timer);
  24. }
  25.  
  26. void SceneDirector::hide()
  27. {
  28.     stop_timer_cue(CLOCKTICKS, (callback)&SceneDirector::on_timer);
  29.     SceneryDirector::hide();
  30. }
  31.  
  32. void SceneDirector::addplayer(Player& pl)
  33. {
  34.     plist.AppendEntry(&pl);
  35. }
  36.  
  37. void SceneDirector::scanframes()
  38. {
  39.     Player *pl = plist.FirstEntry();
  40.     while (pl)    {
  41.         pl->displayframe();
  42.         pl = plist.NextEntry();
  43.     }
  44.     if (mouseinuse)
  45.         fg_mousevis(0);
  46.     swap_video_pages();
  47.     if (snapshot)    {
  48.         snapshot = 0;
  49.         VideoDirector::on_s();
  50.     }
  51.     if (mouseinuse)
  52.         fg_mousevis(1);
  53.     synch_patches(0);
  54. }
  55.  
  56. void SceneDirector::on_s(int)
  57. {
  58.     snapshot = 1;
  59. }
  60. void SceneDirector::on_timer()
  61. {
  62.     pre_timer_tick();
  63.     scanframes();
  64.     post_timer_tick();
  65. }
  66.  
  67.