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.
38 #include "Displayer.h"
39 #include "WinRecord.h"
41 void Displayer::drawWinRecord ( )
43 glBindTexture(GL_TEXTURE_2D
, mote_textures
[MT_FIVE_POINTED_STAR
]);
46 if (MetaState::mode
& CM_SOLO
)
47 n
= DC_SOLO_STAR_ID
+ 1;
49 n
= GC_GAMES_PER_MATCH
;
51 Star
&star
= WinRecord::stars
[n
];
55 switch (WinRecord::record
[n
]) {
57 // game not yet played
59 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
60 DC_STAR_UNPLAYED_BLUE
);
61 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
62 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
63 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
64 glCallList(sparkle_list
);
69 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
70 DC_STAR_UNPLAYED_BLUE
);
71 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
72 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
73 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
74 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
75 glCallList(sparkle_list
);
80 // star has already faded out
81 if (WinRecord::current_game
!= n
)
82 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
83 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
86 else if (Game::time_step
< DC_CELEBRATION_TIME
) {
88 = Game::time_step
* (1.0f
/ (GLfloat
) DC_CELEBRATION_TIME
);
89 fade
= Game::sqrt(fade
);
90 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
91 DC_STAR_UNPLAYED_BLUE
, 1.0f
- (1.0f
- DC_STAR_LOST_ALPHA
) * fade
);
93 // star has already faded out
95 glColor4f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
96 DC_STAR_UNPLAYED_BLUE
, DC_STAR_LOST_ALPHA
);
98 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
99 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
100 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
101 glScalef(DC_STAR_SIZE_EQUILIBRIUM
, -DC_STAR_SIZE_EQUILIBRIUM
, 0.0f
);
102 glCallList(sparkle_list
);
107 // if we need to, draw the old star
108 if (WinRecord::draw_old_star
&& WinRecord::current_game
== n
) {
110 glColor3f(DC_STAR_UNPLAYED_RED
, DC_STAR_UNPLAYED_GREEN
,
111 DC_STAR_UNPLAYED_BLUE
);
112 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
113 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
114 glRotatef(WinRecord::old_star_a
, 0.0f
, 0.0f
, 1.0f
);
115 glScalef(WinRecord::old_star_size
, -WinRecord::old_star_size
, 0.0f
);
116 glCallList(sparkle_list
);
120 glColor3f(DC_STAR_WIN_RED
, DC_STAR_WIN_GREEN
, DC_STAR_WIN_BLUE
);
122 // star is static but displaced
123 if (n
== WinRecord::displaced_star
)
124 if (MetaState::mode
& CM_SOLO
)
125 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_SOLO_OFFSET_Y
,
126 DC_EXTERNAL_OFFSET_Z
);
128 glTranslatef(DC_STAR_WIN_OFFSET_X
, DC_STAR_WIN_OFFSET_Y
,
129 DC_EXTERNAL_OFFSET_Z
);
132 else if (n
== WinRecord::dynamic_star
)
133 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
134 + WinRecord::win_star_x
, DC_STAR_OFFSET_Y
+ WinRecord::win_star_y
,
135 DC_EXTERNAL_OFFSET_Z
);
137 // star is at rest in the standard location
139 glTranslatef(DC_STAR_OFFSET_X
+ DC_STAR_DISPLACEMENT
* n
,
140 DC_STAR_OFFSET_Y
, DC_EXTERNAL_OFFSET_Z
);
142 glRotatef(star
.a
, 0.0f
, 0.0f
, 1.0f
);
143 glScalef(star
.size
, -star
.size
, 0.0f
);
144 glCallList(sparkle_list
);
150 if (MetaState::mode
& CM_SOLO
) break;