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

📄 te_list.cpp

📁 空战游戏flacon源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		but->SetClient (1);
		but->SetCallback (tactical_mission_selection);

		win->AddControl (but);

		but->SetHotSpot
		(
			0,
			0,
			win->ClientArea_[1].right - win->ClientArea_[1].left,
			but->GetH ()
		);

		id ++;
		y += but->GetH ();

		miss = tactical_mission::get_next_mission ();
	}
#if 0
	if (current_tactical_mode == tm_load)
	{
		but = new C_Button;

		but->Setup (id, C_TYPE_RADIO, 0, y);
		but->SetFlagBitOn (C_BIT_ENABLED);

		but->SetText (C_STATE_0, "[NEW MISSION]");
		but->SetText (C_STATE_1, "[NEW MISSION]");
		but->SetFont (win->Font_);

		if (loop == 0)
		{
			current_tactical_mission = NULL;

			but->SetState (1);
		}
		else
		{
			but->SetState (0);
		}

		but->SetUserNumber (0, 0);
		but->SetUserNumber(_UI95_DELGROUP_SLOT_,_UI95_DELGROUP_ID_);

		but->SetFgColor (C_STATE_0, 0x00e0e0e0);
		but->SetFgColor (C_STATE_1, 0x0000ff00);
		but->SetGroup (-10);

		but->SetClient (1);
		but->SetCallback (tactical_mission_selection);

		win->AddControl (but);

		but->SetHotSpot
		(
			0,
			0,
			win->ClientArea_[1].right - win->ClientArea_[1].left,
			but->GetH ()
		);

		id ++;
		y += but->GetH ();
	}
#endif
	current_tactical_mission->preload();

	update_sua_load_list ();

	update_pua_list ();

	win->ScanClientAreas();
	win->RefreshWindow();
}

#endif 

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

void tactical_team_selection(long,short hittype,C_Base *control)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(current_tactical_mission)
	{
		current_tactical_mission->set_team(control->GetUserNumber(0) );
		update_pua_list();
	}
}

void JoinTacTeamCB(long,short hittype,C_Base *control)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(control)
		gSelectedTeam=static_cast<uchar>(control->GetUserNumber(0));
	current_tactical_mission->set_team(gSelectedTeam);
	update_pua_list();
}

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

static void update_sua_load_list (void)
{
	C_Window *win;
	C_Button *but;
	C_Line *line;

	int
		id,
		loop,
		MaxTeams;

	// ONLY show Team 1 if a training mission
	if(current_tactical_mission->get_type() == tt_training)
		MaxTeams=2;
	else
		MaxTeams=NUM_TEAMS;

	win = gMainHandler->FindWindow (TAC_SUA_WIN);
	if (current_tactical_mission && win)
	{
		gSelectedTeam=0;
//!		gSelectedTeam=-1;
		current_tactical_mission->set_team(0);
		id=0;
		for(loop=1;loop < MaxTeams;loop++)
		{
			if(TheCampaign.team_flags[loop])
			{
				but=(C_Button*)win->FindControl(TeamBtnIDs[id]);
				if(but)
				{
					but->SetImage(0,FlagImageID[TheCampaign.team_flags[loop]][SMALL_HORIZ]);
					but->SetImage(1,FlagImageID[TheCampaign.team_flags[loop]][SMALL_HORIZ]);
 					but->SetAllLabel((_TCHAR*)TheCampaign.team_name[loop]);
					but->SetCallback(JoinTacTeamCB);
					but->SetUserNumber(0,loop);
					but->SetUserNumber(1,id);
					if(gSelectedTeam < 1)
						gSelectedTeam=static_cast<uchar>(loop);
				}
				line=(C_Line*)win->FindControl(TeamLineIDs[id]);
				if(line)
				{
					if (TheCampaign.team_flags[loop])
					{
						line->SetColor(TeamColorList[TheCampaign.team_colour[loop]]);;
					}
				}
				win->UnHideCluster(id+1);
				id++;
			}
		}
		while(id < NUM_TEAMS)
		{
			win->HideCluster(id+1);
			id++;
		}

		// Do Map Overlay
		SetupOccupationMap();
		EnableScenarioInfo(3050);
	}
}

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

