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.
19 static char rcsid[] = "$Id: effects.c,v 1.3 2002-07-26 09:22:05 btb Exp $";
40 eclip Effects[MAX_EFFECTS];
42 void init_special_effects()
46 for (i=0;i<Num_effects;i++)
47 Effects[i].time_left = Effects[i].vc.frame_time;
50 void reset_special_effects()
54 for (i=0;i<Num_effects;i++) {
55 Effects[i].segnum = -1; //clear any active one-shots
56 Effects[i].flags &= ~(EF_STOPPED|EF_ONE_SHOT); //restart any stopped effects
58 //reset bitmap, which could have been changed by a crit_clip
59 if (Effects[i].changing_wall_texture != -1)
60 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[Effects[i].frame_count];
62 if (Effects[i].changing_object_texture != -1)
63 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[Effects[i].frame_count];
68 void do_special_effects()
73 for (i=0,ec=Effects;i<Num_effects;i++,ec++) {
75 if ((Effects[i].changing_wall_texture == -1) && (Effects[i].changing_object_texture==-1) )
78 if (ec->flags & EF_STOPPED)
81 ec->time_left -= FrameTime;
83 while (ec->time_left < 0) {
85 ec->time_left += ec->vc.frame_time;
88 if (ec->frame_count >= ec->vc.num_frames) {
89 if (ec->flags & EF_ONE_SHOT) {
90 Assert(ec->segnum!=-1);
91 Assert(ec->sidenum>=0 && ec->sidenum<6);
92 Assert(ec->dest_bm_num!=0 && Segments[ec->segnum].sides[ec->sidenum].tmap_num2!=0);
93 Segments[ec->segnum].sides[ec->sidenum].tmap_num2 = ec->dest_bm_num | (Segments[ec->segnum].sides[ec->sidenum].tmap_num2&0xc000); //replace with destoyed
94 ec->flags &= ~EF_ONE_SHOT;
95 ec->segnum = -1; //done with this
102 if (ec->flags & EF_CRITICAL)
105 if (ec->crit_clip!=-1 && Control_center_destroyed) {
106 int n = ec->crit_clip;
108 //*ec->bm_ptr = &GameBitmaps[Effects[n].vc.frames[Effects[n].frame_count].index];
109 if (ec->changing_wall_texture != -1)
110 Textures[ec->changing_wall_texture] = Effects[n].vc.frames[Effects[n].frame_count];
112 if (ec->changing_object_texture != -1)
113 ObjBitmaps[ec->changing_object_texture] = Effects[n].vc.frames[Effects[n].frame_count];
117 // *ec->bm_ptr = &GameBitmaps[ec->vc.frames[ec->frame_count].index];
118 if (ec->changing_wall_texture != -1)
119 Textures[ec->changing_wall_texture] = ec->vc.frames[ec->frame_count];
121 if (ec->changing_object_texture != -1)
122 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[ec->frame_count];
128 void restore_effect_bitmap_icons()
132 for (i=0;i<Num_effects;i++)
133 if (! (Effects[i].flags & EF_CRITICAL)) {
134 if (Effects[i].changing_wall_texture != -1)
135 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[0];
137 if (Effects[i].changing_object_texture != -1)
138 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[0];
140 //if (Effects[i].bm_ptr != -1)
141 // *Effects[i].bm_ptr = &GameBitmaps[Effects[i].vc.frames[0].index];
144 //stop an effect from animating. Show first frame.
145 void stop_effect(int effect_num)
147 eclip *ec = &Effects[effect_num];
149 //Assert(ec->bm_ptr != -1);
151 ec->flags |= EF_STOPPED;
154 //*ec->bm_ptr = &GameBitmaps[ec->vc.frames[0].index];
156 if (ec->changing_wall_texture != -1)
157 Textures[ec->changing_wall_texture] = ec->vc.frames[0];
159 if (ec->changing_object_texture != -1)
160 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[0];
164 //restart a stopped effect
165 void restart_effect(int effect_num)
167 Effects[effect_num].flags &= ~EF_STOPPED;
169 //Assert(Effects[effect_num].bm_ptr != -1);
173 * reads an eclip structure from a CFILE
175 void eclip_read(eclip *ec, CFILE *fp)
177 vclip_read(&ec->vc, fp);
178 ec->time_left = cfile_read_fix(fp);
179 ec->frame_count = cfile_read_int(fp);
180 ec->changing_wall_texture = cfile_read_short(fp);
181 ec->changing_object_texture = cfile_read_short(fp);
182 ec->flags = cfile_read_int(fp);
183 ec->crit_clip = cfile_read_int(fp);
184 ec->dest_bm_num = cfile_read_int(fp);
185 ec->dest_vclip = cfile_read_int(fp);
186 ec->dest_eclip = cfile_read_int(fp);
187 ec->dest_size = cfile_read_fix(fp);
188 ec->sound_num = cfile_read_int(fp);
189 ec->segnum = cfile_read_int(fp);
190 ec->sidenum = cfile_read_int(fp);