📄 campaign.cpp
字号:
gMainHandler->ShowWindow(win);
gMainHandler->WindowToFront(win);
gMainHandler->LeaveCritical();
}
}
}
// Autosave the game, if campaign
CampaignAutoSave(FalconLocalGame->GetGameType());
gMusic->ClearQ();
gMusic->FadeOut_Stop();
// Force Compliance... since they already agreed before
if(gCommsMgr && gCommsMgr->Online())
{
PlayerOptions.ComplyWRules(CurrRules.GetRules());
PlayerOptions.SaveOptions();
}
}
static void CloseCampaignWindowCB(long,short hittype,C_Base *)
{
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
if(CampaignLastGroup)
{
gMainHandler->DisableWindowGroup(CampaignLastGroup);
win=gMainHandler->FindWindow(CP_TOOLBAR);
if(win)
win->HideCluster(CampaignLastGroup);
CampaignLastGroup=0;
}
}
static void GenericCloseCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
gMainHandler->DisableWindowGroup(control->GetGroup());
}
static void MapMgrDrawCB(long,short,C_Base *)
{
//gMapMgr->SetFlags(I_NEED_TO_DRAW_MAP);
//gMapMgr->DrawMap();
}
static void MapMgrMoveCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_MOUSEMOVE)
return;
gMapMgr->MoveCenter(-((C_MapMover *)control)->GetHRange(),-((C_MapMover *)control)->GetVRange());
control->Parent_->RefreshClient(0);
}
static void OpenFullMapCB(long,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
Leave=UI_Enter(control->Parent_);
win=gMainHandler->FindWindow(CB_FULLMAP_WIN);
if(win)
{
gMapMgr->SetWindow(win);
gMapMgr->DrawMap();
}
win=gMainHandler->FindWindow(CP_PUA_MAP);
if(win)
gMainHandler->HideWindow(win);
gMainHandler->EnableWindowGroup(control->GetGroup());
UI_Leave(Leave);
}
static void CloseFullMapCB(long,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
Leave=UI_Enter(control->Parent_);
gMainHandler->DisableWindowGroup(control->GetGroup());
gMainHandler->DisableWindowGroup(6401);
StupidHackToCloseCSECT=0;
win=gMainHandler->FindWindow(CP_PUA_MAP);
if(win)
{
gMapMgr->SetWindow(win);
gMapMgr->DrawMap();
gMainHandler->ShowWindow(win);
gMainHandler->WindowToFront(win);
}
UI_Leave(Leave);
}
static void OpenCampaignCB(long,short hittype,C_Base *control)
{
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
win=gMainHandler->FindWindow(CP_TOOLBAR);
if(CampaignLastGroup != 0 && CampaignLastGroup != control->GetGroup())
{
gMainHandler->DisableWindowGroup(CampaignLastGroup);
if(win)
win->HideCluster(CampaignLastGroup);
}
if(CampaignLastGroup != control->GetGroup())
{
gMainHandler->EnableWindowGroup(control->GetGroup());
CampaignLastGroup=control->GetGroup();
if(win)
win->UnHideCluster(CampaignLastGroup);
}
CheckCampaignFlyButton();
}
BOOL CampaignClockCB(C_Base *me)
{
long curtime;
if(me == NULL) return(FALSE);
// curtime=TheCampaign.CurrentTime/VU_TICS_PER_SECOND;
curtime=vuxGameTime/VU_TICS_PER_SECOND;
if(((C_Clock*)me)->GetTime() != curtime)
{
((C_Clock*)me)->SetTime(curtime);
me->Refresh();
return(TRUE);
}
return(FALSE);
}
extern _TCHAR *ObjStr[5];
void CleanupCampaignUI()
{
C_Window *win;
C_Blip *blip;
C_Bitmap *bmp;
int i;
InCleanup=1;
ReadyToPlayMovie=FALSE;
gCurrentFlightID=FalconNullId;
if (gMainHandler)
{
gMainHandler->EnterCritical();
gMainHandler->RemoveUserCallback(CampaignListCB);
gMainHandler->RemoveUserCallback(CampaignSoundEventCB);
if(gGps)
{
gGps->Cleanup();
delete gGps;
gGps=NULL;
}
if(gMapMgr)
{
gMapMgr->Cleanup();
delete gMapMgr;
gMapMgr=NULL;
}
if(gATOPackage)
{
gATOPackage->DeleteBranch(gATOPackage->GetRoot());
}
if(gATOAll)
{
gATOAll->DeleteBranch(gATOAll->GetRoot());
}
if(gOOBTree)
{
gOOBTree->DeleteBranch(gOOBTree->GetRoot());
}
/* if(gTaskList)
{
while(gTaskList)
{
last=gTaskList;
gTaskList=gTaskList->Next;
if(last->Label_)
{
last->Label_->Cleanup();
delete last->Label_;
}
delete last;
}
gTaskList=NULL;
}
*/
win=gMainHandler->FindWindow(STRAT_WIN);
if(win)
{
bmp=(C_Bitmap*)win->FindControl(PAK_REGION);
if(bmp)
bmp->SetImage((long)NULL);
}
if(PAKMap)
{
C_Resmgr *mgr;
mgr=PAKMap->Owner;
mgr->Cleanup();
delete mgr;
PAKMap=NULL;
}
for(i=0;i<5;i++)
{
if (ObjStr[i])
{
delete ObjStr[i];
}
ObjStr[i]=NULL;
}
if(gUIViewer)
{
delete gUIViewer;
gUIViewer = NULL;
}
win=gMainHandler->FindWindow(CP_SUA);
if(win)
{
DeleteGroupList(CP_SUA);
blip=(C_Blip*)win->FindControl(9000000);
if(blip)
blip->RemoveAll();
}
gMainHandler->LeaveCritical();
}
}
void CleanupTacticalEngagementUI()
{
C_Window *win;
C_Blip *blip;
InCleanup=1;
if(te_restore_map)
{
delete te_restore_map;
te_restore_map=NULL;
}
ReadyToPlayMovie=FALSE;
gCurrentFlightID=FalconNullId;
if (gMainHandler)
{
gMainHandler->EnterCritical();
gMainHandler->RemoveUserCallback(TacEngListCB);
gMainHandler->RemoveUserCallback(CampaignSoundEventCB);
if(gGps)
{
gGps->Cleanup();
delete gGps;
gGps=NULL;
}
if(gMapMgr)
{
gMapMgr->Cleanup();
delete gMapMgr;
gMapMgr=NULL;
}
if(gATOPackage)
{
gATOPackage->DeleteBranch(gATOPackage->GetRoot());
}
if(gATOAll)
{
gATOAll->DeleteBranch(gATOAll->GetRoot());
}
if(gOOBTree)
{
gOOBTree->DeleteBranch(gOOBTree->GetRoot());
}
CleanupVCArgLists();
if(gVCTree)
gVCTree->DeleteBranch(gVCTree->GetRoot());
/* if(gTaskList)
{
while(gTaskList)
{
last=gTaskList;
gTaskList=gTaskList->Next;
if(last->Label_)
{
last->Label_->Cleanup();
delete last->Label_;
}
delete last;
}
gTaskList=NULL;
}
*/
if(gUIViewer)
{
delete gUIViewer;
gUIViewer = NULL;
}
win=gMainHandler->FindWindow(TAC_MISSION_SUA);
if(win)
{
DeleteGroupList(TAC_MISSION_SUA);
blip=(C_Blip*)win->FindControl(9000000);
if(blip)
blip->RemoveAll();
}
gMainHandler->LeaveCritical();
}
}
void EndCommitCB(long,short hittype,C_Base *)
{
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
CampaignAutoSave(FalconLocalGame->GetGameType());
gMusic->ClearQ();
gMusic->FadeOut_Stop();
gMusic->ToggleStream();
PlayUIMusic();
gMainHandler->EnterCritical();
if(CampaignLastGroup)
{
gMainHandler->DisableWindowGroup(CampaignLastGroup);
win=gMainHandler->FindWindow(CP_TOOLBAR);
if(win)
win->HideCluster(CampaignLastGroup);
CampaignLastGroup=0;
}
gMainHandler->DisableWindowGroup(200);
gMainHandler->DisableSection(200);
gMainHandler->SetSection(100);
gMainHandler->EnableWindowGroup(100);
gMainHandler->EnableWindowGroup(MainLastGroup);
gMainHandler->LeaveCritical();
FalconLocalSession->SetPlayerSquadron(NULL);
FalconLocalSession->SetPlayerFlight(NULL);
CleanupCampaignUI();
ShutdownCampaign();
SelectScenarioCB(CS_LOAD_SCENARIO1,C_TYPE_LMOUSEUP,NULL);
gCommsMgr->SetCampaignFlag(game_PlayerPool);
}
static void SmallMapZoomInCB(long,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
if ((hittype != C_TYPE_LMOUSEUP) && (hittype != C_TYPE_REPEAT))
return;
Leave=UI_Enter(control->Parent_);
gMapMgr->ZoomIn();
gMapMgr->DrawMap();
UI_Leave(Leave);
}
static void SmallMapZoomOutCB(long,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
if ((hittype != C_TYPE_LMOUSEUP) && (hittype != C_TYPE_REPEAT))
return;
Leave=UI_Enter(control->Parent_);
gMapMgr->ZoomOut();
gMapMgr->DrawMap();
UI_Leave(Leave);
}
void OpenPlannerWindowCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
gMainHandler->EnableWindowGroup(control->GetGroup());
}
static void OpenATOWindowCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
gGps->SetAllowed(gGps->GetAllowed() | UR_ATO | UR_SQUADRON);
gGps->Update();
gMainHandler->EnableWindowGroup(control->GetGroup());
}
static void OpenBriefingWindowCB(long,short hittype,C_Base *control)
{
C_Window *win;
if(hittype != C_TYPE_LMOUSEUP)
return;
if(gSelectedFlightID == FalconNullId)
return;
win=gMainHandler->FindWindow(BRIEF_WIN);
if(win)
{
BuildCampBrief(win);
}
gMainHandler->EnableWindowGroup(control->GetGroup());
}
void CheckPlayersFlight(FalconSessionEntity *session)
{
if(!session)
return;
UpdateMissionWindow(CB_MISSION_SCREEN);
UpdateMissionWindow(TAC_AIRCRAFT);
}
void PickCampaignPlaneCB(long ID,short hittype,C_Base *)
{
int playerPlane;
Flight flight;
if(hittype != C_TYPE_LMOUSEUP)
return;
flight=(Flight)vuDatabase->Find(gCurrentFlightID);
if(!flight)
return;
if ((gCommsMgr) && (gCommsMgr->Online ()))
{
// Don't care about restricting access when online
}
else
{
if(GetFlightStatusID(flight) >= _MIS_EGRESS)
{
return;
}
}
switch(ID)
{
case CB_1_1:
case CB_2_1:
case CB_3_1:
case CB_4_1:
playerPlane=0;
break;
case CB_2_2:
case CB_3_2:
case CB_4_2:
playerPlane=1;
break;
case CB_3_3:
case CB_4_3:
playerPlane=2;
break;
case CB_4_4:
playerPlane=3;
break;
default:
return;
break;
}
// playerPlane = flight->GetAdjustedAircraftSlot(playerPlane);
if (!gTimeModeServer)
{
RequestACSlot(flight, 0, static_cast<uchar>(playerPlane), 0, 0, 1);
}
}
void UpdateEventBlipsCB(long, short,C_Base *control)
{
C_Window *win;
C_Blip *Blip;
F4CSECTIONHANDLE *Leave;
win=control->Parent_;
if(win)
{
Blip=(C_Blip*)win->FindControl(9000000);
if(Blip)
{
Leave=UI_Enter(win);
if(control->GetUserNumber(_UI95_TIMER_COUNTER_) & 1)
Blip->BlinkLast();
if(control->GetUserNumber(_UI95_TIMER_COUNTER_) < 1)
{
Blip->Update(vuxGameTime / (VU_TICS_PER_SECOND*60));
control->SetUserNumber(_UI95_TIMER_COUNTER_,control->GetUserNumber(_UI95_TIMER_DELAY_));
}
UI_Leave(Leave);
}
}
control->SetUserNumber(_UI95_TIMER_COUNTER_,control->GetUserNumber(_UI95_TIMER_COUNTER_)-1);
}
void OpenCampaignCommsCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
if(!gCommsMgr->Online())
gMainHandler->EnableWindowGroup(control->GetUserNumber(1));
else
{
gNewMessage=NULL;
gMainHandler->EnableWindowGroup(control->GetUserNumber(0));
}
}
void HistoryPlayForward(long,short hittype,C_Base *control)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -