FTEQW
Documentation of the FTE engine source tree.
spritegn.h
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20//
21// spritegn.h: header file for sprite generation program
22//
23
24// **********************************************************
25// * This file must be identical in the spritegen directory *
26// * and in the Quake directory, because it's used to *
27// * pass data from one to the other via .spr files. *
28// **********************************************************
29
30//-------------------------------------------------------
31// This program generates .spr sprite package files.
32// The format of the files is as follows:
33//
34// dsprite_t file header structure
35// <repeat dsprite_t.numframes times>
36// <if spritegroup, repeat dspritegroup_t.numframes times>
37// dspriteframe_t frame header structure
38// sprite bitmap
39// <else (single sprite frame)>
40// dspriteframe_t frame header structure
41// sprite bitmap
42// <endrepeat>
43//-------------------------------------------------------
44
45#ifdef INCLUDELIBS
46
47#include <stdlib.h>
48#include <stdio.h>
49#include <math.h>
50#include <string.h>
51
52#include "cmdlib.h"
53#include "scriplib.h"
54#include "dictlib.h"
55#include "trilib.h"
56#include "lbmlib.h"
57#include "mathlib.h"
58
59#endif
60
61#define SPRITE_VERSION 1
62#define SPRITEHL_VERSION 2
63#define SPRITE32_VERSION 32
64
65// must match definition in modelgen.h
66#ifndef SYNCTYPE_T
67#define SYNCTYPE_T
68typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
69#endif
70
71// TODO: shorten these?
72typedef struct {
73 int ident;
75 int type;
76 //int rendermode; //present only in halflife sprites.
78 int width;
79 int height;
83} dsprite_t;
84
85#define SPR_VP_PARALLEL_UPRIGHT 0 //xy faces view. z is always up.
86#define SPR_FACING_UPRIGHT 1 //xy faces view. z is always up.
87#define SPR_VP_PARALLEL 2 //faces camera (traditional sprite)
88#define SPR_ORIENTED 3 //uses axis
89#define SPR_VP_PARALLEL_ORIENTED 4 //faces camera *then* rotated
90#define SPRDP_LABEL 5
91#define SPRDP_LABEL_SCALE 6
92#define SPRDP_OVERHEAD 7
93
94#define SPR_ORIENTED_BACKFACE 8 //SPR_ORIENTED except facing along its normal...
95
96#define SPRHL_OPAQUE 0
97#define SPRHL_ADDITIVE 1
98#define SPRHL_INDEXALPHA 2
99#define SPRHL_ALPHATEST 3
100
101typedef struct {
102 int origin[2];
103 int width;
106
107typedef struct {
110
111typedef struct {
112 float interval;
114
116
117typedef struct {
120
121#define IDSPRITEHEADER "IDSP",4
122 // little-endian "IDSP"
123
124
125
126
127
128
129
130
131#define MAX_SKINNAME 64
132#define IDSPRITE2HEADER "IDS2",4
133 // little-endian "IDS2"
134#define SPRITE2_VERSION 2
135
136typedef struct
137{
139 int origin_x, origin_y; // raster coordinates inside pic
140 char name[MAX_SKINNAME]; // name of pcx file
142
143typedef struct {
144 int ident;
147 dmd2sprframe_t frames[1]; // variable sized
149
150
unsigned int width
Definition: bymorphed.h:4
GLuint GLcharARB * name
Definition: glquake.h:155
synctype_t
Definition: modelgen.h:53
evalc_t origin
Definition: pr_menu.c:1356
synctype_t
Definition: spritegn.h:68
@ ST_RAND
Definition: spritegn.h:68
@ ST_SYNC
Definition: spritegn.h:68
spriteframetype_t
Definition: spritegn.h:115
@ SPR_ANGLED
Definition: spritegn.h:115
@ SPR_SINGLE
Definition: spritegn.h:115
@ SPR_GROUP
Definition: spritegn.h:115
Definition: spritegn.h:137
int origin_x
Definition: spritegn.h:139
int height
Definition: spritegn.h:138
Definition: spritegn.h:143
int numframes
Definition: spritegn.h:146
int ident
Definition: spritegn.h:144
int version
Definition: spritegn.h:145
Definition: spritegn.h:72
int version
Definition: spritegn.h:74
int numframes
Definition: spritegn.h:80
float boundingradius
Definition: spritegn.h:77
int width
Definition: spritegn.h:78
synctype_t synctype
Definition: spritegn.h:82
int type
Definition: spritegn.h:75
int ident
Definition: spritegn.h:73
int height
Definition: spritegn.h:79
float beamlength
Definition: spritegn.h:81
Definition: spritegn.h:101
int height
Definition: spritegn.h:104
int width
Definition: spritegn.h:103
Definition: spritegn.h:117
spriteframetype_t type
Definition: spritegn.h:118
Definition: spritegn.h:107
int numframes
Definition: spritegn.h:108
Definition: spritegn.h:111
float interval
Definition: spritegn.h:112