3 * Daniel Nelson - 9/30/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 swapper thing.
33 #include "Displayer.h"
35 #include "LightManager.h"
38 const GLfloat swapper_colors
[4][3]
39 = { { 1.0f
, 1.0f
, 1.0f
}, // normal
40 { 0.85f
, 0.85f
, 0.0f
}, // reverse control
41 { 0.0f
, 0.6f
, 0.05f
}, // invisible swapper
42 { 0.425f
, 0.725f
, 0.025f
} }; // both
44 void Displayer::drawSwapper ( )
46 // blocks have already been drawn, so we use their material calls
48 if (!X::invisibleSwapper())
49 glColor3fv(swapper_colors
[Swapper::color
]);
52 if (!X::needDrawSwapper()) return;
55 glColor4f(swapper_colors
[Swapper::color
][0],
56 swapper_colors
[Swapper::color
][1], swapper_colors
[Swapper::color
][2],
62 GLfloat x
= Swapper::x
* DC_GRID_ELEMENT_LENGTH
63 + (DC_PLAY_OFFSET_X
+ 0.5f
* DC_GRID_ELEMENT_LENGTH
);
64 GLfloat y
= Swapper::y
* DC_GRID_ELEMENT_LENGTH
+ play_offset_y
;
66 LightManager::setupGarbageLights(x
- (0.5f
* DC_GRID_ELEMENT_LENGTH
), y
,
69 if (Swapper::state
& SS_SWAPPING
) {
71 glTranslatef(x
, y
, DC_PLAY_OFFSET_Z
);
72 glRotatef(180.0f
* Swapper::swap_factor
, 0.0f
, 1.0f
, 0.0f
);
76 glTranslatef(-DC_SWAPPER_GRAB_LENGTH
, DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
77 glCallList(swapper_list
);
79 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
80 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
81 glScalef(-1.0f
, -1.0f
, 1.0f
);
82 glCallList(swapper_list
);
84 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
, 0.0f
);
85 glScalef(-1.0f
, 1.0f
, 1.0f
);
86 glCallList(swapper_list
);
88 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
89 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
90 glScalef(-1.0f
, -1.0f
, 1.0f
);
91 glCallList(swapper_list
);
95 glScalef(1.0f
, 1.0f
, -1.0f
);
97 glTranslatef(-DC_SWAPPER_GRAB_LENGTH
, DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
98 glCallList(swapper_list
);
100 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
101 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
102 glScalef(-1.0f
, -1.0f
, 1.0f
);
103 glCallList(swapper_list
);
105 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
, 0.0f
);
106 glScalef(-1.0f
, 1.0f
, 1.0f
);
107 glCallList(swapper_list
);
109 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
110 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
111 glScalef(-1.0f
, -1.0f
, 1.0f
);
112 glCallList(swapper_list
);
119 if (Swapper::state
& SS_MOVE_PAUSE
) {
120 GLfloat shift
= (Game::time_step
- Swapper::move_pause_alarm
)
121 * (1.0f
/ (GLfloat
) GC_MOVE_DELAY
);
124 if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_LEFT
)
126 else if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_RIGHT
)
128 else if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_UP
)
134 glTranslatef(x
, y
, DC_PLAY_OFFSET_Z
);
136 glCallList(swapper_list
);
138 glScalef(-1.0f
, -1.0f
, 1.0f
);
139 glCallList(swapper_list
);
141 glScalef(-1.0f
, 1.0f
, 1.0f
);
142 glCallList(swapper_list
);
144 glScalef(-1.0f
, -1.0f
, 1.0f
);
145 glCallList(swapper_list
);
149 if (X::invisibleSwapper())