Guest User

Untitled

a guest
Mar 13th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 30.79 KB | None | 0 0
  1. void main()
  2. {// Update script for displaying different HP color from each player based on char name
  3.     void P1 = getplayerproperty(0, "entity");
  4.     void P2 = getplayerproperty(1, "entity");
  5.     void Bar = getglobalvar("Bar");
  6.     void Bar2 = getglobalvar("Bar2");
  7.     void Bar3 = getglobalvar("Bar3");
  8.     void Bar4 = getglobalvar("Bar4");
  9.     void Bar5 = getglobalvar("Bar5");
  10.     void Bar6 = getglobalvar("Bar6");
  11.     char P1name = getentityproperty(P1, "defaultname");
  12.     char P2name = getentityproperty(P2, "defaultname");
  13.  
  14.     trainingPause();
  15.     //piladaKoul();
  16.     //pauseToMusic();
  17.     customPauseTest();
  18.  
  19.     //TITLE SCREEN, CLEAR AND START A LOT OF VARIABLES IF "NULL()"
  20.     if(openborvariant("in_titlescreen")){
  21.         loadAll();
  22.     }
  23.  
  24.     //MENU SCREEN, SET THE "CLEARALL" FLAG TO 1
  25.     if(openborvariant("in_menuscreen")){
  26.         if(getglobalvar("clearAll") == NULL()){setglobalvar("clearAll", 1);}
  27.     }
  28.    
  29.     //IN LEVEL
  30.     if(openborvariant("in_level")){
  31.         menuPartners();
  32.     }
  33.  
  34.     //COMPLETE SCREEN, RESET SOME PARTNER VARIABLES
  35.     if(openborvariant("in_showcomplete")){
  36.         if(getglobalvar("partnerFull") != 1){setglobalvar("partnerFull", 1);}
  37.     }
  38.  
  39.     /*
  40.     if(openborvariant("in_level")==1){
  41.       if(P1 && P1name == "Billy"){
  42.         int HP1 = getentityproperty(P1, "health");
  43.         drawbox(26,9,HP1-3,10,999,rgbcolor(56,160,248),0);
  44.         drawsprite(Bar, 1, 8, 2500);
  45.       }else if(P1 && P1name == "Jimmy"){
  46.         int HP1 = getentityproperty(P1, "health");
  47.         drawbox(26,9,HP1-3,10,999,rgbcolor(246,130,130),0);
  48.         drawsprite(Bar2, 1, 8, 2500);
  49.       }else if(P1 && P1name == "1jeff"){
  50.         int HP1 = getentityproperty(P1, "health");
  51.         drawbox(26,9,HP1-3,10,999,rgbcolor(41,220,113),0);
  52.         drawsprite(Bar3, 1, 8, 2500);
  53.       }else if(P1 && P1name == "CBilly"){
  54.         int HP1 = getentityproperty(P1, "health");
  55.         drawbox(26,9,HP1-3,10,999,rgbcolor(128,0,240),0);
  56.         drawsprite(Bar4, 1, 8, 2500);
  57.       }else if(P1 && P1name == "Sonny"){
  58.         int HP1 = getentityproperty(P1, "health");
  59.         drawbox(26,9,HP1-3,10,999,rgbcolor(239,181,41),0);
  60.         drawsprite(Bar5, 1, 8, 2500);
  61.       }else if(P1 && P1name == "chinsei"){
  62.         int HP1 = getentityproperty(P1, "health");
  63.         drawbox(26,9,HP1-3,10,999,rgbcolor(252,252,252),0);
  64.         drawsprite(Bar6, 1, 8, 2500);
  65.       }
  66.  
  67.       if(P2 && P2name == "Billy"){
  68.         int HP2 = getentityproperty(P2, "health");
  69.         drawbox(156,9,HP2-3,10,999,rgbcolor(56,160,248),0);
  70.         drawsprite(Bar, 131, 8, 2500);
  71.       }else if(P2 && P2name == "Jimmy"){
  72.         int HP2 = getentityproperty(P2, "health");
  73.         drawbox(156,9,HP2-3,10,999,rgbcolor(246,130,130),0);
  74.         drawsprite(Bar2, 131, 8, 2500);
  75.       }else if(P2 && P2name == "1jeff"){
  76.         int HP2 = getentityproperty(P2, "health");
  77.         drawbox(156,9,HP2-3,10,999,rgbcolor(41,220,113),0);
  78.         drawsprite(Bar3, 131, 8, 2500);
  79.       }else if(P2 && P2name == "CBilly"){
  80.         int HP2 = getentityproperty(P2, "health");
  81.         drawbox(156,9,HP2-3,10,999,rgbcolor(128,0,240),0);
  82.         drawsprite(Bar4, 131, 8, 2500);
  83.       }else if(P2 && P2name == "Sonny"){
  84.         int HP2 = getentityproperty(P2, "health");
  85.         drawbox(156,9,HP2-3,10,999,rgbcolor(239,181,41),0);
  86.         drawsprite(Bar5, 131, 8, 2500);
  87.       }else if(P2 && P2name == "chinsei"){
  88.         int HP2 = getentityproperty(P2, "health");
  89.         drawbox(156,9,HP2-3,10,999,rgbcolor(252,252,252),0);
  90.         drawsprite(Bar6, 131, 8, 2500);
  91.       }
  92.     }
  93.     */
  94. }
  95.  
  96. void oncreate()
  97. {
  98.     void Bar;
  99.     void Bar2;
  100.     void Bar3;
  101.     void Bar4;
  102.     void Bar5;
  103.     void Bar6;
  104.  
  105.     if(!Bar){
  106.       Bar = loadsprite("data/sprites/bar.gif");
  107.       Bar2 = loadsprite("data/sprites/bar2.gif");
  108.       Bar3 = loadsprite("data/sprites/bar3.gif");
  109.       Bar4 = loadsprite("data/sprites/bar4.gif");
  110.       Bar5 = loadsprite("data/sprites/bar5.gif");
  111.       Bar6 = loadsprite("data/sprites/bar6.gif");
  112.       setglobalvar("Bar", Bar);
  113.       setglobalvar("Bar2", Bar2);
  114.       setglobalvar("Bar3", Bar3);
  115.       setglobalvar("Bar4", Bar4);
  116.       setglobalvar("Bar5", Bar5);
  117.       setglobalvar("Bar6", Bar6);
  118.     }
  119. }
  120.  
  121. void ondestroy(){
  122.     void Bar = getglobalvar("Bar");
  123.     void Bar2 = getglobalvar("Bar2");
  124.     void Bar3 = getglobalvar("Bar3");
  125.     void Bar4 = getglobalvar("Bar4");
  126.     void Bar5 = getglobalvar("Bar5");
  127.     void Bar6 = getglobalvar("Bar6");
  128.  
  129.     if(Bar){
  130.       free(Bar);
  131.       free(Bar2);
  132.       free(Bar3);
  133.       free(Bar4);
  134.       free(Bar5);
  135.       free(Bar6);
  136.       setglobalvar("Bar", NULL());
  137.       setglobalvar("Bar2", NULL());
  138.       setglobalvar("Bar3", NULL());
  139.       setglobalvar("Bar4", NULL());
  140.       setglobalvar("Bar5", NULL());
  141.       setglobalvar("Bar6", NULL());
  142.     }
  143. }
  144.  
  145.  
  146. void piladaKoul()
  147. {
  148.     //SONG SELECTION IN THE PAUSE MENU ONLY IN THE THIRD GAME MODE
  149.     if(openborvariant("in_titlescreen")){
  150.         if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
  151.     }
  152.  
  153.     //CHECK IF THE PLAYER IS IN THE THIRD GAME MODE
  154.     if(openborvariant("in_level") && openborvariant("current_set") == 2){
  155.  
  156.         int volume      = openborvariant("effectvol");
  157.         int speed       = 100;
  158.         int loop        = 0;
  159.         int menuPause   = getglobalvar("menuPause");
  160.         int musicPause = getglobalvar("musicPause");
  161.         int max         = 4;
  162.         int min         = 0;
  163.         int add         = 1;
  164.  
  165.         //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
  166.         if(openborvariant("game_paused") && !openborvariant("in_options")){
  167.  
  168.             //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
  169.             if( playerkeys(0, 1, "movedown")||
  170.                 playerkeys(1, 1, "movedown")||
  171.                 playerkeys(2, 1, "movedown")||
  172.                 playerkeys(3, 1, "movedown")){
  173.                
  174.                 if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
  175.                 if(menuPause == max){setglobalvar("menuPause", min);}
  176.             }
  177.             if( playerkeys(0, 1, "moveup")||
  178.                 playerkeys(1, 1, "moveup")||
  179.                 playerkeys(2, 1, "moveup")||
  180.                 playerkeys(3, 1, "moveup")){
  181.                
  182.                 if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
  183.                 if(menuPause == min){setglobalvar("menuPause", max);}
  184.             }
  185.  
  186.             //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
  187.             //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
  188.             if( playerkeys(0, 1, "anybutton")||
  189.                 playerkeys(1, 1, "anybutton")||
  190.                 playerkeys(2, 1, "anybutton")||
  191.                 playerkeys(3, 1, "anybutton")){
  192.                
  193.                 //LOCK NATIVE KEYS
  194.                 changeplayerproperty(0, "newkeys", 0);
  195.                 changeplayerproperty(1, "newkeys", 0);
  196.                 changeplayerproperty(2, "newkeys", 0);
  197.                 changeplayerproperty(3, "newkeys", 0);
  198.  
  199.                 //CONTINUE
  200.                 if(menuPause == 0){
  201.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  202.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  203.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  204.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  205.                     //changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
  206.                     //changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
  207.                     //changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
  208.                     //changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
  209.                 }
  210.  
  211.                 //OPTIONS
  212.                 if(menuPause == 1){
  213.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  214.                     options();
  215.                 }
  216.  
  217.                 //HOW TO PLAY
  218.                
  219.                 if(menuPause == 2){
  220.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  221.                     setglobalvar("menuPause", 0);
  222.                     playgif("data/scenes/howto.gif");
  223.                 }
  224.                
  225.  
  226.                
  227.                 /*if(menuPause == 2){
  228.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  229.                     //setglobalvar("menuPause", 0);
  230.                     playgif("data/scenes/howto.gif"); //playgif(path, x, y, noskip) e.g. playgif("data/scenes/cut.gif", 0, 12, 1);
  231.                     //selectMusic();
  232.  
  233.                     //if(musicPause == 0){
  234.                     //  fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5);
  235.                     //}
  236.  
  237.                     //if(musicPause == 1){
  238.                     //  fademusic(0.5, "data/music/dojo/002.ogg", 1, 43526.7);
  239.                     //}
  240.  
  241.                     //if(musicPause == 2){
  242.                     //  fademusic(0.5, "data/music/dojo/003.ogg", 1, 35588.7);
  243.                     //}
  244.  
  245.                     //if(musicPause == 3){
  246.                     //  fademusic(0.5, "data/music/dojo/004.ogg", 1, 1);
  247.                     //}
  248.  
  249.                     void str2;
  250.                     float hRes2     = openborvariant("hresolution");
  251.                     int align2;
  252.                     int yPos2       = 80;
  253.                     int fontPause2  = 3;
  254.                     int font02      = 0;
  255.                     int font12      = 0;
  256.                     int font22      = 0;
  257.                     int font32      = 0;
  258.                     int yAdd2       = 11;
  259.                     int layer2      = -1000000003;
  260.  
  261.                     //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  262.                     if(getglobalvar("musicPause") == 0){font02 = 1;}else    //IS CONTINUE HIGHLIGHTED??
  263.                     if(getglobalvar("musicPause") == 1){font12 = 1;}else    //IS OPTIONS HIGHLIGHTED??
  264.                     if(getglobalvar("musicPause") == 2){font22 = 1;}else    //IS SELECT MUSIC HIGHLIGHTED??
  265.                     if(getglobalvar("musicPause") == 3){font32 = 1;}        //IS END GAME HIGHLIGHTED??
  266.  
  267.                     str2 = "Select Music";align2 = (hRes2-(strwidth(str2, fontPause2)))/2;
  268.                     drawstring(align2, yPos2, fontPause2, str2, layer2);
  269.  
  270.                     yPos2 = yPos2+yAdd2*3;
  271.                     str2 = "001";align2 = (hRes2-(strwidth(str2, font02)))/2;
  272.                     drawstring(align2, yPos2, font02, str2, layer2);
  273.  
  274.                     yPos2 = yPos2+yAdd2;
  275.                     str2 = "002";align2 = (hRes2-(strwidth(str2, font12)))/2;
  276.                     drawstring(align2, yPos2, font12, str2, layer2);
  277.  
  278.                     yPos2 = yPos2+yAdd2;
  279.                     str2 = "003";align2 = (hRes2-(strwidth(str2, font22)))/2;
  280.                     drawstring(align2, yPos2, font22, str2, layer2);
  281.  
  282.                     yPos2 = yPos2+yAdd2;
  283.                     str2 = "004";align2 = (hRes2-(strwidth(str2, font32)))/2;
  284.                     drawstring(align2, yPos2, font32, str2, layer2);
  285.                 }              
  286.                 */
  287.  
  288.                
  289.                 //SELECT MUSIC
  290.                 if(menuPause == 3){
  291.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  292.                     //setglobalvar("menuPause", 2);
  293.                     void vSpawn = spawn();
  294.                     loadmodel("MusicSelect");
  295.                     clearspawnentry();
  296.                     setspawnentry("name", "MusicSelect");
  297.                     setspawnentry("coords", 1, 1, 0);
  298.                     changeentityproperty(vSpawn, "position", 1, 1, 0);
  299.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  300.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  301.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  302.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  303.                 }
  304.                
  305.  
  306.                 //END GAME
  307.                 if(menuPause == 4){
  308.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  309.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  310.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  311.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  312.                 }
  313.             }
  314.  
  315.             //TEXTS, IMAGES AND EFFECTS
  316.             void str;
  317.             float hRes      = openborvariant("hresolution");
  318.             int align;
  319.             int yPos        = 80;
  320.             int fontPause   = 3;
  321.             int font0       = 0;
  322.             int font1       = 0;
  323.             int font2       = 0;
  324.             int font3       = 0;
  325.             int font4       = 0;
  326.             int yAdd        = 11;
  327.             int layer       = -1000000003;
  328.  
  329.             //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  330.             if(getglobalvar("menuPause") == 0){font0 = 1;}else  //IS CONTINUE HIGHLIGHTED??
  331.             if(getglobalvar("menuPause") == 1){font1 = 1;}else  //IS OPTIONS HIGHLIGHTED??
  332.             if(getglobalvar("menuPause") == 2){font2 = 1;}else  //IS HOW TO PLAY HIGHLIGHTED??
  333.             if(getglobalvar("menuPause") == 3){font3 = 1;}else  //IS SELECT MUSIC HIGHLIGHTED??
  334.             if(getglobalvar("menuPause") == 4){font4 = 1;}      //IS END GAME HIGHLIGHTED??
  335.  
  336.             str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
  337.             drawstring(align, yPos, fontPause, str, layer);
  338.  
  339.             yPos = yPos+yAdd*3;
  340.             str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
  341.             drawstring(align, yPos, font0, str, layer);
  342.  
  343.             yPos = yPos+yAdd;
  344.             str = "Options";align = (hRes-(strwidth(str, font1)))/2;
  345.             drawstring(align, yPos, font1, str, layer);
  346.  
  347.             yPos = yPos+yAdd;
  348.             str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
  349.             drawstring(align, yPos, font2, str, layer);
  350.  
  351.             yPos = yPos+yAdd;
  352.             str = "Select Music";align = (hRes-(strwidth(str, font3)))/2;
  353.             drawstring(align, yPos, font3, str, layer);
  354.  
  355.             yPos = yPos+yAdd;
  356.             str = "End Game";align = (hRes-(strwidth(str, font4)))/2;
  357.             drawstring(align, yPos, font4, str, layer);
  358.         }
  359.  
  360.         //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
  361.         if(openborvariant("game_paused") && openborvariant("in_options")){
  362.             changeplayerproperty(0, "newkeys", 0);
  363.             changeplayerproperty(1, "newkeys", 0);
  364.             changeplayerproperty(2, "newkeys", 0);
  365.             changeplayerproperty(3, "newkeys", 0);
  366.         }
  367.  
  368.         //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
  369.         //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
  370.         if(!openborvariant("game_paused") && !openborvariant("in_options")){
  371.  
  372.             //END GAME
  373.             if(menuPause == 4){gameover();}
  374.         }
  375.     }
  376. }
  377.  
  378.  
  379. void trainingPause()
  380. {
  381.     //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
  382.     if(openborvariant("in_titlescreen")){
  383.         if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
  384.     }
  385.  
  386.     //CHECK IF THE PLAYER IS IN A LEVEL
  387.     if(openborvariant("in_level") && openborvariant("current_set") < 2){
  388.         int volume      = openborvariant("effectvol");
  389.         int speed       = 100;
  390.         int loop        = 0;
  391.         int menuPause   = getglobalvar("menuPause");
  392.         int max         = 3;
  393.         int min         = 0;
  394.         int add         = 1;
  395.  
  396.         //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
  397.         if(openborvariant("game_paused") && !openborvariant("in_options")){
  398.  
  399.             //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
  400.             if( playerkeys(0, 1, "movedown")||
  401.                 playerkeys(1, 1, "movedown")||
  402.                 playerkeys(2, 1, "movedown")||
  403.                 playerkeys(3, 1, "movedown")){
  404.                
  405.                 if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
  406.                 if(menuPause == max){setglobalvar("menuPause", min);}
  407.             }
  408.             if( playerkeys(0, 1, "moveup")||
  409.                 playerkeys(1, 1, "moveup")||
  410.                 playerkeys(2, 1, "moveup")||
  411.                 playerkeys(3, 1, "moveup")){
  412.                
  413.                 if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
  414.                 if(menuPause == min){setglobalvar("menuPause", max);}
  415.             }
  416.  
  417.             //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
  418.             //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
  419.             if( playerkeys(0, 1, "anybutton")||
  420.                 playerkeys(1, 1, "anybutton")||
  421.                 playerkeys(2, 1, "anybutton")||
  422.                 playerkeys(3, 1, "anybutton")){
  423.                
  424.                 //LOCK NATIVE KEYS
  425.                 changeplayerproperty(0, "newkeys", 0);
  426.                 changeplayerproperty(1, "newkeys", 0);
  427.                 changeplayerproperty(2, "newkeys", 0);
  428.                 changeplayerproperty(3, "newkeys", 0);
  429.  
  430.                 //CONTINUE
  431.                 if(menuPause == 0){
  432.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  433.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  434.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  435.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  436.                 }
  437.  
  438.                 //OPTIONS
  439.                 if(menuPause == 1){
  440.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  441.                     options();
  442.                 }
  443.  
  444.                 //HOW TO PLAY
  445.                 if(menuPause == 2){
  446.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  447.                     setglobalvar("menuPause", 0);
  448.                     playgif("data/scenes/howto.gif");
  449.                 }
  450.  
  451.                 //END GAME
  452.                 if(menuPause == 3){
  453.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  454.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  455.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  456.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  457.                 }
  458.             }
  459.  
  460.             //TEXTS, IMAGES AND EFFECTS
  461.             void str;
  462.             float hRes      = openborvariant("hresolution");
  463.             int align;
  464.             int yPos        = 80;
  465.             int fontPause   = 3;
  466.             int font0       = 0;
  467.             int font1       = 0;
  468.             int font2       = 0;
  469.             int font3       = 0;
  470.             int yAdd        = 11;
  471.             int layer       = -1000000003;
  472.  
  473.             //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  474.             if(getglobalvar("menuPause") == 0){font0 = 1;}else  //IS CONTINUE HIGHLIGHTED??
  475.             if(getglobalvar("menuPause") == 1){font1 = 1;}else  //IS OPTIONS HIGHLIGHTED??
  476.             if(getglobalvar("menuPause") == 2){font2 = 1;}else  //IS HOW TO PLAY HIGHLIGHTED??
  477.             if(getglobalvar("menuPause") == 3){font3 = 1;}      //IS END GAME HIGHLIGHTED??
  478.  
  479.             str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
  480.             drawstring(align, yPos, fontPause, str, layer);
  481.  
  482.             yPos = yPos+yAdd*3;
  483.             str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
  484.             drawstring(align, yPos, font0, str, layer);
  485.  
  486.             yPos = yPos+yAdd;
  487.             str = "Options";align = (hRes-(strwidth(str, font1)))/2;
  488.             drawstring(align, yPos, font1, str, layer);
  489.  
  490.             yPos = yPos+yAdd;
  491.             str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
  492.             drawstring(align, yPos, font2, str, layer);
  493.  
  494.             yPos = yPos+yAdd;
  495.             str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
  496.             drawstring(align, yPos, font3, str, layer);
  497.         }
  498.  
  499.         //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
  500.         if(openborvariant("game_paused") && openborvariant("in_options")){
  501.             changeplayerproperty(0, "newkeys", 0);
  502.             changeplayerproperty(1, "newkeys", 0);
  503.             changeplayerproperty(2, "newkeys", 0);
  504.             changeplayerproperty(3, "newkeys", 0);
  505.         }
  506.  
  507.         //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
  508.         //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
  509.         if(!openborvariant("game_paused") && !openborvariant("in_options")){
  510.  
  511.             //END GAME
  512.             if(menuPause == 3){gameover();}
  513.         }
  514.     }
  515. }
  516.  
  517. void customPauseTest(){
  518.     //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
  519.     if(openborvariant("in_titlescreen")){
  520.         if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
  521.     }
  522.  
  523.     if(openborvariant("in_level") && openborvariant("current_set") == 2){
  524.         int volume      = openborvariant("effectvol");
  525.         int speed       = 100;
  526.         int loop        = 0;
  527.         int menuPause   = getglobalvar("menuPause");
  528.         int max         = 5;
  529.         int min         = 0;
  530.         int add         = 1;
  531.  
  532.         //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
  533.         if(openborvariant("game_paused") && !openborvariant("in_options")){
  534.  
  535.             //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
  536.             if( playerkeys(0, 1, "movedown")||
  537.                 playerkeys(1, 1, "movedown")||
  538.                 playerkeys(2, 1, "movedown")||
  539.                 playerkeys(3, 1, "movedown")){
  540.                
  541.                 if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
  542.                 if(menuPause == max){setglobalvar("menuPause", min);}
  543.             }
  544.             if( playerkeys(0, 1, "moveup")||
  545.                 playerkeys(1, 1, "moveup")||
  546.                 playerkeys(2, 1, "moveup")||
  547.                 playerkeys(3, 1, "moveup")){
  548.                
  549.                 if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
  550.                 if(menuPause == min){setglobalvar("menuPause", max);}
  551.             }
  552.  
  553.  
  554.             //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
  555.             //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
  556.             if( playerkeys(0, 1, "anybutton")||
  557.                 playerkeys(1, 1, "anybutton")||
  558.                 playerkeys(2, 1, "anybutton")||
  559.                 playerkeys(3, 1, "anybutton")){
  560.                
  561.                 //LOCK NATIVE KEYS
  562.                 changeplayerproperty(0, "newkeys", 0);
  563.                 changeplayerproperty(1, "newkeys", 0);
  564.                 changeplayerproperty(2, "newkeys", 0);
  565.                 changeplayerproperty(3, "newkeys", 0);
  566.  
  567.                 //CONTINUE
  568.                 if(menuPause == 0){
  569.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  570.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  571.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  572.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  573.                 }
  574.  
  575.                 //OPTIONS
  576.                 if(menuPause == 1){
  577.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  578.                     options();
  579.                 }
  580.  
  581.                 //HOW TO PLAY
  582.                 if(menuPause == 2){
  583.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  584.                     setglobalvar("menuPause", 0);
  585.                     playgif("data/scenes/howto.gif");
  586.                 }
  587.  
  588.                 // CALL PARTNER
  589.                 if(menuPause == 3){
  590.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  591.                     //setglobalvar("menuPause", 0);
  592.  
  593.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  594.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  595.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  596.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  597.                 }
  598.  
  599.                 // MUSIC TEST
  600.                 if(menuPause == 4){
  601.                     playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
  602.                     //setglobalvar("menuPause", 0);
  603.  
  604.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  605.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  606.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  607.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  608.                 }
  609.  
  610.                 //END GAME
  611.                 if(menuPause == 5){
  612.                     changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
  613.                     changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
  614.                     changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
  615.                     changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
  616.                 }
  617.  
  618.  
  619.             }
  620.            
  621.                         //TEXTS, IMAGES AND EFFECTS
  622.             void str;
  623.             float hRes      = openborvariant("hresolution");
  624.             int align;
  625.             int yPos        = 80;
  626.             int fontPause   = 3;
  627.             int font0       = 0;
  628.             int font1       = 0;
  629.             int font2       = 0;
  630.             int font3       = 0;
  631.             int font4       = 0;
  632.             int font5       = 0;
  633.             int yAdd        = 11;
  634.             int layer       = -1000000003;
  635.  
  636.             //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  637.             if(getglobalvar("menuPause") == 0){font0 = 1;}else  //IS CONTINUE HIGHLIGHTED??
  638.             if(getglobalvar("menuPause") == 1){font1 = 1;}else  //IS OPTIONS HIGHLIGHTED??
  639.             if(getglobalvar("menuPause") == 2){font2 = 1;}else  //IS HOW TO PLAY HIGHLIGHTED??
  640.             if(getglobalvar("menuPause") == 3){font3 = 1;}else  //IS CALL PARTNER HIGHLIGHTED??
  641.             if(getglobalvar("menuPause") == 4){font4 = 1;}else  //IS MUSIC TEST HIGHLIGHTED??
  642.             if(getglobalvar("menuPause") == 5){font5 = 1;}      //IS END GAME HIGHLIGHTED??
  643.  
  644.             str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
  645.             drawstring(align, yPos, fontPause, str, layer);
  646.  
  647.             yPos = yPos+yAdd*3;
  648.             str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
  649.             drawstring(align, yPos, font0, str, layer);
  650.  
  651.             yPos = yPos+yAdd;
  652.             str = "Options";align = (hRes-(strwidth(str, font1)))/2;
  653.             drawstring(align, yPos, font1, str, layer);
  654.  
  655.             yPos = yPos+yAdd;
  656.             str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
  657.             drawstring(align, yPos, font2, str, layer);
  658.  
  659.             yPos = yPos+yAdd;
  660.             str = "Call Partner";align = (hRes-(strwidth(str, font3)))/2;
  661.             drawstring(align, yPos, font3, str, layer);
  662.  
  663.             yPos = yPos+yAdd;
  664.             str = "Music Test";align = (hRes-(strwidth(str, font4)))/2;
  665.             drawstring(align, yPos, font4, str, layer);
  666.  
  667.             yPos = yPos+yAdd;
  668.             str = "End Game";align = (hRes-(strwidth(str, font5)))/2;
  669.             drawstring(align, yPos, font5, str, layer);
  670.         }
  671.  
  672.         //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
  673.         if(openborvariant("game_paused") && openborvariant("in_options")){
  674.             changeplayerproperty(0, "newkeys", 0);
  675.             changeplayerproperty(1, "newkeys", 0);
  676.             changeplayerproperty(2, "newkeys", 0);
  677.             changeplayerproperty(3, "newkeys", 0);
  678.         }
  679.  
  680.         //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
  681.         //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
  682.         if(!openborvariant("game_paused") && !openborvariant("in_options")){
  683.  
  684.             //END GAME
  685.             if(menuPause == 5){gameover();}
  686.         }
  687.     }
  688. }
  689.  
  690.  
  691. void loadAll()
  692. {//Load all necessary variables
  693.  
  694.     //SCRIPT USED TO CLEAR ALL VARIABLES AND ASSETS
  695.     if(getglobalvar("clearAll") != NULL()){clearAssets();clearlocalvar();clearglobalvar();}
  696.  
  697.     //PARTNER MENU FUNCTIONS
  698.     if(getglobalvar("activeText") == NULL()){
  699.         setglobalvar("highlight", 0);
  700.         setglobalvar("selectPartner", "HaggarNPC");
  701.         setglobalvar("partnerAlive", 0);
  702.         setglobalvar("partnerMode", "balanced");
  703.         setglobalvar("partnerAggression", "*****");
  704.         setglobalvar("partnerGetFood", "yes");
  705.         setglobalvar("partnerFollow", "automatic");
  706.         setglobalvar("partnerRespawn", "instantly");
  707.         setglobalvar("partnerLifeBar", "full_hud");
  708.         setglobalvar("activeText", 0);
  709.         setglobalvar("selectSong", "001");
  710.     }
  711.    
  712.     //LOAD ALL NECESSARY ASSETS (SPRITES, SOUNDS, ETC)
  713.     saveAssets();
  714. }
  715.  
  716.  
  717.  
  718. void saveAssets()
  719. {//Load global assets for further use
  720.  
  721.     if(getglobalvar("saveAssets") == NULL()){ //TRIGGER TO ALLOW ALL VARIABLES TO BE DEFINED ONCE
  722.        
  723.         //CAUTION!! ALL GLOBAL VARIABLES BELOW WILL CHANGE ALL ASSETS USED IN MANY SCRIPTS
  724.        
  725.         //GLOBAL USAGE (PUT ALL NECESSARY SPRITES TO BE LOADED HERE)
  726.         setglobalvar("parrow5", loadsprite("data/sprites/parrow5.png"));
  727.        
  728.         //TRIGGER TO STOP THE SCRIPT AFTER RUN ONCE, SAVE CPU POWER
  729.         setglobalvar("saveAssets", 1);
  730.     }
  731. }
  732.  
  733.  
  734.  
  735. void clearAssets()
  736. {//Clear all used assets to save memory
  737.  
  738.     if(getglobalvar("clearAssets") == NULL()){ //TRIGGER TO CLEAR ALL VARIABLES
  739.    
  740.         //GLOBAL USAGE (PUT ALL PREVIOUS LOADED SPRITES HERE TO SAVE MEMORY)
  741.         free(getglobalvar("parrow5"));
  742.  
  743.         //TRIGGER TO STOP THE SCRIPT AFTER RUN ONCE, SAVE CPU POWER
  744.         setglobalvar("clearAssets", 1);
  745.     }
  746. }
  747.  
  748.  
  749.  
  750. void menuPartners()
  751. {//Draw a CPU Partner Menu in game
  752.    
  753.     //DRAW MENU
  754.     if(getglobalvar("activeText") == "Partner"){
  755.         void str;
  756.         float hRes  = openborvariant("hresolution");
  757.         int align;
  758.         int xDif    = 10;               //DIFFERENCE BETWEEN THE FIRST AND SECOND COLUMNS
  759.         int xPos1   = (hRes/2)-xDif;    //BASE X POSITION, FIRST COLUMN (HIGHLIGHTED OPTIONS NAME)
  760.         int xPos2   = (hRes/2)+xDif;    //BASE X POSITION, SECOND COLUMN (HIGHLIGHTED OPTIONS CHANGE)
  761.         int yPos    = 60;               //BASE Y POSITION FOR ALL MENU CONTENT, USE THIS TO MOVE ALL OPTIONS TOGETHER
  762.         int font0   = 0;                //ALL FONTS BELOW CHANGES FROM 0 TO 1 IF THE OPTION IS HIGHLIGHTED
  763.         int font0   = 0;
  764.         int font1   = 0;
  765.         int font2   = 0;
  766.         int font3   = 0;
  767.         int font4   = 0;
  768.         int font5   = 0;
  769.         int font6   = 0;
  770.         int yAdd    = 11;
  771.         int layer   = 1000000003;
  772.        
  773.         //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  774.         if(getglobalvar("highlight") == 0){ font0 = 1;}else //IS PARTNER MODE HIGHLIGHTED??
  775.         if(getglobalvar("highlight") == 1){ font1 = 1;}else //IS PARTNER AGGRESSION HIGHLIGHTED??
  776.         if(getglobalvar("highlight") == 2){ font2 = 1;}else //IS PARTNER GET FOOD HIGHLIGHTED??
  777.         if(getglobalvar("highlight") == 3){ font3 = 1;}else //IS PARTNER FOLLOW HIGHLIGHTED??
  778.         if(getglobalvar("highlight") == 4){ font4 = 1;}else //IS PARTNER RESPAWN HIGHLIGHTED??
  779.         if(getglobalvar("highlight") == 5){ font5 = 1;}else //IS PARTNER LIFE BAR HIGHLIGHTED??
  780.         if(getglobalvar("highlight") == 6){ font6 = 1;}     //IS PARTNER SPAWN HIGHLIGHTED??
  781.        
  782.         str = "fighting_mode:";align = xPos1-strwidth(str, font0);
  783.         drawstring(align, yPos, font0, str, layer);
  784.         str = getglobalvar("partnerMode");
  785.         drawstring(xPos2, yPos, font0, str, layer);
  786.  
  787.         yPos = yPos+yAdd;
  788.         str = "aggression:";align = xPos1-strwidth(str, font0);
  789.         drawstring(align, yPos, font1, str, layer);
  790.         str = getglobalvar("partnerAggression");
  791.         drawstring(xPos2, yPos, font1, str, layer);
  792.  
  793.         yPos = yPos+yAdd;
  794.         str = "get_food:";align = xPos1-strwidth(str, font0);
  795.         drawstring(align, yPos, font2, str, layer);
  796.         str = getglobalvar("partnerGetFood");
  797.         drawstring(xPos2, yPos, font2, str, layer);
  798.  
  799.         yPos = yPos+yAdd;
  800.         str = "follow_caller:";align = xPos1-strwidth(str, font0);
  801.         drawstring(align, yPos, font3, str, layer);
  802.         str = getglobalvar("partnerFollow");
  803.         drawstring(xPos2, yPos, font3, str, layer);
  804.  
  805.         yPos = yPos+yAdd;
  806.         str = "respawn:";align = xPos1-strwidth(str, font0);
  807.         drawstring(align, yPos, font4, str, layer);
  808.         str = getglobalvar("partnerRespawn");
  809.         drawstring(xPos2, yPos, font4, str, layer);
  810.  
  811.         yPos = yPos+yAdd;
  812.         str = "life_bar:";align = xPos1-strwidth(str, font0);
  813.         drawstring(align, yPos, font5, str, layer);
  814.         str = getglobalvar("partnerLifeBar");
  815.         drawstring(xPos2, yPos, font5, str, layer);
  816.  
  817.         yPos = yPos+yAdd;
  818.         str = "spawn_partner:";align = xPos1-strwidth(str, font0);
  819.         drawstring(align, yPos, font6, str, layer);
  820.         str = getglobalvar("selectPartner");
  821.         drawstring(xPos2, yPos, font6, str, layer);
  822.        
  823.         if(getglobalvar("highlight") == 6 && getglobalvar("partnerIndex") == NULL()){
  824.             yPos = yPos+yAdd*2;
  825.             str = "press_attack_to"; align = (hRes-strwidth(str, font0))/2;
  826.             drawstring(align, yPos, font6, str);
  827.  
  828.             yPos = yPos+yAdd;
  829.             str = "call_cpu_partner"; align = (hRes-strwidth(str, font0))/2;
  830.             drawstring(align, yPos, font6, str);
  831.  
  832.             yPos = yPos+yAdd;
  833.             str = "(player_1_only)"; align = (hRes-strwidth(str, font0))/2;
  834.             drawstring(align, yPos, font6, str);
  835.         }
  836.     }
  837. }
  838.  
  839.  
  840.  
  841.  
  842. void musicMenu()
  843. {
  844. // Draw list of songs
  845.  
  846.     // DRAW MUSIC MENU
  847.  
  848.     if(getglobalvar("activeText") == "Song"){ // Does the music playlist exist?
  849.         void str;
  850.         float hRes  = openborvariant("hresolution");
  851.         int align;
  852.         int xDif    = 10;               //DIFFERENCE BETWEEN THE FIRST AND SECOND COLUMNS
  853.         int xPos1   = (hRes/2)-xDif;    //BASE X POSITION, FIRST COLUMN (HIGHLIGHTED OPTIONS NAME)
  854.         int xPos2   = (hRes/2)+xDif;    //BASE X POSITION, SECOND COLUMN (HIGHLIGHTED OPTIONS CHANGE)
  855.         int yPos    = 60;               //BASE Y POSITION FOR ALL MENU CONTENT, USE THIS TO MOVE ALL OPTIONS TOGETHER
  856.         int font0   = 0;                //ALL FONTS BELOW CHANGES FROM 0 TO 1 IF THE OPTION IS HIGHLIGHTED
  857.         int font0   = 0;
  858.         int font1   = 0;
  859.         int yAdd    = 11;
  860.         int layer   = 1000000003;
  861.  
  862.         //DEFINE FONTS TO HIGHLIGHTED OPTIONS
  863.         if(getglobalvar("highlight") == 0){ font0 = 1;}else // CHOOSE SONG
  864.         if(getglobalvar("highlight") == 1){ font1 = 1;}else // EXIT
  865.         //if(getglobalvar("highlight") == 2){   font2 = 1;}
  866.  
  867.         str = "Choose_song:";align = xPos1-strwidth(str, font0);
  868.         drawstring(align, yPos, font0, str, layer);
  869.         str = getglobalvar("selectSong");
  870.         drawstring(xPos2, yPos, font0, str, layer);
  871.  
  872.         /*if(getglobalvar("highlight") == 0 && getglobalvar("songIndex") == NULL()){
  873.             yPos = yPos+yAdd*2;
  874.             str = "press_attack_to"; align = (hRes-strwidth(str, font0))/2;
  875.             drawstring(align, yPos, font0, str);
  876.  
  877.             yPos = yPos+yAdd;
  878.             str = "play_music"; align = (hRes-strwidth(str, font0))/2;
  879.             drawstring(align, yPos, font0, str);
  880.  
  881.             yPos = yPos+yAdd;
  882.             str = "(player_1_only)"; align = (hRes-strwidth(str, font0))/2;
  883.             drawstring(align, yPos, font0, str);
  884.         }*/
  885.  
  886.         yPos = yPos+yAdd;
  887.         str = "Close";align = xPos1-strwidth(str, font1);
  888.         drawstring(align, yPos, font1, str, layer);
  889.         //str = getglobalvar("closeMusicMenu");
  890.         //drawstring(xPos2, yPos, font1, str, layer);
  891.  
  892.         //yPos = yPos+yAdd;
  893.         //str = "002";align = xPos1-strwidth(str, font0);
  894.         //drawstring(align, yPos, font2, str, layer);
  895.         //str = getglobalvar("partnerGetFood");
  896.         //drawstring(xPos2, yPos, font2, str, layer);
  897.     }
  898.  
  899. }
Advertisement
Add Comment
Please, Sign In to add comment