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.
38 #include "Displayer.h"
40 #include "LightManager.h"
43 const GLfloat swapper_colors
[4][3]
44 = { { 1.0f
, 1.0f
, 1.0f
}, // normal
45 { 0.85f
, 0.85f
, 0.0f
}, // reverse control
46 { 0.0f
, 0.6f
, 0.05f
}, // invisible swapper
47 { 0.425f
, 0.725f
, 0.025f
} }; // both
49 void Displayer::drawSwapper ( )
51 // blocks have already been drawn, so we use their material calls
53 if (!X::invisibleSwapper())
54 glColor3fv(swapper_colors
[Swapper::color
]);
57 if (!X::needDrawSwapper()) return;
60 glColor4f(swapper_colors
[Swapper::color
][0],
61 swapper_colors
[Swapper::color
][1], swapper_colors
[Swapper::color
][2],
67 GLfloat x
= Swapper::x
* DC_GRID_ELEMENT_LENGTH
68 + (DC_PLAY_OFFSET_X
+ 0.5f
* DC_GRID_ELEMENT_LENGTH
);
69 GLfloat y
= Swapper::y
* DC_GRID_ELEMENT_LENGTH
+ play_offset_y
;
71 LightManager::setupGarbageLights(x
- (0.5f
* DC_GRID_ELEMENT_LENGTH
), y
,
74 if (Swapper::state
& SS_SWAPPING
) {
76 glTranslatef(x
, y
, DC_PLAY_OFFSET_Z
);
77 glRotatef(180.0f
* Swapper::swap_factor
, 0.0f
, 1.0f
, 0.0f
);
81 glTranslatef(-DC_SWAPPER_GRAB_LENGTH
, DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
82 glCallList(swapper_list
);
84 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
85 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
86 glScalef(-1.0f
, -1.0f
, 1.0f
);
87 glCallList(swapper_list
);
89 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
, 0.0f
);
90 glScalef(-1.0f
, 1.0f
, 1.0f
);
91 glCallList(swapper_list
);
93 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
94 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
95 glScalef(-1.0f
, -1.0f
, 1.0f
);
96 glCallList(swapper_list
);
100 glScalef(1.0f
, 1.0f
, -1.0f
);
102 glTranslatef(-DC_SWAPPER_GRAB_LENGTH
, DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
103 glCallList(swapper_list
);
105 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
106 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
107 glScalef(-1.0f
, -1.0f
, 1.0f
);
108 glCallList(swapper_list
);
110 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
, 0.0f
);
111 glScalef(-1.0f
, 1.0f
, 1.0f
);
112 glCallList(swapper_list
);
114 glTranslatef(2.0f
* DC_SWAPPER_GRAB_LENGTH
,
115 -2.0f
* DC_SWAPPER_GRAB_LENGTH
, 0.0f
);
116 glScalef(-1.0f
, -1.0f
, 1.0f
);
117 glCallList(swapper_list
);
124 if (Swapper::state
& SS_MOVE_PAUSE
) {
125 GLfloat shift
= (Game::time_step
- Swapper::move_pause_alarm
)
126 * (1.0f
/ (GLfloat
) GC_MOVE_DELAY
);
129 if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_LEFT
)
131 else if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_RIGHT
)
133 else if ((Swapper::state
& SS_MOVE_MASK
) & SS_MOVE_UP
)
139 glTranslatef(x
, y
, DC_PLAY_OFFSET_Z
);
141 glCallList(swapper_list
);
143 glScalef(-1.0f
, -1.0f
, 1.0f
);
144 glCallList(swapper_list
);
146 glScalef(-1.0f
, 1.0f
, 1.0f
);
147 glCallList(swapper_list
);
149 glScalef(-1.0f
, -1.0f
, 1.0f
);
150 glCallList(swapper_list
);
154 if (X::invisibleSwapper())