Fixes for datatype size on amd64.
[crack-attack.git] / src / DrawScoreRecord.cxx
blobd5f37e92fa1847b8919669769f854059829287fc
1 /*
2 * DrawScoreRecord.cxx
3 * Daniel Nelson - 12/7/1
5 * Copyright (C) 2000 Daniel Nelson
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Daniel Nelson - aluminumangel.org
22 * 174 W. 18th Ave.
23 * Columbus, OH 43210
25 * Draws the messages associated with the score record for solo play.
28 #include <GL/glut.h>
30 #include "glext.h"
32 #include "Game.h"
33 #include "Displayer.h"
34 #include "ScoreRecordManager.h"
35 #include "Score.h"
36 #include "Sine.h"
38 void Displayer::drawScoreToBeatMessage_inline_split_ ( )
40 if (!(MetaState::mode & CM_SOLO) ||
41 !(MetaState::state & MS_BOTH_KEY_WAIT))
42 return;
43 if ((MetaState::mode & CM_AI)) return;
45 glBindTexture(GL_TEXTURE_2D, score_to_beat_texture);
47 glPushMatrix();
49 glTranslatef(0.0f, DC_PLAY_OFFSET_Y + DC_GRID_ELEMENT_LENGTH
50 * 0.4f * GC_SAFE_HEIGHT, DC_PLAY_OFFSET_Z);
52 glScalef(DC_SCORE_TO_BEAT_SCALE, DC_SCORE_TO_BEAT_SCALE, 1.0f);
54 glCallList(message_2x1_list);
56 glPopMatrix();
59 void Displayer::drawScoreRecord_inline_split_ ( )
61 if (!(MetaState::mode & CM_SOLO)
62 || !(MetaState::state & MS_GAME_OVER_KEY_WAIT) || !WinRecord::won)
63 return;
64 if (MetaState::mode & CM_AI) return;
66 if (Game::time_step < DC_WIN_FADE_TIME) return;
68 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
70 glPushMatrix();
72 glTranslatef(0.0f, DC_PLAY_OFFSET_Y + DC_SCORE_REC_Y_OFFSET,
73 DC_PLAY_OFFSET_Z);
75 glScalef(DC_SCORE_REC_SCALE_X, DC_SCORE_REC_SCALE_Y, 1.0f);
77 for (int n = 0; n < DC_SCORE_REC_NUMBER_DRAW
78 && n <= ScoreRecordManager::top_rank; n++) {
79 if (ScoreRecordManager::top_rank - n >= GC_SCORE_REC_LENGTH) continue;
81 GLfloat y = (((DC_SCORE_REC_NUMBER_DRAW - 1) / 2.0f) - n)
82 * DC_SCORE_REC_RANK_HEIGHT - ScoreRecordManager::offset;
84 GLfloat yt = (y + DC_SCORE_REC_RANK_DRAW_HEIGHT / 2.0f)
85 * (PI / (2.0f * (DC_SCORE_REC_NUMBER_DRAW / 2.0f)
86 * DC_SCORE_REC_RANK_HEIGHT));
87 GLfloat yb = (y - DC_SCORE_REC_RANK_DRAW_HEIGHT / 2.0f)
88 * (PI / (2.0f * (DC_SCORE_REC_NUMBER_DRAW / 2.0f)
89 * DC_SCORE_REC_RANK_HEIGHT));
91 GLfloat yt_circle = Sine::sin(yt);
92 GLfloat yb_circle = Sine::sin(yb);
94 int texture = ScoreRecordManager::top_texture + n;
95 if (texture >= DC_SCORE_REC_NUMBER_DRAW)
96 texture -= DC_SCORE_REC_NUMBER_DRAW;
98 glBindTexture(GL_TEXTURE_2D, record_textures[texture]);
100 glBegin(GL_TRIANGLE_STRIP);
101 glTexCoord2f(0.0f, 1.0f);
102 glVertex3f(-1.0f, yb_circle, 0.0f);
103 glTexCoord2f(1.0f, 1.0f);
104 glVertex3f(1.0f, yb_circle, 0.0f);
105 glTexCoord2f(0.0f, 0.0f);
106 glVertex3f(-1.0f, yt_circle, 0.0f);
107 glTexCoord2f(1.0f, 0.0f);
108 glVertex3f(1.0f, yt_circle, 0.0f);
109 glEnd();
112 glPopMatrix();