spritegn.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. //
  16. // spritegn.h: header file for sprite generation program
  17. //
  18. // **********************************************************
  19. // * This file must be identical in the spritegen directory *
  20. // * and in the Quake directory, because it's used to *
  21. // * pass data from one to the other via .spr files. *
  22. // **********************************************************
  23. //-------------------------------------------------------
  24. // This program generates .spr sprite package files.
  25. // The format of the files is as follows:
  26. //
  27. // dsprite_t file header structure
  28. // <repeat dsprite_t.numframes times>
  29. // <if spritegroup, repeat dspritegroup_t.numframes times>
  30. // dspriteframe_t frame header structure
  31. // sprite bitmap
  32. // <else (single sprite frame)>
  33. // dspriteframe_t frame header structure
  34. // sprite bitmap
  35. // <endrepeat>
  36. //-------------------------------------------------------
  37. #ifdef INCLUDELIBS
  38. #include <stdlib.h>
  39. #include <stdio.h>
  40. #include <math.h>
  41. #include <string.h>
  42. #include "cmdlib.h"
  43. #include "scriplib.h"
  44. #include "dictlib.h"
  45. #include "trilib.h"
  46. #include "lbmlib.h"
  47. #include "mathlib.h"
  48. #endif
  49. #define SPRITE_VERSION 1
  50. // must match definition in modelgen.h
  51. #ifndef SYNCTYPE_T
  52. #define SYNCTYPE_T
  53. typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
  54. #endif
  55. // TODO: shorten these?
  56. typedef struct {
  57. int ident;
  58. int version;
  59. int type;
  60. float boundingradius;
  61. int width;
  62. int height;
  63. int numframes;
  64. float beamlength;
  65. synctype_t synctype;
  66. } dsprite_t;
  67. #define SPR_VP_PARALLEL_UPRIGHT 0
  68. #define SPR_FACING_UPRIGHT 1
  69. #define SPR_VP_PARALLEL 2
  70. #define SPR_ORIENTED 3
  71. #define SPR_VP_PARALLEL_ORIENTED 4
  72. typedef struct {
  73. int origin[2];
  74. int width;
  75. int height;
  76. } dspriteframe_t;
  77. typedef struct {
  78. int numframes;
  79. } dspritegroup_t;
  80. typedef struct {
  81. float interval;
  82. } dspriteinterval_t;
  83. typedef enum { SPR_SINGLE=0, SPR_GROUP } spriteframetype_t;
  84. typedef struct {
  85. spriteframetype_t type;
  86. } dspriteframetype_t;
  87. #define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I')
  88. // little-endian "IDSP"