⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 te_flow.cpp

📁 空战游戏flacon源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	{
		return;
	}

	SetupInfoWindow(NULL, NULL);
	// gMainHandler->EnableWindowGroup (control->GetGroup ());

	//MonoPrint ("Info\n");
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

static void TACHostCB (long, short hittype, C_Base *)
{
	if (hittype != C_TYPE_LMOUSEUP)
	{
		return;
	}

	if (current_tactical_mission)
	{
		tactical_accept_mission ();
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

static void TACRevertCB (long, short hittype, C_Base *)
{
	if (hittype != C_TYPE_LMOUSEUP)
	{
		return;
	}

	tactical_revert_mission ();
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

static void TACSaveFileCB (long,short hittype,C_Base *control)
{
	C_EditBox *edit_box;
	C_Window *win;

	char buffer[100];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	win=gMainHandler->FindWindow(SAVE_WIN);
	if(!win)
		return;

	gMainHandler->HideWindow(win);
	gMainHandler->HideWindow(control->Parent_);

	edit_box = (C_EditBox*) win->FindControl (FILE_NAME);
	if (edit_box)
	{
		_tcscpy (buffer, edit_box->GetText ());
	}

	current_tactical_mission->save (buffer);
	GetTacticalFileList();
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

static void TACVerifySaveFileCB (long ID,short hittype,C_Base *control)
{
	C_EditBox *edit_box;
	FILE *fp;

	char buffer[MAX_PATH];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	edit_box = (C_EditBox*) control->Parent_->FindControl (FILE_NAME);
	if (edit_box)
	{
		_stprintf(buffer,"%s\\%s.tac",FalconCampUserSaveDirectory,edit_box->GetText ());
		fp=fopen(buffer,"r");
		if(fp)
		{
			fclose(fp);
			if(CheckExclude(buffer,FalconCampUserSaveDirectory,TEExcludeList,"tac"))
				AreYouSure(TXT_ERROR,TXT_CANT_OVERWRITE,CloseWindowCB,CloseWindowCB);
			else
				AreYouSure(TXT_SAVE_ENGAGEMENT,TXT_FILE_EXISTS,TACSaveFileCB,CloseWindowCB);
		}
		else
		{
			if(CheckExclude(buffer,FalconCampUserSaveDirectory,TEExcludeList,"tac"))
				AreYouSure(TXT_ERROR,TXT_CANT_OVERWRITE,CloseWindowCB,CloseWindowCB);
			else
				TACSaveFileCB(ID,hittype,control);
		}
	}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void LoadSaveSelectFileCB(long,short hittype,C_Base *control)
{
	C_EditBox *ebox;
	C_Button *btn;

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(control)
	{
		btn=(C_Button*)control;
		ebox=(C_EditBox*)btn->Parent_->FindControl(FILE_NAME);
		if(ebox)
		{
			ebox->Refresh();
			ebox->SetText(btn->GetText(C_STATE_0));
			ebox->Refresh();
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

static void TACSaveAsCB (long, short hittype, C_Base *)
{
	_TCHAR buffer[MAX_PATH];

	if (hittype != C_TYPE_LMOUSEUP)
		return;

	if(OwnershipChanged)
		UpdateOwners();

	sprintf (buffer, "%s\\*.tac", FalconCampUserSaveDirectory);

	SetDeleteCallback(DelTacFileCB);
	SaveAFile(TXT_SAVE_ENGAGEMENT,buffer,TEExcludeList,TACVerifySaveFileCB,CloseWindowCB);
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void tactical_play_setup()
{
	short i;

	if (!gMainHandler)
		return;

//	MonoPrint ("Tactical Play Setup\n");

	gMainHandler->EnterCritical();
	gMainHandler->DisableWindowGroup(100);
	gMainHandler->DisableSection(100);
	gMainHandler->SetSection(200);
	gMainHandler->EnableWindowGroup(3025);

	tactical_update_campaign_entities ();

	TheCampaign.Flags |= CAMP_TACTICAL;


	// MONUMENTOUS HACK to get team color & Flag initialized (If they aren't already)
	for(i=0;i<NUM_TEAMS;i++)
	{
		if(TeamInfo[i])
		{
			if(!TeamInfo[i]->GetFlag())
				TeamInfo[i]->SetFlag(static_cast<uchar>(i));
			if(!TeamInfo[i]->GetColor())
				TeamInfo[i]->SetColor(static_cast<uchar>(i));
			if(i && !(TeamInfo[i]->flags & TEAM_ACTIVE))
				TeamInfo[i]->flags |= TEAM_ACTIVE;
		}
	}

	update_taceng_clock ();

	TacticalEngagementSetup ();

	update_missions_details (TAC_AIRCRAFT);

	gGps->SetAllowed(0xffffffff);

	if(current_tactical_mission->get_type() == tt_engagement)
	{
		InitTimeCompressionBox(1);
		SetTimeCompression (1);
	}
	else
	{
		//PauseTacticalEngagement();
		InitTimeCompressionBox(0);
		SetTimeCompression (0);
	}
	ActivateTacMissionSchedule();
	gMainHandler->LeaveCritical();
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void tactical_accept_mission (void)
{
	if (current_tactical_mission)
	{
		current_tactical_mission->load ();
	}
	else
	{
		// Cannot accept a new mission - sorry
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void tactical_restart_mission (void)
{
	tactical_type
		current_type;

	if (current_tactical_mission)
	{
		current_type = current_tactical_mission->get_type ();

		current_tactical_mission->load ();

		current_tactical_mission->set_type (current_type);
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void restart_tactical_engagement (void)
{
	if(current_tactical_mission->get_type() != tt_engagement)
	{
		TheCampaign.Suspend();
		InitTimeCompressionBox(0);
		SetTimeCompression (0);
	}

	gMainHandler->SetSection(200);

	LoadTacEngSelectWindows();
	LoadTacticalWindows ();

	tactical_play_setup ();

	if(TacLastGroup)
		gMainHandler->EnableWindowGroup (TacLastGroup);
	else
		ActivateTacMissionSchedule();
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void tactical_edit_mission (tactical_mission *)
{
	short i;
	int
		loop;

	char
		filename[MAX_PATH];

	FILE
		*fp;

	SetTimeCompression (0);

	if (current_tactical_mission)
	{
		MakeTacticalEdit ();

		current_tactical_mission->load ();
	}
	else
	{
		ShiAssert(!"This doesn't work, so should not be allowed");

		return;
		// We are trying to edit a new mission
		for (loop = 0; loop < 10000; loop ++)
		{
			sprintf (filename, "Campaign\\save\\mission%d.te", loop);

			fp = fopen (filename, "r");

			if (fp)
			{
				fclose (fp);
			}
			else
			{
				current_tactical_mission = new tactical_mission (filename);
				break;
			}
		}

		F4Assert (current_tactical_mission);

		current_tactical_mission->set_type (tt_engagement);
	
		MakeTacticalEdit ();

		current_tactical_mission->new_setup ();
	}

	tactical_mission_loaded = TRUE;

	// MONUMENTOUS HACK to get team color & Flag initialized (If they aren't already)
	for(i=0;i<NUM_TEAMS;i++)
	{
		if(TeamInfo[i])
		{
			if(!TeamInfo[i]->GetFlag())
				TeamInfo[i]->SetFlag(static_cast<uchar>(i));
			if(!TeamInfo[i]->GetColor())
				TeamInfo[i]->SetColor(static_cast<uchar>(i));
			if(i && !(TeamInfo[i]->flags & TEAM_ACTIVE))
				TeamInfo[i]->flags |= TEAM_ACTIVE;
		}
	}

	update_taceng_clock ();

	tactical_update_campaign_entities ();

	TheCampaign.Flags |= CAMP_TACTICAL | CAMP_TACTICAL_EDIT;

	TacticalEngagementSetup ();

	PauseTacticalEngagement ();

	gGps->SetAllowed(0xffffffff);
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

// This basically Ends, then starts
void tactical_revert_mission (void)
{
	gMainHandler->EnterCritical();
	tactical_mission_loaded = FALSE;

	RemoveTacticalEdit();

	CleanupTacticalEngagementUI ();
	TheCampaign.EndCampaign ();

#ifdef CAMPTOOL
	if (gRenameIds)
		SendMessage(gMainHandler->GetAppWnd(), FM_LOAD_CAMPAIGN, 0, game_TacticalEngagement);
	else
#endif
		tactical_edit_mission (current_tactical_mission);
	ActivateTacMissionBuilder();
	gSelectedTeam=1;
	PickTeamColors();
	gMainHandler->LeaveCritical();
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void update_taceng_clock (void)
{
	CampaignTime
		time,
		hrs,
		min,
		sec;

	C_Window
		*win;

	C_Clock
		*clk;

	win = gMainHandler->FindWindow (TAC_TIME);
	if (!win)
	{
		return;
	}

	clk = (C_Clock *) win->FindControl (TIME_ID);
	if (clk)
	{
		time = TheCampaign.CurrentTime;

		hrs = (time / (1000 * 60 * 60)) % 24;
		min = (time / (1000 * 60)) % 60;
		sec = (time / 1000) % 60;

		clk->SetHour (hrs);
		clk->SetMinute (min);
		clk->SetSecond (sec);
		clk->Refresh ();
	}
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -