/*----------------------------------------------------------------------------- Name : svCoverageRender Description : Callback which draws the coverage stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svCoverageRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; sdword width; fonthandle currentFont; char buftemp[50]; uword coverage; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svCoverageRegion = region; if (FELASTCALL(atom)) { svCoverageRegion = NULL; return; } if(svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; //maybe print UNKNOWN! } currentFont = fontMakeCurrent(svShipStatFont); coverage = svShipCoverage(info); if(coverage != 0) { sprintf(buftemp,"%d %s",coverage,ShipStatToNiceStr(CoverageUnits)); } else { sprintf(buftemp,"%s","-"); } sprintf(buf,ShipStatToNiceStr(Coverage),buftemp); width = fontWidthf("%s",buf); if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); fontPrintf( rect->x0,//rect->x1 - width, rect->y0, FEC_ListItemStandard, "%s",buf); fontMakeCurrent(currentFont); }
/*----------------------------------------------------------------------------- Name : svTopSpeedRender Description : Callback which draws the top speed stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svTopSpeedRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; fonthandle currentFont; char buftemp[50]; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svTopSpeedRegion = region; if (FELASTCALL(atom)) { svTopSpeedRegion = NULL; return; } if(svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; } currentFont = fontMakeCurrent(svShipStatFont); if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); //sprintf(buf,"%d", (uword)info->staticheader.maxvelocity); //topspeed contains a %d for the numerical location of the maxvelocity if(info->shiptype == Probe) { sprintf(buftemp,"%d",(udword) ((ProbeStatics *) info->custstatinfo)->ProbeDispatchMaxVelocity); sprintf(buf,ShipStatToNiceStr(TopSpeed),buftemp); } else { sprintf(buftemp,"%d",(udword) info->staticheader.maxvelocity); sprintf(buf,ShipStatToNiceStr(TopSpeed),buftemp); } fontPrintf( rect->x0, rect->y0, FEC_ListItemStandard, "%s", buf); fontMakeCurrent(currentFont); }
/*----------------------------------------------------------------------------- Name : svFirepowerRender Description : Callback which draws the firepower stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svFirepowerRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; fonthandle currentFont; uword firepower; char buftemp[50]; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svFirepowerRegion = region; if (FELASTCALL(atom)) { svFirepowerRegion = NULL; return; } if(svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; } currentFont = fontMakeCurrent(svShipStatFont); if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); if(info->svFirePower !=0) { firepower = (uword) info->svFirePower; } else { firepower = (uword) gunShipFirePower(info, Neutral); } if(firepower != 0) { sprintf(buftemp,"%d",firepower); } else { sprintf(buftemp,"%s","-"); } sprintf(buf,ShipStatToNiceStr(Firepower),buftemp); fontPrintf( rect->x0, rect->y0, FEC_ListItemStandard, "%s", buf); fontMakeCurrent(currentFont); }
void svShipManeuverability(ShipStaticInfo *statinfo,char *name) { sdword man=0; real32 turnspeed; if(statinfo->svManeuverability != 0) { man = statinfo->svManeuverability; calcmanjump: switch (man) { case 1: //very low sprintf(name,"%s",ShipStatToNiceStr(VeryLow)); break; case 2: //low sprintf(name,"%s",ShipStatToNiceStr(Low)); break; case 3: //medium sprintf(name,"%s",ShipStatToNiceStr(Medium)); break; case 4: //high sprintf(name,"%s",ShipStatToNiceStr(High)); break; case 5: //Very High sprintf(name,"%s",ShipStatToNiceStr(VeryHigh)); break; default: dbgFatalf(DBG_Loc,"Error Calculating Maneuverability"); } return; } //calculate maneuverability turnspeed = statinfo->turnspeedstat[TURN_YAW]+ statinfo->turnspeedstat[TURN_PITCH]+ statinfo->turnspeedstat[TURN_ROLL]; if(turnspeed < TW_SV_MAN_VERY_LOW) man=1; else if(turnspeed < TW_SV_MAN_LOW) man=2; else if(turnspeed < TW_SV_MAN_MEDIUM) man=3; else if(turnspeed < TW_SV_MAN_HIGH) man=4; else man=5; goto calcmanjump; }
/*----------------------------------------------------------------------------- Name : svMassRender Description : Callback which draws the mass stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svMassRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; fonthandle currentFont; sdword width; char buftemp[50]; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svMassRegion = region; if (FELASTCALL(atom)) { svMassRegion = NULL; return; } if(svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; } currentFont = fontMakeCurrent(svShipStatFont); //sprintf(buf, "%d", (uword)info->staticheader.mass); //Mass str contains a %d for the mass to expand into sprintf(buftemp,"%d",(udword)info->staticheader.mass); sprintf(buf,ShipStatToNiceStr(Mass),buftemp); width = fontWidthf("%s", buf); //width of number //ShipTypeStatToNiceStr(svShipType, Mass));//width of number if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); fontPrintf( rect->x0,//rect->x1 - width, rect->y0, FEC_ListItemStandard, "%s", buf); //ShipTypeStatToNiceStr(svShipType, Mass)); fontMakeCurrent(currentFont); }
/*----------------------------------------------------------------------------- Name : svArmorRender Description : Callback which draws the armor stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svArmorRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; sdword width; char buftemp[50]; fonthandle currentFont; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svArmorRegion = region; if (FELASTCALL(atom)) { svArmorRegion = NULL; return; } if(svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; } svArmorRegion = region; currentFont = fontMakeCurrent(svShipStatFont); sprintf(buftemp,"%d",(udword) info->maxhealth); sprintf(buf,ShipStatToNiceStr(Armor),buftemp); width = fontWidthf("%s",buf); if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); fontPrintf( rect->x0,//rect->x1 - width, rect->y0, FEC_ListItemStandard, "%s",buf); fontMakeCurrent(currentFont); }
/*----------------------------------------------------------------------------- Name : svManeuverRender Description : Callback which draws the maneuver stat in ship view. Inputs : standard FE callback Outputs : .. Return : void ----------------------------------------------------------------------------*/ void svManeuverRender(featom *atom, regionhandle region) { rectangle *rect = ®ion->rect; fonthandle currentFont; char maneuverability[100] = ""; ShipStaticInfo *info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race); svManeuverRegion = region; if (FELASTCALL(atom)) { svManeuverRegion = NULL; return; } if (svShipType == DefaultShip) { return; } if (info == NULL) { info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType)); } if (info == NULL) { return; } currentFont = fontMakeCurrent(svShipStatFont); if (RGLtype == SWtype) primRectSolid2(®ion->rect, FEC_Background); svShipManeuverability(info,maneuverability); sprintf(buf,ShipStatToNiceStr(Maneuver),maneuverability); fontPrintf( rect->x0, rect->y0, FEC_ListItemStandard, "%s",buf); fontMakeCurrent(currentFont); }