Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,527 @@
/*=========================================================================================
File: Bezier.c
Prupose: Handle a Bezier curve
Author: Yann Le Tensorer
Creation Date: 23 january 1997
Version: 1.0
===========================================================================================
Revisions: Version Date Author
----------------------------------------------------------------
1.1 3 february 1997 Yann Le Tensorer
1.2 5 february 1997 Yann Le Tensorer
Added the possibility of changing the sampling rate in real-time
=========================================================================================*/
/*==========================================================
Notes:
This module implements functions to create and draw bezier curves
here is an example how to use it:
{
tdstBezierObject BezierCurve;
long color;
MTH3D_tdstVector A,B,T1,T2;
ACP_tdstDynaParam stDynaParam;
unsigned char ucSamplingRate;
color=0xffffffff; // white
A.xX=0;
A.xY=0;
A.xZ=0;
B.xX=1;
B.xY=1;
B.xZ=0;
T1.xX=0;
T1.xY=0.25;
T1.xZ=0;
T2.xX=-0.25;
T2.xY=0;
T2.xZ=0;
ucSamplingRate=20; // Sampling rate
fn_vDynamicObject_Create(&stDynaParam,ucSamplingRate,C_ucSinus,0,MTH_C_Pi,255);
fn_vBezierObject_Create(&BezierCurve,ucSamplingRate,&A,&B,&T1,&T2,C_ucModeNoObject,&stDynaParam);
fn_vBezierObject_SetColor(&BezierCurve,color);
fn_vBezierObject_SetViewPortAttributes(...); // en fonction du viewport
fn_vBezierObject_Draw(&BezierCurve);
fn_vBezierObject_Free(&BezierCurve);
}
===========================================================*/
#ifdef _AI_LIB_
#include "AIUseCPA.h"
/*#include "acp_base.h"*/
/*#include "gli.h"*/
#include "geoobj.h"
#include "bezier.h"
#include "IAOption.h"
#include "IAMacros.h"
/* AI memory and error management */
#include "MemIA.h"
#include "ErrIA.h"
#else /*_AI_LIB_*/
#include "acp_base.h"
#include "gli.h"
#include "geoobj.h"
#include "bezier.h"
#endif /*_AI_LIB_*/
/*============================================================
Memory management macros, to be replaced with correct memory management
============================================================*/
#ifdef _AI_LIB_
#define M_malloc(pointer,cast,size) M_IAAlloc(pointer,cast,size)
#define M_free(pointer) M_IAFree(pointer)
#else /*_AI_LIB_*/
#define M_malloc(pointer,cast,size) (pointer=(cast)malloc(size))
#define M_free(pointer) (free(pointer))
#endif /*_AI_LIB_*/
/*==========================================================
Function name: fn_vBezierObject_Create
Description: Create Bezier curve (in ram only) between two points
Input: p_BezierObject: pointer to a preallocated tdstBezierObject
ucSamplingRate: number of segment to define the curve)
stStartPoint: First vertex of the curve
stEndPoint: Last vertex of the curve
stStartVector: Tangent vector at the first point
stEndVector: Tangent vector at the last point
ucObjectMode: Creation mode (C_ucModeNoObject ou C_ucModeRealObject)
C_ucModeNoObject does not create a geometric object
whereas C_ucModeRealObject does.
Output: none
Author: Yann Le Tensorer
Date: 23 january 1997
Revision: YLT - 03 february 1997
==========================================================*/
void fn_vBezierObject_Create( tdstBezierObject *p_BezierObject,
unsigned char ucSamplingRate,
MTH3D_tdstVector* p_stStartPoint,
MTH3D_tdstVector* p_stEndPoint,
MTH3D_tdstVector* p_stStartVector,
MTH3D_tdstVector* p_stEndVector,
unsigned char ucObjectMode,
ACP_tdstDynaParam* p_stDynaParams
)
{
GEO_tdstDoubledIndex xLineDoubleIndex;
long xCurVertex;
if (p_BezierObject==0) return; /* avoid crash */
/* copies input parameters into objects parameters */
p_BezierObject->ucObjectMode =ucObjectMode;
p_BezierObject->ucSamplingRate =ucSamplingRate;
p_BezierObject->stStartPoint =*p_stStartPoint;
p_BezierObject->stEndPoint =*p_stEndPoint;
p_BezierObject->stStartVector =*p_stStartVector;
p_BezierObject->stEndVector =*p_stEndVector;
p_BezierObject->p_stDynaParams =p_stDynaParams;
/* if mode is MODE_NO_OBJECT, allocates ram only for points list and dynamic parameters */
if (ucObjectMode==C_ucModeNoObject)
{
M_malloc ( p_BezierObject->d_stListOfPoints,
MTH3D_tdstVector*,
(ucSamplingRate+1)*sizeof(MTH3D_tdstVector)
);
}
else
/* else mode is MODE_REAL_OBJET, creates the geometric object*/
{
/* This list of points is not used */
p_BezierObject->d_stListOfPoints=0;
/* create object with 1 element (lines only), and ucSamplingRate+1 points) */
GEO_vCreateGeometricObject(&p_BezierObject->hObject,ucSamplingRate+1,1);
/* create line element*/
GEO_xCreateElementLines(p_BezierObject->hObject,&p_BezierObject->hElement,ucSamplingRate);
/* create lines indexes */
for (xCurVertex=0;xCurVertex<ucSamplingRate;xCurVertex++)
{
/* define start and end vertex of a line */
xLineDoubleIndex.a2_xIndex[0]=xCurVertex;
xLineDoubleIndex.a2_xIndex[1]=xCurVertex+1;
/* set line index */
GEO_xSetIndexOfElementLines(p_BezierObject->hObject,p_BezierObject->hElement,xCurVertex,&xLineDoubleIndex);
}
}
/* calculate points of bezier curve */
fn_vBezierObject_Calculate(p_BezierObject);
}
/*===============================================================================
Function name: fn_bBezierObject_SetSamplingRate
Description: Modifies the sampling rate of a bezier object, and changes all
the depending parameters (including dynamic sampling rate)
Input: p_BezierObject: pointer to a preallocated tdstBezierObject
ucSamplingRate: New sampling rate
Output: return value is true if sampling rate could be modified,
false if not.
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
Note: The sampling rate can only be modified for objects that have been
created using C_ucModeNoObject at their creation.
================================================================================*/
ACP_tdxBool fn_bBezierObject_SetSamplingRate(tdstBezierObject *p_BezierObject,
unsigned char ucSamplingRate)
{
if (p_BezierObject==0) return FALSE;
if (p_BezierObject->ucObjectMode==C_ucModeNoObject)
{
/* copies new sampling rate value into objects parameters */
p_BezierObject->ucSamplingRate =ucSamplingRate;
if (p_BezierObject->ucSamplingRate<2) p_BezierObject->ucSamplingRate=2;
/* free old list of points and allocates new one */
if (p_BezierObject->d_stListOfPoints!=0)
M_free(p_BezierObject->d_stListOfPoints);
M_malloc ( p_BezierObject->d_stListOfPoints,
MTH3D_tdstVector*,
(p_BezierObject->ucSamplingRate+1)*sizeof(MTH3D_tdstVector)
);
/* calculate points of bezier curve */
fn_vBezierObject_Calculate(p_BezierObject);
/* checks if dynamic parameters are attached to the object
if yes, changes them to match the new sampling rate */
fn_vDynamicObject_ChangeSamplingRate(p_BezierObject->p_stDynaParams,
p_BezierObject->ucSamplingRate);
return TRUE;
}
else
return FALSE;
}
/*==========================================================
Function name: fn_vBezierObject_Free
Description: Free memory allocated by the bezier objet
Input: p_BezierObject: pointer to a tdstBezierObject
Output: none
Author: Yann Le Tensorer
Date: 29 january 1997
Revision:
==========================================================*/
void fn_vBezierObject_Free(tdstBezierObject *p_BezierObject)
{
if (p_BezierObject!=0)
{
if (p_BezierObject->d_stListOfPoints!=0)
M_free(p_BezierObject->d_stListOfPoints);
/* if dynamic parameters are present, free memory too */
if (p_BezierObject->p_stDynaParams!=0)
fn_vDynamicObject_Free(p_BezierObject->p_stDynaParams);
}
}
/*==========================================================
Function name: fn_vBezierObject_Calculate
Description: Calculates the points of the b<>zier curve according to the
parameters specified when creating the object.
Input: p_BezierObject: Pointer to a pre-created bezier object
Output: none
Author: Yann Le Tensorer
Date: 23 january 1997
Revision:
==========================================================*/
void fn_vBezierObject_Calculate(tdstBezierObject *p_BezierObject)
{
double xt,endxt,t,c0,c1,c2,c3,c4,c5,c6;
MTH3D_tdstVector A,B,T1,T2;
MTH3D_tdstVector *p_stPointList;
if (p_BezierObject==0) return; /* avoid crash */
if (p_BezierObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_BezierObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_BezierObject->d_stListOfPoints);
A = p_BezierObject->stStartPoint;
B = p_BezierObject->stEndPoint;
MTH3D_M_vAddVector(&T1,&p_BezierObject->stStartVector,&p_BezierObject->stStartPoint);
MTH3D_M_vAddVector(&T2,&p_BezierObject->stEndVector,&p_BezierObject->stEndPoint);
endxt= p_BezierObject->ucSamplingRate;
for (xt=0;xt<=endxt;xt++)
{
t=xt/endxt;
c0=1-t; /* 1-t */
c2=c0*c0; /* (1-t)^2 */
c1=3*t*c2; /* 3t*((1-t)^2) */
c3=t*t; /* t^2 */
c4=3*c3*c0; /* 3t^2*(1-t) */
c5=c0*c2; /* (1-t)^3 */
c6=c3*t; /* t^3 */
p_stPointList->xX=(c5*A.xX)+(c1*T1.xX)+(c4*T2.xX)+(c6*B.xX);
p_stPointList->xY=(c5*A.xY)+(c1*T1.xY)+(c4*T2.xY)+(c6*B.xY);
p_stPointList->xZ=(c5*A.xZ)+(c1*T1.xZ)+(c4*T2.xZ)+(c6*B.xZ);
p_stPointList++;
}
}
/*==========================================================
Function name: fn_vBezierObject_SetColor
Description: Set the color of a bezier object.
Input: p_BezierObject: pointer to a pre-created tdstBezierObject
color: 24 bit color of object. (0->7=B; 8->15=G; 16->23=R ; 24->32=Unused)
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vBezierObject_SetColor(tdstBezierObject *p_BezierObject,long color)
{
if (p_BezierObject==0) return; /* avoid crash */
p_BezierObject->color=color;
}
/*==========================================================
Function name: fn_vBezierObject_SetViewPortAttributes
Description: Set the viewportattributes for drawing.
Input: p_BezierObject: pointer to a pre-created tdstBezierObject
p_ViewPortAttributes: pointer to pre-defined viewport attributes
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vBezierObject_SetViewPortAttributes(tdstBezierObject *p_BezierObject,GLD_tdstViewportAttributes *p_ViewPortAttributes)
{
if (p_BezierObject==0) return; /* avoid crash */
p_BezierObject->p_ViewPortAttributes=p_ViewPortAttributes;
}
/*==========================================================
Function name: fn_vBezierObject_Draw
Description: Draw Bezier object on screen
Input: p_BezierObject: pointer to a pre-created tdstBezierObject
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vBezierObject_Draw(tdstBezierObject *p_BezierObject)
{
POS_tdstCompletePosition stMatrix;
GEO_tdstColor ColBidon;
MTH3D_tdstVector *p_stPointList;
MTH3D_tdstVector *p_stPointListEnd;
POS_fn_vSetIdentityMatrix(&stMatrix);
if (p_BezierObject==0) return; /* avoid crash */
/*unsigned long color; */
ColBidon.xR=(float)0.5;
ColBidon.xG=(float)0.5;
ColBidon.xB=(float)0.5;
ColBidon.xA=(float)0.5;
if (p_BezierObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_BezierObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_BezierObject->d_stListOfPoints);
if (p_stPointList==0) return;
GLI_xGetCameraMatrix(((GLI_tdstSpecificAttributesFor3D*)((p_BezierObject->p_ViewPortAttributes)->p_vSpecificToXD))->p_stCam,&stMatrix);
GLI_xLoadMatrix(&stMatrix);
GLI_vSetFog(100,100,&ColBidon);
p_stPointListEnd=p_stPointList+p_BezierObject->ucSamplingRate;
for (;p_stPointList<p_stPointListEnd;p_stPointList++)
{
GLI_xDraw3DLine16(
(struct GLD_tdstViewportAttributes_*)(p_BezierObject->p_ViewPortAttributes),
p_stPointList,
p_stPointList+1,
p_BezierObject->color);
}
GLI_xPopMatrix();
}
/*==========================================================
Function name: fn_vBezierObject_ChangeParams
Description: Changes the parameters of a bezier objet and recalculates the coordinates
of the points.
Input: p_BezierObject: Pointer to a pre-created bezier object
p_stStartPoint: Pointer to the start point
p_stEndPoint: Pointer to the end Point
p_stStartVector:Pointer to the start vector
p_stEndVector: Pointer to the end vector
Output: none
Author: Yann Le Tensorer
Date: 28 january 1997
Revision:
Notes: If an input parameter is 0, this parameter is simply not
affected. This enables to change easily only one parameter
==========================================================*/
void fn_vBezierObject_ChangeParams(tdstBezierObject *p_BezierObject,
MTH3D_tdstVector* p_stStartPoint,
MTH3D_tdstVector* p_stEndPoint,
MTH3D_tdstVector* p_stStartVector,
MTH3D_tdstVector* p_stEndVector)
{
if (p_BezierObject==0) return; /* avoid crash */
/* copies input parameters into objects parameters */
if (p_stStartPoint!=0) p_BezierObject->stStartPoint =*p_stStartPoint;
if (p_stEndPoint!=0) p_BezierObject->stEndPoint =*p_stEndPoint;
if (p_stStartVector!=0) p_BezierObject->stStartVector =*p_stStartVector;
if (p_stEndVector!=0) p_BezierObject->stEndVector =*p_stEndVector;
fn_vBezierObject_Calculate(p_BezierObject);
}
/*==========================================================
Function name: fn_xBezierObject_GetSpeed
Description: returns the speed at a given sample (n<> of the point) of a bezier object
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
ucSampleNo: n<> of the point to get the speed from.
Output: return value is the speed.
Author: Yann Le Tensorer
Date: 03 february 1997
Revision:
==========================================================*/
MTH_tdxReal fn_xBezierObject_GetSpeed(tdstBezierObject *p_BezierObject,unsigned char ucSampleNo)
{
if (p_BezierObject==0) return 0;
return fn_xDynamicObject_GetSpeed(p_BezierObject->p_stDynaParams,ucSampleNo);
}
/*==========================================================
Function name: fn_vBezierObject_GetPoint
Description: returns the coordinates in the global rep<65>re of the point at a
given sample (n<> of the point) of a bezier object.
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
ucSampleNo: n<> of the point to get the coordinates from.
p_ReturnVector: pointer to a vector to be returned.
Output: *p_ReturnVector is a vector countaining the.coordinates of the point.
Author: Yann Le Tensorer
Date: 03 february 1997
Revision:
==========================================================*/
void fn_vBezierObject_GetPoint(tdstBezierObject *p_BezierObject,unsigned char ucSampleNo,MTH3D_tdstVector* p_ReturnVector)
{
MTH3D_tdstVector *p_stPointList;
if (p_BezierObject==0) return;
if (p_BezierObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_BezierObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_BezierObject->d_stListOfPoints);
if (p_stPointList!=0)
*p_ReturnVector=p_stPointList[ucSampleNo];
}
/*==========================================================
Function name: fn_vBezierObject_GetParams
Description: Gets the parameters of a bezier objet
Input: p_BezierObject: Pointer to a pre-created bezier object
p_stStartPoint: Pointer to the start point
p_stEndPoint: Pointer to the end Point
p_stStartVector:Pointer to the start vector
p_stEndVector: Pointer to the end vector
Output: *p_stStartPoint:start point
*p_stEndPoint: end Point
*p_stStartVectorstart vector
*p_stEndVector: end vector
Author: Yann Le Tensorer
Date: 4 february 1997
Revision:
Notes: If an input pointer is null, this parameter is simply not
affected.
==========================================================*/
void fn_vBezierObject_GetParams(tdstBezierObject *p_BezierObject,
MTH3D_tdstVector* p_stStartPoint,
MTH3D_tdstVector* p_stEndPoint,
MTH3D_tdstVector* p_stStartVector,
MTH3D_tdstVector* p_stEndVector)
{
if (p_BezierObject==0) return; /* avoid crash */
if (p_stStartPoint!=0) *p_stStartPoint = p_BezierObject->stStartPoint;
if (p_stEndPoint!=0) *p_stEndPoint = p_BezierObject->stEndPoint;
if (p_stEndVector!=0) *p_stEndVector = p_BezierObject->stEndVector;
if (p_stStartVector!=0) *p_stStartVector= p_BezierObject->stStartVector;
}
/*==========================================================
Function name: fn_ucBezierObject_GetSamplingRate
Description: Gets the sampling rate of a BezierObject objet
Input: p_BezierObject: Pointer to a pre-created Bezier object
Output: return value is the sampling rate of the circle arc object
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
==========================================================*/
unsigned char fn_ucBezierObject_GetSamplingRate(tdstBezierObject *p_BezierObject)
{
if (p_BezierObject==0)
return 0;
else
return p_BezierObject->ucSamplingRate;
}

View File

@@ -0,0 +1,696 @@
/*=========================================================================================
File: CirclWay.c
Prupose: Handle a CircleArc curve
Author: Yann Le Tensorer
Creation Date: 3 february 1997
Version: 1.1
Revision:
===========================================================================================
Revisions: Version Date Author
----------------------------------------------------------------
1.1 6 february 1997 Yann Le Tensorer
Added function "fn_vCircle_FindCenter"
=========================================================================================*/
/*==========================================================
Notes:
This module implements functions to create and draw CircleArc curves
here is an example how to use it:
{
tdstCircleArcObject CircleArcCurve;
long color;
MTH3D_tdstVector A,B,O;
ACP_tdstDynaParam stDynaParam;
unsigned char ucSamplingRate;
color=0xffffffff; // white
O.xX=0;
O.xY=0;
O.xZ=0
A.xX=0;
A.xY=1;
A.xZ=0;
B.xX=-1;
B.xY=0;
B.xZ=0;
ucSamplingRate=20; // Sampling rate
fn_vDynamicObject_Create(&stDynaParam,ucSamplingRate,C_ucSinus,0,MTH_C_Pi,255);
fn_vCircleArcObject_Create(&CircleArcCurve,ucSamplingRate,&A,&B,&O,C_ucModeNoObject,&stDynaParam);
fn_vCircleArcObject_SetColor(&CircleArcCurve,color);
fn_vCircleArcObject_SetViewPortAttributes(...); // en fonction du viewport
fn_vCircleArcObject_Draw(&CircleArcCurve);
fn_vCircleArcObject_Free(&CircleArcCurve);
}
===========================================================*/
#ifdef _AI_LIB_
#include "AIUseCPA.h"
/*#include "acp_base.h"*/
/*#include "gli.h"*/
#include "geoobj.h"
#include "circlway.h"
#include "IAOption.h"
#include "IAMacros.h"
/* AI memory and error management */
#include "MemIA.h"
#include "ErrIA.h"
#else /*_AI_LIB_*/
#include "acp_base.h"
#include "gli.h"
#include "geoobj.h"
#include "circlway.h"
#endif /*_AI_LIB_*/
/*============================================================
Memory management macros, to be replaced with correct memory management
============================================================*/
#ifdef _AI_LIB_
#define M_malloc(pointer,cast,size) M_IAAlloc(pointer,cast,size)
#define M_free(pointer) M_IAFree(pointer)
#else /*_AI_LIB_*/
#define M_malloc(pointer,cast,size) (pointer=(cast)malloc(size))
#define M_free(pointer) (free(pointer))
#endif /*_AI_LIB_*/
/*==========================================================
Function name: fn_vCircleArcObject_Create
Description: Create CircleArc curve (in ram only) between two points
Input: p_CircleArcObject: pointer to a preallocated tdstCircleArcObject
ucSamplingRate: number of segment to define the curve)
p_stStartPoint: pointer to the first vertex of the curve (in global repere)
p_stEndPoint: pointer to the last vertex of the curve (in global repere)
p_stCenter: pointer to the center of the circle (in global repere)
ucObjectMode: Creation mode (C_ucModeNoObject ou C_ucModeRealObject)
C_ucModeNoObject does not create a geometric object
whereas C_ucModeRealObject does.
Output: none
Author: Yann Le Tensorer
Date: 4 february 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_Create( tdstCircleArcObject *p_CircleArcObject,
unsigned char ucSamplingRate,
MTH3D_tdstVector* p_stStartPoint,
MTH3D_tdstVector* p_stEndPoint,
MTH3D_tdstVector* p_stCenter,
unsigned char ucObjectMode,
ACP_tdstDynaParam* p_stDynaParams
)
{
GEO_tdstDoubledIndex xLineDoubleIndex;
MTH3D_tdstVector TmpVector,TmpVector2,OA,OB,UnitOA,UnitOB;
MTH_tdxReal DotProduct;
long xCurVertex;
if (p_CircleArcObject==0) return; /* avoid crash */
/* copies input parameters into objects parameters */
p_CircleArcObject->ucObjectMode =ucObjectMode;
p_CircleArcObject->ucSamplingRate =ucSamplingRate;
p_CircleArcObject->stStartPoint =*p_stStartPoint;
p_CircleArcObject->stEndPoint =*p_stEndPoint;
p_CircleArcObject->stCenter =*p_stCenter;
p_CircleArcObject->p_stDynaParams =p_stDynaParams;
/* calculate OA and OB */
MTH3D_M_vSubVector(&OA,&p_CircleArcObject->stStartPoint,&p_CircleArcObject->stCenter);
MTH3D_M_vSubVector(&OB,&p_CircleArcObject->stEndPoint,&p_CircleArcObject->stCenter);
/*=====================================
calculates the local repere of the plan
=====================================*/
MTH3D_M_vNormalizeVector(&UnitOA,&OA);
MTH3D_M_vNormalizeVector(&UnitOB,&OB);
/* X axis = OA */
p_CircleArcObject->stLocalRepere.stCol_0=UnitOA;
/* Z axis = (OA^OB) */
MTH3D_M_vCrossProductVector(&TmpVector,&UnitOA,&UnitOB);
MTH3D_M_vNormalizeVector(&TmpVector,&TmpVector);
p_CircleArcObject->stLocalRepere.stCol_2=TmpVector;
/* Y axis = (OA^OB)^OA*/
MTH3D_M_vCrossProductVector(&TmpVector2,&TmpVector,&UnitOA);
MTH3D_M_vNormalizeVector(&TmpVector2,&TmpVector2);
p_CircleArcObject->stLocalRepere.stCol_1 = TmpVector2;
// MTH3D_M_vCrossProductVector(&p_CircleArcObject->stLocalRepere.stCol_1,&TmpVector,&UnitOA);
/*==================================================
Calculates inverse of local repere matrix
===================================================*/
MTH3D_M_vInverMatrix(&p_CircleArcObject->stInvLocalRepere,&p_CircleArcObject->stLocalRepere);
/*==================================================
calculates start and end coordinates in local repere
Xlocal(A)=inv(M)*(OA)
Xlocal(B)=inv(M)*(OB)
==================================================*/
fn_vCircleArcObject_GlobalToLocal( p_CircleArcObject,
&p_CircleArcObject->stLocalStartPoint,
&p_CircleArcObject->stStartPoint);
fn_vCircleArcObject_GlobalToLocal( p_CircleArcObject,
&p_CircleArcObject->stLocalEndPoint,
&p_CircleArcObject->stEndPoint);
/*==================================================
Calculates angle (OA,OB)
===================================================*/
DotProduct=MTH3D_M_xDotProductVector(&UnitOA,&UnitOB);
p_CircleArcObject->xMainAngle=MTH_M_xACos(DotProduct);
/* if mode is MODE_NO_OBJECT, allocates ram only for points list and dynamic parameters */
if (ucObjectMode==C_ucModeNoObject)
{
M_malloc ( p_CircleArcObject->d_stListOfPoints,
MTH3D_tdstVector*,
(ucSamplingRate+1)*sizeof(MTH3D_tdstVector)
);
}
else
/* else mode is MODE_REAL_OBJET, creates the geometric object*/
{
/* This list of points is not used */
p_CircleArcObject->d_stListOfPoints=0;
/* create object with 1 element (lines only), and ucSamplingRate+1 points) */
GEO_vCreateGeometricObject(&p_CircleArcObject->hObject,ucSamplingRate+1,1);
/* create line element*/
GEO_xCreateElementLines(p_CircleArcObject->hObject,&p_CircleArcObject->hElement,ucSamplingRate);
/* create lines indexes */
for (xCurVertex=0;xCurVertex<ucSamplingRate;xCurVertex++)
{
/* define start and end vertex of a line */
xLineDoubleIndex.a2_xIndex[0]=xCurVertex;
xLineDoubleIndex.a2_xIndex[1]=xCurVertex+1;
/* set line index */
GEO_xSetIndexOfElementLines(p_CircleArcObject->hObject,p_CircleArcObject->hElement,xCurVertex,&xLineDoubleIndex);
}
}
/* calculate points of CircleArc curve */
fn_vCircleArcObject_Calculate(p_CircleArcObject);
}
/*==========================================================
Function name: fn_vCircleArcObject_Free
Description: Free memory allocated by the CircleArc objet
Input: p_CircleArcObject: pointer to a tdstCircleArcObject
Output: none
Author: Yann Le Tensorer
Date: 29 january 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_Free(tdstCircleArcObject *p_CircleArcObject)
{
if (p_CircleArcObject!=0)
{
if (p_CircleArcObject->d_stListOfPoints!=0)
M_free(p_CircleArcObject->d_stListOfPoints);
/* if dynamic parameters are present, free memory too */
if (p_CircleArcObject->p_stDynaParams!=0)
fn_vDynamicObject_Free(p_CircleArcObject->p_stDynaParams);
}
}
/*==========================================================
Function name: fn_vCircleArcObject_Calculate
Description: Calculates the points of the b<>zier curve according to the
parameters specified when creating the object.
Input: p_CircleArcObject: Pointer to a pre-created CircleArc object
Output: none
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_Calculate(tdstCircleArcObject *p_CircleArcObject)
{
MTH_tdxReal xCurAngle,xDeltaAngle,xRayon;
MTH3D_tdstVector A,B,LocalCurPoint,OA;
MTH3D_tdstVector *p_stPointList;
int i;
if (p_CircleArcObject==0) return; /* avoid crash */
if (p_CircleArcObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_CircleArcObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_CircleArcObject->d_stListOfPoints);
/* Calculates rayon of circle */
MTH3D_M_vSubVector(&OA,&p_CircleArcObject->stStartPoint,&p_CircleArcObject->stCenter);
xRayon=MTH3D_M_xNormVector(&OA);
A = p_CircleArcObject->stLocalStartPoint;
B = p_CircleArcObject->stLocalEndPoint;
xDeltaAngle=p_CircleArcObject->xMainAngle/p_CircleArcObject->ucSamplingRate;
for (i=0,xCurAngle=0;i<=p_CircleArcObject->ucSamplingRate;i++,xCurAngle+=xDeltaAngle)
{
LocalCurPoint.xX=MTH_M_xCos(xCurAngle)*xRayon;
LocalCurPoint.xY=MTH_M_xSin(xCurAngle)*xRayon;
LocalCurPoint.xZ=0;
fn_vCircleArcObject_LocalToGlobal(p_CircleArcObject,p_stPointList,&LocalCurPoint);
p_stPointList++;
}
}
/*==========================================================
Function name: fn_vCircleArcObject_SetColor
Description: Set the color of a CircleArc object.
Input: p_CircleArcObject: pointer to a pre-created tdstCircleArcObject
color: 24 bit color of object. (0->7=B; 8->15=G; 16->23=R ; 24->32=Unused)
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_SetColor(tdstCircleArcObject *p_CircleArcObject,long color)
{
if (p_CircleArcObject==0) return; /* avoid crash */
p_CircleArcObject->color=color;
}
/*==========================================================
Function name: fn_vCircleArcObject_SetViewPortAttributes
Description: Set the viewportattributes for drawing.
Input: p_CircleArcObject: pointer to a pre-created tdstCircleArcObject
p_ViewPortAttributes: pointer to pre-defined viewport attributes
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_SetViewPortAttributes(tdstCircleArcObject *p_CircleArcObject,GLD_tdstViewportAttributes *p_ViewPortAttributes)
{
if (p_CircleArcObject==0) return; /* avoid crash */
p_CircleArcObject->p_ViewPortAttributes=p_ViewPortAttributes;
}
/*==========================================================
Function name: fn_vCircleArcObject_Draw
Description: Draw CircleArc object on screen
Input: p_CircleArcObject: pointer to a pre-created tdstCircleArcObject
Output: none
Author: Yann Le Tensorer
Date: 24 january 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_Draw(tdstCircleArcObject *p_CircleArcObject)
{
POS_tdstCompletePosition stMatrix;
GEO_tdstColor ColBidon;
MTH3D_tdstVector *p_stPointList;
MTH3D_tdstVector *p_stPointListEnd;
POS_fn_vSetIdentityMatrix(&stMatrix);
if (p_CircleArcObject==0) return; /* avoid crash */
/*unsigned long color; */
ColBidon.xR=(float)0.5;
ColBidon.xG=(float)0.5;
ColBidon.xB=(float)0.5;
ColBidon.xA=(float)0.5;
if (p_CircleArcObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_CircleArcObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_CircleArcObject->d_stListOfPoints);
if (p_stPointList==0) return;
GLI_xGetCameraMatrix(((GLI_tdstSpecificAttributesFor3D*)((p_CircleArcObject->p_ViewPortAttributes)->p_vSpecificToXD))->p_stCam,&stMatrix);
GLI_xLoadMatrix(&stMatrix);
GLI_vSetFog(100,100,&ColBidon);
p_stPointListEnd=p_stPointList+p_CircleArcObject->ucSamplingRate;
for (;p_stPointList<p_stPointListEnd;p_stPointList++)
{
GLI_xDraw3DLine16(
(struct GLD_tdstViewportAttributes_*)(p_CircleArcObject->p_ViewPortAttributes),
p_stPointList,
p_stPointList+1,
p_CircleArcObject->color);
}
GLI_xPopMatrix();
}
/*==========================================================
Function name: fn_vCircleArcObject_ChangeParams
Description: Changes the parameters of a CircleArc objet and recalculates the coordinates
of the points.
Input: p_CircleArcObject: Pointer to a pre-created CircleArc object
p_stStartPoint: Pointer to the start point
p_stEndPoint: Pointer to the end Point
p_stCenter: Pointer to the center of the circle
Output: none
Author: Yann Le Tensorer
Date: 6 february 1997
Revision:
Notes: If an input parameter is 0, this parameter is simply not
affected. This enables to change easily only one parameter
==========================================================*/
void fn_vCircleArcObject_ChangeParams(tdstCircleArcObject *p_CircleArcObject,
MTH3D_tdstVector* p_stStartPoint,
MTH3D_tdstVector* p_stEndPoint,
MTH3D_tdstVector* p_stCenter)
{
MTH3D_tdstVector TmpVector,TmpVector2,OA,OB,UnitOA,UnitOB;
MTH_tdxReal DotProduct;
if (p_CircleArcObject==0) return; /* avoid crash */
/* copies input parameters into objects parameters */
if (p_stStartPoint!=0) p_CircleArcObject->stStartPoint =*p_stStartPoint;
if (p_stEndPoint!=0) p_CircleArcObject->stEndPoint =*p_stEndPoint;
if (p_stCenter!=0) p_CircleArcObject->stCenter =*p_stCenter;
/* calculate OA and OB */
MTH3D_M_vSubVector(&OA,&p_CircleArcObject->stStartPoint,&p_CircleArcObject->stCenter);
MTH3D_M_vSubVector(&OB,&p_CircleArcObject->stEndPoint,&p_CircleArcObject->stCenter);
/*=====================================
calculates the local repere of the plan
=====================================*/
MTH3D_M_vNormalizeVector(&UnitOA,&OA);
MTH3D_M_vNormalizeVector(&UnitOB,&OB);
/* X axis = OA */
p_CircleArcObject->stLocalRepere.stCol_0=UnitOA;
/* Z axis = (OA^OB) */
MTH3D_M_vCrossProductVector(&TmpVector,&UnitOA,&UnitOB);
MTH3D_M_vNormalizeVector(&TmpVector,&TmpVector);
p_CircleArcObject->stLocalRepere.stCol_2=TmpVector;
/* Y axis = (OA^OB)^OA*/
MTH3D_M_vCrossProductVector(&TmpVector2,&TmpVector,&UnitOA);
MTH3D_M_vNormalizeVector(&TmpVector2,&TmpVector2);
p_CircleArcObject->stLocalRepere.stCol_1 = TmpVector2;
// MTH3D_M_vCrossProductVector(&p_CircleArcObject->stLocalRepere.stCol_1,&TmpVector,&UnitOA);
/*==================================================
Calculates inverse of local repere matrix
===================================================*/
MTH3D_M_vInverMatrix(&p_CircleArcObject->stInvLocalRepere,&p_CircleArcObject->stLocalRepere);
/*==================================================
calculates start and end coordinates in local repere
Xlocal(A)=inv(M)*(OA)
Xlocal(B)=inv(M)*(OB)
==================================================*/
fn_vCircleArcObject_GlobalToLocal( p_CircleArcObject,
&p_CircleArcObject->stLocalStartPoint,
&p_CircleArcObject->stStartPoint);
fn_vCircleArcObject_GlobalToLocal( p_CircleArcObject,
&p_CircleArcObject->stLocalEndPoint,
&p_CircleArcObject->stEndPoint);
/*==================================================
Calculates angle (OA,OB)
===================================================*/
DotProduct=MTH3D_M_xDotProductVector(&UnitOA,&UnitOB);
p_CircleArcObject->xMainAngle=MTH_M_xACos(DotProduct);
fn_vCircleArcObject_Calculate(p_CircleArcObject);
}
/*==========================================================
Function name: fn_xCircleArcObject_GetSpeed
Description: returns the speed at a given sample (n<> of the point) of a CircleArc object
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
ucSampleNo: n<> of the point to get the speed from.
Output: return value is the speed.
Author: Yann Le Tensorer
Date: 03 february 1997
Revision:
==========================================================*/
MTH_tdxReal fn_xCircleArcObject_GetSpeed(tdstCircleArcObject *p_CircleArcObject,unsigned char ucSampleNo)
{
if (p_CircleArcObject==0) return 0;
return fn_xDynamicObject_GetSpeed(p_CircleArcObject->p_stDynaParams,ucSampleNo);
}
/*==========================================================
Function name: fn_vCircleArcObject_GetPoint
Description: returns the coordinates in the global rep<65>re of the point at a
given sample (n<> of the point) of a CircleArc object.
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
ucSampleNo: n<> of the point to get the coordinates from.
p_ReturnVector: pointer to a vector to be returned.
Output: *p_ReturnVector is a vector countaining the.coordinates of the point.
Author: Yann Le Tensorer
Date: 03 february 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_GetPoint(tdstCircleArcObject *p_CircleArcObject,unsigned char ucSampleNo,MTH3D_tdstVector* p_ReturnVector)
{
MTH3D_tdstVector *p_stPointList;
if (p_CircleArcObject==0) return;
if (p_CircleArcObject->ucObjectMode==C_ucModeRealObject)
p_stPointList=((p_CircleArcObject->hObject) -> d_stListOfPoints);
else
p_stPointList=(p_CircleArcObject->d_stListOfPoints);
if (p_stPointList!=0)
*p_ReturnVector=p_stPointList[ucSampleNo];
}
/*==========================================================
Function name: fn_vCircleArcObject_GlobalToLocal
Description: Changes coordinates of a point from global coordinates to local.
Input: p_CircleArcObject: pointer to the circle arc object
p_stDestVector: pointer to the destination vector
p_stSourceVector: pointer to the source vector
Output: *p_stDestVector is a vector countaining the.coordinates in the local
repere of the plan.
Author: Yann Le Tensorer
Date: 4 february 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_GlobalToLocal( tdstCircleArcObject *p_CircleArcObject,
MTH3D_tdstVector *p_stDestVector,
MTH3D_tdstVector *p_stSourceVector)
{
MTH3D_M_vSubVector( &p_CircleArcObject->stTmpVector0,
p_stSourceVector,
&p_CircleArcObject->stCenter);
MTH3D_M_vMulMatrixVector( p_stDestVector,
&p_CircleArcObject->stInvLocalRepere,
&p_CircleArcObject->stTmpVector0);
}
/*==========================================================
Function name: fn_vCircleArcObject_LocalToGlobal
Description: Changes coordinates of a point from local coordinates to global
Input: p_CircleArcObject: pointer to the circle arc object
p_stDestVector: pointer to the destination vector
p_stSourceVector: pointer to the source vector
Output: *p_stDestVector is a vector countaining the.coordinates in the global
repere of the plan.
Author: Yann Le Tensorer
Date: 4 february 1997
Revision:
==========================================================*/
void fn_vCircleArcObject_LocalToGlobal( tdstCircleArcObject *p_CircleArcObject,
MTH3D_tdstVector *p_stDestVector,
MTH3D_tdstVector *p_stSourceVector)
{
MTH3D_M_vMulMatrixVector( p_stDestVector,
&p_CircleArcObject->stLocalRepere,
p_stSourceVector);
MTH3D_M_vAddVector( p_stDestVector,
p_stDestVector,
&p_CircleArcObject->stCenter);
}
/*==========================================================
Function name: fn_ucCircleArcObject_GetSamplingRate
Description: Gets the sampling rate of a CircleArcObject objet
Input: p_CircleArcObject: Pointer to a pre-created CircleArc object
Output: return value is the sampling rate of the circle arc object
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
==========================================================*/
unsigned char fn_ucCircleArcObject_GetSamplingRate(tdstCircleArcObject *p_CircleArcObject)
{
if (p_CircleArcObject==0)
return 0;
else
return p_CircleArcObject->ucSamplingRate;
}
/*===============================================================================
Function name: fn_bCircleArcObject_SetSamplingRate
Description: Modifies the sampling rate of a CircleArc object, and changes all
the depending parameters (including dynamic sampling rate)
Input: p_CircleArcObject: pointer to a preallocated tdstCircleArcObject
ucSamplingRate: New sampling rate
Output: return value is true if sampling rate could be modified,
false if not.
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
Note: The sampling rate can only be modified for objects that have been
created using C_ucModeNoObject at their creation.
================================================================================*/
ACP_tdxBool fn_bCircleArcObject_SetSamplingRate(tdstCircleArcObject *p_CircleArcObject,
unsigned char ucSamplingRate)
{
if (p_CircleArcObject==0) return FALSE;
if (p_CircleArcObject->ucObjectMode==C_ucModeNoObject)
{
/* copies new sampling rate value into objects parameters */
p_CircleArcObject->ucSamplingRate =ucSamplingRate;
if (p_CircleArcObject->ucSamplingRate<2) p_CircleArcObject->ucSamplingRate=2;
/* free old list of points and allocates new one */
if (p_CircleArcObject->d_stListOfPoints!=0)
M_free(p_CircleArcObject->d_stListOfPoints);
M_malloc ( p_CircleArcObject->d_stListOfPoints,
MTH3D_tdstVector*,
(p_CircleArcObject->ucSamplingRate+1)*sizeof(MTH3D_tdstVector)
);
/* calculate points of CircleArc curve */
fn_vCircleArcObject_Calculate(p_CircleArcObject);
/* checks if dynamic parameters are attached to the object
if yes, changes them to match the new sampling rate */
fn_vDynamicObject_ChangeSamplingRate(p_CircleArcObject->p_stDynaParams,
p_CircleArcObject->ucSamplingRate);
return TRUE;
}
else
return FALSE;
}
/*==========================================================
Function name: fn_vCircle_FindCenter
Description: Finds the 3D coordinate of the center of the circle on which are 3 points.
Input: p_FirstPoint: pointer to the first point
p_SecondPoint: pointer to the second point
p_ThirdPoint: pointer to the third point
p_ReturnCenter: pointer to a point to be returned.
Output: *p_ReturnCenter is a vector countaining the.coordinates of the center.
Author: Yann Le Tensorer
Date: 6 february 1997
Revision:
NOTE: The 3 points must have a z coordinate equal to zero! (In fact, the points must be
given in a local repere of the plan in which is the circle, where the x and y
axis define the plan) The Center of the screen is given in the local repere
of this plan, so with a zero coordinate too.
==========================================================*/
void fn_vCircle_FindCenter( MTH3D_tdstVector *p_FirstPoint,
MTH3D_tdstVector *p_SecondPoint,
MTH3D_tdstVector *p_ThirdPoint,
MTH3D_tdstVector *p_ReturnCenter)
{
MTH_tdxReal xa,xb,xc,ya,yb,yc,xm,xn,ym,yn,a,b,c,d,alpha,beta;
/* see technical notes of ways and waypoints specifications (ref.003ST037)
for explanations...*/
xa=p_FirstPoint->xX;
ya=p_FirstPoint->xY;
xb=p_SecondPoint->xX;
yb=p_SecondPoint->xY;
xc=p_ThirdPoint->xX;
yc=p_ThirdPoint->xY;
xm=MTH_M_xMul(MTH_M_xAdd(xa,xc),MTH_C_Inv2);
ym=MTH_M_xMul(MTH_M_xAdd(ya,yc),MTH_C_Inv2);
xn=MTH_M_xMul(MTH_M_xAdd(xb,xc),MTH_C_Inv2);
yn=MTH_M_xMul(MTH_M_xAdd(yb,yc),MTH_C_Inv2);
a=MTH_M_xSub(xm,xa);
b=MTH_M_xSub(ym,ya);
c=MTH_M_xSub(xn,xb);
d=MTH_M_xSub(yn,yb);
alpha=MTH_M_xAdd(MTH_M_xMul(a,xm),MTH_M_xMul(b,ym));
beta= MTH_M_xAdd(MTH_M_xMul(c,xn),MTH_M_xMul(d,yn));
p_ReturnCenter->xX=MTH_M_xDiv(
MTH_M_xSub(MTH_M_xMul(beta,b),MTH_M_xMul(alpha,d)),
MTH_M_xSub(MTH_M_xMul(b,c),MTH_M_xMul(a,d))
);
p_ReturnCenter->xY=MTH_M_xDiv(
MTH_M_xSub(MTH_M_xMul(alpha,c),MTH_M_xMul(beta,a)),
MTH_M_xSub(MTH_M_xMul(b,c),MTH_M_xMul(a,d))
);
p_ReturnCenter->xZ=MTH_C_ZERO;
}

