Пример #1
0
void CVehicleUpgrades::AddAllUpgrades ( void )
{
    unsigned short usUpgrade = 1000;
    for ( ; usUpgrade <= 1193 ; usUpgrade++ )
    {
        AddUpgrade ( usUpgrade );
    }
}
Пример #2
0
void HUDInterface::Update ()
{

	if ( IsVisible () ) {

		int screenw = app->GetOptions ()->GetOptionValue ( "graphics_screenwidth" );
		int screenh = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" );

		// Update the location, date/time 

		char caption [128];
		char *date = game->GetWorld ()->date.GetLongString ();

        UplinkStrncpy ( caption, game->GetWorld ()->GetPlayer ()->GetRemoteHost ()->ip, sizeof ( caption ) );

		EclGetButton ( "hud_location" )->SetCaption ( caption );
		EclGetButton ( "hud_date" )->SetCaption ( date );
		
		// Update the messages on display

		for ( int mi = 0; mi < game->GetWorld ()->GetPlayer ()->messages.Size (); ++mi ) {

			char bname [128];
			UplinkSnprintf ( bname, sizeof ( bname ), "hud_message %d", mi );
			if ( !EclGetButton ( bname ) ) {
				EclRegisterButton ( 222, screenh - 41, 24, 24, "", "Read this message", bname );
				button_assignbitmaps ( bname, "hud/email.tif", "hud/email_h.tif", "hud/email_c.tif" );
				EclRegisterButtonCallbacks ( bname, imagebutton_draw, EmailClick, button_click, EmailHighlight );
				EclRegisterMovement ( bname, screenw - 30 * (mi+1), screenh - 41, 1000 );
                SgPlaySound ( RsArchiveFileOpen ("sounds/newmail.wav"), "sounds/newmail.wav", false );
			}	

		}

		// What the f**k is this for?
		// It removes any message buttons that shouldn't be there 
		// (ie if they have been deleted)

        int removeMessageIndex = game->GetWorld ()->GetPlayer ()->messages.Size ();
		char bname [128];
		UplinkSnprintf ( bname, sizeof ( bname ), "hud_message %d", removeMessageIndex );
        while ( EclGetButton ( bname ) ) {
			EclRemoveButton ( bname );
            ++removeMessageIndex;
            UplinkSnprintf ( bname, sizeof ( bname ), "hud_message %d", removeMessageIndex );
        }


		// Update the missions on display

		int baseX = screenw - 30 * (game->GetWorld ()->GetPlayer ()->messages.Size () + 1);

		for ( int msi = 0; msi < game->GetWorld ()->GetPlayer ()->missions.Size (); ++msi ) {

			char bname [128];
			UplinkSnprintf ( bname, sizeof ( bname ), "hud_mission %d", msi );

			if ( !EclGetButton ( bname ) ) {
				EclRegisterButton ( 222, screenh - 41, 24, 24, "", "View this mission", bname );
				button_assignbitmaps ( bname, "hud/mission.tif", "hud/mission_h.tif", "hud/mission_c.tif" );
				EclRegisterButtonCallbacks ( bname, imagebutton_draw, MissionClick, button_click, MissionHighlight );
				EclRegisterMovement ( bname, baseX - 30 * msi, screenh - 41, 1000 );
                SgPlaySound ( RsArchiveFileOpen ("sounds/newmail.wav"), "sounds/newmail.wav", false );
			}	
			else {
				if ( EclGetButton ( bname ) && EclGetButton ( bname )->x != baseX - 30 * msi )
					if ( EclIsAnimationActive ( bname ) == -1 )
						EclRegisterMovement ( bname, baseX - 30 * msi, screenh - 41, 300 );

			}

		}
		
		// Remove any mission buttons that shouldn't be here
        int removeMissionIndex = game->GetWorld ()->GetPlayer ()->missions.Size ();
        UplinkSnprintf ( bname, sizeof ( bname ), "hud_mission %d", removeMissionIndex );
        while ( EclGetButton ( bname ) ) {
			EclRemoveButton ( bname );
            ++removeMissionIndex;
            UplinkSnprintf ( bname, sizeof ( bname ), "hud_mission %d", removeMissionIndex );
        }

        // Add / remove any upgrade buttons

        if ( game->GetWorld ()->GetPlayer ()->gateway.HasHUDUpgrade ( HUDUPGRADE_CONNECTIONANALYSIS ) ) 
            if ( !IsUpgradeVisible ( HUDUPGRADE_CONNECTIONANALYSIS ) )
                    AddUpgrade ( HUDUPGRADE_CONNECTIONANALYSIS );

        if ( game->GetWorld ()->GetPlayer ()->gateway.HasHUDUpgrade ( HUDUPGRADE_IRCCLIENT ) ) 
            if ( !IsUpgradeVisible ( HUDUPGRADE_IRCCLIENT ) )
                    AddUpgrade ( HUDUPGRADE_IRCCLIENT );

        if ( game->GetWorld ()->GetPlayer ()->gateway.HasHUDUpgrade ( HUDUPGRADE_LANVIEW ) ) 
            if ( !IsUpgradeVisible ( HUDUPGRADE_LANVIEW ) )
                    AddUpgrade ( HUDUPGRADE_LANVIEW );

		// Update the world map and software menu

		wmi.Update ();
		si.Update ();

		// Update the task manager

		SvbUpdateInterface ();

	}

}