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

📄 te_setup.cpp

📁 空战游戏flacon源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	win2=gMainHandler->FindWindow(TAC_EDIT_TOOLBAR);

	//Hide Icons which shouldn't be seen with this window
	idx=200;
	cluster=control->GetUserNumber(idx);
	while(cluster)
	{
		if(win1)
			win1->HideCluster(cluster);
		if(win2)
			win2->HideCluster(cluster);

		idx++;
		cluster=control->GetUserNumber(idx);
	}
	//Unhide Icons which should be seen with this window
	idx=100;
	cluster=control->GetUserNumber(idx);
	while(cluster)
	{
		if(win1)
			win1->UnHideCluster(cluster);
		if(win2)
			win2->UnHideCluster(cluster);

		idx++;
		cluster=control->GetUserNumber(idx);
	}
}

void OpenTeamWindowCB(long ID,short hittype,C_Base *base)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(OwnershipChanged)
		UpdateOwners();

	SetupCurrentTeamValues(gSelectedTeam);
	SetupTeamListValues();
	TestOpenCB(ID,hittype,base);
}

void OpenVCWindowCB(long ID,short hittype,C_Base *base)
{
	C_Window *win;

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(OwnershipChanged)
		UpdateOwners();

	win=gMainHandler->FindWindow(TAC_VC_WIN);
	if(win)
	{
		gMapMgr->SetWindow(win);
		SelectToolTypeCB(0,C_TYPE_LMOUSEUP,NULL);
		gMapMgr->GetCurWP()->SetFlagBitOn(C_BIT_INVISIBLE);
		TestOpenCB(ID,hittype,base);
	}
}

void OpenBuilderWindowCB(long ID,short hittype,C_Base *base)
{
	C_Window *win;

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(OwnershipChanged)
		UpdateOwners();

	win=gMainHandler->FindWindow(TAC_EDIT_WIN);
	if(win)
	{
		gMapMgr->SetWindow(win);
		SelectToolTypeCB(0,C_TYPE_LMOUSEUP,NULL);
		gMapMgr->GetCurWP()->SetFlagBitOff(C_BIT_INVISIBLE);
		TestOpenCB(ID,hittype,base);
	}
}

void OpenMissionWindowCB(long ID,short hittype,C_Base *base)
{
	C_Window *win;

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(OwnershipChanged)
		UpdateOwners();

	win=gMainHandler->FindWindow(TAC_PUA_MAP);
	if(win)
	{
		gMapMgr->SetWindow(win);
		SelectToolTypeCB(0,C_TYPE_LMOUSEUP,NULL);
		gMapMgr->GetCurWP()->SetFlagBitOff(C_BIT_INVISIBLE);
		TestOpenCB(ID,hittype,base);
	}
}

void hookup_main_buttons(C_Window *win)
{
	C_Button *btn;

	btn=(C_Button*)win->FindControl(BUILDER_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenBuilderWindowCB);

	btn=(C_Button*)win->FindControl(TEAMS_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenTeamWindowCB);

	btn=(C_Button*)win->FindControl(TAC_MISS_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenMissionWindowCB);

	btn=(C_Button*)win->FindControl(VC_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenVCWindowCB);

	btn=(C_Button *)win->FindControl(LB_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenLogBookCB);

	btn=(C_Button *)win->FindControl(CO_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenCommsCB);

	btn=(C_Button *)win->FindControl(SP_MAIN_CTRL);
	if(btn)
		btn->SetCallback(OpenSetupCB);

	btn=(C_Button *)win->FindControl(ACMI_CTRL);
	if(btn)
		btn->SetCallback(ACMIButtonCB);
}

void ChangeStartTimeCB(long ID,short hittype,C_Base *control)
{
	C_Clock *clk;
	long time,deltatime;

	if(hittype != C_TYPE_LMOUSEUP && hittype != C_TYPE_REPEAT)
		return;

	clk=(C_Clock*)control->Parent_->FindControl(control->GetUserNumber(0));
	if(clk)
	{
		time=clk->GetTime();
		ChangeTimeCB(ID,hittype,control);

		deltatime=(clk->GetTime() - time) * VU_TICS_PER_SECOND;

		TheCampaign.SetTEStartTime(clk->GetTime() * VU_TICS_PER_SECOND);
		// Adjust ALL times relative to the deltatime
	}
}

