📄 ui_setup.cpp
字号:
}
button=(C_Button *)win->FindControl(OBJECT_TEXTURES);
if(button != NULL)
{
if(button->GetState() == C_STATE_1)
PlayerOptions.ObjFlags |= DISP_OBJ_TEXTURES;
else
PlayerOptions.ObjFlags &= ~DISP_OBJ_TEXTURES;
}
slider=(C_Slider *)win->FindControl(OBJECT_DETAIL);
if(slider != NULL)
{
PlayerOptions.ObjDetailLevel = ((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin())*1.5f*GraphicSettingMult + 0.5f);
}
slider=(C_Slider *)win->FindControl(SFX_LEVEL);
if(slider != NULL)
{
PlayerOptions.SfxLevel = ((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 4.0f + 1.0F);
}
slider=(C_Slider *)win->FindControl(PLAYER_BUBBLE_SLIDER);
if(slider != NULL)
{
PlayerOptions.PlayerBubble = ((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin())*1.5f*GraphicSettingMult + 0.5f);
FalconLocalSession->SetBubbleRatio( PlayerOptions.PlayerBubble );
}
slider=(C_Slider *)win->FindControl(DISAGG_LEVEL);
if(slider != NULL)
{
PlayerOptions.BldDeaggLevel = FloatToInt32((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 5 + 0.5F);
PlayerOptions.ObjDeaggLevel = FloatToInt32((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 100 + 0.5F);
}
slider=(C_Slider *)win->FindControl(VEHICLE_SIZE);
if(slider != NULL)
{
PlayerOptions.ObjMagnification = static_cast<float>(FloatToInt32( (float)slider->GetSliderPos()/(float)( slider->GetSliderMax() - slider->GetSliderMin() ) * 4.0F + 1.0F ));
}
slider=(C_Slider *)win->FindControl(TEXTURE_DISTANCE);
if(slider != NULL)
{
PlayerOptions.DispTextureLevel = FloatToInt32((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 4.0F + 0.5F);
}
slider=(C_Slider *)win->FindControl(TERRAIN_DETAIL);
if(slider != NULL)
{
int step;
step = (slider->GetSliderMax()-slider->GetSliderMin())/(6*GraphicSettingMult);
if(slider->GetSliderPos() > 2*step)
{
PlayerOptions.DispTerrainDist = (40.0f + ( ((float)slider->GetSliderPos())/step - 2 ) * 10.0f);
PlayerOptions.DispMaxTerrainLevel = 0;
}
else
{
PlayerOptions.DispTerrainDist = 40.0f;
PlayerOptions.DispMaxTerrainLevel = FloatToInt32( max(0.0F, 2.0F - slider->GetSliderPos()/step) + 0.5F);
}
}
text=(C_Text *)win->FindControl(CAL_TEXT);
if(text != NULL)
text->SetText("");
double pos,range;
int volume, i;
for(i=0;i<17;i+=2)
{
slider=(C_Slider *)win->FindControl(ENGINE_VOLUME + i);
if ( slider )
{
pos = slider->GetSliderPos();
range = slider->GetSliderMax()-slider->GetSliderMin();
pos = (1.0F - pos / range);
volume = (int)(pos * pos * (SND_RNG));
PlayerOptions.GroupVol[i/2] = volume;
F4SetGroupVolume(i/2,volume);
}
}
PlayerOptions.Realism = GetRealism(win)/100.0f;
PlayerOptions.SaveOptions();
DisplayOptions.SaveOptions();
SaveKeyMapList(PlayerOptions.keyfile);
win = gMainHandler->FindWindow(INFO_WIN);
if(win)
{
INFOSetupControls();
}
}//SaveValues
void ShutdownSetup()
{
if(Objects)
{
delete [] Objects;
Objects = NULL;
}
if(Features)
{
delete [] Features;
Features = NULL;
}
if(SetupViewer)
{
ready = FALSE;
F4EnterCriticalSection(SetupCritSection);
RViewPoint *viewpt;
viewpt = SetupViewer->GetVP();
viewpt->RemoveObject(Smoke);
delete Smoke;
Smoke = NULL;
SetupViewer->Cleanup();
delete SetupViewer;
SetupViewer = NULL;
F4LeaveCriticalSection(SetupCritSection);
}
if(tmpVpoint)
{
tmpVpoint->Cleanup();
tmpVpoint = NULL;
}
F4EnterCriticalSection(SetupCritSection);
F4LeaveCriticalSection(SetupCritSection);
if(SetupCritSection)
{
F4DestroyCriticalSection(SetupCritSection);
SetupCritSection = NULL;
}
}
void CloseSetupWindowCB(long ID,short hittype,C_Base *control)
{
C_Button *button;
if(hittype != C_TYPE_LMOUSEUP)
return;
ShutdownSetup();
PlayerOptions.LoadOptions();
InitSoundSetup();
/*
if(Calibration.calibrating)
StopCalibrating(control);*/
button=(C_Button *)control->Parent_->FindControl(RENDER);
if(button != NULL)
{
button->SetState(C_STATE_0);
}
UpdateKeyMapList( PlayerOptions.keyfile,USE_FILENAME);
CloseWindowCB(ID,hittype,control);
}//CloseSetupWindowCB
void SetupOkCB(long ID,short hittype,C_Base *control)
{
C_Button *button;
if(hittype != C_TYPE_LMOUSEUP)
return;
SaveValues();
InitSoundSetup();
CheckFlyButton();
ShutdownSetup();
/*
if(Calibration.calibrating)
StopCalibrating(control);*/
button=(C_Button *)control->Parent_->FindControl(RENDER);
if(button != NULL)
{
button->SetState(C_STATE_0);
}
CloseWindowCB(ID,hittype,control);
}//SetupOkCB
void ApplySetupCB(long,short hittype,C_Base *)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
SaveValues();
CheckFlyButton();
}//ApplySetupCB
void CancelSetupCB(long ID,short hittype,C_Base *control)
{
C_Button *button;
if(hittype != C_TYPE_LMOUSEUP)
return;
ShutdownSetup();
PlayerOptions.LoadOptions();
InitSoundSetup();
/*
if(Calibration.calibrating)
StopCalibrating(control);*/
button=(C_Button *)control->Parent_->FindControl(RENDER);
if(button != NULL)
{
button->SetState(C_STATE_0);
}
UpdateKeyMapList( PlayerOptions.keyfile, USE_FILENAME);
CloseWindowCB(ID,hittype,control);
} //CancelSetupCB
static void HookupSetupControls(long ID)
{
C_Window *win;
C_Button *button;
C_Slider *slider;
C_ListBox *listbox;
win=gMainHandler->FindWindow(ID);
if(win == NULL)
return;
// Help GUIDE thing
button=(C_Button*)win->FindControl(UI_HELP_GUIDE);
if(button)
button->SetCallback(UI_Help_Guide_CB);
// Hook up IDs here
// Hook up Close Button
button=(C_Button *)win->FindControl(CLOSE_WINDOW);
if(button != NULL)
button->SetCallback(CloseSetupWindowCB);
button=(C_Button *)win->FindControl(OK);
if(button != NULL)
button->SetCallback(SetupOkCB);
button=(C_Button *)win->FindControl(APPLY);
if(button != NULL)
button->SetCallback(ApplySetupCB);
button=(C_Button *)win->FindControl(CANCEL);
if(button != NULL)
button->SetCallback(CancelSetupCB);
button=(C_Button *)win->FindControl(SET_LOGBOOK);
if(button != NULL)
button->SetCallback(SetupOpenLogBookCB);
button=(C_Button *)win->FindControl(SIM_TAB);
if(button != NULL)
button->SetCallback(SetupRadioCB);
button=(C_Button *)win->FindControl(GRAPHICS_TAB);
if(button != NULL)
button->SetCallback(SetupRadioCB);
button=(C_Button *)win->FindControl(SOUND_TAB);
if(button != NULL)
button->SetCallback(SetupRadioCB);
button=(C_Button *)win->FindControl(CONTROLLERS_TAB);
if(button != NULL)
button->SetCallback(SetupRadioCB);
//Sim Tab
listbox = (C_ListBox *)win->FindControl(SET_SKILL);
if(listbox != NULL)
listbox->SetCallback(SetSkillCB);
listbox = (C_ListBox *)win->FindControl(SET_FLTMOD);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
listbox = (C_ListBox *)win->FindControl(SET_RADAR);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
listbox = (C_ListBox *)win->FindControl(SET_WEAPEFF);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
listbox = (C_ListBox *)win->FindControl(SET_AUTOPILOT);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
listbox = (C_ListBox *)win->FindControl(SET_REFUELING);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
listbox = (C_ListBox *)win->FindControl(SET_PADLOCK);
if(listbox != NULL)
listbox->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_INVULNERABILITY);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_FUEL);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_CHAFFLARES);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_COLLISIONS);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_BLACKOUT);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_IDTAGS);
if(button != NULL)
button->SetCallback(SimControlCB);
button=(C_Button *)win->FindControl(SET_WEATHER);
if(button != NULL)
button->SetCallback(SimControlCB);
//Controllers Tab
//button=(C_Button *)win->FindControl(SET_DEFAULTS);
//if(button != NULL)
// button->SetCallback(SetKeyDefaultCB);
button=(C_Button *)win->FindControl(CALIBRATE);
if(button != NULL)
button->SetCallback(RecenterJoystickCB);
button=(C_Button *)win->FindControl(SET_AB_DETENT);
if(button != NULL)
button->SetCallback(SetABDetentCB);
button=(C_Button *)win->FindControl(KEYMAP_SAVE);
if(button != NULL)
button->SetCallback(SaveKeyButtonCB);
button=(C_Button *)win->FindControl(KEYMAP_LOAD);
if(button != NULL)
button->SetCallback(LoadKeyButtonCB);
win->SetKBCallback(KeystrokeCB);
listbox = (C_ListBox *)win->FindControl(70137);//JOYSTICK_SELECT
if(listbox != NULL)
listbox->SetCallback(ControllerSelectCB);
//Sound Tab
button=(C_Button*)win->FindControl(ENGINE_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(SIDEWINDER_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(RWR_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(COCKPIT_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(COM1_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(COM2_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(SOUNDFX_SND);
if(button)
button->SetCallback(TestButtonCB);
button=(C_Button*)win->FindControl(UISOUNDFX_SND);
if(button)
button->SetCallback(TestButtonCB);
slider=(C_Slider*)win->FindControl(ENGINE_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(SIDEWINDER_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(RWR_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(COCKPIT_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(COM1_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(COM2_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(SOUNDFX_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(UISOUNDFX_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(MUSIC_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
slider=(C_Slider*)win->FindControl(MASTER_VOLUME);
if(slider)
slider->SetCallback(SoundSliderCB);
//Graphics Tab
if(ID == SETUP_WIN)
{
C_TimerHook *tmr;
tmr=new C_TimerHook;
tmr->Setup(C_DONT_CARE,C_TYPE_NORMAL);
tmr->SetClient(2);
tmr->SetXY(win->ClientArea_[2].left,win->ClientArea_[2].top);
tmr->SetW(win->ClientArea_[2].right - win->ClientArea_[2].left);
tmr->SetH(win->ClientArea_[2].bottom - win->ClientArea_[2].top);
tmr->SetUpdateCallback(STPViewTimerCB);
tmr->SetDrawCallback(STPDisplayCB);
tmr->SetFlagBitOff(C_BIT_TIMER);
tmr->SetCluster(8002);
// tmr->SetUserNumber(1,2);
tmr->SetReady(1);
win->AddControl(tmr);
win->SetDragCallback(STPMoveRendererCB);
}
listbox = (C_ListBox *)win->FindControl(SET_VIDEO_CARD);
if(listbox != NULL)
listbox->SetCallback(VideoCardCB);
listbox = (C_ListBox *)win->FindControl(SET_VIDEO_DRIVER);
if(listbox != NULL)
listbox->SetCallback(VideoDriverCB);
listbox = (C_ListBox *)win->FindControl(SET_RESOLUTION);
if(listbox != NULL)
listbox->SetCallback(ResolutionCB);
button=(C_Button *)win->FindControl(SET_GRAPHICS_DEFAULTS);
if(button != NULL)
{
button->SetCallback(GraphicsDefaultsCB);
}
button=(C_Button *)win->FindControl(RENDER);
if(button != NULL)
{
button->SetCallback(RenderViewCB);
}
button=(C_Button *)win->FindControl(AUTO_SCALE);
if(button != NULL)
{
button->SetCallback(ScalingCB);
}
button=(C_Button *)win->FindControl(70136);//GOUROUD
if(button != NULL)
{
button->SetCallback(GouraudCB);
}
button=(C_Button *)win->FindControl(HAZING);
if(button != NULL)
{
button->SetCallback(HazingCB);
}
button=(C_Button *)win->FindControl(ALPHA_BLENDING);
if(button != NULL)
{
button->SetCallback(AlphaBlendCB);
}
button=(C_Button *)win->FindControl(BILINEAR_FILTERING);
if(button != NULL)
{
button->SetCallback(BilinearFilterCB);
}
button=(C_Button *)win->FindControl(OBJECT_TEXTURES);
if(button != NULL)
{
button->SetCallback(ObjectTextureCB);
}
slider=(C_Slider *)win->FindControl(DISAGG_LEVEL);
if(slider != NULL)
{
slider->SetCallback(BuildingDetailCB);
}
slider=(C_Slider *)win->FindControl(OBJECT_DETAIL);
if(slider != NULL)
{
slider->SetCallback(ObjectDetailCB);
}
slider=(C_Slider *)win->FindControl(PLAYER_BUBBLE_SLIDER);
if(slider != NULL)
{
slider->SetCallback(PlayerBubbleCB);
}
slider=(C_Slider *)win->FindControl(VEHICLE_SIZE);
if(slider != NULL)
{
slider->SetCallback(VehicleSizeCB);
}
slider=(C_Slider *)win->FindControl(TERRAIN_DETAIL);
if(slider != NULL)
{
slider->SetCallback(TerrainDetailCB);
}
slider=(C_Slider *)win->FindControl(TEXTURE_DISTANCE);
if(slider != NULL)
{
slider->SetCallback(TextureDistanceCB);
}
slider=(C_Slider *)win->FindControl(SFX_LEVEL);
if(slider != NULL)
{
slider->SetCallback(SfxLevelCB);
}
}//HookupSetupControls
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -