385 lines
10 KiB
C++
385 lines
10 KiB
C++
// EdIRCtl.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Defines.hpp"
|
|
|
|
#ifdef D_ED_IR_ACTIVE
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
#include "EDACCust.hpp"
|
|
|
|
#include "EdIRird.hpp"
|
|
#include "edirfrm.hpp"
|
|
#include "edirbeen.hpp"
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
|
|
#include "EdIRCtl.hpp"
|
|
#include "EdIRDat.hpp"
|
|
#include "EdIRQuer.hpp"
|
|
#include "EdIRWaW.hpp"
|
|
|
|
#include "EDACDoc.hpp"
|
|
#include "EDACActr.hpp"
|
|
#include "_Actors.hpp"
|
|
|
|
#include "Ctl.h"
|
|
|
|
//ANNECY CB
|
|
#include "x:\cpa\main\inc\_EditID.h"
|
|
#include "ai_intf.hpp"
|
|
#include "EDIRDvVw.hpp"
|
|
//END
|
|
|
|
#define C_OWNER_DATA_DATA_LEVEL "Data Level"
|
|
#define C_OWNER_DATA_VISIBILITY "Visibility"
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
#define C_OWNER_DATA_QUALIFIER "Data Qualifier"
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
|
|
#include "EdIRStrg.hpp"
|
|
|
|
/**********************************************************************************/
|
|
void fn_vDeleteControl(CTL_Editor_Control *pclControl)
|
|
{
|
|
delete pclControl;
|
|
}
|
|
|
|
/**********************************************************************************/
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
void fn_vAddOwnerData(CTL_Editor_Control *pclControl,OAC_tdeDataLevel eDataLevel,OAC_tdeControlVisibility eVisibility, enum OAC_eDataQualifier eDataQualifier/*= OAC_DATA_PUBLIC*/)
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
{
|
|
pclControl->m_pub_fn_pclAddOwnerData((long)eDataLevel,C_OWNER_DATA_DATA_LEVEL);
|
|
pclControl->m_pub_fn_pclAddOwnerData((long)eVisibility,C_OWNER_DATA_VISIBILITY);
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
pclControl->m_pub_fn_pclAddOwnerData((long)eDataQualifier,C_OWNER_DATA_QUALIFIER);
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
}
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
/**********************************************************************************/
|
|
OAC_tdeDataQualifier fn_eGetDataQualifier(CTL_Editor_Control *pclControl)
|
|
{
|
|
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_QUALIFIER);
|
|
if(pclOwnerData!=NULL)
|
|
return (OAC_tdeDataQualifier)(pclOwnerData->m_pub_fn_lGetData());
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
|
|
return OAC_DATA_PUBLIC;
|
|
}
|
|
}
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
|
|
/**********************************************************************************/
|
|
OAC_tdeDataLevel fn_eGetDataLevel(CTL_Editor_Control *pclControl)
|
|
{
|
|
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_DATA_LEVEL);
|
|
if(pclOwnerData!=NULL)
|
|
return (OAC_tdeDataLevel)(pclOwnerData->m_pub_fn_lGetData());
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
|
|
return OAC_DATA_LEVEL_1;
|
|
}
|
|
}
|
|
|
|
/**********************************************************************************/
|
|
OAC_tdeControlVisibility fn_eGetVisibility(CTL_Editor_Control *pclControl)
|
|
{
|
|
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_VISIBILITY);
|
|
if(pclOwnerData!=NULL)
|
|
return (OAC_tdeControlVisibility)(pclOwnerData->m_pub_fn_lGetData());
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
|
|
return EDCAR_DATA_VISI_DUAL;
|
|
}
|
|
}
|
|
|
|
/**********************************************************************************/
|
|
BOOL fn_bMustDisplay(CTL_Editor_Control *pclControl)
|
|
{
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
CPA_EdIR_Frame *pclIRMainFrame = g_pclAIInterface->m_pclIRMainFrame;
|
|
if (pclIRMainFrame)
|
|
{
|
|
CPA_EdIR_Brain *pclBrain = pclIRMainFrame -> m_pclBrain;
|
|
if (pclBrain)
|
|
{
|
|
OAC_tdeDataQualifier eDataQualifier = fn_eGetDataQualifier (pclControl);
|
|
if (eDataQualifier == OAC_DATA_PRIVATE && ! pclBrain -> m_bShowPrivateVariable)
|
|
return FALSE;
|
|
}
|
|
}
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
|
|
EdActors_MyDocument *pclDocument=fn_pclGetEdActorsDocument();
|
|
OAC_eDataLevel eDataLevel=fn_eGetDataLevel(pclControl);
|
|
OAC_tdeControlVisibility eVisibility=fn_eGetVisibility(pclControl);
|
|
//ANNECY CB
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
|
|
//CPA2 Stegaru Cristian 98-06
|
|
if((pclDsgVarView->mfn_bHideVariables ())||(g_pclAIInterface->m_bIsOpened == FALSE))
|
|
//End CPA2 Stegaru Cristian 98-06
|
|
return FALSE;
|
|
//END
|
|
|
|
//Stefan Dumitrean 14-07-98 ( OAC Buttons )
|
|
BOOL bMustDisplayBecauseRightLevel = TRUE;
|
|
|
|
/*
|
|
switch( eDataLevel )
|
|
{
|
|
case OAC_DATA_LEVEL_1:
|
|
if( bMustDisplayBecauseRightLevel = pclDocument->m_aCurrentOACButtonsPressed[0] )
|
|
switch( pclControl->m_ucInitialCurrentPair )
|
|
{
|
|
case 1: //is initial
|
|
bMustDisplayBecauseRightLevel = !pclDocument->m_aCurrentOACButtonsPressed[2];
|
|
break;
|
|
case 2: //is current
|
|
bMustDisplayBecauseRightLevel = pclDocument->m_aCurrentOACButtonsPressed[2];
|
|
}
|
|
break;
|
|
case OAC_DATA_LEVEL_2:
|
|
bMustDisplayBecauseRightLevel =
|
|
pclDocument->m_aCurrentOACButtonsPressed[1] && !pclDocument->m_aCurrentOACButtonsPressed[2];
|
|
break;
|
|
case OAC_DATA_LEVEL_3:
|
|
bMustDisplayBecauseRightLevel =
|
|
pclDocument->m_aCurrentOACButtonsPressed[1] && pclDocument->m_aCurrentOACButtonsPressed[2];
|
|
}
|
|
*/
|
|
switch( eDataLevel )
|
|
{
|
|
case OAC_DATA_LEVEL_1:
|
|
switch( pclControl->m_ucInitialCurrentPair )
|
|
{
|
|
case 1: //is initial
|
|
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayInitialValue;
|
|
break;
|
|
case 2: //is current
|
|
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayCurrentValue;
|
|
}
|
|
break;
|
|
case OAC_DATA_LEVEL_2:
|
|
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayInitialValue;
|
|
break;
|
|
case OAC_DATA_LEVEL_3:
|
|
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayCurrentValue;
|
|
}
|
|
return (
|
|
|
|
/* (
|
|
(pclDocument->m_tdeCurrentDataLevel>=eDataLevel)
|
|
&&
|
|
(!pclDocument->m_bExclusiveLevel)
|
|
)
|
|
||
|
|
(
|
|
(pclDocument->m_tdeCurrentDataLevel==eDataLevel)
|
|
&&
|
|
(pclDocument->m_bExclusiveLevel)
|
|
)
|
|
*/
|
|
bMustDisplayBecauseRightLevel
|
|
//End Stefan Dumitrean 14-07-98 ( OAC Buttons )
|
|
)
|
|
&&
|
|
(
|
|
(
|
|
(
|
|
(eVisibility==EDCAR_DATA_VISI_ONLY_INSTANCES)
|
|
||
|
|
(eVisibility==EDCAR_DATA_VISI_DUAL)
|
|
)
|
|
&&
|
|
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_Instance)
|
|
)
|
|
||
|
|
(
|
|
(
|
|
(eVisibility==EDCAR_DATA_VISI_ONLY_MODELS)
|
|
||
|
|
(eVisibility==EDCAR_DATA_VISI_DUAL)
|
|
)
|
|
&&
|
|
(
|
|
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_Model)
|
|
||
|
|
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_AlwaysModel)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
/**********************************************************************************/
|
|
void fn_vOnButtonClick(CTL_Editor_Static *pclStatic,enum CTL_eClickType eClickType)
|
|
{
|
|
if(pclStatic!=NULL)
|
|
{
|
|
if(pclStatic->m_pub_fn_tdeGetType()==CTL_STATIC_TYPE__FIELD_NAME)
|
|
{
|
|
CTL_Editor_Control *pclControl=pclStatic->m_pub_fn_pclGetParentControl();
|
|
|
|
if(pclControl!=NULL)
|
|
{
|
|
CTL_Editor_Data *pclData=pclControl->m_fn_pclGetEditedData();
|
|
|
|
if(pclData!=NULL && fn_pclGetAssociatedControl(pclData)==NULL)
|
|
{
|
|
switch(eClickType)
|
|
{
|
|
case CTL_CLICK_TYPE__LEFT_CLICK:
|
|
break;
|
|
|
|
case CTL_CLICK_TYPE__RIGHT_CLICK:
|
|
{
|
|
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
|
|
if(pclActor->m_pclActor->m_fn_bIsAnInstance())
|
|
{
|
|
if(fn_bIsInWatch(pclData))
|
|
{
|
|
fn_vRemoveValueFromWatch(pclData);
|
|
fn_vSetInWatch(pclData,FALSE);
|
|
pclStatic->InvalidateRect(NULL);
|
|
}
|
|
else
|
|
{
|
|
fn_vAddValueInWatch(pclData);
|
|
fn_vSetInWatch(pclData,TRUE);
|
|
pclStatic->InvalidateRect(NULL);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK:
|
|
break;
|
|
|
|
case CTL_CLICK_TYPE__RIGHT_DOUBLE_CLICK:
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
|
|
/**********************************************************************************/
|
|
void fn_vGetStaticColor(CTL_Editor_Static *pclStatic,COLORREF &r_ColRefBackGround,COLORREF &r_ColRefText)
|
|
{
|
|
if(pclStatic!=NULL)
|
|
{
|
|
if(pclStatic->m_pub_fn_tdeGetType()==CTL_STATIC_TYPE__FIELD_NAME)
|
|
{
|
|
CTL_Editor_Control *pclControl=pclStatic->m_pub_fn_pclGetParentControl();
|
|
|
|
if(pclControl!=NULL)
|
|
{
|
|
CTL_Editor_Data *pclData=pclControl->m_fn_pclGetEditedData();
|
|
|
|
if(pclData!=NULL)
|
|
{
|
|
if(fn_bIsInWatch(pclData))
|
|
{
|
|
r_ColRefBackGround=RGB(192,50,50);
|
|
r_ColRefText=RGB(0,0,0);
|
|
}
|
|
else
|
|
{
|
|
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
|
|
if(pclActor->m_pclActor->m_fn_bIsAnInstance())
|
|
{
|
|
switch (fn_eGetDataLevel(pclControl))
|
|
{
|
|
case OAC_DATA_LEVEL_1:
|
|
switch (pclControl->m_ucInitialCurrentPair)
|
|
{
|
|
case 2:
|
|
r_ColRefBackGround=RGB(0,192,192);
|
|
r_ColRefText=RGB(0,0,0);
|
|
break;
|
|
case 1:
|
|
r_ColRefBackGround=RGB(192,192,0);
|
|
r_ColRefText=RGB(0,0,0);
|
|
break;
|
|
case 0:
|
|
default:
|
|
r_ColRefBackGround=RGB(0,192,0);
|
|
r_ColRefText=RGB(0,0,0);
|
|
break;
|
|
}
|
|
break;
|
|
|
|
case OAC_DATA_LEVEL_2:
|
|
r_ColRefBackGround=RGB(192,192,0);
|
|
r_ColRefText=RGB(0,0,0);
|
|
break;
|
|
|
|
case OAC_DATA_LEVEL_3:
|
|
r_ColRefBackGround=RGB(0,192,192);
|
|
r_ColRefText= RGB(0,0,0);
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Shaitan => Check Save type
|
|
if (pclData->m_pub_fn_csGetDataName().Find(g_c_csDsgVarSaveTypeText) != -1)
|
|
{
|
|
r_ColRefBackGround=((CTL_Editor_EnumData *)pclData)->m_pclCurrentValue->m_pub_fn_lGetValue() ? RGB(255,100,200) : RGB(0,255,255);
|
|
r_ColRefText= RGB(0,0,0);
|
|
}
|
|
else if (pclData->m_pub_fn_csGetDataName().Find(g_c_csDsgVarInitTypeText)!= -1)
|
|
{
|
|
r_ColRefBackGround=(((CTL_Editor_EnumData *)pclData)->m_pclCurrentValue->m_pub_fn_lGetValue() != OTI_PlayerDead) ? RGB(255,100,0) : RGB(255,255,0);
|
|
r_ColRefText = RGB(0,0,0);
|
|
}
|
|
else
|
|
{
|
|
r_ColRefBackGround=RGB(192,192,0);
|
|
r_ColRefText= RGB(0,0,0);
|
|
}
|
|
|
|
// End Shaitan => Check Save type
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
|
|
#endif //D_ED_IR_ACTIVE
|