コード例 #1
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->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);
}
コード例 #2
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    Name        : tmNumberRUsDraw
    Description : Callback to draw number of RU's available
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void tmNumberRUsDraw(featom *atom, regionhandle region)
{
    sdword width;
    fonthandle oldfont;
    rectangle rect = region->rect;
    tmNumberRUsRegion = region;

    oldfont = fontMakeCurrent(tmTechListFont);
    width = fontWidthf("%d", universe.curPlayerPtr->resourceUnits);//width of number

    primModeSet2();
    primRectSolid2(&rect, colRGB(0, 0, 0));

    glEnable(GL_SCISSOR_TEST);
    glScissor(rect.x0, MAIN_WindowHeight - rect.y1, rect.x1 - rect.x0, rect.y1 - rect.y0);
    glClear(GL_DEPTH_BUFFER_BIT);
    glDisable(GL_SCISSOR_TEST);

    feStaticRectangleDraw(region);                          //draw regular rectangle as backdrop
    fontPrintf(region->rect.x1 - width - TM_RUMarginRight,
               (region->rect.y1 - region->rect.y0 - fontHeight(NULL)) / 2 + region->rect.y0,
               atom->borderColor, "%d", universe.curPlayerPtr->resourceUnits);

    fontMakeCurrent(oldfont);
}
コード例 #3
0
void hrDrawChatBox(featom *atom, regionhandle region)
{
    fonthandle currentfont;
    sdword     x,y,i;
    char       name[128];

    hrChatBoxRegion = region;

    currentfont = fontMakeCurrent(playernamefont);

    primRectSolid2(&region->rect,colRGB(0,0,0));
    feStaticRectangleDraw(region);

    x = region->rect.x0+10;
    y = region->rect.y0;

    for (i=0;i<NUM_CHAT_LINES;i++)
    {
        if (chathistory[i].message[0]!=0)
        {
            x = region->rect.x0;
            sprintf(name,"%s >",tpGameCreated.playerInfo[chathistory[i].packetheader.frame].PersonalName);
            fontPrintf(x,y,tpGameCreated.playerInfo[chathistory[i].packetheader.frame].baseColor,"%s",name);
            x+=fontWidth(name)+10;
            //fontShadowSet(FS_E | FS_SE | FS_S);
            fontPrintf(x,y,hrChatTextColor,"%s",chathistory[i].message);
            //fontShadowSet(FS_NONE);
            y+= fontHeight(" ");
        }
    }

    fontMakeCurrent(currentfont);
}
コード例 #4
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->rect, FEC_Background);

    fontPrintf(
        rect->x0,//rect->x1 - width,
        rect->y0,
        FEC_ListItemStandard,
        "%s",buf);

    fontMakeCurrent(currentFont);
}
コード例 #5
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->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);
}
コード例 #6
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->rect, FEC_Background);

    fontPrintf(
        rect->x0,//rect->x1 - width,
        rect->y0,
        FEC_ListItemStandard,
        "%s",
        buf);
        //ShipTypeStatToNiceStr(svShipType, Mass));

    fontMakeCurrent(currentFont);
}
コード例 #7
0
ファイル: gamepick.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : gpGameNameDraw
    Description : Draw the currently selected game name in screens other
                    than the game picker.
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void gpGameNameDraw(featom *atom, regionhandle region)
{
    fonthandle fhSave;
    char gameName[128];

    rectangle *r = &region->rect;

    fhSave = fontMakeCurrent(gpNameFont); //select the appropriate font
    memStrncpy(gameName, gpGames[gpCurrentSelected].title, 127);
    _strupr(gameName);
    fontPrintf(r->x0, r->y0, GP_SelectedColor, gameName);
    fontMakeCurrent(fhSave);
}
コード例 #8
0
ファイル: scenpick.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : spScenarioBitmap
    Description :
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void spScenarioBitmap(featom *atom, regionhandle region)
{
    rectangle textureRect;
    sdword index, y;
    fonthandle oldFont;

    textureRect.x0 = region->rect.x0 + SCP_TEXTURE_INSET;
    textureRect.y0 = region->rect.y0 + SCP_TEXTURE_INSET;
    textureRect.x1 = region->rect.x1 - SCP_TEXTURE_INSET;
    textureRect.y1 = region->rect.y1 - SCP_TEXTURE_INSET;

    //draw the bitmap...
    if (scenarioTexture != TR_InvalidInternalHandle)
    {
        if (glcActive())
        {
            glcRectSolidTexturedScaled2(&textureRect,
                                        spTextureWidth, spTextureHeight,
                                        spTextureData, NULL, TRUE);
        }
        else
        {
            trRGBTextureMakeCurrent(scenarioTexture);
            rndPerspectiveCorrection(FALSE);
            primRectSolidTextured2(&textureRect);               //draw the bitmap
        }
        feStaticRectangleDraw(region);                      //draw a border
    }
    //draw the description text...
    if (spDescription != NULL)
    {                                                       //if there is description text
        dbgAssert(spDescriptionFont != FONT_InvalidFontHandle);
        oldFont = fontMakeCurrent(spDescriptionFont);       //set the font
        if (spDescriptionShadow)
        {                                                   //optionally enable dropshadow
            fontShadowSet(FS_SE, colBlack);
        }
        for (index = 0, y = textureRect.y0; index < spNDescriptionLines; index++)
        {                                                   //draw each line
            dbgAssert(spDescriptionLines[index] != NULL);
            if (y + fontHeight(" ") >= textureRect.y1)
            {                                               //if this line will extend off bottom of region
                break;
            }
            fontPrint(textureRect.x0, y, spDescriptionColor, spDescriptionLines[index]);
            y += fontHeight(" ") + 1;
        }
        fontShadowSet(FS_NONE, colBlack);
        fontMakeCurrent(oldFont);
    }
}
コード例 #9
0
ファイル: scenpick.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : spScenarioWindowInit
    Description :
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void spScenarioWindowInit(char *name, featom *atom)
{
    fonthandle  oldfont;
    sdword      index;

    if (FEFIRSTCALL(atom))
    {
        oldfont = fontMakeCurrent(spListFont);

        spScenarioListWindow = (listwindowhandle)atom->pData;

        uicListWindowInit(spScenarioListWindow,
                          NULL,                             // title draw, no title
                          NULL,                             // title click process, no title
                          0/*fontHeight(" ")*2*/,                // title height, no title
                          spScenarioItemDraw,               // item draw function
                          fontHeight(" ")+SCP_VertSpacing,   // item height
                          UICLW_CanSelect|UICLW_CanHaveFocus);


        //spScenarioListWindow->reg.flags |=

        for (index = 0; index < spNumberScenarios; index++)
        {
            if (index==spCurrentSelected)
                uicListAddItem(spScenarioListWindow, (ubyte *)&spScenarios[index], UICLI_CanSelect|UICLI_Selected, UICLW_AddToTail);
            else
                uicListAddItem(spScenarioListWindow, (ubyte *)&spScenarios[index], UICLI_CanSelect, UICLW_AddToTail);
        }

        fontMakeCurrent(oldfont);
        return;
    }
    else
    {
        switch (spScenarioListWindow->message)
        {
            case CM_AcceptText:
                spDonePicking(NULL,NULL);
                break;
            case CM_DoubleClick:

                spDonePicking(NULL,NULL);
                break;
            case CM_NewItemSelected:
                spNewItem();

        }
    }
}
コード例 #10
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->rect, FEC_Background);

    fontPrintf(
        rect->x0,//rect->x1 - width,
        rect->y0,
        FEC_ListItemStandard,
        "%s",buf);

    fontMakeCurrent(currentFont);
}
コード例 #11
0
/*-----------------------------------------------------------------------------
    Name        : gpGameNameDraw
    Description : Draw the currently selected game name in screens other
                    than the game picker.
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void gpGameNameDraw(featom *atom, regionhandle region)
{
    fonthandle fhSave;
    char gameName[128];
    char curr_ch;
    unsigned int i;

    rectangle *r = &region->rect;

    fhSave = fontMakeCurrent(gpNameFont); //select the appropriate font
    for (i = 0; i < 127 && (curr_ch = gpGames[gpCurrentSelected].title[i]); i++)
        gameName[i] = toupper(curr_ch);
    gameName[i] = '\0';
    fontPrintf(r->x0, r->y0, GP_SelectedColor, gameName);
    fontMakeCurrent(fhSave);
}
コード例 #12
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    Name        : tmSelectTechType
    Description : Find what type of tech was selected
    Inputs      : reg - region clicked on
                  yClicked - vertical location clicked on.
    Outputs     :
    Return      : type of tech clicked on or -1 if none
----------------------------------------------------------------------------*/
sdword tmSelectTechType(regionhandle region, sdword yClicked)
{
    sdword index, y, numlines, startind;
    fonthandle currentFont;
    bool newline = FALSE;

    currentFont = fontMakeCurrent(tmTechListFont);

    numlines = 0;

    startind = 0;

    y = region->rect.y0 + TM_ASMarginTop;

    for (index=startind; index<TM_NUM_TECHS; index++)
    {
        if (y + fontHeight(" ") >= region->rect.y1)
        {
            break;
        }

        if  (tmTechForSale[index] == TM_TECH_IS_FOR_SALE )

        {
            newline=TRUE;
        }


        if ((yClicked < y + fontHeight(" ") + TM_ASInterSpacing)&&(newline))
        {
                return(index);
        }

        if (newline)
        {
            newline = FALSE;

            y+= fontHeight(" ") + TM_ASInterSpacing;
        }
    }

    fontMakeCurrent(currentFont);

    return (-1);
}
コード例 #13
0
ファイル: ShipView.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    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 = &region->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(&region->rect, FEC_Background);

    svShipManeuverability(info,maneuverability);
    sprintf(buf,ShipStatToNiceStr(Maneuver),maneuverability);

    fontPrintf(
        rect->x0,
        rect->y0,
        FEC_ListItemStandard,
        "%s",buf);

    fontMakeCurrent(currentFont);
}
コード例 #14
0
void hrChatTextEntry(char *name, featom *atom)
{
    char *string;
    ChatPacket temp;
    sdword     width;
    fonthandle fhsave;
    char  testwidth[MAX_CHATSTRING_LENGTH+40];

    if (FEFIRSTCALL(atom))
    {
        // initialize button here
        ChatTextEntryBox = (textentryhandle)atom->pData;
        uicTextEntryInit(ChatTextEntryBox,UICTE_NoLossOfFocus|UICTE_ChatTextEntry);
        uicTextBufferResize(ChatTextEntryBox,MAX_CHATSTRING_LENGTH-2);
        return;
    }

    switch (uicTextEntryMessage(atom))
    {
        case CM_AcceptText :
            string = ((textentryhandle)atom->pData)->textBuffer;
            sendChatMessage(ALL_PLAYER_MASK^PLAYER_MASK(sigsPlayerIndex),string,(uword)sigsPlayerIndex);
            dbgMessagef("text entry: %s",string);
            strcpy(temp.message,string);
            temp.packetheader.frame = (uword)sigsPlayerIndex;
            hrProcessPacket((struct ChatPacket *)&temp);
            uicTextEntrySet(ChatTextEntryBox,"",0);
        break;
        case CM_KeyPressed :
            fhsave = fontMakeCurrent(((textentryhandle)atom->pData)->currentFont); //select the appropriate font
            sprintf(testwidth, "%s >  %s", playerNames[sigsPlayerIndex], ((textentryhandle)atom->pData)->textBuffer);
            width = fontWidth(testwidth);
            fontMakeCurrent(fhsave);
            if (width > (atom->width-30))
            {
                uicBackspaceCharacter((textentryhandle)atom->pData);
            }
        break;
    }
}
コード例 #15
0
/*-----------------------------------------------------------------------------
    Name        : gpGameItemDraw
    Description : Draw the list of available games
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void gpGameItemDraw(rectangle *rect, listitemhandle data)
{
    char            temp[64];
    sdword          x, y;
    color           c;
    fonthandle      oldfont;
    gpgame         *gpGame = (gpgame *)data->data;

    oldfont = fontMakeCurrent(gpListFont);

    if (data->flags&UICLI_Selected)
        c = FEC_ListItemSelected;
    else
        c = FEC_ListItemStandard;

    x = rect->x0;
    y = rect->y0;

    sprintf(temp,"%s",gpGame->title);
    fontPrint(x,y,c,temp);

    fontMakeCurrent(oldfont);
}
コード例 #16
0
ファイル: scenpick.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : spScenarioItemDraw
    Description : Draw the list of available scenarios
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void spScenarioItemDraw(rectangle *rect, listitemhandle data)
{
    char            temp[64];
    sdword          x, y;
    color           c;
    fonthandle      oldfont;
    spscenario     *spScenario = (spscenario *)data->data;

    oldfont = fontMakeCurrent(spListFont);

    if (data->flags&UICLI_Selected)
        c = FEC_ListItemSelected;
    else
        c = FEC_ListItemStandard;

    x = rect->x0;//+MG_HorzSpacing;
    y = rect->y0;//+MG_VertSpacing/2;

    sprintf(temp,"%s",spScenario->title);
    fontPrint(x,y,c,temp);

    fontMakeCurrent(oldfont);
}
コード例 #17
0
/*-----------------------------------------------------------------------------
    Name        : frReloadFonts
    Description : reloads all of the currently loaded fonts with respect to the currently selected language.
    Inputs      : none
    Outputs     : none
    Return      : void
----------------------------------------------------------------------------*/
void frReloadFonts(void)
{
    sdword index;
    fonthandle curfont;
    char   name[64];
    char fullName[128];

    curfont = fontCurrentGet();

    for (index = FR_NumberFonts - 1; index >= 1; index--)
    {                                                       //for all of the registry
        if (frFontRegistry[index].name != NULL)
        {
            // free memory associated with the current font
            strcpy(name, frFontRegistry[index].name);
            memFree(frFontRegistry[index].name);            //free previously allocated name
            frFontRegistry[index].name = NULL;              //no longer registered
            fontDiscard(frFontRegistry[index].handle);      //free the font

            frFontRegistry[index].name = memStringDupe(name);//duplicate name string
            strcpy(fullName, FR_PrependPath);                       //prepare file path
            if (strCurLanguage==languageEnglish)
            {
                strcat(fullName, FR_English);
            }
            else if (strCurLanguage==languageFrench)
            {
                strcat(fullName, FR_French);
            }
            else if (strCurLanguage==languageGerman)
            {
                strcat(fullName, FR_German);
            }
            else if (strCurLanguage==languageSpanish)
            {
                strcat(fullName, FR_Spanish);
            }
            else if (strCurLanguage==languageItalian)
            {
                strcat(fullName, FR_Italian);
            }
            strcat(fullName, name);
            frFontRegistry[index].fontdat = fontLoad(fullName);  //load file
            frFontRegistry[index].handle = index;
        }
    }

    fontMakeCurrent(curfont);
}
コード例 #18
0
ファイル: scenpick.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : spScenarioNameDraw
    Description : Draw the currently selected scenario name in screens other
                    than the scenario picker.
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void spScenarioNameDraw(featom *atom, regionhandle region)
{
    fonthandle fhSave;
    char scenarioName[128];
    bool useDisplayName = FALSE;

    rectangle *r = &region->rect;

    fhSave = fontMakeCurrent(spNameFont); //select the appropriate font

    if (multiPlayerGame && (!GameCreator))
    {
        if (LANGame)
        {
            if (currentScreen == MGS_Basic_Options_View)
            {
                useDisplayName = TRUE;
            }
        }
        else
        {
            if (WaitingForGame)
            {
                useDisplayName = TRUE;
            }
        }
    }

    if (useDisplayName)
        memStrncpy(scenarioName, tpGameCreated.DisplayMapName, 127);
    else
        memStrncpy(scenarioName, spScenarios[spCurrentSelected].title, 127);
    _strupr(scenarioName);
    fontPrintf(r->x0, r->y0, FEC_ListItemSelected, scenarioName);
    fontMakeCurrent(fhSave);
}
コード例 #19
0
ファイル: tutorial.c プロジェクト: spippolatore/homeworld-1
void tutExecute(regionhandle reg)
{
    fonthandle currentfont;
    sdword texty, bitmap;

    rectangle rect;                         // used for translucent boxes behind text
    rectangle *buttonrect = &reg->rect;     // used for "next" button
    bool modeset = FALSE;
    sdword bitmap_x, bitmap_vel;

	if(tutorial == 3)
		return;

    if(tutRegion->previous)
        regSiblingMoveToFront(tutRegion);

    if(tutTransition == 0 && tutLesson != TUT_LESSON_ENTER_BUILD_MANAGER && tutLesson != TUT_LESSON_BUILD_SHIP) // don't draw button on build manager lessons
    {
        if(mouseInRect(buttonrect))
        {
            if(mouseLeftButton())
            {
                tutSkip = TRUE;
                trRGBTextureMakeCurrent(tutButtonTexture[NEXT_ON]);
            }
            else
                trRGBTextureMakeCurrent(tutButtonTexture[NEXT_MOUSE]);
        }
        else
            trRGBTextureMakeCurrent(tutButtonTexture[NEXT_OFF]);
        rndPerspectiveCorrection(FALSE);
//      glEnable(GL_BLEND);         // needs to be enabled once Keith fixes alpha blending intel compiler optimization bug
        primRectSolidTextured2(buttonrect);
//      glDisable(GL_BLEND);        // needs to be enabled once Keith fixes alpha blending intel compiler optimization bug
    }

    if(tutTransition == 0)
    {
        switch(PassedTutorial(tutLesson))
        {
        case 0:     // Didn't pass
            break;

        case 1:     // Perform transition
            tutTransition = 1;
            break;

        case -1:    // No Transition
            tutLesson++;
            InitTutorial(tutLesson);
            break;
        }
    }
    else if(tutTransition == 1)
    {
        tutTransitionCount++;
        if(tutTransitionCount == TUT_TransitionFramesOut)
        {
            tutTransition = 2;
            tutTransitionCount = TUT_TransitionFramesIn;
            tutLesson++;
            InitTutorial(tutLesson);
            if((tutLesson >= TUT_ADVANCED_INTRO && tutorial == 1) || (tutLesson >= TUT_TOTAL_LESSONS && tutorial == 2))
            {
                tutorialdone = TRUE;
                return;
            }
        }
    }
    else if(tutTransition == 2)
    {
        tutTransitionCount--;
        if(tutTransitionCount == 0)
            tutTransition = 0;
    }

    if(tutBitmapList[tutLesson][2] != -1)
    {
        bitmap_x = TUT_BITMAP_X;
        bitmap_vel = 210;
    }
    else if(tutBitmapList[tutLesson][1] != -1)
    {
        bitmap_x = TUT_BITMAP_X + (TUT_BITMAP_WIDTH + 8);
        bitmap_vel = 150;
    }
    else
    {
        bitmap_x = TUT_BITMAP_X + ((2 * TUT_BITMAP_WIDTH) + 8);
        bitmap_vel = 90;
    }

    if(tutTransition == 0)
        bitmap_vel = 0;
    else if(tutTransition == 1)
        bitmap_vel = (long) (((float)bitmap_vel/(float)TUT_TransitionFramesOut) * (float)tutTransitionCount);
    else if(tutTransition == 2)
        bitmap_vel = (long) (((float)bitmap_vel/(float)TUT_TransitionFramesIn) * (float)tutTransitionCount);

//  glEnable(GL_BLEND);
    for(bitmap = 0; bitmap < 3; bitmap++)
    {
        if(tutBitmapList[tutLesson][bitmap] != -1)
        {
            trRGBTextureMakeCurrent(tutButtonTexture[tutBitmapList[tutLesson][bitmap]]);
            rndPerspectiveCorrection(FALSE);
            rect.x0 = bitmap_x + ((TUT_BITMAP_WIDTH + 8) * bitmap) + bitmap_vel;
            rect.y0 = TUT_BITMAP_Y;
            rect.x1 = bitmap_x + ((TUT_BITMAP_WIDTH + 8) * bitmap) + TUT_BITMAP_WIDTH + bitmap_vel;
            rect.y1 = TUT_BITMAP_Y + TUT_BITMAP_HEIGHT;
            primRectSolidTextured2(&rect);
        }
    }
//  glDisable(GL_BLEND);

    if (!primModeEnabled)   // draw translucent polys before text
    {
        primModeSet2();
        modeset = TRUE;
    }

    if(tutLesson != TUT_LESSON_BUILD_SHIP)      // default behaviour for lessons
    {
    long    TitlePos = (long)(TUT_TitleTransMult[tutTransition] * (float)tutTransitionCount);
    long    TextPos = (long)(TUT_TextTransMult[tutTransition] * (float)tutTransitionCount);

        rect.x0 = 0;
        rect.y0 = TUT_Title_Y - TitlePos - 7;
        rect.x1 = 640;
        rect.y1 = TUT_Title_Y - TitlePos + 22;
        primRectTranslucent2(&rect, colRGBA(0, 0, 0, 128));

        rect.x0 = TUT_Main_X - TextPos - 12;
        rect.y0 = TUT_Main_Y - 6;
        rect.x1 = TUT_Main_X - TextPos + TUT_MainTextWidth + 4;
        rect.y1 = tutLastMainY;
        primRectTranslucent2(&rect, colRGBA(0, 0, 0, 128));

        currentfont = fontMakeCurrent(tutTitleFont);    // draw text
        fontPrintf(TUT_Title_X, TUT_Title_Y - TitlePos, TUT_TitleColor, "%s", strGetString(strTutorial00Title + (tutLesson * 7)));
        currentfont = fontMakeCurrent(tutMainFont);
        texty = DrawTextBlock(strGetString(strTutorial00Line01 + (tutLesson * 7)), TUT_Main_X - TextPos, TUT_Main_Y, TUT_MainTextWidth, TUT_MainTextHeight, TUT_MainColor);
        texty = DrawTextBlock(strGetString(strTutorial00Line02 + (tutLesson * 7)), TUT_Main_X - TextPos, texty, TUT_MainTextWidth, TUT_MainTextHeight, TUT_MainColor);
        texty = DrawTextBlock(strGetString(strTutorial00Line03 + (tutLesson * 7)), TUT_Main_X - TextPos, texty, TUT_MainTextWidth, TUT_MainTextHeight, TUT_MainColor);
        texty = DrawTextBlock(strGetString(strTutorial00Line04 + (tutLesson * 7)), TUT_Main_X - TextPos, texty, TUT_MainTextWidth, TUT_MainTextHeight, TUT_MainColor);
        tutLastMainY = DrawTextBlock(strGetString(strTutorial00Line05 + (tutLesson * 7)), TUT_Main_X - TextPos, texty, TUT_MainTextWidth, TUT_MainTextHeight, TUT_MainColor);
        fontMakeCurrent(currentfont);
    }
    else                                    // special case for build ship lesson
    {
        currentfont = fontMakeCurrent(tutMainFont);
        texty = DrawTextBlock(strGetString(strTutorial17Line01 + tutVar.count), TUT_Build_X, TUT_Build_Y, TUT_BuildTextWidth, TUT_BuildTextHeight, TUT_BuildColor);
        fontMakeCurrent(currentfont);

        rect.x0 = TUT_Build_X - 8;          // draw outline box around text
        rect.y0 = TUT_Build_Y - 6;
        rect.x1 = TUT_Build_X + TUT_BuildTextWidth + 8;
        rect.y1 = texty;
        primRectOutline2(&rect, 2, colRGB(tutPulseValue, tutPulseValue, tutPulseValue));

        if(tutVar.count == 0)               // point to appropriate place on screen
            tutDrawLinePulse(TUT_Build_X - 8, texty, 160, 100, tutPulseValue, 8);
        else if(tutVar.count == 1)
            tutDrawLinePulse(TUT_Build_X - 8, texty, 180, 410, tutPulseValue, 8);
        else if(tutVar.count == 2)
            tutDrawLinePulse(TUT_Build_X - 8, texty, 550, 410, tutPulseValue, 8);

        tutPulseValue -= 8;
    }

    if(!FirstWordNULL(strGetString(strTutorial00Tip + (tutLesson * 7))))
    {
    long    TipPos = (long)(TUT_TipTransMult[tutTransition] * (float)tutTransitionCount);
    long    TextPos = (long)(TUT_TextTransMult[tutTransition] * (float)tutTransitionCount);

        if (!primModeEnabled)   // draw translucent polys before tip text
        {
            primModeSet2();
            modeset = TRUE;
        }

        rect.x0 = TUT_TipTitle_X - 8;
        rect.y0 = TUT_TipTitle_Y - TipPos - 6;
        rect.x1 = TUT_Tip_X - 8;
        rect.y1 = TUT_TipTitle_Y - TipPos + 18;
        primRectTranslucent2(&rect, colRGBA(0, 0, 0, 128));

        rect.x0 = TUT_Tip_X + TextPos - 8;
        rect.y0 = TUT_Tip_Y - 6;
        rect.x1 = TUT_Tip_X + TextPos + TUT_TipTextWidth + 8;
        rect.y1 = tutLastTipY;
        primRectTranslucent2(&rect, colRGBA(0, 0, 0, 128));

        if(modeset)
            primModeClear2();

        currentfont = fontMakeCurrent(tutTipTitleFont);
        fontPrintf(TUT_TipTitle_X, TUT_TipTitle_Y - TipPos, TUT_TipTitleColor, "%s", strGetString(strTutorialTip));
        currentfont = fontMakeCurrent(tutTipFont);
        tutLastTipY = DrawTextBlock(strGetString(strTutorial00Tip + (tutLesson * 7)), TUT_Tip_X + TextPos, TUT_Tip_Y, TUT_TipTextWidth, TUT_TipTextHeight, TUT_TipColor);
    }

    fontMakeCurrent(currentfont);
}
コード例 #20
0
ファイル: GameChat.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : gcChatTextDraw
    Description : draws the chat history window and prompts for text entry.
    Inputs      : standard draw callbacks.
    Outputs     : none
    Return      : void
