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

📄 info.cpp

📁 空战游戏flacon源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	
	button=(C_Button *)win->FindControl(IDTAGS_CUR);
	if(button != NULL)
		button->SetCallback(ButtonChangeCB);
	
	button=(C_Button *)win->FindControl(WEATHER_CUR);
	if(button != NULL)
		button->SetCallback(ButtonChangeCB);
	

	button=(C_Button *)win->FindControl(INVULNERABILITY_CUR); 
	if(button != NULL)
		button->SetCallback(ButtonChangeCB);

	/* May need to hit this if veh mag is 1
	button=(C_Button *)win->FindControl(AUTO_SCALE);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1)
			PlayerOptions.SetObjFlag(DISP_OBJ_DYN_SCALING);
		else
			PlayerOptions.ClearObjFlag(DISP_OBJ_DYN_SCALING);
	}*/

	slider=(C_Slider *)win->FindControl(VEHICLE_SIZE_CUR);
	if(slider != NULL)
		slider->SetCallback(SliderChangeCB);

	//required values

	lbox=(C_ListBox *)win->FindControl(FLTMOD_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);

	
	lbox=(C_ListBox *)win->FindControl(RADAR_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);
	
	
	lbox=(C_ListBox *)win->FindControl(WEAPEFF_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);
	
	
	lbox=(C_ListBox *)win->FindControl(AUTOPILOT_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);

	lbox=(C_ListBox *)win->FindControl(PADLOCK_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);
	
	lbox=(C_ListBox *)win->FindControl(REFUELING_REQ);
	if(lbox != NULL)
		lbox->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(FUEL_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(CHAFFLARES_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(COLLISIONS_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(BLACKOUT_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	
	button=(C_Button *)win->FindControl(IDTAGS_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(WEATHER_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	

	button=(C_Button *)win->FindControl(EXT_VIEWS_REQ);
	if(button != NULL)
		button->SetCallback(RuleControlCB);
	
	button=(C_Button *)win->FindControl(INVULNERABILITY_REQ); 
	if(button != NULL)
		button->SetCallback(RuleControlCB);

	/* May need to hit this if veh mag is 1
	button=(C_Button *)win->FindControl(AUTO_SCALE);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1)
			PlayerOptions.SetObjFlag(DISP_OBJ_DYN_SCALING);
		else
			PlayerOptions.ClearObjFlag(DISP_OBJ_DYN_SCALING);
	}*/

	
	
	slider=(C_Slider *)win->FindControl(VEHICLE_SIZE_REQ);
	if(slider != NULL)
		slider->SetCallback(SliderRuleControlCB);
}

void SetupInfoWindow(void (*tOkCB)(), void (*tCancelCB)())
{
	FalconGameEntity *game;
	C_Window *win;

	win=gMainHandler->FindWindow(INFO_WIN);
	if(!win)
	{
		if(tCancelCB)
			(*tCancelCB)();
		return;
	}
	/*if(FalconLocalGame != vuPlayerPoolGroup)
		CurrRules = &FalconLocalGameEntity->rules;
	else if(gCommsMgr->GetTargetGame())
		CurrRules = &((FalconGameEntity *)gCommsMgr->GetTargetGame())->rules;
	else
		CurrRules = &gRules[RuleMode];*/
	game = (FalconGameEntity *)gCommsMgr->GetTargetGame();
	if(game)
	{
		CurrRules.LoadRules(game->rules.GetRules());
		modify = FALSE;
	}
	else
	{
		modify = TRUE;
		CurrRules.LoadRules(gRules[RuleMode].GetRules());
	}
	
	OkCB = tOkCB;
	CancelCB = tCancelCB;

	
	if(!INFOLoaded)
	{
		switch(gLangIDNum)
		{
			case F4LANG_ENGLISH:
			case F4LANG_UK:
			case F4LANG_GERMAN:
				_stprintf(GameName,"%s%s",LogBook.Callsign(),gStringMgr->GetString(TXT_APPEND_GAME));
				break;
			case F4LANG_FRENCH:
			case F4LANG_SPANISH:
			case F4LANG_ITALIAN:
			case F4LANG_PORTUGESE:
				_stprintf(GameName,"%s %s",gStringMgr->GetString(TXT_APPEND_GAME),LogBook.Callsign());
				break;
		}

		INFOHookupControls();	
		INFOLoaded++;
	}

	INFOSetupControls();

	gMainHandler->EnableWindowGroup(win->GetGroup());
}


static void INFOSaveRules(void)
{
	C_Window	*win;
	C_Button	*button;
	C_ListBox	*lbox;
	C_Slider	*slider;
	C_EditBox	*ebox;
	RulesClass  tempRules;

	tempRules.Initialize();

	if(  VuLocalGame != vuPlayerPoolGroup )
		return;

	win=gMainHandler->FindWindow(INFO_WIN);
	
	if(win == NULL)
		return;

	int host = FALSE;
/*
	if(FalconLocalGameEntity && FalconLocalSession && FalconLocalGameEntity->OwnerId() == FalconLocalSession->Id())
		host = TRUE;
	else if(!gCommsMgr->GetTargetGame() && !FalconLocalGameEntity)
	*/	host = modify;

	if(host)
	{
		ebox = (C_EditBox *)win->FindControl(INFO_GAMENAME);
		if(ebox)
		{
			//if(FalconLocalGame && _tcscmp( FalconLocalGame->GameName(),ebox->GetText() ) )
			//	FalconLocalGame->SetGameName(ebox->GetText());
			_tcscpy(GameName,ebox->GetText());
		}

		ebox = (C_EditBox *)win->FindControl(INFO_PASSWORD);
		if(ebox)
		{
			if(ebox->GetText())
				tempRules.SetPassword(ebox->GetText());
			//if(FalconLocalGameEntity)
				//FalconLocalGameEntity->EncipherPassword(CurrRules.Password,RUL_PW_LEN);
		}

		ebox = (C_EditBox *)win->FindControl(MAX_PLAYERS);
		if(ebox)
		{
			tempRules.SetMaxPlayers(ebox->GetInteger());
		}

		lbox=(C_ListBox *)win->FindControl(FLTMOD_REQ);
		if(lbox != NULL)
		{
			if((lbox->GetTextID())==FLTMOD_1)
				tempRules.SimFlightModel = FMAccurate;
			else
				tempRules.SimFlightModel = FMSimplified;
		}

		lbox=(C_ListBox *)win->FindControl(RADAR_REQ);
		if(lbox != NULL)
		{
			switch(lbox->GetTextID())
			{
			case RADAR_1:
				tempRules.SimAvionicsType = ATRealistic;
				break;
			case RADAR_2:
				tempRules.SimAvionicsType = ATSimplified;
				break;
			case RADAR_3:
				tempRules.SimAvionicsType = ATEasy;
				break;
			}
		}

		lbox=(C_ListBox *)win->FindControl(WEAPEFF_REQ);
		if(lbox != NULL)
		{
			switch(lbox->GetTextID())
			{
			case WEAPEFF_1:
				tempRules.SimWeaponEffect = WEAccurate;
				break;
			case WEAPEFF_2:
				tempRules.SimWeaponEffect = WEEnhanced;
				break;
			case WEAPEFF_3:
				tempRules.SimWeaponEffect = WEExaggerated;
				break;
			}
		}

		lbox=(C_ListBox *)win->FindControl(AUTOPILOT_REQ);
		if(lbox != NULL)
		{
			switch(lbox->GetTextID())
			{
			case AUTO_1:
				tempRules.SimAutopilotType = APNormal;
				break;
			case AUTO_2:
				tempRules.SimAutopilotType = APEnhanced;
				break;
			case AUTO_3:
				tempRules.SimAutopilotType = APIntelligent;
				break;
			}
		}

		lbox=(C_ListBox *)win->FindControl(PADLOCK_REQ);
		if(lbox != NULL)
		{
			switch(lbox->GetTextID())
			{
			case PADLOCK_4:
				tempRules.SimPadlockMode = PDDisabled;
				break;
			case PADLOCK_1:
				tempRules.SimPadlockMode = PDRealistic;
				break;
			case PADLOCK_2:
				tempRules.SimPadlockMode = PDEnhanced;
				break;
			//case PADLOCK_3:
			//	tempRules.SimPadlockMode = PDSuper;
			//	break;
			}
		}

		lbox=(C_ListBox *)win->FindControl(REFUELING_REQ);
		if(lbox != NULL)
		{
			switch(lbox->GetTextID())
			{
			case REFUEL_1:
				tempRules.SimAirRefuelingMode = ARRealistic;
				break;
			case REFUEL_2:
				tempRules.SimAirRefuelingMode = ARModerated;
				break;
			case REFUEL_3:
				tempRules.SimAirRefuelingMode = ARSimplistic;
				break;
			}
		}

		button=(C_Button *)win->FindControl(FUEL_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag (SIM_UNLIMITED_FUEL);
			else
				tempRules.ClearSimFlag (SIM_UNLIMITED_FUEL);
		}

		button=(C_Button *)win->FindControl(CHAFFLARES_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag (SIM_UNLIMITED_CHAFF);
			else
				tempRules.ClearSimFlag (SIM_UNLIMITED_CHAFF);
			
		}

		button=(C_Button *)win->FindControl(COLLISIONS_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag (SIM_NO_COLLISIONS);
			else
				tempRules.ClearSimFlag (SIM_NO_COLLISIONS);
		}

		button=(C_Button *)win->FindControl(BLACKOUT_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag (SIM_NO_BLACKOUT);
			else
				tempRules.ClearSimFlag (SIM_NO_BLACKOUT);
		}


		button=(C_Button *)win->FindControl(IDTAGS_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag (SIM_NAMETAGS);
			else
				tempRules.ClearSimFlag (SIM_NAMETAGS);			
		}

		button=(C_Button *)win->FindControl(WEATHER_REQ);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetGenFlag(GEN_NO_WEATHER);
			else
				tempRules.ClearGenFlag(GEN_NO_WEATHER);
		}


		button=(C_Button *)win->FindControl(INVULNERABILITY_REQ); 
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				tempRules.SetSimFlag(SIM_INVULNERABLE);
			else
				tempRules.ClearSimFlag(SIM_INVULNERABLE);
		}

		button=(C_Button *)win->FindControl(EXT_VIEWS_REQ); 
		if(button != NULL)
		{		
			if(button->GetState() == C_STATE_1)
				tempRules.SetGenFlag(GEN_EXTERNAL_VIEW);
			else
				tempRules.ClearGenFlag(GEN_EXTERNAL_VIEW);
		}

		/* May need to hit this if veh mag is 1
		button=(C_Button *)win->FindControl(AUTO_SCALE);
		if(button != NULL)
		{
			if(button->GetState() == C_STATE_1)
				PlayerOptions.SetObjFlag(DISP_OBJ_DYN_SCALING);
			else
				PlayerOptions.ClearObjFlag(DISP_OBJ_DYN_SCALING);
		}*/

		slider=(C_Slider *)win->FindControl(VEHICLE_SIZE_REQ);
		if(slider != NULL)
		{
			tempRules.ObjMagnification = static_cast<float>((int)( (float)slider->GetSliderPos()/( slider->GetSliderMax() - slider->GetSliderMin() ) * 4 + 1.5f ));
		}

//		if(FalconLocalGameEntity)
//			FalconLocalGameEntity->UpdateRules(tempRules.GetRules());
//		else
			gRules[RuleMode].LoadRules(tempRules.GetRules());
	}
}

static void INFOSaveValues(void)
{
	C_Window	*win;
	C_Button	*button;
	C_ListBox	*lbox;
	C_Slider	*slider;
	
	
	win=gMainHandler->FindWindow(INFO_WIN);
	
	if(win == NULL)
		return;

	int host = FALSE;

	if(FalconLocalGame && FalconLocalSession && FalconLocalGame->OwnerId() == FalconLocalSession->Id())
		host = TRUE;
	
	lbox=(C_ListBox *)win->FindControl(FLTMOD_CUR);
	if(lbox != NULL)
	{
		if((lbox->GetTextID())==FLTMOD_1)
			PlayerOptions.SimFlightModel = FMAccurate;
		else
			PlayerOptions.SimFlightModel = FMSimplified;

		lbox->Refresh();
	}
	
	lbox=(C_ListBox *)win->FindControl(RADAR_CUR);
	if(lbox != NULL)
	{
		switch(lbox->GetTextID())
		{
		case RADAR_1:
			PlayerOptions.SimAvionicsType = ATRealistic;
			break;
		case RADAR_2:
			PlayerOptions.SimAvionicsType = ATSimplified;
			break;
		case RADAR_3:
			PlayerOptions.SimAvionicsType = ATEasy;
			break;
		}
		lbox->Refresh();
	}
	
	lbox=(C_ListBox *)win->FindControl(WEAPEFF_CUR);
	if(lbox != NULL)
	{
		switch(lbox->GetTextID())
		{
		case WEAPEFF_1:
			PlayerOptions.SimWeaponEffect = WEAccurate;
			break;
		case WEAPEFF_2:
			PlayerOptions.SimWeaponEffect = WEEnhanced;
			break;
		case WEAPEFF_3:
			PlayerOptions.SimWeaponEffect = WEExaggerated;
			break;
		}
		lbox->Refresh();
	}
	
	lbox=(C_ListBox *)win->FindControl(AUTOPILOT_CUR);
	if(lbox != NULL)
	{
		switch(lbox->GetTextID())
		{
		case AUTO_1:
			PlayerOptions.SimAutopilotType = APNormal;
			break;
		case AUTO_2:
			PlayerOptions.SimAutopilotType = APEnhanced;
			break;
		case AUTO_3:
			PlayerOptions.SimAutopilotType = APIntelligent;
			break;
		}
		lbox->Refresh();
	}

	lbox=(C_ListBox *)win->FindControl(PADLOCK_CUR);
	if(lbox != NULL)
	{
		switch(lbox->GetTextID())
		{
		case PADLOCK_4:
			PlayerOptions.SimPadlockMode = PDDisabled;
			break;
		case PADLOCK_1:
			PlayerOptions.SimPadlockMode = PDRealistic;
			break;
		case PADLOCK_2:
			PlayerOptions.SimPadlockMode = PDEnhanced;
			break;
		//case PADLOCK_3:
		//	PlayerOptions.SimPadlockMode = PDSuper;
		//	break;
		}
		lbox->Refresh();
	}
	
	lbox=(C_ListBox *)win->FindControl(REFUELING_CUR);
	if(lbox != NULL)
	{
		switch(lbox->GetTextID())
		{
		case REFUEL_1:
			PlayerOptions.SimAirRefuelingMode = ARRealistic;
			break;
		case REFUEL_2:
			PlayerOptions.SimAirRefuelingMode = ARModerated;
			break;
		case REFUEL_3:
			PlayerOptions.SimAirRefuelingMode = ARSimplistic;
			break;
		}
		lbox->Refresh();
	}
	
	button=(C_Button *)win->FindControl(FUEL_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag (SIM_UNLIMITED_FUEL);
		else
			PlayerOptions.ClearSimFlag (SIM_UNLIMITED_FUEL);
	}
	
	button=(C_Button *)win->FindControl(CHAFFLARES_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag (SIM_UNLIMITED_CHAFF);
		else
			PlayerOptions.ClearSimFlag (SIM_UNLIMITED_CHAFF);
		
	}
	
	button=(C_Button *)win->FindControl(COLLISIONS_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag (SIM_NO_COLLISIONS);
		else
			PlayerOptions.ClearSimFlag (SIM_NO_COLLISIONS);
	}
	
	button=(C_Button *)win->FindControl(BLACKOUT_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag (SIM_NO_BLACKOUT);
		else
			PlayerOptions.ClearSimFlag (SIM_NO_BLACKOUT);
	}
	
	
	button=(C_Button *)win->FindControl(IDTAGS_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag (SIM_NAMETAGS);
		else
			PlayerOptions.ClearSimFlag (SIM_NAMETAGS);			
	}
	
	button=(C_Button *)win->FindControl(WEATHER_CUR);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.GeneralFlags |= GEN_NO_WEATHER;
		else
			PlayerOptions.GeneralFlags &= ~GEN_NO_WEATHER;
	}
	

	button=(C_Button *)win->FindControl(INVULNERABILITY_CUR); 
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1 || button->GetState() == C_STATE_2)
			PlayerOptions.SetSimFlag(SIM_INVULNERABLE);
		else
			PlayerOptions.ClearSimFlag(SIM_INVULNERABLE);
	}

	/* May need to hit this if veh mag is 1
	button=(C_Button *)win->FindControl(AUTO_SCALE);
	if(button != NULL)
	{
		if(button->GetState() == C_STATE_1)
			PlayerOptions.SetObjFlag(DISP_OBJ_DYN_SCALING);
		else
			PlayerOptions.ClearObjFlag(DISP_OBJ_DYN_SCALING);
	}*/

	
	
	slider=(C_Slider *)win->FindControl(VEHICLE_SIZE_CUR);
	if(slider != NULL)
	{
		PlayerOptions.ObjMagnification = static_cast<float>((int)( (float)slider->GetSliderPos()/( slider->GetSliderMax() - slider->GetSliderMin() ) * 4 + 1.5f ));
	}
	
	PlayerOptions.SaveOptions();

	INFOSaveRules();
	INFOSaveRulesToFile();

}//SaveValues

void CopyRulesToGame(FalconGameEntity *)
{
	//game->UpdateRules(gRules[RuleMode].GetRules());
}

⌨️ 快捷键说明

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