~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to include/movie.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
!------------------------------------------------------- -*- Inform -*- ----
2
 
!  Movie.H              An Inform 6.0 library to put non-interactive 
3
 
!   Version 2           "cut scenes" into a game.  By L. Ross Raszewski
4
 
!
5
 
! This is a minor re-release as I just realized I uploaded the wrong copy
6
 
! to gmd.  Sorry.
7
 
!
8
 
!
9
 
! I know what you're thinking.  You're thinking, "non-interactive cut scenes"?
10
 
! What would I want a thing like that for?  Well, It may at times be useful,
11
 
! or at least novel, to have the player suddenly be stopped and watch a sort 
12
 
! of anecdote.  It could be used for an introduction, and endgame, or a 
13
 
! flashback.  The player may, if they wish, choose not to view movies 
14
 
! automatically.  This library allows players to review movies they have 
15
 
! already seen.
16
 
! Usage:
17
 
! In a print statement: (PlayMovie) 1
18
 
! (Call PlayMovie(movie,1); if you want the movie to play regardless of 
19
 
! autoplay and replay settings!)
20
 
! The programmer must provide a DoMovie(movie) sub, which reads its argument, 
21
 
! and writes the movie based on it as such:
22
 
! [ DoMenu m;
23
 
!       switch(m){1: "This is the first movie";
24
 
!                  ... };     
25
 
! ];
26
 
!
27
 
! The first time a call to PlayMovie(movie); is made, if you have a footnote
28
 
! library installed (especially mine) define the constant MovieNote with a 
29
 
! value equal to one of your footnotes, and that footnote will be called.
30
 
! (To alert players to the fact that they can watch movies later).
31
 
! If the global "ShowMovies" is equal to 1, movies will not be shown, but 
32
 
! a message will alert players to the fact that one is being played.  
33
 
! If the global replayMovie is set to 1, the movie will only play the first
34
 
! time it is callled, and the alert message will be shown all subsequent 
35
 
! times.  The global nextmovie can be read, but should be left alone by 
36
 
! the game (unless you're trying to do something really sneaky).
37
 
!
38
 
! In addition to DoMovie, the user must provide an array (a bit array 
39
 
! will do) called 'movies', of a length _greater_ then the number of movies 
40
 
! in the game (because I use movies-->0 for internal things.)  
41
 
! The game should provide a word array, MovieTitle-->, which names the movies
42
 
! (This MUST start at MovieTitle-->1, not -->0, for internal reasons.)
43
 
! and a MovieTL-> which holds (again, starting one entry in) the number of 
44
 
! letters for the corresponding MovieTitle _divided by 2_ for DoMenu.
45
 
! The user need also define either a global or constant (depending on how 
46
 
! you plan to use it) called MMTitle (The banner you want to display when the 
47
 
! movies are called from a menu) and another called MMWidth, (half the width 
48
 
! of the MMTitle)  
49
 
!
50
 
! When called from the screen, PlayMovie will prompt for a keypress 
51
 
! (the WaitForKey("Message"); routine is available for public use.) 
52
 
! then clear the screen, show the movie, wait for a keypress, then clear the 
53
 
! screen again.
54
 
!
55
 
! Typing "Movie" will bring up the movie menu.  The names of viewed movies will
56
 
! appear in the same order as the player saw them, and the player can view his 
57
 
! choice of movie.  "Movie On" and "Movie Off" will enable and disable movie 
58
 
! autoplaying. (A verb to change the replay mode is "left as an exercise to the
59
 
! reader")
60
 
!
61
 
! Calling DoMovie alone will write the movie but not update the counter.  The 
62
 
! movie will not appear on on the Movie review screen. (Nor will the screen be 
63
 
! blanked)
64
 
!
65
 
! MoviePlayed(movie) returns true if the movie in question has been played, false 
66
 
! otherwise
67
 
! FindMovie(i) finds which movie was "i-th" played.
68
 
!
69
 
!
70
 
! Questions, Comments, bugs, e-mail me at rraszews@skipjack.bluecrab.org
71
 
 
72
 
 
73
 
 
74
 
 
75
 
global ShowMovies=0;
76
 
global nextmovie=1;
77
 
global replayMovie;
78
 
[ PlayMovie movie flag;
79
 
   #IFDEF MovieNote;
80
 
   if (movies-->0==0) { Note(MovieNote); 
81
 
                        new_line; movies-->0=1;};
82
 
   #ENDIF;
83
 
   if (flag ~= 1 &&(ShowMovies==1 || (MoviePlayed(movie)==1 && replayMovie==1)))
84
 
                        { style underline; print "^^[Movie: "; 
85
 
                              print (string) MovieTitle-->movie;
86
 
                              print "]^^"; style roman; 
87
 
                if (MoviePlayed(movie)==0) {
88
 
                        movies-->nextmovie=movie;
89
 
                        nextmovie++;};
90
 
                              rtrue;};
91
 
        WaitForKey("^^^Press [SPACE]");
92
 
        @erase_window -1;
93
 
   
94
 
   DoMovie(movie);
95
 
   WaitForKey("^^^Press [SPACE]"); @erase_window -1;
96
 
                if (MoviePlayed(movie)==0) {
97
 
                        movies-->nextmovie=movie;
98
 
                        nextmovie++;};
99
 
print "^^^";
100
 
];
101
 
[ MoviePlayed movie i;
102
 
        for(i=1:i<=nextmovie:i++) {
103
 
                if (movies-->i==movie) rtrue;};
104
 
        rfalse;
105
 
];
106
 
[ MovieMenuSub;
107
 
        DoMenu(WriteMovieList,MovieRC,MoviePF);
108
 
];
109
 
[ WriteMovieList i j;
110
 
        new_line;
111
 
        for(i=1:i<=nextmovie:i++) {
112
 
                j=movies-->i;
113
 
                if (j~=0) { new_line;
114
 
                        spaces(5); print (string) MovieTitle-->j;};
115
 
                        };
116
 
];
117
 
[ FindMovie i;
118
 
   return movies-->i;
119
 
];
120
 
[ MovieRC;
121
 
        if (menu_item==0) { item_name=MMtitle; item_width=MMwidth; return (nextmovie-1);};
122
 
        item_name=MovieTitle-->FindMovie(menu_item);
123
 
        item_width=MovieTL->FindMovie(menu_item);
124
 
];
125
 
[ MoviePF i;
126
 
        i=FindMovie(menu_item);
127
 
        DoMovie(i);
128
 
];
129
 
[ TurnOffMSub;
130
 
  ShowMovies=1;
131
 
  "Movie autoplay disabled.";
132
 
];
133
 
[ TurnOnMSub;
134
 
  ShowMovies=0;
135
 
  "Movie autoplay enabled.";
136
 
];
137
 
 
138
 
verb meta "Movies" "Movie" *            -> MovieMenu
139
 
                        * "off"         -> TurnOffM
140
 
                        * "on"          -> TurnOnM;
141
 
 
142
 
#IFNDEF WaitForKey;
143
 
[ WaitForKey str i;
144
 
if (str==0) str="(Please Press Any Key)";
145
 
print (string) str;
146
 
@read_char 1 0 0 i;
147
 
];
148
 
#EndIf;