#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 #define UPD_BUTTONS (-32456) #define ALPHA_MIN 0 #define ALPHA_DEC 5 // fade out deccrement down to ALPHA_MIN #define ALPHA_INIT_VALUE 5 // should be between ALPHA_MIN < & < ALPHA_MAX #define ALPHA_INC 3 // fade in incrementsupward ALPHA_MAX #define ALPHA_MAX 50 // #define PANE_CETER_X 420 // briefing... #define BRF_X_DIVIDER 480 #define BRF_Y_SDTART 240 // continue? #define CON_WIDTH 634 // 634 * 203 continue.png #define CON_DEPTH 203 #define CON_TIME_HEIGHT 60 // 60 pixel high // score sheet after each sub-stage... #define RPT_WIDTH 170 // score-titles.png #define RPT_DEPTH 186 // 186 = RPT_SCORE_UPDN_GAP * 2 + RPT_SCORE_HEIGHT * 6 + RPT_YGAP * 5 #define RPT_SCORE_HEIGHT 30 // 20 // score: 21 pixel high #define RPT_SCORE_UPDN_GAP 3 // #define RPT_YGAP 12 // 15 pixels... #define RPT_YSHIFT 50 #define RPT_XGAP 20 // 15 pixels... #define RPT_XSHIFT (-(RPT_WIDTH / 2)) main { GUI_CREATE { if exists(@shell@) mail(25, @shell@volumn_control) //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, 20000 object pointer // 0: not paused - invitation in menu-state, 1: briefing, 2: score-sheet, 3: continue, 4: invited in single-game, 5: high-score(game-over?), 6: by ESC(for testing only)... int nWhyPaused nWhyPaused = callback($$CTCL_WhyPaused$$) //if nWhyPaused == 1 // sound sndOpenPanel = SPATH "sfx_warning_buzzer.wav" // "sfx_missile_flyby.wav" // "sfx_mech_dry_fire_projectile.wav" // "sfx_mech_dry_fire_projectile.wav" //else 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, 0) callback($$CTCL_SetDispStateCOOP$$, 3, 1, 1) object screen = o_PauseModalScreen initialize(screen) } } o_PauseModalScreen { GUI_CREATE { location = 0, 0, 30000 int nLoopSound = 0 if (nWhyPaused == 0) || (nWhyPaused == 4) { // invitation... int nYNC = 0 // -1: no, 0: cancel, 1: yes pane p_panel_13 = "hsh\\coop\\challenge.png" color(p_panel_13) = packcolor(255, 255, 255, 255) alphamode(p_panel_13) = am_alpha_alphainvalpha string strInviter callback($$CTCL_CheckCampaign$$, 8, strInviter) } if (nWhyPaused == 3) || (nWhyPaused == 6) { pane p_panel_13 = "hsh\\coop\\continue.png" color(p_panel_13) = packcolor(255, 255, 255, 255) alphamode(p_panel_13) = am_alpha_alphainvalpha } if (nWhyPaused == 1) || (nWhyPaused == 2) { 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) } if (nWhyPaused == 1) || (nWhyPaused == 2) { int nAdvanceTypeWriters = 0 int all_tw_displayed = 0 sound sndTW = SPATH "sfx_button7.wav" int nLocalLoop int nnnnn object o_TWs[10] // 6 for scoring... int nTimeGoal int nCamp_Stage int nSubStageNumber } if (nWhyPaused == 2) { string score_subtitles[6] score_subtitles[0] = "Stage Score :" score_subtitles[1] = "Play Time :" score_subtitles[2] = "Time Bonus :" score_subtitles[3] = "Destruction :" score_subtitles[4] = "Repair :" score_subtitles[5] = "Total Score :" int nStage int nScore int nKills int nDeaths int nDead int nEnemyCount int nTimePlayTotal int nSubStageScoreOld nStage = callback($$CTCL_CheckCampaign$$, 1, nScore, nKills, nDeaths, nDead, nEnemyCount, nTimePlayTotal, nTimeGoal, nSubStageScoreOld, nCamp_Stage, nSubStageNumber) float fRepair = 0.0 int nRepair switch(nSubStageNumber) { case 1: // sub-stage 1 fRepair = 0.15 nRepair = 15 break case 2: // sub-stage 2 fRepair = 0.20 nRepair = 20 break case 3: // sub-stage 3 fRepair = 0.30 nRepair = 30 break case 4: // boss fRepair = 1.0 nRepair = 100 break case 5: // bonus fRepair = 0.0 nRepair = 0 break } int nTimeBonus = 3000 + (nTimeGoal - nTimePlayTotal) * 50 if nTimeBonus < 0 nTimeBonus = 0 if 100000 < nTimeBonus nTimeBonus = 100000 for nLocalLoop = 0; nLocalLoop < 6; nLocalLoop++ { o_TWs[nLocalLoop] = s_typewriter o_TWs[nLocalLoop].nReqCount = 20 // 10 framerate then 1 sec... switch(nLocalLoop) { case 0: // stage score o_TWs[0].nEnd = nScore - nSubStageScoreOld break case 1: o_TWs[1].nEnd = nTimePlayTotal // value but display as time... break case 2: o_TWs[2].nEnd = nTimeBonus break case 3: if nEnemyCount == 0 { // as text... o_TWs[3].text = "?" // ?????????????????????????? o_TWs[3].nReqCount = 0 } else { nnnnn = 100 * nDead/nEnemyCount if (100 < nnnnn) nnnnn = 100 o_TWs[3].nEnd = nnnnn } break case 4: o_TWs[4].nEnd = nRepair break case 5: o_TWs[5].nEnd = nScore + nTimeBonus break } } if 0 < nRepair callback($$CTCL_CheckCampaign$$, 4, fRepair, nTimeBonus) } if (nWhyPaused == 1) { string names[10] int counts[10] int nEnemyTypes int nStageType nEnemyTypes = callback($$CTCL_CheckCampaign$$, 5, names[0], counts[0], nTimeGoal, nCamp_Stage, nSubStageNumber) switch(nSubStageNumber) { case 0: nStageType = 3 // trainning break case 1: case 2: case 3: nStageType = 0 // normal break case 4: nStageType = 1 // boss break case 5: nStageType = 2 // bonus } if (nStageType != 1) // ! noss { for nLocalLoop = 0; nLocalLoop < nEnemyTypes; nLocalLoop++ { o_TWs[nLocalLoop] = s_typewriter o_TWs[nLocalLoop].nReqCount = 20 // 10 framerate then 1 sec... o_TWs[nLocalLoop].nEnd = counts[nLocalLoop] } } } int nTimeCutOFF int nTime_Quit int nTime_Left = -1 if (nWhyPaused == 1) || (nWhyPaused == 2) { nTime_Quit = 5 * 1000 nTimeCutOFF = -1 // I'll set this later, after displaying infos... } else { if (nWhyPaused == 0) || (nWhyPaused == 4) nTime_Quit = 15 * 1000 else nTime_Quit = 10 * 1000 nTimeCutOFF = gettimex() + nTime_Quit } font3d font_mesg = "arial.ttf" // FPATH "" // delay is frame based not time based int delay = 4 int time_delayed = 0 framerate = 20 sound btnTriggeredSound = SPATH "sfx_button5.wav" // variables for fading in and out int alpha_val = ALPHA_INIT_VALUE int fadeout = false if callback($$CTCL_CheckUseJPD$$) { object o_fscreen = s_fscreen o_fscreen.playHorz = 1 o_fscreen.playVert = 1 initialize(o_fscreen) } } GUI_INIT { if callback($$CTCL_CheckUseJPD$$) { setpointer(0) focus(o_fscreen) } else { pointer = o_MousePointer pointer.showMousePointer = 1 // use the whole region //location = 0, 0, 0 region = 0, 0 to getresx(), getresy() focus(this) } } GUI_EXECUTE { if fadeout == true { // Fading out(Exiting) if alpha_val > ALPHA_MIN { alpha_val = alpha_val - ALPHA_DEC if alpha_val <= ALPHA_MIN { alpha_val = ALPHA_MIN unfocus script_end "gs_PauseModalCampaign.script" } } return } else { // Fading in(Entering) if alpha_val < ALPHA_MAX { alpha_val += ALPHA_INC if alpha_val >= ALPHA_MAX { alpha_val = ALPHA_MAX } } if (nWhyPaused == 0) || (nWhyPaused == 4) { if callback($$CTCL_CheckInviteCOOP$$, -1) < 0 { // check inviter exited? or still waiting?... if (nWhyPaused == 0) callback($$CTCL_CheckInviteCOOP$$, 2) else callback($$SetShellCommand$$, ExitToMainMenuCommand) fadeout = true return } } } if (nWhyPaused == 1) || (nWhyPaused == 2) nAdvanceTypeWriters = nAdvanceTypeWriters + 1 if (nWhyPaused == 1) || (nWhyPaused == 2) { nDiffX = nDiffX + 15 if nPanelX < 0 nPanelX = nPanelX + nDiffX if 0 < nPanelX nPanelX = 0 } if (time_delayed < delay) time_delayed++ if 0 <= nTimeCutOFF { int nTime_Cur = gettimex() if (nTimeCutOFF <= nTime_Cur) { nTimeCutOFF = -2 nTime_Left = 0 if (nWhyPaused == 0) || (nWhyPaused == 4) { #if 1 if nYNC == 1 { // yes? if (nWhyPaused == 0) callback($$CTCL_CheckInviteCOOP$$, 3) else callback($$SetShellCommand$$, ResumeMissionCommand) } else { // not yes: i.e. no or cancel if (nWhyPaused == 0) callback($$CTCL_CheckInviteCOOP$$, 2) else callback($$SetShellCommand$$, ExitToMainMenuCommand) } #endif fadeout = true } else { if (nWhyPaused == 6) mail(fs_id, fs_but1, this) else { mail(fs_id, fs_but2, this) } } 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 } } } GUI_DRAW { //setpencolor(0, 0, 100, alpha_val) //drawrect 0, 0 to getresx(), getresy() if (nWhyPaused == 0) || (nWhyPaused == 4) { render p_panel_13, (getresx() - CON_WIDTH) / 2, (getresy() - CON_DEPTH) / 2, 35000 } if (nWhyPaused == 3) || (nWhyPaused == 6) { render p_panel_13, (getresx() - CON_WIDTH) / 2, (getresy() - CON_DEPTH) / 2, 0 } if (nWhyPaused == 1) || (nWhyPaused == 2) { render p_infopanel, nPanelX, 0, 0 } string text int text_size int text_color = packcolor(255,255,255,255) int n_color = packcolor(255,255,255,255) int nWidth int nHeight int nDispX int nDispY switch(nWhyPaused) { case 1: if ((0 <= nPanelX) && ((getstatus(1) == 3) || nLoopSound)) { int w nDispX = BRF_X_DIVIDER // getresx() / 2 nDispY = BRF_Y_SDTART // getresy() / 2 int nTitleHeight int nTitleGap switch(nStageType) { case 0: text = "Attack Mission!" n_color = packcolor(255,255,0,255) nTitleHeight = 40 nDispY = 260 break case 1: text = "BOSS!" n_color = packcolor(255,0,0,255) nTitleHeight = 60 nDispY = 220 break case 2: text = "Bonus" n_color = packcolor(255,255,0,255) nTitleHeight = 40 nDispY = 260 break case 3: text = "Trainning" n_color = packcolor(255,255,0,255) nTitleHeight = 40 nDispY = 260 break } if (nStageType != 1) || (gettimex() % 800 < 400) { text_size = -(1000 + nTitleHeight) print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 w = getprint3dwidth(text) print3d_position = PANE_CETER_X - w / 2, nDispY print3d text } nDispY = nDispY + nTitleHeight + nTitleHeight / 2 if nStageType != 1 // no boss { text_size = -(1000 + 30) n_color = packcolor(255,255,255,255) // 220,220,220,255 print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 int nOldDispY = nDispY for nLocalLoop = 0; nLocalLoop < nEnemyTypes; nLocalLoop++ { text = names[nLocalLoop] " :" w = getprint3dwidth(text) print3d_position = nDispX - w, nDispY print3d text nDispY = nDispY + 30 + 15 } nDispY = nOldDispY all_tw_displayed = 1 for nLocalLoop = 0; (nLocalLoop < nEnemyTypes) && all_tw_displayed; nLocalLoop++ { if 0 <= o_TWs[nLocalLoop].nReqCount { all_tw_displayed = 0 if o_TWs[nLocalLoop].nCount == -1 { nAdvanceTypeWriters = -5 // delay few frames between lines... mail(0, o_TWs[nLocalLoop]) break } else { if nLoopSound == 0 nLoopSound = 1 if 0 < nAdvanceTypeWriters { if getstatus(1) == 3 play sndTW, 1 nAdvanceTypeWriters = 0 mail(0, o_TWs[nLocalLoop]) } else { if nAdvanceTypeWriters < 0 break } } } print3d_position = nDispX, nDispY print3d " " conv$(o_TWs[nLocalLoop].nResult) nDispY = nDispY + 30 + 15 } } else all_tw_displayed = 1 // boss!! if all_tw_displayed { nDispY = nDispY + nTitleHeight / 2 - 15 text_size = -(1000 + 30) n_color = packcolor(255,255,255,255) // 220,220,220,255 text = "You must destroy in " conv$(nTimeGoal) " seconds!" print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 w = getprint3dwidth(text) print3d_position = PANE_CETER_X - w / 2, nDispY print3d text if (nTimeCutOFF == -1) nTimeCutOFF = gettimex() + nTime_Quit } } break case 2: if ((0 <= nPanelX) && ((getstatus(1) == 3) || nLoopSound)) { nDispX = (getresx() - RPT_WIDTH) / 2 + RPT_XSHIFT + RPT_WIDTH + RPT_XGAP + 27 nDispY = (getresy() - RPT_DEPTH) / 2 + RPT_YSHIFT + RPT_SCORE_UPDN_GAP - 51 text_size = -(1000 + RPT_SCORE_HEIGHT) int nOldDispY = nDispY for nLocalLoop = 0; nLocalLoop < 6; nLocalLoop++ { text = score_subtitles[nLocalLoop] print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 nWidth = getprint3dwidth(text) print3d_position = nDispX - nWidth, nDispY print3d text nDispY = nDispY + RPT_SCORE_HEIGHT + RPT_YGAP } nDispY = nOldDispY all_tw_displayed = 1 for nLocalLoop = 0; (nLocalLoop < 6) && all_tw_displayed; nLocalLoop++ { if 0 <= o_TWs[nLocalLoop].nReqCount { all_tw_displayed = 0 if o_TWs[nLocalLoop].nCount == -1 { nAdvanceTypeWriters = -5 // delay few frames between lines... mail(0, o_TWs[nLocalLoop]) break } else { if nLoopSound == 0 nLoopSound = 1 if 0 < nAdvanceTypeWriters { if getstatus(1) == 3 play sndTW, 1 nAdvanceTypeWriters = 0 mail(0, o_TWs[nLocalLoop]) } else { if nAdvanceTypeWriters < 0 break } } } if nLocalLoop < 6 { text_size = -(1000 + RPT_SCORE_HEIGHT) if (0 < o_TWs[nLocalLoop].nReqCount) || (o_TWs[nLocalLoop].nReqCount == -2) { nnnnn = o_TWs[nLocalLoop].nResult if nLocalLoop == 1 { // time nnnnn = o_TWs[nLocalLoop].nResult if nnnnn % 60 < 10 text = conv$(nnnnn / 60)":0"conv$(nnnnn % 60) // "2:38" // "?:??" else text = conv$(nnnnn / 60)":"conv$(nnnnn % 60) // "2:38" // "?:??" } if nLocalLoop == 3 { // destruction text = conv$(nnnnn) "%(" conv$(nDead) " of " conv$(nEnemyCount) ")" // "$$$$" " TOTAL KILLS: " conv$(nKills) } if nLocalLoop == 4 { // repair text = conv$(nnnnn) "%" // Armor repaired" } if nLocalLoop != 1 && nLocalLoop != 3 && nLocalLoop != 4 { text = o_TWs[nLocalLoop].strResult } } else { text = o_TWs[nLocalLoop].strResult } print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 nWidth = getprint3dwidth(text) print3d_position = nDispX, nDispY print3d " " text nDispY = nDispY + RPT_SCORE_HEIGHT + RPT_YGAP } } if all_tw_displayed { if (nTimeCutOFF == -1) nTimeCutOFF = gettimex() + nTime_Quit } } break case 0: case 3: case 4: case 6: if (nTime_Left != -1) { print3d_margins = 0, 0 to getresx(), getresy() text = conv$(nTime_Left) if ((nWhyPaused == 0) || (nWhyPaused == 4)) { text = strInviter "(" text ")" } text_size = -(1000 + CON_TIME_HEIGHT) if (nWhyPaused == 0) || (nWhyPaused == 4) { // TIME if nYNC == 0 n_color = packcolor(255,255,0,255) else n_color = packcolor(192,192,192,255) } else { n_color = packcolor(255,255,255,255) } print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 nWidth = getprint3dwidth(text) nHeight = getprint3dheight(text) nDispX = (getresx() - nWidth) / 2 nDispY = (getresy() + (CON_DEPTH / 2) - CON_TIME_HEIGHT) / 2 print3d_position = nDispX, nDispY print3d text int nLeft = nDispX int nRight = nDispX + nWidth if (nWhyPaused == 0) || (nWhyPaused == 4) { // YES if nYNC == 1 n_color = packcolor(255,255,0,255) else n_color = packcolor(192,192,192,255) print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 text = "YESNO" int nWidth2Temp = getprint3dwidth(text) / 2 text = "YES" nWidth = getprint3dwidth(text) nDispX = nLeft - nWidth - (nWidth2Temp / 2) print3d_position = nDispX, nDispY print3d text // NO if nYNC == -1 n_color = packcolor(255,255,0,255) else n_color = packcolor(192,192,192,255) print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_left,1 text = "NO" nWidth = getprint3dwidth(text) nDispX = nRight + (nWidth2Temp / 2) print3d_position = nDispX, nDispY print3d text } } break } } LBUTTON_UPDATE { if (time_delayed == delay) { if (mouse.left == BUTTON_CLICKED) { mail(fs_id, fs_but1, this) // for testing in PC } } } RBUTTON_UPDATE { if (time_delayed == delay) { if (mouse.right == BUTTON_CLICKED) { mail(fs_id, fs_but2, this) // for testing in PC } } } GUI_MAILBOX { if callback($$CTCL_CheckUseJPD$$) { if sender == o_fscreen { if (getmessage(0) == fs_id) && (getmessage(1) == fs_but2) { // no cancel for Invititation(menu/in-single-game) & "Continue", to prevent wrong-fs_but2-click.... if (nWhyPaused == 0) || (nWhyPaused == 3) || (nWhyPaused == 4) return } mail(getmessage(0), getmessage(1), this) return } } if (sender == this) && (getmessage(0) == fs_id) { int kEvent = getmessage(1) if (kEvent == fs_but1) || (kEvent == fs_but2) || (kEvent == fs_space) || (kEvent == fs_ret) || (kEvent == fs_esc) { play btnTriggeredSound,1 if (nWhyPaused == 0) || (nWhyPaused == 4) { if nYNC == 0 // cancel... return if nYNC == 1 { // yes? if (nWhyPaused == 0) callback($$CTCL_CheckInviteCOOP$$, 3) else callback($$SetShellCommand$$, ResumeMissionCommand) } else { // no if (nWhyPaused == 0) callback($$CTCL_CheckInviteCOOP$$, 2) else callback($$SetShellCommand$$, ExitToMainMenuCommand) } } else { if (nWhyPaused == 1) || (nWhyPaused == 2) || (kEvent == fs_but1) || (kEvent == fs_space) || (kEvent == fs_ret) { if (nWhyPaused == 3) || (nWhyPaused == 6) { if callback($$CTCL_CheckCoinCounts$$) <= 0 // insert more coin... return } callback($$SetShellCommand$$, ResumeMissionCommand) } else { callback($$SetShellCommand$$, ExitToMainMenuCommand) } } // Tell this script to fade out and deactivate all its objects fadeout = true return } if (kEvent & fs_left) || (kEvent & fs_right) { if (nWhyPaused == 0) || (nWhyPaused == 4) { if nYNC == 0 { if (kEvent & fs_left) nYNC = +1 else nYNC = -1 } else { if 0 < nYNC nYNC = -1 else nYNC = +1 } } } } } GUI_CHAR { // Check for the Escape key to resume mission int ch = getchar() if (ch == 0x09) { mail(fs_id, fs_tab, this) return } if (ch == 0x0d) || (ch == 0x0a) { mail(fs_id, fs_ret, this) return } if (ch == 27) { mail(fs_id, fs_esc, this) } if (ch == ' ') { mail(fs_id, fs_space, this) } } GUI_DESTROY { unfocus } } // A utility class for showing the mouse pointer when the pause menu is active o_MousePointer { GUI_CREATE { int showMousePointer = 1 pane p_pointer = GPATH "mouse_pointer.tga" alphamode(p_pointer) = am_alpha_alphainvalpha origin(p_pointer) = 0, 0 location.z = 900 } GUI_DRAW { if (showMousePointer != 0) { render p_pointer, mouse.x, mouse.y } } } panedisplay { GUI_CREATE { pane p_pane string filename int panecolor = packcolor(255, 255, 255, 255) int scalex = 100 int scaley = 100 int alphatype } GUI_INIT { p_pane = filename color(p_pane) = panecolor scale(p_pane) = scalex, scaley if alphatype == 0 { alphamode(p_pane) = am_alpha_alphainvalpha } else { if alphatype == -1 // jcem alphamode(p_pane) = am_alpha_onezero else alphamode(p_pane) = am_alpha_oneone } } GUI_DRAW { render p_pane, location } }