void Selector::drawDot() { if(!Selector::compiled) return; setColor(1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0); setGLColor(); glCallList(Selector::dot); }
void Selector::draw() { if(!Selector::compiled) return; setColor(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); setGLColor(); glCallList(Selector::displayList); }
void Selector::drawArrow() { if(Model::getSelf()->selectedShip == Model::getSelf()->nullShip) return; if(Model::getSelf()->selectedShip->owner == Model::getSelf()->playerArray[0]) setColor(PLAYER_1_R, PLAYER_1_G, PLAYER_1_B, 1.0, 0.1, 0.5, 0.7); else setColor(PLAYER_2_R, PLAYER_2_G, PLAYER_2_B, 1.0, 0.1, 0.5, 0.7); setGLColor(); glPushMatrix(); glTranslatef(Model::getSelf()->selectedShip->loc->column*COL_SPACING, 0, Model::getSelf()->selectedShip->loc->row*ROW_SPACING); glRotatef(90, 0.0, 1.0, 0.0); float x = (float)(column*COL_SPACING-Model::getSelf()->selectedShip->loc->column*COL_SPACING); float y = (float)(row*ROW_SPACING-Model::getSelf()->selectedShip->loc->row*ROW_SPACING); float mag = sqrtf((x*x)+(y*y)); float rot = acos(y/mag)*180.0f/3.1415f + 180; if(column < Model::getSelf()->selectedShip->loc->column) rot*=-1; glRotatef(rot, 0.0, 1.0, 0.0); glScalef(mag, 1.0f, 1.0f); glCallList(Selector::arrow); glPopMatrix(); }
void Unit::draw() { if(!Unit::compiled) return; setType(type); setGLColor(); glCallList(Unit::typeList); if(this->owner == Model::getSelf()->playerArray[0]) //setColor(PLAYER_1_R, PLAYER_1_G, PLAYER_1_B, 1.0, 0.1, 0.5, 0.7); setColor(1.0, 0.0, 0.0, 1.0, 0.1, 0.5, 0.7); else //setColor(PLAYER_2_R, PLAYER_2_G, PLAYER_2_B, 1.0, 0.1, 0.5, 0.7); setColor(0.0, 0.0, 1.0, 1.0, 0.1, 0.5, 0.7); setGLColor(); glCallList(Unit::teamList); glPushMatrix(); glScalef((float)health/(float)maxHealth, 1.0, 1.0); glCallList(Unit::healthBar); glPopMatrix(); }
void Skybox::compileDL() { if(Skybox::compiled) return; Skybox::displayList = glGenLists(1); glNewList(Skybox::displayList, GL_COMPILE); setGLColor(); glBegin(GL_QUADS); //Ceiling glNormal3d(0.0, 1.0, 0.0); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); //West Wall glNormal3d(1.0, 0.0, 0.0); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, -ARENA_HEIGHT, ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, -ARENA_HEIGHT, -ARENA_LENGTH); //East Wall glNormal3d(-1.0, 0.0, 0.0); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, -ARENA_HEIGHT, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, -ARENA_HEIGHT, -ARENA_LENGTH); //North Wall glNormal3d(0.0, 0.0, 1.0); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, -ARENA_LENGTH); glVertex3d(ARENA_WIDTH, -ARENA_HEIGHT, -ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, -ARENA_HEIGHT, -ARENA_LENGTH); //South Wall glNormal3d(0.0, 0.0, -1.0); glVertex3d(-ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, ARENA_HEIGHT*4, ARENA_LENGTH); glVertex3d(ARENA_WIDTH, -ARENA_HEIGHT, ARENA_LENGTH); glVertex3d(-ARENA_WIDTH, -ARENA_HEIGHT, ARENA_LENGTH); glEnd(); glEndList(); Skybox::compiled = true; }
void Unit::draw() { if(!Unit::compiled) return; setGLColor(); glCallList(Unit::displayList); }
void Menu::draw(){ if(!Menu::compiled || !menuFlag) return; setGLColor(); glCallList(Menu::displayList); }
void Plant::draw( Vector3D *inPosition, double inScale, double inMaxZ, double inMinZ ) { if( mPoisoned && mPoisonStatus >= 1) { // draw nothing return; } double drawScale = inScale; if( mPoisoned ) { // shrink with poisoning drawScale *= ( 1 - mPoisonStatus ); } double radius = drawScale * ( mGrowth * 0.8 + 0.2 ); // leaves become black with poisoning // (shades of white to allow texture color to dominate) Color leafColor( 1 - mPoisonStatus, 1 - mPoisonStatus, 1 - mPoisonStatus, 1 ); if( ! Features::drawNicePlantLeaves ) { // set color to shades of green green for leaves if we're drawing // simple boxes, since there's no texture color leafColor.setValues( 0, 1 - mPoisonStatus, 0, 1 ); } Angle3D zeroAngle( 0, 0, 0 ); PlantGenetics *genetics = &( mSeeds.mGenetics ); int maxNumJoints = (int)( genetics->getParameter( jointCount ) ); double growthFactor = mGrowth * 0.8 + 0.2; int numFullJoints = (int)( growthFactor * maxNumJoints ); double partialJoint = growthFactor * maxNumJoints - numFullJoints; int numLeavesPerJoint = (int)( genetics->getParameter( leavesPerJoint ) ); Angle3D angleIncrement( 0, 0, 2 * M_PI / numLeavesPerJoint ); Angle3D startAngle( 0, 0, mStartZAngle ); double currentScale = 1; double scaleDecrement = currentScale / ( maxNumJoints + 1 ); Vector3D leafPosition( inPosition ); Vector3D positionIncrement( 0, 0, -0.5 ); Vector3D leafWalkerTerminus; SimpleVector<Vector3D *> thisLayerLeafTerminii; for( int j=0; j<numFullJoints; j++ ) { // lower leaves are darker double colorScaleFactor = (double)(j+1) / (double)maxNumJoints; // min scaling of 0.5 colorScaleFactor = colorScaleFactor * 0.5 + 0.5; Color thisLevelColor; thisLevelColor.setValues( &leafColor ); thisLevelColor.weightColor( colorScaleFactor ); Angle3D currentAngle( &startAngle ); double zValue = leafPosition.mZ; if( zValue <= inMaxZ && zValue >= inMaxZ ) { // draw this joint for( int g=0; g<numLeavesPerJoint; g++ ) { if( Features::drawShadows ) { // draw shadow glColor4f( 0, 0, 0, 0.5 ); mLeaf.draw( &leafPosition, ¤tAngle, currentScale * radius * 1.05 ); } // draw leaf setGLColor( &thisLevelColor ); mLeaf.draw( &leafPosition, ¤tAngle, currentScale * radius, &leafWalkerTerminus ); thisLayerLeafTerminii.push_back( new Vector3D( &leafWalkerTerminus ) ); currentAngle.add( &angleIncrement ); } // finally cap this joint setGLColor( &thisLevelColor ); mJointCapTexture->enable(); glBegin( GL_QUADS ); { double capRadius = currentScale * radius * 0.1; double capZ = leafPosition.mZ; glTexCoord2f( 0, 0 ); glVertex3d( leafPosition.mX - capRadius, leafPosition.mY - capRadius, capZ ); glTexCoord2f( 1, 0 ); glVertex3d( leafPosition.mX + capRadius, leafPosition.mY - capRadius, capZ ); glTexCoord2f( 1, 1 ); glVertex3d( leafPosition.mX + capRadius, leafPosition.mY + capRadius, capZ ); glTexCoord2f( 0, 1 ); glVertex3d( leafPosition.mX - capRadius, leafPosition.mY + capRadius, capZ ); } glEnd(); mJointCapTexture->disable(); } Angle3D angleToNextJoint( &angleIncrement ); angleToNextJoint.scale( 0.5 ); currentAngle.add( &angleToNextJoint ); // start next joint at our current angle startAngle.setComponents( ¤tAngle ); currentScale -= scaleDecrement; leafPosition.add( &positionIncrement ); } if( partialJoint > 0 ) { Angle3D currentAngle( &startAngle ); // darker as growing completes // lower leaves are darker double colorScaleFactor = (double)(numFullJoints+1) / (double)maxNumJoints; // min scaling of 0.5 colorScaleFactor = colorScaleFactor * 0.5 + 0.5; // scale factor comes into effect as partial joint reaches 1 colorScaleFactor = (1 - partialJoint) + colorScaleFactor * partialJoint; Color thisLevelColor; thisLevelColor.setValues( &leafColor ); thisLevelColor.weightColor( colorScaleFactor ); double zValue = leafPosition.mZ; if( zValue <= inMaxZ && zValue >= inMaxZ ) { // draw this joint for( int g=0; g<numLeavesPerJoint; g++ ) { if( Features::drawShadows ) { // draw shadow glColor4f( 0, 0, 0, 0.5 ); mLeaf.draw( &leafPosition, ¤tAngle, partialJoint * currentScale * radius * 1.05 ); } setGLColor( &thisLevelColor ); mLeaf.draw( &leafPosition, ¤tAngle, // scale down further by partial fraction partialJoint * currentScale * radius ); currentAngle.add( &angleIncrement ); } // finally cap this joint setGLColor( &thisLevelColor ); mJointCapTexture->enable(); glBegin( GL_QUADS ); { double capRadius = currentScale * radius * 0.1; double capZ = leafPosition.mZ; glTexCoord2f( 0, 0 ); glVertex3d( leafPosition.mX - capRadius, leafPosition.mY - capRadius, capZ ); glTexCoord2f( 1, 0 ); glVertex3d( leafPosition.mX + capRadius, leafPosition.mY - capRadius, capZ ); glTexCoord2f( 1, 1 ); glVertex3d( leafPosition.mX + capRadius, leafPosition.mY + capRadius, capZ ); glTexCoord2f( 0, 1 ); glVertex3d( leafPosition.mX - capRadius, leafPosition.mY + capRadius, capZ ); } glEnd(); mJointCapTexture->disable(); } } int numTerminii = thisLayerLeafTerminii.size(); int t; if( mGrowth >= 1 ) { // NOTE: // This method of collecting all leaf terminii for the plant ASSUMES // that each terminus is at a unique location // This seems like a safe assumption, given the way leaves are // arranged now, but it is not safe in the general case. // If two terminii are at the same location, the terminus collection // would finish before collecting all terminii if( !mLeafTerminiiSet ) { // not done collecting leaf terminii for full-growth plant int numExisting = mLeafTerminii.size(); char collision = false; for( int t=0; t<numTerminii && !collision; t++ ) { Vector3D *newTerminus = *( thisLayerLeafTerminii.getElement( t ) ); // make sure not the same as existing char same = false; for( int e=0; e<numExisting && !same; e++ ) { Vector3D *existing = *( mLeafTerminii.getElement( e ) ); if( existing->equals( newTerminus ) ) { same = true; collision = true; } } if( !same ) { // add to list of all terminii mLeafTerminii.push_back( new Vector3D( newTerminus ) ); } } if( collision ) { // we are back to drawing a layer that we've already drawn // before // so we're not gathering new leaf terminii anymore mLeafTerminiiSet = true; } } else { // don't try adding flowers if we already have more than // numTerminii // flowers int numTotalTerminii = mLeafTerminii.size(); int numFlowers = mFlowerTerminusIndicies.size(); int numFruit = mFruitTerminusIndices.size(); if( numFlowers < numTotalTerminii && mTimeSinceLastFlower >= genetics->getParameter( timeBetweenFlowers ) ) { // new flower // pick random, unflowered, unfruited terminus int numTries = 0; char found = false; int foundIndex = -1; while( ! found && numTries < 100 ) { foundIndex = globalRandomSource.getRandomBoundedInt( 0, numTotalTerminii - 1 ); found = true; int f; for( f=0; f<numFlowers && found; f++ ) { if( *( mFlowerTerminusIndicies.getElement( f ) ) == foundIndex ) { // collision with existing flower location found = false; } } for( f=0; f<numFruit && found; f++ ) { if( *( mFruitTerminusIndices.getElement( f ) ) == foundIndex ) { // collision with existing fruit location found = false; } } numTries++; } if( found ) { mFlowerTerminusIndicies.push_back( foundIndex ); mFlowerStages.push_back( 0 ); mFlowerAngles.push_back( new Angle3D( 0, 0, globalRandomSource.getRandomBoundedDouble( 0, 2 * M_PI ) ) ); } mTimeSinceLastFlower = 0; } // recount, since we may have added some numFlowers = mFlowerTerminusIndicies.size(); for( int f=0; f<numFlowers; f++ ) { int terminusIndex = *( mFlowerTerminusIndicies.getElement( f ) ); Vector3D *terminus = *( mLeafTerminii.getElement( terminusIndex ) ); double zValue = terminus->mZ; if( zValue <= inMaxZ && zValue >= inMaxZ ) { Angle3D *flowerAngle = *( mFlowerAngles.getElement( f ) ); double flowerStage = *( mFlowerStages.getElement( f ) ); mFlower.draw( terminus, flowerAngle, drawScale, flowerStage ); } } } // draw fruit int numFruit = mFruit.size(); for( int f=0; f<numFruit; f++ ) { int terminusIndex = *( mFruitTerminusIndices.getElement( f ) ); Vector3D *terminus = *( mLeafTerminii.getElement( terminusIndex ) ); double zValue = terminus->mZ; if( zValue <= inMaxZ && zValue >= inMaxZ ) { Angle3D *fruitAngle = *( mFruitAngles.getElement( f ) ); Fruit *thisFruit = *( mFruit.getElement( f ) ); double fruitScale = drawScale * 0.2; thisFruit->draw( terminus, fruitAngle, fruitScale ); if( mHighlightRipeFruit && thisFruit->isRipe() ) { // make sure this is the fruit that we will harvest // next // (the z-range drawing can screw us // up here, since we might draw fruits out-of-order) // thus, the first-drawn ripe fruit is not necessarily // the fruit that will be next harvested Fruit *fruitNextHarvested = peekAtRipeFruit(); if( thisFruit == fruitNextHarvested ) { // this fruit will be harvested next glColor4f( 1, 1, 1, 0.25 ); // highlight brightens only glBlendFunc( GL_SRC_ALPHA, GL_ONE ); drawBlurCircle( terminus, fruitScale ); // back to normal blend function glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); // only highlight one mHighlightRipeFruit = false; } } } } } // delete this layer's terminus points for( t=0; t<numTerminii; t++ ) { delete *( thisLayerLeafTerminii.getElement( t ) ); } }
void Unit::compileDL() { if(Unit::compiled) return; Unit::teamList = glGenLists(1); glNewList(Unit::teamList, GL_COMPILE); glPushMatrix(); gluSphere(gluNewQuadric(), 1, 36, 18); //glScalef(2.0, 2.0, 2.0); glBegin(GL_TRIANGLES); //glColor3f(10.0f,0.0f,0.0f); // red glVertex3f( 0.0f, 10.0f, 0.0f); // up-frontplane //glColor3f(0.0f,10.0f,0.0f); // green glVertex3f(-10.0f,-10.0f, 10.0f); // left-frontplane //glColor3f(0.0f,0.0f,1.0f); // blue glVertex3f( 10.0f,-10.0f, 10.0f); // right-frontplane //glColor3f(10.0f,0.0f,0.0f); // red glVertex3f( 0.0f, 10.0f, 0.0f); // up-backplane //glColor3f(0.0f,1.0f,0.0f); // green glVertex3f( 10.0f,-10.0f, -10.0f); // left-backplane //glColor3f(0.0f,0.0f,1.0f); // plane glVertex3f(-10.0f,-10.0f, -10.0f); // right-backplane glEnd(); glPopMatrix(); glEndList(); Unit::typeList = glGenLists(1); glNewList(Unit::typeList, GL_COMPILE); glPushMatrix(); gluSphere(gluNewQuadric(), 1, 36, 18); //glScalef(2.0, 2.0, 2.0); glBegin(GL_TRIANGLES); //glColor3f(10.0f,0.0f,0.0f); // red glVertex3f( 0.0f, 10.0f, 0.0f); // up-rightplane //glColor3f(0.0f,0.0f,10.0f); // blue glVertex3f( 10.0f,-10.0f, 10.0f); // left-rightplane //glColor3f(0.0f,01.0f,0.0f); // green glVertex3f( 10.0f,-10.0f, -10.0f); // right-rightplane //glColor3f(10.0f,0.0f,0.0f); // red glVertex3f( 0.0f, 10.0f, 0.0f); // up-leftplane //glColor3f(0.0f,0.0f,10.0f); // blue glVertex3f(-10.0f,-10.0f,-10.0f); // left-leftplane //glColor3f(0.0f,10.0f,0.0f); // green glVertex3f(-10.0f,-10.0f, 10.0f); // right-leftplane glEnd(); glPopMatrix(); glEndList(); Unit::healthBar = glGenLists(1); glNewList(Unit::healthBar, GL_COMPILE); setColor(0.0, 1.0, 0.0, 1.0, 0.1, 0.5, 0.7); setGLColor(); glBegin(GL_QUADS); glVertex3f(-10.0f, 10.0f, 0.0f); glVertex3f(-10.0f, 15.0f, 0.0f); glVertex3f(10.0f, 15.0f, 0.0f); glVertex3f(10.0f, 10.0f, 0.0f); glEnd(); glEndList(); Unit::compiled = true; }
void Hud::drawMapv() { if(!Hud::compiled) return; glPushMatrix(); glTranslatef(0.0, 0.0, -2); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslatef(-1000, -1000, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 's'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'p'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'a'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'c'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'e'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 't'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'o'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'b'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'u'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'y'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 's'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'h'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'i'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'p'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, '('); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, '1'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, '0'); glTranslatef(60, 40, 0.0); gluSphere(gluNewQuadric(), 40, 5, 5); glTranslatef(40, -40, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, ')'); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 0.0, -2); if(Model::getSelf()->playerturn == P_ONE_TURN) glColor3f(PLAYER_1_R, PLAYER_1_G, PLAYER_1_B); else glColor3f(PLAYER_2_R, PLAYER_2_G, PLAYER_2_B); glScalef(0.001, 0.001, 0.001); glTranslatef(-700, 800, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, '\''); glTranslatef(30, 0, 0.0); if(Model::getSelf()->playerturn == P_ONE_TURN) glutStrokeCharacter(GLUT_STROKE_ROMAN, 'q'); else glutStrokeCharacter(GLUT_STROKE_ROMAN, 'p'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, '\''); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 't'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'o'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'e'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'n'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'd'); glTranslatef(80, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 't'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'u'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'r'); glTranslatef(30, 0, 0.0); glutStrokeCharacter(GLUT_STROKE_ROMAN, 'n'); glPopMatrix(); setColor(0.5f, 0.5f, 0.5f, 1.0f, 0.1f, 0.5f, 0.7f); setGLColor(); glCallList(mapvDl); float dif = -2.0f/((float)NUM_TYPES+2.0f); glPushMatrix(); glTranslated(-1.5, 0.2, 0.0); glTranslatef(0.0, 1.0, -2.0); glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(200.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); strokeNumber(pOneShip->owner->numShips); glPopMatrix(); glPushMatrix(); glScalef(0.2, 0.2, 0.2); glRotatef(pOneRot, 0.0, 1.0, 0.0); glTranslated(0.0, 0.0, -0.4); glRotatef(80, 1.0f, 0.0f, 0.0f); pOneShip->numWaterUnits = ((float)pOneShip->owner->waterNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pOneShip->numEarthUnits = ((float)pOneShip->owner->earthNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pOneShip->numWindUnits = ((float)pOneShip->owner->windNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pOneShip->numFireUnits = ((float)pOneShip->owner->fireNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pOneShip->draw(); glPopMatrix(); for(int i = 0; i < NUM_TYPES; i++) { glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(200.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); if(i == 0) strokeNumber(pOneShip->owner->waterNodesOwned); else if(i == 1) strokeNumber(pOneShip->owner->earthNodesOwned); else if(i == 2) strokeNumber(pOneShip->owner->windNodesOwned); else if(i == 3) strokeNumber(pOneShip->owner->fireNodesOwned); else if(i == 4) strokeNumber(pOneShip->owner->darkNodesOwned); glPopMatrix(); glPushMatrix(); if(Model::getSelf()->playerturn == P_ONE_TURN) pOneRot+=0.1f; else pOneRot+=.01f; if(pOneRot == 360.0f) pOneRot = 0.0; glRotatef(pOneRot, 0.0, 1.0, 0.0); glRotatef(80, 1.0f, 0.0f, 0.0f); glScalef(0.1,0.1,0.1); pOneNodes[i]->draw(); glPopMatrix(); } glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(200.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); strokeNumber(pOneShip->owner->darkResources); glPopMatrix(); glRotatef(pOneRot, 0.0, 1.0, 0.0); gluSphere(gluNewQuadric(), 0.15, 5, 5); glPopMatrix(); glPushMatrix(); glTranslated(1.5, 0.2, 0.0); glTranslatef(0.0, 1.0, -2.0); glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(-270.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); glPushMatrix(); if(pTwoShip->owner->numShips > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->numShips > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->numShips); glPopMatrix(); glPopMatrix(); glPushMatrix(); glScalef(0.2, 0.2, 0.2); glRotatef(pTwoRot, 0.0, 1.0, 0.0); glTranslated(0.0, 0.0, -0.4); glRotatef(80, 1.0f, 0.0f, 0.0f); pTwoShip->numWaterUnits = ((float)pTwoShip->owner->waterNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pTwoShip->numEarthUnits = ((float)pTwoShip->owner->earthNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pTwoShip->numWindUnits = ((float)pTwoShip->owner->windNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pTwoShip->numFireUnits = ((float)pTwoShip->owner->fireNodesOwned/(float)(pOneShip->owner->nodesOwned-pOneShip->owner->darkNodesOwned))*MAX_UNITS; pTwoShip->draw(); glPopMatrix(); for(int i = 0; i < NUM_TYPES; i++) { glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(-270.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); if(i == 0) { glPushMatrix(); if(pTwoShip->owner->waterNodesOwned > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->waterNodesOwned > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->waterNodesOwned); glPopMatrix(); } else if(i == 1) { glPushMatrix(); if(pTwoShip->owner->earthNodesOwned > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->earthNodesOwned > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->earthNodesOwned); glPopMatrix(); } else if(i == 2) { glPushMatrix(); if(pTwoShip->owner->windNodesOwned > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->windNodesOwned> 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->windNodesOwned); glPopMatrix(); } else if(i == 3) { glPushMatrix(); if(pTwoShip->owner->fireNodesOwned > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->fireNodesOwned > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->fireNodesOwned); glPopMatrix(); } else if(i == 4) { glPushMatrix(); if(pTwoShip->owner->darkNodesOwned > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->darkNodesOwned > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->darkNodesOwned); glPopMatrix(); } glPopMatrix(); glPushMatrix(); if(Model::getSelf()->playerturn == P_TWO_TURN) pTwoRot+=0.1f; else pTwoRot+=0.01f; if(pTwoRot == 360.0f) pTwoRot = 0.0; glRotatef(pTwoRot, 0.0, 1.0, 0.0); glRotatef(80, 1.0f, 0.0f, 0.0f); glScalef(0.1,0.1,0.1); pTwoNodes[i]->draw(); glPopMatrix(); } glTranslatef(0.0, dif, 0.0); glPushMatrix(); //glTranslated(0.1, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); glScalef(0.001, 0.001, 0.001); glTranslated(-270.0, 0.0, 0.0); //glRotated(-90, 1.0, 0.0, 0.0); glPushMatrix(); if(pTwoShip->owner->darkResources > 10) glTranslatef(-180, 0.0, 0.0); if(pTwoShip->owner->darkResources > 100) glTranslatef(-180, 0.0, 0.0); strokeNumber(pTwoShip->owner->darkResources); glPopMatrix(); glPopMatrix(); glRotatef(pTwoRot, 0.0, 1.0, 0.0); gluSphere(gluNewQuadric(), 0.15, 5, 5); glPopMatrix(); //if (Model::getSelf()->zoom < 0) // TextPrint::hudText(0, 17, -2, 0.77f, 0.29f, 0.13f,GLUT_BITMAP_TIMES_ROMAN_24, "WARNING: ZOOMED PAST RECOMENDED AREA"); }