----------------------------------------------------------------------------*/
void gcChatTextDraw(featom *atom, regionhandle region)
{
    fonthandle      oldfont;
    sdword          x,y=region->rect.y0,lines=0;
    char            temp[512], *string;
    Node           *walk=NULL;
    chathistory    *chat;

    if (!mrRenderMainScreen) return;

    oldfont = fontMakeCurrent(chathistoryfont);
    fontShadowSet(FS_SE, colBlack);

    if (InChatMode)
    {
        switch (MessageToAllies)
        {
            case GC_ChatToAllies:
                //sprintf(temp,"To Allies: ");
                string = strGetString(strToAllies);
            break;
            case GC_ChatToAll:
                //sprintf(temp,"Say: ");
                string = strGetString(strSay);
            break;
            case GC_RUTransfer:
                //sprintf(temp,"RU Amount: ");
                string = strGetString(strRUAmount);
            break;
        }

        x = region->rect.x0;
        fontPrint(x,y,colWhite,string);
        y+= fontHeight(" ");
        lines++;
    }

    if (curPosition != NULL)
    {
        walk = curPosition;
    }

    if (walk!=NULL)
    {
        do
        {
            x = region->rect.x0;

            chat = listGetStructOfNode(walk);

            switch (chat->messageType)
            {
                case GC_NORMALMESSAGE:
                {
                    sprintf(temp,"<%s>",playerNames[chat->playerindex]);
                    fontPrint(x,y,tpGameCreated.playerInfo[chat->playerindex].baseColor,temp);
                    x+=fontWidth(temp);

                    sprintf(temp,"  %s",chat->chatstring);
                    fontPrint(x,y,gcGameNormalChatColor,temp);
                }
                break;
                case GC_WHISPEREDMESSAGE:
                {
                    sprintf(temp,"<%s>",playerNames[chat->playerindex]);
                    fontPrint(x,y,tpGameCreated.playerInfo[chat->playerindex].baseColor,temp);
                    x+=fontWidth(temp);

                    sprintf(temp, strGetString(strWhisperedMessage));
                    fontPrint(x,y,gcGameWhisperedColor, temp);
                    x+=fontWidth(temp);

                    sprintf(temp,"  %s",chat->chatstring);
                    fontPrint(x,y,gcGamePrivateChatColor,temp);
                }
                break;
                case GC_TEXTMESSAGE:
                {
                    fontPrint(x,y,chat->col,chat->chatstring);
                }
                break;
                case GC_BUFFERSTART:
                {
                    if (ViewingBuffer)
                    {
                        //sprintf(temp,"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^");
                        fontPrint(x,y,gcGameNormalChatColor,strGetString(strStartOfBuffer));
                    }
                }
                break;
                case GC_BUFFEREND:
                {
                    if (ViewingBuffer)
                    {
                        //sprintf(temp,"v v v v v v v v v v v v v v v v v v v v v v v v");
                        fontPrint(x,y,gcGameNormalChatColor,strGetString(strEndOfBuffer));
                    }
                }
                break;
                case GC_WRAPMESSAGE:
                {
                    x+= chat->indent;
                    fontPrint(x,y,chat->col,chat->chatstring);
                }
                break;
            }

            y += fontHeight(" ");
            lines++;

            walk = walk->next;
        }
        while ((walk!=NULL) && (lines < maxlines));

        if ((ScrollDownAutoBaby==NULL) && (!ViewingBuffer) && (curPosition->next != NULL))
        {
            ScrollDownAutoBaby = taskCallBackRegister(gcScrollDownAuto, 0, NULL, GC_SCROLL_TIME);
        }
    }

    fontShadowSet(FS_NONE, colBlack);
    fontMakeCurrent(oldfont);
}
コード例 #21
0
void hrDrawPlayersProgress(featom *atom, regionhandle region)
{
    sdword     index;
    rectangle pos;
    rectangle outline;
    real32 percent;
    fonthandle currentfont;
    bool droppedOut;

    hrProgressRegion = region;

    pos = region->rect;

//  primRectSolid2(&pos, colRGBA(0, 0, 0, 64));

    pos.y0+=fontHeight(" ");
    pos.y1=pos.y0+8;

    currentfont = fontMakeCurrent(playernamefont);

    if (multiPlayerGame)
    {
        dbgAssertOrIgnore(sigsNumPlayers == tpGameCreated.numPlayers);
        for (index=0;index<sigsNumPlayers;index++)
        {
            droppedOut = playerHasDroppedOutOrQuit(index);

            outline = pos;
            outline.x0 -= 5;
            outline.x1 += 10;
            outline.y0 -= 3;
            outline.y1 = outline.y0 + fontHeight(" ")*2 - 2;

            if ((hrBackgroundDirty) || (!PlayersAlreadyDrawnDropped[index]))
            {
                PlayersAlreadyDrawnDropped[index] = droppedOut;

                primRectSolid2(&outline, colBlack);

                if (droppedOut)
                {
                    fontPrintf(pos.x0,pos.y0,colBlack,"%s",tpGameCreated.playerInfo[index].PersonalName);
                    fontPrintf(pos.x0,pos.y0,HorseRaceDropoutColor,"%s",
                               (playersReadyToGo[index] == PLAYER_QUIT) ? strGetString(strQuit) : strGetString(strDroppedOut));
                }
                else
                {
                    fontPrintf(pos.x0,pos.y0,tpGameCreated.playerInfo[index].baseColor,"%s",tpGameCreated.playerInfo[index].PersonalName);

                    if (horseracestatus.hrstatusstr[index][0])
                    {
                        fontPrintf(pos.x0+150,pos.y0,tpGameCreated.playerInfo[index].baseColor,"%s",horseracestatus.hrstatusstr[index]);
                    }
                }
            }

            primRectOutline2(&outline, 1, (droppedOut) ? HorseRaceDropoutColor : tpGameCreated.playerInfo[index].stripeColor);

            pos.y0+=fontHeight(" ");
            pos.y1=pos.y0+4;

            percent = horseracestatus.percent[index];

            hrBarDraw(&pos,hrBackBarColor,(droppedOut) ? HorseRaceDropoutColor : tpGameCreated.playerInfo[index].baseColor,percent);

            pos.y0+=fontHeight(" ");
        }
    }
    else if (singlePlayerGame)
    {
        pos = hrSinglePlayerPos;

        // progress bar
        if (pos.x0 != 0)
        {
            percent = horseracestatus.percent[0];

            //dbgMessagef("percent %f",percent);

            hrBarDraw(&pos, colBlack, hrSinglePlayerLoadingBarColor/*teColorSchemes[0].textureColor.base*/, percent);
        }

        // blinking hyperspace destination (render every other call)
        if (++hrProgressCounter % 2 == 0)
        {
            hrBackgroundDirty = 3;  // 1 - nothing happens as decremented before rendered
                                    // 2 - background is cleared but not redrawn
                                    // 3 - 3's the charm
            
            // hyperspace destination circled in first-person view  
            #define SP_LOADING_HYPERSPACE_DEST_CIRCLE_X  115
            #define SP_LOADING_HYPERSPACE_DEST_CIRCLE_Y  342
            
            // hyperspace destination arrowed in "as the bird flies" view 
            #define SP_LOADING_HYPERSPACE_DEST_ARROWS_X  195
            #define SP_LOADING_HYPERSPACE_DEST_ARROWS_Y  134

            // NB: hrDrawFile deals with coordinate mapping

#ifdef _WIN32
            hrDrawFile("feman\\loadscreen\\ring.lif",
                SP_LOADING_HYPERSPACE_DEST_CIRCLE_X, SP_LOADING_HYPERSPACE_DEST_CIRCLE_Y
            );
            hrDrawFile("feman\\loadscreen\\arrows.lif",
                SP_LOADING_HYPERSPACE_DEST_ARROWS_X, SP_LOADING_HYPERSPACE_DEST_ARROWS_Y
            );
#else
            hrDrawFile("feman/loadscreen/ring.lif",
                SP_LOADING_HYPERSPACE_DEST_CIRCLE_X, SP_LOADING_HYPERSPACE_DEST_CIRCLE_Y
            );
            hrDrawFile("feman/loadscreen/arrows.lif",
                SP_LOADING_HYPERSPACE_DEST_ARROWS_X, SP_LOADING_HYPERSPACE_DEST_ARROWS_Y
            );
#endif
        }
    }
    else
    {
        if (hrBackgroundDirty)
        {
            outline = pos;
            outline.x0 -= 5;
            outline.x1 += 10;
            outline.y0 -= 3;
            outline.y1 = outline.y0 + fontHeight(" ")*2 - 2;

            primRectTranslucent2(&outline, colRGBA(0,0,0,64));
            primRectOutline2(&outline, 1, teColorSchemes[0].textureColor.detail);

            fontPrintf(pos.x0,pos.y0,teColorSchemes[0].textureColor.base,"%s",playerNames[0]);
        }

        pos.y0+=fontHeight(" ");
        pos.y1=pos.y0+4;

        percent = horseracestatus.percent[0];

        hrBarDraw(&pos,hrBackBarColor,teColorSchemes[0].textureColor.base,percent);
    }
    fontMakeCurrent(currentfont);
}
コード例 #22
0
/*-----------------------------------------------------------------------------
    Name        : svShipViewRender
    Description : Callback which draws the main ship view.
    Inputs      : standard FE callback
    Outputs     : ..
    Return      : void
----------------------------------------------------------------------------*/
void svShipViewRender(featom* atom, regionhandle region)
{
    rectangle drawRect;
    rectangle* rect;
    rectangle viewRect;
    fonthandle currentFont;
    GLint viewPort[4];
    GLint box[4];
    ShipStaticInfo* info;
    real32 scale;
    sdword width, height;
    sdword x, y;
    keyindex key;
    char* keystring;
    bool resetRender = FALSE;
    char    temp[100];

    // facilitates smooth transition between auto/manual rotation of ship
    static real32 angle_user_rotated_to       = 0.0f;
    static real32 declination_user_rotated_to = 0.0f;
    static real32 time_user_rotated_view      = 0.0f;
           real32 real_time_angle             = 0.0f;
    static real32 user_real_angle_offset      = 0.0f;
    
    rect = &region->rect;
    viewRect.x0 = 0;
    viewRect.y0 = 0;
    viewRect.x1 = MAIN_WindowWidth  - 1;
    viewRect.y1 = MAIN_WindowHeight - 1;
    info = NULL;

    if (svShipType != DefaultShip)
    {
        if (universe.curPlayerPtr)
        {
            info = GetShipStaticInfoSafe(svShipType, universe.curPlayerPtr->race);
        }
        if (info == NULL)
        {
            info = GetShipStaticInfoSafe(svShipType, GetValidRaceForShipType(svShipType));
        }
        if (info == NULL)
        {
            return;
        }
    }

    svShipViewRegion = region;

    if (!resetRender)
    {
        if (svMouseInside)
        {
            ferDrawFocusWindow(region, lw_focus);
        }
        else
        {
            ferDrawFocusWindow(region, lw_normal);
        }
    }

    soundEventUpdate();

    currentFont = fontMakeCurrent(svShipViewFont);

    if (region->flags == 0 || region->flags == RPE_DrawFunctionAdded)
    {                                         //if region not processed yet
        region->flags =
            RPE_Enter | RPE_Exit |
            RPE_WheelDown | RPE_WheelUp |
            RPE_PressLeft | RPE_ReleaseLeft |
            RPE_PressRight | RPE_ReleaseRight;

        regFunctionSet(region, (regionfunction) svReadMouseEvent);               //set new region handler function
    }

    //scale = *svScale[svShipType];
        //svCamera.closestZoom  = *svMinZoom[svShipType];
    //svCamera.farthestZoom = *svMaxZoom[svShipType];

    scale = 1.0f; //*svScale[svShipType];

    if(svShipType != DefaultShip)
    {
        svCamera.closestZoom = info->minimumZoomDistance*svZoomInScalar;
        svCamera.farthestZoom = (svCamera.closestZoom+info->staticheader.staticCollInfo.approxcollspheresize)*svZoomOutScalar;
        if(ReZoom)
        {
            ReZoom=FALSE;
            cameraZoom(&svCamera,1.0f,FALSE);
        }

        if (svMouseInside && (wheel_down || wheel_up))
        {
            cameraControl(&svCamera, FALSE);
        }
        else if (svMouseInside && svMousePressRight)
        {
            camMouseX = (svMouseCentreX - mouseCursorX()) * 4;      //was 2
            camMouseY = (svMouseCentreY - mouseCursorY()) * 4;
            savecamMouseX = savecamMouseX * SPIN_FEEDBACK +
                (real32)camMouseX * (1.0f - SPIN_FEEDBACK);
            cameraControl(&svCamera, FALSE);                         //update the camera

            mouseCursorHide();
            mousePositionSet(svMouseCentreX, svMouseCentreY); // Reset position so it doesn't walk off region

            // keep track of where the user left the camera so we can sync auto-rotation with it
            angle_user_rotated_to       = svCamera.angle;
            declination_user_rotated_to = svCamera.declination;
            time_user_rotated_view      = universe.totaltimeelapsed;
        }
        else // auto rotate ship model
        {
            // continual 360 degree yaw rotation
            real_time_angle = DEG_TO_RAD(remainder(universe.totaltimeelapsed, SV_360_ROTATION_SECS) / SV_360_ROTATION_SECS * 360);

            if (angle_user_rotated_to >= 0.0) {
                user_real_angle_offset = angle_user_rotated_to - real_time_angle;
                angle_user_rotated_to = -1.0;
            }

            svCamera.angle = real_time_angle + user_real_angle_offset;
            
            // collapse pitch to default declination
            if (time_user_rotated_view > 0.0) {
                if (universe.totaltimeelapsed > time_user_rotated_view + SV_PITCH_FLATTEN_SECS) {
                    svCamera.declination = DEG_TO_RAD(svDeclination);
                    time_user_rotated_view = 0.0;
                }
                else {
                    svCamera.declination = declination_user_rotated_to + (DEG_TO_RAD(svDeclination) - declination_user_rotated_to) * ((universe.totaltimeelapsed - time_user_rotated_view) / SV_PITCH_FLATTEN_SECS);
                }
            }
            
            if (svMouseInside) mouseCursorShow();
        }
    }
    //rotation

    drawRect.x0 = rect->x0 + SV_ViewMargin;
    drawRect.y0 = rect->y0 + SV_ViewMargin;
    drawRect.x1 = rect->x1 - SV_ViewMargin;
    drawRect.y1 = rect->y1 - SV_ViewMargin;

    width  = drawRect.x1 - drawRect.x0;
    height = drawRect.y1 - drawRect.y0;

    glGetIntegerv(GL_VIEWPORT, viewPort);
    glViewport(drawRect.x0, MAIN_WindowHeight - drawRect.y1, width, height);

    primModeSet2();
    if (!resetRender)
    {
        primRectSolid2(&viewRect, FEC_Background);
    }
    primModeClear2();

    glEnable(GL_SCISSOR_TEST);
    glGetIntegerv(GL_SCISSOR_BOX, box);
    glScissor(drawRect.x0, MAIN_WindowHeight - drawRect.y1, width, height);
    glClear(GL_DEPTH_BUFFER_BIT);
    glDisable(GL_SCISSOR_TEST);

    rndPerspectiveCorrection(TRUE);

    //svCamera.lookatpoint.x = -info->staticheader.staticCollInfo.collsphereoffset.z * scale;
    //svCamera.lookatpoint.y = -info->staticheader.staticCollInfo.collsphereoffset.x * scale;
    //svCamera.lookatpoint.z = -info->staticheader.staticCollInfo.collsphereoffset.y * scale;
    if (svShipType == DefaultShip)
    {
        svCamera.lookatpoint.x=0.0f;
        svCamera.lookatpoint.y=0.0f;
        svCamera.lookatpoint.z=0.0f;
    }
    else
    {
        svCamera.lookatpoint.x = -info->staticheader.staticCollInfo.collsphereoffset.z;
        svCamera.lookatpoint.y = -info->staticheader.staticCollInfo.collsphereoffset.x;
        svCamera.lookatpoint.z = -info->staticheader.staticCollInfo.collsphereoffset.y;
    }

    cameraSetEyePosition(&svCamera);

    rndLightingEnable(TRUE);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    rgluPerspective(
        svCamera.fieldofview,
        (float)(width) / (float)(height) /*rndAspectRatio*/,    //set projection matrix
        svCamera.clipPlaneNear,
        svCamera.clipPlaneFar);

    glMatrixMode(GL_MODELVIEW);

    glLoadIdentity();

    rgluLookAt(
        svCamera.eyeposition.x,
        svCamera.eyeposition.y,
        svCamera.eyeposition.z,
        svCamera.lookatpoint.x,
        svCamera.lookatpoint.y,
        svCamera.lookatpoint.z,
        svCamera.upvector.x,
        svCamera.upvector.y,
        svCamera.upvector.z);

    glPushMatrix();

    glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);

    glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *)(&rndCameraMatrix));
    glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat *)(&rndProjectionMatrix));

    glEnable(GL_NORMALIZE);

    glLightfv(GL_LIGHT0, GL_POSITION, lightPosition0);      //position light(s) within world

    glScalef(scale, scale, scale);

    if (svShipType != DefaultShip)
    {
        sdword index;
        //try player index colours first
        index = universe.curPlayerIndex;
        if (info->teamColor[index] == 0)
        {
            //colour scheme doesn't exist, search for something valid
            for (index = 0; index < MAX_MULTIPLAYER_PLAYERS; index++)
            {
                if (info->teamColor[index] != 0)
                {
                    break;
                }
            }
            if (index == MAX_MULTIPLAYER_PLAYERS)
            {
                //this ship doesn't have any colour info,
                //at least avoid a GPF
                index = universe.curPlayerIndex;
            }
        }
        meshRender((meshdata *)info->staticheader.LOD->level[0].pData, index);
    }

    glDisable(GL_NORMALIZE);

    glPopMatrix();

    primModeSet2();

    glScissor(box[0], box[1], box[2], box[3]);
    glViewport(viewPort[0], viewPort[1], viewPort[2], viewPort[3]);

    rndLightingEnable(FALSE);
    rndPerspectiveCorrection(FALSE);

    x = rect->x0 + 2 + SV_ViewMargin;
    y = rect->y0 + 2 + SV_ViewMargin;

    if (svShipType != DefaultShip && !resetRender)
    {
        fontPrintf(
            x,
            y,
            FEC_ListItemStandard,
            "%s",
            ShipTypeToNiceStr(svShipType));

        y += fontHeight(" ");

        sprintf(temp, "%s %d %s",strGetString(strSVCost),info->buildCost, strGetString(strSVRUs));

        fontPrintf(
            x,
            y,
            FEC_ListItemStandard,
            temp);

        if (cmPrintHotKey)
        {
            x = rect->x1 - 2 - SV_ViewMargin;
            y = rect->y0 + 2 + SV_ViewMargin;

            key = cmShipTypeToKey(svShipType);
            keystring = opKeyToNiceString((keyindex)(key & 0x00ff));

            if (key & CM_SHIFT)
            {
                width = fontWidthf("[SHIFT-%s]",keystring);
                fontPrintf(
                    x-width,
                    y,
                    FEC_ListItemStandard,
                    "[SHIFT-%s]",
                    keystring);
            }
            else if (key)
            {
                width = fontWidthf("[%s]",keystring);
                fontPrintf(
                    x-width,
                    y,
                    FEC_ListItemStandard,
                    "[%s]",
                    keystring);
            }
        }
    }
    fontMakeCurrent(currentFont);

    svDirtyShipView();
}
コード例 #23
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
/*-----------------------------------------------------------------------------
    Name        : tmTechCostsDraw
    Description : Draw the cost of building selected techs.
    Inputs      : feflow callback
    Outputs     : ..
    Return      : void
----------------------------------------------------------------------------*/
void tmCostListDraw(featom *atom, regionhandle region)
{
    udword price;
    sdword x, y, index;
    rectangle *rect = &region->rect;
    bool        newline=FALSE;
    color c;
    fonthandle currentFont;
    sdword  numlines;

    currentFont = fontCurrentGet();
    fontMakeCurrent(tmTechListFont);

    tmCostListRegion = region;

    numlines = 0;


    for (index=0; index<TM_NUM_TECHS; index++)
    {
        if  (tmTechForSale[index] == TM_TECH_IS_FOR_SALE)
            newline=TRUE;
        if (newline)
        {
            newline = FALSE;
            numlines++;
        }
    }

    y = region->rect.y0 + TM_ASMarginTop;

    newline=FALSE;
    numlines=0;

    for (index=0; index < TM_NUM_TECHS; index++)
    {
        price = (tmTechPrice[index] * tmPriceScale) / 100;
        if (y + fontHeight(" ") >= region->rect.y1)
        {
            break;
        }

        if (tmTechForSale[index] == TM_TECH_IS_FOR_SALE)
        {
            if (universe.curPlayerPtr->resourceUnits < price)
            {                                                   //if this tech already selected
                c = TM_CantAffordTextColor;
            }

            else
            {
                c = TM_StandardTextColor;
            }
                        //tech fancy name
            x = rect->x1 - TM_ASMarginLeft - fontWidthf("%d", price);
            fontPrintf(x, y, c, "%d", price);

            newline = TRUE;

            tmDirtyTechInfo();
        }
        if (newline)
        {
            newline = FALSE;

            y+= fontHeight(" ") + TM_ASInterSpacing;

        }
    }

    fontMakeCurrent(currentFont);
}
コード例 #24
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
void tmTechListDraw(featom *atom, regionhandle region)
{
    sdword x, y, index;
    color c;
    fonthandle currentFont;
    bool       newline = FALSE;
    sdword     numlines, buyable=0;
    sdword     price;

    if (tmTechSelected == -1)
    {
        sdword i, price;

        for (i = 0; i < TM_NUM_TECHS; i++)
        {
            if (tmTechForSale[i] == TM_TECH_IS_FOR_SALE)
            {
                price = (tmTechPrice[i] * tmPriceScale) / 100;
                if (universe.curPlayerPtr->resourceUnits >= price)
                {
                    tmTechSelected = i;
                    tmtechinfo = i;
                    tmDirtyTechInfo();
                    break;
                }
            }
        }
    }

    tmTechListRegion = region;

    currentFont = fontMakeCurrent(tmTechListFont);

    if (region->flags == 0 || region->flags == RPE_DrawFunctionAdded)
    {                                                       //if region not processed yet
        region->flags = RPE_PressLeft | RPE_PressRight |
                        RPE_WheelUp | RPE_WheelDown;        //receive mouse presses from now on
        regFunctionSet(region, (regionfunction)tmSelectAvailable);          //set new region handler function
    }
    feStaticRectangleDraw(region);                          //draw standard rectangle

    numlines = 0;

    for (index=0; index<TM_NUM_TECHS; index++)
    {
        if (tmTechForSale[index] == TM_TECH_IS_FOR_SALE)

        newline=TRUE;
        if (newline)
        {
            newline = FALSE;
            numlines++;
        }
    }


    y = region->rect.y0 + TM_ASMarginTop;

    newline=FALSE;
    numlines=0;

    for (index=0; index < TM_NUM_TECHS; index++)
    {
        price = (tmTechPrice[index] * tmPriceScale) / 100;

        if (y + fontHeight(" ") >= region->rect.y1)
        {
            break;
        }

        if (tmTechForSale[index] == TM_TECH_IS_FOR_SALE)
        {
            if (universe.curPlayerPtr->resourceUnits < price)
            {                                                   //if this tech already selected
                c = TM_CantAffordTextColor;
            }
            else
            {
                c = TM_StandardTextColor;
                buyable++;
            }

            if (index == tmTechSelected)
            {
                c = TM_SelectionTextColor;
            }
                        //tech fancy name
            x = region->rect.x0 + TM_ASMarginLeft;
            fontPrint(x, y, c, RaceSpecificTechTypeToNiceString(index,universe.curPlayerPtr->race));

            newline = TRUE;

            tmDirtyTechInfo();
        }

        if (newline)
        {
            newline = FALSE;

            y+= fontHeight(" ") + TM_ASInterSpacing;
            numlines++;
        }
    }
    tmStuffToBuy = buyable;

    fontMakeCurrent(currentFont);
    //tmDirtyTechInfo();
}
コード例 #25
0
/*-----------------------------------------------------------------------------
    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));
        }
    }
}
コード例 #26
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
void tmDialogDraw(featom *atom, regionhandle region)
{
    sdword      x,y, width;
    char       *pos, *oldpos;
    char        stringtoprint[650];
    bool        justified, done;
    fonthandle oldfont;

    char tmKASMissing[] = "Hello there, fellow space travellers!  Until somebdoy gives me some new lines in KAS, that is all I can say.";

    tmDialogRegion = region;

    oldfont = fontMakeCurrent(tmFont);

    feStaticRectangleDraw(region);                          //draw regular rectangle as backdrop

    x = region->rect.x0 + 15;
    y = region->rect.y0 + 5 ;

    if (tmKASDialog[tmDialogPhrase])
        strcpy(stringtoprint,tmKASDialog[tmDialogPhrase]);
    else
        strcpy(stringtoprint,tmKASMissing);

    y += TM_VertSpacing + fontHeight(" ");

    pos = stringtoprint;

    done = FALSE;
    while (!done)
    {
        justified = FALSE;
        tline[0]=0;
        while (!justified)
        {
            strcpy(oldtline, tline);
            oldpos = pos;
            pos = getWord(tline, pos);

            if (pos[0] == '\n')
            {
                justified = TRUE;
                pos++;
                while ( pos[0] == ' ' ) pos++;
            }
            else
            {
                if ( (width=fontWidth(tline)) > TM_InfoWidth - 15)
                {
                    strcpy(tline, oldtline);
                    pos = oldpos;
                    while ( pos[0] == ' ' ) pos++;

                    justified = TRUE;
                }
                if (pos[0]==0)
                {
                    justified = TRUE;
                    done      = TRUE;
                }
            }
        }

        fontPrintf(x,y,TM_StandardTextColor,"%s",tline);
        y += fontHeight(" ");
        if (y > region->rect.y1 + fontHeight(" ")) done=TRUE;

    }
    fontMakeCurrent(oldfont);
}
コード例 #27
0
void gpDeleteGame(char *name, featom *atom)
{
    char filename[PATH_MAX] = "";
    sdword i;
    sdword index;
    fonthandle  oldfont;

    if (!gpGetGameName(name,atom,filename))
    {
        return;
    }

    // gpCurrentSelected will be set by gpGetGameName

    feScreenDisappear(NULL, NULL);

    char *tmpFilePath = filePathPrepend(filename, FF_UserSettingsPath);
    strcpy(filename, tmpFilePath);
    fileDelete(filename);

    if (SavedGamesPath == RecordedGamesPath)
    {
        char tmpfile[PATH_MAX] = "";
        strcpy(tmpfile,filename);
        strcat(tmpfile,PKTS_EXTENSION);
        fileDelete(tmpfile);
    }

    for (i=gpCurrentSelected;i<gpNumberGames-1;i++)
    {
        gpGames[i] = gpGames[i+1];
    }
    gpNumberGames--;
    if (gpNumberGames == 0)
    {
        gpCurrentSelected = 0;
    }
    else if (gpCurrentSelected >= gpNumberGames)
    {
        gpCurrentSelected--;
        dbgAssertOrIgnore(gpCurrentSelected >= 0);
        dbgAssertOrIgnore(gpCurrentSelected < gpNumberGames);
    }

    dbgAssertOrIgnore(gpNumberGames >= 0);

    oldfont = fontMakeCurrent(gpListFont);      // fontHeight called later on in this function

    uicListCleanUp(gpGameListWindow);

    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);

    for (index = 0; index < gpNumberGames; index++)
    {
        if (index==gpCurrentSelected)
            uicListAddItem(gpGameListWindow, (ubyte *)&gpGames[index], UICLI_CanSelect|UICLI_Selected, UICLW_AddToTail);
        else
            uicListAddItem(gpGameListWindow, (ubyte *)&gpGames[index], UICLI_CanSelect, UICLW_AddToTail);
    }

    fontMakeCurrent(oldfont);
}
コード例 #28
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
void tmTechInfoDraw(featom *atom, regionhandle region)
{
    fonthandle  currentFont;
    sdword      x,y, width;
    char       *pos, *oldpos;
    char        stringtoprint[650];
    bool        justified, done;

    tmTechInfoRegion = region;

    feStaticRectangleDraw(region); //draw standard rectangle

    currentFont = fontMakeCurrent(tmTechListFont);

    x = region->rect.x0 + 15;
    y = region->rect.y0 + 5 ;

    if (tmtechinfo != -1)
    {
        fontPrintf(x,y,TM_SelectionTextColor,"%s",RaceSpecificTechTypeToNiceString(tmtechinfo, universe.curPlayerPtr->race));

        y += TM_VertSpacing + fontHeight(" ");

        // Bad bad design, my fault [Drew] doh!
        if (tmtechinfo==DDDFDFGFTech)
            if (universe.curPlayerPtr->race==R1)
                strcpy(stringtoprint,strGetString(strR1DDDFTechinfo));
            else
                strcpy(stringtoprint,strGetString(strR2DFGFTechinfo));
        else if (tmtechinfo==CloakDefenseFighter)
            if (universe.curPlayerPtr->race==R1)
                strcpy(stringtoprint,strGetString(strR1CloakFighterinfo));
            else
                strcpy(stringtoprint,strGetString(strR2DefenseFighterTechinfo));
        else
            if (universe.curPlayerPtr->race==R1)
                strcpy(stringtoprint,strGetString(tmtechinfo+strTechInfoOffsetR1));
            else
                strcpy(stringtoprint,strGetString(tmtechinfo+strTechInfoOffsetR2));

        pos = stringtoprint;

        done = FALSE;
        while (!done)
        {
            justified = FALSE;
            tline[0]=0;
            while (!justified)
            {
                strcpy(oldtline, tline);
                oldpos = pos;
                pos = getWord(tline, pos);

                if (pos[0] == '\n')
                {
                    justified = TRUE;
                    pos++;
                    while ( pos[0] == ' ' ) pos++;
                }
                else
                {
                    if ( (width=fontWidth(tline)) > TM_InfoWidth - 15)
                    {
                        strcpy(tline, oldtline);
                        pos = oldpos;
                        while ( pos[0] == ' ' ) pos++;

                        justified = TRUE;
                    }
                    if (pos[0]==0)
                    {
                        justified = TRUE;
                        done      = TRUE;
                    }
                }
            }

            fontPrintf(x,y,TM_StandardTextColor,"%s",tline);
            y += fontHeight(" ");
            if (y > region->rect.y1 + fontHeight(" ")) done=TRUE;
        }
    }

    fontMakeCurrent(currentFont);
}
コード例 #29
0
ファイル: ping.c プロジェクト: spippolatore/homeworld-1
/*-----------------------------------------------------------------------------
    Name        : pingListDraw
    Description : Draw all pings from farthest to nearest.
    Inputs      : camera - the camera we're rendering from
                  modelView, projection - current matrices
                  viewPort - rectangle we're rending in, for the TO legend
    Outputs     :
    Return      :
    Note        : The renderer should be in 2D mode at this point.
----------------------------------------------------------------------------*/
void pingListDraw(Camera *camera, hmatrix *modelView, hmatrix *projection, rectangle *viewPort)
{
    real32 pingAge, pingCycle, pingMod, pingSize;
    real32 x, y, radius;
    Node *thisNode, *nextNode;
    ping *thisPing;
    vector distSquared;
    sdword nSegments, index, rowHeight, xScreen, yScreen;
    oval o;
    udword TOFlags = 0;
    fonthandle fhSave;
    toicon *icon;
    color col;
    real32 realMargin;
    ShipClass shipClass;
    static real32 lastProximityPing = REALlyBig;
    static real32 lastAnomolyPing = REALlyBig;
    static real32 lastBattlePing = REALlyBig;
    static real32 lastHyperspacePing = REALlyBig;
    static real32 lastNewshipPing = REALlyBig;
    bool pingset;

    //start by sorting the ping list from farthest to nearest
    thisNode = pingList.head;

    while (thisNode != NULL)
    {                                                       //scan all pings
        nextNode = thisNode->next;
        thisPing = listGetStructOfNode(thisNode);

        if (thisPing->owner != NULL)
        {
            thisPing->centre = thisPing->owner->posinfo.position;
        }
        vecSub(distSquared, camera->eyeposition, thisPing->centre);
        thisPing->cameraDistanceSquared = vecMagnitudeSquared(distSquared);
        TOFlags |= thisPing->TOMask;

        thisNode = nextNode;
    }
    listMergeSortGeneral(&pingList, pingListSortCallback);

    //now the list is sorted; proceed to draw all the pings
    thisNode = pingList.head;

    pingset = FALSE;

    while (thisNode != NULL)
    {                                                       //scan all pings
        nextNode = thisNode->next;
        thisPing = listGetStructOfNode(thisNode);

        pingCycle = thisPing->pingDuration + thisPing->interPingPause;
        pingAge = universe.totaltimeelapsed - thisPing->creationTime;
        pingMod = (real32)fmod((double)pingAge, (double)pingCycle);
        if (pingMod <= thisPing->pingDuration)
        {
            pingSize = (thisPing->size - thisPing->minSize) * pingMod / thisPing->pingDuration + thisPing->minSize;
            selCircleComputeGeneral(modelView, projection, &thisPing->centre, max(thisPing->size,thisPing->minSize), &x, &y, &radius);
            if (radius > 0.0f)
            {
                radius = max(radius, thisPing->minScreenSize);
                radius *= pingSize / max(thisPing->size,thisPing->minSize);
                o.centreX = primGLToScreenX(x);
                o.centreY = primGLToScreenY(y);
                o.radiusX = o.radiusY = primGLToScreenScaleX(radius);
                nSegments = pieCircleSegmentsCompute(radius);
                primOvalArcOutline2(&o, 0.0f, 2*PI, 1, nSegments, thisPing->c);

                /* starting to draw a new ping so play the sound */
                if (!smZoomingIn && !smZoomingOut && !pingset)
                {
                    switch (thisPing->TOMask)
                    {
                        case PTOM_Anomaly:
                            if (pingSize <=lastAnomolyPing)
                            {
                                soundEvent(NULL, UI_SensorsPing);
                                pingset = TRUE;
                                lastAnomolyPing = pingSize;
                            }
                            break;
                        case PTOM_Battle:
                            if (pingSize <= lastBattlePing)
                            {
                                soundEvent(NULL, UI_PingBattle);
                                pingset = TRUE;
                                lastBattlePing = pingSize;
                            }
                            break;
                        case PTOM_Hyperspace:
                            if (pingSize <=  lastHyperspacePing)
                            {
                                soundEvent(NULL, UI_PingHyperspace);
                                pingset = TRUE;
                                lastHyperspacePing = pingSize;
                            }
                            break;
                        case PTOM_Proximity:
                            if (pingSize <= lastProximityPing)
                            {
                                soundEvent(NULL, UI_PingProximity);
                                pingset = TRUE;
                                lastProximityPing = pingSize;
                            }
                            break;
                        case PTOM_NewShips:
                            if (pingSize <= lastNewshipPing)
                            {
                                soundEvent(NULL, UI_PingNewShips);
                                pingset = TRUE;
                                lastNewshipPing = pingSize;
                            }
                            break;
                        default:
                            break;
                    }
                }
            }
        }

        thisNode = nextNode;
    }

    //draw the blip TO
    if (smTacticalOverlay)
    {
        realMargin = primScreenToGLScaleX(viewPort->x0);
        fhSave = fontCurrentGet();                          //save the current font
        fontMakeCurrent(selGroupFont2);                     // use a common, fairly small font
        rowHeight = fontHeight("M");                        // used to space the legend
        yScreen = viewPort->y0 + rowHeight;                 //leave some space at the top to start
        radius = primScreenToGLScaleX(rowHeight)/2;
        xScreen = viewPort->x0 + (sdword)(rowHeight * 2.5);

        for (index = 0; index < PTO_NumberTOs; index++)
        {
            if ((TOFlags & pingTOList[index].bitMask))
            {
    //            fontPrint(xScreen, yScreen, *pingTOList[index].c, "O");
                pingTOList[index].lastTimeDrawn = universe.totaltimeelapsed;
            }
            if (universe.totaltimeelapsed - pingTOList[index].lastTimeDrawn <= pingTOLingerTime)
            {
                o.centreX = viewPort->x0 + rowHeight * 3 / 2;
                o.centreY = yScreen + rowHeight / 2;
                o.radiusX = o.radiusY = rowHeight / 2;
                primOvalArcOutline2(&o, 0.0f, TWOPI, 1, pingTONSegments, *pingTOList[index].c);
                fontPrint(xScreen, yScreen, TO_TextColor, strGetString(pingTOList[index].stringEnum));
                yScreen += rowHeight + 1;
            }
        }
        for (shipClass = 0; shipClass < NUM_CLASSES; shipClass++)
        {
            if (!toClassUsed[shipClass][0])
            {
                continue;
            }
            icon = toClassIcon[shipClass];
            fontPrint(xScreen, yScreen + (rowHeight>>2), TO_TextColor, ShipClassToNiceStr(shipClass));
#if TO_STANDARD_COLORS
            col = teFriendlyColor;
#else
            col = teColorSchemes[universe.curPlayerIndex].tacticalColor;
#endif
            col = colRGB(colRed(col)/TO_IconColorFade, colGreen(col)/TO_IconColorFade, colBlue(col)/TO_IconColorFade);
            primLineLoopStart2(1, col);

            for (index = icon->nPoints - 1; index >= 0; index--)
            {
               primLineLoopPoint3F(realMargin + primScreenToGLX(rowHeight*1.5) + icon->loc[index].x * radius,
                                          primScreenToGLY(yScreen + rowHeight/2) + icon->loc[index].y * radius);
            }
            primLineLoopEnd2();
            yScreen += rowHeight + 1;
        }

        fontMakeCurrent(fhSave);
    }
}