View File

@@ -0,0 +1,232 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : CurObj.cpp
//
// Definition of the cursor object
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CPA_Object
// CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 5 feb 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
#include "stdafx.h"
#include "acp_base.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 "CurObj.hpp"
#include "Inter.hpp"
//-------- static init
long Cursor::ms_lNbCursor=0;
Waypoint_Interface* Cursor::ms_poInterface;
//------ static
void Cursor::fn_vInitObject (Waypoint_Interface* poInterface)
{
ms_poInterface = poInterface;
}
Cursor::Cursor( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, eCursorMouseMoveLimit elimit ):
CPA_BaseObject ( p_oDLL, "Cursor" )
{
CPA_SuperObject* poSuperCursor = ms_poInterface->GetInterface()->GetNewSuperObject ( E_ss_NoSave, C_NoType );
m_poSuperObject = poSuperCursor;
poSuperCursor->SetTypeSO (C_Protected);
poSuperCursor->SetObject(this);
SetSuperObject (poSuperCursor);
// name
CString csName;
csName.Format ("Cursor%d", ms_lNbCursor);
ms_lNbCursor++;
fn_eRename (csName);
// init
MTH3D_M_vNullVector(&m_stVertex);
m_xDim=0.05f;
m_poParent = (CPA_SuperObject*)p_oOwner;
m_eMouseMoveLimit = elimit;
m_bCursorMove = FALSE;
// graphic object
CPA_SuperObject* poGraphic = GetInterface()->fn_pGetNewCursorGraphicObject();
poGraphic->SetSuperObjectOwner (GetSuperObject());
GetSuperObject()->AddTail (poGraphic);
GEO_xComputeObjectNormals ( (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(poGraphic->GetStruct()));
poGraphic->SetEditProtected (TRUE);
}
long Cursor::GetDataType (void)
{
return C_ucCursor;
}
void* Cursor::GetData (void)
{
return NULL;
}
Waypoint_Interface* Cursor::GetInterface (void)
{
return ms_poInterface;
}
void Cursor::fn_vDraw (void)
{
MTH3D_tdstVector stAbsoluteVertex;
tdeLocalColor tdColor = GetSuperObject()->GetLocalColor ();
CPA_SuperObject* psoObject = (CPA_SuperObject*)GetSuperObject()->GetHead();
fn_vGetAbsoluteVertex ( &stAbsoluteVertex );
ACP_tdxHandleOfObject hMot = (ACP_tdxHandleOfObject) HIE_fn_hGetSuperObjectObject(psoObject->GetStruct());
MTH3D_tdstVector a8_stPoint [13];
MTH3D_M_vSetVectorElements (a8_stPoint, m_xDim,m_xDim,-m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+1, m_xDim,-m_xDim,-m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+2, -m_xDim,-m_xDim,-m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+3, -m_xDim,m_xDim,-m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+4, m_xDim,m_xDim,m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+5, m_xDim,-m_xDim,m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+6, -m_xDim,-m_xDim,m_xDim);
MTH3D_M_vSetVectorElements (a8_stPoint+7, -m_xDim,m_xDim,m_xDim);
GEO_vSetListOfPointsOfObject
(
hMot,
a8_stPoint,
8,
0
);
GEO_xComputeObjectNormals ( hMot );
// change the local matrix
GEO_tdxHandleToMatrix hAbsoluteObjectMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (psoObject->GetStruct());
GEO_tdxHandleToMatrix hAbsoluteFatherMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poParent->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsoluteObjectMatrix );
MTH3D_tdstVector stOx, stOy, stOz;
POS_fn_vGetRotationMatrix( hAbsoluteFatherMatrix ,
&stOx, &stOy, &stOz );
POS_fn_vSetRotationMatrix( hAbsoluteObjectMatrix ,
&stOx, &stOy, &stOz );
POS_fn_vSetTranslationVector( hAbsoluteObjectMatrix, &stAbsoluteVertex );
GetInterface()->fn_vComputeNewRelativeMatrix (psoObject->GetStruct());
}
void Cursor::fn_vSetAbsoluteVertex ( MTH3D_tdstVector* pAbsoluteVertex )
{
POS_tdstCompletePosition stInvMatrix;
POS_fn_vSetIdentityMatrix(&stInvMatrix);
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poParent->GetStruct());
POS_fn_vInvertMatrix( &stInvMatrix , hAbsoluteLineMatrix );
POS_fn_vMulMatrixVertex( &m_stVertex, &stInvMatrix, pAbsoluteVertex) ;
m_stVertex.xZ=0.;
}
void Cursor::fn_vGetAbsoluteVertex ( MTH3D_tdstVector* pAbsoluteVertex )
{
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poParent->GetStruct());
POS_fn_vMulMatrixVertex( pAbsoluteVertex, hAbsoluteLineMatrix, &m_stVertex) ;
}
void Cursor::fn_vStartMove ( MTH3D_tdstVector* pstStartVertex )
{
fn_vSetAbsoluteVertex (pstStartVertex);
fn_vDraw ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Cursor::fn_vMove ( MTH3D_tdstVector* pstTranslation )
{
MTH3D_tdstVector stVertex, stInitialVertex;
fn_vGetAbsoluteVertex ( &stVertex );
stInitialVertex = stVertex;
MTH3D_M_vAddVector(&stVertex, &stVertex, pstTranslation);
if (fn_bCanMove(&stVertex))
{
fn_vSetAbsoluteVertex ( &stVertex );
fn_vGetAbsoluteVertex ( pstTranslation );
MTH3D_M_vSubVector(pstTranslation, pstTranslation, &stInitialVertex );
fn_vDraw ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
else MTH3D_M_vSetVectorElements (pstTranslation, 0., 0., 0.);
}
void Cursor::fn_vEndMove (void)
{
m_bCursorMove = TRUE;
}
BOOL Cursor::fn_bCanMove ( MTH3D_tdstVector* pstVertex )
{
switch (m_eMouseMoveLimit)
{
case eCursorCircularLimit:
{
MTH3D_tdstVector stLocalA, stLocalC;
MTH3D_tdstVector stAB, stBC, stAC;
MTH_tdxReal lAB, lBC, lAC;
MTH3D_M_vSetVectorElements (&stLocalA, 0., 0., 0.);
MTH3D_M_vSetVectorElements (&stLocalC, 1., 0., 0.);
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poParent->GetStruct());
MTH3D_tdstVector stFirstVertex, stSecondVertex;
POS_fn_vMulMatrixVertex( &stFirstVertex, hAbsoluteMatrix, &stLocalA );
POS_fn_vMulMatrixVertex( &stSecondVertex, hAbsoluteMatrix, &stLocalC );
stAB=*pstVertex;
MTH3D_M_vSubVector(&stAB,&stAB,&stFirstVertex);
stBC=stSecondVertex;
MTH3D_M_vSubVector(&stBC,&stBC,pstVertex);
stAC=stSecondVertex;
MTH3D_M_vSubVector(&stAC,&stAC,&stFirstVertex);
lAB = MTH3D_M_xNormVector(&stAB);
lBC = MTH3D_M_xNormVector(&stBC);
lAC = MTH3D_M_xNormVector(&stAC);
lAB *= lAB;
lBC *= lBC;
lAC *= lAC;
return (lAB+lBC<=lAC);
}
default : return TRUE;
}
}
BOOL Cursor::fn_bCursorMove (void)
{
BOOL bReturnCursorMove = m_bCursorMove;
m_bCursorMove = FALSE;
return bReturnCursorMove;
}

View File

@@ -0,0 +1,129 @@
//
// Common functions for Object DLL capabilities
// C. Beaudet
//
#include "stdafx.h"
#include "acp_base.h"
#include "afxdllx.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 "Inter.hpp"
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static WaypointObjetcInterface *gs_p_oWaypointInterface = NULL;
#endif
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stWayPointIdentity . eType = OBJECT_DLL;
g_stWayPointIdentity . csName = "WayPoint";
g_stWayPointIdentity . hModule = NULL;
g_stWayPointIdentity . p_oListOfInstances = &g_oListOfInstances;
return &g_stWayPointIdentity;
}
//========================================================================
// DLL int function
//========================================================================
extern "C" void __declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oWayPointInterface == NULL)
{
gs_p_oWaypointInterface = new Waypoint_Interface();
ASSERT(gs_p_oWaypointInterface != NULL);
}
return gs_p_oWaypointInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new Waypoint_Interface();
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE

View File

