28e34769ab83d0af7c91ee5386c37a0586a8fadc
[blender.git] / source / gameengine / Converter / KX_ConvertActuators.cpp
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  * Convert Blender actuators for use in the GameEngine
27  */
28
29 /** \file gameengine/Converter/KX_ConvertActuators.cpp
30  *  \ingroup bgeconv
31  */
32
33
34 #if defined(WIN32) && !defined(FREE_WINDOWS)
35 #pragma warning (disable : 4786) 
36 #endif //WIN32
37
38 #include <math.h>
39
40 #include "MEM_guardedalloc.h"
41
42 #include "KX_BlenderSceneConverter.h"
43 #include "KX_ConvertActuators.h"
44
45 #ifdef WITH_AUDASPACE
46 #  include "AUD_C-API.h"
47 #  include "AUD_ChannelMapperFactory.h"
48 #endif
49
50 // Actuators
51 //SCA logiclibrary native logicbricks
52 #include "SCA_PropertyActuator.h"
53 #include "SCA_LogicManager.h"
54 #include "SCA_RandomActuator.h"
55 #include "SCA_2DFilterActuator.h"
56
57 // Ketsji specific logicbricks
58 #include "KX_SceneActuator.h"
59 #include "KX_IpoActuator.h"
60 #include "KX_SoundActuator.h"
61 #include "KX_ObjectActuator.h"
62 #include "KX_TrackToActuator.h"
63 #include "KX_ConstraintActuator.h"
64 #include "KX_CameraActuator.h"
65 #include "KX_GameActuator.h"
66 #include "KX_StateActuator.h"
67 #include "KX_VisibilityActuator.h"
68 #include "KX_SCA_AddObjectActuator.h"
69 #include "KX_SCA_EndObjectActuator.h"
70 #include "KX_SCA_ReplaceMeshActuator.h"
71 #include "KX_ParentActuator.h"
72 #include "KX_SCA_DynamicActuator.h"
73 #include "KX_SteeringActuator.h"
74
75 #include "KX_Scene.h"
76 #include "KX_KetsjiEngine.h"
77
78 #include "IntValue.h"
79 #include "KX_GameObject.h"
80
81 /* This little block needed for linking to Blender... */
82 #include "BKE_text.h"
83 #include "BLI_blenlib.h"
84 #include "BLI_math_base.h"
85
86 #define FILE_MAX 1024 // repeated here to avoid dependency from BKE_utildefines.h
87
88 #include "KX_NetworkMessageActuator.h"
89
90 #ifdef WIN32
91 #include "BLI_winstuff.h"
92 #endif
93
94 #include "DNA_object_types.h"
95 #include "DNA_sound_types.h"
96 #include "DNA_scene_types.h"
97 #include "DNA_actuator_types.h"
98 #include "DNA_packedFile_types.h"
99 #include "BL_ActionActuator.h"
100 #include "BL_ShapeActionActuator.h"
101 #include "BL_ArmatureActuator.h"
102 #include "RNA_access.h"
103 #include "BL_Action.h"
104 /* end of blender include block */
105
106 #include "BL_BlenderDataConversion.h"
107
108 /** 
109  * KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
110  */
111
112 #define KX_BLENDERTRUNC(x)  (( x < 0.0001 && x > -0.0001 )  ? 0.0 : x)
113
114 void BL_ConvertActuators(const char* maggiename,
115                                                  struct Object* blenderobject,
116                                                  KX_GameObject* gameobj,
117                                                  SCA_LogicManager* logicmgr,
118                                                  KX_Scene* scene,
119                                                  KX_KetsjiEngine* ketsjiEngine,
120                                                  int activeLayerBitInfo,
121                                                  bool isInActiveLayer,
122                                                  RAS_IRenderTools* rendertools,
123                                                  KX_BlenderSceneConverter* converter
124                                                  )
125 {
126         
127         int uniqueint = 0;
128         int actcount = 0;
129         int executePriority = 0;
130         bActuator* bact = (bActuator*) blenderobject->actuators.first;
131         while (bact)
132         {
133                 actcount++;
134                 bact = bact->next;
135         }
136         gameobj->ReserveActuator(actcount);
137         bact = (bActuator*) blenderobject->actuators.first;
138         while(bact)
139         {
140                 STR_String uniquename = bact->name;
141                 STR_String& objectname = gameobj->GetName();
142                 
143                 SCA_IActuator* baseact = NULL;
144                 switch (bact->type)
145                 {
146                 case ACT_OBJECT:
147                         {
148                                 bObjectActuator* obact = (bObjectActuator*) bact->data;
149                                 KX_GameObject* obref = NULL;
150                                 MT_Vector3 forcevec(KX_BLENDERTRUNC(obact->forceloc[0]),
151                                         KX_BLENDERTRUNC(obact->forceloc[1]),
152                                         KX_BLENDERTRUNC(obact->forceloc[2]));
153                                 MT_Vector3 torquevec(obact->forcerot[0],obact->forcerot[1],obact->forcerot[2]);
154                                 MT_Vector3 dlocvec ( KX_BLENDERTRUNC(obact->dloc[0]),
155                                         KX_BLENDERTRUNC(obact->dloc[1]),
156                                         KX_BLENDERTRUNC(obact->dloc[2]));
157                                 MT_Vector3 drotvec ( KX_BLENDERTRUNC(obact->drot[0]),obact->drot[1],obact->drot[2]);
158                                 MT_Vector3 linvelvec ( KX_BLENDERTRUNC(obact->linearvelocity[0]),
159                                         KX_BLENDERTRUNC(obact->linearvelocity[1]),
160                                         KX_BLENDERTRUNC(obact->linearvelocity[2]));
161                                 MT_Vector3 angvelvec ( KX_BLENDERTRUNC(obact->angularvelocity[0]),
162                                         KX_BLENDERTRUNC(obact->angularvelocity[1]),
163                                         KX_BLENDERTRUNC(obact->angularvelocity[2]));
164                                 short damping = obact->damping;
165                                 
166                                 /* Blender uses a bit vector internally for the local-flags. In */
167                                 /* KX, we have four bools. The compiler should be smart enough  */
168                                 /* to do the right thing. We need to explicitly convert here!   */
169                                 
170                                 KX_LocalFlags bitLocalFlag;
171                                 
172                                 bitLocalFlag.Force = bool((obact->flag & ACT_FORCE_LOCAL)!=0);
173                                 bitLocalFlag.Torque = bool((obact->flag & ACT_TORQUE_LOCAL) !=0);//rlocal;
174                                 bitLocalFlag.DLoc = bool((obact->flag & ACT_DLOC_LOCAL)!=0);
175                                 bitLocalFlag.DRot = bool((obact->flag & ACT_DROT_LOCAL)!=0);
176                                 bitLocalFlag.LinearVelocity = bool((obact->flag & ACT_LIN_VEL_LOCAL)!=0);
177                                 bitLocalFlag.AngularVelocity = bool((obact->flag & ACT_ANG_VEL_LOCAL)!=0);
178                                 bitLocalFlag.ServoControl = bool(obact->type == ACT_OBJECT_SERVO);
179                                 bitLocalFlag.AddOrSetLinV = bool((obact->flag & ACT_ADD_LIN_VEL)!=0);
180                                 if (obact->reference && bitLocalFlag.ServoControl)
181                                 {
182                                         obref = converter->FindGameObject(obact->reference);
183                                 }
184                                 
185                                 KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(gameobj,
186                                         obref,
187                                         forcevec.getValue(),
188                                         torquevec.getValue(),
189                                         dlocvec.getValue(),
190                                         drotvec.getValue(),
191                                         linvelvec.getValue(),
192                                         angvelvec.getValue(),
193                                         damping,
194                                         bitLocalFlag
195                                         );
196                                 baseact = tmpbaseact;
197                                 break;
198                         }
199                 case ACT_ACTION:
200                         {
201                                 bActionActuator* actact = (bActionActuator*) bact->data;
202                                 STR_String propname = (actact->name ? actact->name : "");
203                                 STR_String propframe = (actact->frameProp ? actact->frameProp : "");
204
205                                 short ipo_flags = 0;
206
207                                 // Convert flags
208                                 if (actact->flag & ACT_IPOFORCE) ipo_flags |= BL_Action::ACT_IPOFLAG_FORCE;
209                                 if (actact->flag & ACT_IPOLOCAL) ipo_flags |= BL_Action::ACT_IPOFLAG_LOCAL;
210                                 if (actact->flag & ACT_IPOADD) ipo_flags |= BL_Action::ACT_IPOFLAG_ADD;
211                                 if (actact->flag & ACT_IPOCHILD) ipo_flags |= BL_Action::ACT_IPOFLAG_CHILD;
212                                         
213                                 BL_ActionActuator* tmpbaseact = new BL_ActionActuator(
214                                         gameobj,
215                                         propname,
216                                         propframe,
217                                         actact->sta,
218                                         actact->end,
219                                         actact->act,
220                                         actact->type, // + 1, because Blender starts to count at zero,
221                                         actact->blendin,
222                                         actact->priority,
223                                         actact->layer,
224                                         actact->layer_weight,
225                                         ipo_flags,
226                                         actact->end_reset,
227                                         actact->stridelength
228                                         // Ketsji at 1, because zero is reserved for "NoDef"
229                                         );
230                                 baseact= tmpbaseact;
231                                 break;
232                         }
233                 case ACT_SHAPEACTION:
234                         {
235                                 if (blenderobject->type==OB_MESH) {
236                                         bActionActuator* actact = (bActionActuator*) bact->data;
237                                         STR_String propname = (actact->name ? actact->name : "");
238                                         STR_String propframe = (actact->frameProp ? actact->frameProp : "");
239                                         
240                                         BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
241                                                 gameobj,
242                                                 propname,
243                                                 propframe,
244                                                 actact->sta,
245                                                 actact->end,
246                                                 actact->act,
247                                                 actact->type, // + 1, because Blender starts to count at zero,
248                                                 actact->blendin,
249                                                 actact->priority,
250                                                 actact->stridelength
251                                                 // Ketsji at 1, because zero is reserved for "NoDef"
252                                                 );
253                                         baseact= tmpbaseact;
254                                         break;
255                                 }
256                                 else
257                                         printf ("Discarded shape action actuator from non-mesh object [%s]\n", blenderobject->id.name+2);
258                         }
259                 case ACT_IPO:
260                         {
261                                 bIpoActuator* ipoact = (bIpoActuator*) bact->data;
262                                 bool ipochild = (ipoact->flag & ACT_IPOCHILD) !=0;
263                                 STR_String propname = ipoact->name;
264                                 STR_String frameProp = ipoact->frameProp;
265                                 // first bit?
266                                 bool ipo_as_force = (ipoact->flag & ACT_IPOFORCE);
267                                 bool local = (ipoact->flag & ACT_IPOLOCAL);
268                                 bool ipo_add = (ipoact->flag & ACT_IPOADD);
269                                 
270                                 KX_IpoActuator* tmpbaseact = new KX_IpoActuator(
271                                         gameobj,
272                                         propname ,
273                                         frameProp,
274                                         ipoact->sta,
275                                         ipoact->end,
276                                         ipochild,
277                                         ipoact->type + 1, // + 1, because Blender starts to count at zero,
278                                         // Ketsji at 1, because zero is reserved for "NoDef"
279                                         ipo_as_force,
280                                         ipo_add,
281                                         local);
282                                 baseact = tmpbaseact;
283                                 break;
284                         }
285                 case ACT_LAMP:
286                         {
287                                 break;
288                         }
289                 case ACT_CAMERA:
290                         {
291                                 bCameraActuator *camact = (bCameraActuator *) bact->data;
292                                 if (camact->ob) {
293                                         KX_GameObject *tmpgob = converter->FindGameObject(camact->ob);
294                                         
295                                         /* visifac, fac and axis are not copied from the struct...   */ 
296                                         /* that's some internal state...                             */
297                                         KX_CameraActuator *tmpcamact
298                                                 = new KX_CameraActuator(gameobj,
299                                                 tmpgob,
300                                                 camact->height,
301                                                 camact->min,
302                                                 camact->max,
303                                                 camact->axis,
304                                                 camact->damping);
305                                         baseact = tmpcamact;
306                                 }
307                                 break;
308                         }
309                 case ACT_MESSAGE:
310                         {
311                                 bMessageActuator *msgAct = (bMessageActuator *) bact->data;
312                                 
313                                 /* Get the name of the properties that objects must own that
314                                  * we're sending to, if present
315                                  */
316                                 STR_String toPropName = (msgAct->toPropName
317                                         ? (char*) msgAct->toPropName
318                                         : "");
319                                 
320                                 /* Get the Message Subject to send.
321                                  */
322                                 STR_String subject = (msgAct->subject
323                                         ? (char*) msgAct->subject
324                                         : "");
325                                 
326                                 /* Get the bodyType
327                                  */
328                                 int bodyType = msgAct->bodyType;
329                                 
330                                 /* Get the body (text message or property name whose value
331                                  * we'll be sending, might be empty
332                                  */
333                                 STR_String body = (msgAct->body
334                                         ? (char*) msgAct->body
335                                         : "");
336                                 
337                                 KX_NetworkMessageActuator *tmpmsgact = 
338                                         new KX_NetworkMessageActuator(
339                                         gameobj,                                        // actuator controlling object
340                                         scene->GetNetworkScene(),       // needed for replication
341                                         toPropName,
342                                         subject,
343                                         bodyType,
344                                         body);
345                                 baseact = tmpmsgact;
346                                 break;
347                         }
348                 case ACT_MATERIAL:
349                         {
350                                 break;
351                         }
352                 case ACT_SOUND:
353                         {
354                                 bSoundActuator* soundact = (bSoundActuator*) bact->data;
355                                 /* get type, and possibly a start and end frame */
356                                 KX_SoundActuator::KX_SOUNDACT_TYPE
357                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
358                                 
359                                 switch(soundact->type) {
360                                 case ACT_SND_PLAY_STOP_SOUND:
361                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP;
362                                         break;
363                                 case ACT_SND_PLAY_END_SOUND:
364                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYEND;
365                                         break;
366                                 case ACT_SND_LOOP_STOP_SOUND:
367                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPSTOP;
368                                         break;
369                                 case ACT_SND_LOOP_END_SOUND:
370                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPEND;
371                                         break;
372                                 case ACT_SND_LOOP_BIDIRECTIONAL_SOUND:
373                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL;
374                                         break;
375                                 case ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND:
376                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP;
377                                         break;
378                                         
379                                 default:
380                                         /* This is an error!!! */
381                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
382                                 }
383                                 
384                                 if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF) 
385                                 {
386                                         bSound* sound = soundact->sound;
387                                         bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false;
388                                         AUD_Reference<AUD_IFactory> snd_sound;
389                                         KX_3DSoundSettings settings;
390                                         settings.cone_inner_angle = soundact->sound3D.cone_inner_angle;
391                                         settings.cone_outer_angle = soundact->sound3D.cone_outer_angle;
392                                         settings.cone_outer_gain = soundact->sound3D.cone_outer_gain;
393                                         settings.max_distance = soundact->sound3D.max_distance;
394                                         settings.max_gain = soundact->sound3D.max_gain;
395                                         settings.min_gain = soundact->sound3D.min_gain;
396                                         settings.reference_distance = soundact->sound3D.reference_distance;
397                                         settings.rolloff_factor = soundact->sound3D.rolloff_factor;
398
399                                         if (!sound)
400                                         {
401                                                 std::cout <<    "WARNING: Sound actuator \"" << bact->name <<
402                                                                                 "\" from object \"" <<  blenderobject->id.name+2 <<
403                                                                                 "\" has no sound datablock." << std::endl;
404                                         }
405                                         else
406                                         {
407                                                 snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle);
408
409                                                 // if sound shall be 3D but isn't mono, we have to make it mono!
410                                                 if (is3d)
411                                                 {
412                                                         try
413                                                         {
414                                                                 AUD_Reference<AUD_IReader> reader = snd_sound->createReader();
415                                                                 if (reader->getSpecs().channels != AUD_CHANNELS_MONO)
416                                                                 {
417                                                                         AUD_DeviceSpecs specs;
418                                                                         specs.channels = AUD_CHANNELS_MONO;
419                                                                         specs.rate = AUD_RATE_INVALID;
420                                                                         specs.format = AUD_FORMAT_INVALID;
421                                                                         snd_sound = new AUD_ChannelMapperFactory(snd_sound, specs);
422                                                                 }
423                                                         }
424                                                         catch(AUD_Exception&)
425                                                         {
426                                                                 // sound cannot be played... ignore
427                                                         }
428                                                 }
429                                         }
430                                         KX_SoundActuator* tmpsoundact =
431                                                 new KX_SoundActuator(gameobj,
432                                                 snd_sound,
433                                                 soundact->volume,
434                                                 (float)(exp((soundact->pitch / 12.0) * M_LN2)),
435                                                 is3d,
436                                                 settings,
437                                                 soundActuatorType);
438
439                                         tmpsoundact->SetName(bact->name);
440                                         baseact = tmpsoundact;
441                                 }
442                                 break;
443                         }
444                 case ACT_PROPERTY:
445                         {
446                                 bPropertyActuator* propact = (bPropertyActuator*) bact->data;
447                                 SCA_IObject* destinationObj = NULL;
448                                 
449                                 /*
450                                  * here the destinationobject is searched. problem with multiple scenes: other scenes
451                                  * have not been converted yet, so the destobj will not be found, so the prop will
452                                  * not be copied.
453                                  * possible solutions:
454                                  * - convert everything when possible and not realtime only when needed.
455                                  * - let the object-with-property report itself to the act when converted
456                                  */
457                                 if (propact->ob)
458                                         destinationObj = converter->FindGameObject(propact->ob);
459                                 
460                                 SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator(
461                                         gameobj,
462                                         destinationObj,
463                                         propact->name,
464                                         propact->value,
465                                         propact->type+1); // + 1 because Ketsji Logic starts
466                                 // with 0 for KX_ACT_PROP_NODEF
467                                 baseact = tmppropact;
468                                 break;
469                         }
470                 case ACT_EDIT_OBJECT:
471                         {
472                                 bEditObjectActuator *editobact 
473                                         = (bEditObjectActuator *) bact->data;
474                                 /* There are four different kinds of 'edit object' thingies  */
475                                 /* The alternative to this lengthy conversion is packing     */
476                                 /* several actuators in one, which is not very nice design.. */
477                                 switch (editobact->type) {
478                                 case ACT_EDOB_ADD_OBJECT: 
479                                         {
480                                                 
481                                                 // does the 'original' for replication exists, and 
482                                                 // is it in a non-active layer ?
483                                                 SCA_IObject* originalval = NULL;
484                                                 if (editobact->ob)
485                                                 {
486                                                         if (editobact->ob->lay & activeLayerBitInfo)
487                                                         {
488                                                                 fprintf(stderr, "Warning, object \"%s\" from AddObject actuator \"%s\" is not in a hidden layer.\n", objectname.Ptr(), uniquename.Ptr());
489                                                         }
490                                                         else {
491                                                                 originalval = converter->FindGameObject(editobact->ob);
492                                                         }
493                                                 }
494                                                 
495                                                 KX_SCA_AddObjectActuator* tmpaddact = 
496                                                         new KX_SCA_AddObjectActuator(
497                                                                 gameobj, 
498                                                                 originalval,
499                                                                 editobact->time,
500                                                                 scene,
501                                                                 editobact->linVelocity,
502                                                                 (editobact->localflag & ACT_EDOB_LOCAL_LINV)!=0,
503                                                                 editobact->angVelocity,
504                                                                 (editobact->localflag & ACT_EDOB_LOCAL_ANGV)!=0
505                                                                 );
506                                                                 
507                                                                 //editobact->ob to gameobj
508                                                                 baseact = tmpaddact;
509                                         }
510                                         break;
511                                 case ACT_EDOB_END_OBJECT:
512                                         {
513                                                 KX_SCA_EndObjectActuator* tmpendact 
514                                                         = new KX_SCA_EndObjectActuator(gameobj,scene);
515                                                 baseact = tmpendact;
516                                         }
517                                         break;
518                                 case ACT_EDOB_REPLACE_MESH:
519                                         {
520                                                 RAS_MeshObject *tmpmesh = NULL;
521                                                 if (editobact->me)
522                                                         tmpmesh = BL_ConvertMesh(
523                                                                 editobact->me,
524                                                                 blenderobject,
525                                                                 scene,
526                                                                 converter
527                                                                 );
528
529                                                 KX_SCA_ReplaceMeshActuator* tmpreplaceact
530                                                         = new KX_SCA_ReplaceMeshActuator(
531                                                                 gameobj,
532                                                                 tmpmesh,
533                                                                 scene,
534                                                                 (editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX)==0,
535                                                                 (editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS)!=0
536                                                                 
537                                                                 );
538                                                         
539                                                         baseact = tmpreplaceact;
540                                         }
541                                         break;
542                                 case ACT_EDOB_TRACK_TO:
543                                         {
544                                                 SCA_IObject* originalval = NULL;
545                                                 if (editobact->ob)
546                                                         originalval = converter->FindGameObject(editobact->ob);
547                                                         
548                                                 KX_TrackToActuator* tmptrackact 
549                                                         = new KX_TrackToActuator(gameobj, 
550                                                                 originalval,
551                                                                 editobact->time,
552                                                                 editobact->flag,
553                                                                 blenderobject->trackflag,
554                                                                 blenderobject->upflag
555                                                                 );
556                                                         baseact = tmptrackact;
557                                                 break;
558                                         }
559                                 case ACT_EDOB_DYNAMICS:
560                                         {
561                                                 KX_SCA_DynamicActuator* tmpdynact 
562                                                         = new KX_SCA_DynamicActuator(gameobj, 
563                                                                 editobact->dyn_operation,
564                                                                 editobact->mass
565                                                                 );
566                                                         baseact = tmpdynact;
567                                         }
568                                 }
569                                 break;
570                         }
571                 case ACT_CONSTRAINT:
572                         {
573                                 float min = 0.0, max = 0.0;
574                                 char *prop = NULL;
575                                 KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF;
576                                 bConstraintActuator *conact 
577                                         = (bConstraintActuator*) bact->data;
578                                 /* convert settings... degrees in the ui become radians  */ 
579                                 /* internally                                            */ 
580                                 if (conact->type == ACT_CONST_TYPE_ORI) {
581                                         min = (float)((MT_2_PI * conact->minloc[0])/360.0);
582                                         max = (float)((MT_2_PI * conact->maxloc[0])/360.0);
583                                         switch (conact->mode) {
584                                         case ACT_CONST_DIRPX:
585                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;
586                                                 break;
587                                         case ACT_CONST_DIRPY:
588                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY;
589                                                 break;
590                                         case ACT_CONST_DIRPZ:
591                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ;
592                                                 break;
593                                         }
594                                 } else if (conact->type == ACT_CONST_TYPE_DIST) {
595                                         switch (conact->mode) {
596                                         case ACT_CONST_DIRPX:
597                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPX;
598                                                 min = conact->minloc[0];
599                                                 max = conact->maxloc[0];
600                                                 break;
601                                         case ACT_CONST_DIRPY:
602                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY;
603                                                 min = conact->minloc[1];
604                                                 max = conact->maxloc[1];
605                                                 break;
606                                         case ACT_CONST_DIRPZ:
607                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPZ;
608                                                 min = conact->minloc[2];
609                                                 max = conact->maxloc[2];
610                                                 break;
611                                         case ACT_CONST_DIRNX:
612                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNX;
613                                                 min = conact->minloc[0];
614                                                 max = conact->maxloc[0];
615                                                 break;
616                                         case ACT_CONST_DIRNY:
617                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY;
618                                                 min = conact->minloc[1];
619                                                 max = conact->maxloc[1];
620                                                 break;
621                                         case ACT_CONST_DIRNZ:
622                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNZ;
623                                                 min = conact->minloc[2];
624                                                 max = conact->maxloc[2];
625                                                 break;
626                                         }
627                                         prop = conact->matprop;
628                                 } else if (conact->type == ACT_CONST_TYPE_FH) {
629                                         switch (conact->mode) {
630                                         case ACT_CONST_DIRPX:
631                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX;
632                                                 min = conact->minloc[0];
633                                                 max = conact->maxloc[0];
634                                                 break;
635                                         case ACT_CONST_DIRPY:
636                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY;
637                                                 min = conact->minloc[1];
638                                                 max = conact->maxloc[1];
639                                                 break;
640                                         case ACT_CONST_DIRPZ:
641                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ;
642                                                 min = conact->minloc[2];
643                                                 max = conact->maxloc[2];
644                                                 break;
645                                         case ACT_CONST_DIRNX:
646                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX;
647                                                 min = conact->minloc[0];
648                                                 max = conact->maxloc[0];
649                                                 break;
650                                         case ACT_CONST_DIRNY:
651                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY;
652                                                 min = conact->minloc[1];
653                                                 max = conact->maxloc[1];
654                                                 break;
655                                         case ACT_CONST_DIRNZ:
656                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ;
657                                                 min = conact->minloc[2];
658                                                 max = conact->maxloc[2];
659                                                 break;
660                                         }
661                                         prop = conact->matprop;
662                                 } else {
663                                         switch (conact->flag) {
664                                         case ACT_CONST_LOCX:
665                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX; 
666                                                 min = conact->minloc[0];
667                                                 max = conact->maxloc[0];
668                                                 break;
669                                         case ACT_CONST_LOCY:
670                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY; 
671                                                 min = conact->minloc[1];
672                                                 max = conact->maxloc[1];
673                                                 break;
674                                         case ACT_CONST_LOCZ:
675                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCZ;
676                                                 min = conact->minloc[2];
677                                                 max = conact->maxloc[2];
678                                                 break;
679                                         case ACT_CONST_ROTX:
680                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTX;
681                                                 min = conact->minrot[0] * (float)MT_RADS_PER_DEG;
682                                                 max = conact->maxrot[0] * (float)MT_RADS_PER_DEG;
683                                                 break;
684                                         case ACT_CONST_ROTY:
685                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTY;
686                                                 min = conact->minrot[1] * (float)MT_RADS_PER_DEG;
687                                                 max = conact->maxrot[1] * (float)MT_RADS_PER_DEG;
688                                                 break;
689                                         case ACT_CONST_ROTZ:
690                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ;
691                                                 min = conact->minrot[2] * (float)MT_RADS_PER_DEG;
692                                                 max = conact->maxrot[2] * (float)MT_RADS_PER_DEG;
693                                                 break;
694                                         default:
695                                                 ; /* error */ 
696                                         }
697                                 }
698                                 KX_ConstraintActuator *tmpconact 
699                                         = new KX_ConstraintActuator(gameobj,
700                                                 conact->damp,
701                                                 conact->rotdamp,
702                                                 min,
703                                                 max,
704                                                 conact->maxrot,
705                                                 locrot,
706                                                 conact->time,
707                                                 conact->flag,
708                                                 prop);
709                                 baseact = tmpconact;
710                                 break;
711                         }
712                 case ACT_GROUP:
713                         {
714                                 // deprecated
715                         }
716                         break;
717                 case ACT_SCENE:
718                         {
719                                 bSceneActuator *sceneact = (bSceneActuator *) bact->data;
720                                 STR_String nextSceneName("");
721                                 
722                                 KX_SceneActuator* tmpsceneact;
723                                 int mode = KX_SceneActuator::KX_SCENE_NODEF;
724                                 KX_Camera *cam = NULL;
725                                 //KX_Scene* scene = NULL;
726                                 switch (sceneact->type)
727                                 {
728                                 case ACT_SCENE_RESUME:
729                                 case ACT_SCENE_SUSPEND:
730                                 case ACT_SCENE_ADD_FRONT:
731                                 case ACT_SCENE_ADD_BACK:
732                                 case ACT_SCENE_REMOVE:
733                                 case ACT_SCENE_SET:
734                                         {
735                                                 switch (sceneact->type)
736                                                 {
737                                                 case ACT_SCENE_RESUME:
738                                                         mode = KX_SceneActuator::KX_SCENE_RESUME;
739                                                         break;
740                                                 case ACT_SCENE_SUSPEND:
741                                                         mode = KX_SceneActuator::KX_SCENE_SUSPEND;
742                                                         break;
743                                                 case ACT_SCENE_ADD_FRONT:
744                                                         mode = KX_SceneActuator::KX_SCENE_ADD_FRONT_SCENE;
745                                                         break;
746                                                 case ACT_SCENE_ADD_BACK:
747                                                         mode = KX_SceneActuator::KX_SCENE_ADD_BACK_SCENE;
748                                                         break;
749                                                 case ACT_SCENE_REMOVE:
750                                                         mode = KX_SceneActuator::KX_SCENE_REMOVE_SCENE;
751                                                         break;
752                                                 case ACT_SCENE_SET:
753                                                 default:
754                                                         mode = KX_SceneActuator::KX_SCENE_SET_SCENE;
755                                                         break;
756                                                 };
757                                                 
758                                                 if (sceneact->scene)
759                                                 {
760                                                         nextSceneName = sceneact->scene->id.name + 2; // this '2' is necessary to remove prefix 'SC'
761                                                 }
762                                                 
763                                                 break;
764                                         }
765                                 case ACT_SCENE_CAMERA:
766                                         mode = KX_SceneActuator::KX_SCENE_SET_CAMERA;
767                                         if (sceneact->camera)
768                                         {
769                                                 cam = (KX_Camera*) converter->FindGameObject(sceneact->camera);
770                                         }
771                                         break;
772                                 case ACT_SCENE_RESTART:
773                                         {
774                                                 
775                                                 mode =  KX_SceneActuator::KX_SCENE_RESTART;
776                                                 break;
777                                         }
778                                 default:
779                                         ; /* flag error */
780                                 }
781                                 tmpsceneact = new KX_SceneActuator(gameobj,
782                                                 mode,
783                                                 scene,
784                                                 ketsjiEngine,
785                                                 nextSceneName,
786                                                 cam);
787                                         baseact = tmpsceneact;
788                                 break;
789                         }
790                 case ACT_GAME:
791                         {
792                                 bGameActuator *gameact = (bGameActuator *) bact->data;
793                                 KX_GameActuator* tmpgameact;
794                                 STR_String filename = maggiename;
795                                 STR_String loadinganimationname = "";
796                                 int mode = KX_GameActuator::KX_GAME_NODEF;
797                                 switch (gameact->type)
798                                 {
799                                 case ACT_GAME_LOAD:
800                                         {
801                                                 mode = KX_GameActuator::KX_GAME_LOAD;
802                                                 filename = gameact->filename;
803                                                 loadinganimationname = gameact->loadaniname;
804                                                 break;
805                                         }
806                                 case ACT_GAME_START:
807                                         {
808                                                 mode = KX_GameActuator::KX_GAME_START;
809                                                 filename = gameact->filename;
810                                                 loadinganimationname = gameact->loadaniname;
811                                                 break;
812                                         }
813                                 case ACT_GAME_RESTART:
814                                         {
815                                                 mode = KX_GameActuator::KX_GAME_RESTART;
816                                                 break;
817                                         }
818                                 case ACT_GAME_QUIT:
819                                         {
820                                                 mode = KX_GameActuator::KX_GAME_QUIT;
821                                                 break;
822                                         }
823                                 case ACT_GAME_SAVECFG:
824                                         {
825                                                 mode = KX_GameActuator::KX_GAME_SAVECFG;
826                                                 break;
827                                         }
828                                 case ACT_GAME_LOADCFG:
829                                         {
830                                                 mode = KX_GameActuator::KX_GAME_LOADCFG;
831                                                 break;
832                                         }
833                                 default:
834                                         ; /* flag error */
835                                 }
836                                         tmpgameact = new KX_GameActuator(gameobj,
837                                                 mode,
838                                                 filename,
839                                                 loadinganimationname,
840                                                 scene,
841                                                 ketsjiEngine);
842                                         baseact = tmpgameact;
843
844                                 break;
845                         }
846                 case ACT_RANDOM:
847                         {
848                                 bRandomActuator *randAct 
849                                         = (bRandomActuator *) bact->data;
850                                 
851                                 unsigned long seedArg = randAct->seed;
852                                 if (seedArg == 0)
853                                 {
854                                         seedArg = (int)(ketsjiEngine->GetRealTime()*100000.0);
855                                         seedArg ^= (intptr_t)randAct;
856                                 }
857                                 SCA_RandomActuator::KX_RANDOMACT_MODE modeArg 
858                                         = SCA_RandomActuator::KX_RANDOMACT_NODEF;
859                                 SCA_RandomActuator *tmprandomact;
860                                 float paraArg1 = 0.0;
861                                 float paraArg2 = 0.0;
862                                 
863                                 switch (randAct->distribution) {
864                                 case ACT_RANDOM_BOOL_CONST:
865                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST;
866                                         paraArg1 = (float) randAct->int_arg_1;
867                                         break;
868                                 case ACT_RANDOM_BOOL_UNIFORM:
869                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_UNIFORM;
870                                         break;
871                                 case ACT_RANDOM_BOOL_BERNOUILLI:
872                                         paraArg1 = randAct->float_arg_1;
873                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_BERNOUILLI;
874                                         break;
875                                 case ACT_RANDOM_INT_CONST:
876                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_CONST;
877                                         paraArg1 = (float) randAct->int_arg_1;
878                                         break;
879                                 case ACT_RANDOM_INT_UNIFORM:
880                                         paraArg1 = (float) randAct->int_arg_1;
881                                         paraArg2 = (float) randAct->int_arg_2;
882                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_UNIFORM;
883                                         break;
884                                 case ACT_RANDOM_INT_POISSON:
885                                         paraArg1 = randAct->float_arg_1;
886                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_POISSON;
887                                         break;
888                                 case ACT_RANDOM_FLOAT_CONST:
889                                         paraArg1 = randAct->float_arg_1;
890                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_CONST;
891                                         break;
892                                 case ACT_RANDOM_FLOAT_UNIFORM:
893                                         paraArg1 = randAct->float_arg_1;
894                                         paraArg2 = randAct->float_arg_2;
895                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_UNIFORM;
896                                         break;
897                                 case ACT_RANDOM_FLOAT_NORMAL:
898                                         paraArg1 = randAct->float_arg_1;
899                                         paraArg2 = randAct->float_arg_2;
900                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NORMAL;
901                                         break;
902                                 case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
903                                         paraArg1 = randAct->float_arg_1;
904                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL;
905                                         break;
906                                 default:
907                                         ; /* error */                           
908                                 }
909                                 tmprandomact = new SCA_RandomActuator(gameobj,
910                                         seedArg,
911                                         modeArg, 
912                                         paraArg1,
913                                         paraArg2,
914                                         randAct->propname);
915                                 baseact = tmprandomact;
916                         }
917                         break;
918
919                 case ACT_VISIBILITY:
920                 {
921                         bVisibilityActuator *vis_act = (bVisibilityActuator *) bact->data;
922                         KX_VisibilityActuator * tmp_vis_act = NULL;
923                         bool v = ((vis_act->flag & ACT_VISIBILITY_INVISIBLE) != 0);
924                         bool o = ((vis_act->flag & ACT_VISIBILITY_OCCLUSION) != 0);
925                         bool recursive = ((vis_act->flag & ACT_VISIBILITY_RECURSIVE) != 0);
926
927                         tmp_vis_act = new KX_VisibilityActuator(gameobj, !v, o, recursive);
928                         
929                         baseact = tmp_vis_act;
930                 }
931                 break;
932
933                 case ACT_STATE:
934                 {
935                         bStateActuator *sta_act = (bStateActuator *) bact->data;
936                         KX_StateActuator * tmp_sta_act = NULL;
937
938                         tmp_sta_act = 
939                                 new KX_StateActuator(gameobj, sta_act->type, sta_act->mask);
940                         
941                         baseact = tmp_sta_act;
942                 }
943                 break;
944
945                 case ACT_2DFILTER:
946                 {
947                         bTwoDFilterActuator *_2dfilter = (bTwoDFilterActuator*) bact->data;
948                         SCA_2DFilterActuator *tmp = NULL;
949
950                         RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode;
951                         switch(_2dfilter->type)
952                         {
953                                 case ACT_2DFILTER_MOTIONBLUR:
954                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR;
955                                         break;
956                                 case ACT_2DFILTER_BLUR:
957                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_BLUR;
958                                         break;
959                                 case ACT_2DFILTER_SHARPEN:
960                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SHARPEN;
961                                         break;
962                                 case ACT_2DFILTER_DILATION:
963                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_DILATION;
964                                         break;
965                                 case ACT_2DFILTER_EROSION:
966                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_EROSION;
967                                         break;
968                                 case ACT_2DFILTER_LAPLACIAN:
969                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_LAPLACIAN;
970                                         break;
971                                 case ACT_2DFILTER_SOBEL:
972                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SOBEL;
973                                         break;
974                                 case ACT_2DFILTER_PREWITT:
975                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_PREWITT;
976                                         break;
977                                 case ACT_2DFILTER_GRAYSCALE:
978                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_GRAYSCALE;
979                                         break;
980                                 case ACT_2DFILTER_SEPIA:
981                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SEPIA;
982                                         break;
983                                 case ACT_2DFILTER_INVERT:
984                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_INVERT;
985                                         break;
986                                 case ACT_2DFILTER_CUSTOMFILTER:
987                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_CUSTOMFILTER;
988                                         break;
989                                 case ACT_2DFILTER_NOFILTER:
990                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER;
991                                         break;
992                                 case ACT_2DFILTER_DISABLED:
993                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_DISABLED;
994                                         break;
995                                 case ACT_2DFILTER_ENABLED:
996                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_ENABLED;
997                                         break;
998                                 default:
999                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER;
1000                                         break;
1001                         }
1002
1003                         tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
1004                                 _2dfilter->float_arg,_2dfilter->int_arg,ketsjiEngine->GetRasterizer(),scene);
1005
1006                         if (_2dfilter->text)
1007                         {
1008                                 char *buf;
1009                                 // this is some blender specific code
1010                                 buf = txt_to_buf(_2dfilter->text);
1011                                 if (buf)
1012                                 {
1013                                         tmp->SetShaderText(buf);
1014                                         MEM_freeN(buf);
1015                                 }
1016                         }
1017
1018                         baseact = tmp;
1019
1020                 }
1021                 break;
1022                 case ACT_PARENT:
1023                         {
1024                                 bParentActuator *parAct = (bParentActuator *) bact->data;
1025                                 int mode = KX_ParentActuator::KX_PARENT_NODEF;
1026                                 bool addToCompound = true;
1027                                 bool ghost = true;
1028                                 KX_GameObject *tmpgob = NULL;
1029
1030                                 switch(parAct->type)
1031                                 {
1032                                         case ACT_PARENT_SET:
1033                                                 mode = KX_ParentActuator::KX_PARENT_SET;
1034                                                 tmpgob = converter->FindGameObject(parAct->ob);
1035                                                 addToCompound = !(parAct->flag & ACT_PARENT_COMPOUND);
1036                                                 ghost = !(parAct->flag & ACT_PARENT_GHOST);
1037                                                 break;
1038                                         case ACT_PARENT_REMOVE:
1039                                                 mode = KX_ParentActuator::KX_PARENT_REMOVE;
1040                                                 tmpgob = NULL;
1041                                                 break;
1042                                 }
1043         
1044                                 KX_ParentActuator *tmpparact
1045                                         = new KX_ParentActuator(gameobj,
1046                                         mode,
1047                                         addToCompound,
1048                                         ghost,
1049                                         tmpgob);
1050                                 baseact = tmpparact;
1051                                 break;
1052                         }
1053                 
1054                 case ACT_ARMATURE:
1055                         {
1056                                 bArmatureActuator* armAct = (bArmatureActuator*) bact->data;
1057                                 KX_GameObject *tmpgob = converter->FindGameObject(armAct->target);
1058                                 KX_GameObject *subgob = converter->FindGameObject(armAct->subtarget);
1059                                 BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight, armAct->influence);
1060                                 baseact = tmparmact;
1061                                 break;
1062                         }
1063                 case ACT_STEERING:
1064                         {
1065                                 bSteeringActuator *stAct = (bSteeringActuator *) bact->data;
1066                                 KX_GameObject *navmeshob = NULL;
1067                                 if (stAct->navmesh)
1068                                 {
1069                                         PointerRNA settings_ptr;
1070                                         RNA_pointer_create((ID *)stAct->navmesh, &RNA_GameObjectSettings, stAct->navmesh, &settings_ptr);
1071                                         if (RNA_enum_get(&settings_ptr, "physics_type") == OB_BODY_TYPE_NAVMESH)
1072                                                 navmeshob = converter->FindGameObject(stAct->navmesh);
1073                                 }
1074                                 KX_GameObject *targetob = converter->FindGameObject(stAct->target);
1075
1076                                 int mode = KX_SteeringActuator::KX_STEERING_NODEF;
1077                                 switch(stAct->type)
1078                                 {
1079                                 case ACT_STEERING_SEEK:
1080                                         mode = KX_SteeringActuator::KX_STEERING_SEEK;
1081                                         break;
1082                                 case ACT_STEERING_FLEE:
1083                                         mode = KX_SteeringActuator::KX_STEERING_FLEE;
1084                                         break;
1085                                 case ACT_STEERING_PATHFOLLOWING:
1086                                         mode = KX_SteeringActuator::KX_STEERING_PATHFOLLOWING;
1087                                         break;
1088                                 }
1089
1090                                 bool selfTerminated = (stAct->flag & ACT_STEERING_SELFTERMINATED) !=0;
1091                                 bool enableVisualization = (stAct->flag & ACT_STEERING_ENABLEVISUALIZATION) !=0;
1092                                 short facingMode = (stAct->flag & ACT_STEERING_AUTOMATICFACING) ? stAct->facingaxis : 0;
1093                                 bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0;
1094                                 KX_SteeringActuator *tmpstact
1095                                         = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, 
1096                                         stAct->velocity, stAct->acceleration, stAct->turnspeed, 
1097                                         selfTerminated, stAct->updateTime,
1098                                         scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization);
1099                                 baseact = tmpstact;
1100                                 break;
1101                         }
1102                 default:
1103                         ; /* generate some error */
1104                 }
1105                 
1106                 if (baseact)
1107                 {
1108                         baseact->SetExecutePriority(executePriority++);
1109                         uniquename += "#ACT#";
1110                         uniqueint++;
1111                         CIntValue* uniqueval = new CIntValue(uniqueint);
1112                         uniquename += uniqueval->GetText();
1113                         uniqueval->Release();
1114                         baseact->SetName(bact->name);
1115                         //gameobj->SetProperty(uniquename,baseact);
1116                         gameobj->AddActuator(baseact);
1117                         
1118                         converter->RegisterGameActuator(baseact, bact);
1119                         // done with baseact, release it
1120                         baseact->Release();
1121                 }
1122                 
1123                 bact = bact->next;
1124         }
1125 }
1126
1127