console: Format tabs semi-intelligently
[attac-man.git] / render_shot.c
blob085c42fd691b7f23eda60447d1a56c0cd3a9f305
1 /*
2 Pacman Arena
3 Copyright (C) 2003 Nuno Subtil
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
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.
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, USA.
20 static const char cvsid[] =
21 "$Id: render_shot.c,v 1.3 2003/11/30 17:43:55 nsubtil Exp $";
23 #ifdef _WIN32
24 #include <windows.h>
25 #endif
27 #include <GL/gl.h>
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <string.h>
32 #include "game.h"
33 #include "player.h"
34 #include "ghost.h"
35 #include "map.h"
36 #include "render.h"
37 #include "m_math.h"
38 #include "object.h"
39 #include "particle.h"
40 #include "audio.h"
42 #include "shot.h"
43 #include "render_shot.h"
44 #include "render_particle.h"
46 void shot_render_opaque(struct game *game, int shot_no)
48 struct shot *shot;
50 shot = &game->shots[shot_no];
51 if(shot->state == SHOT_STATE_DEAD)
52 return;
54 glMatrixMode(GL_MODELVIEW);
55 glLoadIdentity();
57 glEnable(GL_LIGHTING);
58 glShadeModel(GL_SMOOTH);
60 glTranslatef(shot->position[X], shot->position[Y], shot->position[Z]);
61 render_setup_model_direction(shot->direction);
63 glEnable(GL_COLOR_MATERIAL);
64 glDisable(GL_BLEND);
65 glDisable(GL_TEXTURE_2D);
66 glEnable(GL_DEPTH_TEST);
67 glDepthMask(GL_TRUE);
69 render_dlist(&shot->model[(int)shot->time % shot->frames],
70 game->players[shot->owner].color);
73 void shot_render_translucent(struct game *game, int player_no, int shot_no)
75 struct shot *shot;
77 shot = &game->shots[shot_no];
79 if(shot->type == SHOT_TYPE_ROCKET)
80 particle_render_src(game, player_no, shot->particle_trail);