@@ -0,0 +1,593 @@
/*================================================================
File: Dynamic.h
Prupose: Dynamic parameters of a connection
Author: Yann Le Tensorer
Creation Date: 29 january 1997
------------------------------------------------------------------
Revisions: 1.01 Yann Le Tensorer
4 february 1997
Added function fn_vDynamicObject_GetParams
=================================================================*/
#ifdef _AI_LIB_
#include "AIUseCPA.h"
#include "dynamic.h"
#include "IAOption.h"
#include "IAMacros.h"
/* AI memory and error management */
#include "MemIA.h"
#include "ErrIA.h"
#else /*_AI_LIB_*/
#include "acp_base.h"
#include "dynamic.h"
#include "malloc.h"
#endif /*_AI_LIB_*/
/*============================================================
Memory management macros, to be replaced with correct memory management
============================================================*/
#ifdef _AI_LIB_
#define M_malloc(pointer,cast,size) M_IAAlloc(pointer,cast,size)
#define M_free(pointer) M_IAFree(pointer)
#else /*_AI_LIB_*/
#define M_malloc(pointer,cast,size) (pointer=(cast)malloc(size))
#define M_free(pointer) (free(pointer))
#endif /*_AI_LIB_*/
/*==========================================================
Function name: fn_vDynamicObject_Calculate
Description: Caculates the speeds at sampled points, according to dynamic parameters
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
Output: none
Author: Yann Le Tensorer
Date: 30 january 1997
Revision:
==========================================================*/
void fn_vDynamicObject_Calculate(ACP_tdstDynaParam* p_stDynaParam)
{
MTH_tdxReal *SpeedList;
MTH_tdxReal *SpeedListEnd;
MTH_tdxReal CurSpeed;
MTH_tdxReal inc;
MTH_tdxReal MaxSpeed;
MTH_tdxReal CurAngle;
if (p_stDynaParam==0) return; /* avoid unexepected crash */
switch (p_stDynaParam->ucDynamicType)
{
case C_ucNone:
case C_ucConst:
break;
case C_ucLinear:
inc=(p_stDynaParam->xEndSpeed-p_stDynaParam->xStartSpeed)/p_stDynaParam->ucSamplingRate;
SpeedList = p_stDynaParam->d_stListOfSpeeds; /* start adress */
if (SpeedList==0) break; /* avoid unexpected crash */
SpeedListEnd= p_stDynaParam->d_stListOfSpeeds+p_stDynaParam->ucSamplingRate; /* end adress */
CurSpeed = p_stDynaParam->xStartSpeed;
for (;SpeedList<=SpeedListEnd;SpeedList++)
{
*SpeedList=CurSpeed;
CurSpeed+=inc;
}
break;
case C_ucSinus:
MaxSpeed=(p_stDynaParam->xMaxSpeed)/2;
inc=(p_stDynaParam->xEndAngle-p_stDynaParam->xStartAngle)/p_stDynaParam->ucSamplingRate;
SpeedList = p_stDynaParam->d_stListOfSpeeds; /* start adress */
if (SpeedList==0) break; /* avoid unexpected crash */
SpeedListEnd= p_stDynaParam->d_stListOfSpeeds+p_stDynaParam->ucSamplingRate; /* end adress */
CurAngle = p_stDynaParam->xStartAngle;
for (;SpeedList<=SpeedListEnd;SpeedList++)
{
*SpeedList=(MTH_M_xSin(CurAngle)+1)*MaxSpeed;
CurAngle+=inc;
}
break;
}
}
/*==========================================================
Function name: fn_vDynamicObject_Create
Description: Creates a dynamic parameters object
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
ucSamplingRate: sampling rate
ucDynamicType: dynamic type (C_NONE,C_CONST,C_LINEAR,C_SINUS)
xFirst,xSecond,xThird: See table below
Type: | C_NONE | C_CONST | C_LINEAR | C_SINUS
===========================================================
xFirst | - | speed | start speed | start angle
| | | |
xSecond | - | - | end speed | end angle
| | | |
xThird | - | - | - | max speed
Output: none
Author: Yann Le Tensorer
Date: 30 january 1997
Revision: 5 february 1997 : corrected minor bugs
==========================================================*/
void fn_vDynamicObject_Create( ACP_tdstDynaParam* p_stDynaParam,
unsigned char ucSamplingRate,
unsigned char ucDynamicType,
MTH_tdxReal xFirst,
MTH_tdxReal xSecond,
MTH_tdxReal xThird)
{
if (p_stDynaParam==0) return;
p_stDynaParam->ucSamplingRate=ucSamplingRate;
if (p_stDynaParam->ucSamplingRate<2) p_stDynaParam->ucSamplingRate=2;
p_stDynaParam->ucDynamicType=ucDynamicType;
switch (ucDynamicType)
{
case C_ucNone:
p_stDynaParam->xSpeed=0;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
p_stDynaParam->d_stListOfSpeeds=0;
break;
case C_ucConst:
p_stDynaParam->xSpeed=xFirst;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
p_stDynaParam->d_stListOfSpeeds=0;
break;
case C_ucLinear:
p_stDynaParam->xStartSpeed=xFirst;
p_stDynaParam->xEndSpeed=xSecond;
p_stDynaParam->xMaxSpeed=0;
M_malloc(p_stDynaParam->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParam->ucSamplingRate+1));
break;
case C_ucSinus:
p_stDynaParam->xStartAngle=xFirst;
p_stDynaParam->xEndAngle=xSecond;
p_stDynaParam->xMaxSpeed=xThird;
M_malloc(p_stDynaParam->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParam->ucSamplingRate+1));
break;
}
fn_vDynamicObject_Calculate(p_stDynaParam);
}
/*==========================================================
Function name: fn_vDynamicObject_ChangeSamplingRate
Description: Changes the sampling rate of a dynamic object
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
ucSamplingRate: sampling rate
Output: none
Author: Yann Le Tensorer
Date: 5 february 1997
Revision:
==========================================================*/
void fn_vDynamicObject_ChangeSamplingRate( ACP_tdstDynaParam* p_stDynaParams,
unsigned char ucSamplingRate)
{
if (p_stDynaParams==0) return;
p_stDynaParams->ucSamplingRate=ucSamplingRate;
if (p_stDynaParams->ucSamplingRate<2) p_stDynaParams->ucSamplingRate=2;
switch (p_stDynaParams->ucDynamicType)
{
case C_ucNone:
p_stDynaParams->d_stListOfSpeeds=0;
break;
case C_ucConst:
p_stDynaParams->d_stListOfSpeeds=0;
break;
case C_ucLinear:
if (p_stDynaParams->d_stListOfSpeeds!=0)
M_free(p_stDynaParams->d_stListOfSpeeds);
M_malloc(p_stDynaParams->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParams->ucSamplingRate+1));
break;
case C_ucSinus:
if (p_stDynaParams->d_stListOfSpeeds!=0)
M_free(p_stDynaParams->d_stListOfSpeeds);
M_malloc(p_stDynaParams->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParams->ucSamplingRate+1));
break;
}
fn_vDynamicObject_Calculate(p_stDynaParams);
}
/*==========================================================
Function name: fn_vDynaParams_Free
Description: removes the allocated ram for DynaParams
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
Output: none
Author: Yann Le Tensorer
Date: 30 january 1997
Revision:
==========================================================*/
void fn_vDynamicObject_Free(ACP_tdstDynaParam* p_stDynaParams)
{
if (p_stDynaParams!=0)
if (p_stDynaParams->d_stListOfSpeeds!=0)
M_free(p_stDynaParams->d_stListOfSpeeds);
}
/*==========================================================
Function name: fn_vDynamicObject_ChangeParams
Description: changes the dynamic parameters (except sampling rate)
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
ucDynamicType: dynamic type (C_ucNone,C_ucConst,C_ucLinear,C_ucSinus)
xFirst,xSecond,xThird: See table below
Type: | C_ucNone | C_ucConst | C_ucLinear | C_ucSinus
===========================================================
xFirst | - | speed | start speed | start angle
| | | |
xSecond | - | - | end speed | end angle
| | | |
xThird | - | - | - | max speed
Output: none
Author: Yann Le Tensorer
Date: 30 january 1997
Revision:
==========================================================*/
void fn_vDynamicObject_ChangeParams( ACP_tdstDynaParam* p_stDynaParam,
unsigned char ucDynamicType,
MTH_tdxReal xFirst,
MTH_tdxReal xSecond,
MTH_tdxReal xThird)
{
p_stDynaParam->ucDynamicType=ucDynamicType;
switch (ucDynamicType)
{
case C_ucNone:
p_stDynaParam->xSpeed=0;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
if (p_stDynaParam->d_stListOfSpeeds!=0)
{
M_free(p_stDynaParam->d_stListOfSpeeds);
p_stDynaParam->d_stListOfSpeeds=0;
}
break;
case C_ucConst:
p_stDynaParam->xSpeed=xFirst;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
if (p_stDynaParam->d_stListOfSpeeds!=0)
{
M_free(p_stDynaParam->d_stListOfSpeeds);
p_stDynaParam->d_stListOfSpeeds=0;
}
break;
case C_ucLinear:
p_stDynaParam->xStartSpeed=xFirst;
p_stDynaParam->xEndSpeed=xSecond;
p_stDynaParam->xMaxSpeed=0;
if (p_stDynaParam->d_stListOfSpeeds==0)
M_malloc(p_stDynaParam->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParam->ucSamplingRate+1));
break;
case C_ucSinus:
p_stDynaParam->xStartAngle=xFirst;
p_stDynaParam->xEndAngle=xSecond;
p_stDynaParam->xMaxSpeed=xThird;
if (p_stDynaParam->d_stListOfSpeeds==0)
M_malloc(p_stDynaParam->d_stListOfSpeeds,MTH_tdxReal*,sizeof(MTH_tdxReal)*(p_stDynaParam->ucSamplingRate+1));
break;
}
fn_vDynamicObject_Calculate(p_stDynaParam);
}
/*==========================================================
Function name: fn_vDynamicObject_GetParams
Description: Gets the dynamic parameters (including sampling rate)
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
p_ucDynamicType:pointer to get dynamic type (C_ucNone,C_ucConst,C_ucLinear,C_ucSinus)
p_SamplingRate: pointer to get sampling rate
p_xFirst,p_xSecond,p_xThird:pointers to parameters to get See table below
Type: | C_ucNone | C_ucConst | C_ucLinear | C_ucSinus
===========================================================
xFirst | - | speed | start speed | start angle
| | | |
xSecond | - | - | end speed | end angle
| | | |
xThird | - | - | - | max speed
Output: none
Author: Yann Le Tensorer
Date: 04 february 1997
Revision:
Note: Programmer may call the function with null pointers.
Only non-null pointers will be affected...
==========================================================*/
void fn_vDynamicObject_GetParams( ACP_tdstDynaParam* p_stDynaParam,
unsigned char* p_ucDynamicType,
unsigned char* p_ucSamplingRate,
MTH_tdxReal* p_xFirst,
MTH_tdxReal* p_xSecond,
MTH_tdxReal* p_xThird)
{
if (p_stDynaParam==0) return;
if (p_ucDynamicType!=0) *p_ucDynamicType=p_stDynaParam->ucDynamicType;
if (p_ucSamplingRate!=0) *p_ucSamplingRate=p_stDynaParam->ucSamplingRate;
switch (p_stDynaParam->ucDynamicType)
{
case C_ucNone:
if (p_xFirst!=0) *p_xFirst =0;
if (p_xSecond!=0) *p_xSecond =0;
if (p_xThird!=0) *p_xThird =0;
break;
case C_ucConst:
if (p_xFirst!=0) *p_xFirst =p_stDynaParam->xSpeed;
if (p_xSecond!=0) *p_xSecond =0;
if (p_xThird!=0) *p_xThird =0;
break;
case C_ucLinear:
if (p_xFirst!=0) *p_xFirst =p_stDynaParam->xStartSpeed;
if (p_xSecond!=0) *p_xSecond =p_stDynaParam->xEndSpeed;
if (p_xThird!=0) *p_xThird =0;
break;
case C_ucSinus:
if (p_xFirst!=0) *p_xFirst =p_stDynaParam->xStartAngle;
if (p_xSecond!=0) *p_xSecond =p_stDynaParam->xEndAngle;
if (p_xThird!=0) *p_xThird =p_stDynaParam->xMaxSpeed;
break;
default:
break;
}
}
/*=========================================================
Function name: fn_xDynamicObject_GetSpeed
Description: returns the speed at a given sample (n<> of the point)
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
iSampleNo: n<> of the point to get the speed from.
Output: return value is the speed.
Author: Yann Le Tensorer
Date: 31 january 1997
==========================================================*/
MTH_tdxReal fn_xDynamicObject_GetSpeed(ACP_tdstDynaParam* p_stDynaParams,unsigned char ucSampleNo)
{
MTH_tdxReal xReturn;
if (p_stDynaParams==0) return 0;
switch (p_stDynaParams->ucDynamicType)
{
case C_ucNone:
xReturn=0;
break;
case C_ucConst:
xReturn=p_stDynaParams->xSpeed;
break;
case C_ucLinear:
case C_ucSinus:
if (ucSampleNo<=p_stDynaParams->ucSamplingRate && p_stDynaParams->d_stListOfSpeeds!=0)
xReturn=p_stDynaParams->d_stListOfSpeeds[ucSampleNo];
else
xReturn=0;
break;
default: xReturn=0;
}
return xReturn;
}
/*==========================================================
Function name: fn_vDynamicObject_CreateNotSampled
Description: Creates a dynamic parameters object for not sampled type
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
ucDynamicType: dynamic type (C_NONE,C_CONST,C_LINEAR,C_SINUS)
xFirst,xSecond,xThird: See table below
Type: | C_NONE | C_CONST | C_LINEAR | C_SINUS
===========================================================
xFirst | - | speed | start speed | start angle
| | | |
xSecond| - | - | end speed | end angle
| | | |
xThird | - | - | - | max speed
Output: none
Author: Albert Pais
Date: February 04, 1997
Revision:
==========================================================*/
void fn_vDynamicObject_CreateNotSampled
(
ACP_tdstDynaParam* p_stDynaParam,
unsigned char ucDynamicType,
MTH_tdxReal xFirst,
MTH_tdxReal xSecond,
MTH_tdxReal xThird
)
{
p_stDynaParam->ucDynamicType=ucDynamicType;
switch (ucDynamicType)
{
case C_ucNone:
p_stDynaParam->xSpeed=0;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
p_stDynaParam->d_stListOfSpeeds=0;
break;
case C_ucConst:
p_stDynaParam->xSpeed=xFirst;
p_stDynaParam->xEndSpeed=0;
p_stDynaParam->xMaxSpeed=0;
p_stDynaParam->d_stListOfSpeeds=0;
break;
case C_ucLinear:
p_stDynaParam->xStartSpeed=xFirst;
p_stDynaParam->xEndSpeed=xSecond;
p_stDynaParam->xMaxSpeed=0;
break;
case C_ucSinus:
p_stDynaParam->xStartAngle=xFirst;
p_stDynaParam->xEndAngle=xSecond;
p_stDynaParam->xMaxSpeed=xThird;
break;
}
}
/*==========================================================
Function name: fn_xDynamicObject_GetSpeedNotSampled
Description: returns the speed at a given position when it is not sampled
Input:
p_stDynaParam: pointer to a pre-created tdstDynaParam structure
_xDist : the dist beetween the position where speed is required and the point to reach
Output: return value is the speed.
Author: Albert Pais
Date: February 4,1997
Revision:
==========================================================*/
MTH_tdxReal fn_xDynamicObject_GetSpeedNotSampled
(
ACP_tdstDynaParam* _p_stDynaParams,
MTH_tdxReal _xDist
)
{
MTH_tdxReal xReturn;
switch (_p_stDynaParams->ucDynamicType)
{
case C_ucNone:
xReturn=0;
break;
case C_ucConst:
xReturn=_p_stDynaParams->xSpeed;
break;
case C_ucLinear:
/* Speed = InitialSpeed + CurrentDist x (FinalSpeed-InitialSpeed) / InitialDist */
/* tip : (FinalSpeed-InitialSpeed) / InitialDist is stored inside xSpeed field */
xReturn = MTH_M_xAdd
(
_p_stDynaParams->xStartSpeed,
MTH_M_xMul(_xDist,_p_stDynaParams->xSpeed )
);
break;
case C_ucSinus:
/* Speed = MaxSpeed x
(1+sin( (FinalAngle - InitialAngle)/InitialDist * CurrentDist + InitialAngle )) */
/* tip : (FinalAngle - InitialAngle)/InitialDist is stored inside xSpeed field */
xReturn = MTH_M_xMul
(
(_p_stDynaParams->xMaxSpeed),
MTH_M_xAdd
(
MTH_C_ONE,
MTH_M_xSin
(
MTH_M_xAdd
(
MTH_M_xMul
(
_p_stDynaParams->xSpeed,
_xDist
),
_p_stDynaParams->xStartAngle
)
)
)
);
break;
default: xReturn=0;
}
return xReturn;
}
/*==========================================================
Function name: fn_vDynamicObject_CalculateNotSampled
Description: Caculates specific coef when speed is not sampled
Input:
p_stDynaParam: pointer to a pre-created tdstDynaParam structure
the initial dist beetween the initial point and the final point
Output: none
Remark :
The xSpeed field of the structure is used to store some
parameters used at execution
Author: Albert Pais
Date: Frebruary 4,1997
Revision:
==========================================================*/
void fn_vDynamicObject_CalculateNotSampled
(
ACP_tdstDynaParam* _p_stDynaParam,
MTH_tdxReal _xInitialDist
)
{
switch (_p_stDynaParam->ucDynamicType)
{
case C_ucNone:
case C_ucConst:
/* nothing to compute */
break;
case C_ucLinear:
if(_xInitialDist)
{/* xSpeed is used to store a specific coef :*/
_p_stDynaParam->xSpeed =
MTH_M_xDiv
(
MTH_M_xSub
(
(_p_stDynaParam->xEndSpeed),
(_p_stDynaParam->xStartSpeed)
),
_xInitialDist
);
}
else
{
_p_stDynaParam->xSpeed = MTH_C_ZERO;
}
break;
case C_ucSinus:
if(_xInitialDist)
{/* xSpeed is used to store a specific coef :*/
_p_stDynaParam->xSpeed =
MTH_M_xDiv
(
MTH_M_xSub
(
(_p_stDynaParam->xEndAngle),
(_p_stDynaParam->xStartAngle)
),
_xInitialDist
);
}
else
{
_p_stDynaParam->xSpeed = MTH_C_ZERO;
}
break;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,257 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Link2D.cpp
//
// Definition of links defined in a 2D plane
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 30 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WPObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "Inter.hpp"
#include "Link2D.hpp"
Link2D::Link2D ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, WP_tdhLink hLink )
: Link ( p_oDLL, p_oOwner, hLink )
{
m_xe = 0.025f;
}
Link2D::Link2D ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner )
: Link ( p_oDLL, p_oOwner )
{
m_xe = 0.025f;
}
void Link2D::fn_vConstructPlane (void)
{
m_poGraphic = GetInterface()->fn_pGetNewPlaneGraphicObject();
m_poGraphic->SetSuperObjectOwner (GetSuperObject());
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_poGraphic,GetSuperObject(),FALSE,FALSE,FALSE);
GEO_xComputeObjectNormals ( (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(m_poGraphic->GetStruct()));
m_poGraphic->SetEditProtected (TRUE);
}
void Link2D::fn_vDestroyPlane (void)
{
GetInterface()->fn_vSetModifDeleteOk (TRUE);
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poGraphic,FALSE,FALSE,TRUE,FALSE);
GetInterface()->fn_vSetModifDeleteOk (FALSE);
m_poGraphic = NULL;
}
void Link2D::fn_vDrawPlane (void)
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
GLI_tdxValue d5, md5;
tdeLocalColor tdColor = GetSuperObject()->GetLocalColor ();
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
MTH3D_tdstVector n, u, v;
ACP_tdxHandleOfObject hMot = (ACP_tdxHandleOfObject) HIE_fn_hGetSuperObjectObject(m_poGraphic->GetStruct());
n = stSecondVertex;
MTH3D_M_vSubVector(&n,&n,&stFirstVertex);
GLI_tdxValue lenght = MTH3D_M_xNormVector( &n );
d5 = (GLI_tdxValue)(lenght*0.5);
md5 = -d5;
MTH3D_tdstVector a8_stPoint [24];
MTH3D_M_vSetVectorElements (a8_stPoint, 0,-0.5,m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+1, 1.,-0.5,m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+2, 1.,0.5,m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+3, 0,0.5,m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+4, 0,-0.5,-m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+5, 1.,-0.5,-m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+6, 1.,0.5,-m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+7, 0,0.5,-m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+8, 0.4f, -0.6f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+9, 0.6f, -0.6f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+10, 0.6f, -0.5f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+11, 0.4f, -0.5f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+12, 0.4f, -0.6f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+13, 0.6f, -0.6f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+14, 0.6f, -0.5f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+15, 0.4f, -0.5f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+16, 0.4f, 0.5f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+17, 0.6f, 0.5f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+18, 0.6f, 0.6f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+19, 0.4f, 0.6f, m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+20, 0.4f, 0.5f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+21, 0.6f, 0.5f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+22, 0.6f, 0.6f, -m_xe);
MTH3D_M_vSetVectorElements (a8_stPoint+23, 0.4f, 0.6f, -m_xe);
GEO_vSetListOfPointsOfObject
(
hMot,
a8_stPoint,
24,
0
);
GEO_xComputeObjectNormals ( hMot );
MTH3D_M_vNormalizeVector(&n,&n);
if (n.xX||n.xY) { MTH3D_M_vSetVectorElements ((&u),(-n.xY),(n.xX),0.); }
else { MTH3D_M_vSetVectorElements((&u),0.,(-n.xZ),n.xY); }
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vCrossProductVector((&v),(&n),(&u));
fn_vComputePlaneAxis ();
}
// moves
void Link2D::fn_vStartMove ( MTH3D_tdstVector* pstStartVertex )
{
m_stPlaneVertex = *pstStartVertex;
fn_vDrawPlane ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Link2D::fn_vMove ( MTH3D_tdstVector* pstTranslation )
{
MTH3D_tdstVector stInitialValue = m_stPlaneVertex;
MTH3D_M_vAddVector(&m_stPlaneVertex,&m_stPlaneVertex,pstTranslation);
fn_vComputePlaneAxis (&m_stPlaneVertex);
fn_vProjVertex ( &m_stPlaneVertex );
fn_vDrawPlane ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
*pstTranslation = m_stPlaneVertex;
MTH3D_M_vSubVector(pstTranslation, pstTranslation, &stInitialValue);
}
void Link2D::fn_vEndMove (void)
{
fn_vWayNotifySave ();
}
void Link2D::fn_vComputePlaneAxis (MTH3D_tdstVector* pstVertex)
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
MTH3D_tdstVector Ox, Oy, Oz;
MTH3D_tdstVector v;
MTH3D_tdstVector stVectorU, stVectorV, stVectorN;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
Ox = stSecondVertex;
MTH3D_M_vSubVector(&Ox,&Ox,&stFirstVertex);
GLI_tdxValue lenght = MTH3D_M_xNormVector( &Ox );
if (pstVertex)
{
v = *pstVertex;
MTH3D_M_vSubVector(&v,&v,&stFirstVertex);
MTH3D_M_vCrossProductVector((&Oz),(&Ox),(&v));
// we keep the normal on the same side !!
if (MTH3D_M_xDotProductVector(&Oz,&m_stNormalVertex)<=0) MTH3D_M_vMulScalarVector (&Oz,-1,&Oz);
}
else Oz = m_stNormalVertex;
MTH3D_M_vCrossProductVector((&Oy),(&Oz),(&Ox));
MTH3D_M_vCrossProductVector((&Oz),(&Ox),(&Oy));
MTH3D_M_vNormalizeVector(&Oy,&Oy);
MTH3D_M_vNormalizeVector(&Oz,&Oz);
MTH3D_M_vNormalizeVector(&Ox,&Ox);
GEO_tdxHandleToMatrix hAbsolutePlaneMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poGraphic->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsolutePlaneMatrix );
POS_fn_vSetTranslationVector( hAbsolutePlaneMatrix, &stFirstVertex );
POS_fn_vSetRotationMatrix( hAbsolutePlaneMatrix , &Ox, &Oy, &Oz );
POS_fn_vGetScaleMatrix( hAbsolutePlaneMatrix, &stVectorU, &stVectorV, &stVectorN );
MTH3D_M_vMulScalarVector( &stVectorU, lenght, &stVectorU);
MTH3D_M_vMulScalarVector( &stVectorV, lenght, &stVectorV);
POS_fn_vSetScaleMatrix( hAbsolutePlaneMatrix, &stVectorU, &stVectorV, &stVectorN );
POS_fn_vNormalizeMatrix( hAbsolutePlaneMatrix ) ;
GetInterface()->fn_vComputeNewRelativeMatrix (m_poGraphic->GetStruct());
m_stNormalVertex = Oz;
}
void Link2D::fn_vSetPlaneHorizontal (void)
{
MTH3D_M_vSetVectorElements (&m_stNormalVertex, 0., 0., 1.);
fn_vComputePlaneAxis ();
fn_vDrawPlane ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Link2D::fn_vSetPlaneVertical (void)
{
MTH3D_tdstVector Ox, Oy;
MTH3D_tdstVector stFirstVertex, stSecondVertex;
MTH3D_M_vSetVectorElements (&Oy, 0., 0., 1.);
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
Ox = stSecondVertex;
MTH3D_M_vSubVector(&Ox,&Ox,&stFirstVertex);
MTH3D_M_vCrossProductVector ( &m_stNormalVertex, &Ox, &Oy );
fn_vComputePlaneAxis ();
fn_vDrawPlane ();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Link2D::fn_vProjVertex ( MTH3D_tdstVector* pstVertex )
{
POS_tdstCompletePosition stInvMatrix;
MTH3D_tdstVector stLocalVertex;
MTH_tdxReal sty;
POS_fn_vSetIdentityMatrix(&stInvMatrix);
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poGraphic->GetStruct());
POS_fn_vInvertMatrix( &stInvMatrix , hAbsoluteMatrix );
POS_fn_vMulMatrixVertex( &stLocalVertex, &stInvMatrix, pstVertex);
MTH3D_M_vSetXofVector(&stLocalVertex,0.5);
sty = MTH3D_M_xGetYofVector(&stLocalVertex);
if (sty>0.) MTH3D_M_vSetYofVector(&stLocalVertex,0.55f)
else MTH3D_M_vSetYofVector(&stLocalVertex,-0.55f);
MTH3D_M_vSetZofVector(&stLocalVertex,0.);
POS_fn_vMulMatrixVertex( pstVertex ,hAbsoluteMatrix, &stLocalVertex);
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,414 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkArc.cpp
//
// Definition of the circle arc
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link2D
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 30 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#define _ENG_CIRCLE_FRIEND_
#include "incai.h"
#undef _ENG_CIRCLE_FRIEND_
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "CurObj.hpp"
#include "Link2D.hpp"
#include "LinkArc.hpp"
#include "LkArcDia.h"
#include "Inter.hpp"
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
char LinkArc::ms_cType = WP_ConnType_ucCircle;
char LinkArc::ms_szName [10] = "Arc";
int iJustToLinkCiArBidouille;
void JustToLinkCiAr (void) { iJustToLinkCiArBidouille=1; }
void LinkArc::fn_vRegisterObject (void)
{
tdst_LinkObject* pstLinkObject = new tdst_LinkObject;
strcpy ( pstLinkObject->szName, ms_szName );
pstLinkObject->cType = ms_cType;
pstLinkObject->fn_pConstruct = fn_pConstruct;
ms_oListLinkObject.AddTail (pstLinkObject);
JustToLinkCiAr ();
}
LinkArc::LinkArc ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, WP_tdhLink hLink )
: Link2D ( p_oDLL, p_oOwner, hLink )
{
m_bInitCenter = FALSE;
MTH3D_tdstVector stNulVector = { 0, 0, 0 };
hLink = (WP_tdhLink)GetEngineStruct();
//-------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hArcObject.CreateFromCurve
(
WP_fnv_Link_GetConnectionTypeCircleArcCurve (hLink),
EDWAY_C_ucModeNoObject,
NULL,
&WP_fnh_Link_GetEngineCircleArcObject(hLink)->m_dstListOfPoints
);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//-------------------------------------
m_bEditPlane = FALSE;
m_poCursor=NULL;
m_stCenterVertex=stNulVector;
m_bFirstEdition=TRUE;
}
LinkArc::LinkArc ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner )
: Link2D ( p_oDLL, p_oOwner )
{
m_bInitCenter = TRUE;
MTH3D_tdstVector stNulVector = { 0, 0, 0 };
WP_tdhLink hLink = (WP_tdhLink)GetEngineStruct();
// allocate circle structure
WP_fnv_Link_Allocate
(
hLink,
WP_ConnType_ucCircle,
WP_fneuc_Link_GetConnectionDynamicType (hLink)
);
//------------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hArcObject.CreateFromCurve
(
WP_fnv_Link_GetConnectionTypeCircleArcCurve (hLink),
EDWAY_C_ucModeNoObject,
NULL,
&WP_fnh_Link_GetEngineCircleArcObject(hLink)->m_dstListOfPoints
);
// init sampling rate values
WP_fnv_Link_SetCurrentSample (hLink, 15);
// EDWAY_fnb_CircleArcObject_ChangeSamplingRate ( m_hArcObject, 15 );
m_hArcObject.ChangeSamplingRate (15 );
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//------------------------------------------------
m_bEditPlane = FALSE;
m_poCursor=NULL;
m_stCenterVertex=stNulVector;
m_bFirstEdition=TRUE;
}
CDialog* LinkArc::fn_pGetSpecificDialog (CWnd* pParentWnd)
{
ArcDia* pDialog = new ArcDia (this);
pDialog->Create ( IDD_ARC_DIALOG, pParentWnd );
pDialog->fn_vTutRegister ();
return (CDialog*) pDialog;
}
void LinkArc::fn_vFreeSpecificDialog (CDialog* pDialog)
{
((ArcDia*)pDialog)->fn_vTutUnregister ();
}
void LinkArc::fn_vConstructGraphic (void)
{
}
void LinkArc::fn_vRotationGraphic (BOOL bRotation)
{
Link::fn_vRotationGraphic (bRotation);
if (bRotation)
{
if (m_bEditPlane)
fn_vStopEdit ();
}
else
{
}
}
void LinkArc::fn_vDrawNormal (void)
{
fn_vComputeAxis ();
if (m_bEditPlane) {
fn_vDrawPlane ();
m_poCursor->fn_vDraw ();
fn_vSetEngineStructure ();
}
}
void LinkArc::fn_vDrawOutHierarchy (GLD_tdstViewportAttributes *pViewportAttributes)
{
if (m_bEditPlane)
{
fn_vUpdateCenter ();
}
fn_vSetEngineStructure ();
//----------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hArcObject.SetColor(0xFFFFFFFF);
m_hArcObject.SetViewPortAttributes (pViewportAttributes);
m_hArcObject.Draw();
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//----------------------------------------------
}
void LinkArc::fn_vSetWaypoints ( WayPoint* poFirstWP, WayPoint* poSecondWP )
{
Link::fn_vSetWaypoints ( poFirstWP, poSecondWP );
}
void LinkArc::fn_vInitGraphic (void)
{
Link::fn_vInitGraphic ();
fn_vInitCenter (m_bInitCenter);
m_bInitCenter=FALSE;
}
void LinkArc::fn_vStartEdit (void)
{
if (m_bRotationMode) return;
fn_vSetDrawOutHierarchy (FALSE);
//---- plane
fn_vConstructPlane();
if (m_bFirstEdition)
{
fn_vInitPlaneOrientation ();
m_bFirstEdition=FALSE;
}
fn_vComputeAxis ();
m_bEditPlane = TRUE;
fn_vDrawPlane ();
//----- cursor
// create
m_poCursor= new Cursor ( GetInterface(), m_poGraphic, eCursorCircularLimit );
// insert in hierarchy
m_poCursor->GetSuperObject()->SetSuperObjectOwner (m_poGraphic);
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy ( m_poCursor->GetSuperObject(), m_poGraphic, FALSE, FALSE, FALSE );
m_poCursor->GetSuperObject()->SetEditProtected (TRUE);
// compute absolute matrix
GetInterface()->fn_vComputeAbsoluteMatrix (m_poCursor->GetSuperObject());
// compute the third point with the center
MTH3D_tdstVector stCursorVertex;
fn_vComputeCursorVertex ( &stCursorVertex );
m_poCursor->fn_vSetAbsoluteVertex (&stCursorVertex);
m_poCursor->fn_vDraw ();
fn_vSetDrawOutHierarchy (TRUE);
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void LinkArc::fn_vStopEdit (void)
{
m_bEditPlane = FALSE;
fn_vDestroyPlane();
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void LinkArc::fn_vSetEngineStructure (void)
{
MTH3D_tdstVector stStartPoint;
MTH3D_tdstVector stEndPoint;
MTH3D_tdstVector stCenterPoint;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stStartPoint );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stEndPoint );
fn_vGetAbsoluteCenter (&stCenterPoint);
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_CircleArcObject_ChangeParams (m_hArcObject,&stStartPoint, &stEndPoint, &stCenterPoint);
m_hArcObject.ChangeParams (&stStartPoint, &stEndPoint, &stCenterPoint);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
if ( m_poCursor )
if ( m_poCursor->fn_bCursorMove() ) fn_vWayNotifySave ();
}
void LinkArc::fn_vUpdateCenter (void)
{
MTH3D_tdstVector stStartPoint, stEndPoint;
MTH3D_tdstVector stLocalFirstVertex, stLocalSecondVertex, stLocalThirdVertex;
MTH3D_tdstVector stAbsoluteCenter;
MTH3D_tdstVector stCenter;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stStartPoint );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stEndPoint );
// local vertex
CPA_SuperObject* psoPlane = (CPA_SuperObject*)GetSuperObject()->GetHead();
GetInterface()->fn_vComputeAbsoluteMatrix (psoPlane);
GEO_tdxHandleToMatrix hAbsolutePlaneMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (psoPlane->GetStruct());
POS_tdstCompletePosition InvMatrix;
POS_fn_vSetIdentityMatrix(&InvMatrix);
POS_fn_vInvertMatrix( &InvMatrix , hAbsolutePlaneMatrix );
POS_fn_vMulMatrixVertex( &stLocalFirstVertex, &InvMatrix, &stStartPoint ) ;
POS_fn_vMulMatrixVertex( &stLocalSecondVertex, &InvMatrix, &stEndPoint ) ;
m_poCursor->fn_vGetAbsoluteVertex ( &stAbsoluteCenter );
POS_fn_vMulMatrixVertex( &stLocalThirdVertex, &InvMatrix, &stAbsoluteCenter ) ;
MTH3D_fnv_CircleArcCurve_FindCenter
(
&stLocalFirstVertex,
&stLocalSecondVertex,
&stLocalThirdVertex,
&stCenter
);
POS_fn_vMulMatrixVertex( &stAbsoluteCenter, hAbsolutePlaneMatrix, &stCenter );
fn_vSetAbsoluteCenter ( &stAbsoluteCenter );
}
void LinkArc::fn_vInitCenter (BOOL bInit)
{
if (bInit)
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
MTH3D_tdstVector u, v, w;
MTH3D_tdstVector stAbsoluteCenter;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
u = stSecondVertex;
MTH3D_M_vSubVector(&u,&u,&stFirstVertex);
MTH3D_M_vMulScalarVector(&u,0.5f,&u);
MTH3D_M_vSetVectorElements ( &w, 0.f, 0.f, 1.f );
MTH3D_M_vCrossProductVector ( &v, &w, &u );
MTH3D_M_vNormalizeVector(&v,&v);
MTH3D_M_vMulScalarVector(&v,1e-3f,&v);
stAbsoluteCenter = stFirstVertex;
MTH3D_M_vAddVector(&stAbsoluteCenter,&stAbsoluteCenter,&u);
MTH3D_M_vAddVector(&stAbsoluteCenter,&stAbsoluteCenter,&v);
fn_vSetAbsoluteCenter (&stAbsoluteCenter);
}
else
{
MTH3D_tdstVector stFirstPoint, stSecondPoint, stCenterPoint;
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_CircleArcObject_GetParams (m_hArcObject, &stFirstPoint, &stSecondPoint, &stCenterPoint);
m_hArcObject.GetParams (&stFirstPoint, &stSecondPoint, &stCenterPoint);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
fn_vSetAbsoluteCenter (&stCenterPoint);
}
}
void LinkArc::fn_vGetAbsoluteCenter (MTH3D_tdstVector* pstCenter)
{
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_fn_vMulMatrixVertex( pstCenter, hAbsoluteMatrix, &m_stCenterVertex );
}
void LinkArc::fn_vSetAbsoluteCenter (MTH3D_tdstVector* pstCenter)
{
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_tdstCompletePosition InvMatrix;
POS_fn_vSetIdentityMatrix(&InvMatrix);
POS_fn_vInvertMatrix( &InvMatrix , hAbsoluteMatrix );
POS_fn_vMulMatrixVertex( &m_stCenterVertex, &InvMatrix, pstCenter );
}
void LinkArc::fn_vComputeCursorVertex ( MTH3D_tdstVector* pstCursorVertex )
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
MTH3D_tdstVector stCenterVertex;
MTH3D_tdstVector stMildVertex;
MTH3D_tdstVector stVector;
MTH3D_tdstVector stRadiusVector;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
fn_vGetAbsoluteCenter ( &stCenterVertex );
stMildVertex = stFirstVertex;
MTH3D_M_vAddVector(&stMildVertex,&stMildVertex,&stSecondVertex);
MTH3D_M_vMulScalarVector(&stMildVertex,0.5f,&stMildVertex);
stVector = stMildVertex;
MTH3D_M_vSubVector(&stVector,&stVector,&stCenterVertex);
MTH3D_M_vNormalizeVector(&stVector,&stVector);
stRadiusVector = stFirstVertex;
MTH3D_M_vSubVector(&stRadiusVector,&stRadiusVector,&stCenterVertex);
MTH_tdxReal stRadius = GLI_M_Norme(&stRadiusVector);
MTH3D_M_vMulScalarVector(&stVector,stRadius,&stVector);
*pstCursorVertex = stCenterVertex;
MTH3D_M_vAddVector(pstCursorVertex,pstCursorVertex,&stVector);
}
void LinkArc::fn_vGetSaveInfo ( char dszParam [20][20], long& lNbParam )
{
unsigned char ucSamplingRate;
MTH3D_tdstVector stFirstPoint, stSecondPoint, stCenterPoint;
ucSamplingRate = WP_fnuc_Link_GetCurrentSample (GetStruct());
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_CircleArcObject_GetParams (m_hArcObject, &stFirstPoint, &stSecondPoint, &stCenterPoint);
m_hArcObject.GetParams (&stFirstPoint, &stSecondPoint, &stCenterPoint);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
strcpy ( dszParam [0], "Circle" );
lNbParam = 2;
sprintf ( dszParam[lNbParam++], "%d", ucSamplingRate);
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetXofVector(&stCenterPoint) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetYofVector(&stCenterPoint) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetZofVector(&stCenterPoint) );
}
void LinkArc::fn_vInitPlaneOrientation (void)
{
MTH3D_tdstVector stFirstPoint, stSecondPoint, stCenterPoint;
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_CircleArcObject_GetParams (m_hArcObject, &stFirstPoint, &stSecondPoint, &stCenterPoint);
m_hArcObject.GetParams (&stFirstPoint, &stSecondPoint, &stCenterPoint);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
fn_vComputePlaneAxis ( &stCenterPoint );
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,356 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkBez.cpp
//
// Edit Bezier Link
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 29 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#define _ENG_BEZ_FRIEND_
#include "incai.h"
#undef _ENG_BEZ_FRIEND_
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "CurObj.hpp"
#include "Link2D.hpp"
#include "TanObj.hpp"
#include "LinkBez.hpp"
#include "LkBezDia.h"
#include "Inter.hpp"
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
char LinkBez::ms_cType = WP_ConnType_ucBezier;
char LinkBez::ms_szName [10] = "Bezier";
int iJustToLinkBezBidouille;
void fn_vJustToLinkBez (void) { iJustToLinkBezBidouille=1; }
void LinkBez::fn_vRegisterObject (void)
{
tdst_LinkObject* pstLinkObject = new tdst_LinkObject;
strcpy ( pstLinkObject->szName, ms_szName );
pstLinkObject->cType = ms_cType;
pstLinkObject->fn_pConstruct = fn_pConstruct;
ms_oListLinkObject.AddTail (pstLinkObject);
fn_vJustToLinkBez ();
}
LinkBez::LinkBez ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, WP_tdhLink hLink )
: Link ( p_oDLL, p_oOwner, hLink )
{
MTH3D_tdstVector stNulVector = { 0, 0, 0 };
hLink = (WP_tdhLink)GetEngineStruct();
ACP_tdstDynaParam stDynaParam;
WP_fnv_Link_GetDynamicParameter (hLink,&stDynaParam);
//-----------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hBezierObject.CreateWithCurve
(
WP_fnv_Link_GetConnectionTypeBezierCurve (hLink),
EDWAY_C_ucModeNoObject,
NULL,
&WP_M_hLinkGetEngineBezierObject(hLink)->m_dstListOfPoints
);
WP_fnv_Link_SetCurrentSample (hLink, 15);
m_hBezierObject.ChangeSamplingRate(15);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//-----------------------------------------------
m_pstStartTangent = new Tangent ( p_oDLL, this, eVariableLenghtTangent, eFixOrientationTangent, eControlUpChangeNeighbour );
m_pstFinishTangent = new Tangent ( p_oDLL, this, eVariableLenghtTangent, eFixOrientationTangent, eControlUpChangeNeighbour );
m_bFirstEdition = TRUE;
}
LinkBez::LinkBez ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner )
: Link ( p_oDLL, p_oOwner )
{
MTH3D_tdstVector stNulVector = { 0, 0, 0 };
WP_tdhLink hLink = (WP_tdhLink)GetEngineStruct();
// allocate bezier structure
WP_fnv_Link_Allocate
(
hLink,
WP_ConnType_ucBezier,
WP_fneuc_Link_GetConnectionDynamicType (hLink)
);
ACP_tdstDynaParam stDynaParam;
WP_fnv_Link_GetDynamicParameter (hLink,&stDynaParam);
//-------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hBezierObject.CreateWithCurve
(
WP_fnv_Link_GetConnectionTypeBezierCurve (hLink),
EDWAY_C_ucModeNoObject,
NULL,
&WP_M_hLinkGetEngineBezierObject(hLink)->m_dstListOfPoints
);
// init sampling rate values
WP_fnv_Link_SetCurrentSample (hLink, 15);
m_hBezierObject.ChangeSamplingRate(15);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//-------------------------------------------
// c'est comme <20>a -> pour allouer m_dstListOfPoints j'ai pas trouv<75> autre chose
// WP_fnv_Link_ChangeConnectionTypeBezier( hLink, EDWAY_fnh_BezierObject_GetBezierCurve(m_hBezierObject) );
// TEST
// ENG_fnv_BezierObject_BuildListOfPoints( WP_M_hLinkGetEngineBezierObject(hLink) );
// ((ENG_tdstBezierObject) WP_M_hLinkGetEngineBezierObject(hLink))->m_dstListOfPoints = NULL;
// ENG_fnv_BezierObject_SetListOfPoints ( WP_M_hLinkGetEngineBezierObject(hLink), NULL );
// EDWAY_fnv_BezierObject_Calculate (m_hBezierObject);
m_pstStartTangent = new Tangent ( p_oDLL, this, eVariableLenghtTangent, eFixOrientationTangent, eControlUpChangeNeighbour );
m_pstFinishTangent = new Tangent ( p_oDLL, this, eVariableLenghtTangent, eFixOrientationTangent, eControlUpChangeNeighbour );
m_bFirstEdition = TRUE;
}
void LinkBez::fn_vConstructGraphic (void)
{
Link::fn_vConstructGraphic();
m_pstStartTangent->GetSuperObject()->SetSuperObjectOwner (GetSuperObject());
m_pstFinishTangent->GetSuperObject()->SetSuperObjectOwner (GetSuperObject());
}
void LinkBez::fn_vRotationGraphic (BOOL bRotation)
{
Link::fn_vRotationGraphic (bRotation);
if (bRotation)
{
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_pstStartTangent->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_pstFinishTangent->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
}
else
{
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_pstStartTangent->GetSuperObject(), GetSuperObject(),FALSE,FALSE,FALSE);
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_pstFinishTangent->GetSuperObject(), GetSuperObject(),FALSE,FALSE,FALSE);
}
}
void LinkBez::fn_vInitGraphic (void)
{
Link::fn_vInitGraphic ();
if (!m_bFirstEdition) return;
m_bFirstEdition = FALSE;
// set the vertex of the Tangent object
MTH3D_tdstVector stFirstFixVertex, stSecondFixVertex;
MTH3D_tdstVector stFirstMoveVertex, stSecondMoveVertex;
MTH3D_tdstVector u;
MTH3D_tdstVector stStartPoint, stEndPoint;
MTH3D_tdstVector stStartVector, stEndVector;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstFixVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondFixVertex );
stFirstMoveVertex = stFirstFixVertex;
stSecondMoveVertex = stSecondFixVertex;
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_BezierObject_GetParams (m_hBezierObject,&stStartPoint, &stEndPoint, &stStartVector, &stEndVector);
m_hBezierObject.GetParams (&stStartPoint, &stEndPoint, &stStartVector, &stEndVector);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
if ( (MTH3D_M_xNormVector(&stStartVector)>1e-10) && (MTH3D_M_xNormVector(&stEndVector)>1e-10) )
{
// init with load values
MTH3D_M_vAddVector(&stFirstMoveVertex,&stFirstMoveVertex,&stStartVector);
MTH3D_M_vAddVector(&stSecondMoveVertex,&stSecondMoveVertex,&stEndVector);
}
else
{
// set new init values
u = stSecondFixVertex;
MTH3D_M_vSubVector(&u, &u, &stFirstFixVertex );
MTH3D_M_vMulScalarVector(&u,0.15f,&u);
MTH_tdxReal xLenght = MTH3D_M_xNormVector (&u);
if (xLenght<0.1f) MTH3D_M_vMulScalarVector ( &u, 0.1f/xLenght, &u);
MTH3D_M_vAddVector(&stFirstMoveVertex,&stFirstMoveVertex,&u);
MTH3D_M_vMulScalarVector(&u,-1,&u);
MTH3D_M_vAddVector(&stSecondMoveVertex,&stSecondMoveVertex,&u);
}
GetSuperObject()->AddTail ( m_pstStartTangent->GetSuperObject() );
GetSuperObject()->AddTail ( m_pstFinishTangent->GetSuperObject() );
GetInterface()->GetInterface()->fn_vCancelCurrentSelection (FALSE);
m_pstStartTangent->fn_vSetAbsoluteVertex ( &stFirstFixVertex, &stFirstMoveVertex );
m_pstFinishTangent->fn_vSetAbsoluteVertex ( &stSecondFixVertex, &stSecondMoveVertex );
}
void LinkBez::fn_vDrawNormal (void)
{
fn_vComputeAxis ();
m_pstStartTangent->fn_vDraw ();
m_pstFinishTangent->fn_vDraw ();
fn_vSetEngineStructure ();
}
void LinkBez::fn_vDrawOutHierarchy (GLD_tdstViewportAttributes *pViewportAttributes)
{
fn_vSetEngineStructure ();
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hBezierObject.SetViewPortAttributes( pViewportAttributes );
m_hBezierObject.SetColor (0xFFFFFFFF );
m_hBezierObject.Draw();
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
}
CDialog* LinkBez::fn_pGetSpecificDialog (CWnd* pParentWnd)
{
BezierDia* pDialog = new BezierDia (this);
pDialog->Create ( IDD_BEZIER_DIALOG, pParentWnd );
pDialog->fn_vTutRegister ();
return (CDialog*) pDialog;
}
void LinkBez::fn_vFreeSpecificDialog (CDialog* pDialog)
{
((BezierDia*)pDialog)->fn_vTutUnregister ();
}
void LinkBez::fn_vSetEngineStructure (void)
{
MTH3D_tdstVector stStartPoint;
MTH3D_tdstVector stEndPoint;
MTH3D_tdstVector stStartVector;
MTH3D_tdstVector stEndVector;
m_pstStartTangent->fn_pGetAbsoluteTangent (&stStartVector);
m_pstFinishTangent->fn_pGetAbsoluteTangent (&stEndVector);
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stStartPoint );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stEndPoint );
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
m_hBezierObject.ChangeParams(&stStartPoint, &stEndPoint, &stStartVector, &stEndVector);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
}
void LinkBez::fn_vChangeNeighbourTangent (Tangent* pTangent)
{
Link::fn_vChangeNeighbourTangent (pTangent);
Link* pChangeLink;
if (m_pstStartTangent==pTangent)
{
pChangeLink = m_poParent->fn_pPrevLink (this);
if (pChangeLink)
if (pChangeLink->fn_cGetType()==WP_ConnType_ucBezier)
{
MTH3D_tdstVector stTangent;
pTangent->fn_pGetAbsoluteTangent(&stTangent);
((LinkBez*)pChangeLink)->fn_vSetTangent ( 2, &stTangent );
pChangeLink->fn_vDraw ();
}
}
else
{
pChangeLink = m_poParent->fn_pNextLink (this);
if (pChangeLink)
if (pChangeLink->fn_cGetType()==WP_ConnType_ucBezier)
{
MTH3D_tdstVector stTangent;
pTangent->fn_pGetAbsoluteTangent(&stTangent);
((LinkBez*)pChangeLink)->fn_vSetTangent ( 1, &stTangent );
pChangeLink->fn_vDraw ();
}
}
}
void LinkBez::fn_vSetTangent ( int iSide, MTH3D_tdstVector* pTangentVertex )
{
switch (iSide)
{
case 1 : m_pstStartTangent->fn_vSetTangentDirection (pTangentVertex,TRUE); break;
case 2 : m_pstFinishTangent->fn_vSetTangentDirection (pTangentVertex,TRUE); break;
}
}
void LinkBez::fn_vGetSaveInfo ( char dszParam [20][20], long& lNbParam )
{
unsigned char ucSamplingRate;
MTH3D_tdstVector stFirstPoint, stSecondPoint, stFirstVector, stSecondVector;
ucSamplingRate = WP_fnuc_Link_GetCurrentSample (GetStruct());
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// EDWAY_fnv_BezierObject_GetParams ( m_hBezierObject, &stFirstPoint, &stSecondPoint, &stFirstVector, &stSecondVector );
m_hBezierObject.GetParams (&stFirstPoint, &stSecondPoint, &stFirstVector, &stSecondVector );
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
strcpy ( dszParam [0], "Bezier" );
lNbParam = 2;
sprintf ( dszParam[lNbParam++], "%d", ucSamplingRate);
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetXofVector(&stFirstVector) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetYofVector(&stFirstVector) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetZofVector(&stFirstVector) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetXofVector(&stSecondVector) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetYofVector(&stSecondVector) );
sprintf ( dszParam[lNbParam++], "%f", MTH3D_M_xGetZofVector(&stSecondVector) );
}
void LinkBez::fn_vInitEditorFromEngine (void)
{
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,157 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkLine.cpp
//
// Definition of the link editors objects
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 29 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WPObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "LinkLine.hpp"
#include "Eng_StLi.h"
#include "Inter.hpp"
char LinkLine::ms_cType = WP_ConnType_ucStaticLine;
char LinkLine::ms_szName [10] = "Line";
void LinkLine::fn_vRegisterObject (void)
{
tdst_LinkObject* pstLinkObject = new tdst_LinkObject;
strcpy ( pstLinkObject->szName, ms_szName );
pstLinkObject->cType = ms_cType;
pstLinkObject->fn_pConstruct = fn_pConstruct;
ms_oListLinkObject.AddTail (pstLinkObject);
}
LinkLine::LinkLine ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, WP_tdhLink hLink )
: Link ( p_oDLL, p_oOwner, hLink )
{
m_xLBeam = 0.034f;
fn_vSetType ( WP_ConnType_ucStaticLine );
}
LinkLine::LinkLine ( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner )
: Link ( p_oDLL, p_oOwner )
{
m_xLBeam = 0.034f;
fn_vSetType ( WP_ConnType_ucStaticLine );
}
void LinkLine::fn_vConstructGraphic (void)
{
CPA_SuperObject* poGraphic = GetInterface()->fn_pGetNewLineGraphicObject();
poGraphic->SetSuperObjectOwner (GetSuperObject());
GetSuperObject()->AddTail (poGraphic);
GEO_xComputeObjectNormals ( (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(poGraphic->GetStruct()));
poGraphic->SetEditProtected (TRUE);
}
void LinkLine::fn_vRotationGraphic (BOOL bRotation)
{
Link::fn_vRotationGraphic (bRotation);
}
void LinkLine::fn_vDrawNormal (void)
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
tdeLocalColor tdColor = GetSuperObject()->GetLocalColor ();
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
CPA_SuperObject* psoLine = (CPA_SuperObject*)GetSuperObject()->GetHead();
GLI_tdxValue d=(GLI_tdxValue)(m_xLBeam*0.5);
GLI_tdxValue md=(GLI_tdxValue)(-m_xLBeam*0.5);
GLI_tdxValue d2=(GLI_tdxValue)(m_xLBeam*2.);
GLI_tdxValue md2=(GLI_tdxValue)(-m_xLBeam*2.);
GLI_tdxValue zero=(GLI_tdxValue)0.;
MTH3D_tdstVector n, u, v;
MTH3D_tdstVector Ox = { 1., 0., 0. };
// Version finale
ACP_tdxHandleOfObject hMot = (ACP_tdxHandleOfObject) HIE_fn_hGetSuperObjectObject(psoLine->GetStruct());
n = stSecondVertex;
MTH3D_M_vSubVector(&n,&n,&stFirstVertex);
GLI_tdxValue lenght = MTH3D_M_xNormVector( &n );
MTH3D_tdstVector a8_stPoint [8];
MTH3D_M_vSetVectorElements (a8_stPoint, md2,md2,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+1, d2,md2,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+2, d2,d2,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+3, md2,d2,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+4, md,md,lenght);
MTH3D_M_vSetVectorElements (a8_stPoint+5, d,md,lenght);
MTH3D_M_vSetVectorElements (a8_stPoint+6, d,d,lenght);
MTH3D_M_vSetVectorElements (a8_stPoint+7, md,d,lenght);
GEO_vSetListOfPointsOfObject
(
hMot,
a8_stPoint,
8,
0
);
GEO_xComputeObjectNormals ( hMot );
MTH3D_M_vNormalizeVector(&n,&n);
// here : to rotate the beam around its principal axis
// by defaults find section align with plan z=0
if (n.xX||n.xY) { MTH3D_M_vSetVectorElements ((&u),(-n.xY),(n.xX),0.); }
else { MTH3D_M_vSetVectorElements((&u),0.,(-n.xZ),n.xY); }
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vCrossProductVector((&v),(&n),(&u));
// change the local matrix
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (psoLine->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsoluteLineMatrix );
POS_fn_vSetTranslationVector( hAbsoluteLineMatrix, &stFirstVertex );
POS_fn_vSetRotationMatrix( hAbsoluteLineMatrix , &u, &v, &n );
GetInterface()->fn_vComputeNewRelativeMatrix (psoLine->GetStruct());
}
void LinkLine::fn_vGetSaveInfo ( char dszParam [20][20], long& lNbParam )
{
strcpy ( dszParam [0], "StaticLine" );
lNbParam = 2;
}
void LinkLine::fn_vSetWaypoints ( WayPoint* poFirstWP, WayPoint* poSecondWP )
{
Link::fn_vSetWaypoints ( poFirstWP, poSecondWP );
if (poFirstWP && poSecondWP)
WP_fnv_Link_ChangeConnectionTypeStaticLineObject ((WP_tdhLink)GetData(), (WP_tdhWayPoint)poFirstWP->GetData(), (WP_tdhWayPoint)poSecondWP->GetData() );
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,30 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkMod.cpp
//
// Modification class.
// This class is used to implement the Do/Undo actions.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
//#include "LinkMod.hpp"
//#include "Inter.hpp"
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,875 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkObj.cpp
//
// Definition of the link editors objects
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CPA_Object
// CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "LinkMod.hpp"
#include "LinkDia.hpp"
#include "RotDia.hpp"
#include "incgli.h"
#include "WPObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "Link2D.hpp"
#include "Inter.hpp"
#include "TanObj.hpp"
#include "LinkLine.hpp"
#include "LinkBez.hpp"
#include "LinkArc.hpp"
#include "LinkObj.hpp"
DeclareTemplateStatic(WP_tdhLink);
//---- static
Waypoint_Interface* Link::ms_poInterface; // Interface
DiaLink* Link::ms_poDiaLink; // Dialog
RotationDia* Link::ms_poRotationDia; // Rotation Dialog
CPA_List<tdst_LinkObject> Link::ms_oListLinkObject; // List of the present links
long Link::ms_lNbLink=0;
void Link::fn_vInitObject (Waypoint_Interface* poInterface)
{
CPA_EdMot<WP_tdhLink>::Init (WP_fnh_Link_Create, WP_fnv_Link_Copy, WP_fnv_Link_Destroy);
LinkLine::fn_vRegisterObject();
LinkBez::fn_vRegisterObject();
LinkArc::fn_vRegisterObject();
ms_poInterface = poInterface;
}
void Link::fn_vSetDialog ( DiaLink* poDiaLink, RotationDia* poRotationDia )
{
ms_poDiaLink=poDiaLink;
ms_poDiaLink->fn_vInitDialog ();
ms_poRotationDia=poRotationDia;
ms_poRotationDia->fn_vInitDialog ();
}
Link* Link::fn_pCreateLink ( Way* poWay, char cType, WayPoint* poFirstWP, WayPoint* poSecondWP, WP_tdhLink hLink )
{
CPA_SuperObject* poSuperLink = ms_poInterface->GetInterface()->GetNewSuperObject ( E_ss_NoSave, C_NoType );
poSuperLink->SetTypeSO (C_Protected);
Link* poLink;
POSITION xPos;
tdst_LinkObject* pst_LinkObject;
if (hLink)
cType = (char) WP_fneuc_Link_GetConnectionType (hLink);
// important loop that call the right constructor
for ( pst_LinkObject=ms_oListLinkObject.GetHeadElement (xPos); pst_LinkObject; pst_LinkObject=ms_oListLinkObject.GetNextElement (xPos) )
if (pst_LinkObject->cType==cType)
poLink = pst_LinkObject->fn_pConstruct ( poWay->GetInterface(), poWay, hLink );
poLink->fn_vSetDraw (TRUE);
poSuperLink->SetObject(poLink);
poLink->SetSuperObject(poSuperLink);
//---- set dynamics parameters
if (!hLink)
{
ACP_tdstDynaParam stDynParam;
WP_fnv_Link_GetDynamicParameter ( (WP_tdhLink)(poLink->GetEngineStruct()), &stDynParam );
fn_vDynamicObject_ChangeParams( &stDynParam, C_ucNone, 0., 0., 0.);
WP_fnv_Link_SetDynamicParameter ( (WP_tdhLink)(poLink->GetEngineStruct()), &stDynParam );
}
//---- create the graphic object
poLink->fn_vConstructGraphic ();
poLink->fn_vSetWaypoints ( poFirstWP, poSecondWP );
return poLink;
}
Link* Link::fn_pCreateLink ( Way* poWay, WP_tdhLink hLink, WayPoint* poFirstWP, WayPoint* poSecondWP )
{
Link* poLink;
char cType;
cType = (char) WP_fneuc_Link_GetConnectionType (hLink);
poLink = fn_pCreateLink ( poWay, cType, poFirstWP, poSecondWP, hLink );
poLink->fn_vSetDrawOutHierarchy (TRUE);
poLink->fn_vInitEditorFromEngine ();
return poLink;
}
Link* Link::CloneLink ( Way* poWay, Link* poLink, CString& szNewLinkName )
{
char cNewType = WP_ConnType_ucInvalid;
POSITION xPos;
tdst_LinkObject* pst_LinkObject;
WayPoint *poFirstWP, *poSecondWP;
// search the type of the new link
for ( pst_LinkObject=ms_oListLinkObject.GetHeadElement (xPos); pst_LinkObject; pst_LinkObject=ms_oListLinkObject.GetNextElement (xPos) )
if (!strcmp (pst_LinkObject->szName, szNewLinkName)) cNewType = pst_LinkObject->cType;
if (cNewType == WP_ConnType_ucInvalid) return NULL;
// Set waypoints
poLink->fn_vGetWaypoints ( &poFirstWP, &poSecondWP );
// Set dynamic parameters
ACP_tdstDynaParam stDynParam; // dynamic param
WP_tde_ucConnectionDynamicType eConnectionType; // type
WP_fnv_Link_GetDynamicParameter ( (WP_tdhLink)(poLink->GetEngineStruct()), &stDynParam );
eConnectionType = WP_fneuc_Link_GetConnectionDynamicType ( (WP_tdhLink)(poLink->GetEngineStruct()) );
Link* poNewLink = fn_pCreateLink ( poWay, cNewType, poFirstWP, poSecondWP );
WP_fnv_Link_SetDynamicParameter ( (WP_tdhLink)(poNewLink->GetEngineStruct()), &stDynParam );
WP_fnv_Link_SetConnectionDynamicType ( (WP_tdhLink)(poNewLink->GetEngineStruct()), eConnectionType );
return poNewLink;
}
Link::Link( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, WP_tdhLink hLink ):
CPA_BaseObject ( p_oDLL, "Link" ),
CPA_EdMot<WP_tdhLink>(hLink)
{
m_poParent = (Way*)p_oOwner;
m_bAddInHierarchy=FALSE;
m_bRemoveInHierarchy=FALSE;
m_bDraw=FALSE;
m_bCanDrawOutHierarchy=FALSE;
m_bRotationMode=FALSE;
m_bFirstEdition=TRUE;
m_xOrientationTangentLenght=0.5f;
m_bXDirectOrientation=TRUE;
m_bYDirectOrientation=TRUE;
m_bZDirectOrientation=TRUE;
m_lNbLapXOrientation=0L;
m_lNbLapYOrientation=0L;
m_lNbLapZOrientation=0L;
m_xFirstTwistOrientation=0.;
m_xSecondTwistOrientation=0.;
// name
CString csName;
csName.Format ("Link%d", ms_lNbLink);
ms_lNbLink++;
fn_eRename (csName);
//--- init dyn params
WP_fnv_Link_SetConnectionDynamicType ( GetStruct(), WP_ConDynType_ucNone );
//--- orientation tangent
GEO_tdstColor stColor;
stColor.xR = 0.f;
stColor.xG = 0.f;
stColor.xB = 0.8f;
m_poFirstOrientationTangent = new Tangent ( p_oDLL, this, eFixLenghtTangent, eVariableOrientationTangent, eControlDownChangeNeighbour, eShiftDownChangeAll, &stColor );
stColor.xR = 0.8f;
stColor.xG = 0.8f;
stColor.xB = 0.f;
m_poSecondOrientationTangent = new Tangent ( p_oDLL, this, eFixLenghtTangent, eVariableOrientationTangent,eControlDownChangeNeighbour, eShiftDownChangeAll, &stColor );
}
Link::Link( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner ):
CPA_BaseObject ( p_oDLL, "Link" ),
CPA_EdMot<WP_tdhLink>()
{
WP_fnv_Link_SetConnectionType ( (WP_tdhLink)GetStruct(), WP_ConnType_ucInvalid);
m_poParent = (Way*)p_oOwner;
m_bAddInHierarchy=FALSE;
m_bRemoveInHierarchy=FALSE;
m_bDraw=FALSE;
m_bCanDrawOutHierarchy=FALSE;
m_bRotationMode=FALSE;
m_bFirstEdition=TRUE;
m_xOrientationTangentLenght=0.5f;
m_bXDirectOrientation=TRUE;
m_bYDirectOrientation=TRUE;
m_bZDirectOrientation=TRUE;
m_lNbLapXOrientation=0L;
m_lNbLapYOrientation=0L;
m_lNbLapZOrientation=0L;
m_xFirstTwistOrientation=0.;
m_xSecondTwistOrientation=0.;
// name
CString csName;
csName.Format ("Link%d", ms_lNbLink);
ms_lNbLink++;
fn_eRename (csName);
//--- init dyn params
WP_fnv_Link_SetConnectionDynamicType ( GetStruct(), WP_ConDynType_ucNone );
fn_vWayNotifySave ();
//--- orientation tangent
GEO_tdstColor stColor;
stColor.xR = 0.f;
stColor.xG = 0.f;
stColor.xB = 0.8f;
m_poFirstOrientationTangent = new Tangent ( p_oDLL, this, eFixLenghtTangent, eVariableOrientationTangent, eControlDownChangeNeighbour, eShiftDownChangeAll, &stColor );
stColor.xR = 0.8f;
stColor.xG = 0.8f;
stColor.xB = 0.f;
m_poSecondOrientationTangent = new Tangent ( p_oDLL, this, eFixLenghtTangent, eVariableOrientationTangent,eControlDownChangeNeighbour, eShiftDownChangeAll, &stColor );
}
//-------------------------------------------------------------------
// Data
//-------------------------------------------------------------------
long Link::GetDataType (void)
{
return C_ucLink;
}
void* Link::GetData (void)
{
return GetStruct();
}
SCRIPT_tdeReturnValue Link::CallBackLoad (FILE *p_fFile, char *szAction, char *szParams[], SCRIPT_tdeAction cType)
{
return R_SCRIPT_NormalReturn;
}
void Link::fn_vSplitLink ( Way* poWay, WayPoint* poWP, Link** pLinkBefore, Link** pLinkAfter )
{
// create and set the extrems WP
*pLinkBefore = (Link*)(poWay->fn_pCreateLink(WP_ConnType_ucStaticLine)->GetObject());
*pLinkAfter = (Link*)(poWay->fn_pCreateLink(WP_ConnType_ucStaticLine)->GetObject());
(*pLinkBefore)->fn_vSetWaypoints ( m_poFirstWP, poWP );
(*pLinkAfter)->fn_vSetWaypoints ( poWP, m_poSecondWP );
}
Link* Link::fn_pMergeLink ( Way* poWay, Link* pLink )
{
if (!pLink) return NULL;
Link* pMergeLink = (Link*)(poWay->fn_pCreateLink(WP_ConnType_ucStaticLine)->GetObject());
// set the extrems WP
WayPoint *oFirstWP, *oSecondWP, *oBufferWP;
fn_vGetWaypoints ( &oFirstWP, &oBufferWP );
pLink->fn_vGetWaypoints ( &oBufferWP, &oSecondWP );
pMergeLink->fn_vSetWaypoints ( oFirstWP, oSecondWP );
return pMergeLink;
}
//-------- Set
void Link::fn_vSetType ( WP_tde_ucConnectionType cType )
{
WP_fnv_Link_SetConnectionType ( ((WP_tdhLink)GetEngineStruct()), cType );
}
//-------- Get
char Link::fn_cGetType ( void )
{
return WP_fneuc_Link_GetConnectionType ( ((WP_tdhLink)GetEngineStruct()) );
}
void Link::fn_vSave ( SCR_tdst_File_Description *_p_stFile )
{
ACP_tdstDynaParam stDynParam;
unsigned char ucDynamicType;
float fSpeed1, fSpeed2, fSpeed3;
long lNbParam=0;
char* dszParam [20];
char a20_20_szParam [20][20];
fn_vGetSaveInfo ( a20_20_szParam, lNbParam );
// dynamic conection type
switch ( WP_fneuc_Link_GetConnectionDynamicType (GetStruct()) )
{
case WP_ConDynType_ucNone : strcpy ( a20_20_szParam[1], "None"); break;
case WP_ConDynType_ucConstant : strcpy ( a20_20_szParam[1], "Constant"); break;
case WP_ConDynType_ucLinear : strcpy ( a20_20_szParam[1], "Linear"); break;
case WP_ConDynType_ucSinus : strcpy ( a20_20_szParam[1], "Sinus"); break;
default : dszParam[1][0]=0; break;
}
// dynamic param
WP_tdhLink hLink = (WP_tdhLink)GetEngineStruct();
WP_fnv_Link_GetDynamicParameter(hLink,&stDynParam);
fn_vDynamicObject_GetParams( &stDynParam, &ucDynamicType, &fSpeed1, &fSpeed2, &fSpeed3);
switch ( ucDynamicType )
{
case C_ucConst :
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed1 );
break;
case C_ucLinear :
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed1 );
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed2 );
break;
case C_ucSinus :
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed1 );
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed2 );
sprintf ( a20_20_szParam[lNbParam++], "%g", fSpeed3 );
break;
}
// save rotation parameters
MTH3D_tdstVector stFirstOrientationVector, stSecondOrientationVector;
fn_vDynamicObject_GetRotation( &stDynParam, &stFirstOrientationVector, &stSecondOrientationVector );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetXofVector(&stFirstOrientationVector) );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetYofVector(&stFirstOrientationVector) );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetZofVector(&stFirstOrientationVector) );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetXofVector(&stSecondOrientationVector) );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetYofVector(&stSecondOrientationVector) );
sprintf ( a20_20_szParam[lNbParam++], "%g", MTH3D_M_xGetZofVector(&stSecondOrientationVector) );
// write entry
for ( long lCounter = 0; lCounter<20; lCounter++ ) dszParam[lCounter]=a20_20_szParam[lCounter];
SCR_M_SvL0_SaveEntry( _p_stFile, "Link", SCR_CC_C_Cfg_NoChar );
SCR_fn_v_SvL0_SaveParameters_AP( _p_stFile, SCR_EF_SvL0_Normal, lNbParam, dszParam);
}
Waypoint_Interface* Link::GetInterface (void)
{
return ms_poInterface;
}
void Link::fn_vWayNotifySave (void)
{
m_poParent->fn_vNotifySave ();
}
void Link::fn_vEdit (void)
{
int iPos = m_poParent->fn_iIsWayPointInNet (m_poFirstWP,m_poSecondWP);
GetInterface()->fn_vEdit ( m_poParent, iPos>0 ? iPos : 0 );
}
void Link::fn_vSelectWay (void)
{
GetInterface()->GetInterface()->fn_vAddSelectedObject ( m_poParent->GetSuperObject(), FALSE);
m_poParent->fn_vSelectAllWP ();
}
void Link::fn_vConstructGraphic (void)
{
m_poFirstOrientationTangent->GetSuperObject()->SetSuperObjectOwner (GetSuperObject());
m_poSecondOrientationTangent->GetSuperObject()->SetSuperObjectOwner (GetSuperObject());
}
void Link::fn_vInitGraphic (void)
{
if (!m_bFirstEdition) return;
m_bFirstEdition = FALSE;
fn_vComputeAxis ();
MTH3D_tdstVector stFirstFixVertex, stSecondFixVertex;
MTH3D_tdstVector stFirstMoveVertex, stSecondMoveVertex;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstFixVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondFixVertex );
// init orientation parameters
MTH3D_tdstVector u;
ACP_tdstDynaParam stDynaParam;
MTH3D_tdstVector stFirstEngineOrientationVector, stSecondEngineOrientationVector;
MTH3D_tdstVector stFirstEditorOrientationVector, stSecondEditorOrientationVector;
MTH_tdxReal stFirstXRot, stFirstYRot, stFirstZRot;
MTH_tdxReal stSecondXRot, stSecondYRot, stSecondZRot;
stFirstXRot = MTH_C_ZERO;
stFirstYRot = MTH_C_ZERO;
stFirstZRot = MTH_C_ZERO;
stSecondXRot = MTH_C_ZERO;
stSecondYRot = MTH_C_ZERO;
stSecondZRot = MTH_C_ZERO;
WP_tdhLink hLink = (WP_tdhLink)GetEngineStruct();
WP_fnv_Link_GetDynamicParameter (hLink,&stDynaParam);
fn_vDynamicObject_GetRotation( &stDynaParam, &stFirstEngineOrientationVector, &stSecondEngineOrientationVector );
u =stSecondFixVertex;
MTH3D_M_vSubVector( &u, &u, &stFirstFixVertex );
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vMulScalarVector(&u,m_xOrientationTangentLenght,&u);
stFirstMoveVertex = stFirstFixVertex;
stSecondMoveVertex = stSecondFixVertex;
if (MTH3D_M_xNormVector(&stFirstEngineOrientationVector)>=1e-10)
{
MTH3D_M_vGetVectorElements ( &stFirstXRot, &stFirstYRot, &stFirstZRot, &stFirstEngineOrientationVector );
fn_vRotation2Vertex ( &stFirstEditorOrientationVector, &m_xFirstTwistOrientation, &stFirstXRot, &stFirstYRot, &stFirstZRot );
MTH3D_M_vNormalizeVector(&stFirstEditorOrientationVector,&stFirstEditorOrientationVector);
MTH3D_M_vMulScalarVector(&stFirstEditorOrientationVector,m_xOrientationTangentLenght,&stFirstEditorOrientationVector);
}
else stFirstEditorOrientationVector = u;
MTH3D_M_vAddVector(&stFirstMoveVertex,&stFirstMoveVertex,&stFirstEditorOrientationVector);
if (MTH3D_M_xNormVector(&stSecondEngineOrientationVector)>=1e-10)
{
MTH3D_M_vGetVectorElements ( &stSecondXRot, &stSecondYRot, &stSecondZRot, &stSecondEngineOrientationVector );
fn_vRotation2Vertex ( &stSecondEditorOrientationVector, &m_xSecondTwistOrientation, &stSecondXRot, &stSecondYRot, &stSecondZRot );
MTH3D_M_vNormalizeVector(&stSecondEditorOrientationVector,&stSecondEditorOrientationVector);
MTH3D_M_vMulScalarVector(&stSecondEditorOrientationVector,m_xOrientationTangentLenght,&stSecondEditorOrientationVector);
}
else stSecondEditorOrientationVector = u;
MTH3D_M_vAddVector(&stSecondMoveVertex,&stSecondMoveVertex,&stSecondEditorOrientationVector);
fn_vExtractModulusRotation ( &m_bXDirectOrientation, &m_lNbLapXOrientation, stFirstXRot, stSecondXRot );
fn_vExtractModulusRotation ( &m_bYDirectOrientation, &m_lNbLapYOrientation, stFirstYRot, stSecondYRot );
fn_vExtractModulusRotation ( &m_bZDirectOrientation, &m_lNbLapZOrientation, stFirstZRot, stSecondZRot );
// matrix compute
Link::fn_vRotationGraphic (TRUE);
m_poFirstOrientationTangent->fn_vSetAbsoluteVertex ( &stFirstFixVertex, &stFirstMoveVertex );
m_poSecondOrientationTangent->fn_vSetAbsoluteVertex ( &stSecondFixVertex, &stSecondMoveVertex );
Link::fn_vRotationGraphic (FALSE);
}
void Link::fn_vRotationGraphic (BOOL bRotation)
{
if (m_bRotationMode==bRotation) return;
m_bRotationMode=bRotation;
if (bRotation)
{
// hierarchy
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_poFirstOrientationTangent->GetSuperObject(), GetSuperObject(),FALSE,FALSE,FALSE);
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_poSecondOrientationTangent->GetSuperObject(), GetSuperObject(),FALSE,FALSE,FALSE);
// dialog
if (ms_poDiaLink->fn_bIsEditLink(this)) ms_poDiaLink->fn_vEdit (NULL);
}
else
{
// hierarchy
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poFirstOrientationTangent->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poSecondOrientationTangent->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
// dialog
if (ms_poRotationDia->fn_bIsEditLink(this)) ms_poRotationDia->fn_vEdit (NULL);
}
}
void Link::fn_vDraw (void)
{
if (m_bRotationMode)
{
fn_vComputeAxis();
m_poFirstOrientationTangent->fn_vDraw ();
m_poSecondOrientationTangent->fn_vDraw ();
fn_vDrawRotation ();
fn_vRefreshEngineOrientation();
}
else
{
fn_vComputeAxis();
fn_vDrawNormal ();
}
}
void Link::fn_vComputeAxis (void)
{
MTH3D_tdstVector stFirstVertex, stSecondVertex;
MTH3D_tdstVector stVectorU, stVectorV, stVectorN;
MTH3D_tdstVector n, u, v;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondVertex );
n = stSecondVertex;
MTH3D_M_vSubVector(&n,&n,&stFirstVertex);
GLI_tdxValue lenght = MTH3D_M_xNormVector( &n );
MTH3D_M_vNormalizeVector(&n,&n);
if (n.xX||n.xY) { MTH3D_M_vSetVectorElements ((&u),(-n.xY),(n.xX),0.); }
else { MTH3D_M_vSetVectorElements((&u),0.,(-n.xZ),n.xY); }
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vCrossProductVector((&v),(&n),(&u));
MTH3D_M_vNormalizeVector(&v,&v);
// change the local matrix
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsoluteLineMatrix );
POS_fn_vSetTranslationVector( hAbsoluteLineMatrix, &stFirstVertex );
POS_fn_vSetRotationMatrix( hAbsoluteLineMatrix , &n, &u, &v );
POS_fn_vGetScaleMatrix( hAbsoluteLineMatrix, &stVectorN, &stVectorU, &stVectorV );
MTH3D_M_vMulScalarVector( &stVectorN, lenght, &stVectorN);
POS_fn_vSetScaleMatrix( hAbsoluteLineMatrix, &stVectorN, &stVectorU, &stVectorV );
POS_fn_vNormalizeMatrix( hAbsoluteLineMatrix ) ;
GetInterface()->fn_vComputeNewRelativeMatrix (GetSuperObject()->GetStruct());
}
void Link::fn_vSetXDirectOrientation ( BOOL bXDirectOrientation )
{
m_bXDirectOrientation = bXDirectOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetYDirectOrientation ( BOOL bYDirectOrientation )
{
m_bYDirectOrientation = bYDirectOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetZDirectOrientation ( BOOL bZDirectOrientation )
{
m_bZDirectOrientation = bZDirectOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetNbLapXOrientation ( long lNbLapXOrientation )
{
m_lNbLapXOrientation = lNbLapXOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetNbLapYOrientation ( long lNbLapYOrientation )
{
m_lNbLapYOrientation = lNbLapYOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetNbLapZOrientation ( long lNbLapZOrientation )
{
m_lNbLapZOrientation = lNbLapZOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetFirstTwistOrientation ( MTH_tdxReal xFirstTwistOrientation )
{
m_xFirstTwistOrientation = xFirstTwistOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vSetSecondTwistOrientation ( MTH_tdxReal xSecondTwistOrientation )
{
m_xSecondTwistOrientation = xSecondTwistOrientation;
fn_vRefreshEngineOrientation ();
}
void Link::fn_vRefreshEngineOrientation (void)
{
ACP_tdstDynaParam stDynaParam;
MTH3D_tdstVector stFirstEngineOrientationVector, stSecondEngineOrientationVector;
MTH3D_tdstVector stFirstAbsoluteOrientationVector, stSecondAbsoluteOrientationVector;
WP_tdhLink hLink = (WP_tdhLink)GetEngineStruct();
m_poFirstOrientationTangent->fn_pGetAbsoluteTangent (&stFirstAbsoluteOrientationVector);
m_poSecondOrientationTangent->fn_pGetAbsoluteTangent (&stSecondAbsoluteOrientationVector);
MTH_tdxReal xXStartRot, xYStartRot, xZStartRot;
MTH_tdxReal xXEndRot, xYEndRot, xZEndRot;
fn_vVertex2Rotation ( &xXStartRot, &xYStartRot, &xZStartRot, &stFirstAbsoluteOrientationVector, &m_xFirstTwistOrientation );
fn_vVertex2Rotation ( &xXEndRot, &xYEndRot, &xZEndRot, &stSecondAbsoluteOrientationVector, &m_xSecondTwistOrientation );
fn_vComputeModulusRotation ( &xXStartRot, &xXEndRot, m_bXDirectOrientation, m_lNbLapXOrientation );
fn_vComputeModulusRotation ( &xYStartRot, &xYEndRot, m_bYDirectOrientation, m_lNbLapYOrientation );
fn_vComputeModulusRotation ( &xZStartRot, &xZEndRot, m_bZDirectOrientation, m_lNbLapZOrientation );
MTH3D_M_vSetVectorElements ( &stFirstEngineOrientationVector, xXStartRot, xYStartRot, xZStartRot );
MTH3D_M_vSetVectorElements ( &stSecondEngineOrientationVector, xXEndRot, xYEndRot, xZEndRot );
WP_fnv_Link_GetDynamicParameter (hLink,&stDynaParam);
fn_vDynamicObject_SetRotation( &stDynaParam, &stFirstEngineOrientationVector, &stSecondEngineOrientationVector );
WP_fnv_Link_SetDynamicParameter (hLink,&stDynaParam);
fn_vWayNotifySave();
}
void Link::fn_vChangeNeighbourTangent (Tangent* pTangent)
{
Link* pChangeLink;
if (m_poFirstOrientationTangent==pTangent)
{
pChangeLink = m_poParent->fn_pPrevLink (this);
if (pChangeLink)
{
MTH3D_tdstVector stTangent;
pTangent->fn_pGetAbsoluteTangent(&stTangent);
pChangeLink->fn_vSetOrientationTangent ( 2, &stTangent );
pChangeLink->fn_vDraw ();
}
}
else
{
pChangeLink = m_poParent->fn_pNextLink (this);
if (pChangeLink)
{
MTH3D_tdstVector stTangent;
pTangent->fn_pGetAbsoluteTangent(&stTangent);
pChangeLink->fn_vSetOrientationTangent ( 1, &stTangent );
pChangeLink->fn_vDraw ();
}
}
}
void Link::fn_vReinitOrientationTangent (Tangent* poTangent)
{
MTH3D_tdstVector stFirstFixVertex, stSecondFixVertex;
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poFirstWP->GetEngineStruct()), &stFirstFixVertex );
WP_fnv_WayPoint_ComputeLocation ( (WP_tdhWayPoint)(m_poSecondWP->GetEngineStruct()), &stSecondFixVertex );
MTH3D_tdstVector u;
u =stSecondFixVertex;
MTH3D_M_vSubVector( &u, &u, &stFirstFixVertex );
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vMulScalarVector(&u,m_xOrientationTangentLenght,&u);
poTangent->fn_vSetTangentDirection (&u);
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Link::fn_vChangeAllTangent (Tangent* pTangent)
{
// on pourrait blinder en s'assurant que la tangente re<72>ue est bien une tangente d'orientation
MTH3D_tdstVector stTangent;
pTangent->fn_pGetAbsoluteTangent(&stTangent);
m_poParent->fn_vChangeAllOrientationTangent (&stTangent);
}
void Link::fn_vSetOrientationTangent ( int iSide, MTH3D_tdstVector* pTangentVertex )
{
switch (iSide)
{
case 1 : m_poFirstOrientationTangent->fn_vSetTangentDirection (pTangentVertex); break;
case 2 : m_poSecondOrientationTangent->fn_vSetTangentDirection (pTangentVertex); break;
}
}
void Link::fn_vSetAllOrientationTangent (MTH3D_tdstVector* pTangentVertex)
{
m_poFirstOrientationTangent->fn_vSetTangentDirection (pTangentVertex);
m_poSecondOrientationTangent->fn_vSetTangentDirection (pTangentVertex);
fn_vRefreshEngineOrientation ();
}
void Link::fn_vVertex2Rotation (MTH_tdxReal* pxXRot, MTH_tdxReal* pxYRot, MTH_tdxReal* pxZRot, MTH3D_tdstVector* pstVector, MTH_tdxReal* pxRot )
{
MTH3D_tdstVector stU, stV, stW;
MTH3D_tdstVector stu, stw;
MTH_tdxReal xSin, xCos;
MTH3D_tdstMatrix stMatrix;
MTH3D_tdstVector stOx, stOz;
MTH3D_M_vSetVectorElements( &stOx, 1.f, 0.f, 0.f);
MTH3D_M_vSetVectorElements( &stOz, 0.f, 0.f, 1.f);
stV = *pstVector;
MTH3D_M_vNormalizeVector (&stV, &stV);
if ( fn_bIsRealNul(MTH3D_M_xGetXofVector(&stV)) && fn_bIsRealNul(MTH3D_M_xGetYofVector(&stV)) )
{
MTH3D_M_vCrossProductVector ( &stu, &stOx, &stV );
}
else
{
MTH3D_M_vCrossProductVector ( &stu, &stV, &stOz );
}
MTH3D_M_vNormalizeVector (&stu, &stu);
MTH3D_M_vCrossProductVector (&stw, &stu, &stV);
MTH_tdxReal sinRot = MTH_M_xSin ( *pxRot );
MTH_tdxReal cosRot = MTH_M_xCos ( *pxRot );
MTH3D_M_vMulScalarVector ( &stw, cosRot, &stw );
MTH3D_M_vMulScalarVector ( &stu, sinRot, &stu );
MTH3D_M_vAddVector ( &stW, &stw, &stu);
MTH3D_M_vCrossProductVector (&stU, &stV, &stW);
fn_vCorrectNulValue ( &stU );
fn_vCorrectNulValue ( &stV );
fn_vCorrectNulValue ( &stW );
// Ox rotation
*pxXRot = atan2 ( MTH3D_M_xGetZofVector(&stV), MTH3D_M_xGetYofVector(&stV) );
xSin = sin (*pxXRot);
xCos = cos (*pxXRot);
MTH3D_M_vSetMatrixLineXElements( &stMatrix, 1.f, 0.f, 0.f );
MTH3D_M_vSetMatrixLineYElements( &stMatrix, 0.f, xCos, xSin );
MTH3D_M_vSetMatrixLineZElements( &stMatrix, 0.f, -xSin, xCos )
MTH3D_M_vMulMatrixVector( &stU, &stMatrix, &stU);
MTH3D_M_vMulMatrixVector( &stV, &stMatrix, &stV);
MTH3D_M_vMulMatrixVector( &stW, &stMatrix, &stW);
// Oz rotation
*pxZRot = atan2 ( -MTH3D_M_xGetXofVector(&stV), MTH3D_M_xGetYofVector(&stV) );
xSin = MTH_M_xSin (*pxZRot);
xCos = MTH_M_xCos (*pxZRot);
MTH3D_M_vSetMatrixLineXElements( &stMatrix, xCos, xSin, 0.f );
MTH3D_M_vSetMatrixLineYElements( &stMatrix, -xSin, xCos, 0.f );
MTH3D_M_vSetMatrixLineZElements( &stMatrix, 0.f, 0.f, 1.f )
MTH3D_M_vMulMatrixVector( &stU, &stMatrix, &stU);
MTH3D_M_vMulMatrixVector( &stV, &stMatrix, &stV);
MTH3D_M_vMulMatrixVector( &stW, &stMatrix, &stW);
fn_vCorrectNulValue ( &stU );
fn_vCorrectNulValue ( &stV );
fn_vCorrectNulValue ( &stW );
// Oy rotation
if ( !fn_bIsRealNul(MTH3D_M_xGetZofVector(&stU)) || !fn_bIsRealNul(MTH3D_M_xGetXofVector(&stU)) )
*pxYRot = atan2 ( -MTH3D_M_xGetZofVector(&stU), MTH3D_M_xGetXofVector(&stU) );
else
*pxYRot = atan2 ( MTH3D_M_xGetXofVector(&stW), MTH3D_M_xGetZofVector(&stW) );
xSin = MTH_M_xSin (*pxYRot);
xCos = MTH_M_xCos (*pxYRot);
MTH3D_M_vSetMatrixLineXElements( &stMatrix, xCos, 0.f, -xSin );
MTH3D_M_vSetMatrixLineYElements( &stMatrix, 0.f, 1.f, 0.f );
MTH3D_M_vSetMatrixLineZElements( &stMatrix, xSin, 0.f, xCos )
MTH3D_M_vMulMatrixVector( &stU, &stMatrix, &stU);
MTH3D_M_vMulMatrixVector( &stV, &stMatrix, &stV);
MTH3D_M_vMulMatrixVector( &stW, &stMatrix, &stW);
}
void Link::fn_vRotation2Vertex ( MTH3D_tdstVector* pstVector, MTH_tdxReal* pxRot, MTH_tdxReal* pxXRot, MTH_tdxReal* pxYRot, MTH_tdxReal* pxZRot )
{
MTH3D_tdstVector stU, stV, stW;
MTH_tdxReal xSin, xCos;
MTH3D_M_vSetVectorElements( &stU, 1.f, 0.f, 0.f);
MTH3D_M_vSetVectorElements( &stV, 0.f, 1.f, 0.f);
MTH3D_M_vSetVectorElements( &stW, 0.f, 0.f, 1.f);
// Ox rotation
xSin = MTH_M_xSin (*pxXRot);
xCos = MTH_M_xCos (*pxXRot);
MTH3D_M_vMulScalarVector ( &stV, xCos, &stV );
MTH3D_M_vMulScalarVector ( &stW, xSin, &stW );
MTH3D_M_vAddVector ( &stV, &stV, &stW);
MTH3D_M_vCrossProductVector (&stW, &stU, &stV);
// Oz rotation
xSin = MTH_M_xSin (*pxZRot);
xCos = MTH_M_xCos (*pxZRot);
MTH3D_M_vMulScalarVector ( &stU, xCos, &stU );
MTH3D_M_vMulScalarVector ( &stV, xSin, &stV );
MTH3D_M_vAddVector ( &stU, &stU, &stV);
MTH3D_M_vCrossProductVector (&stV, &stW, &stU);
// Oy rotation
xSin = MTH_M_xSin (*pxYRot);
xCos = MTH_M_xCos (*pxYRot);
MTH3D_M_vMulScalarVector ( &stW, xCos, &stW );
MTH3D_M_vMulScalarVector ( &stU, xSin, &stU );
MTH3D_M_vAddVector ( &stW, &stW, &stU);
MTH3D_M_vCrossProductVector (&stU, &stV, &stW);
*pstVector = stV;
MTH3D_M_vMulScalarVector(pstVector,m_xOrientationTangentLenght,pstVector);
MTH3D_tdstMatrix stMatrix;
MTH3D_tdstVector stOz;
MTH3D_M_vSetColumnInMatrix ( &stMatrix, &stU, 0 );
MTH3D_M_vSetColumnInMatrix ( &stMatrix, &stV, 1 );
MTH3D_M_vSetColumnInMatrix ( &stMatrix, &stW, 2 );
MTH3D_M_vInverMatrix (&stMatrix, &stMatrix);
MTH3D_M_vGetColumnInMatrix ( &stOz, &stMatrix, 2 );
*pxRot = - atan2 ( MTH3D_M_xGetXofVector(&stOz), MTH3D_M_xGetZofVector(&stOz) );
}
void Link::fn_vCorrectNulValue ( MTH3D_tdstVector* pstVector )
{
if ( fn_bIsRealNul (MTH3D_M_xGetXofVector (pstVector)) ) MTH3D_M_vSetXofVector (pstVector,0.);
if ( fn_bIsRealNul (MTH3D_M_xGetYofVector (pstVector)) ) MTH3D_M_vSetYofVector (pstVector,0.);
if ( fn_bIsRealNul (MTH3D_M_xGetZofVector (pstVector)) ) MTH3D_M_vSetZofVector (pstVector,0.);
}
BOOL Link::fn_bIsRealNul ( MTH_tdxReal& rReal )
{
return ( fabs(rReal) < 1.e-5);
}
void Link::fn_vComputeModulusRotation ( MTH_tdxReal* xStartRot, MTH_tdxReal* xEndRot, BOOL bDirectOrientation, long lNbLapOrientation )
{
// direct orientation
if (bDirectOrientation && (*xStartRot-1e-5)>(*xEndRot)) (*xEndRot)+=MTH_C_2Pi;
else if (!bDirectOrientation && (*xStartRot)<(*xEndRot-1e-3)) (*xStartRot)+=MTH_C_2Pi;
// number of laps
long lSignedLap = bDirectOrientation ? lNbLapOrientation : -lNbLapOrientation;
(*xEndRot) += lSignedLap * MTH_C_2Pi;
}
void Link::fn_vExtractModulusRotation ( BOOL* bDirectOrientation, long* lNbLapOrientation, MTH_tdxReal& xStartRot, MTH_tdxReal& xEndRot )
{
*bDirectOrientation = (xEndRot>=xStartRot);
if (*bDirectOrientation)
{
*lNbLapOrientation = (long)((xEndRot-xStartRot+1e-3)/MTH_C_2Pi);
xEndRot -= (*lNbLapOrientation) * MTH_C_2Pi;
if (xEndRot+1e-3>=MTH_C_Pi) xEndRot -= MTH_C_2Pi;
}
else
{
*lNbLapOrientation = (long)((xStartRot-xEndRot+1e-3)/MTH_C_2Pi);
xEndRot += (*lNbLapOrientation) * MTH_C_2Pi;
if (xStartRot-1e-3<-MTH_C_Pi) xStartRot += MTH_C_2Pi;
}
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,128 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LkArcDia.cpp
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 30 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "LkArcDia.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "CurObj.hpp"
#include "Link2D.hpp"
#include "LinkArc.hpp"
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
#include "Inter.hpp"
#include "x:/cpa/main/inc/_EditId.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// BezierDia dialog
ArcDia::ArcDia (LinkArc* pLinkArc, CWnd* pParent)
: CDialog(ArcDia::IDD, pParent)
{
//{{AFX_DATA_INIT(BezierDia)
m_iSamplingRate = 0;
//}}AFX_DATA_INIT
m_pLinkArc = pLinkArc;
}
void ArcDia::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(BezierDia)
DDX_Text(pDX, IDC_ARC_EDIT, m_iSamplingRate);
DDV_MinMaxInt(pDX, m_iSamplingRate, 0, 500000);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ArcDia, CDialog)
//{{AFX_MSG_MAP(ArcDia)
ON_EN_KILLFOCUS(IDC_ARC_EDIT, OnKillfocusArcEdit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// BezierDia message handlers
void ArcDia::OnKillfocusArcEdit()
{
UpdateData (TRUE);
// change inthe dynamic param
WP_fnv_Link_SetCurrentSample ( (WP_tdhLink)(m_pLinkArc->GetEngineStruct()),m_iSamplingRate );
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// change in the arc structure
// EDWAY_fnb_CircleArcObject_ChangeSamplingRate ( m_pLinkArc->fn_hGetEditArcObject (), m_iSamplingRate );
(m_pLinkArc->fn_hGetEditArcObject())->ChangeSamplingRate (m_iSamplingRate );
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
m_pLinkArc->GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
BOOL ArcDia::OnInitDialog()
{
CDialog::OnInitDialog();
m_iSamplingRate = WP_fnuc_Link_GetCurrentSample ((WP_tdhLink)(m_pLinkArc->GetEngineStruct()));
UpdateData (FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL ArcDia::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (wParam==1)
{
OnKillfocusArcEdit();
return TRUE;
}
return CDialog::OnCommand(wParam, lParam);
}
void ArcDia::fn_vTutRegister (void)
{
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_ArcDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_ARC_EDIT,"OWP_ArcSamplingRateEdit",TUT_e_TextEdit);
}
void ArcDia::fn_vTutUnregister (void)
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_ARC_EDIT);
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,130 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LkBezDia.cpp
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : Link
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 30 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "LkBezDia.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "TanObj.hpp"
#include "CurObj.hpp"
#include "Link2D.hpp"
#include "LinkBez.hpp"
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
#include "Inter.hpp"
#include "x:/cpa/main/inc/_EditId.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// BezierDia dialog
BezierDia::BezierDia (LinkBez* pLinkBez, CWnd* pParent)
: CDialog(BezierDia::IDD, pParent)
{
//{{AFX_DATA_INIT(BezierDia)
m_iSamplingRate = 0;
//}}AFX_DATA_INIT
m_pLinkBez = pLinkBez;
}
void BezierDia::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(BezierDia)
DDX_Text(pDX, IDC_BEZIER_EDIT, m_iSamplingRate);
DDV_MinMaxInt(pDX, m_iSamplingRate, 0, 500000);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(BezierDia, CDialog)
//{{AFX_MSG_MAP(BezierDia)
ON_EN_KILLFOCUS(IDC_BEZIER_EDIT, OnKillfocusBezierEdit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// BezierDia message handlers
void BezierDia::OnKillfocusBezierEdit()
{
UpdateData (TRUE);
// change in the dynamic param
WP_fnv_Link_SetCurrentSample ( (WP_tdhLink)(m_pLinkBez->GetEngineStruct()),m_iSamplingRate );
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// change in the bezier structure
// EDWAY_fnb_BezierObject_ChangeSamplingRate(m_pLinkBez->fn_hGetEditBezierObject(),m_iSamplingRate);
(m_pLinkBez->fn_hGetEditBezierObject())->ChangeSamplingRate(m_iSamplingRate);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
m_pLinkBez->GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
BOOL BezierDia::OnInitDialog()
{
CDialog::OnInitDialog();
m_iSamplingRate = WP_fnuc_Link_GetCurrentSample ((WP_tdhLink)(m_pLinkBez->GetEngineStruct()));
UpdateData (FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL BezierDia::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (wParam==1)
{
OnKillfocusBezierEdit();
return TRUE;
}
return CDialog::OnCommand(wParam, lParam);
}
void BezierDia::fn_vTutRegister (void)
{
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_ArcDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_BEZIER_EDIT,"OWP_BezierSamplingRateEdit",TUT_e_TextEdit);
}
void BezierDia::fn_vTutUnregister (void)
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_BEZIER_EDIT);
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,552 @@
//ROMTEAM Networks (Gabriela Dumitrascu 15/03/98)
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : NtwMod.hpp
//
// Modification classes
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 98-03-15 Author: CPA2 Gabriela Dumitrascu
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incdpt.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 "Inter.hpp"
#include "NtwMod.hpp"
#include "NtwDia.hpp"
#include "x:\cpa\main\inc\_editid.h"
ModifGraph::ModifGraph(Graph *poGraph, unsigned short type) : CPA_Modif (type,"",FALSE)
{
m_poGraph = poGraph;
m_hOldGraph = WPG_fn_hCreate("", "");
WPG_fn_vCopy(m_hOldGraph, m_poGraph->GetEngineStruct());
m_hNewGraph = NULL;
switch (type)
{
case GRAPH_INSERT_GRAPH:
SetName("Insert graph");
break;
case GRAPH_DELETE_GRAPH:
SetName("Delete graph");
break;
case GRAPH_INSERT_NODE:
SetName("Insert node");
break;
case GRAPH_DELETE_NODE:
SetName("Delete node");
break;
case GRAPH_INSERT_ARC:
SetName("Insert arc");
break;
case GRAPH_DELETE_ARC:
SetName("Delete arc");
break;
}
}
void ModifGraph::ModifSave()
{
m_hNewGraph = WPG_fn_hCreate("", "");
WPG_fn_vCopy(m_hNewGraph, m_poGraph->GetEngineStruct());
}
BOOL ModifGraph::Do (void)
{
WPG_fn_vCopy(m_poGraph->GetEngineStruct(), m_hNewGraph);
m_poGraph->fn_vNotifySave();
m_poGraph->fn_pGetDialog()->fn_vRefreshDialog();
return TRUE;
}
BOOL ModifGraph::Undo (void)
{
WPG_fn_vCopy(m_poGraph->GetEngineStruct(), m_hOldGraph);
m_poGraph->fn_vNotifySave();
m_poGraph->fn_pGetDialog()->fn_vRefreshDialog();
return TRUE;
}
//ENDROMTEAM Networks (Gabriela Dumitrascu)
// Shaitan Correction {
/*===========================================================================
Delete Graph
===========================================================================*/
DeleteGraph::DeleteGraph (Graph *pGraph)
: CPA_Modif (GRAPH_DELETE_GRAPH, "Delete Graph", FALSE)
{
// register parameters
m_pGraph = pGraph;
// init flag
m_bDeleted = FALSE;
m_bFirstTime = TRUE;
}
DeleteGraph::~DeleteGraph (void)
{
}
BOOL DeleteGraph::Do (void)
{
// update editor
POSITION DeletePos = Graph::ms_oListOfGraph.Find(m_pGraph);
Graph::ms_oListOfGraph.RemoveAt(DeletePos);
// update engine
SCR_tdst_Link_Value *pValue = SCR_fnp_st_Link_SearchValue(WPG_fnp_Graph_GetLinkTable(), (unsigned long) m_pGraph->GetEngineStruct());
if (pValue)
{
SCR_fn_v_Link_DeleteEntry(WPG_fnp_Graph_GetLinkTable(), pValue);
}
// update flag
m_pGraph->fn_vNotifyUnSave();
m_bDeleted = TRUE;
// update interface
Graph::fn_pGetDialog()->fn_vRefreshGraphList(NULL);
Graph::GetInterface()->fn_vSelectGraph(NULL);
m_bFirstTime = FALSE;
return TRUE;
}
BOOL DeleteGraph::Undo (void)
{
// update editor
Graph::ms_oListOfGraph.AddTail(m_pGraph);
// update engine
SCR_tdst_Link_Value *pValue = SCR_fnp_st_Link_SearchValue(WPG_fnp_Graph_GetLinkTable(), (unsigned long) m_pGraph->GetEngineStruct());
if (!pValue)
{
WPG_fn_vAddGlobalGraph(m_pGraph->GetEngineStruct());
}
// update flag
m_pGraph->fn_vNotifyRestore();
m_bDeleted = FALSE;
// update interface
Graph::fn_pGetDialog()->fn_vRefreshGraphList(NULL);
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
return TRUE;
}
/*===========================================================================
Delete Graph
===========================================================================*/
RenameGraph::RenameGraph (Graph *pGraph, CString csNewName)
: CPA_Modif (GRAPH_RENAME_GRAPH, "Rename Graph", FALSE)
{
// register parameters
m_pGraph = pGraph;
m_csOldName = pGraph->GetName();
m_csNewName = csNewName,
// init flag
m_bFirstTime = TRUE;
}
RenameGraph::~RenameGraph (void)
{
}
BOOL RenameGraph::Do (void)
{
// update editor
m_pGraph->fn_eRename(m_csNewName);
m_csNewName = m_pGraph->GetName();
// update engine structure
WPG_fn_vSetNameOfGraph(m_pGraph->GetEngineStruct(), m_pGraph->GetName());
// update link table
SCR_tdst_Link_Value *pValue = SCR_fnp_st_Link_SearchValue(WPG_fnp_Graph_GetLinkTable(), (unsigned long) m_pGraph->GetEngineStruct());
if (pValue)
{
SCR_fn_v_Link_DeleteEntry(WPG_fnp_Graph_GetLinkTable(), pValue);
WPG_fn_vAddGlobalGraph(m_pGraph->GetEngineStruct());
}
// update interface
if (!m_bFirstTime)
{
Graph::fn_pGetDialog()->fn_vRefreshGraphList(m_pGraph);
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
}
m_bFirstTime = FALSE;
return TRUE;
}
BOOL RenameGraph::Undo (void)
{
// update editor
BOOL bIsLoadingWorld = Graph::GetInterface()->GetInterface()->fn_bIsLoadingWorld();
Graph::GetInterface()->GetInterface()->SetLoadingWorld(TRUE);
m_pGraph->fn_eRename(m_csOldName);
Graph::GetInterface()->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
// update engine structure
WPG_fn_vSetNameOfGraph(m_pGraph->GetEngineStruct(), m_pGraph->GetName());
// update link table
SCR_tdst_Link_Value *pValue = SCR_fnp_st_Link_SearchValue(WPG_fnp_Graph_GetLinkTable(), (unsigned long) m_pGraph->GetEngineStruct());
if (pValue)
{
SCR_fn_v_Link_DeleteEntry(WPG_fnp_Graph_GetLinkTable(), pValue);
WPG_fn_vAddGlobalGraph(m_pGraph->GetEngineStruct());
}
// update interface
Graph::fn_pGetDialog()->fn_vRefreshGraphList(m_pGraph);
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
return TRUE;
}
/*===========================================================================
Insert Node
===========================================================================*/
InsertNode::InsertNode (Graph *pGraph, WayPoint *pNode, BOOL pBlock)
: CPA_Modif (GRAPH_INSERT_NODE, "Insert Node", pBlock)
{
// register parameters
m_pGraph = pGraph;
m_pNode = pNode;
// init flag
m_bInserted = FALSE;
m_bFirstTime = TRUE;
}
InsertNode::~InsertNode (void)
{
}
BOOL InsertNode::Do (void)
{
// update engine
WPG_fn_lAddWayPointIfNotExists(m_pGraph->GetEngineStruct(), m_pNode->GetStruct(), 0L); //BART
// update flag
m_pGraph->fn_vNotifySave();
m_bInserted = TRUE;
// update interface
if (!m_bFirstTime)
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pNode);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshNodeList(m_pGraph, m_pNode);
m_bFirstTime = FALSE;
return TRUE;
}
BOOL InsertNode::Undo (void)
{
// update engine
WPG_fn_lRemoveWayPoint(m_pGraph->GetEngineStruct(), m_pNode->GetStruct());
// update flag
m_pGraph->fn_vNotifySave();
m_bInserted = FALSE;
// update interface
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(NULL);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshNodeList(m_pGraph, NULL);
return TRUE;
}
/*===========================================================================
Delete Node
===========================================================================*/
DeleteNode::DeleteNode (Graph *pGraph, WayPoint *pNode, BOOL pBlock)
: CPA_Modif (GRAPH_DELETE_NODE, "Delete Node", pBlock)
{
// register parameters
m_pGraph = pGraph;
m_pNode = pNode;
// register connections
m_pGraph->GetConnectionsToWaypoint(pNode, 0, &m_lstConnections);
// init flag
m_bDeleted = FALSE;
m_bFirstTime = TRUE;
}
DeleteNode::~DeleteNode (void)
{
if (m_bDeleted)
{
while (m_lstConnections.GetCount() > 0)
delete(m_lstConnections.RemoveTail());
}
}
BOOL DeleteNode::Do (void)
{
CPA_SuperObject *pConnection;
WP_tdhGraphNode hNode, hNextNode;
WP_tdhWayPoint hWayPoint;
POSITION pos;
int iNode;
// update engine
hWayPoint = m_pNode->GetStruct();
LST2_M_DynamicForEachMovingElementOf(&m_pGraph->GetEngineStruct()->m_hListOfNode, hNode, hNextNode, iNode)
{
WPG_fn_lRemoveArcFromWayPoint(m_pGraph->GetEngineStruct(), hNode->m_hWayPoint, hWayPoint);
}
WPG_fn_lRemoveWayPoint(m_pGraph->GetEngineStruct(), hWayPoint);
// update editor connections
for (pConnection = m_lstConnections.GetHeadElement(pos); pConnection;
pConnection = m_lstConnections.GetNextElement(pos))
m_pGraph->fn_vRemoveGraphicConnection(pConnection);
// update flag
m_pGraph->fn_vNotifySave();
m_bDeleted = TRUE;
// update interface
m_pNode->GetRealGraphic()->SetLocalColor(E_lc_NoColor);
m_pNode->GetSymbolicalGraphic()->SetLocalColor(E_lc_NoColor);
if (!m_bFirstTime)
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(NULL);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshNodeList(m_pGraph, NULL);
m_bFirstTime = FALSE;
return TRUE;
}
BOOL DeleteNode::Undo (void)
{
CPA_SuperObject *pConnection;
WP_tdhGraphNode hSrcNode, hDstNode;
Connection *pLinkObject;
POSITION pos;
int iSrcNode, iDstNode;
// update engine
WPG_fn_lAddWayPointIfNotExists(m_pGraph->GetEngineStruct(), m_pNode->GetStruct(), 0L); //BART
for (pConnection = m_lstConnections.GetHeadElement(pos); pConnection;
pConnection = m_lstConnections.GetNextElement(pos))
{
pLinkObject = (Connection *) pConnection->GetObject();
iSrcNode = m_pGraph->fn_iGetNodeOfWayPoint(pLinkObject->GetSrcWayPoint()->GetStruct());
hSrcNode = m_pGraph->fn_hGetNode(iSrcNode);
iDstNode = m_pGraph->fn_iGetNodeOfWayPoint(pLinkObject->GetDstWayPoint()->GetStruct());
hDstNode = m_pGraph->fn_hGetNode(iDstNode);
WPG_fn_vAddArc(hSrcNode, hDstNode, pLinkObject->GetWeight(), pLinkObject->GetCapacity());
}
// update editor
for (pConnection = m_lstConnections.GetHeadElement(pos); pConnection;
pConnection = m_lstConnections.GetNextElement(pos))
m_pGraph->fn_vAddGraphicConnection(pConnection);
// update flag
m_pGraph->fn_vNotifySave();
m_bDeleted = FALSE;
// update interface
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pNode);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshNodeList(m_pGraph, m_pNode);
return TRUE;
}
/*===========================================================================
Insert Connection
===========================================================================*/
InsertConnection::InsertConnection (Graph *pGraph, WayPoint *pSrcWaypoint, WayPoint *pDstWaypoint, BOOL bUpdate, BOOL pBlock)
: CPA_Modif (GRAPH_INSERT_ARC, "Insert Connection", pBlock)
{
int iSrcNode, iDstNode;
// register parameters
m_pGraph = pGraph;
m_pSrcWaypoint = pSrcWaypoint;
m_pDstWaypoint = pDstWaypoint;
m_pArrow = NULL;
// register engine parameters
iSrcNode = m_pGraph->fn_iGetNodeOfWayPoint(m_pSrcWaypoint->GetStruct());
m_hSrcNode = m_pGraph->fn_hGetNode(iSrcNode);
iDstNode = m_pGraph->fn_iGetNodeOfWayPoint(m_pDstWaypoint->GetStruct());
m_hDstNode = m_pGraph->fn_hGetNode(iDstNode);
// init flag
m_bUpdate = bUpdate;
m_bInserted = FALSE;
m_bFirstTime = TRUE;
}
InsertConnection::~InsertConnection (void)
{
// if necessary, delete graphic connection
if (!m_bInserted)
delete m_pArrow;
}
BOOL InsertConnection::Do (void)
{
// update engine data
WPG_fn_vAddArc(m_hSrcNode, m_hDstNode, 0, 0);
// update graphic connection
if (!m_pArrow)
m_pArrow = m_pGraph->GetInterface()->fn_pCreateConnectionGraphicObject(m_pGraph, m_pSrcWaypoint, m_pDstWaypoint, 0, 0);
m_pGraph->fn_vAddGraphicConnection(m_pArrow);
// update flag
m_pGraph->fn_vNotifySave();
m_bInserted = TRUE;
// update interface
if (!m_bFirstTime)
{
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pSrcWaypoint);
Graph::fn_pGetDialog()->fn_vRefreshConnectList(m_pGraph, m_pSrcWaypoint, m_pDstWaypoint);
}
else if (m_bUpdate)
Graph::fn_pGetDialog()->fn_vRefreshConnectList(m_pGraph, m_pSrcWaypoint, m_pDstWaypoint);
Graph::GetInterface()->fn_vUpdateConnections();
m_bFirstTime = FALSE;
return TRUE;
}
BOOL InsertConnection::Undo (void)
{
// update graphic connection
m_pGraph->fn_vRemoveGraphicConnection(m_pArrow);
// update engine data
WPG_fn_vRemoveArc(m_hSrcNode, m_hDstNode);
// update flag
m_pGraph->fn_vNotifySave();
m_bInserted = FALSE;
// update dialog
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pSrcWaypoint);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshConnectList(m_pGraph, m_pSrcWaypoint, NULL);
return TRUE;
}
/*===========================================================================
Delete Connection
===========================================================================*/
DeleteConnection::DeleteConnection (Graph *pGraph, WayPoint *pSrcWaypoint, WayPoint *pDstWaypoint, BOOL pBlock)
: CPA_Modif (GRAPH_DELETE_ARC, "Delete Connection", pBlock)
{
int iSrcNode, iDstNode;
// register parameters
m_pGraph = pGraph;
m_pSrcWaypoint = pSrcWaypoint;
m_pDstWaypoint = pDstWaypoint;
m_pArrow = m_pGraph->GetGraphicConnection(m_pSrcWaypoint, m_pDstWaypoint);
// register engine parameters
iSrcNode = m_pGraph->fn_iGetNodeOfWayPoint(m_pSrcWaypoint->GetStruct());
m_hSrcNode = m_pGraph->fn_hGetNode(iSrcNode);
iDstNode = m_pGraph->fn_iGetNodeOfWayPoint(m_pDstWaypoint->GetStruct());
m_hDstNode = m_pGraph->fn_hGetNode(iDstNode);
// init flag
m_bDeleted = FALSE;
m_bFirstTime = TRUE;
}
DeleteConnection::~DeleteConnection (void)
{
// if necessary, delete graphic connection
if (m_bDeleted)
delete m_pArrow;
}
BOOL DeleteConnection::Do (void)
{
// update graphic connection
m_pGraph->fn_vRemoveGraphicConnection(m_pArrow);
// update engine data
WPG_fn_vRemoveArc(m_hSrcNode, m_hDstNode);
// update flag
m_pGraph->fn_vNotifySave();
m_bDeleted = TRUE;
// update dialog
if (!m_bFirstTime)
{
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pSrcWaypoint);
}
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshConnectList(m_pGraph, m_pSrcWaypoint, NULL);
m_bFirstTime = FALSE;
return TRUE;
}
BOOL DeleteConnection::Undo (void)
{
Connection *pLinkObject = (Connection *) m_pArrow->GetObject();
// update engine data
WPG_fn_vAddArc(m_hSrcNode, m_hDstNode, pLinkObject->GetWeight(), pLinkObject->GetCapacity());
// update graphic connection
m_pGraph->fn_vAddGraphicConnection(m_pArrow);
// update flag
m_pGraph->fn_vNotifySave();
m_bDeleted = FALSE;
// update dialog
Graph::GetInterface()->fn_vSelectGraph(m_pGraph);
Graph::GetInterface()->fn_vSetDisplayedWaypoint(m_pSrcWaypoint);
Graph::GetInterface()->fn_vUpdateConnections();
Graph::fn_pGetDialog()->fn_vRefreshConnectList(m_pGraph, m_pSrcWaypoint, m_pDstWaypoint);
return TRUE;
}
//End Shaitan Correction }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// ACPProject.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,371 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : TanObj.cpp
//
// Definition of the tangent objects
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CPA_Object
// CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 29 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "TanObj.hpp"
#include "Inter.hpp"
#include "LinkBez.hpp"
long Tangent::ms_lNbTangent=0;
Waypoint_Interface* Tangent::ms_poInterface;
//------ static
void Tangent::fn_vInitObject (Waypoint_Interface* poInterface)
{
ms_poInterface = poInterface;
}
Tangent::Tangent( CPA_ObjectDLLBase *p_oDLL, CPA_BaseObject *p_oOwner, eTangentLenghtMode eLenghtMode, eTangentOrientationMode eOrientationMode, eTangentNeighbourMode eNeighbourMode, eTangentChangeAllMode eChangeAllMode, GEO_tdstColor* pstColor ):
CPA_BaseObject ( p_oDLL, "Tangent" )
{
CPA_SuperObject* poSuperTangent = ms_poInterface->GetInterface()->GetNewSuperObject ( E_ss_NoSave, C_NoType );
poSuperTangent->SetObject(this);
SetSuperObject (poSuperTangent);
poSuperTangent->SetTypeSO (C_Protected);
// name
CString csName;
csName.Format ("Tangent%d", ms_lNbTangent);
ms_lNbTangent++;
fn_eRename (csName);
// init
MTH3D_M_vNullVector(&m_stFixVertex);
MTH3D_M_vNullVector(&m_stTangentVector);
m_xDim = 0.05f;
m_bOrientationAllow=FALSE;
m_bNotifyWay=FALSE;
// color
if (pstColor) m_stColor = *pstColor;
else
{
m_stColor.xR = 0.f;
m_stColor.xG = 0.8f;
m_stColor.xB = 0.f;
}
m_eTangentLenghtMode = eLenghtMode;
m_eTangentOrientationMode = eOrientationMode;
m_eTangentNeighbourMode = eNeighbourMode;
m_eTangentChangeAllMode = eChangeAllMode;
// graphic object
CPA_SuperObject* poGraphic = GetInterface()->fn_pGetNewTangentGraphicObject (&m_stColor);
poGraphic->SetSuperObjectOwner (GetSuperObject());
GetSuperObject()->AddTail (poGraphic);
GEO_xComputeObjectNormals ( (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(poGraphic->GetStruct()));
poGraphic->SetEditProtected (TRUE);
m_poParent = (Link*)p_oOwner;
}
long Tangent::GetDataType (void)
{
return C_ucTangent;
}
void* Tangent::GetData (void)
{
return NULL;
}
void Tangent::fn_vSetAbsoluteVertex ( MTH3D_tdstVector* pstFixAbsoluteVertex, MTH3D_tdstVector* pstMoveAbsoluteVertex )
{
POS_tdstCompletePosition InvMatrix;
POS_fn_vSetIdentityMatrix(&InvMatrix);
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_fn_vInvertMatrix( &InvMatrix, hAbsoluteLineMatrix );
POS_fn_vMulMatrixVertex( &m_stFixVertex, &InvMatrix, pstFixAbsoluteVertex ) ;
m_stTangentVector = *pstMoveAbsoluteVertex;
m_stMoveVertex = *pstMoveAbsoluteVertex;
MTH3D_M_vSubVector( &m_stTangentVector, &m_stTangentVector, pstFixAbsoluteVertex );
m_bOrientationAllow=TRUE;
fn_vDraw ();
m_bOrientationAllow=FALSE;
}
void Tangent::fn_vSetTangent ( MTH3D_tdstVector* pstMoveAbsoluteVertex )
{
MTH3D_tdstVector st_FixVertex;
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_fn_vMulMatrixVertex( &st_FixVertex, hAbsoluteLineMatrix, &m_stFixVertex ) ;
switch (m_eTangentLenghtMode)
{
case eVariableLenghtTangent:
m_stTangentVector = *pstMoveAbsoluteVertex;
MTH3D_M_vSubVector(&m_stTangentVector, &m_stTangentVector, &st_FixVertex );
break;
case eFixLenghtTangent:
{
GLI_tdxValue xLenght, xModifLenght, xRatio;
xLenght = MTH3D_M_xNormVector( &m_stTangentVector );
m_stTangentVector = *pstMoveAbsoluteVertex;
MTH3D_M_vSubVector( &m_stTangentVector, &m_stTangentVector, &st_FixVertex );
xModifLenght = MTH3D_M_xNormVector( &m_stTangentVector );
xRatio = xModifLenght>0 ? xLenght/xModifLenght : 1.f;
MTH3D_M_vMulScalarVector(&m_stTangentVector,xRatio, &m_stTangentVector);
} break;
}
m_bOrientationAllow=TRUE;
m_poParent->fn_vDraw ();
m_bOrientationAllow=FALSE;
}
void Tangent::fn_vSetTangentDirection ( MTH3D_tdstVector* pstAbsoluteDirectionVertex, BOOL bOppositeDirection )
{
MTH_tdxReal xLenght = MTH3D_M_xNormVector( &m_stTangentVector );
m_stTangentVector = *pstAbsoluteDirectionVertex;
MTH3D_M_vNormalizeVector(&m_stTangentVector,&m_stTangentVector);
if(bOppositeDirection) MTH3D_M_vMulScalarVector( &m_stTangentVector, -xLenght, &m_stTangentVector )
else MTH3D_M_vMulScalarVector( &m_stTangentVector, xLenght, &m_stTangentVector );
m_bOrientationAllow=TRUE;
fn_vDraw ();
m_bOrientationAllow=FALSE;
}
void Tangent::fn_pGetAbsoluteTangent (MTH3D_tdstVector* pstTangent)
{
*pstTangent = m_stTangentVector;
}
void Tangent::fn_vConstructGraphic (void)
{
CPA_SuperObject* poGraphic = GetInterface()->fn_pGetNewTangentGraphicObject(&m_stColor);
poGraphic->SetSuperObjectOwner (GetSuperObject());
GetSuperObject()->AddTail (poGraphic);
GEO_xComputeObjectNormals ( (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(poGraphic->GetStruct()));
poGraphic->SetEditProtected (TRUE);
}
void Tangent::fn_vDraw (void)
{
if (m_eTangentOrientationMode==eVariableOrientationTangent && !m_bOrientationAllow)
{
MTH3D_tdstVector stU, stV;
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
GLI_tdxValue xlenght = MTH3D_M_xNormVector( &m_stTangentVector );
POS_fn_vGetRotationMatrix( hAbsoluteMatrix , &stU, &stV, &m_stTangentVector );
MTH3D_M_vMulScalarVector ( &m_stTangentVector, xlenght, &m_stTangentVector );
return;
}
MTH3D_tdstVector stAbsoluteFixVertex, stAbsoluteMoveVertex;
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
POS_fn_vNormalizeMatrix( hAbsoluteMatrix ) ;
POS_fn_vMulMatrixVertex( &stAbsoluteFixVertex, hAbsoluteMatrix, &m_stFixVertex ) ;
stAbsoluteMoveVertex = stAbsoluteFixVertex;
MTH3D_M_vAddVector(&stAbsoluteMoveVertex, &stAbsoluteMoveVertex, &m_stTangentVector );
tdeLocalColor tdColor = GetSuperObject()->GetLocalColor ();
CPA_SuperObject* psoObject = (CPA_SuperObject*)GetSuperObject()->GetHead();
GLI_tdxValue d=m_xDim;
GLI_tdxValue md=-m_xDim;
GLI_tdxValue d2=(GLI_tdxValue)(m_xDim*2.);
GLI_tdxValue md2=(GLI_tdxValue)(-m_xDim*2.);
GLI_tdxValue zero=0.;
MTH3D_tdstVector n, u, v;
MTH3D_tdstVector Ox = { 1., 0., 0. };
// Version finale
ACP_tdxHandleOfObject hMot = (ACP_tdxHandleOfObject) HIE_fn_hGetSuperObjectObject(psoObject->GetStruct());
n = stAbsoluteMoveVertex;
MTH3D_M_vSubVector(&n,&n,&stAbsoluteFixVertex);
GLI_tdxValue lenght = MTH3D_M_xNormVector( &n );
GLI_tdxValue lenght8 = (GLI_tdxValue)(lenght*0.8);
MTH3D_tdstVector a8_stPoint [13];
MTH3D_M_vSetVectorElements (a8_stPoint, md,md,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+1, d,md,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+2, d,d,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+3, md,d,zero);
MTH3D_M_vSetVectorElements (a8_stPoint+4, md,md,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+5, d,md,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+6, d,d,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+7, md,d,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+8, md2,md2,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+9, d2,md2,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+10, d2,d2,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+11, md2,d2,lenght8);
MTH3D_M_vSetVectorElements (a8_stPoint+12, 0,0,lenght);
GEO_vSetListOfPointsOfObject
(
hMot,
a8_stPoint,
13,
0
);
MTH3D_M_vNormalizeVector(&n,&n);
// here : to rotate the beam around its principal axis
// by defaults find section align with plan z=0
if (n.xX||n.xY) { MTH3D_M_vSetVectorElements ((&u),(-n.xY),(n.xX),0.); }
else { MTH3D_M_vSetVectorElements((&u),0.,(n.xZ),(-n.xY)); }
MTH3D_M_vNormalizeVector(&u,&u);
MTH3D_M_vCrossProductVector((&v),(&n),(&u));
// change the local matrix
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (psoObject->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsoluteLineMatrix );
POS_fn_vSetTranslationVector( hAbsoluteLineMatrix, &stAbsoluteFixVertex );
POS_fn_vSetRotationMatrix( hAbsoluteLineMatrix , &u, &v, &n );
GetInterface()->fn_vComputeNewRelativeMatrix (psoObject->GetStruct());
}
Waypoint_Interface* Tangent::GetInterface (void)
{
return ms_poInterface;
}
void Tangent::fn_vStartMove ( MTH3D_tdstVector* pstStartVertex, BOOL bShift, BOOL bControl )
{
MTH3D_tdstVector stExtremVector, stPickVector;
MTH3D_tdstVector st_FixVertex;
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteLineMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (GetSuperObject()->GetStruct());
POS_fn_vMulMatrixVertex( &st_FixVertex, hAbsoluteLineMatrix, &m_stFixVertex ) ;
stExtremVector = m_stMoveVertex;
stPickVector = *pstStartVertex;
MTH3D_M_vSubVector( &stExtremVector, &stExtremVector, &st_FixVertex);
MTH3D_M_vSubVector( &stPickVector, &stPickVector, &st_FixVertex);
m_xMoveRatio = MTH3D_M_xNormVector(&stExtremVector)/MTH3D_M_xNormVector(&stPickVector);
fn_vChangeNeighbourTangent (bShift, bControl);
fn_vChangeAllTangent (bShift, bControl);
GetInterface()->fn_vEdit (m_poParent);
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
void Tangent::fn_vMove ( MTH3D_tdstVector* pstTranslation, BOOL bShift, BOOL bControl )
{
MTH3D_tdstVector stTranslation = * pstTranslation;
MTH3D_M_vMulScalarVector(&stTranslation,m_xMoveRatio, &stTranslation);
MTH3D_M_vAddVector(&m_stMoveVertex, &m_stMoveVertex, &stTranslation);
fn_vSetTangent ( &m_stMoveVertex );
fn_vChangeNeighbourTangent (bShift, bControl);
fn_vChangeAllTangent (bShift, bControl);
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
m_bNotifyWay=TRUE;
}
void Tangent::fn_vEndMove (void)
{
if (m_bNotifyWay)
{
m_poParent->fn_vWayNotifySave();
m_bNotifyWay=FALSE;
}
}
void Tangent::fn_vChangeNeighbourTangent (BOOL bShift, BOOL bControl)
{
switch (m_eTangentNeighbourMode)
{
case eAlwaysChangeNeighbour :
m_poParent->fn_vChangeNeighbourTangent (this);
break;
case eShiftDownChangeNeighbour :
if (bShift) m_poParent->fn_vChangeNeighbourTangent (this);
break;
case eControlDownChangeNeighbour :
if (bControl) m_poParent->fn_vChangeNeighbourTangent (this);
break;
case eShiftUpChangeNeighbour :
if (!bShift) m_poParent->fn_vChangeNeighbourTangent (this);
break;
case eControlUpChangeNeighbour :
if (!bControl) m_poParent->fn_vChangeNeighbourTangent (this);
break;
}
}
void Tangent::fn_vChangeAllTangent (void)
{
m_poParent->fn_vChangeAllTangent (this);
}
void Tangent::fn_vChangeAllTangent (BOOL bShift, BOOL bControl)
{
switch (m_eTangentChangeAllMode)
{
case eAlwaysChangeAll :
m_poParent->fn_vChangeAllTangent (this);
break;
case eShiftDownChangeAll :
if (bShift) m_poParent->fn_vChangeAllTangent (this);
break;
case eControlDownChangeAll :
if (bControl) m_poParent->fn_vChangeAllTangent (this);
break;
case eShiftUpChangeAll :
if (!bShift) m_poParent->fn_vChangeAllTangent (this);
break;
case eControlUpChangeAll :
if (!bControl) m_poParent->fn_vChangeAllTangent (this);
break;
}
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,366 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WPDia.cpp
//
// Dialog edition the waypoints
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>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"
#include "WayDia.hpp"
*/
//ENDANNECY Shaitan Nettoyage }
#include "WPDia.hpp"
#include "Inter.hpp"
#include "ogd.h"
#include "x:/cpa/main/inc/_EditId.h"
#include "tut.h"
IMPLEMENT_DYNCREATE ( DiaWP, CFormView );
/////////////////////////////////////////////////////////////////////////////
// DiaWP dialog
DiaWP::DiaWP(CWnd* pParent /*=NULL*/)
: CFormView(DiaWP::IDD)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //IDI_SYMBOLICWP
m_bEditRadius=FALSE;
m_poWP = NULL;
}
void DiaWP::fn_vInitDialog ( void )
{
// init the radio buttons icons
((CButton*)GetDlgItem (IDC_SYMBOLICALWP_RADIO))->SetIcon( AfxGetApp()->LoadIcon(IDI_SYMBOLICWP) );
((CButton*)GetDlgItem (IDC_REALWP_RADIO))->SetIcon( AfxGetApp()->LoadIcon(IDI_REALWP) );
// desactivate all the controls
GetDlgItem (IDC_GLOBALDRAW_CHECK)->EnableWindow (FALSE);
GetDlgItem (IDC_SYMBOLICALWP_RADIO)->EnableWindow (FALSE);
GetDlgItem (IDC_REALWP_RADIO)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_NAME_EDIT)->EnableWindow (FALSE);
}
// to edit a new waypoint
void DiaWP::fn_vEdit (WayPoint* poWP)
{
// Aspect of the dialog
if (!m_poWP && poWP)
{
// wake up
GetDlgItem (IDC_GLOBALDRAW_CHECK)->EnableWindow (TRUE);
GetDlgItem (IDC_SYMBOLICALWP_RADIO)->EnableWindow (TRUE);
GetDlgItem (IDC_REALWP_RADIO)->EnableWindow (TRUE);
GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (TRUE);
GetDlgItem (IDC_WAYPOINT_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_WAYPOINT_TEXT)->EnableWindow (TRUE);
GetDlgItem (IDC_WAYPOINT_NAME_EDIT)->EnableWindow (TRUE);
}
else if (m_poWP && !poWP)
{
GetDlgItem (IDC_GLOBALDRAW_CHECK)->EnableWindow (FALSE);
GetDlgItem (IDC_SYMBOLICALWP_RADIO)->EnableWindow (FALSE);
GetDlgItem (IDC_REALWP_RADIO)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_TEXT)->EnableWindow (FALSE);
GetDlgItem (IDC_WAYPOINT_NAME_EDIT)->EnableWindow (FALSE);
}
m_poWP = poWP;
fn_vRefreshCoordinate();
if (poWP)
{
GetParent()->SetWindowText ( poWP->GetName() );
// set the style buttons
CheckRadioButton( IDC_SYMBOLICALWP_RADIO, IDC_REALWP_RADIO, poWP->fn_bIsRealDraw() ? IDC_REALWP_RADIO : IDC_SYMBOLICALWP_RADIO );
if (m_poWP->fn_bIsAlone())
{
GetDlgItem (IDC_WAYPOINT_ALONE_PICTURE)->ShowWindow( SW_SHOW );
GetDlgItem (IDC_WAYPOINT_WAY_PICTURE)->ShowWindow( SW_HIDE );
}
else
{
GetDlgItem (IDC_WAYPOINT_WAY_PICTURE)->ShowWindow( SW_SHOW );
GetDlgItem (IDC_WAYPOINT_ALONE_PICTURE)->ShowWindow( SW_HIDE );
}
GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (m_poWP->fn_pGetDynamicFather() ? TRUE : FALSE);
fn_vEditName ();
fn_vRefreshDialog ();
}
else
{
m_fRadius = 0.;
m_bStaticCoord = FALSE;
GetParent()->SetWindowText ( "no waypoint to edit" );
UpdateData (FALSE);
m_csWaypointName="";
UpdateData (FALSE);
}
GetParent()->GetParent()->RedrawWindow (NULL, NULL, RDW_INVALIDATE|RDW_FRAME);
}
void DiaWP::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DiaWP)
DDX_Control(pDX, IDC_WAYPOINT_EDIT, m_EditWP);
DDX_Text(pDX, IDC_WAYPOINT_EDIT, m_fRadius);
DDV_MinMaxDouble(pDX, m_fRadius, 0., 99.99);
DDX_Check(pDX, IDC_WAYPOINT_COORD_CHECK, m_bStaticCoord);
DDX_Check(pDX, IDC_GLOBALDRAW_CHECK, m_bGlobalCheck);
DDX_Text(pDX, IDC_WAYPOINT_NAME_EDIT, m_csWaypointName);
DDV_MaxChars(pDX, m_csWaypointName, 50);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DiaWP, CFormView)
//{{AFX_MSG_MAP(DiaWP)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_EN_KILLFOCUS(IDC_WAYPOINT_EDIT, OnKillfocusWaypointEdit)
ON_BN_CLICKED(IDC_WAYPOINT_COORD_CHECK, OnWaypointCoordCheck)
ON_EN_CHANGE(IDC_WAYPOINT_EDIT, OnChangeWaypointEdit)
ON_BN_CLICKED(IDC_REALWP_RADIO, OnRealwpRadio)
ON_BN_CLICKED(IDC_SYMBOLICALWP_RADIO, OnSymbolicalwpRadio)
ON_BN_CLICKED(IDC_GLOBALDRAW_CHECK, OnGlobaldrawCheck)
ON_WM_DESTROY()
ON_EN_KILLFOCUS(IDC_WAYPOINT_NAME_EDIT, OnKillfocusWaypointNameEdit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DiaWP message handlers
/////////////////////////////////////////////////////////////////////////////
// DiaNetWP message handlers
void DiaWP::fn_vRefreshDialog (void)
{
m_fRadius = (float)(m_poWP->fn_xGetRadius());
m_bStaticCoord = m_poWP->fn_bGetCoordinate();
// change the radio buttons push
CheckRadioButton( IDC_SYMBOLICALWP_RADIO, IDC_REALWP_RADIO, m_poWP->fn_bIsGeneralRealDraw() ? IDC_REALWP_RADIO : IDC_SYMBOLICALWP_RADIO );
UpdateData (FALSE);
}
void DiaWP::fn_vRefreshCoordinate(void)
{
if (!m_poWP) return; // there's no waypoint to edit
//ANNECY Shaitan Nettoyage (12/05/98) {
// if (m_poWP->GetInterface()->fn_bWaypointInAWay(m_poWP)) GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (FALSE);
//ENDANNECY Shaitan Nettoyage }
else GetDlgItem (IDC_WAYPOINT_COORD_CHECK)->EnableWindow (TRUE);
}
void DiaWP::OnSysCommand(UINT nID, LPARAM lParam)
{
CFormView::OnSysCommand(nID, lParam);
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void DiaWP::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CFormView::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR DiaWP::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void DiaWP::OnKillfocusWaypointEdit()
{
if (!m_bEditRadius) return;
UpdateData (TRUE);
GLI_tdxValue xRadius = (GLI_tdxValue)m_fRadius;
if (xRadius == 0.0f)
xRadius = 0.001f;
m_poWP->fn_vSetRadius (&xRadius);
m_poWP->fn_vDrawNewRadius ();
m_bEditRadius=FALSE;
}
BOOL DiaWP::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (wParam==1)
{
OnKillfocusWaypointEdit();
OnKillfocusWaypointNameEdit();
}
return CFormView::OnCommand(wParam, lParam);
}
void DiaWP::OnWaypointCoordCheck()
{
m_poWP->fn_vChangeSystemCoordinate ();
}
void DiaWP::OnChangeWaypointEdit()
{
m_bEditRadius=TRUE;
}
// we want a real draw
void DiaWP::OnRealwpRadio()
{
m_poWP->fn_vSetGeneralRealDraw (TRUE);
fn_vDrawWP ();
}
void DiaWP::OnSymbolicalwpRadio()
{
m_poWP->fn_vSetGeneralRealDraw (FALSE);
fn_vDrawWP ();
}
void DiaWP::OnGlobaldrawCheck()
{
// set the memeber varaible
UpdateData (TRUE);
// change the status of the WP object
m_poWP->fn_vSetGlobalDraw (m_bGlobalCheck);
// change the radio buttons push
CheckRadioButton( IDC_SYMBOLICALWP_RADIO, IDC_REALWP_RADIO, m_poWP->fn_bIsGeneralRealDraw() ? IDC_REALWP_RADIO : IDC_SYMBOLICALWP_RADIO );
((Waypoint_Interface*)(m_poWP->GetInterface()))->fn_vDrawAllWP();
}
// draw all the WP that must be redraw
void DiaWP::fn_vDrawWP (void)
{
if (m_bGlobalCheck) ((Waypoint_Interface*)(m_poWP->GetInterface()))->fn_vDrawAllWP();
else m_poWP->fn_vDraw (); // draw the WP in his new mode
}
// Neme edition
void DiaWP::fn_vEditName (void)
{
m_csWaypointName = m_poWP->GetName();
}
void DiaWP::OnKillfocusWaypointNameEdit()
{
CString pOldName = m_csWaypointName;
UpdateData (TRUE);
if (pOldName == m_csWaypointName) return;
if (m_poWP->fn_eRename (m_csWaypointName)!=E_mc_None)
{
MessageBox ( m_csWaypointName+CString( " is already used."),"Attention",MB_ICONEXCLAMATION );
m_csWaypointName=pOldName;
UpdateData (FALSE);
}
else
{
m_poWP->GetInterface()->fn_vRefreshHierarchyList ();
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
Way::fn_pGetDialog()->fn_vRefreshNameList ();
// notify all the ways using this waypoint
POSITION xPos;
Way* poWay;
for ( poWay=Way::fn_poGetListOfWay()->GetHeadElement(xPos); poWay; poWay=Way::fn_poGetListOfWay()->GetNextElement(xPos) )
if ( poWay->fn_iIsWayPointInNet ((WayPoint*)m_poWP)>=0 ) poWay->fn_vNotifySave ();
*/
//ENDANNECY Shaitan Nettoyage }
}
}
BOOL DiaWP::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_WaypointDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_GLOBALDRAW_CHECK,"OWP_GlobalDraw",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_SYMBOLICALWP_RADIO,"OWP_SymbolicalDraw",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_REALWP_RADIO,"OWP_RealDraw",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_WAYPOINT_COORD_CHECK,"OWP_Absolute",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_WAYPOINT_EDIT,"OWP_WaypointRadiusEdit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_WAYPOINT_NAME_EDIT,"OWP_WaypointNameEdit",TUT_e_TextEdit);
return bCreate;
}
void DiaWP::OnDestroy()
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_GLOBALDRAW_CHECK);
TUT_M_vUnregisterControlID (IDC_SYMBOLICALWP_RADIO);
TUT_M_vUnregisterControlID (IDC_REALWP_RADIO);
TUT_M_vUnregisterControlID (IDC_WAYPOINT_COORD_CHECK);
TUT_M_vUnregisterControlID (IDC_WAYPOINT_EDIT);
TUT_M_vUnregisterControlID (IDC_WAYPOINT_NAME_EDIT);
}