void ChangeEndTimeCB(long ID,short hittype,C_Base *control)
{
	C_Clock *clk;
	unsigned long time;

	if(hittype != C_TYPE_LMOUSEUP && hittype != C_TYPE_REPEAT)
		return;

	clk=(C_Clock*)control->Parent_->FindControl(control->GetUserNumber(0));
	if(clk)
	{
		ChangeTimeCB(ID,hittype,control);
		time=clk->GetTime() * VU_TICS_PER_SECOND;

		if(time > TheCampaign.GetTEStartTime())
		{
			MonoPrint ("Set TE Time Limit %08x\n", time);
			TheCampaign.SetTETimeLimitTime(time);
		}
		else
		{
			clk->SetTime(TheCampaign.GetTEStartTime()/VU_TICS_PER_SECOND);
			clk->Refresh();
		}
	}
}

void ChangeCurrentTimeCB(long ID,short hittype,C_Base *control)
{
	C_Clock *clk;
	Unit un;

	if(hittype != C_TYPE_LMOUSEUP && hittype != C_TYPE_REPEAT)
		return;

	clk=(C_Clock*)control->Parent_->FindControl(control->GetUserNumber(0));
	if(clk)
	{
		ChangeTimeCB(ID,hittype,control);

		SetTime (clk->GetTime() * VU_TICS_PER_SECOND);

		fixup_unit_starting_positions ();

		gGps->Update();
		un=(Unit)vuDatabase->Find(gMapMgr->GetCurWPID());
		if(un && un->IsFlight())
			gMapMgr->UpdateWaypoint((Flight)un);
		gMapMgr->DrawMap();
	}
}

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

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

static void TacSelectGameCB(long,short hittype,C_Base *control)
{
	VU_ID *tmpID;
	FalconGameEntity *game;
	TREELIST *item;

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	MonoPrint ("Select TAC Online Game\n");

	if (current_tactical_mission)
	{
		delete current_tactical_mission;
	}

	current_tactical_mission = new tactical_mission;

	SetCursor(gCursors[CRSR_WAIT]);
	item=((C_TreeList *)control)->GetLastItem();
	if(item == NULL) return;
	if(item->Item_ == NULL) return;

	if(item->Type_ == C_TYPE_MENU)
	{
		if(!item->Item_->GetState())
		{
			item->Item_->SetState(1);
			item->Item_->Refresh();
			tmpID=(VU_ID *)item->Item_->GetUserPtr(_UI95_VU_ID_SLOT_);
			if(tmpID)
			{
				game = (FalconGameEntity*) vuDatabase->Find(*tmpID);
				gCommsMgr->LookAtGame(game);
				if (game)
				{
					if(game->GetGameType() == game_TacticalEngagement)
						SendMessage(gMainHandler->GetAppWnd(),FM_JOIN_CAMPAIGN,JOIN_PRELOAD_ONLY,game_TacticalEngagement);
				}
			}
		}
		else
		{
			item->Item_->SetState(0);
			item->Item_->Refresh();
			gCommsMgr->LookAtGame(NULL);
		}
	}
	//SetCursor(gCursors[CRSR_F16]);
}

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

void adjust_all_taceng_unit_times (CampaignTime dt)
{
	VuListIterator
		myit(AllRealList);

	Unit
		un;

	WayPointClass
		*wp;

 	un = GetFirstUnit (&myit);

	while (un)
	{
		wp = un->GetFirstUnitWP ();

		while (wp)
		{
			wp->AddWPTimeDelta (dt);
			wp = wp->GetNextWP ();
		}

		un = GetNextUnit (&myit);
	}
}

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

int tactical_is_training (void)
{
	if (current_tactical_mission && current_tactical_mission->get_type() == tt_training)
		return TRUE;
	return FALSE;
}

⌨️ 快捷键说明

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