static void update_pua_list (void)
{
	C_Window
		*win;

	C_Text
		*txt;

	C_Button
		*btn;

	char
		buffer[100],
		*text;

	win = gMainHandler->FindWindow (TAC_PUA_WIN);

	if (current_tactical_mission)
	{
		txt = (C_Text *) win->FindControl (MISSION_NAME);

		if (txt)
		{
			text = current_tactical_mission->get_title ();

			if (text)
			{
				txt->SetText (text);
			}
			else
			{
				txt->SetText ("");
			}
			txt->Refresh();
		}

		txt = (C_Text *) win->FindControl (TAC_TEAMS);

		if (txt)
		{
			sprintf
			(
				buffer, "%d",
				current_tactical_mission->get_number_of_teams ()
			);

			txt->SetText (buffer);
		}
		

		txt = (C_Text *) win->FindControl (TAC_F16S);

		if (txt)
		{
			sprintf
			(
				buffer, "%d",
				current_tactical_mission->get_number_of_f16s (gSelectedTeam)
			);

			txt->SetText (buffer);
		}
		

		txt = (C_Text *) win->FindControl (TAC_AIRCRAFT);

		if (txt)
		{
			sprintf
			(
				buffer, "%d",
				current_tactical_mission->get_number_of_aircraft (gSelectedTeam)
			);

			txt->SetText (buffer);
		}
		
		txt = (C_Text *) win->FindControl (TAC_PLAYERS);

		if (txt)
		{
			sprintf
			(
				buffer, "%d",
				current_tactical_mission->get_number_of_players (gSelectedTeam)
			);

			txt->SetText (buffer);
		}
		
		txt = (C_Text *) win->FindControl (TAC_TEAM_NAME);

		if (txt)
		{
			txt->SetText((_TCHAR*)TheCampaign.team_name[gSelectedTeam]);
			txt->Refresh();
		}

		btn = (C_Button *)win->FindControl(TAC_FLAG);
		if (btn)
		{
			btn->SetImage(0,FlagImageID[TheCampaign.team_flags[gSelectedTeam]][BIG_HORIZ]);
			btn->Refresh();
		}

		txt=(C_Text*)win->FindControl(UNIT_MOTTO);
		if (txt)
		{
			if(tactical_is_training())
			{
				long textid=TRN_MISSION_01 + atol(current_tactical_mission->get_title ()) - 1;
				txt->SetText(textid);
			}
			else
			{
				txt->SetText((char*)TheCampaign.team_motto[gSelectedTeam]);
			}
		}
	}
	else
	{
		txt = (C_Text *) win->FindControl (MISSION_NAME);
		if(txt)
		{
			txt->SetText ("No Mission");
		}

		txt = (C_Text *) win->FindControl (TAC_TEAMS);
		if(txt)
		{
			txt->SetText ("0");
		}

		txt = (C_Text *) win->FindControl (TAC_F16S);
		if(txt)
		{
			txt->SetText ("0");
		}

		txt = (C_Text *) win->FindControl (TAC_AIRCRAFT);
		if(txt)
		{
			txt->SetText ("0");
		}

		txt = (C_Text *) win->FindControl (TAC_PLAYERS);
		if(txt)
		{
			txt->SetText ("0");
		}

		txt = (C_Text *) win->FindControl (TAC_TEAM_NAME);
		if(txt)
		{
			txt->SetText (" ");
		}

		txt = (C_Text *) win->FindControl (TAC_TEAM_NAME2);
		if(txt)
		{
			txt->SetText (" ");
		}

		btn = (C_Button *)win->FindControl(TAC_FLAG);
		if(btn)
		{
			btn->SetState(0);
		}
	}
	win->RefreshWindow();
}

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

