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.
33 #include "Displayer.h"
34 #include "WinRecord.h"
36 void Displayer::drawWinRecord ( )
38 glBindTexture(GL_TEXTURE_2D
, mote_textures
[MT_FIVE_POINTED_STAR
]);
41 if (MetaState::mode
& CM_SOLO
)
42 n
= DC_SOLO_STAR_ID
+ 1;
44 n
= GC_GAMES_PER_MATCH
;
46 Star
&star
= WinRecord::stars
[n
];
50 switch (WinRecord::record
[n
]) {
52 // game not yet played
54 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
55 DC_STAR_UNPLAYED_BLUE
);
56 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
57 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
58 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
59 glCallList(sparkle_list
);
64 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
65 DC_STAR_UNPLAYED_BLUE
);
66 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
67 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
68 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
69 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
70 glCallList(sparkle_list
);
75 // star has already faded out
76 if (WinRecord::current_game
!= n
)
77 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
78 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
81 else if (Game::time_step
< DC_CELEBRATION_TIME
) {
83 = Game::time_step
* (1.0f
/ (GLfloat
) DC_CELEBRATION_TIME
);
84 fade
= Game::sqrt(fade
);
85 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
86 DC_STAR_UNPLAYED_BLUE
, 1.0f
- (1.0f
- DC_STAR_LOST_ALPHA
) * fade
);
88 // star has already faded out
90 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
91 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
93 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
94 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
95 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
96 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
97 glCallList(sparkle_list
);
102 // if we need to, draw the old star
103 if (WinRecord::draw_old_star
&& WinRecord::current_game
== n
) {
105 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
106 DC_STAR_UNPLAYED_BLUE
);
107 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
108 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
109 glRotatef(WinRecord::old_star_a
, 0.0f
, 0.0f
, 1.0f
);
110 glScalef(WinRecord::old_star_size
, -WinRecord::old_star_size
, 0.0f
);
111 glCallList(sparkle_list
);
115 glColor3f(DC_STAR_WIN_RED
, DC_STAR_WIN_GREEN
, DC_STAR_WIN_BLUE
);
117 // star is static but displaced
118 if (n
== WinRecord::displaced_star
)
119 if (MetaState::mode
& CM_SOLO
)
120 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_SOLO_OFFSET_Y
,
121 DC_EXTERNAL_OFFSET_Z
);
123 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_OFFSET_Y
,
124 DC_EXTERNAL_OFFSET_Z
);
127 else if (n
== WinRecord::dynamic_star
)
128 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
129 + WinRecord::win_star_x
, DC_STAR_OFFSET_Y
+ WinRecord::win_star_y
,
130 DC_EXTERNAL_OFFSET_Z
);
132 // star is at rest in the standard location
134 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
135 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
137 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
138 glScalef(star
.size
, -star
.size
, 0.0f
);
139 glCallList(sparkle_list
);
145 if (MetaState::mode
& CM_SOLO
) break;