home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / baku100.zip / baku100 / Kernel / Boot.tonyu < prev    next >
Text File  |  2006-06-04  |  6KB  |  263 lines

  1. extends classes.lang.Object;
  2.  
  3. native generate;
  4.  
  5. function doMouseMove() {
  6.   if (!$mouseSX) return;
  7.   if ($_tmp_cur_select) {
  8.     $_tmp_cur_select.mouseDrag(
  9.     $mouseSX,
  10.     $mouseSY,
  11.     $mouseX,
  12.     $mouseY, $leftButton,$rightButton);
  13.   } else {
  14.     if($_mouse_event) 
  15.     $_mouse_event.onDrag (
  16.             $mouseSX,
  17.     $mouseSY,
  18.     $mouseX,
  19.     $mouseY, $leftButton,$rightButton);
  20.   }
  21.   $mouseSX=0;
  22. }
  23.  
  24.  
  25. function updateAll () {
  26.   var i,c,p;
  27.   i=0;c=$chars.size();
  28.   setAdjust(0,0);
  29.   $map.draw();  
  30.   if($panel) $panel.draw();
  31.   setAdjust($viewX,$viewY);
  32.   while(i<c) {
  33.     p=$chars.get(i);
  34.     p.draw();  
  35.     i=i+1;
  36.   }
  37.   if ($_inspector_target) $_inspector_target.drawFocus();
  38.   if ($window) {
  39.     $window.setSize($screenWidth,$screenHeight,1);
  40.     //$window.setPos($windowX,$windowY);
  41.   }
  42.   doMouseMove();
  43. }
  44.  
  45. function onLoadPage() {
  46.   $execOK=initResource("usr.classes");
  47.   //print("loading done status="+$execOK);
  48. }
  49.  
  50. function initColorConst() {
  51.   $clBlack=color(8,8,16);
  52.   $clRed=color(255,0,0);
  53.   $clGreen=color(0,255,0);
  54.   $clYellow=color(255,255,0);
  55.   $clBlue=color(0,0,255);
  56.   $clPink=color(255,0,255);
  57.   $clAqua=color(0,255,255);
  58.   $clWhite=color(255,255,255);
  59.  
  60. function startLibraries(path) {
  61.    var a,b,c;
  62.    a=getResource(path);
  63.    if (!a) return;
  64.    for (b in a.getSubres()) {
  65.       c=newInstance(b.getName());
  66.       if (c is Library) c.onLoadPage();
  67.    }
  68. }
  69.  
  70. function onStart() {
  71.   var init,fs;
  72.   $_istat_wait      =0;
  73.   $_istat_progressed=1;
  74.   $_istat_completed =2;
  75.   $_istat_error     =3;
  76.   $systemLibraryPath="classes.lib";
  77.   startLibraries($systemLibraryPath);
  78. // Åëè·ë╗üB
  79.   $mouseSX=0;
  80.   $_tmp_cur_select=null;
  81. // ÉF
  82.   initColorConst(); 
  83.   fs=new Sprite();fs.setFont("élér éoâSâVâbâN",0,0,0);fs=0;
  84. // âyü[âW
  85.   $ProjectManager=new ProjectManager();
  86.   $Options=$ProjectManager;
  87.   initResource("project.pages");
  88. // âTâEâôâh
  89. //  print ("snd:"+$_soundAdded);
  90.   if (!($mplayer is MediaPlayer) || $_soundAdded==1) {
  91.     $_soundAdded=0;
  92.     $mplayer=new MediaPlayer();
  93.     $mplayer.freeAllSE();
  94.     $mplayer.init() ; 
  95.   }
  96. // âOâìü[âoâïò╧Éö
  97. //  initResource("usr.global");
  98. // âIâuâWâFâNâg
  99.   $map=null;
  100.   if (designMode()) $chars=new Array();
  101.   $_hashCode=1;
  102.   $frameManager=null;
  103.   generate(); 
  104. // âëâôâLâôâO
  105.   initResource("usr.$ranking");
  106. // é╗é╠æ╝Äⁿò╙ï@èφ
  107.   $window=new Window();
  108.   $Joystick=new Joystick(0);
  109.   $Joystick2=new Joystick(1);
  110.   $InputBox=new InputBox();
  111.   $SelectBox=new SelectBox();
  112.   $TextEditor=new TextEditor();
  113.   $mouseManager=new MouseManager();
  114.   $System=new System();
  115.   new Math();
  116. //  $_mouse_event= new MouseEvent();
  117. // â}âbâv
  118. //  initResource("usr.mappat");
  119.   if (!$map) {
  120.     $map=new Map();
  121.     $map.setBGColor(color(20,80,180));
  122.     $map.init(0,0,320,320);
  123.   }
  124.   $map.refreshChips(0,0);
  125. // âpâlâï
  126.   if (!$panel || $screenWidth>$panel.width || $screenHeight>$panel.height ) {
  127.     $panel=new Panel($screenWidth,$screenHeight);
  128.   } else {
  129.     $panel.clear();
  130.   }
  131. }
  132.  
  133. function onStop() {
  134.   var a,b,o;
  135.   a=getResource("usr.gen").getSubRes();
  136.   for ( b in a ) {
  137.     o=getGlobal(b.getName());
  138.     if (o is PlainChar && o.isDied()) setGlobal(b.getName(),null);
  139.   }
  140.   $procs=null;
  141.   $chars=null;
  142.   //print ("process stopeed");
  143.   if ($mplayer) $mplayer.stop(); 
  144. }
  145.  
  146. function onDesign() {
  147. }
  148.  
  149. function design () {
  150.   $_design_mode=1;
  151.   $_seamLessLoad=0;
  152.   onStart();
  153.   //print ("play stopeed");
  154.   if ($mplayer) {
  155.     $mplayer.stop();
  156.     $mplayer.setEnable(0);
  157.   }
  158.   onDesign();
  159.   print ("É▌îvÆåé┼é╖");
  160.   while(1) {
  161.     updateAll();
  162.     suspend();
  163.   }
  164. }
  165.  
  166. function onExecute() {
  167.   if ($frameManager) $frameManager.onStart();
  168. }
  169.  
  170. function execute() {
  171.   var i,c,p,hwn;
  172.   /*E*/
  173.   $_design_mode=0;
  174.   /*D*/
  175.   $curProcGroup=new ProcessGroup();
  176.   $curProcGroup.setCurrent();
  177.   onStart();
  178.   print ("Ä└ìsÆåé┼é╖");
  179.   onExecute();
  180.   $_seamLessLoad=0;
  181.   while(1) {
  182.     //i=0; 
  183.     getkey();
  184.     $curProcGroup.exec();
  185.     /*A*/
  186.     doMouseMove();
  187.     if ($window) {
  188.         $window.setSize($screenWidth,$screenHeight,$window.sizeable);
  189.         $window.setPos($windowX,$windowY);
  190.     }
  191.     if ($panel)
  192.         $panel.resize($screenWidth,$screenHeight);
  193.     if ($mouseManager)
  194.         $mouseManager.refreshXY();
  195.  
  196.     if ($_doDraw){
  197.        $curProcGroup.draw();
  198.     } 
  199.     /*B*/
  200.     suspend();
  201.     $frameCount=$curProcGroup.frameCount;
  202.     /*C*/
  203.   }
  204. }
  205.  
  206. function progress () {
  207.   while (1) {
  208.     //print("test");
  209.     suspend();
  210.   } 
  211. }
  212.  
  213. $_mouse_event= new MouseEvent();
  214. /*E if (!$execOK) {
  215.      print ("âRâôâpâCâïâGâëü[é¬éáéΘé╠é┼Ä└ìsé┼é½é▄é╣é±");
  216.       return;
  217.   }*/
  218. /*D $frameCount=2; 
  219.   $waitProcs=new WaitProc();
  220.   $procs=new ProcessList();*/
  221. /*A  if ($frameManager) $frameManager.onBeforeMove();
  222.     for (p in $procs) {
  223.       if ( p.aobj) {
  224.         if ( p.aobj.died ){
  225.           p.kill(); 
  226.           $procs.set(i,0);
  227.         } else if (p.nextWake) {
  228.           p.deletedFromProcs=1;
  229.           $procs.set(i,0);
  230.         } else if (p.halted() ){
  231.           if (p.autoKill) p.aobj.die();
  232.           p.kill();
  233.           $procs.set(i,0);
  234.         } else {
  235.           p.exec();
  236.         }
  237.       }
  238.       i+=1;
  239.     }
  240.     $procs.pack();
  241.     if ($frameManager) $frameManager.onAfterMove();
  242. */
  243. /*B  p=0;
  244.     i=0;c=$chars.size();
  245.     while(i<c) {
  246.       p=$chars.get(i);
  247.       if ( p.died ){
  248.         //p.x=null;p.y=null;
  249.         p.clearAllValues();
  250.         p.died=1;    // clearAllé┼diedé¬0é╔é╚é┴é┐éßéñé⌐éτ
  251.         $chars.delete(i);
  252.         c+=-1;
  253.       } else {
  254.         if ($_doDraw && p._visible) p.draw();
  255.         i+=1;
  256.       }
  257.     }
  258.     p=0;*/
  259. /*C $frameCount+=1; 
  260.     $waitProcs.autoWake($frameCount);*/
  261.     
  262.