home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / vclip.c < prev    next >
Text File  |  1998-06-08  |  4KB  |  121 lines

  1. /*
  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-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/vclip.c $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:32:41 $
  18.  * 
  19.  * Routines for vclips.
  20.  * 
  21.  * $Log: vclip.c $
  22.  * Revision 2.0  1995/02/27  11:32:41  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.8  1994/09/25  23:40:52  matt
  27.  * Changed the object load & save code to read/write the structure fields one
  28.  * at a time (rather than the whole structure at once).  This mean that the
  29.  * object structure can be changed without breaking the load/save functions.
  30.  * As a result of this change, the local_object data can be and has been 
  31.  * incorporated into the object array.  Also, timeleft is now a property 
  32.  * of all objects, and the object structure has been otherwise cleaned up.
  33.  * 
  34.  * Revision 1.7  1994/09/25  15:45:26  matt
  35.  * Added OBJ_LIGHT, a type of object that casts light
  36.  * Added generalized lifeleft, and moved it to local_object
  37.  * 
  38.  * Revision 1.6  1994/09/09  20:05:57  mike
  39.  * Add vclips for weapons.
  40.  * 
  41.  * Revision 1.5  1994/06/14  21:14:35  matt
  42.  * Made rod objects draw lighted or not depending on a parameter, so the
  43.  * materialization effect no longer darkens.
  44.  * 
  45.  * Revision 1.4  1994/06/08  18:16:24  john
  46.  * Bunch of new stuff that basically takes constants out of the code
  47.  * and puts them into bitmaps.tbl.
  48.  * 
  49.  * Revision 1.3  1994/06/03  10:47:17  matt
  50.  * Made vclips (used by explosions) which can be either rods or blobs, as
  51.  * specified in BITMAPS.TBL.  (This is for the materialization center effect).
  52.  * 
  53.  * Revision 1.2  1994/05/11  09:25:25  john
  54.  * Abandoned new vclip system for now because each wallclip, vclip,
  55.  * etc, is different and it would be a huge pain to change all of them.
  56.  * 
  57.  * Revision 1.1  1994/05/10  15:21:12  john
  58.  * Initial revision
  59.  * 
  60.  * 
  61.  */
  62.  
  63.  
  64. #pragma off (unreferenced)
  65. static char rcsid[] = "$Id: vclip.c 2.0 1995/02/27 11:32:41 john Exp $";
  66. #pragma on (unreferenced)
  67.  
  68. #include "error.h"
  69.  
  70. #include "inferno.h"
  71. #include "vclip.h"
  72. #include "weapon.h"
  73.  
  74. //----------------- Variables for video clips -------------------
  75. int                     Num_vclips = 0;
  76. vclip                 Vclip[VCLIP_MAXNUM];        // General purpose vclips.
  77.  
  78. //draw an object which renders as a vclip
  79. draw_vclip_object(object *obj,fix timeleft,int lighted, int vclip_num)
  80. {
  81.     int nf,bitmapnum;
  82.  
  83.     nf = Vclip[vclip_num].num_frames;
  84.  
  85.     bitmapnum =  (nf - f2i(fixdiv( (nf-1)*timeleft,Vclip[vclip_num].play_time))) - 1;
  86.  
  87.     if (bitmapnum >= Vclip[vclip_num].num_frames)
  88.         bitmapnum=Vclip[vclip_num].num_frames-1;
  89.  
  90.     if (bitmapnum >= 0 )    {
  91.  
  92.         if (Vclip[vclip_num].flags & VF_ROD)
  93.             draw_object_tmap_rod(obj, Vclip[vclip_num].frames[bitmapnum],lighted);
  94.         else {
  95.             Assert(lighted==0);        //blob cannot now be lighted
  96.  
  97.             draw_object_blob(obj, Vclip[vclip_num].frames[bitmapnum] );
  98.         }
  99.     }
  100.  
  101. }
  102.  
  103.  
  104. void draw_weapon_vclip(object *obj)
  105. {
  106.     int    vclip_num;
  107.     fix    modtime;
  108.  
  109.     //mprintf( 0, "[Drawing obj %d type %d fireball size %x]\n", obj-Objects, Weapon_info[obj->id].weapon_vclip, obj->size );
  110.  
  111.     vclip_num = Weapon_info[obj->id].weapon_vclip;
  112.     modtime = obj->lifeleft;
  113.     while (modtime > Vclip[vclip_num].play_time)
  114.         modtime -= Vclip[vclip_num].play_time;
  115.  
  116.     draw_vclip_object(obj, modtime, 0, vclip_num);
  117.  
  118. }
  119.  
  120. 
  121.