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 static char rcsid[] = "$Id: effects.c,v 1.1.1.1 2001-01-19 03:30:00 bradleyb Exp $";
38 eclip Effects[MAX_EFFECTS];
40 void init_special_effects()
44 for (i=0;i<Num_effects;i++)
45 Effects[i].time_left = Effects[i].vc.frame_time;
48 void reset_special_effects()
52 for (i=0;i<Num_effects;i++) {
53 Effects[i].segnum = -1; //clear any active one-shots
54 Effects[i].flags &= ~(EF_STOPPED|EF_ONE_SHOT); //restart any stopped effects
56 //reset bitmap, which could have been changed by a crit_clip
57 if (Effects[i].changing_wall_texture != -1)
58 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[Effects[i].frame_count];
60 if (Effects[i].changing_object_texture != -1)
61 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[Effects[i].frame_count];
66 void do_special_effects()
71 for (i=0,ec=Effects;i<Num_effects;i++,ec++) {
73 if ((Effects[i].changing_wall_texture == -1) && (Effects[i].changing_object_texture==-1) )
76 if (ec->flags & EF_STOPPED)
79 ec->time_left -= FrameTime;
81 while (ec->time_left < 0) {
83 ec->time_left += ec->vc.frame_time;
86 if (ec->frame_count >= ec->vc.num_frames) {
87 if (ec->flags & EF_ONE_SHOT) {
88 Assert(ec->segnum!=-1);
89 Assert(ec->sidenum>=0 && ec->sidenum<6);
90 Assert(ec->dest_bm_num!=0 && Segments[ec->segnum].sides[ec->sidenum].tmap_num2!=0);
91 Segments[ec->segnum].sides[ec->sidenum].tmap_num2 = ec->dest_bm_num | (Segments[ec->segnum].sides[ec->sidenum].tmap_num2&0xc000); //replace with destoyed
92 ec->flags &= ~EF_ONE_SHOT;
93 ec->segnum = -1; //done with this
100 if (ec->flags & EF_CRITICAL)
103 if (ec->crit_clip!=-1 && Control_center_destroyed) {
104 int n = ec->crit_clip;
106 //*ec->bm_ptr = &GameBitmaps[Effects[n].vc.frames[Effects[n].frame_count].index];
107 if (ec->changing_wall_texture != -1)
108 Textures[ec->changing_wall_texture] = Effects[n].vc.frames[Effects[n].frame_count];
110 if (ec->changing_object_texture != -1)
111 ObjBitmaps[ec->changing_object_texture] = Effects[n].vc.frames[Effects[n].frame_count];
115 // *ec->bm_ptr = &GameBitmaps[ec->vc.frames[ec->frame_count].index];
116 if (ec->changing_wall_texture != -1)
117 Textures[ec->changing_wall_texture] = ec->vc.frames[ec->frame_count];
119 if (ec->changing_object_texture != -1)
120 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[ec->frame_count];
126 void restore_effect_bitmap_icons()
130 for (i=0;i<Num_effects;i++)
131 if (! (Effects[i].flags & EF_CRITICAL)) {
132 if (Effects[i].changing_wall_texture != -1)
133 Textures[Effects[i].changing_wall_texture] = Effects[i].vc.frames[0];
135 if (Effects[i].changing_object_texture != -1)
136 ObjBitmaps[Effects[i].changing_object_texture] = Effects[i].vc.frames[0];
138 //if (Effects[i].bm_ptr != -1)
139 // *Effects[i].bm_ptr = &GameBitmaps[Effects[i].vc.frames[0].index];
142 //stop an effect from animating. Show first frame.
143 void stop_effect(int effect_num)
145 eclip *ec = &Effects[effect_num];
147 //Assert(ec->bm_ptr != -1);
149 ec->flags |= EF_STOPPED;
152 //*ec->bm_ptr = &GameBitmaps[ec->vc.frames[0].index];
154 if (ec->changing_wall_texture != -1)
155 Textures[ec->changing_wall_texture] = ec->vc.frames[0];
157 if (ec->changing_object_texture != -1)
158 ObjBitmaps[ec->changing_object_texture] = ec->vc.frames[0];
162 //restart a stopped effect
163 void restart_effect(int effect_num)
165 Effects[effect_num].flags &= ~EF_STOPPED;
167 //Assert(Effects[effect_num].bm_ptr != -1);