263 lines
7.0 KiB
C
263 lines
7.0 KiB
C
/*******************************************************/
|
|
/**** For the structures and variables declarations ****/
|
|
/*******************************************************/
|
|
#define D_MSLight_StructureDefine
|
|
/*#define D_MSLight_VariableDefine*/
|
|
|
|
#include "ACP_Base.h"
|
|
#include "CPA_Expt.h"
|
|
|
|
|
|
#ifdef U64
|
|
#include "CPA_Std.h"
|
|
#include "GEO/color.h"
|
|
#endif /*U64*/
|
|
|
|
|
|
#ifndef U64
|
|
#include "ToolsCPA.h"
|
|
#include "../../GLIGLOU/MULTIDRV/INC/light_st.h"
|
|
#else
|
|
#include "../../GLI/specif/light_st.h"
|
|
#include "ToolsCPA.h"
|
|
#endif /*U64*/
|
|
|
|
|
|
|
|
#include "Options/Options.h"
|
|
#include "Macros.h"
|
|
|
|
#include "Actions/AllActs.h"
|
|
|
|
#include "Structur/MemGame.h"
|
|
#include "Structur/ErrGame.h"
|
|
#include "Structur/Objects.h"
|
|
#include "Structur/GameScpt.h"
|
|
#include "Structur/StdObjSt.h"
|
|
#include "Structur/EngMode.h"
|
|
|
|
#include "Basic.h"
|
|
#include "GameEng.h"
|
|
#include "ObjInit.h"
|
|
#include "ZeMem.h"
|
|
#include "toolmatr.h"
|
|
|
|
#include "ldt.h"
|
|
|
|
#define sTagOn 'nO'
|
|
#define sTagType 'yT'
|
|
#define sTagFarNear 'aF'
|
|
#define sTagLittle 'iL'
|
|
#define sTagColor 'oC'
|
|
#define sTagGiroPhare 'iG'
|
|
#define sTagPulse 'uP'
|
|
#define sTagOffset 'fO'
|
|
#define sTagDirection 'iD'
|
|
|
|
#define sTagLocalLight 'oL'
|
|
|
|
|
|
#define sIn 'nI'
|
|
#define sInterMinPos 'iM'
|
|
#define sInterMaxPos 'aM'
|
|
#define sEx 'xE'
|
|
#define sExterMinPos 'iM'
|
|
#define sExterMaxPos 'aM'
|
|
#define sIntensityMinMax 'is'
|
|
|
|
|
|
/*****************************************************************
|
|
Function name : fn_iCreateMSLight
|
|
Description :
|
|
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
|
Creation Date : 13-Oct-98
|
|
Modified :
|
|
Return type : int
|
|
Argument : LDT_tdst_Link *pLink
|
|
*****************************************************************/
|
|
int fn_iCreateMSLight( LDT_tdst_Link *pLink )
|
|
{
|
|
char* szParam;
|
|
MS_tdxHandleToMSLight h_MSLight;
|
|
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
|
|
|
|
szParam = LDT_szGetParam( 1 );
|
|
|
|
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeLight , p_stEngineObject);
|
|
h_MSLight = fn_h_LightRealAlloc();
|
|
MMG_fn_vEndMemoryInfo ();
|
|
|
|
p_stEngineObject->h_MSLight=h_MSLight;
|
|
pLink->pObject = (void*)h_MSLight;
|
|
|
|
if (!stricmp(szParam,"Parallel"))
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,1);
|
|
else if (!stricmp(szParam,"Spherical"))
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,2);
|
|
else if (!stricmp(szParam,"HotSpot"))
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,3);
|
|
else if (!stricmp(szParam,"Ambient"))
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,4);
|
|
/*CHINA WFQ (MT) 16-02-98 {*/
|
|
else if (!stricmp(szParam,"ParallelBox"))
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,5);
|
|
/*ENDCHINA WFQ }*/
|
|
else
|
|
fn_vMSLightSetTypeOfLight(h_MSLight,4);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
Function name : fn_iLoadMSLight
|
|
Description :
|
|
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
|
Creation Date : 13-Oct-98
|
|
Modified :
|
|
Return type : int
|
|
Argument : LDT_tdst_Link *pLink
|
|
*****************************************************************/
|
|
int fn_iLoadMSLight( LDT_tdst_Link *pLink )
|
|
{
|
|
LDT_tdeParseResult result=ParseResult_BeginSection;
|
|
MS_tdxHandleToMSLight h_MSLight = (MS_tdxHandleToMSLight)pLink->pObject;
|
|
|
|
|
|
while( result!=ParseResult_EndSection )
|
|
{
|
|
result=LDT_GetNextEntry();
|
|
switch( result )
|
|
{
|
|
case ParseResult_Entry: /* an entry */
|
|
{
|
|
char *szEntry=LDT_szGetEntryName();
|
|
switch (*(short*)szEntry)
|
|
{
|
|
|
|
case sTagOn : /* */
|
|
{
|
|
if (strlen(szEntry)>2) /* OnlyLocalLight*/
|
|
{
|
|
fn_vMSLightSetOnlyLocalLight(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
|
|
}
|
|
else /*On*/
|
|
{
|
|
fn_vMSLightSetOnOff(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
|
|
}
|
|
}
|
|
break;
|
|
case sTagType : /* */
|
|
{
|
|
}
|
|
break;
|
|
case sTagFarNear : /* */
|
|
{
|
|
fn_vMSLightSetNearFar(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
|
|
|
|
}
|
|
break;
|
|
case sTagLittle : /* */
|
|
{
|
|
if (strlen(szEntry)>15) /*LittleBigTangent*/
|
|
{
|
|
}
|
|
else /*LittleBigAlpha*/
|
|
{
|
|
fn_vMSLightSetAlphas(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
|
|
}
|
|
}
|
|
break;
|
|
case sTagColor : /* */
|
|
{
|
|
fn_vMSLightSetColorRGBA(h_MSLight,
|
|
(GEO_tdxColorValue)atof(LDT_szGetParam(1)),(GEO_tdxColorValue)atof(LDT_szGetParam(2)),(GEO_tdxColorValue)atof(LDT_szGetParam(3)),(GEO_tdxColorValue)atof(LDT_szGetParam(4)));
|
|
}
|
|
break;
|
|
case sTagGiroPhare : /* */
|
|
{
|
|
fn_vMSLightSetGiroPhare(h_MSLight,
|
|
(unsigned char)atoi(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
|
|
}
|
|
break;
|
|
case sTagPulse : /* */
|
|
{
|
|
fn_vMSLightSetPulse(h_MSLight,
|
|
(unsigned char)atoi(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
|
|
}
|
|
break;
|
|
case sTagOffset : /* */
|
|
{
|
|
fn_vMSLightSetOffset(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
}
|
|
break;
|
|
case sTagDirection : /* */
|
|
{
|
|
fn_vMSLightSetDirection(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
}
|
|
break;
|
|
case sTagLocalLight : /* */
|
|
{
|
|
fn_vMSLightSetLocalLight(h_MSLight,(unsigned char)atoi(LDT_szGetParam(1)));
|
|
}
|
|
case sIn : /* */
|
|
{
|
|
switch (*(short*)(szEntry+5))
|
|
{
|
|
case sInterMinPos : /* */
|
|
{
|
|
fn_xMSLightSetInterMinXYZ(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
}
|
|
break;
|
|
case sInterMaxPos : /* */
|
|
{
|
|
fn_xMSLightSetInterMaxXYZ(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
|
|
}
|
|
break;
|
|
case sIntensityMinMax : /* */
|
|
{
|
|
fn_xMSLightSetIntensityMinMax(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)));
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
case sEx : /* */
|
|
{
|
|
switch (*(short*)(szEntry+5))
|
|
{
|
|
case sExterMinPos : /* */
|
|
{
|
|
fn_xMSLightSetExterMinXYZ(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
|
|
}
|
|
break;
|
|
case sExterMaxPos : /* */
|
|
{
|
|
fn_xMSLightSetExterMaxXYZ(h_MSLight,
|
|
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
|
|
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
|