home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / CM / CyclingManagerDemoCangas.exe / CyclingManagerDemo / scripts / common / intro / page_intro.cnc next >
Text File  |  2001-06-08  |  5KB  |  144 lines

  1. //----------------------------------------------------------------------------------------------------------------//
  2. //----------------------------------------------------------------------------------------------------------------//
  3. // Object_Intro Create Func
  4. //----------------------------------------------------------------------------------------------------------------//
  5. //----------------------------------------------------------------------------------------------------------------//
  6. func void Object_Intro_Create ()
  7. {
  8.     var frame fFrame1,fFrame2;
  9.     var i32x i,id,x,y;
  10.     oObject_Intro.pthis = GetParserComponent();
  11.  
  12.     SetComponentNumber(16);
  13.  
  14.     // Video
  15.     id = InitContainer(tVideo512_256);
  16.     SetContainerScale(id,800.0/256.0,400.0/256.0);
  17.     SetComponentPosition(id,0,100);
  18.  
  19.     // Black Border
  20.     id = InitContainer(t_Common_Color_White);
  21.     SetContainerSize(id,800,100);
  22.     SetContainerColor(id,c_Black);
  23.     id = InitContainer(t_Common_Color_White);
  24.     SetContainerSize(id,800,100);
  25.     SetContainerColor(id,c_Black);
  26.     SetComponentPosition(id,0,500);
  27. }
  28.  
  29. //----------------------------------------------------------------------------------------------------------------//
  30. //----------------------------------------------------------------------------------------------------------------//
  31. // Object_Intro Event func
  32. //----------------------------------------------------------------------------------------------------------------//
  33. //----------------------------------------------------------------------------------------------------------------//
  34. func i32x Object_Intro_Event (i32x _iComponentID,i32x _iEvent)
  35. {
  36.     if (_iComponentID == -1)
  37.     {
  38.         if(_iEvent == GUI_COMPONENT_REFRESH )
  39.         {
  40.             if(    (oObject_Intro.m_bIsRunning) && (oObject_Intro.m_bExit == false))
  41.             {
  42.                 // Check video finish
  43.                 if(IsVideoEnded())
  44.                 {
  45.                     oObject_Intro.m_bIsRunning = false;
  46.                     oObject_Intro.m_bExit = true;
  47.                     StopVideo();
  48.                     
  49.                     // debug : special demo
  50.                     //special looprun
  51.                     if((G_iDemoVersion)||(G_iLoopRunVersion))
  52.                     {
  53.                         LogueOffline(1,0);
  54.                     }
  55.                     else
  56.                     {
  57.                         if (g_oGameConfig.m_iInternet==0)
  58.                         {
  59.                             LoadPage(PAGE_SINGLE);
  60.                         }
  61.                         else
  62.                         {
  63.                             // ** internet **
  64.                             LoadPage(PAGE_MULTI);
  65.                         }
  66.                     }
  67.                 }
  68.             }
  69.             else
  70.             {
  71.                 if(oObject_Intro.m_bExit == false)
  72.                 {
  73.                     RunVideo();
  74.                     oObject_Intro.m_bIsRunning = true;
  75.                 }
  76.             }
  77.         }
  78.     }
  79.     return 1;
  80. }
  81.  
  82. //----------------------------------------------------------------------------------------------------------------//
  83. //----------------------------------------------------------------------------------------------------------------//
  84. // Object_Intro Constructor
  85. //----------------------------------------------------------------------------------------------------------------//
  86. //----------------------------------------------------------------------------------------------------------------//
  87. func i32x Object_Intro_Constructor ()
  88. {
  89.     #checkpoint intro constructor
  90.  
  91.     // init video
  92.     InitVideo(tVideo512_256,"./Gui/LogoCyanide_l.avi");
  93.  
  94.     oObject_Intro.m_bIsRunning = false;
  95.     oObject_Intro.m_bExit = false;
  96.  
  97.     // create page
  98.     oObject_Intro.m_iIntroID = InitObject("Object_Intro",oObject_Intro.oFunc.pcreate,oObject_Intro.oFunc.pevent);
  99.     SetStackEvents(oObject_Intro.m_iIntroID,GUI_Char|GUI_KeyDown|GUI_Refresh);
  100.     SetRefreshState(oObject_Intro.m_iIntroID,16,0);
  101.  
  102.     return oObject_Intro.m_iIntroID;
  103. }
  104.  
  105. //----------------------------------------------------------------------------------------------------------------//
  106. //----------------------------------------------------------------------------------------------------------------//
  107. //Destructor
  108. //----------------------------------------------------------------------------------------------------------------//
  109. //----------------------------------------------------------------------------------------------------------------//
  110. func void Object_Intro_Destructor ()
  111. {
  112.     #checkpoint page intro destructor
  113.     if(oObject_Intro.m_bIsRunning)
  114.     {
  115.         oObject_Intro.m_bIsRunning = false;
  116.         oObject_Intro.m_bExit = true;
  117.         StopVideo();
  118.     }
  119.     UninitVideo();
  120.     DeleteComponent(oObject_Intro.m_iIntroID);
  121.  
  122.     //ReleaseTexture(tVideo512_256);
  123.  
  124.     // Init mouse
  125.     InitMouse(tMouse);
  126.     ShowMouse();
  127. }
  128.  
  129. //----------------------------------------------------------------------------------------------------------------//
  130. //----------------------------------------------------------------------------------------------------------------//
  131. //Main Window Init member
  132. //----------------------------------------------------------------------------------------------------------------//
  133. //----------------------------------------------------------------------------------------------------------------//
  134.  
  135. func void Object_Intro_InitMembers ()
  136. {
  137.     oObject_Intro.szName            = "Object_Intro";
  138.     oObject_Intro.oFunc.pcreate        = Object_Intro_Create;
  139.     oObject_Intro.oFunc.pevent        = Object_Intro_Event;
  140. }
  141.  
  142.  
  143.  
  144.