home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 51
/
PCGamer51_17Demos.iso
/
games
/
CM
/
CyclingManagerDemoCangas.exe
/
CyclingManagerDemo
/
scripts
/
inrace
/
page_inrace.cnc
< prev
next >
Wrap
Text File
|
2001-07-02
|
85KB
|
2,852 lines
func void RefreshInfos ()
{
//Update the informations about the cyclist and the groups
// Update Angle picto
Panel_Inrace_Tab_Update();
if (GetInRaceMode()==G_iRaceModeTimeTrial)
Object_InRaceEvents_Time_Trial_Update();
else if (GetInRaceMode()==G_iRaceModeTeamTimeTrial)
Object_InRaceEvents_Team_Time_Trial_Update();
}
func szx szGetKmDistance(f32x _fDistance)
{
var i32x iDistance;
var szx szTemp;
iDistance = _fDistance;
szTemp = strcat(itoa(iDistance),".");
_fDistance = _fDistance - iDistance;
_fDistance = _fDistance * 10.0;
iDistance = _fDistance;
szTemp = strcat(szTemp,itoa(iDistance));
szTemp = strcat(szTemp,"Km");
return szTemp;
}
func szx GetHourMinSecFromTime(f32x _fTime)
{
var szx szRes;
var i32x iHour,iMin,iSec;
var i32x ok;
// Game time to real time compute
iHour=_fTime/360.0;
_fTime=_fTime-(iHour*360);
iMin=_fTime/6.0;
_fTime=_fTime-(iMin*6);
iSec=_fTime*10.0;
ok = 0;
if(iHour>0)
{
szRes=itoa(iHour);
szRes=strcat(szRes, "h");
ok = 1;
}
if((iMin>0)||(ok==1))
{
if(ok==0)
{
szRes=itoa(iMin);
}
else
{
if(iMin<10)
{
szRes = strcat(szRes,"0");
}
szRes=strcat(szRes,itoa(iMin));
}
szRes=strcat(szRes, "'");
ok=1;
}
if(ok == 0)
{
szRes=itoa(iSec);
}
else
{
if(iSec<10)
{
szRes=strcat(szRes,"0");
}
szRes=strcat(szRes,itoa(iSec));
}
szRes=strcat(szRes, "''");
return szRes;
}
func szx GetFullHMSFromTime(f32x _fTime)
{
var szx szRes;
var f32x f;
var i32x iHour,iMin,iSec,iCent;
var i32x ok;
// Game time to real time compute
iHour=_fTime/360.0;
_fTime=_fTime-(iHour*360);
iMin=_fTime/6.0;
_fTime=_fTime-(iMin*6);
iSec=_fTime*10.0;
_fTime=_fTime-(0.1*iSec);
iCent = _fTime*1000.0;
ok = 0;
if(iHour>0)
{
szRes=itoa(iHour);
szRes=strcat(szRes, "h");
ok = 1;
}
if((iMin>0)||(ok==1))
{
if(ok==0)
{
szRes=itoa(iMin);
}
else
{
if(iMin<10)
{
szRes = strcat(szRes,"0");
}
szRes=strcat(szRes,itoa(iMin));
}
szRes=strcat(szRes, "'");
ok=1;
}
if(ok == 0)
{
szRes=itoa(iSec);
}
else
{
if(iSec<10)
{
szRes=strcat(szRes,"0");
}
szRes=strcat(szRes,itoa(iSec));
ok=1;
}
szRes=strcat(szRes, "''");
if(iCent<10)
szRes = strcat(szRes,"0");
szRes = strcat(szRes,itoa(iCent));
return szRes;
}
//Race modes :Normal, time trial or team time trial modes
//This mode changes when menuserver send a phase update
func i32x GetRaceMode()
{
/*print("\nGetting race mode debug : g_oMenuJoins.m_iStageTimeTrial=");
print(itoa(g_oMenuJoins.m_iStageTimeTrial));
print("g_oGameConfig.g_iCurrentStageID=");
print(itoa(g_oGameConfig.g_iCurrentStageID));
print("\nRace mode=");
print(itoa(Join_GetIntFromKey(g_oMenuJoins.m_iStageTimeTrial,g_oGameConfig.g_iCurrentStageID)));*/
return Join_GetIntFromKey(g_oMenuJoins.m_iStageTimeTrial,g_oGameConfig.m_iCurrentStageID);
}
//Race modes :Normal, time trial or team time trial modes
//This mode is set when creating race window and never changed (not available after race window destructor)
func i32x GetInRaceMode()
{
return oRace.iInRaceMode;
}
// State func for profil strafe button
func void StrafeProfil_ButtonState (i32x _iComponentID,i32x _iState)
{
if(_iState & GUI_State_Activated)
SetContainerSprite(_iComponentID, 2, 0);
else
{
if(_iState & GUI_State_UnderMouse)
{
SetContainerSprite(_iComponentID, 1, 0);
}
else
{
SetContainerSprite(_iComponentID, 0, 0);
}
}
if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
{
if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
}
else
{
if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
Reset_Tool_Bar_Text();
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// State func for a button
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void ButtonSpeedState_1 (i32x _iComponentID,i32x _iState)
{
if(_iState & GUI_State_Checked)
{
SetContainerSprite(_iComponentID, 1, 0);
}
else
{
SetContainerSprite(_iComponentID, 0, 0);
}
if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
{
if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
else
oToolBar.m_iCounter = oToolBar.m_iCounter + 1;
}
else
{
// if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
Reset_Tool_Bar_Text();
}
}
func void ButtonSpeedState_2 (i32x _iComponentID,i32x _iState)
{
if(_iState & GUI_State_Checked)
{
SetContainerSprite(_iComponentID, 3, 0);
}
else
{
SetContainerSprite(_iComponentID, 2, 0);
}
if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
{
if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
else
oToolBar.m_iCounter = oToolBar.m_iCounter + 1;
}
else
{
// if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
Reset_Tool_Bar_Text();
}
}
func void ButtonSpeedState_3 (i32x _iComponentID,i32x _iState)
{
if(_iState & GUI_State_Checked)
{
SetContainerSprite(_iComponentID, 5, 0);
}
else
{
SetContainerSprite(_iComponentID, 4, 0);
}
if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
{
if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
else
oToolBar.m_iCounter = oToolBar.m_iCounter + 1;
}
else
{
// if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
Reset_Tool_Bar_Text();
}
}
func void ButtonSpeedState_4 (i32x _iComponentID,i32x _iState)
{
if(_iState & GUI_State_Checked)
{
SetContainerSprite(_iComponentID, 7, 0);
}
else
{
SetContainerSprite(_iComponentID, 6, 0);
}
if((_iState & GUI_State_UnderMouse)&&(GetContainerHelpIndex(_iComponentID)!=0))
{
if(ToolBar_GetHelpStringID() != GetContainerHelpIndex(_iComponentID))
Set_Tool_Bar_TextID(GetContainerHelpIndex(_iComponentID));
else
oToolBar.m_iCounter = oToolBar.m_iCounter + 1;
}
else
{
// if(ToolBar_GetHelpStringID() == GetContainerHelpIndex(_iComponentID))
Reset_Tool_Bar_Text();
}
}
//----------------------------------------------------------------------------------------------------------------//
// Update Race events list
func void InRaceEvents_UpdateListDisplay ()
{
var i32x i,iNumItems;
var component pOldParserComponent;
var frame fFrame1,fFrame2,fFrame3;
var szx szTemp;
pOldParserComponent=GetParserComponent();
SetParserComponent(oRaceEvent.pThis);
i=0;
while(i<6)
{
//
if(oRaceEvent.m_cEvents[i] != ID_NOT_CREATED)
{
// Test animation state
if(GetAnimationState(oRaceEvent.m_cEvents[i])==false)
{
// Animation ended
oRaceEvent.m_cEventEnded[i] = true;
}
}
else
{
oRaceEvent.m_cEventEnded[i] = true;
}
i=i+1;
}
if(oRaceEvent.m_iNeedUpdate)
{
var i32x bFound,iIndex,iEvent,iDistance,iNumCopy;
// Update log windows (if any)
Panel_Inrace_EventLog_Update();
iNumItems = Join_GetNumRows(oRaceEvent.m_jCyclistID)-oRaceEvent.m_iStartIndex;
bFound = false;
if(iNumItems>0)
{
// Some events are waiting for announcement !
i=5;
while(i>=0)
{
// Find last free slot
if(oRaceEvent.m_cEventEnded[i])
{
iIndex = i;
bFound=true;
}
else
{
// Break loop
i=0;
}
i=i-1;
}
if(bFound)
{
// ok
if(oRaceEvent.m_cEvents[iIndex] == ID_NOT_CREATED)
{
// Create container
// race name
oRaceEvent.m_cEvents[iIndex]=InitContainer(tFnt_20);
SetEvents(oRaceEvent.m_cEvents[iIndex],GUI_NoEvent);
//Parameters : Param(1-11) _ix,_iy,_fw,_fh,_fOffset,_fAngle,_r,_g,_b,_a,_fFrameOffset
fFrame1 = AddFrame(oRaceEvent.m_cEvents[iIndex], 0, 64+32*iIndex, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 255, 0.0);
fFrame2 = AddFrame(oRaceEvent.m_cEvents[iIndex], 0, 32+32*iIndex, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 250, 0.3);
fFrame3 = AddFrame(oRaceEvent.m_cEvents[iIndex], 0, 0, 0.1, 0.1, 0.0, 0.0, 255, 255, 255, 0, 1.0);
SetAnimationFlags(oRaceEvent.m_cEvents[iIndex],MSL_Color|MSL_Position|MSL_Scale);
SetAnimationSpeed(oRaceEvent.m_cEvents[iIndex],0.005);
}
// Busy event
oRaceEvent.m_cEventEnded[iIndex] = false;
// Get Evnt type
iEvent = Join_GetIntFromIndex(oRaceEvent.m_jEventsType,oRaceEvent.m_iStartIndex);
iDistance = Join_GetIntFromIndex(oRaceEvent.m_jEventsDistance,oRaceEvent.m_iStartIndex);
iNumCopy = 0;
if(((iEvent == InRaceServer_eEventAttack)||(iEvent == InRaceServer_eEventFall))&&(iNumItems>1))
{
while((iDistance == Join_GetIntFromIndex(oRaceEvent.m_jEventsDistance,oRaceEvent.m_iStartIndex+iNumCopy+1))&&
(iEvent == Join_GetIntFromIndex(oRaceEvent.m_jEventsType,oRaceEvent.m_iStartIndex+iNumCopy+1))&&
(iNumCopy+2<iNumItems))
{
iNumCopy = iNumCopy + 1;
}
}
if(iNumCopy>0)
{
if(iEvent == InRaceServer_eEventAttack)
{
szTemp = itoa(iDistance);
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,GetLocalizedFromGMKey(306));
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,itoa(iNumCopy+1));
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,GetLocalizedFromGMKey(442));
}
else if(iEvent == InRaceServer_eEventFall)
{
szTemp = itoa(iDistance);
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,GetLocalizedFromGMKey(307));
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,itoa(iNumCopy+1));
szTemp = strcat(szTemp," ");
szTemp = strcat(szTemp,GetLocalizedFromGMKey(442));
}
SetContainerText(oRaceEvent.m_cEvents[iIndex],szTemp);
//ResizeComponent(oInRaceEvents_List_Item.m_cEvents);
// Start Animation !!!
GotoFirstFrame(oRaceEvent.m_cEvents[iIndex]);
StartAnimation(oRaceEvent.m_cEvents[iIndex]);
oRaceEvent.m_iStartIndex = oRaceEvent.m_iStartIndex + 1 + iNumCopy;
}
else
{
// Retrieve race name
szTemp=Join_GetStringFromIndex(oRaceEvent.m_jEventsString,oRaceEvent.m_iStartIndex);
SetContainerText(oRaceEvent.m_cEvents[iIndex],szTemp);
//ResizeComponent(oInRaceEvents_List_Item.m_cEvents);
// Start Animation !!!
GotoFirstFrame(oRaceEvent.m_cEvents[iIndex]);
StartAnimation(oRaceEvent.m_cEvents[iIndex]);
oRaceEvent.m_iStartIndex = oRaceEvent.m_iStartIndex + 1;
}
}
}
else
{
// Wait for another event
oRaceEvent.m_iNeedUpdate = false;
}
}
// restore old parser component
SetParserComponent(pOldParserComponent);
}
func void UpdateEventDatabase(i32x _iEventType,i32x _iPreRaceCyclistIndex,szx _szEvnt,i32x _iKm)
{
if((_iEventType == InRaceServer_eEventAttack)||(_iEventType == InRaceServer_eEventWithdrawal)
||(_iEventType == InRaceServer_eEventSprint)||(_iEventType == InRaceServer_eEventFall)||
(_iEventType == InRaceServer_eEventRetained))
{
var i32x iRowIndex;
//Add the new event to the database
iRowIndex = Table_AddRow(DB_INRACE_EVENTS,TABLE_INRACE_EVENTS);
Join_SetIntFromIndex( oRaceEvent.m_jCyclistID, iRowIndex, _iPreRaceCyclistIndex);
Join_SetIntFromIndex(oRaceEvent.m_jEventsType,iRowIndex,_iEventType);
Join_SetIntFromIndex(oRaceEvent.m_jEventsDistance,iRowIndex,_iKm);
Join_SetStringFromIndex(oRaceEvent.m_jEventsString, iRowIndex, _szEvnt);
Database_Update(DB_INRACE_EVENTS);
oRaceEvent.m_iNeedUpdate=true;
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Send Event func function called from the menuserver
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void SendEvent_Null(i32x _iEventType,i32x _iPreRaceCyclistIndex,i32x _iParam1,i32x _iParam2,szx _szParam)
{
}
func i32x IsSomeBodyArrived()
{
if(GetNbGroups()>0)
{
if(GetCyclistRacePercentageDone(GetFirstCyclistPreRaceIndexFromGroup(0))>=99.5)
{
return 1;
}
else
{
return 0;
}
}
return 0;
}
func void SendEvent(i32x _iEventType,i32x _iPreRaceCyclistIndex,i32x _iParam1,i32x _iParam2,szx _szParam)
{
var i32x iDistance,iRows;
var szx szEvnt;
//Get position of the cyclist: *10 to get real distance
iDistance = (GetCyclistSplinePosition(_iPreRaceCyclistIndex)*0.01);
if(_iEventType == InRaceServer_eEventAccel)
{}
else if(_iEventType == InRaceServer_eEventAttack)
{
/*
print("GetEvent Attack from cyclist:");
print(itoa(_iPreRaceCyclistIndex));
print("\n");
*/
//remove all send event attack at the end of the race
if(!(IsSomeBodyArrived()))
{
szEvnt = itoa(iDistance);
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,GetLocalizedFromGMKey(306));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
UpdateEventDatabase(_iEventType,_iPreRaceCyclistIndex,szEvnt,iDistance);
}
}
else if(_iEventType == InRaceServer_eEventFall)
{
/*
print("GetEvent fall from cyclist:");
print(itoa(_iPreRaceCyclistIndex));
print("\n");
*/
PlaySound(1,sbCyclistsSound[0]);
szEvnt = itoa(iDistance);
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,GetLocalizedFromGMKey(307));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
UpdateEventDatabase(_iEventType,_iPreRaceCyclistIndex,szEvnt,iDistance);
}
else if(_iEventType == InRaceServer_eEventFlat)
{}
else if(_iEventType == InRaceServer_eEventHWound)
{}
else if(_iEventType == InRaceServer_eEventLWound)
{}
else if(_iEventType == InRaceServer_eEventSprint)
{
/*
println("GetEvent Sprint from cyclist:");
print(itoa(_iPreRaceCyclistIndex));
print("\t time=");
println(itoa(_iParam2));
*/
RegisterSprintCyclist(_iParam1&255,_iPreRaceCyclistIndex,_iParam2);
if (GetInRaceMode()==G_iRaceModeTimeTrial)
{
//mise α jour de la liste
Sprint_List_NeedUpdate();
}
if (GetInRaceMode()==G_iRaceModeTeamTimeTrial)
{
var f32x fCyclistTime;
var i32x iNumSprint,iTeamID,boucle,boucle2;
iNumSprint=_iParam1&255;
iTeamID=GetCyclistPreRaceTeamID(_iPreRaceCyclistIndex);
fCyclistTime=GetSprintCyclistTimeFromPreRaceID(iNumSprint,_iPreRaceCyclistIndex);
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded=oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded+1;
// si cinquieme cycliste, enregistrement du temps
if (oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded==5)
{
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].fSprintTime=fCyclistTime;
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iCyclistID=_iPreRaceCyclistIndex;
/* print("cinquieme cycliste:");
print(Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
print(" temps: ");
print(itoa(iCyclistTime));
print("\n");*/
oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded=oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded+1;
boucle=0;
/* print("nbre de teams enregistrΘes: ");
print(itoa(oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded));
print("\n");*/
//recherche
while(boucle<oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded-1
&& fCyclistTime>oRace.Tab_Team_Sprints[iNumSprint].Tab[oRace.TabSprintClassement[iNumSprint].TabSprintClassement[boucle].iTeamID].fSprintTime)
boucle=boucle+1;
boucle2=oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded-1;
//decalage
while (boucle2>boucle)
{
oRace.TabSprintClassement[iNumSprint].TabSprintClassement[boucle2].iTeamID=oRace.TabSprintClassement[iNumSprint].TabSprintClassement[boucle2-1].iTeamID;
boucle2=boucle2-1;
}
//insertion
oRace.TabSprintClassement[iNumSprint].TabSprintClassement[boucle].iTeamID=iTeamID;
}
Sprint_List_NeedUpdate();
}
if((_iParam1&255)==(GetNbSprints()-1))
{
//the race is finished for this cyclist so desactivate his control panel
if(GetCyclistPreRaceTeamID(_iPreRaceCyclistIndex)==g_oUser.m_iMyInRaceTeamID)
{
DesactivateControlPanel(GetCyclistPreRaceLocalID(_iPreRaceCyclistIndex));
}
}
if (GetInRaceMode()==G_iRaceModeNormal)
{
if(GetSprintNumRecordedCyclists(_iParam1&255)<=3)
{
if((_iParam1&255)<Join_GetNumRows(g_stInraceJoins.m_iSprint_Name))
{
szEvnt = Join_GetStringFromSortedIndex(g_stInraceJoins.m_iSprint_Name,(_iParam1&255));
}
else
{
// MistER-j WARNING LOCALIZED
szEvnt="Default sprint";
}
szEvnt = strcat(szEvnt," : ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
UpdateEventDatabase(_iEventType,_iPreRaceCyclistIndex,szEvnt,0);
//debug vincent
/* print("\n nbre de cyclistes enregistres α ce sprint:");
var i32x inbcyclists;
inbcyclists=GetSprintNumRecordedCyclists(_iParam1&255);
print(itoa(inbcyclists));
print("\n");
print("temps :");
print(ftoa(GetSprintCyclistTime(_iParam1&255,inbcyclists-1)));
print("\n");
print("\n Nb sprints in race: ");
print(itoa(GetNbSprints()));
print("\n");*/
}//end of if GetSprintNumRecordedCyclists(_iParam1&255)<=3
}//end of if racemode = normal
RefreshInfos();
}
else if(_iEventType == InRaceServer_eEventWithdrawal)
{
/*
print("\nGetEvent Withdrawal from cyclist:");
print(itoa(_iPreRaceCyclistIndex));
print("\n");
*/
// Leave event
szEvnt = itoa(iDistance);
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,GetLocalizedFromGMKey(309));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
UpdateEventDatabase(_iEventType,_iPreRaceCyclistIndex,szEvnt,iDistance);
if(GetCyclistPreRaceTeamID(_iPreRaceCyclistIndex)==g_oUser.m_iMyInRaceTeamID)
{
DesactivateControlPanel(GetCyclistPreRaceLocalID(_iPreRaceCyclistIndex));
}
}
else if(_iEventType == InRaceServer_eEventRetained)
{
/*
print("\nGetEvent Retained Cyclist:");
print(itoa(_iPreRaceCyclistIndex));
print("\n");
*/
if(GetCyclistPreRaceTeamID(_iPreRaceCyclistIndex)==g_oUser.m_iMyInRaceTeamID)
{
// Leave event
szEvnt = itoa(iDistance);
szEvnt = strcat(szEvnt," km : ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_FirstName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,_iPreRaceCyclistIndex));
szEvnt = strcat(szEvnt," ");
szEvnt = strcat(szEvnt,GetLocalizedFromGMKey(384));
UpdateEventDatabase(_iEventType,_iPreRaceCyclistIndex,szEvnt,iDistance);
}
}
else if(_iEventType == InRaceServer_eEventStartRaceSprint)
{
//print("\n Receive start cyclist time.");
SetStartRaceCyclistTime(_iPreRaceCyclistIndex,(1.0*(_iParam1))/65536.0);
if(GetCyclistPreRaceTeamID(_iPreRaceCyclistIndex)==g_oUser.m_iMyInRaceTeamID)
{
ActivateControlPanel(GetCyclistPreRaceLocalID(_iPreRaceCyclistIndex));
}
}
}
func void vRaceSetProfileZoom(i32x _iZoomIndex)
{
//print("*** vRaceSetProfileZoom\n");
if ((_iZoomIndex>=0)&&(_iZoomIndex<=oProfileCamera.m_iZoomIndexMax)&&(_iZoomIndex!=oProfileCamera.m_iZoomIndex))
{
vSetProfileCameraZoom(_iZoomIndex);
}
oRace.bNeedRefreshProfileZoom=1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//RaceEvent Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void RaceEvent_Create ()
{
var i32x i;
oRaceEvent.pThis = GetParserComponent();
SetComponentNumber(16);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//TeamPanel Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x RaceEvent_Event (i32x _iComponentID,i32x _iEvent)
{
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//TeamPanel Init func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void RaceEvent_Init ()
{
var i32x i;
i=0;
while(i<6)
{
oRaceEvent.m_cEvents[i] = ID_NOT_CREATED;
oRaceEvent.m_cEventEnded[i] = true;
i=i+1;
}
oRaceEvent.m_iStartIndex = 0;
oRaceEvent.oFunc.pcreate = RaceEvent_Create;
oRaceEvent.oFunc.pevent = RaceEvent_Event;
}
// ***********************************
// Chat
// ***********************************
//----------------------------------------------------------------------------------------------------------------//
// Update Race chat
func void InRaceChat_UpdateDisplay ()
{
var i32x i,iNumItems;
var component pOldParserComponent;
var frame fFrame1,fFrame2,fFrame3;
var szx szTemp;
pOldParserComponent=GetParserComponent();
SetParserComponent(oRaceChat.pThis);
i=0;
while(i<3)
{
//
if(oRaceChat.m_cEvents[i] != ID_NOT_CREATED)
{
// Test animation state
if(GetAnimationState(oRaceChat.m_cEvents[i])==false)
{
// Animation ended
oRaceChat.m_cEventEnded[i] = true;
}
}
else
{
oRaceChat.m_cEventEnded[i] = true;
}
i=i+1;
}
if(oRaceChat.m_iNeedUpdate)
{
var i32x bFound,iIndex;
iNumItems = (oPanelInraceChat.iCursor - oRaceChat.m_iStartIndex);
if(iNumItems<0)
iNumItems = iNumItems + oPanelInraceChat.iMaxListItems;
bFound = false;
if(iNumItems>0)
{
// Some msg are waiting for announcement !
i=2;
while(i>=0)
{
// Find last free slot
if(oRaceChat.m_cEventEnded[i])
{
iIndex = i;
bFound=true;
}
else
{
// Break loop
i=0;
}
i=i-1;
}
if(bFound)
{
// ok
if(oRaceChat.m_cEvents[iIndex] == ID_NOT_CREATED)
{
// Create container
// race name
oRaceChat.m_cEvents[iIndex]=InitContainer(tFontArialItalique);
SetEvents(oRaceChat.m_cEvents[iIndex],GUI_NoEvent);
//Parameters : Param(1-11) _ix,_iy,_fw,_fh,_fOffset,_fAngle,_r,_g,_b,_a,_fFrameOffset
fFrame1 = AddFrame(oRaceChat.m_cEvents[iIndex], 0, 29*iIndex, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 255, 0.0);
fFrame2 = AddFrame(oRaceChat.m_cEvents[iIndex], 0, 29*iIndex, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 255, 0.9);
fFrame3 = AddFrame(oRaceChat.m_cEvents[iIndex], 0, 29*iIndex, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 0, 1.0);
SetAnimationFlags(oRaceChat.m_cEvents[iIndex],MSL_Color|MSL_Position);
}
// Busy event
oRaceChat.m_cEventEnded[iIndex] = false;
// Retrieve msg
szTemp = oPanelInraceChat.szChatTab[oRaceChat.m_iStartIndex];
SetContainerText(oRaceChat.m_cEvents[iIndex],szTemp);
//ResizeComponent(oInRaceEvents_List_Item.m_cEvents);
// Start Animation !!!
if(iNumItems>12)
{
SetAnimationSpeed(oRaceChat.m_cEvents[iIndex],0.018);
}
else if(iNumItems>6)
{
SetAnimationSpeed(oRaceChat.m_cEvents[iIndex],0.0012);
}
else if(iNumItems>3)
{
SetAnimationSpeed(oRaceChat.m_cEvents[iIndex],0.006);
}
else
{
SetAnimationSpeed(oRaceChat.m_cEvents[iIndex],0.003);
}
GotoFirstFrame(oRaceChat.m_cEvents[iIndex]);
StartAnimation(oRaceChat.m_cEvents[iIndex]);
oRaceChat.m_iStartIndex = oRaceChat.m_iStartIndex + 1;
oRaceChat.m_iStartIndex = oRaceChat.m_iStartIndex%oPanelInraceChat.iMaxListItems;
}
}
else
{
// Wait for another event
oRaceChat.m_iNeedUpdate = false;
}
}
// restore old parser component
SetParserComponent(pOldParserComponent);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//RaceEvent Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void RaceChat_Create ()
{
oRaceChat.pThis = GetParserComponent();
SetComponentNumber(3);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Chat Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x RaceChat_Event (i32x _iComponentID,i32x _iEvent)
{
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Chat Init func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void RaceChat_Init ()
{
var i32x i;
i=0;
while(i<3)
{
oRaceChat.m_cEvents[i] = ID_NOT_CREATED;
oRaceChat.m_cEventEnded[i] = true;
i=i+1;
}
oRaceChat.m_iStartIndex = 0;
oRaceChat.oFunc.pcreate = RaceChat_Create;
oRaceChat.oFunc.pevent = RaceChat_Event;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Race Window Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Groups Update Callback func
func void UpdateGroups()
{
var component pCurrentContext;
pCurrentContext=GetParserComponent();
SetParserComponent(oGroups.pGroups);
if (GetInRaceMode()==G_iRaceModeNormal)
Groups_Update();
else if (GetInRaceMode()==G_iRaceModeTimeTrial)
{
Groups_Time_Trial_Update();
//Object_InRaceEvents_Time_Trial_Update();
}
else
{
Groups_Team_Time_Trial_Update();
//Object_InRaceEvents_Team_Time_Trial_Update();
}
SetParserComponent(pCurrentContext);
// Update blue panel
Panel_Inrace_Tab_Update ();
}
func void UpdateGroupsPositions()
{
var component pCurrentContext;
pCurrentContext=GetParserComponent();
SetParserComponent(oGroups.pGroups);
if (GetInRaceMode()==G_iRaceModeNormal)
Groups_UpdatePosition();
else if (GetInRaceMode()==G_iRaceModeTimeTrial)
{
Object_InRaceEvents_Time_Trial_Update();
Groups_Time_Trial_UpdatePosition();
}
else
{
Groups_Team_Time_Trial_UpdatePosition();
Object_InRaceEvents_Team_Time_Trial_Update();
Panel_Cyclist_Team_Time_Trial_Update();
}
SetParserComponent(pCurrentContext);
}
func void UpdateSprintsPositions()
{
var component pCurrentContext;
pCurrentContext=GetParserComponent();
SetParserComponent(oPanel_Team_Tactic_Profil.cComponent);
if(Geti32x(oPanel_Team_Tactic_Profil.m_iWithSprints))
{
var i32x iTemp,iNumSprints,iPosX;
var f32x fPercentage;
//iNumSprints=Spline_GetNumSprints(Spline_GetSplinePointer(Geti32x(oPanel_Team_Tactic_Profil.m_ipoSimpleSpline)));
iNumSprints=Join_GetIntFromKey(g_oMenuJoins.m_iStage_iNumSprints, oPanel_Team_Tactic_Profil.iStageId);
iTemp=0;
while(iTemp<iNumSprints)
{
fPercentage =
Join_GetFloatFromSortedIndex( g_oMenuJoins.m_iSprint_fPosition, oPanel_Team_Tactic_Profil.iFirstSprint+iTemp) /
Join_GetFloatFromKey( g_oMenuJoins.m_iStage_fSplineLength, oPanel_Team_Tactic_Profil.iStageId);
iPosX = (iGetProfileCameraXPixelPosFromSplinePercentageDone(100.0*fPercentage)+oProfileCamera.m_iWindowPosX-1)-(GetComponentWidth(oPanel_Team_Tactic_Profil.a16_iSprintID[iTemp])/2);
SetComponentPositionX(oPanel_Team_Tactic_Profil.a16_iSprintID[iTemp], iPosX);
SetComponentPositionX(oPanel_Team_Tactic_Profil.a16_iSprintCursorID[iTemp], iPosX);
iTemp=iTemp+1;
}
}
SetParserComponent(pCurrentContext);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Follow camera loop func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void FollowCamera()
{
var boolx bDrawCameraTarget;
bDrawCameraTarget=0;
// debug : special demo
if(G_iDebugVersion)
{
if ((GetKeyState(DIK_RCONTROL))&&(GetKeyState(DIK_RSHIFT)))
{
var f32x fDelta;
fDelta=0.0;
if(GetKeyState(DIK_UP)) fDelta=fDelta-FOV_STEP;
if(GetKeyState(DIK_DOWN)) fDelta=fDelta+FOV_STEP;
if(fDelta!=0.0)
{
CameraOffsetFOV(fDelta);
}
fDelta=0.0;
if(GetKeyState(DIK_LEFT)) fDelta=fDelta-CATCH_UP_STEP;
if(GetKeyState(DIK_RIGHT)) fDelta=fDelta+CATCH_UP_STEP;
if(fDelta!=0.0)
{
CameraOffsetCatchUpTime(fDelta);
}
bDrawCameraTarget=1;
}
else if (GetKeyState(DIK_RSHIFT))
{
if(GetKeyState(DIK_UP))
CameraOffsetPosition(0.0,OFFSET_STEP,0.0);
if(GetKeyState(DIK_DOWN))
CameraOffsetPosition(0.0,-OFFSET_STEP,0.0);
if(GetKeyState(DIK_RIGHT))
CameraOffsetPosition(OFFSET_STEP,0.0,0.0);
if(GetKeyState(DIK_LEFT))
CameraOffsetPosition(-OFFSET_STEP,0.0,0.0);
if(GetKeyState(DIK_PGUP))
CameraOffsetPosition(0.0,0.0,OFFSET_STEP);
if(GetKeyState(DIK_PGDN))
CameraOffsetPosition(0.0,0.0,-OFFSET_STEP);
bDrawCameraTarget=1;
}
else if (GetKeyState(DIK_RCONTROL))
{
if(GetKeyState(DIK_UP))
{
CameraRoll(1.0*TURN_STEP);
bDrawCameraTarget=1;
}
if(GetKeyState(DIK_DOWN))
{
CameraRoll(-1.0*TURN_STEP);
bDrawCameraTarget=1;
}
if(GetKeyState(DIK_RIGHT))
{
CameraTurn(1.0*TURN_STEP);
bDrawCameraTarget=1;
}
if(GetKeyState(DIK_LEFT))
{
CameraTurn(-1.0*TURN_STEP);
bDrawCameraTarget=1;
}
if(GetKeyState(DIK_PGUP))
{
CameraStrafeUpDown(-2.0*OFFSET_STEP);
bDrawCameraTarget=1;
}
if(GetKeyState(DIK_PGDN))
{
CameraStrafeUpDown(2.0*OFFSET_STEP);
bDrawCameraTarget=1;
}
//if (GetMouseTrueRelX()!=0) CameraTurn(0.3*TURN_STEP * GetMouseTrueRelX());
//if (GetMouseTrueRelY()!=0) CameraRoll(0.3*TURN_STEP * GetMouseTrueRelY());
}
if (oRace.bDrawCameraTarget!=bDrawCameraTarget)
{
oRace.bDrawCameraTarget=bDrawCameraTarget;
CameraDrawTarget(bDrawCameraTarget);
}
}// debug : if special demo
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Follow cyclist camera loop func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void FollowCyclistCamera()
{
FollowCamera();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Path camera loop func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void ManPathCamera()
{
FollowCamera();
if ((!(GetKeyState(DIK_RCONTROL)))&&(!(GetKeyState(DIK_RSHIFT))))
{
if (GetKeyState(DIK_NUMPAD0))
{
if(GetKeyState(DIK_RIGHT))
CameraStrafeRightLeft(20.0*STRAFE_STEP);
if(GetKeyState(DIK_LEFT))
CameraStrafeRightLeft(-20.0*STRAFE_STEP);
}
else
{
if(GetKeyState(DIK_RIGHT))
CameraStrafeRightLeft(STRAFE_STEP);
if(GetKeyState(DIK_LEFT))
CameraStrafeRightLeft(-STRAFE_STEP);
}
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Doom like camera loop func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void DoomCamera()
{
CameraTurn(TURN_STEP * GetMouseTrueRelX());
CameraRoll(TURN_STEP * GetMouseTrueRelY());
if(GetKeyState(DIK_UP))
CameraStrafeFrontBack(STRAFE_STEP);
if(GetKeyState(DIK_DOWN))
CameraStrafeFrontBack(-STRAFE_STEP);
if(GetKeyState(DIK_RIGHT))
CameraStrafeRightLeft(STRAFE_STEP);
if(GetKeyState(DIK_LEFT))
CameraStrafeRightLeft(-STRAFE_STEP);
if(GetKeyState(DIK_PGUP))
CameraStrafeUpDown(STRAFE_STEP);
if(GetKeyState(DIK_PGDN))
CameraStrafeUpDown(-STRAFE_STEP);
}
func void RefreshAIDrawInfos()
{
SetContainerText(oRace.iInfoIAID, GetActiveCyclistAIState());
}
func void RefreshPictoVent()
{
var szx szWindText;
var i32x iWindValue;
iWindValue = 3.6*GetWindSpeed();
szWindText = strcat(itoa(iWindValue),"km/h");
SetContainerText(oRace.iWindTextID,szWindText);
if(iWindValue<=1)
SetContainerSprite(oRace.iWindIconID,0,0);
else if(iWindValue<4)
SetContainerSprite(oRace.iWindIconID,1,0);
else if(iWindValue<12)
SetContainerSprite(oRace.iWindIconID,2,0);
else
SetContainerSprite(oRace.iWindIconID,3,0);
}
func void RefreshPictoAngle()
{
var i32x iAngle;
var f32x fAngle;
var szx szAngleText;
fAngle = GetActiveCyclistSplineAngle()*100.0;
if(fAngle>3)
{
// Cote
SetContainerSprite(oRace.iAngleIconID,0,0);
}
else if(fAngle<-3)
{
// pente
SetContainerSprite(oRace.iAngleIconID,2,0);
}
else
{
// plat
SetContainerSprite(oRace.iAngleIconID,1,0);
}
iAngle = fAngle;
fAngle = fAngle - iAngle;
fAngle = fAngle * 10.0;
szAngleText = itoa(iAngle);
if(fAngle<0)
fAngle=-fAngle;
iAngle = fAngle;
szAngleText = strcat(szAngleText,".");
szAngleText = strcat(szAngleText,itoa(iAngle));
SetContainerText(oRace.iAngleTextID,strcat(szAngleText,"%"));
}
func void vUpdate_TissotWatch()
{
var i32x iDelta;
var i32x iDay,iHour,iMin,iSec,ok;
var szx szDelta;
// Update phase duration
iDelta = (GetInRaceTime()*10.0);
iHour = iDelta/3600;
iDelta = iDelta % 3600;
iMin = iDelta/60;
iDelta = iDelta % 60;
iSec = iDelta;
ok = 0;
szDelta = "";
// Hour
if(iHour>=10)
{
szDelta = itoa(iHour);
}
else if(iHour>0)
{
szDelta = strcat("0",itoa(iHour));
}
else
{
szDelta = "00";
}
szDelta = strcat(szDelta,":");
// Minute
if(iMin>=10)
{
szDelta = strcat(szDelta,itoa(iMin));
}
else if(iMin>0)
{
szDelta = strcat(szDelta,"0");
szDelta = strcat(szDelta,itoa(iMin));
}
else
{
szDelta = strcat(szDelta,"00");
}
szDelta = strcat(szDelta,":");
// Seconde
if(iSec>=10)
{
szDelta = strcat(szDelta,itoa(iSec));
}
else if(iSec>0)
{
szDelta = strcat(szDelta,"0");
szDelta = strcat(szDelta,itoa(iSec));
}
else
{
szDelta = strcat(szDelta,"00");
}
SetContainerText(oRace.m_cLCD,szDelta);
}
// *************************************
// Team Time Trial structure initializer
// *************************************
func void vRaz_RaceTimeTrialResults()
{
var i32x iNumSprint,iNbSprints,iNbCyclistsRecorded,boucle,i;
// Raz sprint result array
iNbSprints = 16;
iNumSprint=0;
while(iNumSprint<iNbSprints)
{
iNbCyclistsRecorded=20;
boucle=0;
while(boucle<iNbCyclistsRecorded)
{
i=0;
while(i<20)
{
oRace.Tab_Team_Sprints[iNumSprint].Tab[i].iNbCyclistsRecorded=0;
oRace.Tab_Team_Sprints[iNumSprint].Tab[i].fSprintTime=0.0;
oRace.Tab_Team_Sprints[iNumSprint].Tab[i].iCyclistID=0;
i=i+1;
}
oRace.TabSprintClassement[iNumSprint].TabSprintClassement[oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded].iTeamID=0;
oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded=0;
boucle=boucle+1;
}
iNumSprint=iNumSprint+1;
}
}
func void vInit_RaceTimeTrialResults()
{
var i32x iNumSprint,iNbSprints,iNbCyclistsRecorded,boucle,iTeamID,iCyclistID;
var f32x fCyclistTime;
iNbSprints=GetNbSprints();
iNumSprint=0;
while(iNumSprint<iNbSprints)
{
iNbCyclistsRecorded=GetSprintNumRecordedCyclists(iNumSprint);
boucle=0;
while(boucle<iNbCyclistsRecorded)
{
iCyclistID=GetSprintCyclistPreRaceIndex(iNumSprint,boucle);
iTeamID=GetCyclistPreRaceTeamID(iCyclistID);
fCyclistTime=GetSprintCyclistTime(iNumSprint,boucle);
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded=oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded+1;
// si cinquieme cycliste, enregistrement du temps
if (oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iNbCyclistsRecorded==5)
{
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].fSprintTime=fCyclistTime;
oRace.Tab_Team_Sprints[iNumSprint].Tab[iTeamID].iCyclistID=iCyclistID;
/*print("cinquieme cycliste:");
print(Join_GetStringFromSortedIndex(g_stInraceJoins.m_iCyclist_LastName,iCyclistID));
print("\n");*/
//classement de l'equipe
oRace.TabSprintClassement[iNumSprint].TabSprintClassement[oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded].iTeamID=iTeamID;
oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded=oRace.TabSprintClassement[iNumSprint].iNbTeamRecorded+1;
}
boucle=boucle+1;
}
iNumSprint=iNumSprint+1;
}
}
func void Race_Create ()
{
var i32x i,iServerSpeed;
oRace.iGroupsID=-1;
oRacePodium.m_bPodiumSequenceLaunched = false;
oRacePodium.m_bQueryAsked = false;
//print("race mode:");
//print(itoa(GetRaceMode()));
//print("\n");
//Save the mode for the race
oRace.iInRaceMode=GetRaceMode();
SetObjectSize(800, 600);
SetComponentNumber(36);
oRace.pRace=GetParserComponent();
//print("SetUpdateGroupsFunc\n\n");
//Set the function pointer that will be called by inrace
SetUpdateGroupsFunc(UpdateGroups);
CameraDrawTarget(0);
//Camera management
CreateInRaceCameras(oRace.iNbCameras);
CreatePodiumInRaceCameras(oRace.iPodiumNbCameras);
UpdateInRaceCameraPositions();
SetActiveCamera(0);
SelectInRaceCamera(oRace.iCurrentCamera);
// Left Border (camera settings...)
i= InitContainer(t_panel_bordertopleft);
SetContainerSprite(i,1,0);
SetComponentPositionY(i,3);
SetContainerScaleY(i,489.0/125.0);
i= InitContainer(t_panel_borderbottomleft);
SetComponentPosition(i,0,492);
// Blue button
i = InitContainer(tWatchTissot);
SetEvents(i,GUI_NoEvent);
SetContainerSize(i,74,74);
SetComponentPosition(i,6,495);
SetContainerSprite(i,1,0);
oRace.m_cLCD = InitContainer(tFntLcd);
SetEvents(oRace.m_cLCD ,GUI_NoEvent);
SetContainerScale(oRace.m_cLCD,0.25,0.28);
SetComponentPosition(oRace.m_cLCD ,20,526);
SetContainerText(oRace.m_cLCD,"0");
Panel_Team_Tactic_Profil_InitMembers(g_oGameConfig.m_iCurrentStageID,0,1,624,75,42,6);
oRace.iProfileMeshID = InitObject(oPanel_Team_Tactic_Profil.szName, oPanel_Team_Tactic_Profil.oFunc.pcreate, oPanel_Team_Tactic_Profil.oFunc.pevent);
SetStackEvents(oRace.iProfileMeshID,GUI_Destroy | GUI_Char|GUI_KeyDown);
//Call the function to groups in interface
Groups_Init(GetInRaceMode());
oRace.iGroupsID = InitObject("Groups", oGroups.oFunc.pcreate, oGroups.oFunc.pevent);
//SetStackEvents(oRace.iGroupsID, GUI_Mouse|GUI_Key);
SetComponentPosition(oRace.iGroupsID,oProfileCamera.m_iWindowPosX,oProfileCamera.m_iWindowPosY);
SetComponentWidth(oRace.iGroupsID,oProfileCamera.m_iWindowWidth);
SetComponentHeight(oRace.iGroupsID,oProfileCamera.m_iWindowHeight);
SetComponentClipper(oRace.iGroupsID,0,0,oProfileCamera.m_iWindowWidth,oProfileCamera.m_iWindowHeight);
// Profil cadre
i=InitContainer(tCommonTableBorder);
SetContainerSize(i,17,85);
SetContainerColor(i,c_VLightGray);
SetEvents(i,GUI_NoEvent);
i=InitContainer(tCommonTableBorder);
SetComponentPositionX(i,679);
SetContainerSize(i,16,85);
SetContainerColor(i,c_VLightGray);
SetEvents(i,GUI_NoEvent);
i=Init_LibObject_Cadre(t_panel_profil,663,85);
SetComponentPositionX(i,16);
SetEvents(i,GUI_NoEvent);
// Picking window
PickingWindow_Init();
oRace.iPickingWindowID = InitObject("PickingWindow", oPickingWindow.oFunc.pcreate, oPickingWindow.oFunc.pevent);
SetComponentPosition(oRace.iPickingWindowID,oRace.o3DViewport.iX,oRace.o3DViewport.iY);
SetStackEvents(oRace.iPickingWindowID,GUI_MouseDown|GUI_MouseRoll);
//initialisation du tableau de sprints par equipe si TTT
vRaz_RaceTimeTrialResults();
if (GetInRaceMode()==G_iRaceModeTeamTimeTrial)
{
vInit_RaceTimeTrialResults();
}
// Panel inrace tab
Panel_Inrace_Tab_InitMembers();
oRace.iPanelTabID=InitObject(oPanel_Inrace_Tab.szName,oPanel_Inrace_Tab.oFunc.pcreate,oPanel_Inrace_Tab.oFunc.pevent);
SetComponentPosition(oRace.iPanelTabID,0,85);
// **************
// Profil button
// **************
// Plus button zoom +
i=InitButton(tBtnZoomPlus);
SetComponentPosition(i,15,4);
SetContainerStateFunc(i,ButtonState);
SetContainerHelpIndex(i,1486);
oRace.iButtonZoomPlusID=i;
// Minus button zoom -
i=InitButton(tBtnZoomMinus);
SetComponentPosition(i,12,31);
SetContainerHelpIndex(i,1487);
SetContainerStateFunc(i,ButtonState);
oRace.iButtonZoomMoinsID=i;
// Normal zoom
i=InitButton(tBtnZoomDef);
SetComponentPosition(i,9,58);
SetContainerStateFunc(i,ButtonState);
SetContainerHelpIndex(i,1488);
oRace.iButtonZoomDefID=i;
// Strafe left
i=InitButton(t_leftarrow);
SetComponentRepeatState(i,5);
SetContainerStateFunc(i,StrafeProfil_ButtonState);
SetContainerHelpIndex(i,1489);
SetComponentPosition(i,10,91);
oRace.iStrafeLeft=i;
// Strafe right
i=InitButton(t_rightarrow);
SetComponentRepeatState(i,5);
SetContainerHelpIndex(i,1490);
SetContainerStateFunc(i,StrafeProfil_ButtonState);
SetComponentPosition(i,30,91);
oRace.iStrafeRight=i;
// Speed X1
i=InitRadioButton(t_changespeed);
SetContainerStateFunc(i,ButtonSpeedState_1);
SetContainerHelpIndex(i,1528);
SetComponentPosition(i,574,82);
SetComponentSize(i,20,15);
oRace.iSpeedX1=i;
// Speed X2
i=InitRadioButton(t_changespeed);
SetContainerStateFunc(i,ButtonSpeedState_2);
SetContainerHelpIndex(i,1528);
SetComponentPosition(i,598,82);
SetComponentSize(i,20,15);
oRace.iSpeedX2=i;
// Speed X4
i=InitRadioButton(t_changespeed);
SetContainerStateFunc(i,ButtonSpeedState_3);
SetContainerHelpIndex(i,1528);
SetComponentPosition(i,622,82);
SetComponentSize(i,20,15);
oRace.iSpeedX4=i;
// Speed X8
i=InitRadioButton(t_changespeed);
SetContainerStateFunc(i,ButtonSpeedState_4);
SetContainerHelpIndex(i,1528);
SetComponentPosition(i,646,82);
SetComponentSize(i,20,15);
oRace.iSpeedX8=i;
iServerSpeed = GetMSSpeed();
if(iServerSpeed == 1)
{
SetCheckboxState(oRace.iSpeedX1,1);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
}
if(iServerSpeed == 2)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,1);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
}
if(iServerSpeed == 4)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,1);
SetCheckboxState(oRace.iSpeedX8,0);
}
if(iServerSpeed == 8)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,1);
}
if(IsAdmin() == 0)
{
SetComponentEnableStatus(oRace.iSpeedX1, 0);
SetComponentEnableStatus(oRace.iSpeedX2, 0);
SetComponentEnableStatus(oRace.iSpeedX4, 0);
SetComponentEnableStatus(oRace.iSpeedX8, 0);
}
// **************
// Race Events
// **************
//init event log
Panel_Inrace_EventLog_InitMembers();
oRace.iLogWindow = ID_NOT_CREATED;
//init the chat window
Panel_Inrace_Chat_InitMembers();
oRace.iChatWindow = ID_NOT_CREATED;
// Init Event display
RaceEvent_Init();
oRace.iEventID = InitObject("RaceEvent", oRaceEvent.oFunc.pcreate, oRaceEvent.oFunc.pevent);
SetComponentPosition(oRace.iEventID, 32, 200);
// Init Chat display
RaceChat_Init();
oRace.iChatID = InitObject("RaceChat", oRaceChat.oFunc.pcreate, oRaceChat.oFunc.pevent);
SetComponentPosition(oRace.iChatID, 100, 480);
// Team panel
InitTeamPanel();
oRace.iPanelID = InitObject(oTeamPanel.szName, oTeamPanel.oFunc.pcreate, oTeamPanel.oFunc.pevent);
SetComponentPosition(oRace.iPanelID, 672, 0);
// Init Active cyclist
InitActiveCyclist();
oRace.iInfoIAID=InitContainer(tFontArial);
SetComponentPosition(oRace.iInfoIAID,0,180);
SetEvents(oRace.iInfoIAID,GUI_NoEvent);
// Tool bar
ToolBar_init_members();
oRace.m_cToolBar = InitObject("Tool Bar",oToolBar.ofunc.pcreate,oToolBar.ofunc.pevent);
SetComponentPosition(oRace.m_cToolBar,0,574);
Set_Config_Button_VisibleStatus(false);
// Chat command
if (g_oGameConfig.m_iSinglePlayer==0)
{
oRace.m_cChatButton = InitButton(tBtnChat);
SetContainerStateFunc(oRace.m_cChatButton,ButtonState);
SetContainerHelpIndex(oRace.m_cChatButton,1552);
SetComponentPosition(oRace.m_cChatButton,720,578);
SetContainerScale(oRace.m_cChatButton,0.65,0.65);
}
// Lag indicator
oRace.m_cLagIndicator = InitContainer(tBtnLag);
SetComponentPosition(oRace.m_cLagIndicator,33,545);
SetContainerSize(oRace.m_cLagIndicator,20,20);
SetComponentVisibleStatus(oRace.m_cLagIndicator,0);
SetEvents(oRace.m_cLagIndicator,GUI_NoEvent);
// Create angle info container
oRace.iAngleIconID = InitContainer(tPictoAngle);
SetComponentPosition(oRace.iAngleIconID,536,500);
SetEvents(oRace.iAngleIconID,GUI_NoEvent);
oRace.iAngleTextID = InitContainer(tFontArial);
SetComponentPosition(oRace.iAngleTextID,538,502);
SetContainerColor(oRace.iAngleTextID, c_Black); //black
SetEvents(oRace.iAngleTextID,GUI_NoEvent);
RefreshPictoAngle();
//create the wind info container
//tPictoVent
oRace.iWindIconID = InitContainer(tPictoVent);
SetComponentPosition(oRace.iWindIconID,600,500);
SetEvents(oRace.iWindIconID,GUI_NoEvent);
oRace.iWindTextID = InitContainer(tFontArial);
SetComponentPosition(oRace.iWindTextID,602,502);
SetContainerColor(oRace.iWindTextID, c_Black); //black
SetEvents(oRace.iWindTextID,GUI_NoEvent);
RefreshPictoVent();
// Select first component
SetSelectedComponent(0);
// No pause dialog
oRace.m_cPause = ID_NOT_CREATED;
oRace.iCompteurFPS = 0;
oRace.iCompteurLag = 0;
RefreshInfos();
oRace.ploop = FollowCyclistCamera;
SetLoopFunc(oRace.ploop);
print("debug : race created...\n");
}
func void vInRace_ManageShortcut(i32x _iKey)
{
var i32x i;
if (_iKey == VK_F2)
{
SaveInRaceCameraPositions();
}
else if(_iKey==VK_Pause)
{
if(IsAdmin())
{
if(oRace.iCurrentSpeed != 0)
{
// Ask pause
g_oMenuServer.m_oServer<<speed(0);
//print("PauseAsked\n");
}
else
{
// Remove pause
g_oMenuServer.m_oServer<<speed(1);
//print("PauseRemoved\n");
}
}
}
else if(_iKey==VK_Right)
{
if(GetActiveCamera()==0)
if (!GetKeyState(DIK_RCONTROL))
if (!GetKeyState(DIK_RSHIFT))
{
//print("*** KEY_RIGHT : NextActiveCyclist \n");
// next active cyclist
oPanelRank.m_bSeeClass=true;
SetNextActiveCyclist();
vSetProfileCameraMode(0);
RefreshInfos();
}
}
else if(_iKey==VK_Left)
{
if(GetActiveCamera()==0)
if (!GetKeyState(DIK_RCONTROL))
if (!GetKeyState(DIK_RSHIFT))
{
//print("*** KEY_LEFT : PreviousActiveCyclist \n");
// next active cyclist
oPanelRank.m_bSeeClass=true;
SetPreviousActiveCyclist();
vSetProfileCameraMode(0);
RefreshInfos();
}
}
else if(_iKey==VK_Up)
{
if(GetActiveCamera()==0)
if (!GetKeyState(DIK_RCONTROL))
if (!GetKeyState(DIK_RSHIFT))
{
//print("*** KEY_RIGHT : NextActiveCyclistInTeam \n");
// next active cyclist
oPanelRank.m_bSeeClass=true;
SetPreviousActiveCyclistInTeam(g_oUser.m_iMyInRaceTeamID);
vSetProfileCameraMode(0);
RefreshInfos();
}
}
else if(_iKey==VK_Down)
{
if(GetActiveCamera()==0)
if (!GetKeyState(DIK_RCONTROL))
if (!GetKeyState(DIK_RSHIFT))
{
//print("*** KEY_LEFT : PreviousActiveCyclist \n");
// next active cyclist
oPanelRank.m_bSeeClass=true;
SetNextActiveCyclistInTeam(g_oUser.m_iMyInRaceTeamID);
vSetProfileCameraMode(0);
RefreshInfos();
}
}
else if (_iKey == VK_A)
{
//print("*** Calling vSetProfileCameraMode(1) and move camera left \n");
vMoveProfileCamera(-2.0,1);
}
else if(_iKey == VK_Z)
{
//print("*** Calling vSetProfileCameraMode(1) and move camera right \n");
vMoveProfileCamera(2.0,1);
}
else if (_iKey == VK_Add)
{
//if (GetKeyState(DIK_RCONTROL))
{
//print("*** Calling vRaceSetProfileZoom ++ \n");
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex+1));
}
}
else if (_iKey == VK_Subtract)
{
//if (GetKeyState(DIK_RCONTROL))
{
//print("*** Calling vRaceSetProfileZoom -- \n");
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex-1));
}
}
else if (_iKey == VK_Space)
{
vSetProfileCameraMode(0);
}
else if (_iKey == VK_F8)
{
if(oRace.iLogWindow != ID_NOT_CREATED)
{
// Delete Chat Window
DeleteComponent(oRace.iLogWindow);
oRace.iLogWindow = ID_NOT_CREATED;
}
else
{
if(!oRacePodium.m_bPodiumSequenceLaunched)
{
// Create chat window
oRace.iLogWindow=InitObject("log",oPanelInraceEventLog.oFunc.pcreate,oPanelInraceEventLog.oFunc.pevent);
SetComponentPosition(oRace.iLogWindow,75,225);
}
}
}
else if (_iKey == VK_F3)
{
if(oRace.iChatWindow != ID_NOT_CREATED)
{
// Delete Chat Window
DeleteComponent(oRace.iChatWindow);
oRace.iChatWindow = ID_NOT_CREATED;
}
else
{
if(!oRacePodium.m_bPodiumSequenceLaunched)
{
// Create chat window
oRace.iChatWindow=InitObject("chat",oPanelInraceChat.oFunc.pcreate,oPanelInraceChat.oFunc.pevent);
SetComponentPosition(oRace.iChatWindow,50,200);
}
}
}
// debug : special demo
else if ((_iKey == VK_F4)&&(G_iDebugVersion))
{
//Change fog
oRace.iCurrentFog=oRace.iCurrentFog+1;
if (oRace.iCurrentFog>=oRace.iNbFogs)
oRace.iCurrentFog=0;
SelectFog(oRace.iCurrentFog);
}
else if ((_iKey == VK_F5)&&(G_iDebugVersion)&&(GetActiveCamera()!=4))
{
if (GetActiveCamera()!=2)
{
oRace.bDrawCameraTarget=0;
CameraDrawTarget(0);
SetActiveCamera(2);
oRace.ploop = ManPathCamera;
SetLoopFunc(oRace.ploop);
ShowMouse();
}
else
{
//Change camera path
oRace.iCurrentCamera=oRace.iCurrentCamera+1;
if (oRace.iCurrentCamera>=oRace.iNbCameras)
oRace.iCurrentCamera=0;
SelectInRaceCamera(oRace.iCurrentCamera);
}
}
// debug : special demo
else if ((_iKey == VK_F7)&&(GetActiveCamera()!=4))
{
if (GetActiveCamera()!=0)
{
SetActiveCamera(0);
oRace.ploop = FollowCyclistCamera;
SetLoopFunc(oRace.ploop);
}
else
{
//Change camera path
oRace.iCurrentCamera=oRace.iCurrentCamera+1;
PlaySound(0,sbClickSound[5]);
if (oRace.iCurrentCamera>=oRace.iNbCameras)
oRace.iCurrentCamera=0;
SelectInRaceCamera(oRace.iCurrentCamera);
}
}
else if (_iKey == VK_PageUp)
{
PushEventOnChild(oRace.iPanelID,GUI_PANEL_UP);
}
else if (_iKey == VK_PageDown)
{
PushEventOnChild(oRace.iPanelID,GUI_PANEL_DOWN);
}
else if ((_iKey>=VK_1) && (_iKey<=VK_9))
{
// Don't make camera change when chat is open
if(oRace.iChatWindow == ID_NOT_CREATED)
{
// choose camera for cyclist or sprint
i = _iKey - VK_1;
if ((GetActiveCamera()==0) || (GetActiveCamera()==3))
{
if (i<oRace.iNbCameras)
{
oRace.iCurrentCamera=i;
SelectInRaceCamera(i);
}
}
}
}
/*
else if (GetLastKey() == VK_F6)
{
oRace.bDrawCameraTarget=0;
CameraDrawTarget(0);
oRace.ploop = DoomCamera;
SetActiveCamera(1);
HideMouse();
SetLoopFunc(oRace.ploop);
}
*/
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Race Window Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Race (i32x _iComponentID,i32x _iEvent)
{
var i32x i;
var i32x iKey;
if (_iComponentID == -1)
{
if(_iEvent == GUI_COMPONENT_KEYDOWN )
{
iKey = GetLastKey();
vInRace_ManageShortcut(iKey);
}
if(_iEvent == GUI_COMPONENT_REFRESH )
{
var i32x iCyclist,iServerSpeed;
var f32x fRacePerc;
// Update Tissot watch
vUpdate_TissotWatch();
if(oRace.iCompteurLag == 6)
{
oRace.iCompteurLag = 0;
if(GetNetLatency() > 8.0) // If Net latency greater than 8.0 : warning
{
SetContainerSprite(oRace.m_cLagIndicator,0,0);
SetComponentVisibleStatus(oRace.m_cLagIndicator,1);
}
else if(GetNetLatency() >= 4.0) // If 4.0 <= Net latency < 8.0 : little warning
{
SetContainerSprite(oRace.m_cLagIndicator,1,0);
SetComponentVisibleStatus(oRace.m_cLagIndicator,1);
}
else // If Net latency < 4.0 : No warning
{
SetComponentVisibleStatus(oRace.m_cLagIndicator,0);
}
}
else
oRace.iCompteurLag = oRace.iCompteurLag + 1;
if(oRace.iCompteurFPS == 15)
{
oRace.iCompteurFPS = 0;
if((oRace.iCurrentSpeed > 1) && IsAdmin())
{
if(GetFPS() < 3.0)
{
if(oRace.iCompteurRamageFPS < 5)
oRace.iCompteurRamageFPS = oRace.iCompteurRamageFPS + 1;
else
{
//special looprun
if(G_iLoopRunVersion==0)
{
g_oMenuServer.m_oServer<<speed(oRace.iCurrentSpeed / 2);
}
oRace.iCompteurRamageFPS = 0;
}
}
else
{
oRace.iCompteurRamageFPS = 0;
}
}
}
else
oRace.iCompteurFPS = oRace.iCompteurFPS + 1;
if(GetLineOnOff(Sound_eLine_Music))
{
if(IsMp3Ended())
{
NextMp3();
SetMp3Volume(g_oUser.m_fMp3Volume);
}
}
iServerSpeed = GetMSSpeed();
if(oRace.iCurrentSpeed != iServerSpeed)
{
if(iServerSpeed == 0)
{
// Pause mode
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
// Create Pause dialog
if(oRace.m_cPause == ID_NOT_CREATED)
{
oRace.m_cPause = Dialog_Pause_Constructor();
SetComponentPosition(oRace.m_cPause,225,225);
SetEvents(oRace.iPanelID,GUI_NoEvent);
}
}
else
{
// Remove Pause dialog
if(oRace.m_cPause != ID_NOT_CREATED)
{
Dialog_Pause_Destructor();
oRace.m_cPause = ID_NOT_CREATED;
SetEvents(oRace.iPanelID,GUI_Destroy | GUI_MouseRoll | GUI_MouseMove | GUI_MouseUp | GUI_MouseDown | GUI_MouseEnter | GUI_MouseLeave | GUI_Key | GUI_Refresh | GUI_Enable | GUI_Disable);
}
if(iServerSpeed == 1)
{
SetCheckboxState(oRace.iSpeedX1,1);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
}
else if(iServerSpeed == 2)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,1);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
}
else if(iServerSpeed == 4)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,1);
SetCheckboxState(oRace.iSpeedX8,0);
}
else if(iServerSpeed == 8)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,1);
}
}
oRace.iCurrentSpeed = iServerSpeed;
}
if (g_oInRaceServer.m_iCanStartRace!=0)
{
iCyclist = GetActiveCyclistPreRaceID();
fRacePerc = GetCyclistSplinePercentageDone(iCyclist);
var component pOld;
pOld = GetParserComponent();
SetParserComponent(GetObject(oRace.iProfileMeshID));
//ProfileCamera management
if (iGetProfileCameraMode()==0)
{
vSetProfileCameraPosition(fRacePerc);
vRefreshProfilePosition();
}
else if (oRace.bNeedRefreshProfilePosition)
{
vRefreshProfilePosition();
oRace.bNeedRefreshProfilePosition=0;
}
if (oRace.bNeedRefreshProfileZoom)
{
vRefreshProfileZoom();
oRace.bNeedRefreshProfileZoom=0;
}
SetParserComponent(pOld);
RefreshAIDrawInfos();
// Update event
InRaceEvents_UpdateListDisplay();
// Update chat
InRaceChat_UpdateDisplay();
//Groups position update
UpdateGroupsPositions();
UpdateSprintsPositions();
// Angle update
RefreshPictoAngle();
//wind update
RefreshPictoVent();
if(GetInRaceMode() != G_iRaceModeNormal)
{
// We're in time trial mode (team or individual)
// so update arrival time
Update_Sprint_List();
}
}
else
{
// stop race
// debug : special demo
if((oRacePodium.m_bQueryAsked == false)&&(oRacePodium.m_bPodiumSequenceLaunched == false))
{
// 16:9 displays
SetRaceViewport(0, 75, 800, 450);
// Hide all component
oRace.bDrawCameraTarget=0;
CameraDrawTarget(0);
SelectInRaceCamera(1);
SetActiveCamera(2);
oRace.ploop = VoidCamera;
SetLoopFunc(oRace.ploop);
//Explore all the components and test if they still exist
i = 0;
while(i<34)
{
if(IsComponentValid(i))
//If the component still exists, hide it
SetComponentVisibleStatus(i,0);
i = i + 1;
}
// Play podium sound and stop music
PlaySoundLoop(1,sbCyclistsSound[2]);
if(GetLineOnOff(Sound_eLine_Music))
{
SetLineOnOff(Sound_eLine_Music,false);
StopMp3();
oRace.bMusicWasOnOff = true;
}
else
oRace.bMusicWasOnOff = false;
// Hide lag indicator
SetComponentVisibleStatus(oRace.m_cLagIndicator,0);
SetPodiumInRaceMode();
SetActiveCamera(4);
// Init podium object
oRace.m_cPodium = InitObject(
"Podium",
Object_Podium_Create,
Object_Podium_Event
);
SetStackEvents(oRace.m_cPodium,GUI_Destroy | GUI_Refresh);
SetRefreshState(oRace.m_cPodium,6,0);
ResetQuery(QUERY_RACE_PODIUM);
GetQuery(g_oMenuServer.m_oServer,QUERY_RACE_PODIUM,"PodiumResult",CreatePodiumJoins, 0);
oRacePodium.m_bQueryAsked = true;
}
return 1;
}
}
}
else if(_iComponentID == oRace.iGroupsID)
{
if(_iEvent == GUI_RESET_SPRINTS )
{
PushEventOnChild(oRace.iProfileMeshID,GUI_RESET_SPRINTS);
}
}
else if(_iComponentID == oRace.iPanelTabID)
{
if((_iEvent >= GUI_SPRINT_EVENT_MIN )&&(_iEvent<=GUI_SPRINT_EVENT_MAX))
{
PushEventOnChild(oRace.iGroupsID,GUI_RESET_GROUPS);
PushEventOnChild(oRace.iProfileMeshID,_iEvent);
}
}
else if(_iComponentID == oRace.iPanelID)
{
if(_iEvent == GUI_RESET_SPRINTS )
{
oGroups.m_iActive = 1;
PushEventOnChild(oRace.iProfileMeshID,GUI_RESET_SPRINTS);
}
}
else if(_iComponentID == oRace.iPickingWindowID)
{
if(_iEvent == GUI_RESET_SPRINTS )
{
oGroups.m_iActive = 1;
PushEventOnChild(oRace.iProfileMeshID,GUI_RESET_SPRINTS);
}
}
else if(_iComponentID == oRace.iSpeedX1)
{
if(_iEvent == GUI_RADIOBUTTON_CHANGED)
{
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
g_oMenuServer.m_oServer<<speed(1);
}
}
else if(_iComponentID == oRace.iSpeedX2)
{
if(_iEvent == GUI_RADIOBUTTON_CHANGED)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX4,0);
SetCheckboxState(oRace.iSpeedX8,0);
g_oMenuServer.m_oServer<<speed(2);
}
}
else if(_iComponentID == oRace.iSpeedX4)
{
if(_iEvent == GUI_RADIOBUTTON_CHANGED)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX8,0);
g_oMenuServer.m_oServer<<speed(4);
}
}
else if(_iComponentID == oRace.iSpeedX8)
{
if(_iEvent == GUI_RADIOBUTTON_CHANGED)
{
SetCheckboxState(oRace.iSpeedX1,0);
SetCheckboxState(oRace.iSpeedX2,0);
SetCheckboxState(oRace.iSpeedX4,0);
g_oMenuServer.m_oServer<<speed(8);
}
}
else if(_iComponentID == oRace.m_cPodium)
{
if(_iEvent == GUI_DESTROY_ME)
{
// load page news
LoadPage(PAGE_ADMIN);
}
}
// Roll on cyclist picking window
else if (_iComponentID == oRace.iProfileMeshID)
{
if(_iEvent == GUI_COMPONENT_MOUSE_ROLL )
{
var i32x iMouseRoll;
iMouseRoll=5*(GetMouseRoll()/240)+(GetMouseRoll()/120)%2;
var i32x iStep;
if (iMouseRoll>0)
{
while(iMouseRoll>0)
{
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex+1));
iMouseRoll=iMouseRoll-1;
}
}
else
{
while(iMouseRoll<0)
{
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex-1));
iMouseRoll=iMouseRoll+1;
}
}
}
else if((_iEvent >= GUI_SPRINT_EVENT_MIN )&&(_iEvent<=GUI_SPRINT_EVENT_MAX))
{
SetActiveCamera(3);
SetCameraSprint((_iEvent-GUI_SPRINT_EVENT_MIN));
PushEventOnChild(oRace.iGroupsID,GUI_RESET_GROUPS);
}
}
else if (_iComponentID == oRace.iButtonZoomMoinsID)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex-1));
}
}
else if (_iComponentID == oRace.iButtonZoomPlusID)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
vRaceSetProfileZoom((oProfileCamera.m_iZoomIndex+1));
}
}
else if(_iComponentID == oRace.iButtonZoomDefID)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
vRaceSetProfileZoom(0);
}
}
else if (_iComponentID == oRace.iStrafeRight)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
vMoveProfileCamera(2.0,1);
}
}
else if (_iComponentID == oRace.iStrafeLeft)
{
if(_iEvent == GUI_COMPONENT_MOUSE_LDOWN )
PlaySound(0,sbClickSound[0]);
if(_iEvent == GUI_BUTTON_PRESSED )
{
vMoveProfileCamera(-2.0,1);
}
}
else if( _iComponentID == oRace.m_cChatButton)
{
if(_iEvent == GUI_BUTTON_PRESSED )
{
if(oRace.iChatWindow != ID_NOT_CREATED)
{
// Delete Chat Window
DeleteComponent(oRace.iChatWindow);
oRace.iChatWindow = ID_NOT_CREATED;
}
else
{
if(!oRacePodium.m_bPodiumSequenceLaunched)
{
// Create chat window
oRace.iChatWindow=InitObject("chat",oPanelInraceChat.oFunc.pcreate,oPanelInraceChat.oFunc.pevent);
SetComponentPosition(oRace.iChatWindow,50,200);
}
}
}
}
else if(_iEvent == GUI_QUIT_GAME)
PushEvent(GUI_QUIT_GAME);
return 1;
}
func void VoidCamera()
{
}
func void Page_Race_LoadData ()
{
// create waiting dialog
CreateDialog(DIALOG_LOADING_DATA);
// Get prerace data
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(310));
ResetQuery(QUERY_PRERACE_DATA);
GetQuery(g_oMenuServer.m_oServer,QUERY_PRERACE_DATA,"PreRace",PreRaceDataOk, 1);
}
func void PreRaceDataOk()
{
SetRaceViewport(oRace.o3DViewport.iX, oRace.o3DViewport.iY, oRace.o3DViewport.iW, oRace.o3DViewport.iH);
NetClient_SetInterface(g_oMenuServer.m_oServer,iClientInRace);
print("PreRace query received !\n");
// init race client
InitRaceClient();
// this will start the udp handshake
// when it is finished UDPHandshakeFinishedCB is called back
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(311));
// tutu debug : no udp authorization...
//StartHandshake(g_oInRaceServer.m_szRServerIP,g_oInRaceServer.m_iRServerPort,g_oInRaceServer.m_szResolServerPass ,UDPHandshakeFinishedCB);
if(g_oGameConfig.m_iSinglePlayer)
{
StartHandshake(g_oInRaceServer.m_szRServerIP,g_oInRaceServer.m_iRServerPort,"Cyanide",UDPHandshakeFinishedCB);
}
else
{
StartHandshake(g_oInRaceServer.m_szRServerIP,g_oInRaceServer.m_iRServerPort,g_oUser.m_szLogin ,UDPHandshakeFinishedCB);
}
}
func void UDPHandshakeFinishedCB(i32x _iSuccess)
{
#checkpoint UDPHandshakeFinishedCB
if (_iSuccess)
{
// ready to receive udp messages
g_oMenuServer.m_oServer << mStartUDP();
// Start wait for pos
Dialog_Loading_Data_SetText(GetLocalizedFromGMKey(312));
StartWaitForPos(WaitForPosFinishedCB);
}
else
{
// destroy waiting dialog
DestroyDialog();
// destroy race
StopRace();
}
}
func void WaitForPosFinishedCB(i32x _iSuccess)
{
#checkpoint WaitForPosFinishedCB
if (_iSuccess)
{
//init control panels
var i32x i;
i=0;
while(i<9)
{
oRace.a9_bControlPanelActivated[i]=0;
i=i+1;
}
// create inrace joins
CreateInraceJoins();
// destroy waiting dialog
DestroyDialog();
// StopSound(1,sbMusicSound[0]);
// StopSound(2,sbMusicSound[1]);
// load inrace page (call Race_Constructor)
InRace_LoadPage();
// inform c++ to change loop
StartRace();
//Fog management
CreateFogs(oRace.iNbFogs);
UpdateFogsParameters();
SelectFog(oRace.iCurrentFog);
//send a message to the menuserver to say i am ready to receive interface,events,sprints
g_oMenuServer.m_oServer<<mInRaceReady();
//special looprun
if(G_iLoopRunVersion)
{
g_oMenuServer.m_oServer<<speed(8);
//g_oMenuServer.m_oServer<<delta(20);
}
}
else
{
// destroy waiting dialog
DestroyDialog();
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Constructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Race_Constructor ()
{
print("debug : race constructor...\n");
oRace.iCurrentCamera=0;
oRace.bDrawCameraTarget=0;
oRace.bNeedRefreshProfileZoom=0;
oRace.bNeedRefreshProfilePosition=0;
oRace.iCurrentSpeed = 1;
//PlaySoundLoop(2,sbMusicSound[1]);
oRace.iWindowID = InitObject( oRace.szName, oRace.oFunc.pcreate,oRace.oFunc.pevent);
SetStackEvents(oRace.iWindowID,GUI_Refresh|GUI_Char|GUI_KeyDown); //416
SetRefreshState(oRace.iWindowID,10,0);
return oRace.iWindowID;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Destructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Race_Destructor ()
{
#checkpoint RACEDESTRUCTOR
// inform menu server
g_oMenuServer.m_oServer<<mStopUDP();
// Destroy inrace joins
DestroyInraceJoins();
// tutu debug : end of race...
NetClient_SetInterface(g_oMenuServer.m_oServer,iClientLogin);
StopRace();
ShowMouse();
//DisplayToolsPanel();
RazLoopFunc();
//StopSound(2,sbMusicSound[1]);
//PlaySoundLoop(2,sbMusicSound[1]);
DeleteComponent(oRace.iWindowID);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Race Window Init func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Race_InitMembers()
{
oRace.szName = "Race";
oRace.iNbCameras=9;
oRace.iPodiumNbCameras=6;
oRace.iNbFogs=4;
oRace.o3DViewport.iX = 0;
oRace.o3DViewport.iY = 98;
oRace.o3DViewport.iW = 695;
oRace.o3DViewport.iH = 502;
oRace.oFunc.pcreate = Race_Create;
oRace.oFunc.pevent = Race;
// Init pause dialog
Dialog_Pause_InitMembers();
}
func void RaceEnd_MessageBoxCallback(i32x _iResult)
{
// debug : special demo
if(G_iDemoVersion)
{
ExitNow();
}
// load page news
Manager_LoadPage(PAGE_ADMIN);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Create inrace joins
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void CreateInraceJoins()
{
// make sure we dont create a memory leak
DestroyInraceJoins();
// Weather
oRace.iCurrentFog = Database_GetIntData(QUERY_PRERACE_DATA,"STA_stage.gene_i_weather",ROW_INDEX,0);
if(oRace.iCurrentFog>oRace.iNbFogs)
oRace.iCurrentFog = oRace.iNbFogs-1;
else if(oRace.iCurrentFog<0)
oRace.iCurrentFog = 0;
//print("CurrentFog:");println(itoa(oRace.iCurrentFog));
// Create inrace joins
oRaceEvent.m_jEventID = Join_Constructor(QUERY_PRERACE_DATA,"DYN_event.IDevent");
oRaceEvent.m_jCyclistID = Join_Constructor(QUERY_PRERACE_DATA,"DYN_event.fkIDcyclist");
oRaceEvent.m_jEventsString = Join_Constructor(QUERY_PRERACE_DATA,"DYN_event.gene_sz_event");
oRaceEvent.m_jEventsType = Join_Constructor(QUERY_PRERACE_DATA,"DYN_event.gene_i_type");
oRaceEvent.m_jEventsDistance= Join_Constructor(QUERY_PRERACE_DATA,"DYN_event.gene_i_km");
g_stInraceJoins.m_iSprint_Name = Join_Constructor(QUERY_PRERACE_DATA, "STA_sprint.gene_sz_name");
g_stInraceJoins.m_iCyclist_LastName = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.gene_sz_lastname");
g_stInraceJoins.m_iCyclist_FirstName = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.gene_sz_firstname");
g_stInraceJoins.m_iCyclist_PreRaceIndex = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.prerace_i_cyclist");
g_stInraceJoins.m_bCyclist_Withdrawal = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.race_b_withdrawal");
g_stInraceJoins.m_iCyclist_TeamName = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.fkIDteam.DYN_team.gene_sz_name");
g_stInraceJoins.m_iCyclist_TeamIDName = Join_Constructor(QUERY_PRERACE_DATA, "DYN_team.gene_sz_name");
g_stInraceJoins.m_jTeam_szAbrev = Join_Constructor(QUERY_PRERACE_DATA, "DYN_team.gene_sz_abbreviation");
g_stInraceJoins.m_jTeam_iId = Join_Constructor(QUERY_PRERACE_DATA, "DYN_team.IDteam");
g_stInraceJoins.m_iStage_NameID = Join_Constructor(QUERY_PRERACE_DATA, "STA_stage.gene_strID_stage_name");
g_stInraceJoins.m_iCyclist_TeamId = Join_Constructor(QUERY_PRERACE_DATA, "DYN_cyclist.fkIDteam");
// Create palmares subset
// Create a subset to store sorting data
DatabaseSubset_Create( TEMP_DATABASE, QUERY_PRERACE_DATA);
Database_AddTables( TEMP_DATABASE, 1);
Table_SetName( TEMP_DATABASE, 0, "DYN_palmares");
TableSubset_SelectColumns( TEMP_DATABASE, 0, "*");
g_stInraceJoins.m_iPalmares_iCyclistId = Join_Constructor(TEMP_DATABASE, "DYN_palmares.fkIDcyclist");
g_stInraceJoins.m_iPalmares_iClassId = Join_Constructor(TEMP_DATABASE, "DYN_palmares.fkIDclassification");
g_stInraceJoins.m_iPalmares_fValue = Join_Constructor(TEMP_DATABASE, "DYN_palmares.gene_f_value");
// Jerseys
g_stInraceJoins.m_iPalmares_iClassCriterium = Join_Constructor(QUERY_PRERACE_DATA, "STA_classification.fkIDcriterium_classification.ALG_criterium_classification.gene_i_type");
g_stInraceJoins.m_iPalmares_iClassJerseyDesc = Join_Constructor(QUERY_PRERACE_DATA, "STA_classification.gene_sz_jersey_description");
g_stInraceJoins.m_iPalmares_iClassJerseyColor = Join_Constructor(QUERY_PRERACE_DATA, "STA_classification.game_ilist_RGB");
Table_Sort(QUERY_PRERACE_DATA,"DYN_cyclist","prerace_i_cyclist",1);
Table_Sort(QUERY_PRERACE_DATA,"STA_sprint","gene_f_km",1);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Destroy inrace joins
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void DestroyInraceJoins()
{
// Delete inrace join
if (oRaceEvent.m_jEventID)
{
Join_Destructor(oRaceEvent.m_jEventID);
Join_Destructor(oRaceEvent.m_jCyclistID);
Join_Destructor(oRaceEvent.m_jEventsString);
Join_Destructor(oRaceEvent.m_jEventsType);
Join_Destructor(oRaceEvent.m_jEventsDistance);
oRaceEvent.m_jEventID = 0;
oRaceEvent.m_jCyclistID = 0;
oRaceEvent.m_jEventsString = 0;
oRaceEvent.m_jEventsType = 0;
Join_Destructor(g_stInraceJoins.m_iSprint_Name);
Join_Destructor(g_stInraceJoins.m_iCyclist_LastName);
Join_Destructor(g_stInraceJoins.m_iCyclist_FirstName);
Join_Destructor(g_stInraceJoins.m_iCyclist_PreRaceIndex);
Join_Destructor(g_stInraceJoins.m_bCyclist_Withdrawal);
Join_Destructor(g_stInraceJoins.m_iCyclist_TeamName);
Join_Destructor(g_stInraceJoins.m_iStage_NameID);
Join_Destructor(g_stInraceJoins.m_iCyclist_TeamIDName);
Join_Destructor(g_stInraceJoins.m_jTeam_szAbrev);
Join_Destructor(g_stInraceJoins.m_jTeam_iId);
Join_Destructor(g_stInraceJoins.m_iCyclist_TeamId);
Join_Destructor(g_stInraceJoins.m_iPalmares_iCyclistId);
Join_Destructor(g_stInraceJoins.m_iPalmares_iClassId);
Join_Destructor(g_stInraceJoins.m_iPalmares_fValue);
Join_Destructor(g_stInraceJoins.m_iPalmares_iClassJerseyDesc);
Join_Destructor(g_stInraceJoins.m_iPalmares_iClassJerseyColor);
Join_Destructor(g_stInraceJoins.m_iPalmares_iClassCriterium);
g_stInraceJoins.m_iCyclist_PreRaceIndex = 0;
g_stInraceJoins.m_iSprint_Name = 0;
g_stInraceJoins.m_iCyclist_LastName = 0;
g_stInraceJoins.m_iCyclist_FirstName = 0;
g_stInraceJoins.m_bCyclist_Withdrawal = 0;
g_stInraceJoins.m_iCyclist_TeamName = 0;
g_stInraceJoins.m_iStage_NameID = 0;
g_stInraceJoins.m_iCyclist_TeamIDName = 0;
g_stInraceJoins.m_jTeam_szAbrev = 0;
g_stInraceJoins.m_iCyclist_TeamId = 0;
g_stInraceJoins.m_jTeam_iId = 0;
g_stInraceJoins.m_iPalmares_iClassCriterium = 0;
g_stInraceJoins.m_iPalmares_iCyclistId = 0;
g_stInraceJoins.m_iPalmares_iClassId = 0;
g_stInraceJoins.m_iPalmares_fValue = 0;
g_stInraceJoins.m_iPalmares_iClassJerseyDesc = 0;
g_stInraceJoins.m_iPalmares_iClassJerseyColor = 0;
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Dialog_Pause Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Dialog_Pause_Create ()
{
var i32x iID;
// Get dialbox context
if(oDialog_Pause.cComponent != g_poNullComponent)
{
print("Warning : Old Loading dialbox not deleted !\n");
}
oDialog_Pause.cComponent = GetParserComponent();
SetComponentNumber(5);
// background
iID=Init_LibObject_FilledCadre(tCadreDialbox,400,150);
oDialog_Pause.iBackgroundID=iID;
SetEvents(iID,GUI_NoEvent);
// text
iID=InitContainer(tFontArial);
SetComponentSize(iID,280,100);
SetContainerText(iID,GetLocalizedFromGMKey(447)); // Pause
SetComponentPosition(iID,70,40);
SetEvents(iID,GUI_NoEvent);
oDialog_Pause.iMessageTextID=iID;
// Hour picto background
iID=InitContainer(t_bckpicto_hour);
SetComponentPosition(iID,20,40);
iID=InitContainer(t_picto_hour);
SetComponentPosition(iID,20,40);
SetContainerRotationCenter(iID,16,16);
SetEvents(iID,GUI_NoEvent);
oDialog_Pause.iPictoID=iID;
//Parameters : Param(0) Component ID
//Parameters : Param(1-11) i32x _x,i32x _y,f32x _fw,f32x _fh,f32x _fOffset,f32x _fAngle,ui8x _r,ui8x _g,ui8x _b,ui8x _a,f32x _fFrameOffset
oDialog_Pause.m_fHour[0] = AddFrame(iID, 0, 0, 1.0, 1.0, 0.0, 0.0, 0, 0, 0, 0, 0.0);
oDialog_Pause.m_fHour[1] = AddFrame(iID, 0, 0, 1.0, 1.0, 0.0, 0.0, 0, 0, 0, 0, 0.5);
SetAnimationFlags(iID,MSL_Rotation);
SetAnimationSpeed(iID,0.01);
GotoFirstFrame(iID);
SetNextFrame(iID,oDialog_Pause.m_fHour[0]);
StartAnimation(iID);
// resize the panel*/
SetObjectSize(400,150);
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
// Dialog_Pause Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Dialog_Pause_Event (i32x _iComponentID, i32x _iEvent)
{
if(_iComponentID==-1)
{
if(_iEvent == GUI_COMPONENT_DESTRUCTOR)
{
// Raz context
oDialog_Pause.cComponent = g_poNullComponent;
}
}
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Constructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Dialog_Pause_Constructor ()
{
oDialog_Pause.iDialogID=InitObject(oDialog_Pause.szName,oDialog_Pause.oFunc.pcreate,oDialog_Pause.oFunc.pevent);
SetStackEvents(oDialog_Pause.iDialogID,GUI_Destroy);
return oDialog_Pause.iDialogID;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Destructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Dialog_Pause_Destructor ()
{
// delete the dialog
DeleteComponent(oDialog_Pause.iDialogID);
oDialog_Pause.iDialogID = ID_NOT_CREATED;
oDialog_Pause.iMessageTextID = ID_NOT_CREATED;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Dialog_Pause Init member
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Dialog_Pause_InitMembers ()
{
oDialog_Pause.szName = "Dialog_Pause";
oDialog_Pause.oFunc.pcreate = Dialog_Pause_Create;
oDialog_Pause.oFunc.pevent = Dialog_Pause_Event;
}