2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Special effects, such as rotating fans, electrical walls, and
17 * other cool animations.
43 eclip Effects[MAX_EFFECTS];
45 void init_special_effects()
49 for (i=0;i<Num_effects;i++)
50 Effects[i].time_left = Effects[i].vc.frame_time;
53 void reset_special_effects()
57 for (i=0;i<Num_effects;i++) {
58 Effects[i].segnum = -1; //clear any active one-shots
59 Effects[i].flags &= ~(EF_STOPPED|EF_ONE_SHOT); //restart any stopped effects
61 //reset bitmap, which could have been changed by a crit_clip
62 if (Effects[i].changing_wall_texture != -1)
63 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[Effects[i].frame_count];
65 if (Effects[i].changing_object_texture != -1)
66 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[Effects[i].frame_count];
71 void do_special_effects()
76 for (i=0,ec=Effects;i<Num_effects;i++,ec++) {
78 if ((Effects[i].changing_wall_texture == -1) && (Effects[i].changing_object_texture==-1) )
81 if (ec->flags & EF_STOPPED)
84 ec->time_left -= FrameTime;
86 while (ec->time_left < 0) {
88 ec->time_left += ec->vc.frame_time;
91 if (ec->frame_count >= ec->vc.num_frames) {
92 if (ec->flags & EF_ONE_SHOT) {
93 Assert(ec->segnum!=-1);
94 Assert(ec->sidenum>=0 && ec->sidenum<6);
95 Assert(ec->dest_bm_num!=0 && Segments[ec->segnum].sides[ec->sidenum].tmap_num2!=0);
96 Segments[ec->segnum].sides[ec->sidenum].tmap_num2 = ec->dest_bm_num | (Segments[ec->segnum].sides[ec->sidenum].tmap_num2&0xc000); //replace with destoyed
97 ec->flags &= ~EF_ONE_SHOT;
98 ec->segnum = -1; //done with this
105 if (ec->flags & EF_CRITICAL)
108 if (ec->crit_clip!=-1 && Control_center_destroyed) {
109 int n = ec->crit_clip;
111 //*ec->bm_ptr = &GameBitmaps[Effects[n].vc.frames[Effects[n].frame_count].index];
112 if (ec->changing_wall_texture != -1)
113 Textures[ec->changing_wall_texture] = Effects[n].vc.frames[Effects[n].frame_count];
115 if (ec->changing_object_texture != -1)
116 ObjBitmaps[ec->changing_object_texture] = Effects[n].vc.frames[Effects[n].frame_count];
120 // *ec->bm_ptr = &GameBitmaps[ec->vc.frames[ec->frame_count].index];
121 if (ec->changing_wall_texture != -1)
122 Textures[ec->changing_wall_texture] = ec->vc.frames[ec->frame_count];
124 if (ec->changing_object_texture != -1)
125 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[ec->frame_count];
131 void restore_effect_bitmap_icons()
135 for (i=0;i<Num_effects;i++)
136 if (! (Effects[i].flags & EF_CRITICAL)) {
137 if (Effects[i].changing_wall_texture != -1)
138 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[0];
140 if (Effects[i].changing_object_texture != -1)
141 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[0];
143 //if (Effects[i].bm_ptr != -1)
144 // *Effects[i].bm_ptr = &GameBitmaps[Effects[i].vc.frames[0].index];
147 //stop an effect from animating. Show first frame.
148 void stop_effect(int effect_num)
150 eclip *ec = &Effects[effect_num];
152 //Assert(ec->bm_ptr != -1);
154 ec->flags |= EF_STOPPED;
157 //*ec->bm_ptr = &GameBitmaps[ec->vc.frames[0].index];
159 if (ec->changing_wall_texture != -1)
160 Textures[ec->changing_wall_texture] = ec->vc.frames[0];
162 if (ec->changing_object_texture != -1)
163 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[0];
167 //restart a stopped effect
168 void restart_effect(int effect_num)
170 Effects[effect_num].flags &= ~EF_STOPPED;
172 //Assert(Effects[effect_num].bm_ptr != -1);
177 * reads n eclip structs from a CFILE
179 int eclip_read_n(eclip *ec, int n, CFILE *fp)
183 for (i = 0; i < n; i++) {
184 vclip_read_n(&ec[i].vc, 1, fp);
185 ec[i].time_left = cfile_read_fix(fp);
186 ec[i].frame_count = cfile_read_int(fp);
187 ec[i].changing_wall_texture = cfile_read_short(fp);
188 ec[i].changing_object_texture = cfile_read_short(fp);
189 ec[i].flags = cfile_read_int(fp);
190 ec[i].crit_clip = cfile_read_int(fp);
191 ec[i].dest_bm_num = cfile_read_int(fp);
192 ec[i].dest_vclip = cfile_read_int(fp);
193 ec[i].dest_eclip = cfile_read_int(fp);
194 ec[i].dest_size = cfile_read_fix(fp);
195 ec[i].sound_num = cfile_read_int(fp);
196 ec[i].segnum = cfile_read_int(fp);
197 ec[i].sidenum = cfile_read_int(fp);