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: vclip.c,v 1.2 2001-01-31 15:17:59 bradleyb Exp $";
31 //----------------- Variables for video clips -------------------
33 vclip Vclip[VCLIP_MAXNUM]; // General purpose vclips.
35 //draw an object which renders as a vclip
36 void draw_vclip_object(object *obj,fix timeleft,int lighted, int vclip_num)
40 nf = Vclip[vclip_num].num_frames;
42 bitmapnum = (nf - f2i(fixdiv( (nf-1)*timeleft,Vclip[vclip_num].play_time))) - 1;
44 if (bitmapnum >= Vclip[vclip_num].num_frames)
45 bitmapnum=Vclip[vclip_num].num_frames-1;
47 if (bitmapnum >= 0 ) {
49 if (Vclip[vclip_num].flags & VF_ROD)
50 draw_object_tmap_rod(obj, Vclip[vclip_num].frames[bitmapnum],lighted);
52 Assert(lighted==0); //blob cannot now be lighted
54 draw_object_blob(obj, Vclip[vclip_num].frames[bitmapnum] );
61 void draw_weapon_vclip(object *obj)
64 fix modtime,play_time;
66 //mprintf( 0, "[Drawing obj %d type %d fireball size %x]\n", obj-Objects, Weapon_info[obj->id].weapon_vclip, obj->size );
68 Assert(obj->type == OBJ_WEAPON);
70 vclip_num = Weapon_info[obj->id].weapon_vclip;
72 modtime = obj->lifeleft;
73 play_time = Vclip[vclip_num].play_time;
75 // Special values for modtime were causing enormous slowdown for omega blobs.
76 if (modtime == IMMORTAL_TIME)
79 // Should cause Omega blobs (which live for one frame) to not always be the same.
80 if (modtime == ONE_FRAME_TIME)
83 if (obj->id == PROXIMITY_ID) { //make prox bombs spin out of sync
84 int objnum = obj-Objects;
86 modtime += (modtime * (objnum&7)) / 16; //add variance to spin rate
88 while (modtime > play_time)
91 if ((objnum&1) ^ ((objnum>>1)&1)) //make some spin other way
92 modtime = play_time - modtime;
96 while (modtime > play_time)
100 draw_vclip_object(obj, modtime, 0, vclip_num);