📄 te_flow.cpp
字号:
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// Tactical Engagement - Robin Heydon
//
// Implements the user interface for the tactical engagement section
// of falcon 4.0
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <ddraw.h>
#include "falclib.h"
#include "unit.h"
#include "team.h"
#include "CmpGlobl.h"
#include "CampCell.h"
#include "CampTerr.h"
#include "Listadt.h"
#include "objectiv.h"
#include "Campaign.h"
#include "campmap.h"
#include "campwp.h"
#include "campstr.h"
#include "squadron.h"
#include "feature.h"
#include "pilot.h"
#include "team.h"
#include "find.h"
#include "misseval.h"
#include "cmpclass.h"
#include "ui95_dd.h"
#include "chandler.h"
#include "ui95_ext.h"
#include "AirUnit.h"
#include "uicomms.h"
#include "userids.h"
#include "classtbl.h"
#include "textids.h"
#include "tac_class.h"
#include "te_defs.h"
#include "division.h"
#include "cmap.h"
#include "ui_cmpgn.h"
#include "MsgInc\RequestAircraftSlot.h"
#include "vu2.h"
#include "F4Find.h"
#include "F4Error.h"
#include "gps.h"
#ifdef CAMPTOOL
// Renaming tool stuff
extern int gRenameIds;
#endif CAMPTOOL
#pragma warning(disable : 4127) // Conditional Expression is constant warning
extern C_Map *gMapMgr;
extern int MainLastGroup,TacLastGroup;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SaveAFile(long TitleID,_TCHAR *filespec,_TCHAR *excludelist[],void (*YesCB)(long,short,C_Base*),void (*NoCB)(long,short,C_Base*));
static void update_taceng_clock (void);
static void TACNewCB (long ID, short hittype, C_Base *control);
static void TACEditCB (long ID, short hittype, C_Base *control);
static void TACAcceptCB (long ID, short hittype, C_Base *control);
static void TACHostCB (long ID, short hittype, C_Base *control);
static void TACInfoCB (long ID, short hittype, C_Base *control);
static void TACExitCB (long ID, short hittype, C_Base *control);
static void TACRevertCB (long ID, short hittype, C_Base *control);
static void TACSaveAsCB (long ID, short hittype, C_Base *control);
void SetupInfoWindow(void (*tOkCB)(), void (*tCancelCB)());
void SetDeleteCallback(void (*cb)(long,short,C_Base*));
void TacticalEngagementSetup (void);
void PauseTacticalEngagement (void);
void MakeTacticalEdit (void);
void RemoveTacticalEdit (void);
void SetupMapMgr();
void LoadTacticalWindows(void);
void LoadTacEngSelectWindows();
void SetTimeCompression (int);
void CleanupTacticalEngagementUI();
void PickTeamColors();
void InitTimeCompressionBox(long compression);
void UpdateOwners();
extern long OwnershipChanged;
void tactical_edit_mission (tactical_mission *);
static void tactical_revert_mission (void);
void SetupInfoWindow(void (*tOkCB)(), void (*tCancelCB)());
void SetupOccupationMap (void);
void DelSTRFileCB(long ID,short hittype,C_Base *control);
void DelDFSFileCB(long ID,short hittype,C_Base *control);
void DelLSTFileCB(long ID,short hittype,C_Base *control);
void DelCamFileCB(long ID,short hittype,C_Base *control);
void DelTacFileCB(long ID,short hittype,C_Base *control);
void DelTGAFileCB(long ID,short hittype,C_Base *control);
void DelVHSFileCB(long ID,short hittype,C_Base *control);
void DelKeyFileCB(long ID,short hittype,C_Base *control);
void SetupTeamData(void);
void OpenBuilderWindowCB(long ID,short hittype,C_Base *base);
void OpenMissionWindowCB(long ID,short hittype,C_Base *base);
void AreYouSure(long TitleID,long MessageID,void (*OkCB)(long,short,C_Base*),void (*CancelCB)(long,short,C_Base*));
void AreYouSure(long TitleID,_TCHAR *text,void (*OkCB)(long,short,C_Base*),void (*CancelCB)(long,short,C_Base*));
BOOL CheckExclude(_TCHAR *filename,_TCHAR *directory,_TCHAR *ExcludeList[],_TCHAR *extension);
void VerifyDelete(long TitleID, void (*YesCB)(long,short,C_Base*),void (*NoCB)(long,short,C_Base*));
void GetTacticalFileList();
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern GlobalPositioningSystem
*gGps;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int
tactical_debriefing = FALSE,
tactical_mission_loaded = FALSE;
extern _TCHAR *TEExcludeList[];
extern uchar gSelectedTeam;
extern long OwnershipChanged;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void hookup_flow_buttons (C_Window *winme)
{
C_Button
*ctrl;
// New Mission Button
ctrl = (C_Button *) winme->FindControl (TAC_NEW_MISSION);
if (ctrl)
{
ctrl->SetCallback(TACNewCB);
}
ctrl = (C_Button *) winme->FindControl (TAC_EDIT);
if (ctrl)
{
ctrl->SetCallback(TACEditCB);
}
// Accept Button
ctrl = (C_Button *) winme->FindControl (SINGLE_COMMIT_CTRL);
if (ctrl)
{
ctrl->SetCallback(TACAcceptCB);
}
// Accept Button
ctrl = (C_Button *) winme->FindControl (COMMS_COMMIT_CTRL);
if (ctrl)
{
ctrl->SetCallback(TACAcceptCB);
}
// Host Button
ctrl = (C_Button *) winme->FindControl (TAC_HOST);
if (ctrl)
{
ctrl->SetCallback (TACHostCB);
ctrl->SetFlagBitOn (C_BIT_INVISIBLE);
}
// Info Button
ctrl = (C_Button *) winme->FindControl (TAC_INFO);
if (ctrl)
{
ctrl->SetCallback(TACInfoCB);
}
// Exit Button
ctrl = (C_Button *) winme->FindControl (TAC_EXIT);
if (ctrl)
{
ctrl->SetCallback (TACExitCB);
}
// Revert Button
ctrl = (C_Button *) winme->FindControl (TAC_RESTORE_CTRL);
if (ctrl)
{
ctrl->SetCallback (TACRevertCB);
}
// SaveAS Button
ctrl = (C_Button *) winme->FindControl (TAC_SAVE_CTRL);
if (ctrl)
{
ctrl->SetCallback (TACSaveAsCB);
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void ActivateTacMissionSchedule()
{
C_Window *win;
C_Button *btn;
win=gMainHandler->FindWindow(TAC_PLAY_SCREEN);
if(win)
{
btn=(C_Button*)win->FindControl(TAC_MISS_MAIN_CTRL);
if(btn)
OpenMissionWindowCB(btn->GetID(),C_TYPE_LMOUSEUP,btn);
// Select 1st mission
}
SetupTeamData();
SetupOccupationMap ();
}
void ActivateTacMissionBuilder()
{
C_Window *win;
C_Button *btn;
win=gMainHandler->FindWindow(TAC_EDIT_SCREEN);
if(win)
{
btn=(C_Button*)win->FindControl(BUILDER_MAIN_CTRL);
if(btn)
OpenBuilderWindowCB(btn->GetID(),C_TYPE_LMOUSEUP,btn);
}
SetupTeamData();
SetupOccupationMap ();
}
static void TACNewCB (long, short hittype, C_Base *control)
{
if (hittype != C_TYPE_LMOUSEUP)
{
return;
}
LoadTacticalWindows();
gMainHandler->EnterCritical();
gMainHandler->DisableWindowGroup(100);
gMainHandler->DisableSection(100);
gMainHandler->SetSection(200);
if (current_tactical_mission)
{
delete current_tactical_mission;
}
TheCampaign.EndCampaign();
current_tactical_mission = new tactical_mission ("campaign\\save\\te_new.tac");
#ifdef CAMPTOOL
if (gRenameIds)
SendMessage(gMainHandler->GetAppWnd(), FM_LOAD_CAMPAIGN, 0, game_TacticalEngagement);
else
#endif
tactical_edit_mission (current_tactical_mission);
gMainHandler->EnableWindowGroup(control->GetGroup());
ActivateTacMissionBuilder();
gSelectedTeam=1;
PickTeamColors();
gMainHandler->LeaveCritical();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACEditCB (long ID, short hittype, C_Base *control)
{
if (hittype != C_TYPE_LMOUSEUP)
{
return;
}
if (!current_tactical_mission)
{
TACNewCB (ID, hittype, control);
return;
}
LoadTacticalWindows();
gMainHandler->EnterCritical();
gMainHandler->DisableWindowGroup(100);
gMainHandler->DisableSection(100);
gMainHandler->SetSection(200);
#ifdef CAMPTOOL
if (gRenameIds)
SendMessage(gMainHandler->GetAppWnd(), FM_LOAD_CAMPAIGN, 0, game_TacticalEngagement);
else
#endif
tactical_edit_mission (current_tactical_mission);
gMainHandler->EnableWindowGroup(control->GetGroup());
ActivateTacMissionBuilder();
gSelectedTeam=1;
PickTeamColors();
gMainHandler->LeaveCritical();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACCancelJoinCB(void)
{
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACReallyAcceptCB (void)
{
if (!current_tactical_mission)
{
return;
}
SetCursor(gCursors[CRSR_WAIT]);
LoadTacticalWindows();
gMainHandler->EnterCritical();
tactical_accept_mission ();
gMainHandler->LeaveCritical();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACAcceptCB (long, short hittype, C_Base *)
{
if (hittype != C_TYPE_LMOUSEUP)
{
return;
}
SetCursor(gCursors[CRSR_WAIT]);
if (!current_tactical_mission)
{
return;
}
if(gCommsMgr->Online())
SetupInfoWindow(TACReallyAcceptCB,TACCancelJoinCB);
else
TACReallyAcceptCB();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void UpdateVCs()
{
victory_condition *vc;
if (current_tactical_mission && gMapMgr)
{
vc=current_tactical_mission->get_first_unfiltered_victory_condition();
while(vc)
{
gMapMgr->UpdateVC(vc);
vc=current_tactical_mission->get_next_unfiltered_victory_condition();
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACExitCB (long, short hittype, C_Base *)
{
if (hittype != C_TYPE_LMOUSEUP)
{
return;
}
tactical_mission_loaded = FALSE;
RemoveTacticalEdit();
gMainHandler->EnterCritical();
TheCampaign.EndCampaign ();
CleanupTacticalEngagementUI ();
TacLastGroup = 0;
gMainHandler->DisableSection(200);
gMainHandler->SetSection(100);
gMainHandler->EnableWindowGroup(100);
gMainHandler->EnableWindowGroup(MainLastGroup);
gMainHandler->LeaveCritical();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void TACInfoCB (long, short hittype, C_Base *)
{
if (hittype != C_TYPE_LMOUSEUP)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -