1 /*
2  * Sprites.h
3  * Copyright (C) 2007 by Bryan Duff <duff0097@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20 #ifndef _SPRITE_H_
21 #define _SPRITE_H_
22 
23 #include "Quaternions.h"
24 #include <GL/gl.h>
25 #include <GL/glu.h>
26 #include "Files.h"
27 #include "TGALoader.h"
28 #include "Quaternions.h"
29 #include "Camera.h"
30 #include "Models.h"
31 #include "Fog.h"
32 //
33 // Model Structures
34 //
35 
36 #define maxsprites 2000
37 
38 #define muzzleflashsprite 1
39 #define smokesprite 2
40 #define smokespritenoup 3
41 #define flashsprite 6
42 #define grenadesprite 7
43 #define pinsprite 8
44 #define spoonsprite 9
45 #define bloodspritedown 10
46 #define bloodspritenoup 11
47 #define particlesspritedown 12
48 #define snowsprite 13
49 #define rainsprite 14
50 
51 #define bullet 4
52 #define bulletinstant 5
53 
54 class Sprites {
55 public:
56   GLuint flaretextureptr;
57   GLuint muzzleflaretextureptr;
58   GLuint smoketextureptr;
59   GLuint bullettextureptr;
60   GLuint bloodtextureptr;
61   GLuint raintextureptr;
62   GLuint snowtextureptr;
63 
64   int howmanysprites;
65 
66   XYZ location[maxsprites];
67   XYZ oldlocation[maxsprites];
68   XYZ velocity[maxsprites];
69   XYZ initialvelocity[maxsprites];
70   float size[maxsprites];
71   float initialsize[maxsprites];
72   float brightness[maxsprites];
73   float initialbrightness[maxsprites];
74   float color1[maxsprites];
75   float color2[maxsprites];
76   float color3[maxsprites];
77   float alivetime[maxsprites];
78   float rotation[maxsprites];
79   int type[maxsprites];
80   int owner[maxsprites];
81 
82   void draw();
83 
84   int DeleteSprite(int which);
85   int MakeSprite(int atype, float abrightness, float acolor1, float acolor2,
86                  float acolor3, XYZ alocation, XYZ avelocity, float asize);
87   int MakeSprite(int atype, float abrightness, float acolor1, float acolor2,
88                  float acolor3, XYZ alocation, XYZ avelocity, float asize,
89                  int aowner);
90 
91   void DoStuff();
92   void LoadMuzzleFlareTexture(char *fileName);
93   void LoadFlareTexture(char *fileName);
94   void LoadSmokeTexture(char *fileName);
95   void LoadBulletTexture(char *fileName);
96   void LoadBloodTexture(char *fileName);
97   void LoadSnowTexture(char *fileName);
98   void LoadRainTexture(char *fileName);
99 
~Sprites()100    ~Sprites() {
101     glDeleteTextures(1, (const GLuint *)&muzzleflaretextureptr);
102     glDeleteTextures(1, (const GLuint *)&flaretextureptr);
103     glDeleteTextures(1, (const GLuint *)&bullettextureptr);
104     glDeleteTextures(1, (const GLuint *)&smoketextureptr);
105     glDeleteTextures(1, (const GLuint *)&bloodtextureptr);
106     glDeleteTextures(1, (const GLuint *)&raintextureptr);
107     glDeleteTextures(1, (const GLuint *)&snowtextureptr);
108   };
109 };
110 
111 #endif
112