void update_missions_details(long winID)
{
	Package curpackage;
	Flight curflight,flight;
	WayPoint wp;
	_TCHAR Task[200];
	_TCHAR Mission[200];
	_TCHAR TOT[200];
	_TCHAR Buffer[200];
	C_Text *text;

	C_Window *win = gMainHandler->FindWindow(winID);
	if(!win)
		return;

	if(winID == TAC_AIRCRAFT)
	{
		text = (C_Text *)win->FindControl(TAC_MISS_TITLE);
		if(text)
		{
			text->Refresh();
			if(current_tactical_mission)
				text->SetText(current_tactical_mission->get_title());
			else
				text->SetText("No Mission");//should NEVER happen
			text->Refresh();
		}
		
		text = (C_Text *)win->FindControl(TEAM_NAME);
		if(text)
		{
			text->Refresh();
			if(current_tactical_mission)
				text->SetText(current_tactical_mission->get_team_name(current_tactical_mission->get_team ()));
			else
				text->SetText("No Mission");//should NEVER happen
			text->Refresh();
		}
	}

	curflight=(Flight)vuDatabase->Find(gCurrentFlightID);
	if(curflight)
		curpackage=(Package)curflight->GetUnitParent();
	else
		curpackage=NULL;

	if(curpackage)
	{
		// Get Task string
		flight=(Flight)curpackage->GetFirstUnitElement();
		if(flight)
		{
			// Get Task string
			_tcscpy(Task,MissStr[flight->GetUnitMission()]);
		}
		else
		{
			_tcscpy(Task," ");
		}

		// Get Mission string
		if(curflight->GetUnitMission() != AMIS_ABORT)
		{
			GetMissionTarget(curpackage,curflight,Buffer);

			_tcscpy(Mission,Buffer);

			// Time on Target (TOT)
			wp=curflight->GetFirstUnitWP();

			_tcscpy(TOT," ");

			while(wp)
			{
				if(wp->GetWPFlags() & WPF_TARGET)
				{
					GetTimeString(wp->GetWPArrivalTime(),TOT);
					wp=NULL;
				}
				else
					wp=wp->GetNextWP();
			}
		}
		else
		{
			_tcscpy(Task,gStringMgr->GetString(TXT_RETURN_TO_BASE));
			_tcscpy(Mission,gStringMgr->GetString(TXT_MISSION_ABORTED));
			_tcscpy(TOT,gStringMgr->GetString(TXT_ABORTED));
		}
	}
	else
	{
		_tcscpy(Task,"");
		_tcscpy(Mission,"");
		_tcscpy(TOT,"");
	}


	

	text = (C_Text *)win->FindControl(MISSION_FIELD);
	if(text)
	{
		text->Refresh();
		text->SetText(Task);
		text->Refresh();
	}

	text = (C_Text *)win->FindControl(TGT_FIELD);
	if(text)
	{
		text->Refresh();
		text->SetText(Mission);
		text->Refresh();
	}

	text = (C_Text *)win->FindControl(TOT_FIELD);
	if(text)
	{
		text->Refresh();
		text->SetText(TOT);
		text->Refresh();
	}
}

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

void tactical_select_join (long, short hittype, C_Base *ctrl)
{
	C_Window
		*win;

	if (hittype != C_TYPE_LMOUSEUP)
	{
		return;
	}

	DisableScenarioInfo();

	if(!gCommsMgr->Online())
		gMainHandler->EnableWindowGroup(6001);

	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(1));
	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(2));
	ctrl->Parent_->UnHideCluster(ctrl->GetUserNumber(0));

	if (!gCommsMgr->Online ())
	{
		win = gMainHandler->FindWindow (PB_WIN);
		if (win)
		{
			gMainHandler->EnableWindowGroup(win->GetGroup());
		}
	}
	gLastTEFilename[0]=0;
}

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

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

	DisableScenarioInfo();

	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(1));
	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(2));
	ctrl->Parent_->UnHideCluster(ctrl->GetUserNumber(0));

	GetTacticalFileList ();
}

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

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

	DisableScenarioInfo();

	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(1));
	ctrl->Parent_->HideCluster(ctrl->GetUserNumber(2));
	ctrl->Parent_->UnHideCluster(ctrl->GetUserNumber(0));

	GetTrainingFileList ();
}

⌨️ 快捷键说明

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