- glPushMatrix();
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialYellow);
-
- {
- int pos = sp->sphere_position;
- int ppos = sp->sphere_position - 3;
- int npos = sp->sphere_position + 3;
- GLfloat spx, spy, spz;
- GLfloat dx, dy, dz;
- int div;
-
- if (ppos < 0) ppos += NPOSITIONS;
- if (npos >= NPOSITIONS) npos -= NPOSITIONS;
-
- if (sp->sphere_tick < 0)
- {
- dx = positions[ppos] - positions[pos];
- dy = positions[ppos+1] - positions[pos+1];
- dz = positions[ppos+2] - positions[pos+2];
- div = SPHERE_TICKS + sp->sphere_tick;
- }
- else
- {
- dx = positions[npos] - positions[pos];
- dy = positions[npos+1] - positions[pos+1];
- dz = positions[npos+2] - positions[ppos+2];
- div = SPHERE_TICKS - sp->sphere_tick;
- }
-
- spx = positions[pos];
- spy = positions[pos+1];
- spz = positions[pos+2];
- if (div != 0)
- {
- spx += dx / div;
- spy += dy / div;
- spz += dz / div;
- }
-
-
- spy -= 0.5; /* move the bottom of the ball closer to the stairs */
-
-
-#ifdef DEBUG
- fprintf(stderr, "%3d %3d %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f\n",
- sp->sphere_position, sp->sphere_tick,
- dx, dy, dz,
- spx, spy, spz);