View File

@@ -0,0 +1,131 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WPMod.cpp
//
// Modification classes
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>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<6E>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);
}
}

View File

@@ -0,0 +1,815 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WPObj.cpp
//
// Definition of the waypoint editors objects
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CPA_Object
// CPA_EdMot<ACP_tdxHandleOfLink>
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incdpt.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 "Inter.hpp"
#include "WPMod.hpp"
#include "WPDia.hpp"
#include "x:\cpa\main\inc\_editid.h"
//--------------------------------------- Script definition
static char* pszWaypointAction = "Waypoint";
//----------------------------------------------- static variables
BOOL WayPoint::ms_bRealDraw = TRUE;
BOOL WayPoint::ms_bGlobalDraw = FALSE;
BOOL WayPoint::ms_bOnScreen=TRUE;
DiaWP* WayPoint::ms_poDiaWP;
BOOL WayPoint::ms_bNotifyHeader;
BOOL WayPoint::ms_bDrawJustIsolateWaypoint;
CPA_List<WayPoint> WayPoint::ms_oListOfWaypoint;
Waypoint_Interface* WayPoint::ms_poInterface;
DeclareTemplateStatic(WP_tdhWayPoint);
void WayPoint::fn_vSetDialog ( DiaWP* poDiaWP )
{
ms_poDiaWP=poDiaWP;
ms_poDiaWP->fn_vInitDialog ();
}
void del(WP_tdhWayPoint h)
{
if (M_GetMainApp()->m_bLeavingApplication == TRUE)
return;
WP_fnv_WayPoint_Destroy(h);
}
void WayPoint::fn_vInitObject (Waypoint_Interface* poInterface)
{
// init Edmot
CPA_EdMot<WP_tdhWayPoint>::Init (WP_fnh_WayPoint_Create, WP_fnv_WayPoint_Copy, del);
ms_bNotifyHeader=FALSE;
ms_poInterface = poInterface;
ms_bOnScreen = TRUE;
ms_bDrawJustIsolateWaypoint = TRUE;
}
void WayPoint::fn_vRefreshWaypoint (void)
{
POSITION xPos;
WayPoint* poWaypoint;
CPA_SuperObject* poSuperObject;
CPA_List<CPA_SuperObject>* pListOfWaypointInHierarchy;
CPA_List<WayPoint> oListOfWaypointToRetreive;
CPA_BaseObjectList oListOfAllWaypoint;
// serach invisible ways in hierarchy
pListOfWaypointInHierarchy = GetInterface()->GetInterface()->GetObjectListByType("Waypoint");
if (pListOfWaypointInHierarchy->GetCount())
{
for ( poSuperObject=pListOfWaypointInHierarchy->GetHeadElement (xPos); xPos; poSuperObject=pListOfWaypointInHierarchy->GetNextElement (xPos) )
{
if (poSuperObject)
{
poWaypoint = (WayPoint*)(poSuperObject->GetObject());
if (!poWaypoint->fn_bIsWaypointDrawable()) oListOfWaypointToRetreive.AddTail (poWaypoint);
}
}
}
// and retreive them now
GetInterface()->fn_vSetRefreshWay (TRUE);
for ( poWaypoint=oListOfWaypointToRetreive.GetHeadElement (xPos); xPos; poWaypoint=oListOfWaypointToRetreive.GetNextElement (xPos) )
{
GetInterface()->fn_vSetModifDeleteOk (TRUE);
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (poWaypoint->GetSuperObject(),FALSE,FALSE,FALSE,FALSE);
GetInterface()->fn_vSetModifDeleteOk (FALSE);
}
// Add the way that are not in hierarchy and should be
if (ms_oListOfWaypoint.GetCount())
{
for (poWaypoint=ms_oListOfWaypoint.GetHeadElement(xPos); poWaypoint; poWaypoint=ms_oListOfWaypoint.GetNextElement(xPos) )
// the waypoint is virtual ?
if (poWaypoint->GetSuperObject())
{
// the waypoint is not in the hierarchy
if (!poWaypoint->GetSuperObject()->GetParent())
{
if (poWaypoint->fn_bIsWaypointDrawable ())
if (poWaypoint->fn_pGetFather())
// local waypoint
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (poWaypoint->GetSuperObject(), poWaypoint->fn_pGetFather(),FALSE,FALSE,FALSE );
else
// absolute waypoint
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (poWaypoint->GetSuperObject(), GetInterface()->GetInterface()->GetSpecificInterface()->GetDynamicRoot(),FALSE,FALSE,FALSE );
}
}
}
GetInterface()->fn_vSetRefreshWay (FALSE);
GetInterface()->GetInterface()->fn_vCancelCurrentSelection (FALSE);
}
BOOL WayPoint::fn_bCheckWaypointCoherence (CPA_List<WayPoint> *poWaypointList)
{
POSITION xPos;
WayPoint* poWaypoint;
BOOL bCheckWaypointCoherence = TRUE;
for ( poWaypoint=ms_oListOfWaypoint.GetHeadElement(xPos); xPos; poWaypoint=ms_oListOfWaypoint.GetNextElement(xPos) )
{
if (!poWaypoint->fn_bCheckCoherence())
{
if (poWaypointList) poWaypointList->AddTail (poWaypoint);
bCheckWaypointCoherence = FALSE;
}
}
return bCheckWaypointCoherence;
}
WayPoint::WayPoint (CPA_ObjectDLLBase *p_oDLL, BOOL bAlone, CString csName, BOOL bSave):
CPA_SaveObject ( p_oDLL, C_szWayPointTypeName, E_ss_Responsible )
{
m_bAbsoluteCoordinate=FALSE;
MTH_tdxReal stInitialValueRadius = 1.f;
WP_fnv_WayPoint_SetRadius ((WP_tdhWayPoint)GetEngineStruct(), stInitialValueRadius);
m_bCurrentDraw=FALSE;
m_bRealDraw=FALSE;
m_bSave=bSave;
m_bAlone = bAlone;
m_bOnScreen = FALSE;
m_poSuperObject = NULL;
// Shaitan Correction {
m_pSymbolicalGraphic = GetInterface()->fn_pGetNewSymbolicalGraphicObject();
m_pSymbolicalGraphic->SetEditProtected (TRUE);
m_pRealGraphic = GetInterface()->fn_pGetNewSphericalGraphicObject();
m_pRealGraphic->SetEditProtected (TRUE);
//End Shaitan Correction }
m_poDynamicFather = NULL;
ms_oListOfWaypoint.AddTail (this);
char szLevelFileName [256];
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
fn_zsGetActualLevelFilename (szLevelFileName,"wp");
long lSizePath = strlen ( fn_szGetLevelsDataPath() );
CString csLevelName = szLevelFileName+lSizePath+1;
csLevelName += "^";
csLevelName += m_bAlone ? C_SubSectionIsolateWayPointDescription : C_SubSectionInWayWayPointDescription;
// section object
SetSectionData ( this ) ;
SetCallBackSave ( fn_vCallbackSave ) ;
SetDataPath ( fn_szGetLevelsDataPath() ) ;
SCR_fn_v_RdL0_ComputeSectionName ( szSectionName, (char *)(LPCSTR)csLevelName, pszWaypointAction, " ");
SetReferencedSectionName (szSectionName);
// name
if ( fn_eRename (csName) != E_mc_None)
SetDefaultValidName ( ) ;
fn_vUpdateSectionName ( ) ;
SetExistingSection (FALSE) ;
// update link table
SCR_fnp_st_Link_SetValue (WP_fnp_WayPoint_GetLinkTable(),
(char*)(LPCSTR)GetCompleteSectionName(),
(unsigned long)GetEngineStruct());
fn_vNotifySave ();
}
WayPoint::WayPoint ( CPA_ObjectDLLBase *p_oDLL, WP_tdhWayPoint hEngineWP, CString csName, CString csFileName, CString csSectionName ):
CPA_SaveObject ( p_oDLL, C_szWayPointTypeName, E_ss_Responsible ),
CPA_EdMot<WP_tdhWayPoint>(hEngineWP)
{
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
m_bAbsoluteCoordinate=WP_fnb_WayPoint_IsStatic (hEngineWP);
m_bCurrentDraw=FALSE;
m_bRealDraw=FALSE;
m_bSave=TRUE;
m_bOnScreen = FALSE;
m_poSuperObject = NULL;
// Shaitan Correction {
m_pSymbolicalGraphic = GetInterface()->fn_pGetNewSymbolicalGraphicObject();
m_pSymbolicalGraphic->SetEditProtected (TRUE);
m_pRealGraphic = GetInterface()->fn_pGetNewSphericalGraphicObject();
m_pRealGraphic->SetEditProtected (TRUE);
//End Shaitan Correction }
m_poDynamicFather = NULL;
ms_oListOfWaypoint.AddTail (this);
// section object
SetSectionData ( this ) ;
SetCallBackSave ( fn_vCallbackSave ) ;
SetDataPath ( fn_szGetLevelsDataPath() ) ;
SCR_fn_v_RdL0_ComputeSectionName ( szSectionName, (char *)(LPCSTR)csFileName, (char *)(LPCSTR)csSectionName, " ");
SetReferencedSectionName (szSectionName);
// name
if ( fn_eRename (csName) != E_mc_None)
SetDefaultValidName ( ) ;
fn_vUpdateSectionName ( ) ;
SetExistingSection (TRUE) ;
}
WayPoint::WayPoint( WayPoint& rWayPoint):
CPA_SaveObject ( ms_poInterface, C_szWayPointTypeName, E_ss_Responsible ),
CPA_EdMot<WP_tdhWayPoint>()
{
m_bAbsoluteCoordinate=rWayPoint.m_bAbsoluteCoordinate;
m_poFather=rWayPoint.m_poFather;
m_bCurrentDraw=rWayPoint.m_bCurrentDraw;
m_bRealDraw=rWayPoint.m_bRealDraw;
m_bSave=rWayPoint.m_bSave;
m_bOnScreen = FALSE;
m_poSuperObject = NULL;
// Shaitan Correction {
m_pSymbolicalGraphic = GetInterface()->fn_pGetNewSymbolicalGraphicObject();
m_pSymbolicalGraphic->SetEditProtected (TRUE);
m_pRealGraphic = GetInterface()->fn_pGetNewSphericalGraphicObject();
m_pRealGraphic->SetEditProtected (TRUE);
//End Shaitan Correction }
ms_oListOfWaypoint.AddTail (this);
WP_fnv_WayPoint_Copy (GetStruct(), rWayPoint.GetStruct());
// section object
SetSectionData ( this ) ;
SetCallBackSave ( fn_vCallbackSave ) ;
SetDataPath ( fn_szGetLevelsDataPath() ) ;
SetReferencedSectionName ( rWayPoint.GetReferencedSectionName() );
// name
if ( fn_eRename (rWayPoint.GetName() ) != E_mc_None)
SetDefaultValidName ( ) ;
fn_vUpdateSectionName ( ) ;
}
WayPoint::~WayPoint(void)
{
POSITION DeletePos = ms_oListOfWaypoint.Find( this );
ms_oListOfWaypoint.RemoveAt (DeletePos);
}
WayPoint& WayPoint::operator= (WayPoint& rWayPoint)
{
m_bAbsoluteCoordinate=rWayPoint.m_bAbsoluteCoordinate;
m_poFather=rWayPoint.m_poFather;
m_bCurrentDraw=rWayPoint.m_bCurrentDraw;
m_bRealDraw=rWayPoint.m_bRealDraw;
m_bSave=rWayPoint.m_bSave;
WP_fnv_WayPoint_Copy (GetStruct(), rWayPoint.GetStruct());
return *this;
}
//-------------------------------------------------------------------
// Data
//-------------------------------------------------------------------
long WayPoint::GetDataType (void)
{
return HIE_C_ulEDT_Waypoint;
}
void* WayPoint::GetData (void)
{
return GetStruct();
}
//-------------------------------------------------------------------
// SAVE
//-------------------------------------------------------------------
void WayPoint::fn_vNotifySave (void)
{
if (!m_bSave) return;
if (!GetInterface()->fn_bExistWaypointSaveFile() && !ms_bNotifyHeader)
{
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
// header
SCR_fn_v_SvL1_RegisterNotify ( GetInterface()->fn_csGetWaypointSaveFileName().GetBuffer(256), WayPoint::fn_vCallbackHeader, NULL, SCR_EA_Ntfy_AddSection );
// Isolate section
SCR_fn_v_RdL0_ComputeSectionName
(
szSectionName,
GetInterface()->fn_csGetWaypointSaveFileName().GetBuffer(256),
C_SubSectionIsolateWayPointDescription,
" "
);
SCR_fn_v_SvL1_RegisterNotify ( szSectionName, WayPoint::fn_vCallbackEmptySectionWaypointIsolate, NULL, SCR_EA_Ntfy_AddSection );
// Inway section
SCR_fn_v_RdL0_ComputeSectionName
(
szSectionName,
GetInterface()->fn_csGetWaypointSaveFileName().GetBuffer(256),
C_SubSectionInWayWayPointDescription,
" "
);
SCR_fn_v_SvL1_RegisterNotify ( szSectionName, WayPoint::fn_vCallbackEmptySectionWaypointInWay, NULL, SCR_EA_Ntfy_AddSection );
ms_bNotifyHeader=TRUE;
}
fn_vNotifySection( SCR_EA_Ntfy_AddOrRebuildSection );
}
void WayPoint::fn_vNotifyUnSave (void)
{
if (m_bSave) CPA_SaveObject::fn_vNotifyUnSave ();
}
void WayPoint::fn_vNotifyRestore (void)
{
if (m_bSave) CPA_SaveObject::fn_vNotifyRestore ();
}
void WayPoint::fn_vNotifyRename (void)
{
if (m_bSave) CPA_SaveObject::fn_vNotifyRename ();
}
void WayPoint::fn_vUpdateReference (CPA_SaveObject *pReferencedObject)
{
if (m_bSave) fn_vUpdateReference (pReferencedObject);
}
void WayPoint::fn_vCallbackHeader ( SCR_tdst_File_Description *p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction )
{
if (_eAction==SCR_EA_Ntfy_AddSection)
{
char szBuffer [256];
char szTime [256];
char szDate [256];
SCR_M_SvL0_SaveScriptFileHeader(p_stFile);
SCR_M_SvL0_SaveComment(p_stFile, "Generated by waypoint editor");
_strtime(szTime);
_strdate(szDate);
sprintf(szBuffer, "Created date : %s %s", szDate, szTime);
SCR_M_SvL0_SaveComment(p_stFile, szBuffer);
SCR_M_SvL0_SaveBlankLine(p_stFile);
}
}
// create empty section for isolate waypoint
void WayPoint::fn_vCallbackEmptySectionWaypointIsolate ( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction )
{
if (_eAction==SCR_EA_Ntfy_AddSection)
{
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
strcpy ( szSectionName, C_SubSectionIsolateWayPointDescription );
strcat ( szSectionName, ":" );
SCR_fn_v_SvL1_ToEndSection (p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
SCR_M_SvL0_SaveBeginSection ( p_stFile, szSectionName, SCR_CC_C_Cfg_EOL );
SCR_M_SvL0_SaveEndSection ( p_stFile, SCR_CC_C_Cfg_EOL );
}
}
// create empty section for waypoint "in way"
void WayPoint::fn_vCallbackEmptySectionWaypointInWay ( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction )
{
if (_eAction==SCR_EA_Ntfy_AddSection)
{
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
strcpy ( szSectionName, C_SubSectionInWayWayPointDescription );
strcat ( szSectionName, ":" );
SCR_fn_v_SvL1_ToEndSection (p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
SCR_M_SvL0_SaveBeginSection ( p_stFile, szSectionName, SCR_CC_C_Cfg_EOL );
SCR_M_SvL0_SaveEndSection ( p_stFile, SCR_CC_C_Cfg_EOL );
}
}
void WayPoint::fn_vCallbackSave ( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData,SCR_tde_Ntfy_Action _eAction )
{
WayPoint* poWayPoint = (WayPoint*)_p_vData;
switch (_eAction)
{
case SCR_EA_Ntfy_AddSection :
case SCR_EA_Ntfy_ModifySection :
case SCR_EA_Ntfy_RebuildSection :
{
// declaration
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
char szObjectName [SCR_CV_ui_Cfg_MaxLenName];
double a3_dVertex [3];
MTH3D_tdstVector stVertex;
double xRadius;
//init
strcpy ( szObjectName, poWayPoint->GetName() );
WP_fnv_WayPoint_GetVertex ( poWayPoint->GetStruct(), &stVertex );
xRadius = WP_fnx_WayPoint_GetRadius ( poWayPoint->GetStruct() );
MTH3D_M_vGetVectorElements ( &(a3_dVertex[0]), &(a3_dVertex[1]), &(a3_dVertex[2]), &stVertex );
SCR_fn_v_RdL0_ComputeSectionName
(
szSectionName,
NULL,
pszWaypointAction,
szObjectName
);
SCR_g_ui_SvL0_IndentationLevel=1;
SCR_M_SvL0_SaveBeginSection ( _p_stFile, szSectionName, SCR_CC_C_Cfg_EOL );
SCR_M_SvL0_SaveEntry( _p_stFile, "Vertex", SCR_CC_C_Cfg_NoChar );
SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_ArrayDouble, 2, 3, a3_dVertex );
SCR_M_SvL0_SaveEntry( _p_stFile, "Radius", SCR_CC_C_Cfg_NoChar );
SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_ArrayDouble, 2, 1, &xRadius );
if (WP_fnb_WayPoint_IsDynamic(poWayPoint->GetStruct()))
{
HIE_tdxHandleToSuperObject hSuperObject = WP_fnh_WayPoint_GetSuperObject (poWayPoint->GetStruct());
CPA_BaseObject* poBaseObject = poWayPoint->GetInterface()->GetMainWorld()->fn_p_oFindObjectWithEngine (hSuperObject);
strcpy ( szSectionName, ((CPA_SaveObject*)((CPA_SuperObject*)poBaseObject)->GetObject())->GetReferencedSectionName() );
SCR_M_SvL0_SaveEntry( _p_stFile, "Father", SCR_CC_C_Cfg_NoChar );
SCR_fn_v_SvL0_SaveParameters_MP ( _p_stFile, SCR_EF_SvL0_Normal, 1, szSectionName );
}
SCR_M_SvL0_SaveEndSection (_p_stFile, SCR_CC_C_Cfg_EOL);
SCR_g_ui_SvL0_IndentationLevel=0;
poWayPoint->fn_vSectionSaved ();
} break;
case SCR_EA_Ntfy_DeleteSection :
poWayPoint->fn_vSectionDeleted ();
break;
}
}
void WayPoint::fn_vSetRadius (GLI_tdxValue* pxR)
{
GetInterface()->GetInterface()->GetMultiDevice()->GetEditManager()->AskFor(new ModifWayPointRadius (this, pxR));
}
void WayPoint::fn_vChangeSystemCoordinate (void)
{
GetInterface()->GetInterface()->GetMultiDevice()->GetEditManager()->AskFor(new ModifWayPointCoordinate (this));
}
void WayPoint::fn_vSetCoordinate (BOOL bAbsolute)
{
m_bAbsoluteCoordinate = bAbsolute;
}
GLI_tdxValue WayPoint::fn_xGetRadius (void)
{
GLI_tdxValue stRadius;
stRadius = WP_fnx_WayPoint_GetRadius (GetStruct() );
return stRadius;
}
CPA_SuperObject* WayPoint::fn_pGetFather (void)
{
return m_poFather;
}
void WayPoint::fn_vSetFather (CPA_SuperObject* poFather)
{
m_poFather=poFather;
}
CPA_SuperObject* WayPoint::fn_pGetDynamicFather (void)
{
return m_poDynamicFather;
}
void WayPoint::fn_vSetDynamicFather (CPA_SuperObject* poDynamicFather)
{
m_poDynamicFather=poDynamicFather;
}
void WayPoint::fn_vComputeMotorStructure (void)
{
if (m_bAbsoluteCoordinate)
{
MTH3D_tdstVector stVertex;
// compute absolute matrix
GetInterface()->fn_vComputeAbsoluteMatrix (GetSuperObject());
GEO_tdxHandleToMatrix hAbsoluteMatrix = HIE_fn_hGetSuperObjectGlobalMatrix ( GetSuperObject()->GetStruct() );
POS_fn_vGetTranslationVector( hAbsoluteMatrix, &stVertex ) ;
WP_fnv_WayPoint_SetVertex (GetStruct(), &stVertex);
WP_fnv_WayPoint_SetSuperObject (GetStruct(), NULL);
}
else
{
MTH3D_tdstVector stVertex;
WP_fnv_WayPoint_SetSuperObject ( GetStruct(), fn_pGetFather()->GetStruct() );
GEO_tdxHandleToMatrix hRelativeMatrix;
hRelativeMatrix = HIE_fn_hGetSuperObjectMatrix (GetSuperObject()->GetStruct());
POS_fn_vGetTranslationVector( hRelativeMatrix, &stVertex ) ;
WP_fnv_WayPoint_SetVertex (GetStruct(), &stVertex);
}
}
// this function attach the appropriate graphic object to the WayPoint Object
// bSreen echo on the screen the new draw -> default TRUE
// bDestroy delete in the hiearchy the old graphic object -> default TRUE
void WayPoint::fn_vDraw (BOOL bScreen, BOOL bDestroy)
{
// Shaitan Correction {
CPA_SuperObject * pDelSuperObject;
CPA_SuperObject * pNewGraphicObject;
//End Shaitan Correction }
BOOL bMustChange = (fn_bIsGeneralRealDraw()!=m_bCurrentDraw);
// Shaitan Correction {
// we must change the draw
if (m_bCurrentDraw)
pDelSuperObject = m_pRealGraphic;
else
pDelSuperObject = m_pSymbolicalGraphic;
//End Shaitan Correction }
if (bMustChange)
{
m_bCurrentDraw = fn_bIsGeneralRealDraw();
// Shaitan Correction {
// we must change the draw
// POSITION xPos;
// CPA_SuperObjectBase* pDelSuperObject;
// pDelSuperObject = GetSuperObject()->GetHeadElement (xPos);
//End Shaitan Correction }
// Ruse de sioux
if (bDestroy)
{
GetInterface()->fn_vSetModifDeleteOk (TRUE);
GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (pDelSuperObject,FALSE,FALSE,FALSE,FALSE);
GetInterface()->fn_vSetModifDeleteOk (FALSE);
}
else GetSuperObject()->RemoveAll();
}
// Shaitan Correction {
// we must change the draw
if (m_bCurrentDraw)
pNewGraphicObject = m_pRealGraphic;
else
pNewGraphicObject = m_pSymbolicalGraphic;
// pNewGraphicObject = m_bCurrentDraw ? ((Waypoint_Interface*)GetInterface())->fn_pGetNewSphericalGraphicObject() : ((Waypoint_Interface*)GetInterface())->fn_pGetNewSymbolicalGraphicObject ();
//End Shaitan Correction }
if (bMustChange)
{
GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (pNewGraphicObject, GetSuperObject(),FALSE,FALSE,FALSE);
pNewGraphicObject->SetEditProtected (TRUE);
pNewGraphicObject->SetSuperObjectOwner (GetSuperObject());
}
// register the relative location;
GEO_tdxHandleToMatrix hRelativeMatrix = HIE_fn_hGetSuperObjectMatrix (pDelSuperObject->GetStruct());
// no scale
POS_fn_vResetScaleMatrix( hRelativeMatrix );
if (m_bCurrentDraw)
{
// compute the radius by changing the scale matrix
MTH3D_tdstVector stI, stJ, stK;
GLI_tdxValue xR;
xR = WP_fnx_WayPoint_GetRadius (GetStruct());
POS_fn_vGetScaleMatrix
(
hRelativeMatrix,
&stI,
&stJ,
&stK
);
MTH3D_M_vMulScalarVector(&stI, xR, &stI );
MTH3D_M_vMulScalarVector(&stJ, xR, &stJ );
MTH3D_M_vMulScalarVector(&stK, xR, &stK );
POS_fn_vSetScaleMatrix
(
hRelativeMatrix,
&stI ,
&stJ ,
&stK
);
// normalize
// POS_fn_vNormalizeMatrix( hRelativeMatrix );
}
// correct the scale with the father's one
CPA_SuperObject *pFather = fn_pGetFather();
POS_tdstCompletePosition stScaleMatrix, stInvertMatrix;
POS_fn_vSetIdentityMatrix(&stScaleMatrix);
POS_fn_vSetIdentityMatrix(&stInvertMatrix);
MTH3D_tdstVector stI, stJ, stK;
POS_fn_vGetScaleMatrix
(
HIE_fn_hGetSuperObjectGlobalMatrix(pFather->GetStruct()),
&stI,
&stJ,
&stK
);
POS_fn_vSetScaleMatrix
(
&stScaleMatrix,
&stI ,
&stJ ,
&stK
);
POS_fn_vInvertMatrix(&stInvertMatrix, &stScaleMatrix);
POS_fn_vMulMatrixMatrix(hRelativeMatrix, &stInvertMatrix, hRelativeMatrix);
// init the location
HIE_fn_vSetSuperObjectMatrix(pNewGraphicObject->GetStruct(), hRelativeMatrix);
// Redraw the world
if (bScreen) GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw); // provisoire JT
}
void WayPoint::fn_vDrawNewRadius (void)
{
if (!fn_bIsGeneralRealDraw()) return;
// compute the radius by changing the scale matrix
GEO_tdxHandleToMatrix hRelativeMatrix = HIE_fn_hGetSuperObjectMatrix (m_pRealGraphic->GetStruct());
MTH3D_tdstVector stI, stJ, stK;
GLI_tdxValue xR;
xR = WP_fnx_WayPoint_GetRadius (GetStruct());
POS_fn_vResetScaleMatrix( hRelativeMatrix ) ;
POS_fn_vGetScaleMatrix
(
hRelativeMatrix,
&stI,
&stJ,
&stK
);
MTH3D_M_vMulScalarVector(&stI, xR, &stI );
MTH3D_M_vMulScalarVector(&stJ, xR, &stJ );
MTH3D_M_vMulScalarVector(&stK, xR, &stK );
POS_fn_vSetScaleMatrix
(
hRelativeMatrix,
&stI,
&stJ,
&stK
);
// correct the scale with the father's one
CPA_SuperObject *pFather = fn_pGetFather();
POS_tdstCompletePosition stScaleMatrix, stInvertMatrix;
POS_fn_vSetIdentityMatrix(&stScaleMatrix);
POS_fn_vSetIdentityMatrix(&stInvertMatrix);
POS_fn_vGetScaleMatrix
(
HIE_fn_hGetSuperObjectGlobalMatrix(pFather->GetStruct()),
&stI,
&stJ,
&stK
);
POS_fn_vSetScaleMatrix
(
&stScaleMatrix,
&stI ,
&stJ ,
&stK
);
POS_fn_vInvertMatrix(&stInvertMatrix, &stScaleMatrix);
POS_fn_vMulMatrixMatrix(hRelativeMatrix, &stInvertMatrix, hRelativeMatrix);
// normalize
// POS_fn_vNormalizeMatrix( hRelativeMatrix );
GetInterface()->GetInterface()->fn_vUpdateAll (E_mc_JustDraw);
}
BOOL WayPoint::fn_bIsWaypointDrawable (void)
{
return ( (ms_bOnScreen && ( m_bAlone ? TRUE : !fn_bDrawJustIsolateWaypoint() )) || m_bOnScreen ) && fn_bIsValid();
}
BOOL WayPoint::fn_bCheckCoherence (void)
{
CList<CPA_BaseObject*,CPA_BaseObject*> oInvalidFatherList;
int iIncoherenceNb = g_oCoherenceManager.m_fn_iGetInvalidFatherList ( this, &oInvalidFatherList );
if (!iIncoherenceNb) return TRUE;
POSITION xPos;
CPA_BaseObject* poBaseObject;
for ( xPos=oInvalidFatherList.GetHeadPosition(); xPos; oInvalidFatherList.GetNext(xPos) )
{
poBaseObject = oInvalidFatherList.GetAt (xPos);
if (poBaseObject->GetType()==C_szIABehaviourTypeName) return FALSE;
}
return TRUE;
}
BOOL WayPoint::fn_bIsReferencedInAI (void)
{
CList<CPA_BaseObject*,CPA_BaseObject*> oInvalidFatherList;
int iIncoherenceNb = g_oCoherenceManager.m_fn_iGetFatherList ( this, &oInvalidFatherList );
if (!iIncoherenceNb) return FALSE;
POSITION xPos;
CPA_BaseObject* poBaseObject;
for ( xPos=oInvalidFatherList.GetHeadPosition(); xPos; oInvalidFatherList.GetNext(xPos) )
{
poBaseObject = oInvalidFatherList.GetAt (xPos);
if (poBaseObject->GetType()==C_szIABehaviourTypeName) return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,604 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WayMod.cpp
//
// Modification classes
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "WayMod.hpp"
#include "Inter.hpp"
#include "WayDia.hpp"
ModifWayInsert::ModifWayInsert (Way* pWay, WayPoint* pInsertWP, WP_tduc_WPIndex stBeforeWP, BOOL bDialog1stRefresh, BOOL pBlock) : CPA_Modif (TYPE_INSERT_WP,"",pBlock)
{
m_pWay = pWay;
m_pWay->GetInterface()->fn_bComputeRealWay (&m_pWay);
m_pInsertWP = pInsertWP;
m_stBeforeWP = stBeforeWP;
m_DialogRefresh=bDialog1stRefresh;
SetName(CString("Insert ")+CString(m_pInsertWP->GetName())+CString (" into ")+CString (m_pWay->GetName()));
}
BOOL ModifWayInsert::Do (void)
{
POSITION lPosWP, lPosLink;
WayPoint* poWP;
Link* poLink;
int iSelect=0;
// insert object in the editor list
if (m_stBeforeWP<m_pWay->GetListWaypoint()->GetCount())
{
//----------- link
if (m_stBeforeWP)
{
m_pOldLink = m_pWay->fn_pGetLink (m_stBeforeWP-1);
m_pOldLink->fn_vSplitLink ( m_pWay, m_pInsertWP, &m_pLinkBefore, &m_pLinkAfter );
m_pOldLink->fn_vSetRemoveInHierarchy (TRUE);
m_pLinkBefore->fn_vSetAddInHierarchy (TRUE);
m_pLinkAfter->fn_vSetAddInHierarchy (TRUE);
for (poLink=m_pWay->GetListLink()->GetHeadElement(lPosLink), iSelect=1; poLink && iSelect!=m_stBeforeWP; poLink=m_pWay->GetListLink()->GetNextElement(lPosLink), iSelect++);
if (poLink)
{
m_pWay->GetListLink()->SetAt( lPosLink, m_pLinkAfter );
m_pWay->GetListLink()->InsertBefore( lPosLink, m_pLinkBefore );
}
}
else
{
m_pOldLink=NULL;
m_pLinkBefore=NULL;
m_pLinkAfter=(Link*)(m_pWay->fn_pCreateLink (m_pWay->fn_cGetDefaultLink())->GetObject());
m_pLinkAfter->fn_vSetWaypoints ( m_pInsertWP, m_pWay->GetListWaypoint()->GetHead () );
m_pWay->GetListLink()->AddHead ( m_pLinkAfter );
}
//------------- waypoint
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPosWP), iSelect=0; poWP && iSelect!=m_stBeforeWP; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPosWP), iSelect++);
if (poWP) m_pWay->GetListWaypoint()->InsertBefore(lPosWP,m_pInsertWP);
}
else
{
//---------- link
m_pOldLink=NULL;
m_pLinkAfter=NULL;
m_pLinkBefore=NULL;
if (m_pWay->GetListWaypoint()->GetCount())
{
m_pLinkBefore = (Link*) (m_pWay->fn_pCreateLink(m_pWay->fn_cGetDefaultLink())->GetObject());
m_pLinkBefore->fn_vSetWaypoints (m_pWay->GetListWaypoint()->GetTail (), m_pInsertWP);
m_pLinkBefore->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->AddTail(m_pLinkBefore);
}
//---------- waypoint
m_pWay->GetListWaypoint()->AddTail(m_pInsertWP);
iSelect=m_pWay->GetListWaypoint()->GetCount();
}
// insert the WP and the links in the engine structure
WP_fnv_Way_InsertWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), (WP_tdhWayPoint)(m_pInsertWP->GetStruct()),m_pLinkBefore ? (WP_tdhLink)(m_pLinkBefore->GetStruct()) : NULL, m_pLinkAfter ? (WP_tdhLink)(m_pLinkAfter->GetStruct()) : NULL , m_stBeforeWP);
// refresh the dialog if it's open
if (!m_DialogRefresh) m_DialogRefresh=TRUE;
else
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog(iSelect);
// refreh the waypoint dialog
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate ();
// refresh the graphic
m_pInsertWP->fn_vDraw(FALSE,TRUE);
m_pWay->fn_vRefresh();
m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
m_pWay->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayInsert::Undo (void)
{
POSITION lPosWP, lPosLink;
WayPoint* poWP;
Link* poLink;
int iSelect=0;
// delete object in the engine structure
WP_fnv_Way_DeleteWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), m_stBeforeWP, m_pOldLink ? (WP_tdhLink)m_pOldLink->GetStruct() : NULL );
// delete object in the editor list
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPosWP), iSelect=0; poWP && iSelect!=m_stBeforeWP; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPosWP), iSelect++);
if (poWP) m_pWay->GetListWaypoint()->RemoveAt(lPosWP);
// restore editors links
if (m_stBeforeWP)
{
for (poLink=m_pWay->GetListLink()->GetHeadElement(lPosLink), iSelect=1; poLink && iSelect!=m_stBeforeWP; poLink=m_pWay->GetListLink()->GetNextElement(lPosLink), iSelect++);
if (m_pOldLink)
{
m_pWay->GetListLink()->SetAt( lPosLink, m_pOldLink );
m_pOldLink->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->GetNextElement(lPosLink);
}
m_pLinkBefore->fn_vSetRemoveInHierarchy (TRUE);
if (m_pLinkAfter) m_pLinkAfter->fn_vSetRemoveInHierarchy (TRUE);
if (lPosLink) m_pWay->GetListLink()->RemoveAt(lPosLink);
}
else
{
if (m_pWay->GetListLink()->GetCount()) m_pWay->GetListLink()->RemoveHead ();
}
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog(iSelect);
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate();
m_pWay->fn_vRefresh();
m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
m_pWay->fn_vNotifySave ();
return TRUE;
}
ModifWayDelete::ModifWayDelete (Way* pWay, WP_tduc_WPIndex stPosDeleteWP, BOOL pBlock) : CPA_Modif (TYPE_DELETE_WP,"",pBlock)
{
m_pWay = pWay;
m_pWay->GetInterface()->fn_bComputeRealWay (&m_pWay);
m_stDeletePosWP = stPosDeleteWP;
m_pDeleteWP=0;
m_pLink=NULL;
m_DialogRefresh=!pBlock;
SetName(CString("Delete ")+CString(m_pWay->fn_pGetWayPoint ((m_stDeletePosWP==WP_fnuc_Way_GetSizeWay ((WP_tdhWay)(pWay->GetEngineStruct()))) ? m_stDeletePosWP-1 : m_stDeletePosWP)->GetName()) + CString (" in ") + CString (m_pWay->GetName()) );
}
BOOL ModifWayDelete::Do (void)
{
POSITION lPosWP, lPosLink;
POSITION lPosModifyLink;
WayPoint* poWP;
Link* poLink;
int iSelect=0;
// delete object in the editor list
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPosWP), iSelect=0; poWP && iSelect!=m_stDeletePosWP; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPosWP),iSelect++);
if (poWP) {
m_pWay->GetListWaypoint()->RemoveAt(lPosWP); // Ok we have it
m_pDeleteWP=poWP;
}
// modify links in the editor list
if (m_stDeletePosWP)
{
for (poLink=m_pWay->GetListLink()->GetHeadElement(lPosLink), iSelect=1; poLink && iSelect!=m_stDeletePosWP; poLink=m_pWay->GetListLink()->GetNextElement(lPosLink),iSelect++);
lPosModifyLink = lPosLink;
m_pOldLinkBefore=poLink;
m_pOldLinkAfter=m_pWay->GetListLink()->GetNextElement(lPosLink);
if (m_pOldLinkBefore && m_pOldLinkAfter)
{
m_pLink = m_pOldLinkBefore->fn_pMergeLink (m_pWay, m_pOldLinkAfter);
m_pLink->fn_vSetAddInHierarchy (TRUE);
if (m_pOldLinkBefore) m_pOldLinkBefore->fn_vSetRemoveInHierarchy (TRUE);
if (m_pOldLinkAfter) m_pOldLinkAfter->fn_vSetRemoveInHierarchy (TRUE);
m_pWay->GetListLink()->SetAt( lPosModifyLink, m_pLink );
if (m_stDeletePosWP) m_pWay->GetListLink()->RemoveAt(lPosLink);
}
else
{
m_pLink=NULL;
if (m_pOldLinkBefore) m_pOldLinkBefore->fn_vSetRemoveInHierarchy (TRUE);
m_pWay->GetListLink()->RemoveTail ();
}
}
else
{
m_pOldLinkBefore=NULL;
m_pOldLinkAfter=m_pWay->GetListLink()->GetHeadElement(lPosLink);
m_pLink = NULL;
if (m_pWay->GetListLink()->GetCount())
{
m_pWay->GetListLink()->GetHead()->fn_vSetRemoveInHierarchy (TRUE);
m_pWay->GetListLink()->RemoveHead();
}
}
// delete object in the motor structure
if (m_pWay->IsWayEmpty()) WP_fnv_Way_Free ((WP_tdhWay)(m_pWay->GetStruct()));
else WP_fnv_Way_DeleteWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), m_stDeletePosWP, m_pLink ? (WP_tdhLink)m_pLink->GetEngineStruct() : NULL );
// refresh the dialog if it's open
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog(max (iSelect-1,0));
// refreh the waypoint dialog
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate();
m_pWay->fn_vRefresh();
if (m_DialogRefresh) m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
if (m_pWay->IsWayEmpty())
{
m_pWay->fn_vNotifyUnSave ();
m_pWay->fn_vSetRecreate (TRUE);
if (m_pWay->GetSuperObject()->GetParent())
{
Way::GetInterface()->fn_vSetModifDeleteOk (TRUE);
Way::GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_pWay->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetModifDeleteOk (FALSE);
}
}
else m_pWay->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayDelete::Undo (void)
{
POSITION lPosWP, lPosLink;
WayPoint* poWP;
Link* poLink;
long lIndex;
if (m_pWay->IsWayEmpty())
{
Way::GetInterface()->fn_vSetRefreshWay (TRUE);
if (!m_pWay->GetSuperObject()->GetParent()) Way::GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_pWay->GetSuperObject(), Way::GetInterface()->GetInterface()->GetSpecificInterface()->GetDynamicRoot(), FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetRefreshWay (FALSE);
}
// search the position in the editor list to reinsert and do it
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPosWP), lIndex=0; poWP && lIndex!=m_stDeletePosWP; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPosWP),lIndex++);
if (poWP) m_pWay->GetListWaypoint()->InsertBefore(lPosWP,m_pDeleteWP);
else m_pWay->GetListWaypoint()->AddTail(m_pDeleteWP);
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog(lIndex);
// set the links editor
if (m_stDeletePosWP)
{
if (m_pLink)
{
for (poLink=m_pWay->GetListLink()->GetHeadElement(lPosLink), lIndex=1; poLink && lIndex!=m_stDeletePosWP; poLink=m_pWay->GetListLink()->GetNextElement(lPosLink),lIndex++);
m_pLink->fn_vSetRemoveInHierarchy (TRUE);
if (m_pOldLinkBefore)
{
m_pOldLinkBefore->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->SetAt( lPosLink, m_pOldLinkBefore );
}
if (m_pOldLinkAfter)
{
m_pOldLinkAfter->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->InsertAfter( lPosLink, m_pOldLinkAfter );
}
}
else
{
m_pOldLinkBefore->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->AddTail (m_pOldLinkBefore);
m_pOldLinkBefore->fn_vSetAddInHierarchy (TRUE);
}
}
else
{
if (m_pOldLinkAfter)
{
m_pOldLinkAfter->fn_vSetAddInHierarchy (TRUE);
m_pWay->GetListLink()->AddHead (m_pOldLinkAfter);
}
}
// reinsert the object in the motor structure
WP_fnv_Way_InsertWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), (WP_tdhWayPoint)(m_pDeleteWP->GetStruct()), m_pOldLinkBefore ? (WP_tdhLink)(m_pOldLinkBefore->GetEngineStruct()) : NULL, m_pOldLinkAfter ? (WP_tdhLink)(m_pOldLinkAfter->GetEngineStruct()) : NULL, m_stDeletePosWP);
m_pWay->fn_vRefresh();
// refresh the dialog if it's open
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog ();
// refreh the waypoint dialog
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate();
if (m_DialogRefresh) m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
m_pWay->fn_vNotifySave ();
return TRUE;
}
ModifWayRemove::ModifWayRemove (Way* pWay, WayPoint* pRemoveWP, BOOL pBlock) : CPA_Modif (TYPE_REMOVE_WP,"Remove WP",pBlock)
{
m_pWay = pWay;
m_pWay->GetInterface()->fn_bComputeRealWay (&m_pWay);
m_pRemoveWP = pRemoveWP;
m_lNbRemoveWP = 0;
m_dstRemovePosWP = NULL;
m_dpoRemoveLinkBefore = NULL;
m_dpoRemoveLinkAfter = NULL;
}
BOOL ModifWayRemove::Do (void)
{
POSITION lPos;
WayPoint* poWP;
// we count the number of waypoint to remove
m_lNbRemoveWP=0;
for
(
poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPos);
poWP;
poWP=m_pWay->GetListWaypoint()->GetNextElement(lPos)
)
if (poWP==m_pRemoveWP) m_lNbRemoveWP++;
// we allocate the array of position
m_dstRemovePosWP = new WP_tduc_WPIndex [m_lNbRemoveWP];
m_dpoRemoveLinkBefore = new Link* [m_lNbRemoveWP];
m_dpoRemoveLinkAfter = new Link* [m_lNbRemoveWP];
long lIndexRemoveWP = 0; // indice in the array
for (lIndexRemoveWP=0; lIndexRemoveWP<m_lNbRemoveWP; lIndexRemoveWP++)
{
POSITION lPosLinkBefore=0, lPosLinkAfter=0, lPosLink=0;
// delete object in the engine structure
m_dstRemovePosWP[lIndexRemoveWP] = WP_fnuc_Way_PositionWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), (WP_tdhWayPoint)(m_pRemoveWP->GetStruct()));
m_dpoRemoveLinkBefore[lIndexRemoveWP] = m_pWay->fn_pGetLink (m_dstRemovePosWP[lIndexRemoveWP]-1);
m_dpoRemoveLinkAfter[lIndexRemoveWP] = m_pWay->fn_pGetLink (m_dstRemovePosWP[lIndexRemoveWP]);
Link* poLink = NULL;
if (m_dpoRemoveLinkBefore[lIndexRemoveWP] && m_dpoRemoveLinkAfter[lIndexRemoveWP])
{
poLink = m_dpoRemoveLinkBefore[lIndexRemoveWP]->fn_pMergeLink (m_pWay, m_dpoRemoveLinkAfter[lIndexRemoveWP] );
poLink->fn_vSetAddInHierarchy (TRUE);
}
// delete object in the editor list
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPos); poWP && poWP!=m_pRemoveWP; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPos) );
if (poWP==m_pRemoveWP) m_pWay->GetListWaypoint()->RemoveAt(lPos);
// replace link in the editor list
if (m_dstRemovePosWP[lIndexRemoveWP]) lPosLinkBefore=m_pWay->GetListLink()->FindIndex (m_dstRemovePosWP[lIndexRemoveWP]-1);
lPosLinkAfter = m_pWay->GetListLink()->FindIndex (m_dstRemovePosWP[lIndexRemoveWP]);
if (lPosLinkBefore) m_pWay->GetListLink()->RemoveAt (lPosLinkBefore);
if (lPosLinkAfter) m_pWay->GetListLink()->RemoveAt (lPosLinkAfter);
if (m_dstRemovePosWP[lIndexRemoveWP]>=2) lPosLink = m_pWay->GetListLink()->FindIndex (m_dstRemovePosWP[lIndexRemoveWP]-2);
if (lPosLinkBefore && lPosLinkAfter)
{
if (lPosLink) m_pWay->GetListLink()->InsertAfter ( lPosLink, poLink );
else m_pWay->GetListLink()->AddHead (poLink);
}
WP_fnv_Way_DeleteWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), m_dstRemovePosWP[lIndexRemoveWP],poLink ? (WP_tdhLink)(poLink->GetEngineStruct()) : NULL );
// Links
if (m_dpoRemoveLinkBefore[lIndexRemoveWP]) m_dpoRemoveLinkBefore[lIndexRemoveWP]->fn_vSetRemoveInHierarchy (TRUE);
if (m_dpoRemoveLinkAfter[lIndexRemoveWP]) m_dpoRemoveLinkAfter[lIndexRemoveWP]->fn_vSetRemoveInHierarchy (TRUE);
}
// refreh the waypoint dialog
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate();
// refresh the dialog if it's open
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog();
m_pWay->fn_vRefresh();
m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
if (m_pWay->IsWayEmpty())
{
m_pWay->fn_vNotifyUnSave ();
m_pWay->fn_vSetRecreate (TRUE);
if (m_pWay->GetSuperObject()->GetParent())
{
Way::GetInterface()->fn_vSetModifDeleteOk (TRUE);
Way::GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_pWay->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetModifDeleteOk (FALSE);
}
}
else m_pWay->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayRemove::Undo (void)
{
POSITION lPos;
WayPoint* poWP;
long lWP;
long lIndexRemoveWP = 0;
if (m_pWay->IsWayEmpty())
{
Way::GetInterface()->fn_vSetRefreshWay (TRUE);
if (!m_pWay->GetSuperObject()->GetParent()) Way::GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy (m_pWay->GetSuperObject(), Way::GetInterface()->GetInterface()->GetSpecificInterface()->GetDynamicRoot(), FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetRefreshWay (FALSE);
}
// reinsert the object in the motor structure
for (lIndexRemoveWP=m_lNbRemoveWP-1; lIndexRemoveWP>=0; lIndexRemoveWP--)
{
WP_fnv_Way_InsertWayPoint ((WP_tdhWay)(m_pWay->GetStruct()), (WP_tdhWayPoint)(m_pRemoveWP->GetStruct()), m_dpoRemoveLinkBefore[lIndexRemoveWP] ? (WP_tdhLink)(m_dpoRemoveLinkBefore[lIndexRemoveWP]->GetEngineStruct()) : NULL, m_dpoRemoveLinkAfter[lIndexRemoveWP] ? (WP_tdhLink)(m_dpoRemoveLinkAfter[lIndexRemoveWP]->GetEngineStruct()) : NULL, m_dstRemovePosWP[lIndexRemoveWP]);
// search the position in the editor list to reinsert and do it
for (poWP=m_pWay->GetListWaypoint()->GetHeadElement(lPos), lWP=0; poWP && lWP!=m_dstRemovePosWP[lIndexRemoveWP]; poWP=m_pWay->GetListWaypoint()->GetNextElement(lPos),lWP++);
if (poWP) m_pWay->GetListWaypoint()->InsertBefore(lPos,m_pRemoveWP);
else m_pWay->GetListWaypoint()->AddTail(m_pRemoveWP);
// list links
if (m_dstRemovePosWP[lIndexRemoveWP]<2)
{
if (m_dpoRemoveLinkAfter[lIndexRemoveWP] && m_dpoRemoveLinkBefore[lIndexRemoveWP])
{
m_pWay->GetListLink()->GetHead()->fn_vSetRemoveInHierarchy (TRUE);
m_pWay->GetListLink()->RemoveHead ();
}
if (m_dpoRemoveLinkAfter[lIndexRemoveWP]) m_pWay->GetListLink()->AddHead (m_dpoRemoveLinkAfter[lIndexRemoveWP]);
if (m_dpoRemoveLinkBefore[lIndexRemoveWP]) m_pWay->GetListLink()->AddHead (m_dpoRemoveLinkBefore[lIndexRemoveWP]);
}
else
{
POSITION lPosLastLink = m_pWay->GetListLink()->FindIndex (m_dstRemovePosWP[lIndexRemoveWP]-1);
if (lPosLastLink)
{
m_pWay->GetListLink()->GetAt ( lPosLastLink )->fn_vSetRemoveInHierarchy (TRUE);
m_pWay->GetListLink()->RemoveAt ( lPosLastLink );
}
POSITION lPosInsertLink = m_pWay->GetListLink()->FindIndex ( m_dstRemovePosWP[lIndexRemoveWP]-2 );
if (m_dpoRemoveLinkBefore[lIndexRemoveWP]) m_pWay->GetListLink()->InsertAfter (lPosInsertLink, m_dpoRemoveLinkBefore[lIndexRemoveWP]);
m_pWay->GetListLink()->GetNextElement (lPosInsertLink);
if (m_dpoRemoveLinkAfter[lIndexRemoveWP]) m_pWay->GetListLink()->InsertAfter (lPosInsertLink, m_dpoRemoveLinkAfter[lIndexRemoveWP]);
}
// Links
if (m_dpoRemoveLinkBefore[lIndexRemoveWP]) m_dpoRemoveLinkBefore[lIndexRemoveWP]->fn_vSetAddInHierarchy (TRUE);
if (m_dpoRemoveLinkAfter[lIndexRemoveWP]) m_dpoRemoveLinkAfter[lIndexRemoveWP]->fn_vSetAddInHierarchy (TRUE);
}
delete[] m_dstRemovePosWP;
delete[] m_dpoRemoveLinkBefore;
delete[] m_dpoRemoveLinkAfter;
m_dstRemovePosWP=NULL;
m_dpoRemoveLinkBefore=NULL;
m_dpoRemoveLinkAfter=NULL;
if (m_pWay->fn_bIsDialog()) m_pWay->fn_pGetDialog()->fn_vRefreshDialog(lWP);
// refreh the waypoint dialog
m_pWay->GetInterface()->fn_vRefreshWaypointCoordinate();
m_pWay->fn_vRefresh();
m_pWay->GetInterface()->fn_vRefreshHierarchyList ();
m_pWay->fn_vNotifySave ();
return TRUE;
}
// Add a new WP in the net
ModifWayAddWP::ModifWayAddWP ( Way* poWay, MTH3D_tdstVector* pAbsolutePosition, WP_tduc_WPIndex stBeforeWP, CPA_Interface* pEditor, BOOL pBlock ) : CPA_Modif (TYPE_ADD_NEW_WP,"Add new WP", pBlock )
{
m_poWay = poWay;
m_poWay->GetInterface()->fn_bComputeRealWay (&m_poWay);
m_pAbsolutePosition = pAbsolutePosition;
m_pEditor = pEditor;
m_poWay->GetInterface()->fn_vSetNextInstanceInWay ();
m_poSuperWP = m_pEditor->GetNewInstance ("Waypoint", "Waypoint");
HIE_fn_vSetSuperObjectDrawMask(m_poSuperWP->GetStruct(), C_lTexturedElement);
m_pModifInsertWP=NULL;
m_stPosBeforeWP = stBeforeWP;
// compute position of the WayPoint
POS_tdstCompletePosition InvWorldMatrix;
POS_fn_vSetIdentityMatrix(&InvWorldMatrix);
HIE_tdxHandleToSuperObject hSuperWorldEngine = ((DEV_MultiDevice3D *)(m_pEditor->GetMultiDevice()))->GetEngineWorld();
CPA_SuperObject* poSuperWorldEditor = ((DEV_MultiDevice3D *)(m_pEditor->GetMultiDevice()))->GetWorld()->GetRoot();
// set absolute position
GEO_tdxHandleToMatrix hAbsoluteWorldMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (hSuperWorldEngine);
GEO_tdxHandleToMatrix hAbsoluteWPMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (m_poSuperWP->GetStruct());
GEO_tdxHandleToMatrix hRelativeWPMatrix = HIE_fn_hGetSuperObjectMatrix (m_poSuperWP->GetStruct());
POS_fn_vSetIdentityMatrix( hAbsoluteWPMatrix ) ;
POS_fn_vSetTranslationVector
(
hAbsoluteWPMatrix,
m_pAbsolutePosition
);
// compute relative position
POS_fn_vInvertIsoMatrix( &InvWorldMatrix, hAbsoluteWorldMatrix );
POS_fn_vMulMatrixMatrix
(
hRelativeWPMatrix,
&InvWorldMatrix,
hAbsoluteWPMatrix
);
// Set the name
SetName(CString("Add new ")+CString(m_poSuperWP->GetObject()->GetName())+CString(" to ")+CString(m_poWay->GetName()));
}
BOOL ModifWayAddWP::Do (void)
{
CPA_SuperObject* poSuperWorldEditor = ((DEV_MultiDevice3D *)(m_pEditor->GetMultiDevice()))->GetWorld()->GetRoot();
m_poWay->GetInterface()->GetInterface()->fn_bInsertObjectInHierarchy ( m_poSuperWP, m_poWay->GetInterface()->GetInterface()->GetSpecificInterface()->GetDynamicRoot(),FALSE,FALSE, FALSE );
// set the status of the waypoint
((WayPoint*)(m_poSuperWP->GetObject()))->fn_vSetAlone (FALSE);
// Set the engine structure
((WayPoint*)(m_poSuperWP->GetObject()))->fn_vComputeMotorStructure ();
m_pModifInsertWP = new ModifWayInsert (m_poWay, (WayPoint*)(m_poSuperWP->GetObject()), m_stPosBeforeWP );
m_pModifInsertWP->Do ();
m_poWay->fn_vNotifySave ();
return TRUE;
}
BOOL ModifWayAddWP::Undo (void)
{
CPA_SuperObject* poSuperWorldEditor = ((DEV_MultiDevice3D *)(m_pEditor->GetMultiDevice()))->GetWorld()->GetRoot();
// delete the add waypoint from the hiearchie
m_pModifInsertWP->Undo ();
Way::GetInterface()->fn_vSetModifDeleteOk (TRUE);
m_poWay->GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy ( m_poSuperWP,FALSE,FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetModifDeleteOk (FALSE);
delete m_pModifInsertWP;
m_pModifInsertWP=NULL;
// test jt
if (m_poWay->IsWayEmpty())
{
m_poWay->fn_vNotifyUnSave ();
m_poWay->fn_vSetRecreate (TRUE);
if (m_poWay->GetSuperObject()->GetParent())
{
Way::GetInterface()->fn_vSetModifDeleteOk (TRUE);
Way::GetInterface()->GetInterface()->fn_bDeleteObjectInHierarchy (m_poWay->GetSuperObject(), FALSE, FALSE, FALSE, FALSE );
Way::GetInterface()->fn_vSetModifDeleteOk (FALSE);
}
}
else m_poWay->fn_vNotifySave ();
m_pEditor->fn_vUpdateAll (E_mc_JustDraw);
// m_poWay->fn_vNotifySave ();
return TRUE;
}
*/
//ENDANNECY Shaitan Nettoyage }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

View File

@@ -0,0 +1,337 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : EditDia.cpp
//
// General dialog edition
// - to change the super object name
// - to indicate what is visible
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 10 mar 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "EditDia.h"
#include "WPObj.hpp"
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "WayDia.hpp"
*/
//ENDANNECY Shaitan Nettoyage }
#include "Inter.hpp"
#include "x:\cpa\main\inc\_editid.h"
#include "oac.h"
#include "gam.h"
#include "x:/cpa/main/inc/_EditId.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// EditDia
IMPLEMENT_DYNCREATE(EditDia, CFormView)
EditDia::EditDia(void)
: CFormView(EditDia::IDD)
{
//{{AFX_DATA_INIT(EditDia)
//}}AFX_DATA_INIT
}
void EditDia::fn_vSetInterface (Waypoint_Interface* poInterface)
{
m_poInterface = poInterface;
}
void EditDia::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EditDia)
DDX_Control(pDX, IDC_EDIT_TAB, m_oTab);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(EditDia, CFormView)
//{{AFX_MSG_MAP(EditDia)
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ON_RADIO, OnEditWaypointOnRadio)
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_OFF_RADIO, OnEditWaypointOffRadio)
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ALL_RADIO, OnEditWaypointAllRadio)
ON_BN_CLICKED(IDC_EDIT_WAYPOINT_ISOLATE_RADIO, OnEditWaypointIsolateRadio)
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
ON_NOTIFY(TCN_SELCHANGE, IDC_EDIT_TAB, OnSelchangeEditTab)
ON_BN_CLICKED(IDC_EDIT_WAY_OFF_RADIO, OnEditWayOffRadio)
ON_BN_CLICKED(IDC_EDIT_WAY_ON_RADIO, OnEditWayOnRadio)
ON_BN_CLICKED(IDC_EDIT_WAY_SELECTED_RADIO, OnEditWaySelectedRadio)
*/
//ENDANNECY Shaitan Nettoyage }
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void EditDia::fn_vInit (void)
{
UpdateData (FALSE);
CTabCtrl* poTab = (CTabCtrl*)GetDlgItem (IDC_EDIT_TAB);
TC_ITEM stTabCtrlItemAll;
stTabCtrlItemAll.mask = TCIF_TEXT;
stTabCtrlItemAll.pszText = "All";
poTab->InsertItem( 0, &stTabCtrlItemAll );
poTab->SetItemSize( CSize (30,18) );
GetDlgItem (IDC_EDIT_WAY_ON_RADIO)->Invalidate ();
GetDlgItem (IDC_EDIT_WAY_OFF_RADIO)->Invalidate ();
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->Invalidate ();
CheckRadioButton( IDC_EDIT_WAYPOINT_ISOLATE_RADIO, IDC_EDIT_WAYPOINT_ALL_RADIO, WayPoint::fn_bDrawJustIsolateWaypoint() ? IDC_EDIT_WAYPOINT_ISOLATE_RADIO : IDC_EDIT_WAYPOINT_ALL_RADIO );
CheckRadioButton( IDC_EDIT_WAYPOINT_ON_RADIO, IDC_EDIT_WAYPOINT_OFF_RADIO, WayPoint::fn_bIsWaypointScreen() ? IDC_EDIT_WAYPOINT_ON_RADIO : IDC_EDIT_WAYPOINT_OFF_RADIO );
}
void EditDia::OnEditWaypointOnRadio()
{
// Enable buttons
GetDlgItem (IDC_EDIT_WAYPOINT_ISOLATE_RADIO)->EnableWindow(TRUE);
GetDlgItem (IDC_EDIT_WAYPOINT_ALL_RADIO)->EnableWindow(TRUE);
WayPoint::fn_vSetWaypointOnScreen (TRUE);
m_poInterface->fn_vRefreshScreen ();
}
void EditDia::OnEditWaypointOffRadio()
{
// Disable buttons
GetDlgItem (IDC_EDIT_WAYPOINT_ISOLATE_RADIO)->EnableWindow(FALSE);
GetDlgItem (IDC_EDIT_WAYPOINT_ALL_RADIO)->EnableWindow(FALSE);
WayPoint::fn_vSetWaypointOnScreen (FALSE);
m_poInterface->fn_vRefreshScreen ();
}
void EditDia::OnEditWaypointAllRadio()
{
WayPoint::fn_vSetDrawJustIsolateWaypoint (FALSE);
m_poInterface->fn_vRefreshScreen ();
}
void EditDia::OnEditWaypointIsolateRadio()
{
WayPoint::fn_vSetDrawJustIsolateWaypoint (TRUE);
m_poInterface->fn_vRefreshScreen ();
}
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
void EditDia::OnSelchangeEditTab(NMHDR* pNMHDR, LRESULT* pResult)
{
if (pNMHDR->idFrom==IDC_EDIT_TAB)
{
int iIndex = m_oTab.GetCurSel();
switch (iIndex)
{
case 0: // All
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (Way::fn_eGetDisplayAllWay()) );
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
break;
case 1: // Actor
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId ((tdeWayDisplay)m_poInterface->fn_pGetSelectedEdtList()->fn_lGetDrawObjects() ) );
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
break;
case 2: // Way
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (((Way*)m_poInterface->fn_pGetSelectedWay())->fn_eGetDisplayWay() ) );
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_HIDE);
break;
}
}
*pResult = 0;
}
long EditDia::fn_lGetId (long lWayDisplay)
{
tdeWayDisplay eWayDisplay = (tdeWayDisplay)lWayDisplay;
switch (eWayDisplay)
{
case eWayDisplayOn : return IDC_EDIT_WAY_ON_RADIO;
case eWayDisplayOff : return IDC_EDIT_WAY_OFF_RADIO;
case eWayDisplaySelected : return IDC_EDIT_WAY_SELECTED_RADIO;
default :return 0;
}
}
void EditDia::OnEditWayOffRadio()
{
fn_vSetDisplay (eWayDisplayOff);
}
void EditDia::OnEditWayOnRadio()
{
fn_vSetDisplay (eWayDisplayOn);
}
void EditDia::OnEditWaySelectedRadio()
{
fn_vSetDisplay (eWayDisplaySelected);
}
void EditDia::fn_vSetDisplay ( long lDisplayState )
{
tdeWayDisplay eDisplayState = (tdeWayDisplay)lDisplayState;
int iIndex = m_oTab.GetCurSel();
// set flags to object
fn_vSetFlags ( iIndex, lDisplayState );
// set all previous tab to selected
if (eDisplayState!=eWayDisplayOff)
{
for ( int iCounter=0; iCounter<iIndex; iCounter++)
fn_vSetFlags ( iCounter, (long)eWayDisplaySelected );
}
// Draw screen
m_poInterface->fn_vRefreshScreen ();
}
void EditDia::fn_vSetFlags ( int iIndex, long lDisplayState )
{
tdeWayDisplay eDisplayState = (tdeWayDisplay)lDisplayState;
switch (iIndex)
{
case 0: // all
Way::fn_vSetDisplayAllWay (eDisplayState);
break;
case 1: // instance actor
m_poInterface->fn_poGetEdtListUseByActor (m_poInterface->fn_pGetSelectedInstance ())->fn_vSetDrawObjects ((long)eDisplayState);
break;
case 2 : // way
((Way*)m_poInterface->fn_pGetSelectedWay())->fn_vSetDisplayWay(eDisplayState);
break;
}
}
*/
//ENDANNECY Shaitan Nettoyage }
void EditDia::fn_vRefresh (void)
{
// add
if (m_poInterface->fn_pGetSelectedEdtList() && m_oTab.GetItemCount()==1)
{
TC_ITEM stTabCtrlItemActor;
stTabCtrlItemActor.mask = TCIF_TEXT;
stTabCtrlItemActor.pszText = "Actor";
m_oTab.InsertItem( 1, &stTabCtrlItemActor );
}
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
if (m_poInterface->fn_pGetSelectedWay() && m_oTab.GetItemCount()==2)
{
TC_ITEM stTabCtrlItemWay;
stTabCtrlItemWay.mask = TCIF_TEXT;
stTabCtrlItemWay.pszText = "Way";
m_oTab.InsertItem( 2, &stTabCtrlItemWay );
}
// retrieve
if (!m_poInterface->fn_pGetSelectedWay() && m_oTab.GetItemCount()==3)
{
m_oTab.SetCurSel (1);
m_oTab.DeleteItem (2);
}
*/
//ENDANNECY Shaitan Nettoyage }
if (!m_poInterface->fn_pGetSelectedEdtList() && m_oTab.GetItemCount()==2)
{
m_oTab.SetCurSel (0);
m_oTab.DeleteItem (1);
}
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
// refresh
int iIndex = m_oTab.GetCurSel();
switch (iIndex)
{
case 0: // All
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId (Way::fn_eGetDisplayAllWay()) );
break;
case 1: // Actor
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_SELECTED_RADIO, fn_lGetId ((tdeWayDisplay)m_poInterface->fn_pGetSelectedEdtList()->fn_lGetDrawObjects() ) );
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_SHOW);
break;
case 2: // Way
CheckRadioButton( IDC_EDIT_WAY_ON_RADIO, IDC_EDIT_WAY_OFF_RADIO, fn_lGetId (((Way*)m_poInterface->fn_pGetSelectedWay())->fn_eGetDisplayWay() ) );
GetDlgItem (IDC_EDIT_WAY_SELECTED_RADIO)->ShowWindow (SW_HIDE);
break;
}
*/
//ENDANNECY Shaitan Nettoyage }
Invalidate ();
}
BOOL EditDia::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_DisplayControlDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ON_RADIO,"OWP_DisplayWaypointOn",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_OFF_RADIO,"OWP_DisplayWaypointOff",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ALL_RADIO,"OWP_DisplayWaypointAll",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_WAYPOINT_ISOLATE_RADIO,"OWP_DisplayIsolateWaypoint",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_TAB,"OWP_DisplayControlTab",TUT_e_Window); // <- Onglet
TUT_M_vRegisterControlID (IDC_EDIT_WAY_OFF_RADIO,"OWP_DisplayWayOff",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_WAY_ON_RADIO,"OWP_DisplayWayOn",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_EDIT_WAY_SELECTED_RADIO,"OWP_DisplayWaySelected",TUT_e_Button);
return bCreate;
}
void EditDia::OnDestroy()
{
CFormView::OnDestroy();
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ON_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_OFF_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ALL_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_WAYPOINT_ISOLATE_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_TAB);
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_OFF_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_ON_RADIO);
TUT_M_vUnregisterControlID (IDC_EDIT_WAY_SELECTED_RADIO);
}

