Exemplo n.º 1
0
/*
===============
UI_SPUnlock_f
===============
*/
void UI_SPUnlock_f( void ) {
	char	arenaKey[16];
	char	scores[MAX_INFO_VALUE];
	int		level;
	int		tier;

	// get scores for skill 1
	_UI_trap_Cvar_VariableStringBuffer( "g_spScores1", scores, MAX_INFO_VALUE );

	// update scores
	for( level = 0; level < ui_numSinglePlayerArenas + ui_numSpecialSinglePlayerArenas; level++ ) {
		Com_sprintf( arenaKey, sizeof( arenaKey ), "l%i", level );
		Info_SetValueForKey( scores, arenaKey, "1" );
	}
	_UI_trap_Cvar_Set( "g_spScores1", scores );

	// unlock cinematics
	for( tier = 1; tier <= 8; tier++ ) {
		UI_ShowTierVideo( tier );
	}

	_UI_trap_Print( "All levels unlocked at skill level 1\n" );

	UI_SPLevelMenu_ReInit();
}
/*
=================
UI_SPPostgameMenu_MenuDraw
=================
*/
static void UI_SPPostgameMenu_MenuDraw( void ) {
    int		timer;
    int		serverId;
    int		n;
    char	info[MAX_INFO_STRING];

    trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
    serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
    if( serverId != postgameMenuInfo.serverId ) {
        UI_PopMenu();
        return;
    }

    // phase 1
    if ( postgameMenuInfo.numClients > 2 ) {
        UI_DrawProportionalString( 510, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[2], UI_CENTER, color_white );
    }
    UI_DrawProportionalString( 130, 480 - 64 - PROP_HEIGHT, postgameMenuInfo.placeNames[1], UI_CENTER, color_white );
    UI_DrawProportionalString( 320, 480 - 64 - 2 * PROP_HEIGHT, postgameMenuInfo.placeNames[0], UI_CENTER, color_white );

    if( postgameMenuInfo.phase == 1 ) {
        timer = uis.realtime - postgameMenuInfo.starttime;

        if( timer >= 1000 && postgameMenuInfo.winnerSound ) {
            trap_S_StartLocalSound( postgameMenuInfo.winnerSound, CHAN_ANNOUNCER );
            postgameMenuInfo.winnerSound = 0;
        }

        if( timer < 5000 ) {
            return;
        }
        postgameMenuInfo.phase = 2;
        postgameMenuInfo.starttime = uis.realtime;
    }

    // phase 2
    if( postgameMenuInfo.phase == 2 ) {
        timer = uis.realtime - postgameMenuInfo.starttime;
        if( timer >= ( postgameMenuInfo.numAwards * AWARD_PRESENTATION_TIME ) ) {

            if( timer < 5000 ) {
                return;
            }

            postgameMenuInfo.phase = 3;
            postgameMenuInfo.starttime = uis.realtime;
        }
        else {
            UI_SPPostgameMenu_DrawAwardsPresentation( timer );
        }
    }

    // phase 3
    if( postgameMenuInfo.phase == 3 ) {
        if( uis.demoversion ) {
            if( postgameMenuInfo.won == 1 && UI_ShowTierVideo( 8 )) {
                trap_Cvar_Set( "nextmap", "" );
                trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic demoEnd.RoQ\n" );
                return;
            }
        }
        else if( postgameMenuInfo.won > -1 && UI_ShowTierVideo( postgameMenuInfo.won + 1 )) {
            if( postgameMenuInfo.won == postgameMenuInfo.lastTier ) {
                trap_Cvar_Set( "nextmap", "" );
                trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; cinematic end.RoQ\n" );
                return;
            }

            trap_Cvar_SetValue( "ui_spSelection", postgameMenuInfo.won * ARENAS_PER_TIER );
            trap_Cvar_Set( "nextmap", "levelselect" );
            trap_Cmd_ExecuteText( EXEC_APPEND, va( "disconnect; cinematic tier%i.RoQ\n", postgameMenuInfo.won + 1 ) );
            return;
        }

        postgameMenuInfo.item_again.generic.flags &= ~QMF_INACTIVE;
        postgameMenuInfo.item_next.generic.flags &= ~QMF_INACTIVE;
        postgameMenuInfo.item_menu.generic.flags &= ~QMF_INACTIVE;

        UI_SPPostgameMenu_DrawAwardsMedals( postgameMenuInfo.numAwards );

        Menu_Draw( &postgameMenuInfo.menu );
    }

    // draw the scoreboard
    if( !trap_Cvar_VariableValue( "ui_spScoreboard" ) ) {
        return;
    }

    timer = uis.realtime - postgameMenuInfo.scoreboardtime;
    if( postgameMenuInfo.numClients <= 3 ) {
        n = 0;
    }
    else {
        n = timer / 1500 % (postgameMenuInfo.numClients + 2);
    }
    UI_SPPostgameMenu_MenuDrawScoreLine( n, 0 );
    UI_SPPostgameMenu_MenuDrawScoreLine( n + 1, 0 + SMALLCHAR_HEIGHT );
    UI_SPPostgameMenu_MenuDrawScoreLine( n + 2, 0 + 2 * SMALLCHAR_HEIGHT );
}