home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / CM / CyclingManagerDemoCangas.exe / CyclingManagerDemo / scripts / inrace / ingame_panel.cnc < prev    next >
Text File  |  2001-05-31  |  49KB  |  1,486 lines

  1. var i32x g_i_RefreshLoop = 10; //Panel is refreshed every 10 GUI update (60 hz) so one panel refresh loop is 1/6 s
  2. var i32x g_i_TimeLoopConvCoef = 6;//invert of 1/6 s
  3. var i32x g_i_AttackWaitNumLoop = 100;//16s
  4. var i32x g_i_EatWaitNumLoop = 120;//20s
  5. var f32x g_f_MinGlycoToStartAttack = 15.0;
  6. var f32x g_f_MinGlycoToStopAttack = 1.0;
  7.  
  8. //inrace client interface management
  9. func void SetCyclistAttackButtonState(i32x _iCyclistLocalId,i32x _iButtonState)
  10. {
  11.     g_oMenuServer.m_oServer <<  mAttack (_iCyclistLocalId,_iButtonState);
  12. }
  13. func void SetCyclistSprintCheckBoxState(i32x _iCyclistLocalId,i32x _iButtonState)
  14. {
  15.     g_oMenuServer.m_oServer <<  mSprint (_iCyclistLocalId,_iButtonState);
  16. }
  17. func void SetCyclistTakeRelayCheckBoxState(i32x _iCyclistLocalId,i32x _iButtonState)
  18. {
  19.     g_oMenuServer.m_oServer <<  mRelay (_iCyclistLocalId,_iButtonState);
  20. }
  21. func void SetCyclistSpeedSliderValue(i32x _iCyclistLocalId,f32x _fSpeeValue)
  22. {
  23.     g_oMenuServer.m_oServer <<  mSpeed (_iCyclistLocalId,_fSpeeValue);
  24. }    
  25. func void AIBreak(i32x _iPreRaceCyclist)
  26. {
  27.     g_oMenuServer.m_oServer <<  mAIBreak (_iPreRaceCyclist);
  28. }
  29. func void AIWithdrawal(i32x _iPreRaceCyclist)
  30. {
  31.     g_oMenuServer.m_oServer <<  mAIWithdrawal(_iPreRaceCyclist);
  32. }
  33. func void AIAllWithdrawal()
  34. {
  35.     g_oMenuServer.m_oServer <<  mAIAllwithdrawal();
  36. }
  37. func void AIFall(i32x _iPreRaceCyclist)
  38. {
  39.     g_oMenuServer.m_oServer <<  mAIFall(_iPreRaceCyclist);
  40. }
  41. func void SetCyclistAutoCheckBoxState(i32x _iCyclistLocalId,i32x _iButtonState)
  42. {
  43.     g_oMenuServer.m_oServer <<  mAuto (_iCyclistLocalId,_iButtonState);
  44. }
  45. func void SetCyclistEatRation(i32x _iCyclistLocalId)
  46. {
  47.     g_oMenuServer.m_oServer <<  mRation (_iCyclistLocalId);
  48. }
  49.  
  50.  
  51. //----------------------------------------------------------------------------------------------------------------//
  52. //----------------------------------------------------------------------------------------------------------------//
  53. //SendInterface func function called from the menuserver 
  54. //----------------------------------------------------------------------------------------------------------------//
  55. //----------------------------------------------------------------------------------------------------------------//
  56. func void CSendInterface_Null(i32x _iValue,i32x _iValue2)
  57. {
  58. }
  59. func void CSendInterface(i32x _iValue,i32x _iValue2)
  60. {
  61.     var    i32x        iPreRaceTeamIndex,iCyclistInTeamIndex,iTempValue,bAuto;
  62.     var component    pOldComponent;
  63.     
  64.     /*
  65.     #define DEF_INTERFACE_PRERACETEAM_INDEX_MASK        0xFE000000
  66.     #define DEF_INTERFACE_PRERACETEAM_INDEX_OFFSET        25
  67.     #define DEF_INTERFACE_CYCLIST_INTEAMINDEX_MASK        0x01FE0000
  68.     #define DEF_INTERFACE_CYCLIST_INTEAMINDEX_OFFSET    17
  69.     */
  70.     
  71.     //print("Receive interface:");
  72.     //print("\n PreRaceTeamID:");
  73.     iPreRaceTeamIndex=_iValue/33554432;
  74.     //print(itoa(iPreRaceTeamIndex));
  75.  
  76.     //print("\n CyclistIndexInTeam:");
  77.     iCyclistInTeamIndex=(_iValue&33423360)/131072;
  78.     //print(itoa(iCyclistInTeamIndex));
  79.  
  80.     if (iPreRaceTeamIndex!=g_oUser.m_iMyInRaceTeamID)
  81.     {
  82.         print("\n Error : Bad iPreRaceTeamIndex in SendInterface \n");
  83.     }
  84.     if ((iCyclistInTeamIndex<0)||(iCyclistInTeamIndex>8))
  85.     {
  86.         print("\n Error : Bad iCyclistInTeamIndex in SendInterface \n");
  87.     }
  88.     
  89.     /*
  90.  
  91.     #define DEF_INTERFACE_ATTACK_MASK                    0x0001C000
  92.     #define DEF_INTERFACE_ATTACK_OFFSET                    14
  93.     #define DEF_INTERFACE_SPRINT_MASK                    0x00003000
  94.     #define DEF_INTERFACE_SPRINT_OFFSET                    12
  95.     #define DEF_INTERFACE_TAKERELAY_MASK                0x00000C00
  96.     #define DEF_INTERFACE_TAKERELAY_OFFSET                10
  97.     #define DEF_INTERFACE_SPEED_MASK            0x000003FF
  98.     #define DEF_INTERFACE_SPEED_OFFSET            0
  99.     */
  100.     
  101.     if(oControlPanel.oFunc.pevent)
  102.     {
  103.         pOldComponent = GetParserComponent();
  104.         
  105.         SetParserComponent(oTeamPanel.PanelComponent);
  106.         SetParserComponent(GetObject(oTeamPanel.iPanelID[iCyclistInTeamIndex]));
  107.         bAuto=Geti32x(oControlPanel.i_m_bAuto);
  108.         
  109.         if(bAuto)
  110.         {
  111.             if (_iValue&8192)
  112.             {
  113.                 SetComponentEnableStatus(oControlPanel.iSprintID,true);
  114.                 SetCheckboxState(oControlPanel.iSprintID,true);
  115.                 Seti32x(oControlPanel.i_m_iSprintState,1);
  116.             }
  117.             else if (_iValue&4096)
  118.             {
  119.                 SetComponentEnableStatus(oControlPanel.iSprintID,true);
  120.                 SetCheckboxState(oControlPanel.iSprintID,false);
  121.                 Seti32x(oControlPanel.i_m_iSprintState,0);
  122.             }
  123.             else
  124.             {
  125.                 SetComponentEnableStatus(oControlPanel.iSprintID,false);
  126.                 SetCheckboxState(oControlPanel.iSprintID,false);
  127.                 Seti32x(oControlPanel.i_m_iSprintState,0);
  128.             }
  129.             
  130.             //Relay
  131.             if (_iValue&2048)
  132.             {
  133.                 //SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[2]);
  134.             }
  135.             else if (_iValue&1024)
  136.             {
  137.                 //SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[1]);
  138.             }
  139.             else
  140.             {
  141.                 //SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[0]);
  142.             }
  143.             
  144.             //Speed
  145.             iTempValue=(_iValue&1023);
  146.             if(iTempValue>=128)
  147.             {
  148.                 print("\n Error: Unknown speed value.");
  149.                 print(itoa(iTempValue));
  150.                 print("\n");
  151.             }
  152.             else
  153.             {
  154.                 Seti32x(oControlPanel.i_m_iEffort,iTempValue);
  155.             }
  156.  
  157.             //Attack
  158.             if ((_iValue&114688)/16384)
  159.             {
  160.                 SetComponentEnableStatus(oControlPanel.iAttackID,true);
  161.                 SetCheckboxState(oControlPanel.iAttackID,true);
  162.             }
  163.             else
  164.             {
  165.                 if(GetCyclistGlycogen(Geti32x(oControlPanel.i_m_iPreRaceCyclistID))>=g_f_MinGlycoToStartAttack)
  166.                 {
  167.                     SetComponentEnableStatus(oControlPanel.iAttackID,true);
  168.                     SetCheckboxState(oControlPanel.iAttackID,false);
  169.                 }
  170.                 else
  171.                 {
  172.                     SetComponentEnableStatus(oControlPanel.iAttackID,false);
  173.                 }
  174.             }
  175.             /*
  176.             #define DEF_INTERFACE_NB_RATIONS_MASK        0x00000003
  177.             #define DEF_INTERFACE_NB_RATION_OFFSET    0
  178.             #define DEF_INTERFACE_EATING_RATION_TIME_MASK        0x000001FC
  179.             #define DEF_INTERFACE_EATING_RATION_TIME_OFFSET    2
  180.             #define DEF_INTERFACE_EATING_RATION_TIME_MASK        0x000001FC
  181.             #define DEF_INTERFACE_ATTACKING_TIME_OFFSET    9
  182.             #define DEF_INTERFACE_ATTACKING_TIME_MASK        0x0000FE00
  183.             #define DEF_INTERFACE_NOTUSED_MASK        0xFFFF0000
  184.             */
  185.             //num rations
  186.             iTempValue=(_iValue2&3);
  187.             if(iTempValue>3)
  188.                 iTempValue=3;
  189.             if(iTempValue<0)
  190.                 iTempValue=0;
  191.             Seti32x(oControlPanel.i_m_iNbBouf,iTempValue);
  192.             SetContainerMap(oControlPanel.iBoufID,a4_t_bouffe[iTempValue]);
  193.  
  194.             //eating time
  195.             iTempValue=((_iValue2&508)/4);
  196.             iTempValue=iTempValue*g_i_TimeLoopConvCoef;
  197.             if(iTempValue==0)
  198.             {
  199.                 Seti32x(oControlPanel.i_m_iEatWaitLoop,0);
  200.                 SetCheckboxState(oControlPanel.iBoufID, false);
  201.             }
  202.             else if(iTempValue>=(g_i_EatWaitNumLoop-1))
  203.             {
  204.                 Seti32x(oControlPanel.i_m_iEatWaitLoop,2);
  205.                 SetCheckboxState(oControlPanel.iBoufID, true);
  206.             }
  207.             else
  208.             {
  209.                 Seti32x(oControlPanel.i_m_iEatWaitLoop,(g_i_EatWaitNumLoop-iTempValue));
  210.                 SetCheckboxState(oControlPanel.iBoufID, true);
  211.             }
  212.  
  213.             //attacking time
  214.             iTempValue=((_iValue2&65024)/512);
  215.             iTempValue=iTempValue*g_i_TimeLoopConvCoef;
  216.             if(iTempValue==0)
  217.             {
  218.                 Seti32x(oControlPanel.i_m_iAttackWaitLoop,0);
  219.                 Seti32x(oControlPanel.i_m_bAttack,0);
  220.             }
  221.             else if(iTempValue>=(g_i_AttackWaitNumLoop-1))
  222.             {
  223.                 Seti32x(oControlPanel.i_m_iAttackWaitLoop,2);
  224.                 Seti32x(oControlPanel.i_m_bAttack,1);
  225.             }
  226.             else
  227.             {
  228.                 Seti32x(oControlPanel.i_m_iAttackWaitLoop,(g_i_AttackWaitNumLoop-iTempValue));
  229.                 Seti32x(oControlPanel.i_m_bAttack,1);
  230.             }
  231.         }
  232.         SetParserComponent(pOldComponent);
  233.     }
  234. }
  235.  
  236. func void SetManualMode()
  237. {
  238.     Seti32x(oControlPanel.i_m_bAuto,0);
  239.     if(GetCheckboxState(oControlPanel.iAutoID)==true)
  240.         SetCheckboxState(oControlPanel.iAutoID,false);
  241.     Seti32x(oControlPanel.i_m_bHasToSendData,1);    
  242. }
  243.             
  244. func void SetAutomaticMode()
  245. {
  246.     Seti32x(oControlPanel.i_m_bAuto,1);
  247.     if(GetCheckboxState(oControlPanel.iAutoID)==false)
  248.         SetCheckboxState(oControlPanel.iAutoID,true);
  249.     Seti32x(oControlPanel.i_m_bHasToSendData,1);
  250. }
  251.  
  252. // State func for ingame button
  253. //----------------------------------------------------------------------------------------------------------------//
  254. //----------------------------------------------------------------------------------------------------------------//
  255. func void ControlPanel_State (i32x _iComponentID,i32x _iState)
  256. {
  257.     if(_iState & GUI_State_Enabled)
  258.     {
  259.         if(_iState & GUI_State_Checked)
  260.         {
  261.             SetContainerSprite(_iComponentID, 2, 0);
  262.         }
  263.         else
  264.         {
  265.             SetContainerSprite(_iComponentID, 0, 0);
  266.         }
  267.     }
  268.     else
  269.     {
  270.         SetContainerSprite(_iComponentID, 1, 0);
  271.     }
  272. }
  273. func void ButtonAttack_State (i32x _iComponentID,i32x _iState)
  274. {
  275.     if(_iState & GUI_State_Enabled)
  276.     {
  277.         if(_iState & GUI_State_Checked)
  278.         {
  279.             SetContainerSprite(_iComponentID, 2, 0);
  280.         }
  281.         else
  282.         {
  283.             if(_iState & GUI_State_Activated)
  284.                 SetContainerSprite(_iComponentID, 1, 0);
  285.             else
  286.                 SetContainerSprite(_iComponentID, 0, 0);
  287.         }
  288.     }
  289.     else
  290.     {
  291.         SetContainerSprite(_iComponentID, 3, 0);
  292.     }
  293.     if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
  294.     {
  295.         if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
  296.         {
  297.             Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
  298.             oTeamPanel.m_poUnderMousePanel = GetParserComponent();
  299.         }
  300.     }
  301.     else
  302.     {
  303.         if(oTeamPanel.m_poUnderMousePanel == GetParserComponent())
  304.         {
  305.             if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
  306.                 Reset_Tool_Bar_Text();
  307.         }
  308.     }
  309. }
  310. func void ButtonIA_State (i32x _iComponentID,i32x _iState)
  311. {
  312.     if(_iState & GUI_State_Enabled)
  313.     {
  314.         if(_iState & GUI_State_Checked)
  315.         {
  316.             if(_iState & GUI_State_Activated)
  317.                 SetContainerSprite(_iComponentID, 1, 0);
  318.             else
  319.                 SetContainerSprite(_iComponentID, 0, 0);
  320.         }
  321.         else
  322.         {
  323.             if(_iState & GUI_State_Activated)
  324.                 SetContainerSprite(_iComponentID, 3, 0);
  325.             else
  326.                 SetContainerSprite(_iComponentID, 2, 0);
  327.         }
  328.     }
  329.     else
  330.     {
  331.         SetContainerSprite(_iComponentID, 2, 0);
  332.     }
  333.     if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
  334.     {
  335.         if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
  336.         {
  337.             Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
  338.             oTeamPanel.m_poUnderMousePanel = GetParserComponent();
  339.         }
  340.     }
  341.     else
  342.     {
  343.         if(oTeamPanel.m_poUnderMousePanel == GetParserComponent())
  344.         {
  345.             if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
  346.                 Reset_Tool_Bar_Text();
  347.         }
  348.     }
  349. }
  350. func void ButtonSprint_State (i32x _iComponentID,i32x _iState)
  351. {
  352.     if(_iState & GUI_State_Enabled)
  353.     {
  354.         if(_iState & GUI_State_Checked)
  355.         {
  356.             SetContainerSprite(_iComponentID, 1, 0);
  357.         }
  358.         else
  359.         {
  360.             SetContainerSprite(_iComponentID, 2, 0);
  361.         }
  362.     }
  363.     else
  364.     {
  365.         SetContainerSprite(_iComponentID, 0, 0);
  366.     }
  367.     if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
  368.     {
  369.         if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
  370.         {
  371.             Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
  372.             oTeamPanel.m_poUnderMousePanel = GetParserComponent();
  373.         }
  374.     }
  375.     else
  376.     {
  377.         if(oTeamPanel.m_poUnderMousePanel == GetParserComponent())
  378.         {
  379.             if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
  380.                 Reset_Tool_Bar_Text();
  381.         }
  382.     }
  383. }
  384.  
  385. func void ButtonBouf_State (i32x _iComponentID,i32x _iState)
  386. {
  387.     if(_iState & GUI_State_Enabled)
  388.     {
  389.         if(_iState & GUI_State_Checked)
  390.         {
  391.             SetContainerSprite(_iComponentID, 1, 0);
  392.         }
  393.         else
  394.         {
  395.             SetContainerSprite(_iComponentID, 0, 0);
  396.         }
  397.     }
  398.     else
  399.     {
  400.         SetContainerSprite(_iComponentID, 0, 0);
  401.     }
  402.     if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
  403.     {
  404.         if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
  405.         {
  406.             Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
  407.             oTeamPanel.m_poUnderMousePanel = GetParserComponent();
  408.         }
  409.     }
  410.     else
  411.     {
  412.         if(oTeamPanel.m_poUnderMousePanel == GetParserComponent())
  413.         {
  414.             if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
  415.                 Reset_Tool_Bar_Text();
  416.         }
  417.     }
  418. }
  419.  
  420. func void CyclistName_State (i32x _iComponentID,i32x _iState)
  421. {
  422.     if(_iState & GUI_State_Enabled)
  423.     {
  424.         if(_iState & GUI_State_Checked)
  425.         {
  426.             SetContainerColor(_iComponentID, c_ActivatedText);
  427.         }
  428.         else
  429.         {
  430.             if(_iState & GUI_State_UnderMouse)
  431.                 SetContainerColor(_iComponentID, c_UnderMouseText);
  432.             else
  433.                 SetContainerColor(_iComponentID, c_EnabledText);
  434.         }
  435.     }
  436.     else
  437.     {
  438.         SetContainerColor(_iComponentID, c_DisabledText);
  439.     }
  440.     if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
  441.     {
  442.         if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
  443.         {
  444.             Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
  445.             oTeamPanel.m_poUnderMousePanel = GetParserComponent();
  446.         }
  447.     }
  448.     else
  449.     {
  450.         if(oTeamPanel.m_poUnderMousePanel == GetParserComponent())
  451.         {
  452.             if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
  453.                 Reset_Tool_Bar_Text();
  454.         }
  455.     }
  456. }
  457.  
  458. //----------------------------------------------------------------------------------------------------------------//
  459. //----------------------------------------------------------------------------------------------------------------//
  460. //ControlPanel Create func
  461. //----------------------------------------------------------------------------------------------------------------//
  462. //----------------------------------------------------------------------------------------------------------------//
  463. func void CreateControlPanel ()
  464. {
  465.     var i32x i;
  466.  
  467.     SetObjectMembersNumber(19);
  468.  
  469.     // Members Index init
  470.     oControlPanel.i_m_iCyclistInTeamID=0;
  471.     Seti32x(oControlPanel.i_m_iCyclistInTeamID,oControlPanel.iCyclistInTeamID);
  472.  
  473.     oControlPanel.i_m_iEffort=1;
  474.     Seti32x(oControlPanel.i_m_iEffort,50);
  475.     
  476.     oControlPanel.i_m_iEffortSent=2;
  477.     Seti32x(oControlPanel.i_m_iEffortSent,50);
  478.     
  479.     oControlPanel.i_m_iAbandonState=3;
  480.     Seti32x(oControlPanel.i_m_iAbandonState,0);
  481.     
  482.     oControlPanel.i_m_iAbandonStateSent=4;
  483.     Seti32x(oControlPanel.i_m_iAbandonStateSent,0);
  484.     
  485.     oControlPanel.i_m_iAttackWaitLoop=5;
  486.     Seti32x(oControlPanel.i_m_iAttackWaitLoop,0);
  487.     
  488.     oControlPanel.i_m_iSprintState=6;
  489.     Seti32x(oControlPanel.i_m_iSprintState,0);
  490.     
  491.     oControlPanel.i_m_iSprintStateSent=7;
  492.     Seti32x(oControlPanel.i_m_iSprintStateSent,0);
  493.     
  494.     oControlPanel.i_m_iRelayState=8;
  495.     Seti32x(oControlPanel.i_m_iRelayState,0);
  496.     
  497.     oControlPanel.i_m_iRelayStateSent=9;
  498.     Seti32x(oControlPanel.i_m_iRelayStateSent,0);
  499.     
  500.     oControlPanel.i_m_bHasToSendData=10;
  501.     Seti32x(oControlPanel.i_m_bHasToSendData,0);
  502.     
  503.     oControlPanel.i_m_iSendDataWaitLoop=11;
  504.     Seti32x(oControlPanel.i_m_iSendDataWaitLoop,0);
  505.     
  506.     oControlPanel.i_m_bAuto=12;
  507.     Seti32x(oControlPanel.i_m_bAuto,1);
  508.     
  509.     oControlPanel.i_m_bAutoSent=13;
  510.     Seti32x(oControlPanel.i_m_bAutoSent,1);
  511.     
  512.     oControlPanel.i_m_iPreRaceCyclistID=14;
  513.     Seti32x(oControlPanel.i_m_iPreRaceCyclistID,oControlPanel.iPreRaceCyclistID);
  514.  
  515.     oControlPanel.i_m_iEatWaitLoop=15;
  516.     Seti32x(oControlPanel.i_m_iEatWaitLoop,0);
  517.  
  518.     oControlPanel.i_m_iNbBouf=16;
  519.     Seti32x(oControlPanel.i_m_iNbBouf,3);
  520.  
  521.     oControlPanel.i_m_bAttack=17;
  522.     Seti32x(oControlPanel.i_m_bAttack,0);
  523.     
  524.     oControlPanel.i_m_bAttackSent=18;
  525.     Seti32x(oControlPanel.i_m_bAttackSent,0);
  526.  
  527.     SetComponentNumber(24);
  528.  
  529.     // ****************************************
  530.     // Gauge behind background
  531.  
  532.     // *** Tire gauge ***
  533.     i = InitContainer(tCommonTableBorder);    // Tire gauge background
  534.     SetComponentPosition(i, 29, 24);
  535.     SetContainerSize(i, 47, 6);
  536.     SetContainerColor(i,c_BackGlyco);
  537.     SetEvents(i,GUI_NoEvent);
  538.  
  539.     oControlPanel.iTireBarID = InitContainer(tCommonTableBorder);    // Tire gauge forground (green)
  540.     SetComponentPosition(oControlPanel.iTireBarID, 29, 24);
  541.     SetContainerSize(oControlPanel.iTireBarID, 47, 6);
  542.     SetContainerColor(oControlPanel.iTireBarID,c_Energy);
  543.     SetEvents(oControlPanel.iTireBarID,GUI_NoEvent);
  544.  
  545.     // *** Glyco gauge ***
  546.     i = InitContainer(tCommonTableBorder);    // Boost gauge background
  547.     SetComponentPosition(i, 29, 33);
  548.     SetContainerSize(i, 47, 6);
  549.     SetContainerColor(i,c_BackGlyco);
  550.  
  551.     oControlPanel.iBoostBarID = InitContainer(tCommonTableBorder);
  552.     SetComponentPosition(oControlPanel.iBoostBarID, 29, 33);
  553.     SetContainerSize(oControlPanel.iBoostBarID, 47, 6);
  554.     SetContainerColor(oControlPanel.iBoostBarID,c_Glyco);    // Blue
  555.  
  556.     // ************************
  557.     // Control panel background
  558.     oControlPanel.iBackGroundID = InitRadioButton(tControlPanel);
  559.     SetContainerStateFunc(oControlPanel.iBackGroundID,ControlPanel_State);
  560.     // ************************
  561.     
  562.     // *** Cyclist name ***
  563.     oControlPanel.iNameID = InitRadioButton(tFontArial);
  564.     SetContainerStateFunc(oControlPanel.iNameID,CyclistName_State);
  565.     SetComponentSize(oControlPanel.iNameID,95,16);
  566.     SetComponentClipper(oControlPanel.iNameID,0,0,78,16);
  567.     SetContainerScaleX(oControlPanel.iNameID,0.9);
  568.     SetComponentPosition(oControlPanel.iNameID, 15, 3);
  569.     SetContainerText(oControlPanel.iNameID, oControlPanel.szName);
  570.     SetContainerOffset(oControlPanel.iNameID,-1.5);
  571.  
  572.     oControlPanel.iSprintID = InitRadioButton(tBtnSprint);
  573.     SetContainerStateFunc(oControlPanel.iSprintID, ButtonSprint_State);
  574.     SetContainerHelpIndex(oControlPanel.iSprintID,1478);
  575.     SetComponentPosition(oControlPanel.iSprintID, 3, 16);
  576.     
  577.     oControlPanel.iRelayID = InitButton(a3_t_relaytake[0]);
  578.     SetContainerStateFunc(oControlPanel.iRelayID, ButtonState);
  579.     SetContainerHelpIndex(oControlPanel.iRelayID,1479);
  580.     SetComponentPosition(oControlPanel.iRelayID, 54, 43);
  581.  
  582.     // *** Speed caption ***
  583.     oControlPanel.iSpeedValueID = InitContainer(tFontArial);
  584.     SetContainerOffset(oControlPanel.iSpeedValueID,-1);
  585.     SetContainerScale(oControlPanel.iSpeedValueID, 1.1, 1.3);
  586.     SetEvents(oControlPanel.iSpeedValueID,GUI_NoEvent);
  587.     SetComponentPosition(oControlPanel.iSpeedValueID, 96, 7);
  588.     SetContainerText(oControlPanel.iSpeedValueID,"0");
  589.     
  590.     // *** Heart rate caption ***
  591.     // Heart rate is hidden by default
  592.     oControlPanel.iHRValueID = InitContainer(tFontArial);
  593.     SetContainerOffset(oControlPanel.iHRValueID,-1.1);
  594.     SetContainerScale(oControlPanel.iHRValueID, 1.0, 1.3);
  595.     SetEvents(oControlPanel.iHRValueID,GUI_NoEvent);
  596.     SetComponentPosition(oControlPanel.iHRValueID, 96, 7);
  597.     SetContainerText(oControlPanel.iHRValueID,"0");
  598.     SetComponentVisibleStatus(oControlPanel.iHRValueID,false);
  599.  
  600.     oControlPanel.iBoufID=InitRadioButton(a4_t_bouffe[3]);
  601.     SetContainerStateFunc(oControlPanel.iBoufID,ButtonBouf_State);
  602.     SetContainerHelpIndex(oControlPanel.iBoufID,1482);
  603.     SetComponentPosition(oControlPanel.iBoufID,77, 43);
  604.  
  605.  
  606.  
  607.     oControlPanel.iGroupNameID = InitContainer(tFontArialItalique);
  608.     SetContainerOffset(oControlPanel.iGroupNameID,-2);
  609.     SetComponentPosition(oControlPanel.iGroupNameID, 2,3);
  610.     if (GetInRaceMode()==G_iRaceModeNormal )
  611.     {
  612.         SetContainerText(oControlPanel.iGroupNameID,GetGroupNameFromPreRaceCyclistIndex(Geti32x(oControlPanel.i_m_iPreRaceCyclistID)));
  613.     }
  614.     else if (GetInRaceMode()==G_iRaceModeTimeTrial)
  615.     {
  616.         SetContainerText(oControlPanel.iGroupNameID,itoa(Geti32x(oControlPanel.i_m_iCyclistInTeamID)+1));
  617.     }
  618.     else
  619.     {
  620.         SetContainerText(oControlPanel.iGroupNameID,g_szNull);    
  621.     }
  622.     SetContainerScale(oControlPanel.iGroupNameID,0.90,0.90);
  623.     SetEvents(oControlPanel.iGroupNameID,GUI_NoEvent);
  624.  
  625.  
  626.     oControlPanel.iAutoID = InitCheckBox(tBtnIA);
  627.     SetContainerStateFunc(oControlPanel.iAutoID, ButtonIA_State);
  628.     SetContainerHelpIndex(oControlPanel.iAutoID,1483);
  629.     SetComponentPosition(oControlPanel.iAutoID, 29, 43);
  630.     SetCheckboxState(oControlPanel.iAutoID,1);
  631.  
  632.     // *** Attack radio button ***
  633.     oControlPanel.iAttackID = InitRadioButton(tBtnAttack);
  634.     SetContainerStateFunc(oControlPanel.iAttackID,ButtonAttack_State);
  635.     SetContainerHelpIndex(oControlPanel.iAttackID,1475);
  636.     SetComponentPosition(oControlPanel.iAttackID,0,37);
  637.     
  638.         
  639.     // Heart rate checkbox
  640.     oControlPanel.iHeartRateCB = InitCheckBox(tBtnHeart);
  641.     SetContainerStateFunc(oControlPanel.iHeartRateCB,CheckboxState);
  642.     SetContainerHelpIndex(oControlPanel.iHeartRateCB,1476);
  643.     SetComponentPosition(oControlPanel.iHeartRateCB, 79, 25);
  644.  
  645.     // *********************
  646.     // *** Effort slider ***
  647.     // *********************
  648.     oControlPanel.iEffortID = InitCheckBox(tFontArial);
  649.     SetContainerHelpIndex(oControlPanel.iEffortID,1485);
  650.     SetContainerStateFunc(oControlPanel.iEffortID,CyclistName_State);
  651.     SetComponentPosition(oControlPanel.iEffortID, 96, 28);
  652.     SetContainerScale(oControlPanel.iEffortID, 0.8, 0.8);
  653.     SetContainerText(oControlPanel.iEffortID,"0");
  654.     SetComponentSize(oControlPanel.iEffortID,24,11);
  655.     // slider color
  656.     oControlPanel.iSliderColorID = InitContainer(tCommonTableBorder);
  657.     SetContainerSize(oControlPanel.iSliderColorID,86,4);
  658.     SetComponentPosition(oControlPanel.iSliderColorID,33,50);
  659.     SetEvents(oControlPanel.iSliderColorID,GUI_NoEvent);
  660.     // slider back
  661.     oControlPanel.iSliderBackID = InitContainer(tEffortSlider);
  662.     SetContainerSprite(oControlPanel.iSliderBackID,1,0);
  663.     SetComponentPosition(oControlPanel.iSliderBackID,29,44);
  664.     SetEvents(oControlPanel.iSliderBackID,GUI_NoEvent);
  665.     // slider
  666.     oControlPanel.iSliderID = InitSlide(tEffortSlider,0,100,92,1,0);
  667.     SetComponentPosition(oControlPanel.iSliderID,31,45);
  668.     SetContainerStateFunc(oControlPanel.iSliderID,NullButtonState);
  669.  
  670.     // SLider are hidden by default
  671.     SetComponentVisibleStatus(oControlPanel.iSliderID,false);
  672.     SetComponentVisibleStatus(oControlPanel.iSliderBackID,false);
  673.     SetComponentVisibleStatus(oControlPanel.iSliderColorID,false);
  674.  
  675.     AutoResize();
  676. }
  677.  
  678. func void SendMode()
  679. {
  680.     if(Geti32x(oControlPanel.i_m_bAuto)!=Geti32x(oControlPanel.i_m_bAutoSent))
  681.     {
  682.         SetCyclistAutoCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_bAuto));
  683.         Seti32x(oControlPanel.i_m_bAutoSent,Geti32x(oControlPanel.i_m_bAuto));
  684.         
  685.         if(Geti32x(oControlPanel.i_m_bAuto)==0)
  686.         {
  687.             SetCyclistSpeedSliderValue(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iEffort));
  688.             Seti32x(oControlPanel.i_m_iEffortSent,Geti32x(oControlPanel.i_m_iEffort));
  689.             
  690.             SetCyclistTakeRelayCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iRelayState));
  691.             Seti32x(oControlPanel.i_m_iRelayStateSent,Geti32x(oControlPanel.i_m_iRelayState));
  692.             
  693.             SetCyclistSprintCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iSprintState));
  694.             Seti32x(oControlPanel.i_m_iSprintStateSent,Geti32x(oControlPanel.i_m_iSprintState));
  695.             
  696.             SetCyclistAttackButtonState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_bAttack));
  697.             Seti32x(oControlPanel.i_m_bAttackSent,Geti32x(oControlPanel.i_m_bAttack));
  698.         }
  699.     }
  700. }
  701. func void vPanel_UpdateEffort(i32x _iValue)
  702. {
  703.     var f32x f;
  704.     var i32x iColor;
  705.     //Effort
  706.     SetContainerText(oControlPanel.iEffortID,itoa(_iValue));
  707.     ResizeComponent(oControlPanel.iEffortID);
  708.     SetComponentPositionX(oControlPanel.iEffortID,116-GetComponentWidth(oControlPanel.iEffortID));
  709.     SetSliderValue(oControlPanel.iSliderID,_iValue);
  710.     if(_iValue==0)
  711.     {
  712.         iColor = c_Black;
  713.     }
  714.     else if(_iValue<50)
  715.     {
  716.         f = _iValue;
  717.         f = f / 50.0;
  718.         iColor = ColorLERP(c_Green,c_Yellow,f); 
  719.     }
  720.     else
  721.     {
  722.         f = _iValue-50;
  723.         f = f / 50.0;
  724.         iColor = ColorLERP(c_Yellow,c_Red,f); 
  725.     }
  726.     SetContainerColor(oControlPanel.iSliderColorID,iColor);
  727. }
  728. //----------------------------------------------------------------------------------------------------------------//
  729. //----------------------------------------------------------------------------------------------------------------//
  730. //ControlPanel Event func
  731. //----------------------------------------------------------------------------------------------------------------//
  732. //----------------------------------------------------------------------------------------------------------------//
  733. func i32x ControlPanel (i32x _iComponentID,i32x _iEvent)
  734. {
  735.     if(_iComponentID == -1)
  736.     {
  737.         if(_iEvent == GUI_COMPONENT_DISABLED)
  738.         {
  739.             SetContainerText(oControlPanel.iSpeedValueID,"0");
  740.             SetContainerText(oControlPanel.iEffortID,"0");
  741.             SetContainerText(oControlPanel.iHRValueID,"0");
  742.         }
  743.         if(_iEvent == GUI_COMPONENT_ENABLED)
  744.         {
  745.             // Disable sprint on activate panel
  746.             SetComponentEnableStatus(oControlPanel.iSprintID,false);
  747.             SetComponentEnableStatus(oControlPanel.iBoufID,true);
  748.             SetComponentEnableStatus(oControlPanel.iAttackID,false);
  749.         }
  750.         if(_iEvent == GUI_PANELCLICK)
  751.         {
  752.             // Unselect panel
  753.             SetCheckboxState(oControlPanel.iBackGroundID,false);
  754.             SetCheckboxState(oControlPanel.iNameID,false);
  755.         }
  756.         else if(_iEvent == GUI_COMPONENT_REFRESH )
  757.         {
  758.             var i32x iPreRaceCyclistIndex,iSpeed,iEffort,bCanSprint,iRaceSpeed;
  759.             var f32x fTire,fBoost,fStrain,fGlycogen;
  760.  
  761.             //Refresh gauges of the control panel
  762.             iPreRaceCyclistIndex = Geti32x(oControlPanel.i_m_iPreRaceCyclistID);
  763.  
  764.             //Race speed set by the client
  765.             iRaceSpeed=GetCyclistRaceSpeed(iPreRaceCyclistIndex);
  766.  
  767.             iEffort = Geti32x(oControlPanel.i_m_iEffort);
  768.             //Effort
  769.             vPanel_UpdateEffort(iEffort);
  770.  
  771.             //Jauge fatigue
  772.             fTire = 100.0 - GetCyclistEnergy(iPreRaceCyclistIndex);
  773.             SetComponentClipper(oControlPanel.iTireBarID, 0,  0, 47.0 - (fTire * 47.0) / 100.0, 6.0);
  774.  
  775.             //Boost bar
  776.             fGlycogen = GetCyclistGlycogen(iPreRaceCyclistIndex);
  777.             fBoost = 160.0 - fGlycogen;
  778.             SetComponentClipper(oControlPanel.iBoostBarID, 0,  0, 47.0    - (fBoost * 47.0) / 160.0, 6.0);
  779.  
  780.             //Speed figures
  781.             SetContainerText(oControlPanel.iSpeedValueID,itoa(GetCyclistSpeedValue(iPreRaceCyclistIndex)));            
  782.             ResizeComponent(oControlPanel.iSpeedValueID);
  783.             SetComponentPositionX(oControlPanel.iSpeedValueID,116-GetComponentWidth(oControlPanel.iSpeedValueID));
  784.             
  785.             //Heart rate figures
  786.             SetContainerText(oControlPanel.iHRValueID,itoa(GetCyclistHRValue(iPreRaceCyclistIndex)));            
  787.             ResizeComponent(oControlPanel.iHRValueID);
  788.             SetComponentPositionX(oControlPanel.iHRValueID,116-GetComponentWidth(oControlPanel.iHRValueID));
  789.  
  790.             //test if the panel has not been desactivated
  791.             if(oRace.a9_bControlPanelActivated[Geti32x(oControlPanel.i_m_iCyclistInTeamID)]!=0)
  792.             {
  793.                 SetComponentEnableStatus(oControlPanel.iBackGroundID,true);
  794.                 SetComponentEnableStatus(oControlPanel.iNameID,true);
  795.                 if(iPreRaceCyclistIndex == GetActiveCyclistPreRaceID())
  796.                 {
  797.                     if(oTeamPanel.m_iSelectedCyclistInTeam != Geti32x(oControlPanel.i_m_iCyclistInTeamID))
  798.                     {
  799.                         oTeamPanel.m_iSelectedCyclistInTeam = Geti32x(oControlPanel.i_m_iCyclistInTeamID);
  800.                         PushEvent(GUI_PANELCLICK);
  801.                     }
  802.                     SetCheckboxState(oControlPanel.iNameID, true); 
  803.                     SetCheckboxState(oControlPanel.iBackGroundID, true);
  804.                 }
  805.                 else
  806.                 {
  807.                     if(oTeamPanel.m_iSelectedCyclistInTeam == Geti32x(oControlPanel.i_m_iCyclistInTeamID))
  808.                     {
  809.                         oTeamPanel.m_iSelectedCyclistInTeam = -1;
  810.                         PushEvent(GUI_PANELRESET);
  811.                     }
  812.                     SetCheckboxState(oControlPanel.iNameID, false); 
  813.                     SetCheckboxState(oControlPanel.iBackGroundID, false);
  814.                 }
  815.             }
  816.  
  817.             // Refresh group name
  818.             if (GetInRaceMode()==G_iRaceModeNormal)
  819.             {            
  820.                 SetContainerText(oControlPanel.iGroupNameID,GetGroupNameFromPreRaceCyclistIndex(Geti32x(oControlPanel.i_m_iPreRaceCyclistID)));
  821.             }
  822.             else if(GetInRaceMode()==G_iRaceModeTimeTrial)
  823.             {
  824.                 SetContainerText(oControlPanel.iGroupNameID,itoa(Geti32x(oControlPanel.i_m_iCyclistInTeamID)+1));
  825.             }
  826.             else
  827.             {
  828.                 SetContainerText(oControlPanel.iGroupNameID,g_szNull);
  829.             }
  830.             
  831.             if (Geti32x(oControlPanel.i_m_bAuto)==0)
  832.             {
  833.                 //test if the cyclist can sprint
  834.                 bCanSprint=GetCyclistCanSprint(iPreRaceCyclistIndex);
  835.                 if((bCanSprint)&&(GetInRaceMode()==G_iRaceModeNormal))
  836.                 {
  837.                     if((GetComponentEnableStatus(oControlPanel.iSprintID)==false)&&(fGlycogen>=g_f_MinGlycoToStartAttack)&&(Geti32x(oControlPanel.i_m_iEatWaitLoop)==0))
  838.                     {
  839.                         SetComponentEnableStatus(oControlPanel.iSprintID,true);
  840.                     }
  841.                     else if ((GetComponentEnableStatus(oControlPanel.iSprintID)==true)&&(fGlycogen<=g_f_MinGlycoToStopAttack))
  842.                     {
  843.                         SetComponentEnableStatus(oControlPanel.iSprintID,false);
  844.                     }
  845.                 }
  846.                 else
  847.                 {
  848.                     if(GetComponentEnableStatus(oControlPanel.iSprintID)==true)
  849.                     {
  850.                         SetComponentEnableStatus(oControlPanel.iSprintID,false);
  851.                         if((Geti32x(oControlPanel.i_m_iSprintState)!=0)||(Geti32x(oControlPanel.i_m_iSprintStateSent)!=0))
  852.                         {
  853.                             Seti32x(oControlPanel.i_m_iSprintState,0);
  854.                             Seti32x(oControlPanel.i_m_iSprintStateSent,0);
  855.                             Seti32x(oControlPanel.i_m_bHasToSendData,1);
  856.                         }
  857.                     }
  858.                 }
  859.  
  860.                 //test if the cyclist can attack
  861.                 if((GetComponentEnableStatus(oControlPanel.iAttackID)==false)
  862.                     &&(fGlycogen>=g_f_MinGlycoToStartAttack)
  863.                     &&(Geti32x(oControlPanel.i_m_iEatWaitLoop)==0)
  864.                     &&(GetCheckboxState(oControlPanel.iSprintID)==false))
  865.                 {
  866.                     SetComponentEnableStatus(oControlPanel.iAttackID,true);
  867.                 }
  868.                 else if ((GetComponentEnableStatus(oControlPanel.iAttackID)==true)&&(fGlycogen<=g_f_MinGlycoToStopAttack))
  869.                 {
  870.                     SetCheckboxState(oControlPanel.iAttackID, false);
  871.                     SetComponentEnableStatus(oControlPanel.iAttackID,false);
  872.                     Seti32x(oControlPanel.i_m_iAttackWaitLoop,0);
  873.                     Seti32x(oControlPanel.i_m_bAttack,0);
  874.                 }
  875.  
  876.                 //test if the cyclist can eat
  877.                 if((GetComponentEnableStatus(oControlPanel.iBoufID)==false)
  878.                     &&(Geti32x(oControlPanel.i_m_iAttackWaitLoop)==0)
  879.                     &&(GetCheckboxState(oControlPanel.iSprintID)==false))
  880.                 {
  881.                     SetComponentEnableStatus(oControlPanel.iBoufID,true);
  882.                 }
  883.                 
  884.                 //send attack data if manual mode is active
  885.                 if (Geti32x(oControlPanel.i_m_iAttackWaitLoop))
  886.                 {
  887.                     if (Geti32x(oControlPanel.i_m_iAttackWaitLoop)==1)
  888.                     {
  889.                         //Go to manual mode
  890.                         SendMode();
  891.                         
  892.                         //Send do not sprint if not done yet
  893.                         if (Geti32x(oControlPanel.i_m_iSprintState)!=Geti32x(oControlPanel.i_m_iSprintStateSent))
  894.                         {
  895.                             SetCyclistSprintCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iSprintState));
  896.                             Seti32x(oControlPanel.i_m_iSprintStateSent,Geti32x(oControlPanel.i_m_iSprintState));
  897.                         }
  898.                         
  899.                         //Then send the attack to the server
  900.                         if(Geti32x(oControlPanel.i_m_bAttack)!=Geti32x(oControlPanel.i_m_bAttackSent))
  901.                         {
  902.                             SetCyclistAttackButtonState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_bAttack));
  903.                             Seti32x(oControlPanel.i_m_bAttackSent,Geti32x(oControlPanel.i_m_bAttack));
  904.                         }
  905.                     }
  906.                     
  907.                     Seti32x(oControlPanel.i_m_iAttackWaitLoop,Geti32x(oControlPanel.i_m_iAttackWaitLoop)+iRaceSpeed);
  908.                     
  909.                     if (Geti32x(oControlPanel.i_m_iAttackWaitLoop)>=g_i_AttackWaitNumLoop)
  910.                     {
  911.                         SetCheckboxState(oControlPanel.iAttackID,false);
  912.                         Seti32x(oControlPanel.i_m_iAttackWaitLoop,0);
  913.                         Seti32x(oControlPanel.i_m_bAttack,0);
  914.                     }
  915.                 }//end of if (Geti32x(oControlPanel.i_m_iAttackWaitLoop))
  916.                 
  917.                 if (Geti32x(oControlPanel.i_m_iEatWaitLoop))
  918.                 {
  919.                     if (Geti32x(oControlPanel.i_m_iEatWaitLoop)==1)
  920.                     {
  921.                         //Go to manual mode
  922.                         SendMode();
  923.                         
  924.                         //Then send the eatration message to the server
  925.                         SetCyclistEatRation(Geti32x(oControlPanel.i_m_iCyclistInTeamID));
  926.                     }
  927.                     
  928.                     Seti32x(oControlPanel.i_m_iEatWaitLoop,(Geti32x(oControlPanel.i_m_iEatWaitLoop)+iRaceSpeed));
  929.                     
  930.                     if (Geti32x(oControlPanel.i_m_iEatWaitLoop)>=g_i_EatWaitNumLoop)
  931.                     {
  932.                         SetCheckboxState(oControlPanel.iBoufID,false);
  933.                         Seti32x(oControlPanel.i_m_iEatWaitLoop,0);
  934.                     }
  935.                 }
  936.             }//end of manual mode
  937.             
  938.             Seti32x(oControlPanel.i_m_iSendDataWaitLoop,Geti32x(oControlPanel.i_m_iSendDataWaitLoop)+iRaceSpeed);
  939.             
  940.             if (Geti32x(oControlPanel.i_m_iSendDataWaitLoop)>=10)
  941.             {
  942.                 if (Geti32x(oControlPanel.i_m_bHasToSendData))
  943.                 {    
  944.                     SendMode();
  945.  
  946.                     if (Geti32x(oControlPanel.i_m_bAuto)==0)
  947.                     {
  948.                         //send data if manual mode is active
  949.                         if (Geti32x(oControlPanel.i_m_iEffort)!=Geti32x(oControlPanel.i_m_iEffortSent))
  950.                         {
  951.                             SetCyclistSpeedSliderValue(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iEffort));
  952.                             Seti32x(oControlPanel.i_m_iEffortSent,Geti32x(oControlPanel.i_m_iEffort));
  953.                         }
  954.                         
  955.                         if (Geti32x(oControlPanel.i_m_iRelayState)!=Geti32x(oControlPanel.i_m_iRelayStateSent))
  956.                         {
  957.                             SetCyclistTakeRelayCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iRelayState));
  958.                             Seti32x(oControlPanel.i_m_iRelayStateSent,Geti32x(oControlPanel.i_m_iRelayState));
  959.                         }
  960.  
  961.                         if(Geti32x(oControlPanel.i_m_bAttack)!=Geti32x(oControlPanel.i_m_bAttackSent))
  962.                         {
  963.                             SetCyclistAttackButtonState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_bAttack));
  964.                             Seti32x(oControlPanel.i_m_bAttackSent,Geti32x(oControlPanel.i_m_bAttack));
  965.                         }
  966.                         
  967.                         if (Geti32x(oControlPanel.i_m_iSprintState)!=Geti32x(oControlPanel.i_m_iSprintStateSent))
  968.                         {
  969.                             SetCyclistSprintCheckBoxState(Geti32x(oControlPanel.i_m_iCyclistInTeamID),Geti32x(oControlPanel.i_m_iSprintState));
  970.                             Seti32x(oControlPanel.i_m_iSprintStateSent,Geti32x(oControlPanel.i_m_iSprintState));
  971.                         }
  972.                     }//end of if manual mode
  973.             
  974.                     Seti32x(oControlPanel.i_m_bHasToSendData,0);
  975.                 }
  976.                 
  977.                 Seti32x(oControlPanel.i_m_iSendDataWaitLoop,0);
  978.             }//end of if (Geti32x(oControlPanel.i_m_iSendDataWaitLoop)==10)
  979.         }//end of refresh event
  980.     }//end of component -1
  981.     else if( (_iComponentID == oControlPanel.iBackGroundID) || (_iComponentID == oControlPanel.iNameID) )
  982.     {
  983.         if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
  984.             PlaySound(0,sbClickSound[1]);
  985.         if(_iEvent == GUI_RADIOBUTTON_CHANGED)
  986.         {
  987.             oTeamPanel.m_iSelectedCyclistInTeam = Geti32x(oControlPanel.i_m_iCyclistInTeamID);
  988.             PushEvent(GUI_PANELCLICK);
  989.         }
  990.     }//end of if( (_iComponentID == oControlPanel.iBackGroundID) || (_iComponentID == oControlPanel.iNameID) )
  991.     else if(_iComponentID == oControlPanel.iHeartRateCB)
  992.     {
  993.         if(_iEvent == GUI_CHECKBOX_CHANGED )
  994.         {
  995.             var i32x iHR;
  996.             PlaySound(0,sbClickSound[1]);
  997.             iHR = GetCheckboxState(oControlPanel.iHeartRateCB);
  998.             if(iHR == 1)
  999.             {
  1000.                 SetContainerHelpIndex(oControlPanel.iHeartRateCB,1477);
  1001.                 // Display Heart rate and hide speed
  1002.                 SetComponentVisibleStatus(oControlPanel.iSpeedValueID,false);
  1003.                 SetComponentVisibleStatus(oControlPanel.iHRValueID,true);
  1004.             }
  1005.             else
  1006.             {
  1007.                 SetContainerHelpIndex(oControlPanel.iHeartRateCB,1476);
  1008.                 // Hide Heart rate and display speed
  1009.                 SetComponentVisibleStatus(oControlPanel.iSpeedValueID,true);
  1010.                 SetComponentVisibleStatus(oControlPanel.iHRValueID,false);
  1011.             }
  1012.         }
  1013.     }
  1014.     else if(_iComponentID == oControlPanel.iEffortID)
  1015.     {
  1016.         if(_iEvent == GUI_CHECKBOX_CHANGED )
  1017.         {
  1018.             var i32x iEffort;
  1019.             
  1020.             iEffort = GetCheckboxState(oControlPanel.iEffortID);
  1021.             if(iEffort == 1)
  1022.             {
  1023.                 // Display effort slider
  1024.                 SetComponentVisibleStatus(oControlPanel.iSliderID,true);
  1025.                 SetComponentVisibleStatus(oControlPanel.iSliderBackID,true);
  1026.                 SetComponentVisibleStatus(oControlPanel.iSliderColorID,true);
  1027.  
  1028.                 // Hide other button
  1029.                 SetComponentVisibleStatus(oControlPanel.iAutoID,false);
  1030.                 SetComponentVisibleStatus(oControlPanel.iRelayID,false);
  1031.                 SetComponentVisibleStatus(oControlPanel.iBoufID,false);
  1032.             }
  1033.             else
  1034.             {
  1035.                 // Hide effort slider
  1036.                 SetComponentVisibleStatus(oControlPanel.iSliderID,false);
  1037.                 SetComponentVisibleStatus(oControlPanel.iSliderBackID,false);
  1038.                 SetComponentVisibleStatus(oControlPanel.iSliderColorID,false);
  1039.  
  1040.                 // Show other button
  1041.                 SetComponentVisibleStatus(oControlPanel.iAutoID,true);
  1042.                 SetComponentVisibleStatus(oControlPanel.iRelayID,true);
  1043.                 SetComponentVisibleStatus(oControlPanel.iBoufID,true);
  1044.             }
  1045.         }
  1046.     }
  1047.     else if(_iComponentID == oControlPanel.iSliderID)
  1048.     {
  1049.         if(_iEvent == GUI_SLIDER_CHANGED )
  1050.         {
  1051.             var i32x iEffort;
  1052.  
  1053.             iEffort = GetSliderValue(oControlPanel.iSliderID);
  1054.             vPanel_UpdateEffort(iEffort);
  1055.             Seti32x(oControlPanel.i_m_iEffort,iEffort);
  1056.             Seti32x(oControlPanel.i_m_bHasToSendData,1);
  1057.             SetManualMode();
  1058.         }
  1059.         if(_iEvent == GUI_COMPONENT_MOUSE_UP )
  1060.         {
  1061.             // Hide effort slider
  1062.             SetComponentVisibleStatus(oControlPanel.iSliderID,false);
  1063.             SetComponentVisibleStatus(oControlPanel.iSliderBackID,false);
  1064.             SetComponentVisibleStatus(oControlPanel.iSliderColorID,false);
  1065.  
  1066.             // Show other button
  1067.             SetComponentVisibleStatus(oControlPanel.iAutoID,true);
  1068.             SetComponentVisibleStatus(oControlPanel.iRelayID,true);
  1069.             SetComponentVisibleStatus(oControlPanel.iBoufID,true);
  1070.  
  1071.             // Update check box
  1072.             SetCheckboxState(oControlPanel.iEffortID,false);
  1073.         }
  1074.     }
  1075.     else if(_iComponentID == oControlPanel.iRelayID)
  1076.     {
  1077.         if(_iEvent == GUI_BUTTON_PRESSED )
  1078.         {
  1079.             PlaySound(0,sbClickSound[2]);
  1080.             SetManualMode();
  1081.             Seti32x(oControlPanel.i_m_bHasToSendData,1);
  1082.  
  1083.             if(GetContainerMap(oControlPanel.iRelayID)==a3_t_relaytake[0])
  1084.             {
  1085.                 SetContainerHelpIndex(oControlPanel.iRelayID,1480);
  1086.                 SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[1]);
  1087.                 Seti32x(oControlPanel.i_m_iRelayState,1);
  1088.             }
  1089.             else if (GetContainerMap(oControlPanel.iRelayID)==a3_t_relaytake[1])
  1090.             {
  1091.                 SetContainerHelpIndex(oControlPanel.iRelayID,1481);
  1092.                 SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[2]);
  1093.                 Seti32x(oControlPanel.i_m_iRelayState,2);
  1094.             }
  1095.             else
  1096.             {
  1097.                 SetContainerHelpIndex(oControlPanel.iRelayID,1479);
  1098.                 SetContainerMap(oControlPanel.iRelayID,a3_t_relaytake[0]);
  1099.                 Seti32x(oControlPanel.i_m_iRelayState,0);
  1100.             }
  1101.         }
  1102.     }//end of if(_iComponentID == oControlPanel.iRelayID)
  1103.  
  1104.     else if(_iComponentID == oControlPanel.iSprintID)
  1105.     {
  1106.         if(_iEvent == GUI_RADIOBUTTON_CHANGED )
  1107.         {
  1108.                 PlaySound(0,sbClickSound[9]);
  1109.                 SetManualMode();
  1110.  
  1111.                 Seti32x(oControlPanel.i_m_iSprintState,1);
  1112.                 Seti32x(oControlPanel.i_m_iSprintStateSent,0);
  1113.                 Seti32x(oControlPanel.i_m_bHasToSendData,1);
  1114.                 
  1115.                 //stop attack and eat
  1116.                 Seti32x(oControlPanel.i_m_bAttack,0);
  1117.                 Seti32x(oControlPanel.i_m_bAttackSent,1);
  1118.                 Seti32x(oControlPanel.i_m_iAttackWaitLoop,0);
  1119.                 SetComponentEnableStatus(oControlPanel.iAttackID,false);
  1120.                 SetComponentEnableStatus(oControlPanel.iBoufID,false);
  1121.         }
  1122.     }//end of if(_iComponentID == oControlPanel.iSprintID)
  1123.  
  1124.     else if(_iComponentID == oControlPanel.iAutoID)
  1125.     {
  1126.         if(_iEvent == GUI_CHECKBOX_CHANGED )
  1127.         {
  1128.         
  1129.             //The cyclist change sprint
  1130.             if(GetCheckboxState(_iComponentID))
  1131.             {
  1132.                 PlaySound(0,sbClickSound[6]);
  1133.                 SetContainerHelpIndex(oControlPanel.iAutoID,1483);
  1134.                 SetAutomaticMode();
  1135.                 
  1136.             }
  1137.             else
  1138.             {
  1139.                 PlaySound(0,sbClickSound[7]);
  1140.                 SetContainerHelpIndex(oControlPanel.iAutoID,1484);
  1141.                 SetManualMode();
  1142.             }
  1143.         }
  1144.     }//end of if(_iComponentID == oControlPanel.iAutoID)
  1145.     else if(_iComponentID == oControlPanel.iAttackID)
  1146.     {
  1147.         if(_iEvent == GUI_RADIOBUTTON_CHANGED )
  1148.         {
  1149.             SetManualMode();
  1150.             
  1151.             PlaySound(0,sbClickSound[8]);
  1152.             
  1153.             SetContainerSprite(oControlPanel.iAttackID, 2, 0);
  1154.             Seti32x(oControlPanel.i_m_iAttackWaitLoop,1);
  1155.             Seti32x(oControlPanel.i_m_bHasToSendData,1);
  1156.             Seti32x(oControlPanel.i_m_bAttack,1);
  1157.             Seti32x(oControlPanel.i_m_bAttackSent,0);
  1158.             //stop sprint and eat
  1159.             Seti32x(oControlPanel.i_m_iSprintState,0);
  1160.             Seti32x(oControlPanel.i_m_iSprintStateSent,1);
  1161.             SetComponentEnableStatus(oControlPanel.iSprintID,false);
  1162.             SetComponentEnableStatus(oControlPanel.iBoufID,false);
  1163.         }
  1164.     }//end of if(_iComponentID == oControlPanel.iAttackID)
  1165.     else if(_iComponentID == oControlPanel.iBoufID)
  1166.     {
  1167.         if(_iEvent == GUI_RADIOBUTTON_CHANGED )
  1168.         {
  1169.             var i32x iNumBouf;
  1170.  
  1171.             iNumBouf = Geti32x(oControlPanel.i_m_iNbBouf);
  1172.             SetManualMode();
  1173.             //Test if an attack has already been launched
  1174.             if((Geti32x(oControlPanel.i_m_iEatWaitLoop)==0) && (iNumBouf>0))
  1175.             {
  1176.                 iNumBouf = iNumBouf - 1;
  1177.                 SetContainerMap(oControlPanel.iBoufID,a4_t_bouffe[iNumBouf]);
  1178.                 Seti32x(oControlPanel.i_m_iEatWaitLoop,1);
  1179.                 Seti32x(oControlPanel.i_m_iNbBouf,iNumBouf);
  1180.                 Seti32x(oControlPanel.i_m_bHasToSendData,1);
  1181.  
  1182.                 SetComponentEnableStatus(oControlPanel.iAttackID,false);
  1183.                 SetComponentEnableStatus(oControlPanel.iSprintID,false);
  1184.             }
  1185.         }
  1186.     }//end of if((_iComponentID == oControlPanel.iBoufID))
  1187.     return 1;
  1188. }
  1189.  
  1190. //----------------------------------------------------------------------------------------------------------------//
  1191. //----------------------------------------------------------------------------------------------------------------//
  1192. //ControlPanel Init func
  1193. //----------------------------------------------------------------------------------------------------------------//
  1194. //----------------------------------------------------------------------------------------------------------------//
  1195. func void InitControlPanel (i32x iTeamID, i32x iCyclistInTeamID)
  1196. {
  1197.     var i32x iID;
  1198.     var szx szCyclist;
  1199.  
  1200.     iID = GetPreRaceCyclistIndexFromTeamAndIndexInTeam(iTeamID, iCyclistInTeamID);
  1201.  
  1202.     if(iID != -1)
  1203.     {
  1204.         szCyclist = Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,iID);
  1205.         szCyclist = strncpy(szCyclist,1);
  1206.         szCyclist = strcat(strcat(szCyclist,"."),Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,iID));
  1207.         oControlPanel.szName = szCyclist;
  1208.         oControlPanel.iCyclistInTeamID = iCyclistInTeamID;
  1209.         oControlPanel.iPreRaceCyclistID = iID;
  1210.     }
  1211.     else
  1212.     {
  1213. // MistER-j WARNING LOCALIZED
  1214.         oControlPanel.szName = "Not found";
  1215.         oControlPanel.iCyclistInTeamID = iCyclistInTeamID;
  1216.         oControlPanel.iPreRaceCyclistID = iID;
  1217.     }
  1218.     
  1219.     oControlPanel.oFunc.pcreate = CreateControlPanel;
  1220.     oControlPanel.oFunc.pevent = ControlPanel;
  1221. }
  1222.  
  1223. func void DesactivateControlPanel(i32x _iPanelIndex)
  1224. {
  1225.     //print("Desactivate control panel:");
  1226.     //print(itoa(_iPanelIndex));
  1227.     //print("\n");
  1228.  
  1229.     // Disable Panel
  1230.     oRace.a9_bControlPanelActivated[_iPanelIndex]=0;
  1231.  
  1232.     // Save current context
  1233.     var component pold;
  1234.     pold=GetParserComponent();
  1235.  
  1236.     // Set Team panel context
  1237.     SetParserComponent(oTeamPanel.PanelComponent);
  1238.  
  1239.     SetComponentEnableStatus(oTeamPanel.iPanelID[_iPanelIndex],false);
  1240.     SetEvents(oTeamPanel.iPanelID[_iPanelIndex],GUI_Enable|GUI_Disable);
  1241.  
  1242.     // Restore old context
  1243.     SetParserComponent(pold);
  1244. }
  1245.  
  1246. func void ActivateControlPanel(i32x _iPanelIndex)
  1247. {
  1248.     //print("Activate control panel:");
  1249.     //println(itoa(_iPanelIndex));
  1250.  
  1251.     // Enable Panel
  1252.     oRace.a9_bControlPanelActivated[_iPanelIndex]=1;
  1253.     
  1254.     // Save current context
  1255.     var component pold;
  1256.     pold=GetParserComponent();
  1257.  
  1258.     // Set Team panel context
  1259.     SetParserComponent(oTeamPanel.PanelComponent);
  1260.  
  1261.     SetComponentEnableStatus(oTeamPanel.iPanelID[_iPanelIndex],true);
  1262.     SetEvents(oTeamPanel.iPanelID[_iPanelIndex],GUI_Enable|GUI_Disable|GUI_Key|GUI_Mouse|GUI_Refresh);
  1263.  
  1264.     // Restore old context
  1265.     SetParserComponent(pold);
  1266. }
  1267.  
  1268. //----------------------------------------------------------------------------------------------------------------//
  1269. //----------------------------------------------------------------------------------------------------------------//
  1270. //TeamPanel Create func
  1271. //----------------------------------------------------------------------------------------------------------------//
  1272. //----------------------------------------------------------------------------------------------------------------//
  1273. func void CreateTeamPanel ()
  1274. {
  1275.     var i32x i,iMax,iPosY,id;
  1276.  
  1277.     // 9 cyclist per team + background
  1278.     SetComponentNumber(10);
  1279.  
  1280.     // Get team panel context
  1281.     oTeamPanel.PanelComponent = GetParserComponent();
  1282.  
  1283.     // Create 9 control panel
  1284.     i=0;
  1285.     iMax=9;
  1286.     iPosY = 0;
  1287.     while(i<iMax)
  1288.     {
  1289.         var szx szObjName;
  1290.         var i32x iCyclistID;
  1291.         
  1292.         szObjName = "ControlPanel_";
  1293.         szObjName = strcat(szObjName,itoa(i));
  1294.  
  1295.         InitControlPanel(g_oUser.m_iMyInRaceTeamID,i);
  1296.         oTeamPanel.iPanelID[i] = InitObject(szObjName, oControlPanel.oFunc.pcreate, oControlPanel.oFunc.pevent);
  1297.         SetStackEvents(oTeamPanel.iPanelID[i],GUI_Refresh|GUI_MouseUp|GUI_Enable|GUI_Disable);
  1298.         
  1299.         if(Join_GetIntFromSortedIndex(g_stInraceJoins.m_bCyclist_Withdrawal,oControlPanel.iPreRaceCyclistID))
  1300.         {
  1301.             //print("Creation of control panel without desactivated and without refresh:");
  1302.             //println(itoa(i));
  1303.  
  1304.             SetEvents(oTeamPanel.iPanelID[i],GUI_Enable|GUI_Disable);
  1305.             SetComponentEnableStatus(oTeamPanel.iPanelID[i],false);
  1306.         }
  1307.         else
  1308.         {
  1309.             //print("Creation of control panel desactivated:");
  1310.             //println(itoa(i));
  1311.  
  1312.             SetEvents(oTeamPanel.iPanelID[i],GUI_Enable|GUI_Disable|GUI_Refresh);
  1313.             SetComponentEnableStatus(oTeamPanel.iPanelID[i],false);
  1314.         }
  1315.  
  1316.         SetRefreshState(oTeamPanel.iPanelID[i],iMax+1,i);
  1317.  
  1318.         iPosY = oTeamPanel.iPanelPos[i]*64;
  1319.         SetComponentPosition(oTeamPanel.iPanelID[i], 4, iPosY);
  1320.  
  1321.         //iPosY = iPosY + 64;
  1322.         i=i+1;
  1323.     }
  1324.  
  1325.     // Team panel size
  1326.     SetObjectSize(128,600);
  1327. }
  1328.  
  1329.  
  1330.  
  1331. //----------------------------------------------------------------------------------------------------------------//
  1332. //----------------------------------------------------------------------------------------------------------------//
  1333. //TeamPanel Event func
  1334. //----------------------------------------------------------------------------------------------------------------//
  1335. //----------------------------------------------------------------------------------------------------------------//
  1336. func i32x TeamPanel (i32x _iComponentID,i32x _iEvent)
  1337. {
  1338.     var i32x i;
  1339.     if(_iEvent == GUI_PANELCLICK )
  1340.     {
  1341.         PushEvent(GUI_RESET_SPRINTS);
  1342.         i=0;
  1343.         while(i<9)
  1344.         {
  1345.             if(_iComponentID == oTeamPanel.iPanelID[i])
  1346.             {
  1347.                 SetActiveCyclist(GetPreRaceCyclistIndexFromTeamAndIndexInTeam(g_oUser.m_iMyInRaceTeamID,i));
  1348.                 oPanelRank.m_bSeeClass=true;
  1349.                 oPanelRank.m_bFindCyclist = true;
  1350.                 SetComponentPositionX(oTeamPanel.iPanelID[i],0);
  1351.             }
  1352.             else
  1353.             {
  1354.                 SetComponentPositionX(oTeamPanel.iPanelID[i],4);
  1355.                 PushEventOnChild(oTeamPanel.iPanelID[i],GUI_PANELCLICK);
  1356.             }
  1357.             i=i+1;
  1358.         }
  1359.         vSetProfileCameraMode(0);
  1360.         RefreshInfos();
  1361.     }
  1362.     else if(_iEvent == GUI_PANELRESET)
  1363.     {
  1364.         i=0;
  1365.         while(i<9)
  1366.         {
  1367.             if(_iComponentID == oTeamPanel.iPanelID[i])
  1368.             {
  1369.                 SetComponentPositionX(oTeamPanel.iPanelID[i],4);
  1370.             }
  1371.             i=i+1;
  1372.         }
  1373.     }
  1374.     else if(_iEvent == GUI_PANEL_UP)
  1375.     {
  1376.         if((oTeamPanel.m_iSelectedCyclistInTeam>=0)&&(oTeamPanel.m_iSelectedCyclistInTeam<9))
  1377.         {
  1378.             var i32x iSwapCyclist,iIndex,iNewPosY,iOldPosY;
  1379.  
  1380.             // Move up Control panel selected
  1381.             iIndex = oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam];
  1382.  
  1383.             if(iIndex>0)
  1384.             {
  1385.                 iSwapCyclist = -1;
  1386.                 i=0;
  1387.                 while(i<9)
  1388.                 {
  1389.                     if(oTeamPanel.iPanelPos[i]==iIndex-1)
  1390.                     {
  1391.                         iSwapCyclist = i;
  1392.                         i=8;
  1393.                     }
  1394.                     i=i+1;
  1395.                 }
  1396.  
  1397.                 if(iSwapCyclist>=0)
  1398.                 {
  1399.                     var i32x iTmp;
  1400.  
  1401.                     iTmp = oTeamPanel.iPanelPos[iSwapCyclist];
  1402.                     oTeamPanel.iPanelPos[iSwapCyclist] = oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam];
  1403.                     oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam] = iTmp;
  1404.  
  1405.                     // Calc new position
  1406.                     iOldPosY = oTeamPanel.iPanelPos[iSwapCyclist]*64;
  1407.                     iNewPosY = oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam]*64;
  1408.  
  1409.                     // Move panel
  1410.                     SetComponentPositionY(oTeamPanel.iPanelID[oTeamPanel.m_iSelectedCyclistInTeam],iNewPosY);
  1411.                     SetComponentPositionY(oTeamPanel.iPanelID[iSwapCyclist],iOldPosY);
  1412.                 }
  1413.             }
  1414.         }
  1415.     }
  1416.     else if(_iEvent == GUI_PANEL_DOWN)
  1417.     {
  1418.         if((oTeamPanel.m_iSelectedCyclistInTeam>=0)&&(oTeamPanel.m_iSelectedCyclistInTeam<9))
  1419.         {
  1420.             var i32x iSwapCyclist,iIndex,iNewPosY,iOldPosY;
  1421.  
  1422.             // Move up Control panel selected
  1423.             iIndex = oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam];
  1424.  
  1425.             if(iIndex<8)
  1426.             {
  1427.                 iSwapCyclist = -1;
  1428.                 i=0;
  1429.                 while(i<9)
  1430.                 {
  1431.                     if(oTeamPanel.iPanelPos[i]==iIndex+1)
  1432.                     {
  1433.                         iSwapCyclist = i;
  1434.                         i=8;
  1435.                     }
  1436.                     i=i+1;
  1437.                 }
  1438.  
  1439.                 if(iSwapCyclist>=0)
  1440.                 {
  1441.                     var i32x iTmp;
  1442.  
  1443.                     iTmp = oTeamPanel.iPanelPos[iSwapCyclist];
  1444.                     oTeamPanel.iPanelPos[iSwapCyclist] = iIndex;
  1445.                     oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam] = iTmp;
  1446.  
  1447.                     // Calc new position
  1448.                     iOldPosY = oTeamPanel.iPanelPos[iSwapCyclist]*64;
  1449.                     iNewPosY = oTeamPanel.iPanelPos[oTeamPanel.m_iSelectedCyclistInTeam]*64;
  1450.  
  1451.                     // Move panel
  1452.                     SetComponentPositionY(oTeamPanel.iPanelID[oTeamPanel.m_iSelectedCyclistInTeam],iNewPosY);
  1453.                     SetComponentPositionY(oTeamPanel.iPanelID[iSwapCyclist],iOldPosY);
  1454.                 }
  1455.             }
  1456.         }
  1457.     }
  1458.     return 1;
  1459. }
  1460.  
  1461. //----------------------------------------------------------------------------------------------------------------//
  1462. //----------------------------------------------------------------------------------------------------------------//
  1463. //TeamPanel Init func
  1464. //----------------------------------------------------------------------------------------------------------------//
  1465. //----------------------------------------------------------------------------------------------------------------//
  1466. func void InitTeamPanel ()
  1467. {
  1468.     var i32x i;
  1469.     g_fSpeedStep = 1.0;
  1470.  
  1471.     oTeamPanel.szName = "TeamPanel";
  1472.  
  1473.     oTeamPanel.m_iSelectedCyclistInTeam = -1;
  1474.  
  1475.     while(i<9)
  1476.     {
  1477.         oTeamPanel.iPanelPos[i] = i;
  1478.         i=i+1;
  1479.     }
  1480.  
  1481.     oTeamPanel.oFunc.pcreate = CreateTeamPanel;
  1482.     oTeamPanel.oFunc.pevent = TeamPanel;
  1483. }
  1484.  
  1485.  
  1486.