View File

@@ -0,0 +1,119 @@
//ROMTEAM Networks (Gabriela Dumitrascu 25/02/98)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : IsoWpDia.cpp
//
// Definition of the waypoint ,implementation file
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from : CDialog
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 1998-02-23 Author: CPA2 Gabriela Dumitrascu
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incai.h"
#include "WPObj.hpp"
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "WayDia.hpp"
*/
//ENDANNECY Shaitan Nettoyage }
#include "WPDia.hpp"
#include "Inter.hpp"
#include "x:\cpa\main\inc\_EditId.h"
#include "isowpdia.hpp"
#include "tut.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// IsoWPDia dialog
IsoWPDia::IsoWPDia(CWnd* pParent /*=NULL*/)
: CDialog(IsoWPDia::IDD, pParent)
{
//{{AFX_DATA_INIT(IsoWPDia)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void IsoWPDia::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(IsoWPDia)
DDX_Control(pDX, IDC_LIST_WP, m_IsoWpList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(IsoWPDia, CDialog)
//{{AFX_MSG_MAP(IsoWPDia)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// IsoWPDia message handlers
void IsoWPDia::OnOK()
{
int i = 0;
POSITION lPos;
m_oListOfSelWP.RemoveAll();
for (WayPoint* poWP = m_oListOfWP.GetHeadElement(lPos); poWP; poWP = m_oListOfWP.GetNextElement(lPos), i++)
{
if (m_IsoWpList.GetSel(i))
m_oListOfSelWP.AddTail(poWP);
}
CDialog::OnOK();
}
BOOL IsoWPDia::OnInitDialog()
{
CDialog::OnInitDialog();
WayPoint* poWP;
POSITION lPos;
for (poWP = m_oListOfWP.GetHeadElement(lPos); poWP; poWP = m_oListOfWP.GetNextElement(lPos))
m_IsoWpList.AddString(poWP->GetName());
return TRUE;
}
BOOL IsoWPDia::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
TUT_M_vGetTutDll ();
TUT_M_vRegisterControlID (IDC_LIST_WP, "IsoWp_List",TUT_e_ListBox);
TUT_M_vRegisterControlID (IDOK, "WP_Ok", TUT_e_Button);
TUT_M_vRegisterControlID (IDCANCEL, "WP_Cancel",TUT_e_Button);
return CDialog::Create(IDD, pParentWnd);
}
void IsoWPDia::OnDestroy()
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControlID (IDC_LIST_WP);
TUT_M_vUnregisterControlID (IDOK );
TUT_M_vUnregisterControlID (IDCANCEL );
CDialog::OnDestroy();
}
//ENDROMTEAM Networks (Gabriela Dumitrascu)

View File

@@ -0,0 +1,372 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : LinkDia.cpp
//
// Dialog edition the ways
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "incGli.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "LinkDia.hpp"
#include "LkBezDia.h"
#include "x:/cpa/main/inc/_EditId.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// DiaLink
IMPLEMENT_DYNCREATE(DiaLink, CFormView)
DiaLink::DiaLink()
: CFormView(DiaLink::IDD)
{
//{{AFX_DATA_INIT(DiaLink)
m_szLinkName = _T("");
m_oSpeedMode = _T("");
m_fSpeed1 = 0.0f;
m_fSpeed2 = 0.0f;
m_fSpeed3 = 0.0f;
//}}AFX_DATA_INIT
m_poLink = NULL;
m_pSpecificDialog = NULL;
}
DiaLink::~DiaLink()
{
}
void DiaLink::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DiaLink)
DDX_CBString(pDX, IDC_LINK_COMBO, m_szLinkName);
DDV_MaxChars(pDX, m_szLinkName, 15);
DDX_CBString(pDX, IDC_LINK_SPEED_COMBO, m_oSpeedMode);
DDV_MaxChars(pDX, m_oSpeedMode, 15);
DDX_Text(pDX, IDC_LINK_SPEED1_EDIT, m_fSpeed1);
DDV_MinMaxFloat(pDX, m_fSpeed1, 0.f, 9999.99f);
DDX_Text(pDX, IDC_LINK_SPEED2_EDIT, m_fSpeed2);
DDV_MinMaxFloat(pDX, m_fSpeed2, 0.f, 9999.99f);
DDX_Text(pDX, IDC_LINK_SPEED3_EDIT, m_fSpeed3);
DDV_MinMaxFloat(pDX, m_fSpeed3, 0.f, 9999.99f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DiaLink, CFormView)
//{{AFX_MSG_MAP(DiaLink)
ON_CBN_SELCHANGE(IDC_LINK_COMBO, OnSelchangeLinkCombo)
ON_CBN_SELCHANGE(IDC_LINK_SPEED_COMBO, OnSelchangeLinkSpeedCombo)
ON_EN_KILLFOCUS(IDC_LINK_SPEED1_EDIT, OnKillfocusLinkSpeed1Edit)
ON_EN_KILLFOCUS(IDC_LINK_SPEED2_EDIT, OnKillfocusLinkSpeed2Edit)
ON_EN_KILLFOCUS(IDC_LINK_SPEED3_EDIT, OnKillfocusLinkSpeed3Edit)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void DiaLink::fn_vInitDialog (void)
{
POSITION xPos;
tdst_LinkObject* pstDefLink;
CComboBox* pComboLink = (CComboBox*) GetDlgItem (IDC_LINK_COMBO);
CComboBox* pComboSpeed = (CComboBox*) GetDlgItem (IDC_LINK_SPEED_COMBO);
for ( pstDefLink=Link::fn_pGetListObject()->GetHeadElement(xPos); pstDefLink; pstDefLink=Link::fn_pGetListObject()->GetNextElement(xPos) )
pComboLink->AddString (pstDefLink->szName);
pComboLink->EnableWindow (FALSE);
pComboSpeed->AddString ("none");
pComboSpeed->AddString ("constant");
pComboSpeed->AddString ("linear");
pComboSpeed->AddString ("sinus");
GetDlgItem (IDC_LINK_SPEED_GROUPBOX)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED_COMBO)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (FALSE);
}
void DiaLink::fn_vEdit (Link* poLink)
{
if (m_poLink==poLink) return;
// Aspect of the dialog
if (!m_poLink && poLink)
{
GetDlgItem (IDC_LINK_COMBO)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED_GROUPBOX)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED_COMBO)->EnableWindow (TRUE);
}
else if (m_poLink && !poLink)
{
GetDlgItem (IDC_LINK_COMBO)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED_GROUPBOX)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED_COMBO)->EnableWindow (FALSE);
}
if (m_poLink) m_poLink->fn_vStopEdit ();
m_poLink=poLink;
if (m_poLink) m_poLink->fn_vStartEdit ();
if (m_poLink)
{
ACP_tdstDynaParam stDynParam;
WP_fnv_Link_GetDynamicParameter ( (WP_tdhLink)(m_poLink->GetEngineStruct()), &stDynParam );
unsigned char ucDynamicType;
float dSpeed1, dSpeed2, dSpeed3;
GetParent()->SetWindowText ( "" );
m_szLinkName = m_poLink->fn_pGetName ();
fn_vDynamicObject_GetParams( &stDynParam, &ucDynamicType, &dSpeed1, &dSpeed2, &dSpeed3);
m_fSpeed1 = dSpeed1;
m_fSpeed2 = dSpeed2;
m_fSpeed3 = dSpeed3;
switch (ucDynamicType)
{
case C_ucNone : m_oSpeedMode = CString ("none"); break;
case C_ucConst : m_oSpeedMode = CString ("constant"); break;
case C_ucLinear : m_oSpeedMode = CString ("linear"); break;
case C_ucSinus : m_oSpeedMode = CString ("sinus"); break;
default: ucDynamicType=C_ucNone;
m_oSpeedMode = CString ("none");
break;
}
UpdateData (FALSE);
fn_vDrawDynParamDialog ();
fn_vChangeDialog ();
}
else
{
GetParent()->SetWindowText ( "no link to edit" );
m_szLinkName = "";
m_oSpeedMode = CString ("");
GetDlgItem (IDC_LINK_SPEED1_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED2_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED3_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (FALSE);
UpdateData (FALSE);
}
GetParent()->GetParent()->RedrawWindow (NULL, NULL, RDW_INVALIDATE|RDW_FRAME);
}
/////////////////////////////////////////////////////////////////////////////
// DiaLink diagnostics
#ifdef _DEBUG
void DiaLink::AssertValid() const
{
CFormView::AssertValid();
}
void DiaLink::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// DiaLink message handlers
void DiaLink::OnSelchangeLinkCombo(void)
{
UpdateData (TRUE);
Way* poParentWay = (Way*) (((CPA_SuperObject*)(m_poLink->GetSuperObject())->GetParent())->GetObject());
Link* pNewLink = Link::CloneLink ( poParentWay, m_poLink, m_szLinkName );
poParentWay->fn_bChangeLink ( m_poLink, pNewLink );
m_poLink = pNewLink;
fn_vChangeDialog ();
}
void DiaLink::fn_vChangeDialog (void)
{
RECT stRect;
GetDlgItem (IDC_DYNAMIC_DIALOG)->GetWindowRect( &stRect );
ScreenToClient( &stRect ) ;
if (m_pSpecificDialog)
{
m_poLink->fn_vFreeSpecificDialog (m_pSpecificDialog);
delete m_pSpecificDialog;
}
m_pSpecificDialog = m_poLink->fn_pGetSpecificDialog (this);
if (m_pSpecificDialog) m_pSpecificDialog->MoveWindow( &stRect, TRUE );
}
//--------------------------- Dynamic Param Edition
void DiaLink::fn_vSetDynParam (void)
{
ACP_tdstDynaParam stDynParam;
WP_fnv_Link_GetDynamicParameter ( (WP_tdhLink)(m_poLink->GetEngineStruct()), &stDynParam );
WP_tde_ucConnectionDynamicType eConnectionType;
unsigned char ucDynamicType;
UpdateData (TRUE);
if ( m_oSpeedMode=="none" ) { ucDynamicType=C_ucNone; eConnectionType=WP_ConDynType_ucNone; }
else if ( m_oSpeedMode=="constant" ) { ucDynamicType=C_ucConst; eConnectionType=WP_ConDynType_ucConstant; }
else if ( m_oSpeedMode=="linear" ) { ucDynamicType=C_ucLinear; eConnectionType=WP_ConDynType_ucLinear; }
else if ( m_oSpeedMode=="sinus" ) { ucDynamicType=C_ucSinus; eConnectionType=WP_ConDynType_ucSinus; }
fn_vDynamicObject_ChangeParams( &stDynParam, ucDynamicType, m_fSpeed1, m_fSpeed2, m_fSpeed3);
WP_fnv_Link_SetDynamicParameter ( (WP_tdhLink)(m_poLink->GetEngineStruct()), &stDynParam );
WP_fnv_Link_SetConnectionDynamicType ( (WP_tdhLink)(m_poLink->GetEngineStruct()), eConnectionType );
m_poLink->fn_vWayNotifySave ();
}
void DiaLink::fn_vDrawDynParamDialog (void)
{
UpdateData (TRUE);
if ( m_oSpeedMode=="none" )
{
GetDlgItem (IDC_LINK_SPEED1_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED2_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED3_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (FALSE);
}
else if ( m_oSpeedMode=="constant" )
{
GetDlgItem (IDC_LINK_SPEED1_STATIC)->SetWindowText( "speed" );
GetDlgItem (IDC_LINK_SPEED2_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED3_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (FALSE);
}
else if ( m_oSpeedMode=="linear" )
{
GetDlgItem (IDC_LINK_SPEED1_STATIC)->SetWindowText( "start speed" );
GetDlgItem (IDC_LINK_SPEED2_STATIC)->SetWindowText( "end speed" );
GetDlgItem (IDC_LINK_SPEED3_STATIC)->SetWindowText( "" );
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (FALSE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (FALSE);
}
else if ( m_oSpeedMode=="sinus" )
{
GetDlgItem (IDC_LINK_SPEED1_STATIC)->SetWindowText( "start angle" );
GetDlgItem (IDC_LINK_SPEED2_STATIC)->SetWindowText( "end angle" );
GetDlgItem (IDC_LINK_SPEED3_STATIC)->SetWindowText( "max speed" );
GetDlgItem (IDC_LINK_SPEED1_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED3_STATIC)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED1_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED2_EDIT)->EnableWindow (TRUE);
GetDlgItem (IDC_LINK_SPEED3_EDIT)->EnableWindow (TRUE);
}
}
void DiaLink::OnSelchangeLinkSpeedCombo()
{
fn_vDrawDynParamDialog ();
fn_vSetDynParam ();
}
void DiaLink::OnKillfocusLinkSpeed1Edit()
{
fn_vSetDynParam ();
}
void DiaLink::OnKillfocusLinkSpeed2Edit()
{
fn_vSetDynParam ();
}
void DiaLink::OnKillfocusLinkSpeed3Edit()
{
fn_vSetDynParam ();
}
BOOL DiaLink::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_LinkDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_LINK_COMBO,"OWP_LinkTypeCombo",TUT_e_ComboBox);
TUT_M_vRegisterControlID (IDC_LINK_SPEED_COMBO,"OWP_LinkSpeedCombo",TUT_e_ComboBox);
TUT_M_vRegisterControlID (IDC_LINK_SPEED1_EDIT,"OWP_LinkSpeed1Edit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_LINK_SPEED2_EDIT,"OWP_LinkSpeed2Edit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_LINK_SPEED3_EDIT,"OWP_LinkSpeed3Edit",TUT_e_TextEdit);
return bCreate;
}
void DiaLink::OnDestroy()
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_LINK_COMBO);
TUT_M_vUnregisterControlID (IDC_LINK_SPEED_COMBO);
TUT_M_vUnregisterControlID (IDC_LINK_SPEED1_EDIT);
TUT_M_vUnregisterControlID (IDC_LINK_SPEED2_EDIT);
TUT_M_vUnregisterControlID (IDC_LINK_SPEED3_EDIT);
}
*/
//ENDANNECY Shaitan Nettoyage }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,342 @@
// rotdia.cpp : implementation file
//
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "rotdia.hpp"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WPObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "WPDia.hpp"
#include "WayDia.hpp"
#include "Inter.hpp"
#include "x:\cpa\main\inc\_editid.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// RotationDia
IMPLEMENT_DYNCREATE(RotationDia, CFormView)
RotationDia::RotationDia()
: CFormView(RotationDia::IDD)
{
//{{AFX_DATA_INIT(RotationDia)
m_fTwist1 = 0.0f;
m_fTwist2 = 0.0f;
m_lTwistLap = 0;
m_lxLap = 0;
m_lyLap = 0;
//}}AFX_DATA_INIT
m_poLink = NULL;
m_bFocusTwist1 = FALSE;
m_bFocusTwist2 = FALSE;
m_bFocusTwistLap = FALSE;
m_bFocusXLap = FALSE;
m_bFocusYLap = FALSE;
}
RotationDia::~RotationDia()
{
}
void RotationDia::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(RotationDia)
DDX_Text(pDX, IDC_TWIST1_EDIT, m_fTwist1);
DDV_MinMaxFloat(pDX, m_fTwist1, 0.f, 360.f);
DDX_Text(pDX, IDC_TWIST2_EDIT, m_fTwist2);
DDV_MinMaxFloat(pDX, m_fTwist2, 0.f, 360.f);
DDX_Text(pDX, IDC_ORIENT_LAP_TWIST_EDIT, m_lTwistLap);
DDX_Text(pDX, IDC_ORIENT_LAP_X_EDIT, m_lxLap);
DDX_Text(pDX, IDC_ORIENT_LAP_Y_EDIT, m_lyLap);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(RotationDia, CFormView)
//{{AFX_MSG_MAP(RotationDia)
ON_EN_KILLFOCUS(IDC_ORIENT_LAP_TWIST_EDIT, OnKillfocusOrientLapTwistEdit)
ON_EN_KILLFOCUS(IDC_ORIENT_LAP_X_EDIT, OnKillfocusOrientLapXEdit)
ON_EN_KILLFOCUS(IDC_ORIENT_LAP_Y_EDIT, OnKillfocusOrientLapYEdit)
ON_BN_CLICKED(IDC_ORIENT_TWIST_DIRECT_RADIO, OnOrientTwistDirectRadio)
ON_BN_CLICKED(IDC_ORIENT_TWIST_INDIRECT_RADIO, OnOrientTwistIndirectRadio)
ON_BN_CLICKED(IDC_ORIENT_X_DIRECT_RADIO, OnOrientXDirectRadio)
ON_BN_CLICKED(IDC_ORIENT_X_INDIRECT_RADIO, OnOrientXIndirectRadio)
ON_BN_CLICKED(IDC_ORIENT_Y_DIRECT_RADIO, OnOrientYDirectRadio)
ON_BN_CLICKED(IDC_ORIENT_Y_INDIRECT_RADIO, OnOrientYIndirectRadio)
ON_EN_KILLFOCUS(IDC_TWIST1_EDIT, OnKillfocusTwist1Edit)
ON_EN_KILLFOCUS(IDC_TWIST2_EDIT, OnKillfocusTwist2Edit)
ON_EN_SETFOCUS(IDC_ORIENT_LAP_TWIST_EDIT, OnSetfocusOrientLapTwistEdit)
ON_EN_SETFOCUS(IDC_ORIENT_LAP_X_EDIT, OnSetfocusOrientLapXEdit)
ON_EN_SETFOCUS(IDC_ORIENT_LAP_Y_EDIT, OnSetfocusOrientLapYEdit)
ON_EN_SETFOCUS(IDC_TWIST1_EDIT, OnSetfocusTwist1Edit)
ON_EN_SETFOCUS(IDC_TWIST2_EDIT, OnSetfocusTwist2Edit)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// RotationDia message handlers
void RotationDia::fn_vInitDialog ( void )
{
fn_vActivateWindow (FALSE);
GetParent()->SetWindowText ( "no orientation to edit" );
}
void RotationDia::fn_vEdit (Link* poLink)
{
BOOL bRedraw=FALSE;
if (!m_poLink && poLink)
{
fn_vActivateWindow (TRUE);
GetParent()->SetWindowText ( "Orientation" );
bRedraw=TRUE;
}
else if (m_poLink && !poLink)
{
fn_vActivateWindow (FALSE);
GetParent()->SetWindowText ( "no orientation to edit" );
bRedraw=TRUE;
}
m_poLink = poLink;
if (m_poLink)
{
CheckRadioButton( IDC_ORIENT_X_DIRECT_RADIO, IDC_ORIENT_X_INDIRECT_RADIO, m_poLink->fn_bIsXDirectOrientation() ? IDC_ORIENT_X_DIRECT_RADIO : IDC_ORIENT_X_INDIRECT_RADIO );
CheckRadioButton( IDC_ORIENT_Y_DIRECT_RADIO, IDC_ORIENT_Y_INDIRECT_RADIO, m_poLink->fn_bIsYDirectOrientation() ? IDC_ORIENT_Y_DIRECT_RADIO : IDC_ORIENT_Y_INDIRECT_RADIO );
CheckRadioButton( IDC_ORIENT_TWIST_DIRECT_RADIO, IDC_ORIENT_TWIST_INDIRECT_RADIO, m_poLink->fn_bIsZDirectOrientation() ? IDC_ORIENT_TWIST_DIRECT_RADIO : IDC_ORIENT_TWIST_INDIRECT_RADIO );
m_lxLap = m_poLink->fn_lGetNbLapXOrientation();
m_lyLap = m_poLink->fn_lGetNbLapYOrientation();
m_lTwistLap = m_poLink->fn_lGetNbLapZOrientation();
m_fTwist1 = m_poLink->fn_xGetFirstTwistOrientation () * 180. / MTH_C_Pi;
m_fTwist2 = m_poLink->fn_xGetSecondTwistOrientation () * 180. / MTH_C_Pi;
m_fTwist1 = ((long) (m_fTwist1*10.f+0.5f))/10.f;
m_fTwist2 = ((long) (m_fTwist2*10.f+0.5f))/10.f;
}
UpdateData (FALSE);
if (bRedraw) GetParent()->GetParent()->RedrawWindow (NULL, NULL, RDW_INVALIDATE|RDW_FRAME);
}
//--------------------------- On Command -> to capture end of edition in edit dialogs
BOOL RotationDia::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (wParam==1)
{
if (m_bFocusTwist1)
{
OnKillfocusTwist1Edit();
m_bFocusTwist1=TRUE;
}
if (m_bFocusTwist2)
{
OnKillfocusTwist2Edit();
m_bFocusTwist2=TRUE;
}
if (m_bFocusTwistLap)
{
OnKillfocusOrientLapTwistEdit();
m_bFocusTwistLap=TRUE;
}
if (m_bFocusXLap)
{
OnKillfocusOrientLapXEdit();
m_bFocusXLap=TRUE;
}
if (m_bFocusYLap)
{
OnKillfocusOrientLapYEdit();
m_bFocusYLap=TRUE;
}
return TRUE;
}
return CFormView::OnCommand(wParam, lParam);
}
//--------------------------- Lap edition
void RotationDia::OnKillfocusOrientLapTwistEdit()
{
UpdateData (TRUE);
m_poLink->fn_vSetNbLapZOrientation ( m_lTwistLap );
m_bFocusTwistLap=FALSE;
}
void RotationDia::OnKillfocusOrientLapXEdit()
{
UpdateData (TRUE);
m_poLink->fn_vSetNbLapXOrientation ( m_lxLap );
m_bFocusXLap=FALSE;
}
void RotationDia::OnKillfocusOrientLapYEdit()
{
UpdateData (TRUE);
m_poLink->fn_vSetNbLapYOrientation ( m_lyLap );
m_bFocusYLap=FALSE;
}
//--------------------------- Direct/Indirect Orientation
void RotationDia::OnOrientTwistDirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetZDirectOrientation (TRUE);
}
void RotationDia::OnOrientTwistIndirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetZDirectOrientation (FALSE);
}
void RotationDia::OnOrientXDirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetXDirectOrientation (TRUE);
}
void RotationDia::OnOrientXIndirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetXDirectOrientation (FALSE);
}
void RotationDia::OnOrientYDirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetYDirectOrientation (TRUE);
}
void RotationDia::OnOrientYIndirectRadio()
{
UpdateData (TRUE);
m_poLink->fn_vSetYDirectOrientation (FALSE);
}
//---------------------------- Twist edition
void RotationDia::OnKillfocusTwist1Edit()
{
UpdateData (TRUE);
m_poLink->fn_vSetFirstTwistOrientation (m_fTwist1*MTH_C_Pi/180.f);
m_bFocusTwist1=FALSE;
}
void RotationDia::OnKillfocusTwist2Edit()
{
UpdateData (TRUE);
m_poLink->fn_vSetSecondTwistOrientation (m_fTwist2*MTH_C_Pi/180.f);
m_bFocusTwist2=FALSE;
}
//---------------- Edit dialog have focus
void RotationDia::OnSetfocusOrientLapTwistEdit()
{
m_bFocusTwistLap=TRUE;
}
void RotationDia::OnSetfocusOrientLapXEdit()
{
m_bFocusXLap=TRUE;
}
void RotationDia::OnSetfocusOrientLapYEdit()
{
m_bFocusYLap=TRUE;
}
void RotationDia::OnSetfocusTwist1Edit()
{
m_bFocusTwist1=TRUE;
}
void RotationDia::OnSetfocusTwist2Edit()
{
m_bFocusTwist2=TRUE;
}
void RotationDia::fn_vActivateWindow (BOOL bActivate)
{
GetDlgItem (IDC_ORIENT_LAP_TWIST_EDIT)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_LAP_X_EDIT)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_LAP_Y_EDIT)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_TWIST_DIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_TWIST_INDIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_X_DIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_X_INDIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_Y_DIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_Y_INDIRECT_RADIO)->EnableWindow (bActivate);
GetDlgItem (IDC_TWIST1_EDIT)->EnableWindow (bActivate);
GetDlgItem (IDC_TWIST2_EDIT)->EnableWindow (bActivate);
GetDlgItem (IDC_LAP_X_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_LAP_Y_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_LAP_TWIST_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_TWIST_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_X_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_ORIENT_Y_STATIC)->EnableWindow (bActivate);
GetDlgItem (IDC_TWIST_STATIC)->EnableWindow (bActivate);
}
BOOL RotationDia::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_RotationDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_ORIENT_LAP_TWIST_EDIT,"OWP_RotationTwistEdit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_ORIENT_LAP_X_EDIT,"OWP_RotationXLapEdit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_ORIENT_LAP_Y_EDIT,"OWP_RotationYLapEdit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_ORIENT_TWIST_DIRECT_RADIO,"OWP_RotationTwistDirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_ORIENT_TWIST_INDIRECT_RADIO,"OWP_RotationTwistIndirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_ORIENT_X_DIRECT_RADIO,"OWP_RotationXDirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_ORIENT_X_INDIRECT_RADIO,"OWP_RotationXIndirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_ORIENT_Y_DIRECT_RADIO,"OWP_RotationYDirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_ORIENT_Y_INDIRECT_RADIO,"OWP_RotationYIndirect",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_TWIST1_EDIT,"OWP_RotationTwist1Edit",TUT_e_TextEdit);
TUT_M_vRegisterControlID (IDC_TWIST2_EDIT,"OWP_RotationTwist2Edit",TUT_e_TextEdit);
return bCreate;
}
void RotationDia::OnDestroy()
{
CFormView::OnDestroy();
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_ORIENT_LAP_TWIST_EDIT);
TUT_M_vUnregisterControlID (IDC_ORIENT_LAP_X_EDIT);
TUT_M_vUnregisterControlID (IDC_ORIENT_LAP_Y_EDIT);
TUT_M_vUnregisterControlID (IDC_ORIENT_TWIST_DIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_ORIENT_TWIST_INDIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_ORIENT_X_DIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_ORIENT_X_INDIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_ORIENT_Y_INDIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_ORIENT_Y_INDIRECT_RADIO);
TUT_M_vUnregisterControlID (IDC_TWIST1_EDIT);
TUT_M_vUnregisterControlID (IDC_TWIST1_EDIT);
}
*/
//ENDANNECY Shaitan Nettoyage }

