void draw_spikes_floor (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { struct spikes_floor *s = spikes_floor_at_pos (p); if (! s) return; draw_spikes_floor_floor (bitmap, p, em, vm); draw_spikes (bitmap, p, s, em, vm); }
ENTRYPOINT void draw_ball (ModeInfo *mi) { ball_configuration *bp = &bps[MI_SCREEN(mi)]; Display *dpy = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int c2; static const GLfloat bspec[4] = {1.0, 1.0, 1.0, 1.0}; static const GLfloat sspec[4] = {0.0, 0.0, 0.0, 1.0}; static const GLfloat bshiny = 128.0; static const GLfloat sshiny = 0.0; GLfloat bcolor[4] = {0.0, 0.0, 0.0, 1.0}; GLfloat scolor[4] = {0.0, 0.0, 0.0, 1.0}; if (!bp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context)); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_NORMALIZE); glEnable(GL_CULL_FACE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); glScalef(1.1, 1.1, 1.1); { double x, y, z; get_position (bp->rot, &x, &y, &z, !bp->button_down_p); glTranslatef((x - 0.5) * 8, (y - 0.5) * 8, (z - 0.5) * 15); gltrackball_rotate (bp->trackball); get_rotation (bp->rot, &x, &y, &z, !bp->button_down_p); glRotatef (x * 360, 1.0, 0.0, 0.0); glRotatef (y * 360, 0.0, 1.0, 0.0); glRotatef (z * 360, 0.0, 0.0, 1.0); } bcolor[0] = bp->colors[bp->ccolor].red / 65536.0; bcolor[1] = bp->colors[bp->ccolor].green / 65536.0; bcolor[2] = bp->colors[bp->ccolor].blue / 65536.0; c2 = (bp->ccolor + bp->color_shift) % bp->ncolors; scolor[0] = bp->colors[c2].red / 65536.0; scolor[1] = bp->colors[c2].green / 65536.0; scolor[2] = bp->colors[c2].blue / 65536.0; bp->ccolor++; if (bp->ccolor >= bp->ncolors) bp->ccolor = 0; mi->polygon_count = 0; glScalef (2.0, 2.0, 2.0); move_spikes (mi); glMaterialfv (GL_FRONT, GL_SPECULAR, bspec); glMateriali (GL_FRONT, GL_SHININESS, bshiny); glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, bcolor); glCallList (bp->ball_list); mi->polygon_count += (SPHERE_SLICES * SPHERE_STACKS); glMaterialfv (GL_FRONT, GL_SPECULAR, sspec); glMaterialf (GL_FRONT, GL_SHININESS, sshiny); glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, scolor); draw_spikes (mi); glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(dpy, window); }