void controls_draw(int x, int y, state_t *state) { if((x > SEL_X + SEL_BUFFER || y < SEL_Y - SEL_BUFFER) && y < BOT_BAR - BOT_BAR_BUFFER) draw_prelight_grid(x, y, state); draw_scores(state); bar_draw(state); sel_draw(state); }
static void draw_main(int x, int y, state_t *state) { int ax = (x / GRID_SIZE) * GRID_SIZE, ay = (y / GRID_SIZE) * GRID_SIZE; float range = 0.0; grid_type g; if(ax > GRID_X * GRID_SIZE || ay > GRID_Y * GRID_SIZE) return; if(state->selected != TT_NONE) draw_prelight_grid(x, y, ax, ay); g = grid[ay/GRID_SIZE][ax/GRID_SIZE].g; glPushMatrix(); glTranslatef(ax + GRID_SIZE/2, ay + GRID_SIZE/2, 0.0); glBlendFunc(GL_SRC_ALPHA, GL_ONE); if(g == GRID_TYPE_TOWER) range = sqrtf(grid[ay/GRID_SIZE][ax/GRID_SIZE].t.range); if(state->selected != TT_NONE) { if(g != GRID_TYPE_NONE) { glColor3f(1.0, 0.0, 0.0); glCallList(DISPLAY_LIST_X); } else { range = tt_data[state->selected].tower.range; glColor3fv(tt_data[state->selected].color); glCallList(DISPLAY_LIST_TOWER); glColor3f(1.0, 1.0, 1.0); glCallList(DISPLAY_LIST_TOWER_BASE + state->selected); } } else { glColor3f(1.0, 1.0, 1.0); } /* draw range circle */ if(range != 0.0) { glScalef(range, range, 1.0); glColor3f(1.0, 0.2, 0.2); glBegin(GL_LINE_STRIP); glCallList(DISPLAY_LIST_CIRCLE); glEnd(); } glPopMatrix(); }