/*----------------------------------------------------------------------------- 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); }
/*----------------------------------------------------------------------------- Name : gpTextEntryWindowInit Description : Inputs : Outputs : Return : ----------------------------------------------------------------------------*/ void gpTextEntryWindowInit(char *name, featom *atom) { if (FEFIRSTCALL(atom)) { // initialize button here gpNameEntryBox = (textentryhandle)atom->pData; // uicTextEntrySet(gpNameEntryBox,gpTextEntryName,strlen(gpTextEntryName)+1); uicTextBufferResize(gpNameEntryBox,GP_GAMENAME_LENGTH-2); bitSet(gpNameEntryBox->textflags, UICTE_FileName); return; } else if ((FELASTCALL(atom))) { gpNameEntryBox = NULL; return; } switch (uicTextEntryMessage(atom)) { case CM_LoseFocus : case CM_AcceptText : strcpy(gpTextEntryName,gpNameEntryBox->textBuffer); break; case CM_GainFocus : break; } }
/*----------------------------------------------------------------------------- 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 : 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); }
/*----------------------------------------------------------------------------- Name : gpGameWindowInit Description : Inputs : Outputs : Return : ----------------------------------------------------------------------------*/ void gpGameWindowInit(char *name, featom *atom) { fonthandle oldfont; sdword index; if (FEFIRSTCALL(atom)) { if (strcmp(name,"FE_RecordedGameWindowInit") == 0) { SavedGamesPath = RecordedGamesPath; } else if (strcmp(name,"FE_TutorialGameWindowInit") == 0) { SavedGamesPath = TutorialSavedGamesPath; tutorial = TUTORIAL_ONLY; gpLoadTutorial = TRUE; gpLoadSinglePlayerGame = TRUE; } else { if (gameIsRunning) { if (singlePlayerGame) { gpLoadSinglePlayerGame = TRUE; } else { gpLoadSinglePlayerGame = FALSE; } gpLoadTutorial = (tutorial==TUTORIAL_ONLY) ? TRUE : FALSE; } else { if (mgRunning) { gpLoadSinglePlayerGame = FALSE; } else { gpLoadSinglePlayerGame = TRUE; } gpLoadTutorial = (tutorial==TUTORIAL_ONLY) ? TRUE : FALSE; } if (gpLoadSinglePlayerGame) { SavedGamesPath = gpLoadTutorial ? TutorialSavedGamesPath : SinglePlayerSavedGamesPath; } else { SavedGamesPath = MultiPlayerSavedGamesPath; } } gpTitleListLoad(); oldfont = fontMakeCurrent(gpListFont); gpGameListWindow = (listwindowhandle)atom->pData; uicListWindowInit(gpGameListWindow, NULL, // title draw, no title NULL, // title click process, no title 0, // title height, no title gpGameItemDraw, // item draw function fontHeight(" ")+GP_VertSpacing, // item height UICLW_CanSelect|UICLW_CanHaveFocus); for (index = 0; index < gpNumberGames; index++) { if (index == 0) { uicListAddItem(gpGameListWindow, (ubyte *)&gpGames[index], UICLI_CanSelect|UICLI_Selected, UICLW_AddToTail); gpCurrentSelected = 0; } else { uicListAddItem(gpGameListWindow, (ubyte *)&gpGames[index], UICLI_CanSelect, UICLW_AddToTail); } } fontMakeCurrent(oldfont); return; } else if (FELASTCALL(atom)) { gpGameListWindow = NULL; return; } else if (gpGameListWindow->message == CM_NewItemSelected) { if (gpNameEntryBox != NULL) { uicTextEntrySet(gpNameEntryBox, ((gpgame *)gpGameListWindow->CurLineSelected->data)->title,strlen(((gpgame *)gpGameListWindow->CurLineSelected->data)->title)); } } }