home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / sharewar / quake106 / utils / sprgen / spritegn.h < prev   
C/C++ Source or Header  |  1996-09-12  |  2KB  |  89 lines

  1. //
  2. // spritegn.h: header file for sprite generation program
  3. //
  4.  
  5. // **********************************************************
  6. // * This file must be identical in the spritegen directory *
  7. // * and in the Quake directory, because it's used to       *
  8. // * pass data from one to the other via .spr files.        *
  9. // **********************************************************
  10.  
  11. //-------------------------------------------------------
  12. // This program generates .spr sprite package files.
  13. // The format of the files is as follows:
  14. //
  15. // dsprite_t file header structure
  16. // <repeat dsprite_t.numframes times>
  17. //   <if spritegroup, repeat dspritegroup_t.numframes times>
  18. //     dspriteframe_t frame header structure
  19. //     sprite bitmap
  20. //   <else (single sprite frame)>
  21. //     dspriteframe_t frame header structure
  22. //     sprite bitmap
  23. // <endrepeat>
  24. //-------------------------------------------------------
  25.  
  26. #ifdef INCLUDELIBS
  27.  
  28. #include <stdlib.h>
  29. #include <stdio.h>
  30. #include <math.h>
  31. #include <string.h>
  32.  
  33. #include "cmdlib.h"
  34. #include "scriplib.h"
  35. #include "lbmlib.h"
  36.  
  37. #endif
  38.  
  39. #define SPRITE_VERSION    1
  40.  
  41. // must match definition in modelgen.h
  42. #ifndef SYNCTYPE_T
  43. #define SYNCTYPE_T
  44. typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
  45. #endif
  46.  
  47. // TODO: shorten these?
  48. typedef struct {
  49.     int            ident;
  50.     int            version;
  51.     int            type;
  52.     float        boundingradius;
  53.     int            width;
  54.     int            height;
  55.     int            numframes;
  56.     float        beamlength;
  57.     synctype_t    synctype;
  58. } dsprite_t;
  59.  
  60. #define SPR_VP_PARALLEL_UPRIGHT        0
  61. #define SPR_FACING_UPRIGHT            1
  62. #define SPR_VP_PARALLEL                2
  63. #define SPR_ORIENTED                3
  64. #define SPR_VP_PARALLEL_ORIENTED    4
  65.  
  66. typedef struct {
  67.     int            origin[2];
  68.     int            width;
  69.     int            height;
  70. } dspriteframe_t;
  71.  
  72. typedef struct {
  73.     int            numframes;
  74. } dspritegroup_t;
  75.  
  76. typedef struct {
  77.     float    interval;
  78. } dspriteinterval_t;
  79.  
  80. typedef enum { SPR_SINGLE=0, SPR_GROUP } spriteframetype_t;
  81.  
  82. typedef struct {
  83.     spriteframetype_t    type;
  84. } dspriteframetype_t;
  85.  
  86. #define IDSPRITEHEADER    (('P'<<24)+('S'<<16)+('D'<<8)+'I')
  87.                                                         // little-endian "IDSP"
  88.  
  89.