📄 ui_tacref.cpp
字号:
Entity *ent;
ent=Reference->Find(EntityID);
if(ent)
EntityToWindow(ent);
}
// Finds first occurence of SubGroup... loads that record
static void LoadSubGroup(long SubGroupID)
{
long EntID;
EntID=InfoToWindow(SubGroupID);
LoadEntity(EntID);
}
// Finds first occurence of Group... loads that record
static void LoadGroup(long GroupID)
{
long SubGroupID;
switch(GroupID)
{
case CAT_AIRCRAFT:
SubGroupID=SUB_CAT_AIRCRAFT_FIGHTERS;
break;
case CAT_VEHICLES:
SubGroupID=SUB_CAT_VEHICLES_TANKS;
break;
case CAT_MUNITIONS:
SubGroupID=SUB_CAT_MUNITIONS_AAM;
break;
default:
SubGroupID=0;
break;
}
SetSubGroupButton(SubGroupID);
LoadSubGroup(SubGroupID);
}
static void SelectGroupCB(long ID,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
if(hittype != C_TYPE_LMOUSEUP)
return;
StopRWRSounds();
Leave=UI_Enter(control->Parent_);
// Hide/Unhide SubCat buttons
if(control->GetUserNumber(1))
control->Parent_->HideCluster(control->GetUserNumber(1));
if(control->GetUserNumber(2))
control->Parent_->HideCluster(control->GetUserNumber(2));
if(control->GetUserNumber(0))
control->Parent_->UnHideCluster(control->GetUserNumber(0));
LoadGroup(ID);
UI_Leave(Leave);
}
static void SelectSubGroupCB(long ID,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
if(hittype != C_TYPE_LMOUSEUP)
return;
StopRWRSounds();
Leave=UI_Enter(control->Parent_);
LoadSubGroup(ID);
UI_Leave(Leave);
}
static void SelectEntityCB(long ID,short hittype,C_Base *control)
{
F4CSECTIONHANDLE *Leave;
C_ListBox *lbox=(C_ListBox*)control;
if(hittype != C_TYPE_SELECT)
return;
StopRWRSounds();
Leave=UI_Enter(control->Parent_);
ID=lbox->GetTextID();
LoadEntity(ID);
UI_Leave(Leave);
}
static void SelectRWRCB(long ID,short hittype,C_Base *control)
{
C_ListBox *lbox=(C_ListBox*)control;
if(hittype != C_TYPE_SELECT)
return;
StopRWRSounds();
ID=lbox->GetTextID();
SelectRWR(ID);
}
static void PlaySoundCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
if(control->GetState())
{
F4StopSound (SFX_DEF[LastLockTone].handle);
LastLockTone=control->GetUserNumber(0);
if(LastLockTone != -1)
F4LoopSound (SFX_DEF[LastLockTone].handle);
}
else if(LastLockTone != -1)
{
F4StopSound (SFX_DEF[LastLockTone].handle);
LastLockTone=-1;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This is the function which makes your objects draw behind the panner/zoomer
//
// DON'T CHANGE IT
//
void ReplaceDummyControl(C_Window *win)
{
CONTROLLIST *cur;
C_TimerHook *objectviewer;
F4CSECTIONHANDLE *Leave;
cur=win->GetControlList();
while(cur)
{
if(cur->Control_->GetID() == TACREF_SCAB_CTRL)
{
Leave=UI_Enter(win);
objectviewer = new C_TimerHook;
objectviewer->Setup( C_DONT_CARE,C_TYPE_NORMAL );
objectviewer->SetClient(0);
objectviewer->SetXY(win->ClientArea_[0].left,win->ClientArea_[0].top);
objectviewer->SetW(win->ClientArea_[0].right - win->ClientArea_[0].left);
objectviewer->SetH(win->ClientArea_[0].bottom - win->ClientArea_[0].top);
objectviewer->SetRefreshCallback(TACREF_ViewTimerCB); // new
objectviewer->SetDrawCallback(TACREF_ViewBSPObjectCB);
objectviewer->SetFlagBitOff( C_BIT_TIMER );
objectviewer->SetReady( 1);
objectviewer->SetParent(win);
cur->Control_->Cleanup();
delete cur->Control_;
cur->Control_=objectviewer;
UI_Leave(Leave);
return;
}
cur=cur->Next;
}
}
static void HookupTacticalReferenceControls(long ID)
{
C_Window *winme;
C_Button *ctrl;
C_Panner *panner;
C_ListBox *lbox;
C_TimerHook *drawTimer;
winme=gMainHandler->FindWindow(ID);
if(winme == NULL)
return;
if(ID == TAC_REF_WIN)
winme->SetDragCallback(TACMoveRendererCB);
// Hook up AIRCRAFT SELECT button
ctrl=(C_Button *)winme->FindControl(CAT_AIRCRAFT);
if(ctrl != NULL)
ctrl->SetCallback(SelectGroupCB);
// Hook up VEHICLES SELECT button
ctrl=(C_Button *)winme->FindControl(CAT_VEHICLES);
if(ctrl != NULL)
ctrl->SetCallback(SelectGroupCB);
// Hook up MUNITIONS SELECT button
ctrl=(C_Button *)winme->FindControl(CAT_MUNITIONS);
if(ctrl != NULL)
ctrl->SetCallback(SelectGroupCB);
// Hook up SUB AIRCRAFT FIGHTERS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_FIGHTERS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB AIRCRAFT ATTACK button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_ATTACK);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB AIRCRAFT BOMBERS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_BOMBERS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB AIRCRAFT HELICOPTERS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_HELICOPTERS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB AIRCRAFT SUPPORT button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_SUPPORT);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB AIRCRAFT EW button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_AIRCRAFT_EW);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES TANKS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_TANKS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES IFVS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_IFVS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES ARTILLERY button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_ARTILLERY);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES AIRDEFENSE button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_AIRDEFENSE);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES SUPPORT button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_SUPPORT);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB VEHICLES SHIPS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_VEHICLES_SHIPS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS AAM button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_AAM);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS AGM button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_AGM);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS ARM button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_ARM);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS BOMBS button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_BOMBS);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS STORES button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_STORES);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up SUB MUNITIONS GROUND button
ctrl=(C_Button *)winme->FindControl(SUB_CAT_MUNITIONS_GROUND);
if(ctrl != NULL)
ctrl->SetCallback(SelectSubGroupCB);
// Hook up Close Button
ctrl=(C_Button *)winme->FindControl(CLOSE_WINDOW);
if(ctrl != NULL)
ctrl->SetCallback(TACREFCloseWindowCB);
// for ROTATION
panner = (C_Panner *)winme->FindControl(TACREF_PANNER);
if(panner != NULL)
panner->SetCallback( TACREF_PannerCB );
// for ZOOM
panner = (C_Panner *)winme->FindControl(TACREF_ZOOMER);
if(panner != NULL)
panner->SetCallback( TACREF_ZoomCB);
lbox=(C_ListBox *)winme->FindControl(ENTITY_LIST);
if(lbox != NULL)
lbox->SetCallback(SelectEntityCB);
// RWR LISTBOX
lbox=(C_ListBox *)winme->FindControl(RWR_LIST);
if(lbox != NULL)
lbox->SetCallback(SelectRWRCB);
// Hook up RWR Search Tone
ctrl=(C_Button *)winme->FindControl(PLAY_SEARCH_TONE);
if(ctrl != NULL)
ctrl->SetCallback(PlaySoundCB);
// Hook up RWR Lock Tone
ctrl=(C_Button *)winme->FindControl(PLAY_LOCK_TONE);
if(ctrl != NULL)
ctrl->SetCallback(PlaySoundCB);
// Help GUIDE thing
ctrl=(C_Button*)winme->FindControl(UI_HELP_GUIDE);
if(ctrl)
ctrl->SetCallback(UI_Help_Guide_CB);
if(ID == TAC_REF_WIN)
{
ReplaceDummyControl(winme);
drawTimer = new C_TimerHook;
drawTimer->Setup( C_DONT_CARE,C_TYPE_NORMAL );
drawTimer->SetClient(0);
drawTimer->SetXY(winme->ClientArea_[0].left,winme->ClientArea_[0].top);
drawTimer->SetW(winme->ClientArea_[0].right - winme->ClientArea_[0].left);
drawTimer->SetH(winme->ClientArea_[0].bottom - winme->ClientArea_[0].top);
drawTimer->SetUpdateCallback(TACREF_ViewTimerAnimCB );
drawTimer->SetReady( 1);
drawTimer->SetUserNumber(_UI95_TIMER_DELAY_,1);
winme->AddControl( drawTimer );
}
}
BOOL TacRef_Setup()
{
C_Window *win;
win=gMainHandler->FindWindow(TAC_REF_WIN);
if(win)
{
if(TAC_Viewer == NULL)
{
if(TAC_Viewer != NULL)
{
TAC_Viewer->Cleanup();
delete TAC_Viewer;
}
CurrentModel=0;
CurrentWeapon=0;
CurrentEntity=0;
TAC_Viewer=new C_3dViewer;
TAC_Viewer->Setup();
TAC_Viewer->Viewport(win,0);
TAC_Viewer->Init3d(30.0f);
}
if(!Reference)
{
Reference=new TacticalReference;
Reference->Load("tacrefdb.bin");
SetGroupButton(CAT_AIRCRAFT);
LoadGroup(CAT_AIRCRAFT);
}
return(TRUE);
}
return(FALSE);
}
void TacRef_Cleanup()
{
if(TAC_Viewer)
{
UnloadObject(); // just in case :)
TAC_Viewer->Cleanup();
delete TAC_Viewer;
TAC_Viewer=NULL;
}
if(Reference)
{
Reference->Cleanup();
delete Reference;
Reference=NULL;
}
}
void LoadTacticalReferenceWindows()
{
long ID;
if(TACREFLoaded) return;
if( _LOAD_ART_RESOURCES_)
gMainParser->LoadImageList("art\\ref_res.lst");
else
gMainParser->LoadImageList("art\\ref_art.lst");
gMainParser->LoadSoundList("art\\ref_snd.lst");
gMainParser->LoadWindowList("art\\ref_scf.lst");
ID=gMainParser->GetFirstWindowLoaded();
while(ID)
{
HookupTacticalReferenceControls(ID);
ID=gMainParser->GetNextWindowLoaded();
}
TACREFLoaded++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -