reman3/Rayman_X/cpa/tempgrp/Owp/src/WPMod.cpp

132 lines
4.5 KiB
C++

/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WPMod.cpp
//
// Modification classes
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Thénoz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WpObj.hpp"
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "WayObj.hpp"
#include "LinkObj.hpp"
*/
//ENDANNECY Shaitan Nettoyage }
#include "WPMod.hpp"
#include "WPDia.hpp"
#include "inter.hpp"
ModifWayPointRadius::ModifWayPointRadius (WayPoint* poWP, GLI_tdxValue* pxR, BOOL pBlock) : CPA_Modif (TYPE_RADIUS_WP,"Change radius WayPoint",pBlock)
{
m_poWP = poWP;
m_xOldRadius = 0.;
m_xNewRadius = *pxR;
m_bFirstTime=TRUE;
}
BOOL ModifWayPointRadius::Do (void)
{
m_xOldRadius = WP_fnx_WayPoint_GetRadius (m_poWP->GetStruct() );
WP_fnv_WayPoint_SetRadius (m_poWP->GetStruct(), m_xNewRadius);
if (m_bFirstTime) m_bFirstTime=FALSE;
WayPoint::fn_pGetDialog()->fn_vRefreshDialog();
m_poWP->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayPointRadius::Undo (void)
{
WP_fnv_WayPoint_SetRadius (m_poWP->GetStruct(), m_xOldRadius);
WayPoint::fn_pGetDialog()->fn_vRefreshDialog();
m_poWP->fn_vNotifySave ();
return TRUE;
}
ModifWayPointCoordinate::ModifWayPointCoordinate (WayPoint* poWP, BOOL pBlock) : CPA_Modif (TYPE_COORDINATE_WP,"Change coordinate WayPoint",pBlock)
{
m_poWP = poWP;
m_bFirstTime=TRUE;
if (!m_poWP->fn_bGetCoordinate()) m_poWP->fn_vSetFather ( (CPA_SuperObject*)(m_poWP->GetSuperObject()->GetParent()) );
}
BOOL ModifWayPointCoordinate::Do (void)
{
fn_vChangeSystemCoordinate ();
if (m_bFirstTime) m_bFirstTime=FALSE;
else WayPoint::fn_pGetDialog()->fn_vRefreshDialog();
m_poWP->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayPointCoordinate::Undo (void)
{
fn_vChangeSystemCoordinate ();
WayPoint::fn_pGetDialog()->fn_vRefreshDialog();
m_poWP->fn_vNotifySave ();
return TRUE;
}
void ModifWayPointCoordinate::fn_vChangeSystemCoordinate (void)
{
BOOL bAbsoluteCoordinate = !m_poWP->fn_bGetCoordinate();
m_poWP->fn_vSetCoordinate (bAbsoluteCoordinate);
// traitement coordonnées moteurs
if (bAbsoluteCoordinate)
{
m_poWP->GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poWP->GetSuperObject(), FALSE, FALSE, FALSE, FALSE);
m_poWP->GetSuperObject()->SetTypeSO (C_Dynamic);
POS_tdstCompletePosition *pParentMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(m_poWP->fn_pGetFather()->GetStruct());
POS_tdstCompletePosition *pInstanceMatrix = HIE_fn_hGetSuperObjectMatrix(m_poWP->GetSuperObject()->GetStruct());
POS_fn_vMulMatrixMatrix(pInstanceMatrix, pParentMatrix, pInstanceMatrix);
m_poWP->GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy ( m_poWP->GetSuperObject(), m_poWP->GetInterface()->GetInterface()->GetSpecificInterface()->GetDynamicRoot(), FALSE, FALSE, FALSE );
HIE_fn_vSetSuperObjectDrawMask(m_poWP->GetSuperObject()->GetStruct(), GLI_C_lAllIsEnable );
HIE_fn_vSetSuperObjectDrawMask(m_poWP->GetSuperObject()->GetHead()->GetStruct(), GLI_C_lAllIsEnable );
m_poWP->GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
else
{
m_poWP->GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poWP->GetSuperObject(), FALSE, FALSE, FALSE, FALSE);
m_poWP->GetSuperObject()->SetTypeSO (C_Protected);
POS_tdstCompletePosition *pParentMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(m_poWP->fn_pGetDynamicFather()->GetStruct());
POS_tdstCompletePosition stInvertMatrix;
POS_fn_vInvertMatrix(&stInvertMatrix, pParentMatrix);
POS_tdstCompletePosition *pInstanceMatrix = HIE_fn_hGetSuperObjectMatrix(m_poWP->GetSuperObject()->GetStruct());
POS_fn_vMulMatrixMatrix(pInstanceMatrix, &stInvertMatrix, pInstanceMatrix);
m_poWP->GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy ( m_poWP->GetSuperObject(), m_poWP->fn_pGetDynamicFather(), FALSE, FALSE, FALSE );
WP_fnv_WayPoint_SetSuperObject (m_poWP->GetStruct(), m_poWP->fn_pGetFather()->GetStruct() );
m_poWP->GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
}