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_ghost.c,v 1.2 2003/11/30 17:43:55 nsubtil Exp $";
40 void ghost_render(struct game
*game
, struct ghost
*g
)
42 GLfloat blue
[] = {0.1, 0.1, 1.0, 1.0};
44 glMatrixMode(GL_MODELVIEW
);
47 glEnable(GL_LIGHTING
);
48 glShadeModel(GL_SMOOTH
);
50 glTranslatef(g
->position
[X
], g
->position
[Y
], g
->position
[Z
]);
51 render_setup_model_direction(g
->direction
);
53 glEnable(GL_COLOR_MATERIAL
);
55 glDisable(GL_TEXTURE_2D
);
56 glEnable(GL_DEPTH_TEST
);
61 case GHOST_STATE_ACTIVE
:
62 if(g
->tainted
&& (game
->players
[0].pill_time
> 3.0 ||
63 (int)(game
->players
[0].pill_time
* 4.0) % 2 == 0))
64 render_dlist(&g
->model_active
[(int)g
->current_frame
% g
->frames_active
],
67 render_dlist(&g
->model_active
[(int)g
->current_frame
% g
->frames_active
],
71 case GHOST_STATE_DYING
:
72 if(g
->tainted
&& (game
->players
[0].pill_time
> 3.0 ||
73 (int)(game
->players
[0].pill_time
* 4.0) % 2 == 0))
74 render_dlist(&g
->model_dying
[(int)g
->current_frame
% g
->frames_dying
],
77 render_dlist(&g
->model_dying
[(int)g
->current_frame
% g
->frames_dying
],
81 case GHOST_STATE_DEAD
:
82 render_dlist(&g
->model_dead
[(int)g
->current_frame
% g
->frames_dead
], g
->color
);
85 case GHOST_STATE_RETURNING
:
86 render_dlist(&g
->model_returning
[(int)g
->current_frame
% g
->frames_returning
], g
->color
);
91 glTranslatef(g
->position
[X
], g
->position
[Y
], g
->position
[Z
]);
92 glColor4f(1.0, 1.0, 1.0, 1.0);
95 glVertex3f(0.0, 0.0, 0.0);
99 glVertex3f(-g
->time
* g
->speed
, 0.0, 0.0);
102 case DIRECTION_RIGHT
:
103 glVertex3f(g
->time
* g
->speed
, 0.0, 0.0);
107 glVertex3f(0.0, 0.0, g
->time
* g
->speed
);
111 glVertex3f(0.0, 0.0, -g
->time
* g
->speed
);