home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / numbersequence.swf / scripts / DefineSprite_323 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-09-27  |  19.8 KB  |  822 lines

  1. function doInit(nStage)
  2. {
  3.    m_szCgiLoad = "No";
  4.    m_szRankIn = "No";
  5.    m_szID = "";
  6.    m_nPoint = 0;
  7.    var i = 0;
  8.    while(i < 5)
  9.    {
  10.       m_anStageGrade[i] = 0;
  11.       i++;
  12.    }
  13.    this.playSoundButton();
  14.    this.doGameInit(nStage,false);
  15.    this.gotoAndPlay(2);
  16. }
  17. function doGameInit(nStage, bContinue)
  18. {
  19.    m_nMode = GD_MODE_START;
  20.    var i = m_nCount;
  21.    while(i < m_nAllCount)
  22.    {
  23.       var szBall = "Ball-" + i;
  24.       BallLayer[szBall].removeMovieClip();
  25.       i++;
  26.    }
  27.    m_nFrameCount = 0;
  28.    m_nStage = nStage;
  29.    m_nMiss = 0;
  30.    m_nCount = 0;
  31.    m_nLife = 3;
  32.    m_bTimeOver = false;
  33.    m_bEmergency = false;
  34.    m_nAllCount = m_anAllCount[m_nStage];
  35.    m_nAllMSeconds = m_anAllSecond[m_nStage] * 1000;
  36.    FrameSet.stop();
  37.    ResultSet._visible = false;
  38.    Balloon._visible = false;
  39.    OverMessage._visible = false;
  40.    ButtonSet.setVisible(false);
  41.    Stage.setVisible(false);
  42.    ClearCount.setVisible(false);
  43.    Start.setVisible(false);
  44.    Clear.setVisible(false);
  45.    Perfect.setVisible(false);
  46.    Message.setVisible(false);
  47.    Tutorial0.setVisible(false);
  48.    var cList = new Object();
  49.    cList.ra = 100;
  50.    cList.ga = 100;
  51.    cList.ba = 100;
  52.    cList.aa = 100;
  53.    cList.ab = 100;
  54.    cList.rb = 0;
  55.    cList.gb = 0;
  56.    cList.bb = 0;
  57.    var cColor = new Color(Cocoa.Body);
  58.    cColor.setTransform(cList);
  59.    Cocoa.setFace(9);
  60.    Cocoa._xscale = 100;
  61.    Cocoa._yscale = 100;
  62.    Cocoa._x = -20;
  63.    Cocoa._y = 70;
  64.    Back._xscale = 100;
  65.    Back._yscale = 100;
  66.    Back._x = 0;
  67.    Back._y = -15;
  68.    this.setBack(0);
  69.    this.setTime(true);
  70.    this.setBall();
  71.    this.setLife();
  72.    SoundBack.stop();
  73.    SoundBack.setVolume(100);
  74.    SoundBack.start(0,999);
  75. }
  76. function setBall()
  77. {
  78.    var m_anR = [96,-64,-64];
  79.    var m_anG = [-64,16,-32];
  80.    var m_anB = [-64,-32,64];
  81.    var cList = new Object();
  82.    cList.ra = 100;
  83.    cList.ga = 100;
  84.    cList.ba = 100;
  85.    cList.aa = 100;
  86.    cList.ab = 100;
  87.    var anTypeRandom = this.getRandomSortArray(m_nAllCount);
  88.    var i = 0;
  89.    while(i < m_nAllCount)
  90.    {
  91.       var nNumber = anTypeRandom[i];
  92.       var szName = "Ball-" + nNumber;
  93.       var nType = 2;
  94.       if(i < m_anType0[m_nStage])
  95.       {
  96.          nType = 0;
  97.       }
  98.       else if(i < m_anType0[m_nStage] + m_anType1[m_nStage])
  99.       {
  100.          nType = 1;
  101.       }
  102.       var szBall = "Ball" + nType;
  103.       BallLayer.attachMovie(szBall,szName,m_nAllCount - nNumber);
  104.       BallLayer[szName]._visible = false;
  105.       BallLayer[szName].m_nNumber = nNumber;
  106.       BallLayer[szName].Number.m_szNumber = nNumber + 1;
  107.       BallLayer[szName].m_nType = nType;
  108.       var cColor = new Color(BallLayer[szName].Back);
  109.       if(m_nStage < 5)
  110.       {
  111.          cList.rb = m_anR[Math.floor(nNumber / 5) % 3];
  112.          cList.gb = m_anG[Math.floor(nNumber / 5) % 3];
  113.          cList.bb = m_anB[Math.floor(nNumber / 5) % 3];
  114.       }
  115.       else if(m_nStage < 10)
  116.       {
  117.          cList.rb = m_anR[nType];
  118.          cList.gb = m_anG[nType];
  119.          cList.bb = m_anB[nType];
  120.       }
  121.       else
  122.       {
  123.          cList.rb = m_anR[i % 3];
  124.          cList.gb = m_anG[i % 3];
  125.          cList.bb = m_anB[i % 3];
  126.       }
  127.       cColor.setTransform(cList);
  128.       i++;
  129.    }
  130.    var anRandom;
  131.    var i = 0;
  132.    while(i < m_nAllCount)
  133.    {
  134.       if(i % 12 == 0)
  135.       {
  136.          anRandom = this.getRandomSortArray(12);
  137.       }
  138.       var szName = "Ball-" + i;
  139.       if(BallLayer[szName].m_nType == 0)
  140.       {
  141.          BallLayer[szName]._x = m_anBall0X[anRandom[i % 12]];
  142.          BallLayer[szName]._y = m_anBall0Y[anRandom[i % 12]];
  143.       }
  144.       else if(BallLayer[szName].m_nType == 1)
  145.       {
  146.          BallLayer[szName]._x = m_anBall1X[anRandom[i % 12]];
  147.          BallLayer[szName]._y = m_anBall1Y[anRandom[i % 12]];
  148.       }
  149.       else
  150.       {
  151.          var nRnd = this.getRandom(2);
  152.          BallLayer[szName]._x = m_anBall2X[anRandom[i % 12]] + m_anBall2SX[nRnd];
  153.          BallLayer[szName]._y = m_anBall2Y[anRandom[i % 12]] + m_anBall2SY[nRnd];
  154.       }
  155.       i++;
  156.    }
  157. }
  158. function doFrameAction()
  159. {
  160.    if(m_nMode == GD_MODE_START)
  161.    {
  162.       this.doStartAction();
  163.    }
  164.    else if(m_nMode == GD_MODE_GAME)
  165.    {
  166.       this.doGameAction();
  167.    }
  168.    else if(m_nMode == GD_MODE_OVER)
  169.    {
  170.       this.doOverAction();
  171.    }
  172.    else if(m_nMode == GD_MODE_CLEAR)
  173.    {
  174.       this.doClearAction();
  175.    }
  176.    else if(m_nMode == GD_MODE_ENDING)
  177.    {
  178.       this.doEndingAction();
  179.    }
  180.    else if(m_nMode == GD_MODE_REPORT)
  181.    {
  182.       this.doReportAction();
  183.    }
  184.    else if(m_nMode == GD_MODE_NAME)
  185.    {
  186.       this.doNameAction();
  187.    }
  188. }
  189. function doStartAction()
  190. {
  191.    if(m_nFrameCount == 0)
  192.    {
  193.       Cocoa.setFace(9);
  194.       Stage._x = 24;
  195.       Stage.setVisible(true,m_nStage % 5 + 1);
  196.    }
  197.    else if(m_nFrameCount == 33)
  198.    {
  199.       Cocoa.setFace(0);
  200.    }
  201.    else if((m_nFrameCount == 36 || m_nFrameCount == 37) && m_nStage % 5 == 0)
  202.    {
  203.       if(_root.m_bTutorial)
  204.       {
  205.          if(m_nFrameCount == 36)
  206.          {
  207.             SoundTutorial.start();
  208.             Tutorial0.setVisible(true);
  209.          }
  210.          else
  211.          {
  212.             m_nFrameCount--;
  213.          }
  214.       }
  215.    }
  216.    else if(m_nFrameCount == 40)
  217.    {
  218.       ClearCount.dispClearCount(m_nAllCount);
  219.       ClearCount.dispClearTime(m_nAllMSeconds / 1000);
  220.       SoundStage.start();
  221.    }
  222.    else if(m_nFrameCount >= 70 && m_nFrameCount < 90)
  223.    {
  224.       if(m_nFrameCount == 70)
  225.       {
  226.          ClearCount.setVisible(false);
  227.          Stage.setVisible(false);
  228.       }
  229.    }
  230.    else if(m_nFrameCount == 90)
  231.    {
  232.       Start.setVisible(true);
  233.       SoundStart.start();
  234.    }
  235.    else if(m_nFrameCount == 100)
  236.    {
  237.       Start.setVisible(false);
  238.       var i = 0;
  239.       while(i < m_nAllCount)
  240.       {
  241.          var szName = "Ball-" + i;
  242.          BallLayer[szName]._visible = true;
  243.          i++;
  244.       }
  245.       var d = new Date();
  246.       m_nSMSeconds = d.getTime();
  247.       m_nFrameCount = 0;
  248.       m_nMode = GD_MODE_GAME;
  249.       return undefined;
  250.    }
  251.    m_nFrameCount++;
  252. }
  253. function doOverAction()
  254. {
  255.    if(m_nFrameCount == 0)
  256.    {
  257.       Balloon._visible = false;
  258.       FrameSet.setEmergency(false);
  259.       SoundBack.stop();
  260.    }
  261.    else if(m_nFrameCount == 60)
  262.    {
  263.       SoundOver.start();
  264.       OverMessage._visible = true;
  265.       Cocoa.setFace(5);
  266.    }
  267.    else if(m_nFrameCount == 100)
  268.    {
  269.       ButtonSet.setVisible(true);
  270.    }
  271.    if(m_nFrameCount < 40)
  272.    {
  273.       var cList = new Object();
  274.       cList.ra = 100;
  275.       cList.ga = 100;
  276.       cList.ba = 100;
  277.       cList.aa = 100;
  278.       cList.ab = 100;
  279.       cList.rb = m_nFrameCount * 3;
  280.       cList.gb = m_nFrameCount * -0.5;
  281.       cList.bb = m_nFrameCount * -0.5;
  282.       var cColor = new Color(Cocoa.Body);
  283.       cColor.setTransform(cList);
  284.    }
  285.    if(m_nFrameCount < 100)
  286.    {
  287.       m_nFrameCount++;
  288.    }
  289. }
  290. function doClearAction()
  291. {
  292.    if(m_nFrameCount == 0)
  293.    {
  294.       SoundBack.stop();
  295.       SoundClear.start();
  296.       FrameSet.setEmergency(false);
  297.       m_szCgiLoad = "No";
  298.       m_szRankIn = "No";
  299.       ReportSet.m_szRanking = "{invalid_utf8=146}╩ÉM{invalid_utf8=146}{invalid_utf8=134}{invalid_utf8=129}c";
  300.       var nGrade = 2;
  301.       if(m_nMiss == 0 && m_nLastFrame >= 10 * GD_FPS)
  302.       {
  303.          nGrade = 0;
  304.       }
  305.       else if(1 >= m_nMiss && m_nLastFrame >= 5 * GD_FPS)
  306.       {
  307.          nGrade = 1;
  308.       }
  309.       else if(m_nMiss >= 2 || m_nLastFrame < 1 * GD_FPS)
  310.       {
  311.          nGrade = 3;
  312.       }
  313.       m_anStageGrade[m_nStage] = nGrade;
  314.       if(m_nMiss == 0)
  315.       {
  316.          Perfect.setVisible(true);
  317.       }
  318.       else
  319.       {
  320.          Clear.setVisible(true);
  321.       }
  322.    }
  323.    else if(m_nFrameCount == 40)
  324.    {
  325.       Clear.setVisible(false);
  326.       Perfect.setVisible(false);
  327.    }
  328.    else if(m_nFrameCount == 50)
  329.    {
  330.       ResultSet.Grade.setVisible(false);
  331.       ResultSet.GradeStr.setVisible(false);
  332.       ResultSet.Message.setVisible(false);
  333.       ResultSet.m_szPoint = m_nPoint;
  334.       ResultSet.m_szTime = m_szTime;
  335.       ResultSet.Life.setLife(m_nLife);
  336.       ResultSet._visible = true;
  337.    }
  338.    else if(m_nFrameCount == 68)
  339.    {
  340.       if(0 < m_nLastFrame % 20)
  341.       {
  342.          m_nLastFrame--;
  343.          this.setResultTime();
  344.          m_nPoint += 10;
  345.          ResultSet.m_szPoint = m_nPoint;
  346.          m_nFrameCount = 67;
  347.       }
  348.    }
  349.    else if(m_nFrameCount == 70)
  350.    {
  351.       if(0 < m_nLastFrame)
  352.       {
  353.          m_nLastFrame -= 20;
  354.          this.setResultTime();
  355.          m_nPoint += 200;
  356.          ResultSet.m_szPoint = m_nPoint;
  357.          m_nFrameCount = 69;
  358.       }
  359.    }
  360.    else if(m_nFrameCount == 80 || m_nFrameCount == 90 || m_nFrameCount == 100)
  361.    {
  362.       if(0 < m_nLife)
  363.       {
  364.          m_nLife--;
  365.          ResultSet.Life.setLife(m_nLife);
  366.          m_nPoint += 1000;
  367.          ResultSet.m_szPoint = m_nPoint;
  368.       }
  369.    }
  370.    else if(m_nFrameCount == 120)
  371.    {
  372.       ResultSet.GradeStr.setVisible(true);
  373.       ResultSet.Grade.setGrade(m_anStageGrade[m_nStage]);
  374.       ResultSet.Message.setFrame(m_anStageGrade[m_nStage]);
  375.       var anFace = [1,3,2,5];
  376.       Cocoa.setFace(anFace[m_anStageGrade[m_nStage]]);
  377.    }
  378.    else if(m_nFrameCount == 210)
  379.    {
  380.       if(m_nStage % 5 < 4)
  381.       {
  382.          m_nFrameCount = 0;
  383.          this.doGameInit(m_nStage + 1,false);
  384.       }
  385.       else
  386.       {
  387.          m_nFrameCount = 0;
  388.          m_nMode = GD_MODE_ENDING;
  389.       }
  390.       return undefined;
  391.    }
  392.    if(m_nFrameCount < 30)
  393.    {
  394.       Back._xscale = 100 + m_nFrameCount * 2;
  395.       Back._yscale = 100 + m_nFrameCount * 2;
  396.       Back._x -= 2.8;
  397.       BAck._y -= 2.7;
  398.       Cocoa._xscale = 100 + m_nFrameCount * 2;
  399.       Cocoa._yscale = 100 + m_nFrameCount * 2;
  400.       Cocoa._x -= 3;
  401.       Cocoa._y -= 0.8;
  402.    }
  403.    m_nFrameCount++;
  404. }
  405. function doEndingAction()
  406. {
  407.    if(m_nFrameCount == 0)
  408.    {
  409.       ResultSet.Message.setVisible(false);
  410.       Cocoa.setFace(9);
  411.    }
  412.    else if(m_nFrameCount == 33)
  413.    {
  414.       Cocoa.setFace(1);
  415.    }
  416.    else if(m_nFrameCount == 40)
  417.    {
  418.       ResultSet.Message.setFrame(4 + Math.floor(m_nStage / 5));
  419.    }
  420.    else if(m_nFrameCount == 140)
  421.    {
  422.       if(Math.floor(m_nStage / 5) == 2)
  423.       {
  424.          Act = "SetMyRanking";
  425.          Point = m_nPoint / 10;
  426.          VAL = Point % 5 * 3 + (Point % 7 + 4) * 13 + (Point % 19 + 5) * 100;
  427.          this.loadVariables(m_szCgiURL,"POST");
  428.          m_nFrameCount = 0;
  429.          ReportSet.m_szPoint = m_nPoint + "{invalid_utf8=147}_";
  430.          ReportSet.ReportNext.setVisible(false);
  431.          ReportSet.ReportOK.setVisible(true);
  432.          ReportSet.setVisible(true);
  433.          m_nMode = GD_MODE_REPORT;
  434.       }
  435.       else
  436.       {
  437.          this.stop();
  438.          _root.onGameButtonOver();
  439.       }
  440.    }
  441.    m_nFrameCount++;
  442. }
  443. function doReportAction()
  444. {
  445.    if(m_szRankIn == "Yes")
  446.    {
  447.       ReportSet.ReportNext.setVisible(true);
  448.       ReportSet.ReportOK.setVisible(false);
  449.    }
  450. }
  451. function doNameAction()
  452. {
  453.    if(m_bRankEntry && m_szCgiLoad == "Yes")
  454.    {
  455.       this.onGameButtonOver();
  456.    }
  457. }
  458. function doGameAction()
  459. {
  460.    this.setTime(false);
  461.    if(m_nCount >= m_nAllCount)
  462.    {
  463.       Balloon._visible = false;
  464.       m_nFrameCount = 0;
  465.       m_nMode = GD_MODE_CLEAR;
  466.       return undefined;
  467.    }
  468.    if(m_bTimeOver)
  469.    {
  470.       m_nFrameCount = 0;
  471.       m_nMode = GD_MODE_OVER;
  472.       return undefined;
  473.    }
  474.    m_nFrameCount++;
  475. }
  476. function setTime(bInit)
  477. {
  478.    if(bInit)
  479.    {
  480.       m_nSMSeconds = 0;
  481.       m_nMSeconds = 0;
  482.    }
  483.    else
  484.    {
  485.       var d = new Date();
  486.       m_nMSeconds = d.getTime();
  487.       if(m_nPrevMSeconds >= m_nMSeconds)
  488.       {
  489.          m_nMSeconds = m_nPrevMSeconds + 50;
  490.       }
  491.       m_nPrevMSeconds = m_nMSeconds;
  492.       m_nMSeconds -= m_nSMSeconds;
  493.    }
  494.    m_nLastFrame = Math.floor((m_nAllMSeconds - m_nMSeconds) / 50);
  495.    if(0 >= m_nLastFrame)
  496.    {
  497.       m_nLastFrame = 0;
  498.       m_bTimeOver = true;
  499.    }
  500.    var nSec = Math.floor(m_nLastFrame / GD_FPS);
  501.    var nMil = Math.floor(m_nLastFrame % GD_FPS) * 5;
  502.    if(nSec < 10)
  503.    {
  504.       nSec = "0" + nSec;
  505.    }
  506.    if(nMil < 10)
  507.    {
  508.       nMil = "0" + nMil;
  509.    }
  510.    m_szTime = nSec + ":" + nMil;
  511.    Bar.Mark._x = m_nMSeconds / m_nAllMSeconds * 180;
  512.    if(m_nLastFrame < 10 * GD_FPS && !m_bEmergency && !bInit)
  513.    {
  514.       m_bEmergency = true;
  515.       FrameSet.setEmergency(true);
  516.    }
  517. }
  518. function setLife()
  519. {
  520.    Life.setLife(m_nLife);
  521. }
  522. function setResultTime()
  523. {
  524.    var nSec = Math.floor(m_nLastFrame / GD_FPS);
  525.    var nMil = m_nLastFrame % GD_FPS * 5;
  526.    if(nSec < 10)
  527.    {
  528.       nSec = "0" + nSec;
  529.    }
  530.    if(nMil < 10)
  531.    {
  532.       nMil = "0" + nMil;
  533.    }
  534.    ResultSet.m_szTime = nSec + ":" + nMil;
  535. }
  536. function setBack(nWater)
  537. {
  538.    Back.gotoAndStop(Math.floor(m_nStage / 5) * 4 + nWater + 1);
  539. }
  540. function onBallPress(mvBall)
  541. {
  542.    if(m_nMode == GD_MODE_GAME)
  543.    {
  544.       if(m_nCount == mvBall.m_nNumber)
  545.       {
  546.          SoundOK.start();
  547.          var nFace = m_nLife != 3 ? (m_nLife != 2 ? 4 : 7) : 6;
  548.          Cocoa.setFace(nFace);
  549.          mvBall.removeMovieClip();
  550.          m_nCount++;
  551.          Balloon.setCount(m_nCount);
  552.          if(Balloon._visible == false)
  553.          {
  554.             Balloon._visible = true;
  555.          }
  556.       }
  557.       else
  558.       {
  559.          SoundNG.start();
  560.          m_nLife--;
  561.          m_nMiss++;
  562.          this.setLife();
  563.          this.setBack(m_nMiss);
  564.          Cocoa.setFace(8);
  565.          if(m_nLife == 0)
  566.          {
  567.             m_nFrameCount = 0;
  568.             m_nMode = GD_MODE_OVER;
  569.          }
  570.       }
  571.    }
  572. }
  573. function setVisible(bVisible)
  574. {
  575.    if(bVisible)
  576.    {
  577.       _xscale = 100;
  578.       _yscale = 100;
  579.       _visible = true;
  580.    }
  581.    else
  582.    {
  583.       _visible = false;
  584.       _xscale = 0;
  585.       _yscale = 0;
  586.    }
  587. }
  588. function playSoundButton()
  589. {
  590.    _root.SoundButton.start();
  591. }
  592. function onGameButtonOver()
  593. {
  594.    this.stop();
  595.    _root.SoundButton.start();
  596.    _root.onGameButtonOver();
  597. }
  598. function onGameButtonContinue()
  599. {
  600.    this.playSoundButton();
  601.    this.doGameInit(m_nStage,true);
  602. }
  603. function onTutorialButtonOK(nID)
  604. {
  605.    _root.SoundButton.start();
  606.    if(nID == 0)
  607.    {
  608.       Tutorial0.setVisible(false);
  609.       _root.m_bTutorial = false;
  610.    }
  611.    m_nFrameCount = 38;
  612. }
  613. function onNameButton(nID)
  614. {
  615.    var nLength = NameSet.m_szName.length;
  616.    if(nID >= m_aszNameChar.length)
  617.    {
  618.       if(0 < nLength)
  619.       {
  620.          SoundClick.start();
  621.          NameSet.m_szName = NameSet.m_szName.slice(0,nLength - 1);
  622.       }
  623.    }
  624.    else if(nLength < GD_NAME_LEN)
  625.    {
  626.       SoundOK.start();
  627.       NameSet.m_szName += m_aszNameChar[nID];
  628.    }
  629. }
  630. function onReportButtonOK()
  631. {
  632.    this.onGameButtonOver();
  633. }
  634. function onReportButtonYes()
  635. {
  636.    _root.SoundButton.start();
  637.    m_nFrameCount = 0;
  638.    NameSet.m_szName = "";
  639.    NameSet.setVisible(true);
  640.    m_nMode = GD_MODE_NAME;
  641. }
  642. function onReportButtonNo()
  643. {
  644.    this.onGameButtonOver();
  645. }
  646. function onNameButtonOK()
  647. {
  648.    if(0 < NameSet.m_szName.length && m_bRankEntry == false)
  649.    {
  650.       Act = "SetBestName";
  651.       Name = NameSet.m_szName;
  652.       ID = m_szID;
  653.       this.loadVariables(m_szCgiURL,"POST");
  654.       m_bRankEntry = true;
  655.    }
  656. }
  657. function onDebugKeyDown(bUp)
  658. {
  659.    if(GD_DEBUG)
  660.    {
  661.       if(bUp)
  662.       {
  663.          this.doGameInit((m_nStage + 1) % GD_STAGE_MAX);
  664.       }
  665.       else
  666.       {
  667.          this.doGameInit((m_nStage + GD_STAGE_MAX - 1) % GD_STAGE_MAX);
  668.       }
  669.    }
  670. }
  671. function getRandom(nMax)
  672. {
  673.    var nRet = Math.floor(Math.random() * nMax);
  674.    if(nRet == nMax)
  675.    {
  676.       nRet--;
  677.    }
  678.    return nRet;
  679. }
  680. function getRandomSortArray(nNum)
  681. {
  682.    var anArray = new Array(nNum);
  683.    var anValue = new Array(nNum);
  684.    var i = 0;
  685.    while(i < nNum)
  686.    {
  687.       anArray[i] = i;
  688.       anValue[i] = this.getRandom(100);
  689.       i++;
  690.    }
  691.    var nTemp = 0;
  692.    var i = 0;
  693.    while(i < nNum - 1)
  694.    {
  695.       var j = 0;
  696.       while(j < nNum - 1)
  697.       {
  698.          if(anValue[j] < anValue[j + 1])
  699.          {
  700.             nTemp = anValue[j + 1];
  701.             anValue[j + 1] = anValue[j];
  702.             anValue[j] = nTemp;
  703.             nTemp = anArray[j + 1];
  704.             anArray[j + 1] = anArray[j];
  705.             anArray[j] = nTemp;
  706.          }
  707.          j++;
  708.       }
  709.       i++;
  710.    }
  711.    return anArray;
  712. }
  713. function getValueSortArray(anOrgValue)
  714. {
  715.    var nNum = anOrgValue.length;
  716.    var anArray = new Array(nNum);
  717.    var anValue = new Array(nNum);
  718.    var i = 0;
  719.    while(i < nNum)
  720.    {
  721.       anArray[i] = i;
  722.       anValue[i] = anOrgValue[i];
  723.       i++;
  724.    }
  725.    var nTemp = 0;
  726.    var i = 0;
  727.    while(i < nNum - 1)
  728.    {
  729.       var j = 0;
  730.       while(j < nNum - 1)
  731.       {
  732.          if(anValue[j] < anValue[j + 1])
  733.          {
  734.             nTemp = anValue[j + 1];
  735.             anValue[j + 1] = anValue[j];
  736.             anValue[j] = nTemp;
  737.             nTemp = anArray[j + 1];
  738.             anArray[j + 1] = anArray[j];
  739.             anArray[j] = nTemp;
  740.          }
  741.          j++;
  742.       }
  743.       i++;
  744.    }
  745.    return anArray;
  746. }
  747. var GD_FPS = 20;
  748. var GD_DEBUG = false;
  749. var GD_NONE = -1;
  750. var GD_YES = 0;
  751. var GD_NO = 1;
  752. var GD_MODE_START = 0;
  753. var GD_MODE_GAME = 1;
  754. var GD_MODE_OVER = 2;
  755. var GD_MODE_CLEAR = 3;
  756. var GD_MODE_ENDING = 4;
  757. var GD_MODE_REPORT = 5;
  758. var GD_MODE_NAME = 6;
  759. var GD_STAGE_MAX = 15;
  760. var GD_NAME_LEN = 6;
  761. var m_nMode;
  762. var m_nFrameCount = 0;
  763. var m_nStage = 0;
  764. var m_nLife = 3;
  765. var m_nMiss = 0;
  766. var m_nPoint = 0;
  767. var m_anStageGrade = new Array(5);
  768. var m_nCount = 0;
  769. var m_nAllCount = 0;
  770. var m_nLastFrame = 0;
  771. var m_nSMSeconds = 0;
  772. var m_nMSeconds = 0;
  773. var m_nPrevMSeconds = 0;
  774. var m_nAllMSeconds = 0;
  775. var m_bTimeOver = false;
  776. var m_bEmergency = false;
  777. var Act = "";
  778. var Point = 0;
  779. var Name = "MINT";
  780. var ID = 0;
  781. var PWD = "cOcOaSpAsPa";
  782. var VERSION = 3;
  783. var VAL = "";
  784. var m_szCgiURL = "http://211.9.215.138/cgi-bin/beastex/cocoflash/spa/sparank.cgi";
  785. var m_szViewURL = "http://211.9.215.138/cgi-bin/beastex/cocoflash/spa/rankview.cgi";
  786. var m_szCgiLoad;
  787. var m_szRankIn;
  788. var m_szID;
  789. var m_bRankEntry = false;
  790. var m_aszNameChar = ["{invalid_utf8=130}`","{invalid_utf8=130}a","{invalid_utf8=130}b","{invalid_utf8=130}c","{invalid_utf8=130}d","{invalid_utf8=130}e","{invalid_utf8=130}f","{invalid_utf8=130}g","{invalid_utf8=130}h","{invalid_utf8=130}i","{invalid_utf8=130}j","{invalid_utf8=130}k","{invalid_utf8=130}l","{invalid_utf8=130}m","{invalid_utf8=130}n","{invalid_utf8=130}o","{invalid_utf8=130}p","{invalid_utf8=130}q","{invalid_utf8=130}r","{invalid_utf8=130}s","{invalid_utf8=130}t","{invalid_utf8=130}u","{invalid_utf8=130}v","{invalid_utf8=130}w","{invalid_utf8=130}x","{invalid_utf8=130}y","{invalid_utf8=129}D"];
  791. var m_anBall0X = [-150,-75,0,75,150,-140,-70,0,70,140,-160,160];
  792. var m_anBall0Y = [-100,-100,-100,-100,-100,-40,-40,-40,-40,-40,20,20];
  793. var m_anBall1X = [-160,-80,0,80,160,-160,-80,0,80,160,-160,160];
  794. var m_anBall1Y = [-120,-120,-120,-120,-120,-40,-40,-40,-40,-40,40,40];
  795. var m_anBall2X = [-156,-78,0,78,156,-156,-78,0,78,156,-156,156];
  796. var m_anBall2Y = [-118,-118,-118,-118,-118,-40,-40,-40,-40,-40,38,38];
  797. var m_anBall2SX = [-19,19];
  798. var m_anBall2SY = [-19,19];
  799. var m_anAllCount = [20,25,30,35,40,40,45,50,55,60,60,70,80,90,99];
  800. var m_anAllSecond = [30,30,30,35,40,40,45,50,55,60,60,70,80,90,99];
  801. var m_anType0 = [5,10,10,15,15,10,10,10,10,10,10,10,15,15,20];
  802. var m_anType1 = [15,15,20,20,25,15,15,15,20,20,10,15,15,20,20];
  803. var SoundStage = new Sound(Stage);
  804. var SoundStart = new Sound(ClearSecond);
  805. var SoundBack = new Sound(Back);
  806. var SoundTutorial = new Sound(Tutorial0);
  807. var SoundOK = new Sound(Bar);
  808. var SoundNG = new Sound(Life);
  809. var SoundClear = new Sound(Clear);
  810. var SoundOver = new Sound(ButtonSet);
  811. var SoundClick = new Sound(NameSet);
  812. SoundStage.attachSound("SoundStage");
  813. SoundStart.attachSound("SoundStart");
  814. SoundBack.attachSound("SoundBack");
  815. SoundTutorial.attachSound("SoundTutorial");
  816. SoundOK.attachSound("SoundOK");
  817. SoundNG.attachSound("SoundMiss");
  818. SoundClear.attachSound("SoundClear");
  819. SoundOver.attachSound("SoundOver");
  820. SoundClick.attachSound("SoundClick");
  821. this.doInit(_root.m_nStage);
  822.