3 * Daniel Nelson - 11/5/0
5 * Copyright (C) 2000 Daniel Nelson
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
25 * Draws the little win record stars.
35 #include "Displayer.h"
36 #include "WinRecord.h"
38 void Displayer::drawWinRecord ( )
40 glBindTexture(GL_TEXTURE_2D
, mote_textures
[MT_FIVE_POINTED_STAR
]);
43 if (MetaState::mode
& CM_SOLO
)
44 n
= DC_SOLO_STAR_ID
+ 1;
46 n
= GC_GAMES_PER_MATCH
;
48 Star
&star
= WinRecord::stars
[n
];
52 switch (WinRecord::record
[n
]) {
54 // game not yet played
56 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
57 DC_STAR_UNPLAYED_BLUE
);
58 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
59 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
60 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
61 glCallList(sparkle_list
);
66 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
67 DC_STAR_UNPLAYED_BLUE
);
68 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
69 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
70 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
71 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
72 glCallList(sparkle_list
);
77 // star has already faded out
78 if (WinRecord::current_game
!= n
)
79 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
80 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
83 else if (Game::time_step
< DC_CELEBRATION_TIME
) {
85 = Game::time_step
* (1.0f
/ (GLfloat
) DC_CELEBRATION_TIME
);
86 fade
= Game::sqrt(fade
);
87 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
88 DC_STAR_UNPLAYED_BLUE
, 1.0f
- (1.0f
- DC_STAR_LOST_ALPHA
) * fade
);
90 // star has already faded out
92 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
93 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
95 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
96 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
97 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
98 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
99 glCallList(sparkle_list
);
104 // if we need to, draw the old star
105 if (WinRecord::draw_old_star
&& WinRecord::current_game
== n
) {
107 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
108 DC_STAR_UNPLAYED_BLUE
);
109 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
110 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
111 glRotatef(WinRecord::old_star_a
, 0.0f
, 0.0f
, 1.0f
);
112 glScalef(WinRecord::old_star_size
, -WinRecord::old_star_size
, 0.0f
);
113 glCallList(sparkle_list
);
117 glColor3f(DC_STAR_WIN_RED
, DC_STAR_WIN_GREEN
, DC_STAR_WIN_BLUE
);
119 // star is static but displaced
120 if (n
== WinRecord::displaced_star
)
121 if (MetaState::mode
& CM_SOLO
)
122 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_SOLO_OFFSET_Y
,
123 DC_EXTERNAL_OFFSET_Z
);
125 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_OFFSET_Y
,
126 DC_EXTERNAL_OFFSET_Z
);
129 else if (n
== WinRecord::dynamic_star
)
130 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
131 + WinRecord::win_star_x
, DC_STAR_OFFSET_Y
+ WinRecord::win_star_y
,
132 DC_EXTERNAL_OFFSET_Z
);
134 // star is at rest in the standard location
136 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
137 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
139 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
140 glScalef(star
.size
, -star
.size
, 0.0f
);
141 glCallList(sparkle_list
);
147 if (MetaState::mode
& CM_SOLO
) break;