/*********************** * Johnny Jetpack * by Paul Adam and Jamie Bradley * * drawlava.c * * this file contains all the functions needed to place lava * in the game environment. *************************/ #include #include #include #include "johnny.h" #include "animation.h" GLfloat LavaColor[4] = {1.0, 0.0, 0.0, 1.0}; void UpdateLavaColor(void) { static float inc = .1; if(LavaColor[1] < 0 || LavaColor[1] > 1) inc = -inc; LavaColor[1] += inc; } void DrawLava(int bxmin, int bxmax, int bymin, int bymax, int bzmin, int bzmax) { glPushMatrix(); glTranslatef((bxmin+bxmax)/2, (bymin+bymax)/2, (bzmin+bzmax)/2); glScalef(abs(bxmin-bxmax), abs(bymin-bymax), abs(bzmin - bzmax)); UpdateLavaColor(); glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, LavaColor); glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, LavaColor); glutSolidCube(1); glPopMatrix(); } void DrawAllLava(void) { int i; for(i=0; i