home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / global / credits.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  27.2 KB  |  858 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  MoH: Allied Assault Script File  
  4. //  Global function: Ending credits routines
  5. //  Script Written By: Benson 'elmagoo' Russell
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8.  
  9. //**************************************************************************
  10. //*** Initializes the credits script
  11. //*** syntax --------------------------------
  12. //*** credits_setup
  13. //**************************************************************************
  14. credits_setup:
  15.  
  16.     //*** catches if the firebutton was pressed and resets the ui_hud command
  17.     thread credits_skip
  18.  
  19.     //*** turn off the player's hud
  20. //    $player stufftext "ui_hud 0"
  21.     setcvar "cg_huddraw_force" "1"
  22.  
  23.     //*** fade the screen out
  24.     fadeout 3 0 0 0 1
  25.     wait 3
  26.  
  27.     //*** draw the letterboxed images
  28.  
  29.     //*** bottom border
  30.     huddraw_virtualsize 253 1
  31.     huddraw_shader 253 "textures/mohmenu/credits/topborder"
  32.     huddraw_align 253 left top
  33.     huddraw_rect 253 0 400 640 80
  34.     //huddraw_color 254 0 0 0
  35.  
  36.     //*** top border
  37.     huddraw_virtualsize 254 1
  38.     huddraw_shader 254 "textures/mohmenu/credits/topborder"
  39.     huddraw_align 254 left top
  40.     huddraw_rect 254 0 0 640 80
  41.     //huddraw_color 255 0 0 0
  42.  
  43.     //*** text telling the player how to skip the credits
  44.     huddraw_virtualsize 255 1
  45.     huddraw_string 255 "Press FIRE to skip the credits"
  46.     huddraw_align 255 left top
  47.     huddraw_font 255 handle-22
  48.     huddraw_color 255 1 1 1
  49.     huddraw_rect 255 205 450 0 0
  50.  
  51.     //*** fade the borders in
  52.     for (local.i = 0 ; local.i <= 1 ; local.i += .03)
  53.     {
  54.         huddraw_alpha 253 local.i
  55.         huddraw_alpha 254 local.i
  56.         huddraw_alpha 255 local.i
  57.         waitframe
  58.     }
  59.     huddraw_alpha 253 1.0
  60.     huddraw_alpha 254 1.0
  61.  
  62.     //*** initialize the credits index, storage arrays, element counter, position variables
  63.     level.credits_index = 0                    //*** where to stuff the next command in the array of credit array's
  64.     level.credits_index_isprocessing = 0    //*** flag for whether or not the stack is being processed
  65.  
  66.     level.credits_command[1] = NIL            //*** stores the command passed [section, entry]
  67.     level.credits_header[1] = NIL            //*** stores the subject header, i.e. Level Designer
  68.     level.credits_body[1] = NIL                //*** stores the value for the header, i.e. Benson Russell
  69.  
  70.     level.credits_current_element = 100        //*** keeps track of what huddraw element to use
  71.                                             //*** 100 - 200  for credit entries
  72.                                             //*** 0 - 100  for background images
  73.  
  74.     level.section_xpos = 150                //*** section x position
  75.     level.header_xpos = 150                    //*** entry header x position
  76.     level.body_xpos = 340                    //*** entry body x position
  77.  
  78.     //*** set the default colors for section
  79.     if (level.credits_section_red == NIL)
  80.     {
  81.         level.credits_section_red = 0
  82.     }
  83.  
  84.     if (level.credits_section_green == NIL)
  85.     {
  86.         level.credits_section_green = 0
  87.     }
  88.  
  89.     if (level.credits_section_blue == NIL)
  90.     {
  91.         level.credits_section_blue = 0
  92.     }
  93.  
  94.     //*** set the default colors for sub_section
  95.     if (level.credits_sub_section_red == NIL)
  96.     {
  97.         level.credits_sub_section_red = 0
  98.     }
  99.  
  100.     if (level.credits_sub_section_green == NIL)
  101.     {
  102.         level.credits_sub_section_green = 0
  103.     }
  104.  
  105.     if (level.credits_sub_section_blue == NIL)
  106.     {
  107.         level.credits_sub_section_blue = 0
  108.     }
  109.  
  110.     //*** set the default colors for entry header
  111.     if (level.credits_entry_header_red == NIL)
  112.     {
  113.         level.credits_entry_header_red = 0
  114.     }
  115.  
  116.     if (level.credits_entry_header_green == NIL)
  117.     {
  118.         level.credits_entry_header_green = 0
  119.     }
  120.  
  121.     if (level.credits_entry_header_blue == NIL)
  122.     {
  123.         level.credits_entry_header_blue = 0
  124.     }
  125.  
  126.     //*** set the default colors for entry body
  127.     if (level.credits_entry_body_red == NIL)
  128.     {
  129.         level.credits_entry_body_red = 0
  130.     }
  131.  
  132.     if (level.credits_entry_body_green == NIL)
  133.     {
  134.         level.credits_entry_body_green = 0
  135.     }
  136.  
  137.     if (level.credits_entry_body_blue == NIL)
  138.     {
  139.         level.credits_entry_body_blue = 0
  140.     }
  141.  
  142.     //*** set the default section font
  143.     if (level.credits_section_font == NIL)
  144.     {
  145.         level.credits_section_font = "handle-23"
  146.     }
  147.  
  148.     //*** set the default section font
  149.     if (level.credits_sub_section_font == NIL)
  150.     {
  151.         level.credits_sub_section_font = "handle-22"
  152.     }
  153.  
  154.     //*** set the default entry header font
  155.     if (level.credits_entry_header_font == NIL)
  156.     {
  157.         level.credits_entry_header_font = "handle-18"
  158.     }
  159.  
  160.     //*** set the default entry body font
  161.     if (level.credits_entry_body_font == NIL)
  162.     {
  163.         level.credits_entry_body_font = "handle-18"
  164.     }
  165.  
  166.     //*** launch the processing thread
  167.     thread credits_processor
  168.  
  169. end
  170.  
  171.  
  172. //**************************************************************************
  173. //*** adds an entry to scroll up the screen
  174. //*** syntax --------------------------------
  175. //*** credits_add <command type| "section", "entry", "pause", "done"> <header text> <body text>
  176. //**************************************************************************
  177. credits_add local.command local.header_string local.body_string local.var1 local.var2 local.var3 local.var4 local.var5 local.var6:
  178.  
  179.     //*** if the stack is currently processing, wait
  180.     while (level.credits_index_isprocessing == 1)
  181.     {
  182.         waitframe
  183.     }
  184.  
  185.     //*** claim the stack
  186.     level.credits_index_isprocessing = 1
  187.  
  188.     switch (local.command)
  189.     {
  190.         case "section":
  191.             //println "CREDITS: section was choosen, adding to credits"
  192.             local.index = level.credits_index
  193.             local.index ++
  194.             level.credits_command[local.index] = local.command
  195.             level.credits_header[local.index] = local.header_string
  196.             level.credits_index ++
  197.             break
  198.  
  199.         case "sub_section":
  200.             //println "CREDITS: section was choosen, adding to credits"
  201.             local.index = level.credits_index
  202.             local.index ++
  203.             level.credits_command[local.index] = local.command
  204.             level.credits_header[local.index] = local.header_string
  205.             level.credits_index ++
  206.             break
  207.  
  208.         case "entry":
  209.             //println "CREDITS: entry was choosen, adding to credits"
  210.             local.index = level.credits_index
  211.             local.index ++
  212.             level.credits_command[local.index] = local.command
  213.             level.credits_header[local.index] = local.header_string
  214.             level.credits_body[local.index] = local.body_string
  215.             level.credits_index ++
  216.             break
  217.  
  218.         case "entry_single":
  219.             //println "CREDITS: entry was choosen, adding to credits"
  220.             local.index = level.credits_index
  221.             local.index ++
  222.             level.credits_command[local.index] = local.command
  223.             level.credits_header[local.index] = local.header_string
  224.             level.credits_index ++
  225.             break
  226.  
  227.         case "image":
  228.             local.index = level.credits_index
  229.             local.index ++
  230.             level.credits_command[local.index] = local.command
  231.             level.credits_draw_command[local.index] = local.header_string
  232.             level.credits_draw_element_number[local.index] = local.body_string
  233.             level.credits_draw_image[local.index] = local.var1
  234.             level.credits_draw_time[local.index] = local.var2
  235.             level.credits_draw_ul_x[local.index] = local.var3
  236.             level.credits_draw_ul_y[local.index] = local.var4
  237.             level.credits_draw_br_x[local.index] = local.var5
  238.             level.credits_draw_br_y[local.index] = local.var6
  239.             level.credits_index ++
  240.             break
  241.  
  242.         case "image_scroll":
  243.             local.index = level.credits_index
  244.             local.index ++
  245.             level.credits_command[local.index] = local.command
  246.             level.credits_draw_image[local.index] = local.header_string
  247.             level.credits_draw_ul_x[local.index] = local.body_string
  248.             level.credits_draw_br_x[local.index] = local.var1
  249.             level.credits_draw_br_y[local.index] = local.var2
  250.             level.credits_index ++
  251.             break
  252.  
  253.         case "pause":
  254.             local.index = level.credits_index
  255.             local.index ++
  256.             level.credits_command[local.index] = local.command
  257.             level.credits_index ++
  258.             break
  259.  
  260.         case "done":
  261.             local.index = level.credits_index
  262.             local.index ++
  263.             level.credits_command[local.index] = local.command
  264.             level.credits_index ++
  265.             break
  266.  
  267.         default:
  268.             println "^~^~^ CREDIT SCRIPT ERROR: command passed was not valid!"
  269.             break
  270.     }
  271.  
  272.     //*** release the stack
  273.     level.credits_index_isprocessing = 0
  274.  
  275. end
  276.  
  277.  
  278. //**************************************************************************
  279. //*** Processes the stack of credits
  280. //*** syntax --------------------------------
  281. //*** credits_processor
  282. //**************************************************************************
  283. credits_processor:
  284.  
  285.     local.current_index = 1  //*** keeps track of which index to process
  286.  
  287. credits_processor_loop:
  288.  
  289.     //*** while there are no credits, wait
  290.     while (level.credits_index == 0)
  291.     {
  292.         waitframe
  293.     }
  294.  
  295.     //*** set the scroll time if none has been set
  296.     if (level.credits_scrolltime == NIL || level.credits_scrolltime == 0)
  297.     {
  298.         //*** if no desired time is set, set it to 10 seconds
  299.         //println "CREDITS PROCESSOR LOOP: setting scrolltime to 10"
  300.         // level.credits_scrolltime = 17
  301.         level.credits_scrolltime = 17
  302.     }
  303.  
  304.     //*** check if the current element counter is over 200, if so, reset it back to 100
  305.     if (level.credits_current_element > 200)
  306.     {
  307.         level.credits_current_element = 100
  308.     }
  309.  
  310.     //*** check what command was passed through
  311.     switch (level.credits_command[local.current_index])
  312.     {
  313.         case "section":
  314.             //*** process a section
  315.             waitthread credits_process_section local.current_index
  316.             break
  317.  
  318.         case "sub_section":
  319.             //*** process a sub_section
  320.             waitthread credits_process_sub_section local.current_index
  321.             break
  322.  
  323.         case "entry":
  324.                 //*** process an entry
  325.             waitthread credits_process_entry local.current_index
  326.             break
  327.  
  328.         case "entry_single":
  329.             //*** process an single line entry
  330.             waitthread credits_process_entry_single local.current_index
  331.             break
  332.  
  333.         case "image":
  334.             //*** display an image
  335.             thread credits_image level.credits_draw_command[local.current_index] level.credits_draw_element_number[local.current_index] level.credits_draw_image[local.current_index] level.credits_draw_time[local.current_index] level.credits_draw_ul_x[local.current_index] level.credits_draw_ul_y[local.current_index] level.credits_draw_br_x[local.current_index] level.credits_draw_br_y[local.current_index]
  336.             break
  337.  
  338.         case "image_scroll":
  339.             //*** display an image that will scroll with the credits
  340.             thread credits_process_image_scroll level.credits_draw_image[local.current_index] level.credits_draw_ul_x[local.current_index] level.credits_draw_br_x[local.current_index] level.credits_draw_br_y[local.current_index]
  341.             break
  342.  
  343.         case "pause":
  344.             //*** pause the game for a set interval based on scrolltime
  345.             local.pause_time = (level.credits_scrolltime / 8.0)
  346.             wait local.pause_time
  347.             break
  348.  
  349.         case "done":
  350.             //*** end the credits routine
  351.             thread credits_done
  352.             goto credits_processor_done
  353.             break
  354.  
  355.         default:
  356.             //*** process an entry by default
  357.             waitthread credits_process_entry local.current_index
  358.             break
  359.     }
  360.  
  361.     //*** increment the current element counter
  362.     level.credits_current_element ++
  363.  
  364.     //*** if the stack is currently processing, wait
  365.     while (level.credits_index_isprocessing == 1)
  366.     {
  367.         waitframe
  368.     }
  369.  
  370.     //*** claim the stack
  371.     level.credits_index_isprocessing = 1
  372.  
  373.     //*** increment the current index, and check if it exists
  374.     local.current_index ++
  375.  
  376.     //*** if there's nothing on the next index, blank the arrays for starting over
  377.     if (level.credits_command.size < local.current_index)
  378.     {
  379.         level.credits_command = NIL
  380.         level.credits_header = NIL
  381.         level.credits_body = NIL
  382.  
  383.         level.credits_command[1] = NIL
  384.         level.credits_header[1] = NIL
  385.         level.credits_body[1] = NIL
  386.  
  387.         level.credits_index = 0
  388.         local.current_index = 1
  389.     }
  390.  
  391.     //*** release the stack
  392.     level.credits_index_isprocessing = 0
  393.  
  394.     goto credits_processor_loop
  395.  
  396. credits_processor_done:
  397. end
  398.  
  399.  
  400. //**************************************************************************
  401. //*** Process a section heading to scroll by
  402. //*** syntax --------------------------------
  403. //*** credits_process_section <stack index number>
  404. //**************************************************************************
  405. credits_process_section local.stack_index:
  406.  
  407.     //*** format the string, and find out how many lines it takes up
  408.     if (level.credits_header[local.stack_index] != NIL)
  409.     {
  410.             local.string = waitthread global/string_format.scr::str_format level.credits_header[local.stack_index] 40
  411.             local.num_lines = level.str_format_num_lines
  412.             //println "CREDITS SECTION: entry was not NIL!"
  413.     }
  414.     else
  415.     {
  416.         local.string = " "
  417.         local.num_lines = 1
  418.         //println "CREDITS SECTION: entry was NIL!"
  419.     }
  420.  
  421.     //*** assign all the huddraw commands
  422.     huddraw_alpha level.credits_current_element 0
  423.     huddraw_string level.credits_current_element local.string
  424.     huddraw_font level.credits_current_element level.credits_section_font
  425.     huddraw_align level.credits_current_element left top
  426.     huddraw_virtualsize level.credits_current_element 1
  427.     huddraw_color level.credits_current_element level.credits_section_red level.credits_section_green level.credits_section_blue
  428.  
  429.     //*** start it scrolling
  430.     thread credits_scroll level.credits_current_element level.section_xpos 1
  431.  
  432.     //*** pause for a bit to give a space in the text
  433.     local.pause_time = (level.credits_scrolltime / 17.0) + ((level.credits_scrolltime / 15.0) * local.num_lines)
  434.  
  435.     wait local.pause_time
  436.  
  437. end
  438.  
  439.  
  440. //**************************************************************************
  441. //*** Process a sub section heading to scroll by
  442. //*** syntax --------------------------------
  443. //*** credits_process_section <stack index number>
  444. //**************************************************************************
  445. credits_process_sub_section local.stack_index:
  446.  
  447.     //*** format the string, and find out how many lines it takes up
  448.     if (level.credits_header[local.stack_index] != NIL)
  449.     {
  450.             local.string = waitthread global/string_format.scr::str_format level.credits_header[local.stack_index] 40
  451.             local.num_lines = level.str_format_num_lines
  452.             //println "CREDITS SUB SECTION: entry was not NIL!"
  453.     }
  454.     else
  455.     {
  456.         local.string = " "
  457.         local.num_lines = 1
  458.         //println "CREDITS SUB SECTION: entry was NIL!"
  459.     }
  460.  
  461.     //*** assign all the huddraw commands
  462.     huddraw_alpha level.credits_current_element 0
  463.     huddraw_string level.credits_current_element local.string
  464.     huddraw_font level.credits_current_element level.credits_sub_section_font
  465.     huddraw_align level.credits_current_element left top
  466.     huddraw_virtualsize level.credits_current_element 1
  467.     huddraw_color level.credits_current_element level.credits_sub_section_red level.credits_sub_section_green level.credits_sub_section_blue
  468.  
  469.     //*** start it scrolling
  470.     thread credits_scroll level.credits_current_element level.section_xpos 1
  471.  
  472.     //*** pause for a bit to give a space in the text
  473.     local.pause_time = (level.credits_scrolltime / 21.0) + ((level.credits_scrolltime / 19.0) * local.num_lines)
  474.  
  475.     wait local.pause_time
  476.  
  477. end
  478.  
  479.  
  480. //**************************************************************************
  481. //*** Process a entry with only one value, header with no body
  482. //*** syntax --------------------------------
  483. //*** credits_process_entry_single <stack index number>
  484. //**************************************************************************
  485. credits_process_entry_single local.stack_index:
  486.  
  487.     //*** format the string, and find out how many lines it takes up
  488.     if (level.credits_header[local.stack_index] != NIL)
  489.     {
  490.             local.string = waitthread global/string_format.scr::str_format level.credits_header[local.stack_index] 45
  491.             local.num_lines = level.str_format_num_lines
  492.             //println "CREDITS ENTRY SINGLE: entry was not NIL!"
  493.     }
  494.     else
  495.     {
  496.         local.string = " "
  497.         local.num_lines = 1
  498.         //println "CREDITS ENTRY SINGLE: entry was NIL!"
  499.     }
  500.  
  501.     //*** assign the header huddraw commands
  502.     huddraw_alpha level.credits_current_element 0
  503.     huddraw_string level.credits_current_element local.string
  504.     huddraw_font level.credits_current_element level.credits_entry_body_font
  505.     huddraw_align level.credits_current_element left top
  506.     huddraw_virtualsize level.credits_current_element 1
  507.     huddraw_color level.credits_current_element level.credits_entry_header_red level.credits_entry_header_green level.credits_entry_header_blue
  508.  
  509.     //*** start it scrolling
  510.     thread credits_scroll level.credits_current_element level.header_xpos 1
  511.  
  512.     //*** pause for a bit to give a space in the text
  513.     local.pause_time = (level.credits_scrolltime / 30.0) + ((level.credits_scrolltime / 27.0) * local.num_lines)
  514.  
  515.     wait local.pause_time
  516.  
  517. end
  518.  
  519.  
  520. //**************************************************************************
  521. //*** Process a section heading to scroll by
  522. //*** syntax --------------------------------
  523. //*** credits_process_entry <stack index number>
  524. //**************************************************************************
  525. credits_process_entry local.stack_index:
  526.  
  527.     //*** format the header string, and find out how many lines it takes up
  528.     if (level.credits_header[local.stack_index] != NIL)
  529.     {
  530.             local.header_string = waitthread global/string_format.scr::str_format level.credits_header[local.stack_index] 20
  531.             local.header_num_lines = level.str_format_num_lines
  532.             //println "CREDITS ENTRY HEADER: entry was not NIL!"
  533.     }
  534.     else
  535.     {
  536.         local.header_string = " "
  537.         local.header_num_lines = 1
  538.         //println "CREDITS ENTRY HEADER: entry was NIL!"
  539.     }
  540.  
  541.     //println "CREDITS PROCESS ENTRY: header string: " local.header_string
  542.     //println "CREDITS PROCESS ENTRY: header num lines: " local.header_num_lines
  543.  
  544.     //*** format the body string, and find out how many lines it takes up
  545.     if (level.credits_body[local.stack_index] != NIL)
  546.     {
  547.         local.body_string = waitthread global/string_format.scr::str_format level.credits_body[local.stack_index] 20
  548.         local.body_num_lines = level.str_format_num_lines
  549.         //println "CREDITS ENTRY BODY: entry was not NIL!"
  550.     }
  551.     else
  552.     {
  553.         local.body_string = " "
  554.         local.body_num_lines = 1
  555.         //println "CREDITS ENTRY BODY: entry was NIL!"
  556.     }
  557.  
  558.     //println "CREDITS PROCESS ENTRY: body string: " local.body_string
  559.     //println "CREDITS PROCESS ENTRY: body num lines: " local.body_num_lines
  560.  
  561.     //*** find whether the header or body has more lines used
  562.     if (local.header_num_lines >= local.body_num_lines)
  563.     {
  564.         //*** if the header has more lines, use it's line total
  565.         local.num_lines = local.header_num_lines
  566.         //println "CREDITS PROCESS ENTRY: header num lines was more or equal than body"
  567.     }
  568.     else
  569.     {
  570.         //*** if the body has more lines, use it's line total
  571.         local.num_lines = local.body_num_lines
  572.         //println "CREDITS PROCESS ENTRY: body num lines was more than header"
  573.     }
  574.  
  575.     //println "CREDITS PROCESS ENTRY: header string into element: " level.credits_current_element
  576.  
  577.     //*** assign the header huddraw commands
  578.     huddraw_alpha level.credits_current_element 0
  579.     huddraw_string level.credits_current_element local.header_string
  580.     huddraw_font level.credits_current_element level.credits_entry_header_font
  581.     huddraw_align level.credits_current_element left top
  582.     huddraw_virtualsize level.credits_current_element 1
  583.     huddraw_color level.credits_current_element level.credits_entry_header_red level.credits_entry_header_green level.credits_entry_header_blue
  584.  
  585.     local.header_element_counter = level.credits_current_element
  586.  
  587.     //println "CREDITS PROCESS ENTRY: header string into element variable: " local.header_element_counter
  588.  
  589.     level.credits_current_element ++
  590.     if (level.credits_current_element > 200)
  591.     {
  592.         level.credits_current_element = 100
  593.     }
  594.  
  595.     //println "CREDITS PROCESS ENTRY: body string into element: " level.credits_current_element
  596.  
  597.     //*** assign the body huddraw commands
  598.     huddraw_alpha level.credits_current_element 0
  599.     huddraw_string level.credits_current_element local.body_string
  600.     huddraw_font level.credits_current_element level.credits_entry_body_font
  601.     huddraw_align level.credits_current_element left top
  602.     huddraw_virtualsize level.credits_current_element 1
  603.     huddraw_color level.credits_current_element level.credits_entry_body_red level.credits_entry_body_green level.credits_entry_body_blue
  604.  
  605.     //*** start both scrolling
  606.     thread credits_scroll local.header_element_counter level.header_xpos 1
  607.     thread credits_scroll level.credits_current_element level.body_xpos 1
  608.  
  609.     //*** pause for a bit to give a space in the text
  610.     local.pause_time = (level.credits_scrolltime / 33.0) + ((level.credits_scrolltime / 25.0) * local.num_lines)
  611.  
  612.     //println "CREDITS PROCESS ENTRY: pause time: " local.pause_time
  613.  
  614.     wait local.pause_time
  615.  
  616. end
  617.  
  618.  
  619. //**************************************************************************
  620. //*** Process a graphic to scroll up with the credits text
  621. //*** syntax --------------------------------
  622. //*** credits_process_image_scroll <image> <ul_x> <br_x> <br_y>
  623. //**************************************************************************
  624. credits_process_image_scroll local.image local.ul_x local.br_x local.br_y:
  625.  
  626.     if (local.br_x == NIL)
  627.     {
  628.         local.br_x = 128
  629.     }
  630.  
  631.     if (local.br_y == NIL)
  632.     {
  633.         local.br_y = 128
  634.     }
  635.  
  636.     //*** assign the image huddraw commands
  637.     huddraw_alpha level.credits_current_element 0
  638.     huddraw_shader level.credits_current_element local.image
  639.     huddraw_align level.credits_current_element left top
  640.     huddraw_virtualsize level.credits_current_element 1
  641.     huddraw_color level.credits_current_element 1 1 1
  642.  
  643.     //*** start it scrolling
  644.     thread credits_scroll level.credits_current_element local.ul_x 0 local.br_x local.br_y
  645.  
  646. end
  647.  
  648.  
  649. //**************************************************************************
  650. //*** Scrolls the elements up the screen
  651. //*** syntax --------------------------------
  652. //*** credits_scroll <huddraw element number> <x position for the element> <fade flag> <bottom right x position for images> <bottom right y position for images>
  653. //**************************************************************************
  654. credits_scroll local.element_number local.element_xpos local.fade local.element_br_xpos local.element_br_ypos:
  655.  
  656.     //*** default the br positions to zero if NIL
  657.     if (local.element_br_xpos == NIL)
  658.     {
  659.         local.element_br_xpos = 0
  660.     }
  661.  
  662.     if (local.element_br_ypos == NIL)
  663.     {
  664.         local.element_br_ypos = 0
  665.     }
  666.  
  667.     //*** set the scroll increment
  668.     local.scroll_increment = (level.credits_scrolltime * 20.0)
  669.     local.scroll_increment = (480.0 / local.scroll_increment)
  670.  
  671.     //*** round the value to make it more even
  672.     local.scroll_increment += .5
  673.     local.scroll_increment = int(local.scroll_increment)
  674.  
  675.     //*** set them scrolling up
  676.     for (local.i = 480 ; local.i >= 0 ; local.i -= local.scroll_increment)
  677.     {
  678.         //*** turn on the element
  679.         if ( local.fade == 1 )
  680.             local.alpha = waitthread calc_alpha local.i
  681.         else
  682.             local.alpha = waitthread calc_alpha (local.i + (local.element_br_ypos * 0.5))
  683.         huddraw_alpha local.element_number local.alpha
  684.  
  685.         //*** scroll the element up the screen
  686.         //println "CREDITS SCROLL: local.i: " local.i
  687.         huddraw_rect local.element_number local.element_xpos local.i local.element_br_xpos local.element_br_ypos
  688.         waitframe
  689.     }
  690.  
  691.     //*** turn off the element
  692.     huddraw_alpha local.element_number 0
  693.  
  694. end
  695.  
  696. calc_alpha local.y:
  697.  
  698.     if ( (local.y < 65) || (local.y > 400) )
  699.         local.a = 0.0
  700.     else if ( local.y < 110 )
  701.     {
  702.         local.a = (local.y - 65) / 45.0
  703.     }
  704.     else if ( local.y > 355 )
  705.     {
  706.         local.a = (400 - local.y) / 45.0
  707.     }
  708.     else
  709.         local.a = 1.0
  710. //    if ( local.i < 150 )
  711. //    {
  712. //        local.alpha = local.i / 150.0
  713. //        huddraw_alpha local.element_number local.alpha
  714. //    }
  715. //    else if ( local.i > 330 )
  716. //    {
  717. //        local.alpha = (480 - local.i) / 150.0
  718. //        huddraw_alpha local.element_number local.alpha
  719. //    }
  720. //    else
  721. //        huddraw_alpha local.element_number 1
  722.  
  723. end local.a
  724.  
  725. //**************************************************************************
  726. //*** Skips the credits
  727. //*** syntax --------------------------------
  728. //*** credits_skip
  729. //**************************************************************************
  730. credits_done:
  731.  
  732.     //*** fade the borders out
  733.     for (local.i = 1 ; local.i >= 0 ; local.i -= .01)
  734.     {
  735.         huddraw_alpha 253 local.i
  736.         huddraw_alpha 254 local.i
  737.         huddraw_alpha 255 local.i
  738.         waitframe
  739.     }
  740.  
  741.     wait 2
  742.     //*** restore the hud and disconnect the player
  743. //    $player stufftext "ui_hud 1"
  744.     $player stufftext "disconnect"
  745.     //$player stufftext "pushmenu main"
  746.  
  747. end
  748.  
  749.  
  750. //**************************************************************************
  751. //*** Skips the credits
  752. //*** syntax --------------------------------
  753. //*** credits_skip
  754. //**************************************************************************
  755. credits_skip:
  756.  
  757.     while ( $player.fireheld == 0 )
  758.     {
  759.         waitframe
  760.     }
  761.  
  762. //    $player stufftext "ui_hud 1"
  763.     $player stufftext "disconnect"
  764.  
  765. end
  766.  
  767.  
  768. //**************************************************************************
  769. //**************************************************************************
  770. //**************************************************************************
  771. //***   DRAWING IMAGES
  772. //**************************************************************************
  773. //**************************************************************************
  774. //**************************************************************************
  775.  
  776. //**************************************************************************
  777. //*** Tells how to draw an image in the background for the credits
  778. //*** syntax --------------------------------
  779. //*** credits_image <command|"show", "hide"> <element number> <image> <time> <ul_x> <ul_y> <br_x> <br_y>
  780. //**************************************************************************
  781. credits_image local.command local.element_number local.image local.time local.ul_x local.ul_y local.br_x local.br_y:
  782.  
  783.     //*** check to see if they gave the proper element number, between 0 and 100, and not NIL
  784.     if (local.element_number == NIL || local.element_number > 100 || local.element_number < 0)
  785.     {
  786.         println "^~^~^ CREDITS PICTURE ERROR: You used an element greater than 100, or less than 0!"
  787.         goto credits_image_done
  788.     }
  789.  
  790.     switch (local.command)
  791.     {
  792.         case "show":
  793.             huddraw_alpha local.element_number 0
  794.             huddraw_shader local.element_number local.image
  795.             huddraw_align local.element_number left top
  796.             huddraw_virtualsize local.element_number 1
  797.  
  798.             //*** if they didn't supply coordinates, default them to 640 x 480
  799.             if (local.ul_x == NIL || local.ul_y == NIL || local.br_x == NIL || local.br_y == NIL)
  800.             {
  801.                 huddraw_rect local.element_number 0 0 640 480
  802.             }
  803.             else
  804.             {
  805.                 huddraw_rect local.element_number local.ul_x local.ul_y local.br_x local.br_y
  806.             }
  807.  
  808.             //*** launch the show thread to fade it in
  809.             thread credits_image_show local.element_number local.time
  810.             break
  811.  
  812.         case "hide":
  813.             huddraw_alpha local.element_number 1
  814.  
  815.             for (local.i = 1 ; local.i >= 0 ; local.i -= .02)
  816.             {
  817.                 huddraw_alpha local.element_number local.i
  818.                 wait .05
  819.             }
  820.             break
  821.  
  822.         default:
  823.             println "^~^~^ CREDITS PICTURE ERROR: An unrecognized command was sent!"
  824.             goto credits_image_done
  825.             break
  826.     }
  827.  
  828. credits_image_done:
  829. end
  830.  
  831.  
  832. //**************************************************************************
  833. //*** Fades the image onto the screen
  834. //*** syntax --------------------------------
  835. //*** credits_image_show <element number> <time>
  836. //**************************************************************************
  837. credits_image_show local.element_number local.time:
  838.  
  839.     //*** fade the image in
  840.     for (local.i = 0 ; local.i <= 1 ; local.i += .02)
  841.     {
  842.         huddraw_alpha local.element_number local.i
  843.         wait .05
  844.     }
  845.  
  846.     //*** if the time was set, wait the amount of time then fade the image out
  847.     if (local.time != NIL)
  848.     {
  849.         wait local.time
  850.         for (local.i = 1 ; local.i >= 0 ; local.i -= .02)
  851.         {
  852.             huddraw_alpha local.element_number local.i
  853.             wait .05
  854.         }
  855.     }
  856.  
  857. end
  858.