/** ** Draw all units on visible map. ** FIXME: Must use the redraw tile flags in this function */ global void DrawUnits(void) { Unit* unit; Unit* table[MAX_UNITS]; int n; int i; // // Select all units touching the viewpoint. // n=SelectUnits(MapX,MapY,MapX+MapWidth,MapY+MapHeight,table); // // 2a) corpse aren't in the cache. // for( i=0; i<NumUnits; ++i ) { unit=Units[i]; if( unit->Type->Vanishes || unit->Command.Action==UnitActionDie ) { DrawUnit(unit); } } // // 2b) buildings // for( i=0; i<n; ++i ) { unit=table[i]; if( !unit->Removed && UnitVisible(unit) ) { if( unit->Type->Building ) { DrawBuilding(unit); table[i]=NoUnitP; } } else { table[i]=NoUnitP; } } // // 3) land/sea units // for( i=0; i<n; ++i ) { if( !(unit=table[i]) ) { continue; } if( unit->Type->UnitType!=UnitTypeFly ) { DrawUnit(unit); table[i]=NoUnitP; } } // // 5) flying units // for( i=0; i<n; ++i ) { if( !(unit=table[i]) ) { continue; } DrawUnit(unit); } }
void AmenBuilding::Display() { glPushMatrix(); glPushAttrib(GL_ALL_ATTRIB_BITS); glTranslatef(pos[0], pos[1], pos[2]); glScalef(scale[0], scale[1], scale[2]); glRotatef(rotation[1], 0.f, 1.f, 0.f); glRotatef(rotation[0], 1.f, 0.f, 0.f); glRotatef(rotation[2], 0.f, 0.f, 1.f); DrawBuilding(); glPopAttrib(); glPopMatrix(); }