source: golgotha/src/golg/m_flow.hh

Last change on this file was 80, checked in by Sam Hocevar, 12 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.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 G1_MOVIE_FLOW_HH
10#define G1_MOVIE_FLOW_HH
11
12#include "math/spline.hh"
13#include "string/string.hh"
14#include "time/time.hh"
15
16
17class g1_loader_class;
18class g1_saver_class;
19class i4_file_class;
20class i4_event_handler_class;
21class i4_event_reaction_class;
22class i4_stream_wav_player;
23
24// this class contains a single cut scene
25class g1_cut_scene_class
26{
27public:
28  enum { DATA_VERSION_1=1,
29         DATA_VERSION_2
30  };  // for loading/saving data
31
32  enum { CAMERA, TARGET, OBJECT, T_PATHS };
33  i4_spline_class paths[3];
34
35
36
37  w32 t_frames;              // frames in cut scene
38
39  i4_str *wave_file;         // sound effect to play at the begining of cut scene
40  i4_str *name;              // name of cut scene to show in editor
41
42  void move(i4_float x_add, i4_float y_add, i4_float z_add);
43
44  g1_cut_scene_class(const i4_const_str &name) : name(new i4_str(name))
45  {
46    t_frames=0;
47    wave_file=0;   
48  }
49
50  g1_cut_scene_class(g1_loader_class *fp, w16 ver);
51
52  w32 total_frames()
53  {
54    w32 tf=paths[0].last_frame();
55
56    for (int i=1; i<T_PATHS; i++)
57    {
58      w32 t=paths[i].last_frame();
59      if (t>tf)
60        tf=t;
61    }
62   
63    return tf;
64  }
65
66  ~g1_cut_scene_class()
67  {
68    if (name)
69      delete name;
70    if (wave_file)
71      delete wave_file;
72  }
73
74  void save(g1_saver_class *fp);
75 
76};
77
78// this class manages a set of cut scenes
79class g1_movie_flow_class
80{
81  w32 frame, scene;
82
83  enum { MAX_SCORES=4 };  // maximum streaming sounds that can be played at the same time
84  i4_stream_wav_player *scores[4];
85
86  void poll_scores();     // called by advance_movie_with_time 
87
88public:
89  enum { DATA_VERSION=1 };  // for loading/saving data
90  enum { MESSAGE_FRAME_CHANGED, MESSAGE_SCENE_CHANGED, MESSAGE_MOVIE_STOPPED };
91
92  g1_cut_scene_class **set;
93
94  w32 t_cut_scenes;
95
96
97  i4_time_class frame_time;
98
99  g1_cut_scene_class *add_cut_scene(const i4_const_str &name);
100  g1_movie_flow_class();
101
102  g1_cut_scene_class *current() { if (set) return set[scene]; else return 0; }
103
104  w32 get_scene() { return scene; }
105  void set_scene(w32 num);
106 
107  w32 get_frame() { return frame; }
108  void set_frame(w32 num);
109
110  ~g1_movie_flow_class();
111
112  void save(g1_saver_class *fp);
113
114  enum advance_status { DONE, NEXT_SCENE, PLAYING };
115  advance_status advance_movie_with_time();
116
117  void start();   // should be called when a movie begins playing
118  void stop();    // should be called whan a movie is done playing
119};
120
121g1_movie_flow_class *g1_load_movie_flow(g1_loader_class *fp);
122
123
124extern i4_event_reaction_class *g1_frame_change_notify,   
125  *g1_scene_change_notify, *g1_movie_stop_notify;
126
127
128#endif
Note: See TracBrowser for help on using the repository browser.