#include "Content\\ShellScripts\\stddefs.h" #include "Content\\ShellScripts\\ScriptStrings.h" #include "Content\\ShellScripts\\buttons.script" #include "Content\\ShellScripts\\ErrorScreen.script" #include "Content\\ShellScripts\\common_shell.script" // jcem //#include "Content\\ShellScripts\\MechLabHeaders.h" #define ALPHA_MIN 0 #define ALPHA_DEC 15 // fade out deccrement down to ALPHA_MIN #define ALPHA_INIT_VALUE 5 // should be between ALPHA_MIN < & < ALPHA_MAX #define ALPHA_INC 15 // fade in incrementsupward ALPHA_MAX #define ALPHA_MAX 120 // #define RANK_MAXLOOPS 10 // 9 // sync w/ gs_multi_id.script #define TITLE_HEIGHT 28 #define TITLE_GAPY 9 #define RANK_YSTART (220 - 18) // (RANK_L_HEIGHT... + ( 2 * RANK_H_THIN...) #define RANK_LMARGIN 160 #define RANK_RMARGIN (160 - 30) #define RANK_TOTALX (800 - RANK_LMARGIN - RANK_RMARGIN) #define RANK_H_THICK 4 #define RANK_H_THIN 2 #define RANK_T_HEIGHT 20 #define RANK_L_HEIGHT 20 #define NAME_TIME_HEIGHT 60 // 60 pixel high #define MAX_IDLE 15000 #define MAX_IDLE2 10000 main { GUI_CREATE { //Makes the connection to the string table .dll //Requires the #include "Content\\ShellScripts\\ScriptStrings.h" in every script with localizable text setresource("ScriptStrings.dll") location = 0, 0, 10000 if callback($$CTCL_CheckUseJPD$$) setpointer(0) object screen = o_ID_Screen initialize(screen) focus(screen.o_fscreen) if 0 // exists(@mainmenu@) { deactivate(@mainmenu@o_lighting_movie) activate(@mainmenu@o_mainscrn_ctr) } mail(25, @shell@volumn_control) } GUI_DESTROY { if 0 // exists(@mainmenu@) { deactivate(@mainmenu@o_mainscrn_ctr) activate(@mainmenu@o_lighting_movie) } } } o_ID_Screen { GUI_CREATE { int nTimeCutOFF int nTime_Quit = MAX_IDLE int nTime_Left = -1 int nTime_Cur // temp value nTimeCutOFF = gettimex() + nTime_Quit framerate=10 sound sndOpenPanel = SPATH "sfx_vtol_drop.wav" // sfx_turret_actuator.wav play sndOpenPanel, 1 callback($$CTCL_SetDispStateCOOP$$, 0, 1, 1) callback($$CTCL_SetDispStateCOOP$$, 1, 1, 0) callback($$CTCL_SetDispStateCOOP$$, 2, 1, 1) callback($$CTCL_SetDispStateCOOP$$, 3, 1, 1) font3d TitleFont = "arial.ttf" font3d font_mesg = "arial.ttf" // FPATH "" if callback($$CTCL_GetACP$$) == 949 // korean font3d help_font = "±¼¸².ttf" else font3d help_font = "arial.ttf" // FPATH "" font3d boldfont = FPATH localize$(IDS_F_MP_SCOREBOARD_BOLD) font3d regfont = FPATH localize$(IDS_F_MP_SCOREBOARD_REG) object o_fscreen = s_fscreen //o_fscreen.playHorz = 1 //o_fscreen.playVert = 1 initialize(o_fscreen) pane p_infopanel = "hsh\\coop\\infopanel.png" color(p_infopanel) = packcolor(255, 255, 255, 255) alphamode(p_infopanel) = am_alpha_alphainvalpha int nDiffX = 15 int nPanelX = -getwidth(p_infopanel) pane p_rank = "hsh\\coop\\rank.png" color(p_rank) = packcolor(255, 255, 255, 255) alphamode(p_rank) = am_alpha_alphainvalpha pane p_Focusing = "hsh\\coop\\focusing.png" color(p_Focusing) = packcolor(255, 255, 255, 255) alphamode(p_Focusing) = am_alpha_alphainvalpha int nTimeTemp int nFocusingWidth = getwidth(p_Focusing) + 5 // variables for fading in and out int alpha_val = ALPHA_INIT_VALUE int fadeout = false int nRetBut = 0 int team_color[8] int teamplayer_color[8] team_color[0] = packcolor(50, 50, 150, 255) team_color[1] = packcolor(100, 50, 50, 255) team_color[2] = packcolor(50, 150, 50, 255) team_color[3] = packcolor(200, 200, 50, 255) team_color[4] = packcolor(150, 50, 150, 255) team_color[5] = packcolor(50, 100, 150, 255) team_color[6] = packcolor(100, 50, 100, 255) team_color[7] = packcolor(0, 200, 100, 255) teamplayer_color[0] = packcolor(50, 50, 150, 150) teamplayer_color[1] = packcolor(100, 50, 50, 150) teamplayer_color[2] = packcolor(50, 150, 50, 150) teamplayer_color[3] = packcolor(200, 200, 50, 150) teamplayer_color[4] = packcolor(150, 50, 150, 150) teamplayer_color[5] = packcolor(50, 100, 150, 150) teamplayer_color[6] = packcolor(100, 50, 100, 150) teamplayer_color[7] = packcolor(0, 200, 100, 150) int naFlags[RANK_MAXLOOPS] // -1: team, 0: normal player, +1: bot player, +2: current player string saRank[RANK_MAXLOOPS] string saNames[RANK_MAXLOOPS] int naScores[RANK_MAXLOOPS] int naKills[RANK_MAXLOOPS] int naDeaths[RANK_MAXLOOPS] int nLastIdx = $$m_scorePlyrIndex$$ // RANK_MAXLOOPS int nScores nScores = $$m_scoreCount$$ if (RANK_MAXLOOPS < nScores) nScores = RANK_MAXLOOPS // Now store the pilot entries in the list box int nInfoIdx = 0 int nHighScore = -9999 if ($$m_scoreTeamAllowed$$) { // sort the team score first int sorted_team_score[8] int sorted_team[8] for (int j = 0; j < 8; j++) { sorted_team_score[j] = $$m_scoreTeamScores$$[j] sorted_team[j] = j } int tmp_score = 0 int tmp_team = 0 int biggest_team = 0 int i = 0 for (j = 0; j < 8; j++) { biggest_team = j for (i = j; i < 8; i++) { if (sorted_team_score[biggest_team] < sorted_team_score[i]) biggest_team = i } if (biggest_team != j) { tmp_score = sorted_team_score[j] sorted_team_score[j] = sorted_team_score[biggest_team] sorted_team_score[biggest_team] = tmp_score tmp_team = sorted_team[j] sorted_team[j] = sorted_team[biggest_team] sorted_team[biggest_team] = tmp_team } } int mc_row_count = 0 int player_count = 0 int k = 0 for (j = 0; j < 8; j++) { k = sorted_team[j] if ($$m_scoreTeamCounts$$[k]) { nScores++ // team information will be added if (RANK_MAXLOOPS < nScores) nScores = RANK_MAXLOOPS if (j == 0) { nHighScore = $$m_scoreTeamScores$$[k] } if (nInfoIdx < nScores) { naFlags[nInfoIdx] = -1 if nHighScore == $$m_scoreTeamScores$$[k] saRank[nInfoIdx] = "Win" else saRank[nInfoIdx] = "Lose" saNames[nInfoIdx] = "Team " conv$(k + 1) naScores[nInfoIdx] = $$m_scoreTeamScores$$[k] naKills[nInfoIdx] = $$m_scoreTeamKills$$[k] naDeaths[nInfoIdx] = $$m_scoreTeamDeaths$$[k] nInfoIdx++ } player_count = 0 for (i = 0; i < k; i++) { player_count += $$m_scoreTeamCounts$$[i] } for (i = 0; i < $$m_scoreTeamCounts$$[k]; i++) { if (nInfoIdx < nScores) { if player_count == nLastIdx naFlags[nInfoIdx] = +2 else { if $$m_scorePlyrs$$[player_count] < 0 naFlags[nInfoIdx] = +1 // bot else naFlags[nInfoIdx] = 0 } if nHighScore == $$m_scoreTeamScores$$[k] saRank[nInfoIdx] = "Win" else saRank[nInfoIdx] = "Lose" saNames[nInfoIdx] = $$m_scoreNames$$[player_count] naScores[nInfoIdx] = $$m_scoreScores$$[player_count] naKills[nInfoIdx] = $$m_scoreKills$$[player_count] naDeaths[nInfoIdx] = $$m_scoreDeaths$$[player_count] nInfoIdx++ } player_count++ } } } } else { int nRank = 0 for (nInfoIdx = 0; nInfoIdx < nScores; nInfoIdx++) // $$m_scoreCount$$ { if nInfoIdx == nLastIdx naFlags[nInfoIdx] = +2 else { if $$m_scorePlyrs$$[nInfoIdx] < 0 naFlags[nInfoIdx] = +1 // bot else naFlags[nInfoIdx] = 0 } if (nInfoIdx == 0) || (nHighScore != $$m_scoreScores$$[nInfoIdx]) { nHighScore = $$m_scoreScores$$[nInfoIdx] nRank++ } saRank[nInfoIdx] = conv$(nRank) saNames[nInfoIdx] = $$m_scoreNames$$[nInfoIdx] naScores[nInfoIdx] = $$m_scoreScores$$[nInfoIdx] naKills[nInfoIdx] = $$m_scoreKills$$[nInfoIdx] naDeaths[nInfoIdx] = $$m_scoreDeaths$$[nInfoIdx] } } callback($$CTCL_CheckCampaign$$, 3, 0) } GUI_INIT { } GUI_EXECUTE { if (!fadeout) { nTime_Cur = gettimex() if nTimeCutOFF <= nTime_Cur { // esc.. cancel this screen //play btnTriggeredSound,1 fadeout = true nRetBut = fs_but2 return } else { nTime_Cur = nTimeCutOFF - nTime_Cur nTime_Cur = nTime_Cur + 500 // round up nTime_Cur = nTime_Cur / 1000 // as sec if nTime_Cur < 0 nTime_Cur = 0 if (nTime_Quit / 1000) < nTime_Cur nTime_Cur = nTime_Quit / 1000 // display as sec... nTime_Left = nTime_Cur } } if fadeout == true { // Fading out(Exiting) if ALPHA_MIN < alpha_val { alpha_val = alpha_val - ALPHA_DEC if alpha_val <= ALPHA_MIN { alpha_val = ALPHA_MIN @shell@id_type_is_single = 1 unfocus @SHELL@currentScreen = MAINMENU // @SHELL@lastScreen[@SHELL@lastScreenDepth] // mainmenu? @SHELL@lastScreenDepth-- //script_end "gs_multi_rank.script" } } return } else { // Fading in(Entering) if alpha_val < ALPHA_MAX { alpha_val += ALPHA_INC if alpha_val >= ALPHA_MAX { alpha_val = ALPHA_MAX } } } nDiffX = nDiffX + 15 if nPanelX < 0 nPanelX = nPanelX + nDiffX if 0 < nPanelX nPanelX = 0 } GUI_DRAW { render @shell@p_bkgnd_4coop, 0, 0, 0 setpencolor(0, 0, 40, alpha_val) drawrect 0, 0 to getresx(), getresy() int boxcolor int y #if 0 boxcolor = packcolor(0, 0, 120, 255) // blue setpencolor(boxcolor) drawrect 0, 0 to getresx(), getresy() #endif render p_infopanel, nPanelX, 0, 0 render p_rank, nPanelX + RANK_LMARGIN, RANK_YSTART - (TITLE_HEIGHT + TITLE_GAPY), 0 y = RANK_YSTART // rank callsign score kill death int nTotal = 4 + 14 + 6 + 5 + 5 // 34 int nRankX = RANK_LMARGIN int nCallX = nRankX + ((RANK_TOTALX * 4) / nTotal) int nTotalEndX = RANK_LMARGIN + RANK_TOTALX int nDeathX = nTotalEndX - ((RANK_TOTALX * 5) / nTotal) int nKNDX = nDeathX - ((RANK_TOTALX * 5) / nTotal) int nScoreX = nKNDX - ((RANK_TOTALX * 6) / nTotal) int text_size int n_color text_size = -(1000 + RANK_T_HEIGHT) n_color = packcolor(255,255,0,255) print3d_attributes = TitleFont, n_color, text_size,0,1,1,0,just_left,1 print3d_position = nPanelX + nRankX, y print3d "Rank" print3d_position = nPanelX + nCallX, y print3d "Callsign" print3d_position = nPanelX + nScoreX, y print3d "Score" print3d_position = nPanelX + nKNDX, y print3d "Kill" // "Kill/Death" print3d_position = nPanelX + nDeathX, y print3d "Death" y = y + RANK_T_HEIGHT boxcolor = packcolor(40, 40, 40, 255) // gray setpencolor(boxcolor) y = y + RANK_H_THICK drawrect nPanelX + RANK_LMARGIN, y to nPanelX + getresx() - RANK_RMARGIN, y + RANK_H_THICK y = y + RANK_H_THICK + RANK_H_THICK text_size = -(1000 + RANK_L_HEIGHT) n_color = packcolor(255,255,0,255) print3d_attributes = TitleFont, n_color, text_size,0,1,1,0,just_left,1 int nLoopRank string text int w for nLoopRank = 0; nLoopRank < nScores; nLoopRank++ { if (0 <= nPanelX) // 0 < length$(saNames[nLoopRank]) { #if 0 if nLoopRank = 0 { text_size = -(1000 + RANK_T_HEIGHT) n_color = packcolor(255,255,255,255) print3d_attributes = TitleFont, n_color, text_size,0,1,1,0,just_left,1 print3d_position = nPanelX + nCallX, RANK_YSTART - RANK_T_HEIGHT print3d "Game: " $$m_gameTypeStr$$ " Map: " $$m_scoreMapName$$ text_size = -(1000 + RANK_L_HEIGHT) } #endif switch(naFlags[nLoopRank]) { case -1: // team n_color = packcolor(0,255,128,255) break case 0: // normal player n_color = packcolor(220,220,220,255) break case +1: // bot player n_color = packcolor(200,200,200,255) break case +2: // current player n_color = packcolor(255,255,0,255) nTimeTemp = gettimex() % 600 if nTimeTemp < 300 render p_Focusing, nRankX - nFocusingWidth, y, 9999 break } print3d_attributes = TitleFont, n_color, text_size,0,1,1,0,just_left,1 text = saRank[nLoopRank] w = getprint3dwidth(text) print3d_position = nRankX + (((nCallX - nRankX) - w) / 2), y print3d text print3d_position = nCallX, y print3d saNames[nLoopRank] print3d_position = nScoreX, y print3d conv$(naScores[nLoopRank]) print3d_position = nKNDX, y print3d conv$(naKills[nLoopRank]) // "/" print3d_position = nDeathX, y print3d conv$(naDeaths[nLoopRank]) } y = y + RANK_L_HEIGHT y = y + RANK_H_THIN if (nLoopRank + 1 < RANK_MAXLOOPS) drawrect nPanelX + RANK_LMARGIN, y to nPanelX + getresx() - RANK_RMARGIN, y + RANK_H_THIN y = y + RANK_H_THIN + RANK_H_THIN } if (nPanelX == 0) && (nTime_Left != -1) { print3d_margins = 610, 140 to 690, 214 text = conv$(nTime_Left) text_size = -(1000 + NAME_TIME_HEIGHT) n_color = packcolor(255,255,255,255) print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_center,1 int nHeight = getprint3dheight(text) print3d_position = 610, 214 - nHeight print3d text // jcem - draw help text!!! if (nLastIdx != -1) { print3d_attributes = help_font, 0xff80ff00, -(1000 + 14), 1, 1, 1, 0, just_center print3d_margins = 140, 495 to 670, 530 print3d_position = 140, 495 if callback($$CTCL_GetACP$$) == 949 // korean { print3d "Á¶À̽ºÆ½ÀÇ ¹æ¾Æ¼è¸¦ ´ç±â°Å³ª ¾öÁö(¹Ì»çÀÏ) ¹öưÀ» ´­·¯ Ãʱâ È­¸éÀ¸·Î µ¹¾Æ°¡½Ç ¼ö ÀÖ½À´Ï´Ù." } else { print3d "Thumb button(on joystick) or Trigger for Main Screen." } } } } GUI_MAILBOX { if sender == o_fscreen { nTime_Cur = gettimex() nTime_Quit = nTimeCutOFF - nTime_Cur nTime_Quit = nTime_Quit / 1000 nTime_Quit = nTime_Quit * 1000 if nTime_Quit < MAX_IDLE2 nTime_Quit = MAX_IDLE2 if MAX_IDLE < nTime_Quit nTime_Quit = MAX_IDLE // possible? nTime_Left = nTime_Quit / 1000 nTimeCutOFF = gettimex() + nTime_Quit int kEvent = getmessage(1) if kEvent == fs_but1 { fadeout = true nRetBut = fs_but1 return } if kEvent == fs_but2 { // esc.. cancel this screen //play btnTriggeredSound,1 fadeout = true nRetBut = fs_but2 return } if (kEvent & fs_left) { } if (kEvent & fs_right) { } if (kEvent & fs_up) { } if (kEvent & fs_down) { } } } GUI_DESTROY { unfocus } }