Add missing ConsoleFont.c (bitmap font for console)
[attac-man.git] / render_player.c
blob34c5e8f952cbcdc753bc3f384d9003c8d7697d18
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_player.c,v 1.2 2003/11/30 17:43:55 nsubtil Exp $";
23 #ifdef _WIN32
24 #include <windows.h>
25 #endif
27 #include <SDL.h>
28 #include <GL/gl.h>
29 #include <GL/glu.h>
30 #include <stdio.h>
32 #include "object.h"
33 #include "game.h"
34 #include "screen.h"
35 #include "render.h"
37 #include "player.h"
39 void player_render(struct player *p)
41 glMatrixMode(GL_MODELVIEW);
42 glLoadIdentity();
44 glEnable(GL_LIGHTING);
45 glShadeModel(GL_SMOOTH);
47 glTranslatef(p->position[X], p->position[Y], p->position[Z]);
49 switch(p->direction)
51 case DIRECTION_RIGHT:
52 /* virado para ex */
53 glRotatef(90.0, 0.0, 1.0, 0.0);
54 break;
56 case DIRECTION_LEFT:
57 /* virado para -ex */
58 glRotatef(-90.0, 0.0, 1.0, 0.0);
59 break;
61 case DIRECTION_DOWN:
62 /* virado para -ez */
63 glRotatef(180.0, 0.0, 1.0, 0.0);
64 break;
67 glEnable(GL_COLOR_MATERIAL);
68 glDisable(GL_BLEND);
69 glDisable(GL_TEXTURE_2D);
70 glEnable(GL_DEPTH_TEST);
71 glDepthMask(GL_TRUE);
73 if(p->pill_time > 0.0)
74 glEnable(GL_LIGHT1);
76 switch(p->state)
78 case PLAYER_STATE_STOPPED:
79 render_dlist(&p->model_stopped[(int)p->current_frame % p->frames_stopped], p->color);
80 break;
82 case PLAYER_STATE_MOVING:
83 render_dlist(&p->model_moving[(int)p->current_frame % p->frames_moving], p->color);
84 break;
86 case PLAYER_STATE_DEAD:
87 render_dlist(&p->model_dying[(int)p->current_frame % p->frames_dying], p->color);
88 break;
90 case PLAYER_STATE_WON:
91 render_dlist(&p->model_won[(int)p->current_frame % p->frames_won], p->color);
92 break;
95 glDisable(GL_LIGHT1);