34 #include "Core-Level-JR.h"
49 char strModelFile[128], label[128];
51 M_BOOL bSnap, bInvertAnimation;
53 fp->readText(strModelFile, M_FALSE);
54 pModel->load(strModelFile);
56 fp->readObj(&pos, M_FALSE);
57 fp->readObj(&scale, M_FALSE);
58 fp->readBool(&bSnap, M_FALSE);
59 fp->readBool(&bSolid , M_FALSE);
60 fp->readBool(&bInvertAnimation, M_FALSE);
64 pModel->edScale(scale);
65 pModel->edTranslate(pos);
66 if(bSnap) pModel->edSnap();
67 if(bInvertAnimation) pModel->edInvertAnimation();
76 void laTypedObject::discard()
78 ASSERT(_pdata,
"Object is nil");
93 void laTypedObject::_type(
char* strType)
95 _nType = M_TYPE_INVALID;
97 if( !strcmp(strType,
"comment") ) _nType = M_TYPE_COMMENT;
98 else if( !strcmp(strType,
"bool") ) _nType = M_TYPE_BOOL;
99 else if( !strcmp(strType,
"int") ) _nType = M_TYPE_INT;
100 else if( !strcmp(strType,
"double") ) _nType = M_TYPE_DOUBLE;
101 else if( !strcmp(strType,
"point3") ) _nType = M_TYPE_POINT3;
102 else if( !strcmp(strType,
"color") ) _nType = M_TYPE_COLOR;
104 else if( !strcmp(strType,
"text") ) _nType = M_TYPE_TEXT;
105 else if( !strcmp(strType,
"model") ) _nType = M_TYPE_MODEL;
106 else if( !strcmp(strType,
"fx") ) _nType = M_TYPE_FX;
107 else if( !strcmp(strType,
"attack") ) _nType = M_TYPE_ATTACK;
108 else if( !strcmp(strType,
"include") ) _nType = M_TYPE_INCLUDE;
111 _nType = M_TYPE_PLIST;
114 ASSERT(_nType != M_TYPE_INVALID,
"Unknown type", strType);
120 if(_nType==M_TYPE_INVALID)
122 fp->readSectionSeparator(_strType);
132 fp->readText(comment, M_FALSE);
137 fp->readBool( (M_BOOL*)_pdata, M_FALSE);
141 fp->readInt( (
int*)_pdata, M_FALSE);
145 fp->readDouble( (
double*)_pdata, M_FALSE);
148 _pdata =
new laPoint3;
149 fp->readObj( (laPoint3*)_pdata, M_FALSE);
150 *((laPoint3*)_pdata) *=
M_UNIT;
153 _pdata =
new laColor;
154 fp->readObj( (laColor*)_pdata, M_FALSE);
162 _pdata =
new char[128];
163 fp->readText( (
char*)_pdata, M_FALSE);
168 fp->readObj( &me, M_FALSE);
169 me.pModel->bIsSolid = me.bSolid;
175 _pdata =
new fxParticleSystem();
184 _pdata =
new laPropertyList();
185 ((laPropertyList*)_pdata)->_bReadName = M_FALSE;
186 strcpy( ((laPropertyList*)_pdata)->_strName, _strType);
191 ASSERT(0,
"Invalid Type", _nType);
194 M_BOOL* laTypedObject::getBool() {
195 ASSERT(type()==M_TYPE_BOOL,
"Incompatible Type");
196 return ((M_BOOL*)_pdata);
199 int* laTypedObject::getInt() {
200 ASSERT(type()==M_TYPE_INT,
"Incompatible Type");
201 return ((
int*)_pdata);
203 double* laTypedObject::getDouble() {
204 ASSERT(type()==M_TYPE_DOUBLE,
"Incompatible Type");
205 return ((
double*)_pdata);
208 laPoint3* laTypedObject::getPoint() {
209 ASSERT(type()==M_TYPE_POINT3,
"Incompatible Type");
210 return ((laPoint3*)_pdata);
213 laColor* laTypedObject::getColor() {
214 ASSERT(type()==M_TYPE_COLOR,
"Incompatible Type");
215 return ((laColor*)_pdata);
223 char* laTypedObject::getText() {
224 ASSERT( (type()==M_TYPE_TEXT) || (type()==M_TYPE_INCLUDE),
"Incompatible Type");
225 return (
char*)(_pdata);
229 ASSERT(type()==M_TYPE_MODEL,
"Incompatible Type");
233 class fxParticleSystem* laTypedObject::getFx() {
234 ASSERT(type()==M_TYPE_FX,
"Incompatible Type");
235 return (
class fxParticleSystem*) (_pdata);
238 class rpgAttack* laTypedObject::attack() {
239 ASSERT(type()==M_TYPE_ATTACK,
"Incompatible Type");
243 class laPropertyList* laTypedObject::getPList()
245 ASSERT(type()==M_TYPE_PLIST,
"Incompatible Type");
246 return (
class laPropertyList*) (_pdata);
#define M_UNIT
Unit of 1 meter.
Interface for loadable objects.