Game end works this way now:
[crack-attack.git] / src / DrawScoreRecord.cxx
blob7a562fd3608c8faaf986b2508b45579bcf9dec5a
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 using namespace std;
34 #include "Game.h"
35 #include "Displayer.h"
36 #include "ScoreRecordManager.h"
37 #include "Score.h"
38 #include "Sine.h"
40 void Displayer::drawScoreToBeatMessage_inline_split_ ( )
42 if (!(MetaState::mode & CM_SOLO) ||
43 !(MetaState::state & MS_BOTH_KEY_WAIT))
44 return;
45 if ((MetaState::mode & CM_AI)) return;
47 glBindTexture(GL_TEXTURE_2D, score_to_beat_texture);
49 glPushMatrix();
51 glTranslatef(0.0f, DC_PLAY_OFFSET_Y + DC_GRID_ELEMENT_LENGTH
52 * 0.4f * GC_SAFE_HEIGHT, DC_PLAY_OFFSET_Z);
54 glScalef(DC_SCORE_TO_BEAT_SCALE, DC_SCORE_TO_BEAT_SCALE, 1.0f);
56 glCallList(message_2x1_list);
58 glPopMatrix();
61 void Displayer::drawScoreRecord_inline_split_ ( )
63 if (!(MetaState::mode & CM_SOLO)
64 || !(MetaState::state & MS_GAME_OVER_KEY_WAIT) || !WinRecord::won)
65 return;
66 if (MetaState::mode & CM_AI) return;
68 if (Game::time_step < DC_WIN_FADE_TIME) return;
70 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
72 glPushMatrix();
74 glTranslatef(0.0f, DC_PLAY_OFFSET_Y + DC_SCORE_REC_Y_OFFSET,
75 DC_PLAY_OFFSET_Z);
77 glScalef(DC_SCORE_REC_SCALE_X, DC_SCORE_REC_SCALE_Y, 1.0f);
79 for (int n = 0; n < DC_SCORE_REC_NUMBER_DRAW
80 && n <= ScoreRecordManager::top_rank; n++) {
81 if (ScoreRecordManager::top_rank - n >= GC_SCORE_REC_LENGTH) continue;
83 GLfloat y = (((DC_SCORE_REC_NUMBER_DRAW - 1) / 2.0f) - n)
84 * DC_SCORE_REC_RANK_HEIGHT - ScoreRecordManager::offset;
86 GLfloat yt = (y + DC_SCORE_REC_RANK_DRAW_HEIGHT / 2.0f)
87 * (PI / (2.0f * (DC_SCORE_REC_NUMBER_DRAW / 2.0f)
88 * DC_SCORE_REC_RANK_HEIGHT));
89 GLfloat yb = (y - DC_SCORE_REC_RANK_DRAW_HEIGHT / 2.0f)
90 * (PI / (2.0f * (DC_SCORE_REC_NUMBER_DRAW / 2.0f)
91 * DC_SCORE_REC_RANK_HEIGHT));
93 GLfloat yt_circle = Sine::sin(yt);
94 GLfloat yb_circle = Sine::sin(yb);
96 int texture = ScoreRecordManager::top_texture + n;
97 if (texture >= DC_SCORE_REC_NUMBER_DRAW)
98 texture -= DC_SCORE_REC_NUMBER_DRAW;
100 glBindTexture(GL_TEXTURE_2D, record_textures[texture]);
102 glBegin(GL_TRIANGLE_STRIP);
103 glTexCoord2f(0.0f, 1.0f);
104 glVertex3f(-1.0f, yb_circle, 0.0f);
105 glTexCoord2f(1.0f, 1.0f);
106 glVertex3f(1.0f, yb_circle, 0.0f);
107 glTexCoord2f(0.0f, 0.0f);
108 glVertex3f(-1.0f, yt_circle, 0.0f);
109 glTexCoord2f(1.0f, 0.0f);
110 glVertex3f(1.0f, yt_circle, 0.0f);
111 glEnd();
114 glPopMatrix();