View File

@@ -0,0 +1,503 @@
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : WayDia.cpp
//
// Dialog edition the ways
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997 Author: J Th<54>noz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date: Author:
//
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#include "stdafx.h"
#include "acp_base.h"
#include "resource.h"
#include "incitf.h"
#include "incgam.h"
#include "incai.h"
#include "WpObj.hpp"
#include "WayObj.hpp"
#include "LinkObj.hpp"
#include "Inter.hpp"
#include "WayDia.hpp"
#include "WpDia.hpp"
#include "LinkDia.hpp"
#include "RotDia.hpp"
#include "oac.h"
#include "x:\cpa\main\inc\_editid.h"
#include "tut.h"
/////////////////////////////////////////////////////////////////////////////
// DiaWay dialog
IMPLEMENT_DYNCREATE ( DiaWay, CFormView);
DiaWay::DiaWay(CWnd* pParent)
: CFormView(DiaWay::IDD)
{
//{{AFX_DATA_INIT(DiaWay)
m_EditWay = _T("");
m_csWayName = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDI_NETWAYPOINT);
m_bInsert=FALSE;
m_bDisableDelete=TRUE;
m_pWayObj=NULL;
}
void DiaWay::fn_vInitDialog (void)
{
GetDlgItem (IDC_WAY_COMBO)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_ADD_BUTTON)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_NAME_EDIT)->EnableWindow (FALSE);
}
void DiaWay::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DiaWay)
DDX_Control(pDX, IDC_WAY_COMBO, m_ListNameWP);
DDX_CBString(pDX, IDC_WAY_COMBO, m_EditWay);
DDV_MaxChars(pDX, m_EditWay, 30);
DDX_Text(pDX, IDC_WAY_NAME_EDIT, m_csWayName);
DDV_MaxChars(pDX, m_csWayName, 30);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DiaWay, CFormView)
//{{AFX_MSG_MAP(DiaWay)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_WAY_DELETE_BUTTON, OnDeleteWayButton)
ON_BN_CLICKED(IDC_WAY_ADD_BUTTON, OnAddWayButton)
ON_CBN_SELCHANGE(IDC_WAY_COMBO, OnSelchangeWayCombo)
ON_CBN_EDITUPDATE(IDC_WAY_COMBO, OnEditupdateWayCombo)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_CBN_DBLCLK(IDC_WAY_COMBO, OnDblclkWayCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// to edit a new way
void DiaWay::fn_vEdit (Way* poWay, int iSelect)
{
// Aspect of the dialog
if (!m_pWayObj && poWay)
{
GetDlgItem (IDC_WAY_COMBO)->EnableWindow (TRUE);
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (TRUE);
GetDlgItem (IDC_WAY_ADD_BUTTON)->EnableWindow (TRUE);
GetDlgItem (IDC_WAY_NAME_EDIT)->EnableWindow (TRUE);
}
else if (m_pWayObj && !poWay)
{
GetDlgItem (IDC_WAY_COMBO)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_ADD_BUTTON)->EnableWindow (FALSE);
GetDlgItem (IDC_WAY_NAME_EDIT)->EnableWindow (FALSE);
m_csWayName="";
UpdateData (FALSE);
}
m_pWayObj=poWay;
if (m_pWayObj)
{
CString csWindowTitle;
csWindowTitle = m_pWayObj->fn_csGetNameInNameList ();
GetParent()->SetWindowText ( csWindowTitle );
fn_vRefreshDialog (iSelect);
fn_vEditName ();
}
else
{
GetParent()->SetWindowText ( "no way to edit" );
m_ListNameWP.ResetContent();
m_bInsert=FALSE;
m_bDisableDelete=TRUE;
m_csWayName="";
}
GetParent()->GetParent()->RedrawWindow (NULL, NULL, RDW_INVALIDATE|RDW_FRAME);
}
BOOL DiaWay::fn_bIsEdit (Way* poWay)
{
return m_pWayObj==poWay;
}
void DiaWay::fn_vRefreshDialog (int iSelect)
{
long lCount;
char (*dpszNameWay) [30];
long lNbWayPointInNet = m_pWayObj->fn_lGetWPName (&dpszNameWay);
UpdateData (FALSE); // just to call DoDataExange the first time
m_ListNameWP.ResetContent();
for (lCount=0; lCount<lNbWayPointInNet; lCount++) m_ListNameWP.AddString (dpszNameWay[lCount]);
m_ListNameWP.AddString ("");
m_iSelect=iSelect;
delete[] dpszNameWay;
m_bDisableDelete=m_ListNameWP.GetCount()<=1;
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (!m_bDisableDelete);
fn_vRefreshLinkBox ();
m_csWayName = m_pWayObj->GetName ();
UpdateData (FALSE);
m_ListNameWP.SetCurSel (m_iSelect);
}
void DiaWay::fn_vRefreshNameList (void)
{
if (!m_pWayObj) return;
long lCount;
char (*dpszNameWay) [30];
long lNbWayPointInNet = m_pWayObj->fn_lGetWPName (&dpszNameWay);
m_ListNameWP.ResetContent();
for (lCount=0; lCount<lNbWayPointInNet; lCount++) m_ListNameWP.AddString (dpszNameWay[lCount]);
m_ListNameWP.AddString ("");
UpdateData (FALSE);
m_ListNameWP.SetCurSel (m_iSelect);
}
void DiaWay::OnSysCommand(UINT nID, LPARAM lParam)
{
CFormView::OnSysCommand(nID, lParam);
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void DiaWay::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CFormView::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR DiaWay::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void DiaWay::OnDeleteWayButton()
{
char szBuffer [30];
m_ListNameWP.GetLBText (m_iSelect, szBuffer);
// delete in the editor object
if (m_iSelect<m_pWayObj->GetListWaypoint()->GetCount()) m_pWayObj->fn_vSupWP (m_iSelect);
m_bInsert=FALSE;
m_pWayObj->fn_vDialogDeleteWp ();
// disable the delete button because there is nothing to delete
if (!m_bDisableDelete && m_ListNameWP.GetCount()<=1)
{
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (FALSE);
m_bDisableDelete=TRUE;
}
}
void DiaWay::OnAddWayButton()
{
if (m_bInsert || m_iSelect==m_ListNameWP.GetCount()-1)
{
m_ListNameWP.SetFocus();
return;
}
m_bInsert=TRUE;
m_ListNameWP.InsertString (m_iSelect,"");
m_ListNameWP.SetEditSel (0,-1);
m_ListNameWP.SetCurSel (m_iSelect);
m_ListNameWP.SetFocus();
}
void DiaWay::OnSelchangeWayCombo()
{
if (m_bInsert)
{
if (!fn_bValidEntry())
{
m_ListNameWP.SetCurSel(m_iSelect);
return;
}
m_bInsert=FALSE;
}
m_iSelect = m_ListNameWP.GetCurSel();
if (m_iSelect==m_pWayObj->GetListWaypoint()->GetCount())
{
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (FALSE);
m_bDisableDelete=TRUE;
}
else
{
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (TRUE);
m_bDisableDelete=FALSE;
}
WayPoint::fn_pGetDialog()->fn_vEdit ( m_pWayObj->fn_pGetWayPoint (m_iSelect) );
m_pWayObj->GetInterface()->GetInterface()->fn_vCancelCurrentSelection (FALSE);
if (m_pWayObj->fn_pGetWayPoint (m_iSelect)) m_pWayObj->GetInterface()->GetInterface()->fn_vAddSelectedObject (m_pWayObj->fn_pGetWayPoint (m_iSelect)->GetSuperObject() );
else m_pWayObj->GetInterface()->GetInterface()->fn_vCancelCurrentSelection ();
Link::fn_pGetDialog()->fn_vEdit (m_pWayObj->fn_pGetLink (m_iSelect));
}
void DiaWay::OnEditupdateWayCombo()
{
m_bInsert=TRUE;
UpdateData (TRUE);
m_ListNameWP.DeleteString (m_iSelect);
m_ListNameWP.InsertString (m_iSelect,m_EditWay);
m_ListNameWP.SetCurSel (m_iSelect);
m_ListNameWP.SetEditSel(-1,0);
}
BOOL DiaWay::fn_bValidEntry (void)
{
WayPoint* pInsertWP=NULL;
UpdateData (TRUE);
if (m_iSelect==m_ListNameWP.GetCount()-1) m_ListNameWP.AddString ("");
if (*m_EditWay)
{
if (!fn_bSameNameSuit())
{
// this WP exist ?
pInsertWP = (WayPoint*)(m_pWayObj->GetInterface()->GetMainWorld()->fn_p_oFindObject (m_EditWay.GetBuffer(30), "Waypoint" ));
if (pInsertWP)
{
// this WP is static ?
if (pInsertWP->fn_bGetCoordinate())
{
m_pWayObj->fn_vInsBeforeWP (pInsertWP, m_iSelect );
if (m_bDisableDelete && m_ListNameWP.GetCount()>1)
{
GetDlgItem (IDC_WAY_DELETE_BUTTON)->EnableWindow (TRUE);
m_bDisableDelete=FALSE;
}
return TRUE;
}
else MessageBox ( "The waypoint "+m_EditWay+ " is not static.", "Error", MB_ICONEXCLAMATION);
}
else MessageBox ( "The waypoint "+m_EditWay+ " is not defined.", "Error", MB_ICONEXCLAMATION);
}
else MessageBox ("The waypoint "+m_EditWay+ " is doubled in the net.", "Error", MB_ICONEXCLAMATION);
m_ListNameWP.SetCurSel (m_iSelect);
m_ListNameWP.SetEditSel(-1,0);
return FALSE;
}
if (m_iSelect!=m_ListNameWP.GetCount()-1) {
MessageBox ("You must give a waypoint name", "Error", MB_ICONEXCLAMATION);
return FALSE;
}
return TRUE;
}
void DiaWay::fn_vMessageBoxDynamicWP ( WayPoint* poWP )
{
MessageBox ( "The waypoint "+CString(poWP->GetSuperObject()->GetName())+ " is not static.", "Error", MB_ICONEXCLAMATION);
}
BOOL DiaWay::fn_bSameNameSuit (void)
{
char szCurrentText [30];
char szPreviousText [30];
long lCounter;
sprintf (szPreviousText,"Impossible_name_WGDTSY");
for (lCounter=0; lCounter<m_ListNameWP.GetCount(); lCounter++)
{
m_ListNameWP.GetLBText( lCounter, szCurrentText );
if (!strcmp(szCurrentText,szPreviousText)) return TRUE;
strcpy (szPreviousText,szCurrentText);
}
return FALSE;
}
void DiaWay::OnClose()
{
if (m_bInsert)
if (!fn_bValidEntry())
{
m_ListNameWP.SetFocus();
return;
}
CFormView::OnClose();
}
BOOL DiaWay::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (wParam==394228)
{
if ( GetAsyncKeyState(VK_DELETE) )
{
OnDeleteWayButton();
return TRUE;
}
}
if (wParam==1)
{
OnKillfocusWayNameEdit ();
if (m_bInsert)
{
if (fn_bValidEntry())
{
if (m_iSelect==m_ListNameWP.GetCount()-2) m_iSelect++;
m_ListNameWP.SetCurSel (m_iSelect);
m_ListNameWP.SetFocus();
m_bInsert=FALSE;
m_pWayObj->fn_vDialogAddWp ();
}
else
{
m_ListNameWP.SetCurSel (m_iSelect);
m_ListNameWP.SetFocus();
}
return TRUE;
}
}
return CFormView::OnCommand(wParam, lParam);
}
BOOL DiaWay::fn_vSelectWPInList (WayPoint* poWP)
{
m_iSelect = m_ListNameWP.FindStringExact( 0, poWP->GetSuperObject()->GetName() );
if (m_iSelect==LB_ERR) return FALSE;
m_ListNameWP.SetCurSel (m_iSelect);
fn_vRefreshLinkBox ();
return TRUE;
}
BOOL DiaWay::fn_vSelectWPInList (int iIndiceWP)
{
m_iSelect = iIndiceWP;
m_ListNameWP.SetCurSel (m_iSelect);
fn_vRefreshLinkBox ();
return TRUE;
}
void DiaWay::fn_vRefreshLinkBox (void)
{
Link* poLink = m_pWayObj->fn_pGetLink(m_iSelect);
if (poLink && poLink->fn_bIsRotationMode()) Link::fn_pGetRotationDialog()->fn_vEdit (poLink);
else Link::fn_pGetDialog()->fn_vEdit (poLink);
}
void DiaWay::fn_vEditName (void)
{
m_csWayName = m_pWayObj->GetName ();
}
void DiaWay::OnKillfocusWayNameEdit()
{
CString pOldName = m_csWayName;
UpdateData (TRUE);
if (pOldName == m_csWayName) return;
if (m_pWayObj->fn_eRename(m_csWayName)!=E_mc_None)
{
CString csMessage = m_csWayName+CString( " is already used.");
M_GetMainWnd()->UpdateStatus ( csMessage.GetBuffer(80), C_STATUSPANE_INFOS, C_STATUS_ERROR );
m_csWayName=pOldName;
UpdateData (FALSE);
}
else
{
m_pWayObj->GetInterface()->fn_vRefreshHierarchyList ();
m_pWayObj->fn_vNotifyAllEdtList ();
}
}
void DiaWay::OnDblclkWayCombo()
{
WayPoint* poWp = m_pWayObj->fn_pGetWayPoint (m_iSelect);
m_pWayObj->GetInterface()->GetInterface()->fn_bSelectObject (poWp->GetSuperObject(), TRUE );
}
BOOL DiaWay::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL bCreate = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
TUT_M_vGetTutDll ();
TUT_M_vRegisterControl (m_hWnd , "OWP_WayDialog" , TUT_e_Window);
TUT_M_vRegisterControlID (IDC_WAY_COMBO,"OWP_WayCombo",TUT_e_ComboBox);
TUT_M_vRegisterControlID (IDC_WAY_DELETE_BUTTON,"OWP_WayDelete",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_WAY_ADD_BUTTON,"OWP_WayAdd",TUT_e_Button);
TUT_M_vRegisterControlID (IDC_WAY_NAME_EDIT,"OWP_WayNameEdit",TUT_e_TextEdit);
return bCreate;
}
void DiaWay::OnDestroy()
{
TUT_M_vGetTutDll ();
TUT_M_vUnregisterControl (m_hWnd);
TUT_M_vUnregisterControlID (IDC_WAY_COMBO);
TUT_M_vUnregisterControlID (IDC_WAY_DELETE_BUTTON);
TUT_M_vUnregisterControlID (IDC_WAY_ADD_BUTTON);
TUT_M_vUnregisterControlID (IDC_WAY_NAME_EDIT);
}
*/
//ENDANNECY Shaitan Nettoyage }

File diff suppressed because it is too large Load Diff