[2036] | 1 | |
---|
| 2 | |
---|
[4570] | 3 | /* |
---|
[2036] | 4 | orxonox - the future of 3D-vertical-scrollers |
---|
| 5 | |
---|
| 6 | Copyright (C) 2004 orx |
---|
| 7 | |
---|
| 8 | This program is free software; you can redistribute it and/or modify |
---|
| 9 | it under the terms of the GNU General Public License as published by |
---|
| 10 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 11 | any later version. |
---|
| 12 | |
---|
| 13 | ### File Specific: |
---|
| 14 | main-programmer: Patrick Boenzli |
---|
[2190] | 15 | co-programmer: Christian Meyer |
---|
[2036] | 16 | */ |
---|
[5300] | 17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
[2036] | 18 | |
---|
| 19 | #include "world_entity.h" |
---|
[5208] | 20 | #include "shell_command.h" |
---|
[5143] | 21 | |
---|
[9869] | 22 | #include "util/loading/resource_manager.h" |
---|
| 23 | #include "resource_obj.h" |
---|
[8490] | 24 | #include "md2/md2Model.h" |
---|
| 25 | #include "md3/md3_model.h" |
---|
| 26 | |
---|
[8724] | 27 | #include "aabb_tree_node.h" |
---|
| 28 | |
---|
[7193] | 29 | #include "util/loading/load_param.h" |
---|
[10088] | 30 | #include "loading/load_param_xml.h" |
---|
| 31 | #include "util/loading/factory.h" |
---|
| 32 | |
---|
[4682] | 33 | #include "obb_tree.h" |
---|
[3608] | 34 | |
---|
[8974] | 35 | #include "elements/glgui_energywidget.h" |
---|
[6430] | 36 | |
---|
[6002] | 37 | #include "state.h" |
---|
[7014] | 38 | #include "camera.h" |
---|
[6002] | 39 | |
---|
[7927] | 40 | #include "collision_handle.h" |
---|
[8190] | 41 | #include "collision_event.h" |
---|
[8777] | 42 | #include "game_rules.h" |
---|
| 43 | #include "kill.h" |
---|
[9869] | 44 | #include "debug.h" |
---|
[7927] | 45 | |
---|
[10088] | 46 | #include "track/track.h" |
---|
| 47 | |
---|
[9869] | 48 | #include "projectiles/projectile.h" |
---|
[7927] | 49 | |
---|
[5208] | 50 | SHELL_COMMAND(model, WorldEntity, loadModel) |
---|
[6430] | 51 | ->describe("sets the Model of the WorldEntity") |
---|
[7711] | 52 | ->defaultValues("models/ships/fighter.obj", 1.0f); |
---|
[5208] | 53 | |
---|
[6424] | 54 | SHELL_COMMAND(debugEntity, WorldEntity, debugWE); |
---|
[5208] | 55 | |
---|
[9869] | 56 | |
---|
| 57 | ObjectListDefinition(WorldEntity); |
---|
[2043] | 58 | /** |
---|
[4836] | 59 | * Loads the WordEntity-specific Part of any derived Class |
---|
[5498] | 60 | * |
---|
| 61 | * @param root: Normally NULL, as the Derived Entities define a loadParams Function themeselves, |
---|
| 62 | * that can calls WorldEntities loadParams for itself. |
---|
| 63 | */ |
---|
[6430] | 64 | WorldEntity::WorldEntity() |
---|
| 65 | : Synchronizeable() |
---|
[2190] | 66 | { |
---|
[9869] | 67 | this->registerObject(this, WorldEntity::_objectList); |
---|
[4597] | 68 | |
---|
[4682] | 69 | this->obbTree = NULL; |
---|
[8724] | 70 | this->aabbNode = NULL; |
---|
[6700] | 71 | this->healthWidget = NULL; |
---|
| 72 | this->healthMax = 1.0f; |
---|
| 73 | this->health = 1.0f; |
---|
[8190] | 74 | this->damage = 0.0f; // no damage dealt by a default entity |
---|
[6695] | 75 | this->scaling = 1.0f; |
---|
[4261] | 76 | |
---|
[6695] | 77 | /* OSOLETE */ |
---|
| 78 | this->bVisible = true; |
---|
| 79 | this->bCollide = true; |
---|
| 80 | |
---|
[6142] | 81 | this->objectListNumber = OM_INIT; |
---|
[9003] | 82 | this->lastObjectListNumber = OM_INIT; |
---|
[6142] | 83 | |
---|
[8190] | 84 | // reset all collision handles to NULL == unsubscribed state |
---|
| 85 | for(int i = 0; i < CREngine::CR_NUMBER; ++i) |
---|
| 86 | this->collisionHandles[i] = NULL; |
---|
| 87 | this->bReactive = false; |
---|
[9003] | 88 | this->bOnGround = false; |
---|
[8190] | 89 | |
---|
[10088] | 90 | // Track of this entity |
---|
| 91 | this->entityTrack = NULL; |
---|
| 92 | |
---|
[8190] | 93 | // registering default reactions: |
---|
[9869] | 94 | this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID()); |
---|
[8190] | 95 | |
---|
[6142] | 96 | this->toList(OM_NULL); |
---|
[9235] | 97 | |
---|
[9656] | 98 | registerVar( new SynchronizeableString( &this->md2TextureFileName, &this->md2TextureFileName, "md2TextureFileName", PERMISSION_MASTER_SERVER ) ); |
---|
| 99 | modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName", PERMISSION_MASTER_SERVER ) ); |
---|
| 100 | scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling", PERMISSION_MASTER_SERVER ) ); |
---|
| 101 | list_handle = registerVarId( new SynchronizeableInt( (int*)&objectListNumber, &list_write, "list", PERMISSION_MASTER_SERVER ) ); |
---|
[9235] | 102 | |
---|
[9656] | 103 | health_handle = registerVarId( new SynchronizeableFloat( &this->health, &this->health_write, "health", PERMISSION_MASTER_SERVER ) ); |
---|
| 104 | healthMax_handle = registerVarId( new SynchronizeableFloat( &this->healthMax, &this->healthMax_write, "maxHealth", PERMISSION_MASTER_SERVER ) ); |
---|
[2190] | 105 | } |
---|
[2043] | 106 | |
---|
| 107 | /** |
---|
[4836] | 108 | * standard destructor |
---|
[2043] | 109 | */ |
---|
[2190] | 110 | WorldEntity::~WorldEntity () |
---|
[2036] | 111 | { |
---|
[7125] | 112 | State::getObjectManager()->toList(this, OM_INIT); |
---|
| 113 | |
---|
| 114 | // Delete the model (unregister it with the ResourceManager) |
---|
| 115 | for (unsigned int i = 0; i < this->models.size(); i++) |
---|
| 116 | this->setModel(NULL, i); |
---|
| 117 | |
---|
[5498] | 118 | // Delete the obbTree |
---|
[5302] | 119 | if( this->obbTree != NULL) |
---|
[4814] | 120 | delete this->obbTree; |
---|
[5994] | 121 | |
---|
[6700] | 122 | if (this->healthWidget != NULL) |
---|
| 123 | delete this->healthWidget; |
---|
[8190] | 124 | |
---|
| 125 | this->unsubscribeReaction(); |
---|
[3531] | 126 | } |
---|
| 127 | |
---|
[5498] | 128 | /** |
---|
| 129 | * loads the WorldEntity Specific Parameters. |
---|
| 130 | * @param root: the XML-Element to load the Data From |
---|
| 131 | */ |
---|
[4436] | 132 | void WorldEntity::loadParams(const TiXmlElement* root) |
---|
| 133 | { |
---|
[5498] | 134 | // Do the PNode loading stuff |
---|
[6512] | 135 | PNode::loadParams(root); |
---|
[5498] | 136 | |
---|
[6222] | 137 | LoadParam(root, "md2texture", this, WorldEntity, loadMD2Texture) |
---|
[6430] | 138 | .describe("the fileName of the texture, that should be loaded onto this world-entity. (must be relative to the data-dir)") |
---|
[7198] | 139 | .defaultValues(""); |
---|
[6222] | 140 | |
---|
[4436] | 141 | // Model Loading |
---|
[5671] | 142 | LoadParam(root, "model", this, WorldEntity, loadModel) |
---|
[6430] | 143 | .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)") |
---|
[7198] | 144 | .defaultValues("", 1.0f, 0); |
---|
[6430] | 145 | |
---|
[10088] | 146 | // Entity Attributes |
---|
[6700] | 147 | LoadParam(root, "maxHealth", this, WorldEntity, setHealthMax) |
---|
| 148 | .describe("The Maximum health that can be loaded onto this entity") |
---|
[7198] | 149 | .defaultValues(1.0f); |
---|
[6430] | 150 | |
---|
[6700] | 151 | LoadParam(root, "health", this, WorldEntity, setHealth) |
---|
| 152 | .describe("The Health the WorldEntity has at this moment") |
---|
[7198] | 153 | .defaultValues(1.0f); |
---|
[9656] | 154 | |
---|
| 155 | LoadParam(root, "list", this, WorldEntity, toListS); |
---|
[10088] | 156 | |
---|
| 157 | |
---|
| 158 | // Track |
---|
| 159 | LoadParamXML(root, "Track", this, WorldEntity, addTrack) |
---|
| 160 | .describe("creates and adds a track to this WorldEntity"); |
---|
[4436] | 161 | } |
---|
| 162 | |
---|
[6222] | 163 | |
---|
[3531] | 164 | /** |
---|
[10088] | 165 | * this functions adds a track to this workd entity. This can be usefull, if you like this WE to follow a some waypoints. |
---|
| 166 | * here the track is created and further initializing left for the Track itself |
---|
| 167 | */ |
---|
| 168 | void WorldEntity::addTrack(const TiXmlElement* root) |
---|
| 169 | { |
---|
[10096] | 170 | |
---|
| 171 | this->entityTrack = new Track(); |
---|
| 172 | this->setParent(this->entityTrack->getTrackNode()); |
---|
| 173 | this->entityTrack->getTrackNode()->setParentMode(PNODE_ALL); |
---|
[10088] | 174 | LOAD_PARAM_START_CYCLE(root, element); |
---|
| 175 | { |
---|
| 176 | PRINTF(4)("element is: %s\n", element->Value()); |
---|
| 177 | Factory::fabricate(element); |
---|
| 178 | } |
---|
| 179 | LOAD_PARAM_END_CYCLE(element); |
---|
[10096] | 180 | |
---|
| 181 | |
---|
[10088] | 182 | } |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | /** |
---|
[4885] | 186 | * loads a Model onto a WorldEntity |
---|
[4836] | 187 | * @param fileName the name of the model to load |
---|
[5057] | 188 | * @param scaling the Scaling of the model |
---|
[7711] | 189 | * |
---|
| 190 | * FIXME |
---|
| 191 | * @todo: separate the obb tree generation from the model |
---|
[7221] | 192 | */ |
---|
[7711] | 193 | void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber, unsigned int obbTreeDepth) |
---|
[4261] | 194 | { |
---|
[6695] | 195 | this->modelLODName = fileName; |
---|
[6424] | 196 | this->scaling = scaling; |
---|
[7954] | 197 | |
---|
| 198 | std::string name = fileName; |
---|
| 199 | |
---|
[9869] | 200 | if ( name.find( Resources::ResourceManager::getInstance()->mainGlobalPath().name() ) == 0 ) |
---|
[7954] | 201 | { |
---|
[9869] | 202 | name.erase(Resources::ResourceManager::getInstance()->mainGlobalPath().name().size()); |
---|
[7954] | 203 | } |
---|
| 204 | |
---|
| 205 | this->modelFileName = name; |
---|
| 206 | |
---|
[7221] | 207 | if (!fileName.empty()) |
---|
[6142] | 208 | { |
---|
[6430] | 209 | // search for the special character # in the LoadParam |
---|
[7221] | 210 | if (fileName.find('#') != std::string::npos) |
---|
[6222] | 211 | { |
---|
[7221] | 212 | PRINTF(4)("Found # in %s... searching for LOD's\n", fileName.c_str()); |
---|
| 213 | std::string lodFile = fileName; |
---|
| 214 | unsigned int offset = lodFile.find('#'); |
---|
[6720] | 215 | for (unsigned int i = 0; i < 3; i++) |
---|
[6005] | 216 | { |
---|
[7221] | 217 | lodFile[offset] = 48+(int)i; |
---|
[9869] | 218 | if (Resources::ResourceManager::getInstance()->checkFileInMainPath( lodFile)) |
---|
[6222] | 219 | this->loadModel(lodFile, scaling, i); |
---|
[6005] | 220 | } |
---|
[6222] | 221 | return; |
---|
| 222 | } |
---|
[6720] | 223 | if (this->scaling <= 0.0) |
---|
[6424] | 224 | { |
---|
[7193] | 225 | PRINTF(1)("YOU GAVE ME A CRAPY SCALE resetting to 1.0\n"); |
---|
[6720] | 226 | this->scaling = 1.0; |
---|
[6424] | 227 | } |
---|
[9869] | 228 | /// LOADING AN OBJ FILE |
---|
[7221] | 229 | if(fileName.find(".obj") != std::string::npos) |
---|
[6222] | 230 | { |
---|
[7221] | 231 | PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str()); |
---|
[9869] | 232 | StaticModel* model = new StaticModel(); |
---|
| 233 | *model = ResourceOBJ(fileName, this->scaling); |
---|
| 234 | if (model->getVertexCount() > 0) |
---|
| 235 | { |
---|
| 236 | this->setModel(model, modelNumber); |
---|
| 237 | if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */) |
---|
| 238 | this->buildObbTree(obbTreeDepth); |
---|
| 239 | } |
---|
[7221] | 240 | else |
---|
[9869] | 241 | delete model; |
---|
[6222] | 242 | } |
---|
[9869] | 243 | /// LOADING AN MD2-model |
---|
[7221] | 244 | else if(fileName.find(".md2") != std::string::npos) |
---|
[6222] | 245 | { |
---|
[7221] | 246 | PRINTF(4)("fetching MD2 file: %s\n", fileName.c_str()); |
---|
[7055] | 247 | Model* m = new MD2Model(fileName, this->md2TextureFileName, this->scaling); |
---|
[6430] | 248 | //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0); |
---|
[6222] | 249 | this->setModel(m, 0); |
---|
[7068] | 250 | |
---|
| 251 | if( m != NULL) |
---|
[7711] | 252 | this->buildObbTree(obbTreeDepth); |
---|
[6222] | 253 | } |
---|
[9869] | 254 | /// LOADING AN MD3-MODEL. |
---|
[9235] | 255 | else if(fileName.find(".md3") != std::string::npos) |
---|
[8490] | 256 | { |
---|
| 257 | PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str()); |
---|
[9869] | 258 | // Model* m = new md3::MD3Model(fileName, this->scaling); |
---|
| 259 | // this->setModel(m, 0); |
---|
[8490] | 260 | |
---|
[9869] | 261 | // if( m != NULL) |
---|
| 262 | // this->buildObbTree(obbTreeDepth); |
---|
[8490] | 263 | } |
---|
[4732] | 264 | } |
---|
| 265 | else |
---|
[6341] | 266 | { |
---|
[5995] | 267 | this->setModel(NULL); |
---|
[6341] | 268 | } |
---|
[4261] | 269 | } |
---|
| 270 | |
---|
[5061] | 271 | /** |
---|
[5994] | 272 | * sets a specific Model for the Object. |
---|
| 273 | * @param model The Model to set |
---|
| 274 | * @param modelNumber the n'th model in the List to get. |
---|
| 275 | */ |
---|
| 276 | void WorldEntity::setModel(Model* model, unsigned int modelNumber) |
---|
| 277 | { |
---|
[5995] | 278 | if (this->models.size() <= modelNumber) |
---|
| 279 | this->models.resize(modelNumber+1, NULL); |
---|
| 280 | |
---|
| 281 | if (this->models[modelNumber] != NULL) |
---|
[6004] | 282 | { |
---|
[9869] | 283 | delete this->models[modelNumber]; |
---|
[5994] | 284 | } |
---|
[6222] | 285 | |
---|
[5995] | 286 | this->models[modelNumber] = model; |
---|
[5994] | 287 | } |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | /** |
---|
[5061] | 291 | * builds the obb-tree |
---|
| 292 | * @param depth the depth to calculate |
---|
| 293 | */ |
---|
[7711] | 294 | bool WorldEntity::buildObbTree(int depth) |
---|
[5061] | 295 | { |
---|
[9494] | 296 | if( this->obbTree != NULL) |
---|
| 297 | { |
---|
[5428] | 298 | delete this->obbTree; |
---|
[9494] | 299 | this->obbTree = NULL; |
---|
| 300 | } |
---|
[5428] | 301 | |
---|
[5995] | 302 | if (this->models[0] != NULL) |
---|
[7711] | 303 | this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this); |
---|
[5428] | 304 | else |
---|
| 305 | { |
---|
[7711] | 306 | PRINTF(1)("could not create obb-tree, because no model was loaded yet\n"); |
---|
[5428] | 307 | this->obbTree = NULL; |
---|
| 308 | return false; |
---|
| 309 | } |
---|
[8724] | 310 | |
---|
| 311 | |
---|
| 312 | // create the axis aligned bounding box |
---|
| 313 | if( this->aabbNode != NULL) |
---|
| 314 | { |
---|
| 315 | delete this->aabbNode; |
---|
| 316 | this->aabbNode = NULL; |
---|
| 317 | } |
---|
| 318 | |
---|
[9869] | 319 | if( this->models[0] != NULL) |
---|
| 320 | { |
---|
[8724] | 321 | this->aabbNode = new AABBTreeNode(); |
---|
| 322 | this->aabbNode->spawnBVTree(this->models[0]); |
---|
| 323 | } |
---|
[9494] | 324 | else |
---|
| 325 | { |
---|
| 326 | PRINTF(1)("could not create aabb bounding box, because no model was loaded yet\n"); |
---|
| 327 | this->aabbNode = NULL; |
---|
| 328 | return false; |
---|
| 329 | } |
---|
[8724] | 330 | return true; |
---|
[5061] | 331 | } |
---|
[5057] | 332 | |
---|
[7927] | 333 | |
---|
[6142] | 334 | /** |
---|
[7927] | 335 | * subscribes this world entity to a collision reaction |
---|
| 336 | * @param type the type of reaction to subscribe to |
---|
[8190] | 337 | * @param target1 a filter target (classID) |
---|
| 338 | */ |
---|
[9869] | 339 | void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1) |
---|
[8190] | 340 | { |
---|
| 341 | this->subscribeReaction(type); |
---|
| 342 | |
---|
| 343 | // add the target filter |
---|
| 344 | this->collisionHandles[type]->addTarget(target1); |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | |
---|
| 348 | /** |
---|
| 349 | * subscribes this world entity to a collision reaction |
---|
| 350 | * @param type the type of reaction to subscribe to |
---|
| 351 | * @param target1 a filter target (classID) |
---|
| 352 | */ |
---|
[9869] | 353 | void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2) |
---|
[8190] | 354 | { |
---|
| 355 | this->subscribeReaction(type); |
---|
| 356 | |
---|
| 357 | // add the target filter |
---|
| 358 | this->collisionHandles[type]->addTarget(target1); |
---|
| 359 | this->collisionHandles[type]->addTarget(target2); |
---|
| 360 | } |
---|
| 361 | |
---|
| 362 | |
---|
| 363 | /** |
---|
| 364 | * subscribes this world entity to a collision reaction |
---|
| 365 | * @param type the type of reaction to subscribe to |
---|
| 366 | * @param target1 a filter target (classID) |
---|
| 367 | */ |
---|
[9869] | 368 | void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3) |
---|
[8190] | 369 | { |
---|
| 370 | this->subscribeReaction(type); |
---|
| 371 | |
---|
| 372 | // add the target filter |
---|
| 373 | this->collisionHandles[type]->addTarget(target1); |
---|
| 374 | this->collisionHandles[type]->addTarget(target2); |
---|
| 375 | this->collisionHandles[type]->addTarget(target3); |
---|
| 376 | } |
---|
| 377 | |
---|
| 378 | |
---|
| 379 | /** |
---|
| 380 | * subscribes this world entity to a collision reaction |
---|
| 381 | * @param type the type of reaction to subscribe to |
---|
| 382 | * @param target1 a filter target (classID) |
---|
| 383 | */ |
---|
[9869] | 384 | void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4) |
---|
[8190] | 385 | { |
---|
| 386 | this->subscribeReaction(type); |
---|
| 387 | |
---|
| 388 | // add the target filter |
---|
| 389 | this->collisionHandles[type]->addTarget(target1); |
---|
| 390 | this->collisionHandles[type]->addTarget(target2); |
---|
| 391 | this->collisionHandles[type]->addTarget(target3); |
---|
| 392 | this->collisionHandles[type]->addTarget(target4); |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | /** |
---|
| 397 | * subscribes this world entity to a collision reaction |
---|
| 398 | * @param type the type of reaction to subscribe to |
---|
[7927] | 399 | * @param nrOfTargets number of target filters |
---|
| 400 | * @param ... the targets as classIDs |
---|
| 401 | */ |
---|
[8190] | 402 | void WorldEntity::subscribeReaction(CREngine::CRType type) |
---|
| 403 | { |
---|
[9869] | 404 | if( this->collisionHandles[type] != NULL) |
---|
| 405 | { |
---|
[8190] | 406 | PRINTF(2)("Registering for a CollisionReaction already subscribed to! Skipping\n"); |
---|
| 407 | return; |
---|
| 408 | } |
---|
[7927] | 409 | |
---|
[8190] | 410 | this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type); |
---|
[7927] | 411 | |
---|
[8190] | 412 | // now there is at least one collision reaction subscribed |
---|
| 413 | this->bReactive = true; |
---|
| 414 | } |
---|
| 415 | |
---|
| 416 | |
---|
[7927] | 417 | /** |
---|
[8190] | 418 | * unsubscribes a specific reaction from the worldentity |
---|
| 419 | * @param type the reaction to unsubscribe |
---|
| 420 | */ |
---|
| 421 | void WorldEntity::unsubscribeReaction(CREngine::CRType type) |
---|
| 422 | { |
---|
| 423 | if( this->collisionHandles[type] == NULL) |
---|
| 424 | return; |
---|
| 425 | |
---|
| 426 | CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]); |
---|
| 427 | this->collisionHandles[type] = NULL; |
---|
| 428 | |
---|
| 429 | // check if there is still any handler registered |
---|
| 430 | for(int i = 0; i < CREngine::CR_NUMBER; ++i) |
---|
| 431 | { |
---|
| 432 | if( this->collisionHandles[i] != NULL) |
---|
| 433 | { |
---|
| 434 | this->bReactive = true; |
---|
| 435 | return; |
---|
| 436 | } |
---|
| 437 | } |
---|
| 438 | this->bReactive = false; |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | |
---|
| 442 | /** |
---|
| 443 | * unsubscribes all collision reactions |
---|
| 444 | */ |
---|
| 445 | void WorldEntity::unsubscribeReaction() |
---|
| 446 | { |
---|
| 447 | for( int i = 0; i < CREngine::CR_NUMBER; i++) |
---|
| 448 | this->unsubscribeReaction((CREngine::CRType)i); |
---|
| 449 | |
---|
| 450 | // there are no reactions subscribed from now on |
---|
| 451 | this->bReactive = false; |
---|
| 452 | } |
---|
| 453 | |
---|
| 454 | |
---|
| 455 | /** |
---|
| 456 | * registers a new collision event to this world entity |
---|
| 457 | * @param entityA entity of the collision |
---|
| 458 | * @param entityB entity of the collision |
---|
| 459 | * @param bvA colliding bounding volume of entityA |
---|
| 460 | * @param bvB colliding bounding volume of entityA |
---|
| 461 | */ |
---|
| 462 | bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) |
---|
| 463 | { |
---|
[9406] | 464 | PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassCName(), entityB->getClassCName()); |
---|
[8190] | 465 | // is there any handler listening? |
---|
| 466 | if( !this->bReactive) |
---|
| 467 | return false; |
---|
| 468 | |
---|
| 469 | // get a collision event |
---|
| 470 | CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject(); |
---|
| 471 | assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h |
---|
[8894] | 472 | c->collide(COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB); |
---|
[8190] | 473 | |
---|
| 474 | for( int i = 0; i < CREngine::CR_NUMBER; ++i) |
---|
| 475 | if( this->collisionHandles[i] != NULL) |
---|
| 476 | this->collisionHandles[i]->registerCollisionEvent(c); |
---|
[8316] | 477 | return true; |
---|
[8190] | 478 | } |
---|
| 479 | |
---|
| 480 | |
---|
| 481 | /** |
---|
| 482 | * registers a new collision event to this woeld entity |
---|
| 483 | * @param entity the entity that collides |
---|
| 484 | * @param plane it stands on |
---|
| 485 | * @param position it collides on the plane |
---|
| 486 | */ |
---|
[8894] | 487 | bool WorldEntity::registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall) |
---|
[8190] | 488 | { |
---|
| 489 | // is there any handler listening? |
---|
| 490 | if( !this->bReactive) |
---|
| 491 | return false; |
---|
| 492 | |
---|
| 493 | // get a collision event |
---|
| 494 | CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject(); |
---|
| 495 | assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h |
---|
[8894] | 496 | c->collide(type, entity, groundEntity, normal, position, bInWall); |
---|
[8190] | 497 | |
---|
| 498 | for( int i = 0; i < CREngine::CR_NUMBER; ++i) |
---|
| 499 | if( this->collisionHandles[i] != NULL) |
---|
| 500 | this->collisionHandles[i]->registerCollisionEvent(c); |
---|
[8316] | 501 | return true; |
---|
[8190] | 502 | } |
---|
| 503 | |
---|
| 504 | |
---|
| 505 | /** |
---|
[6142] | 506 | * @brief moves this entity to the List OM_List |
---|
| 507 | * @param list the list to set this Entity to. |
---|
| 508 | * |
---|
| 509 | * this is the same as a call to State::getObjectManager()->toList(entity , list); |
---|
| 510 | * directly, but with an easier interface. |
---|
| 511 | * |
---|
| 512 | * @todo inline this (peut etre) |
---|
| 513 | */ |
---|
| 514 | void WorldEntity::toList(OM_LIST list) |
---|
| 515 | { |
---|
| 516 | State::getObjectManager()->toList(this, list); |
---|
| 517 | } |
---|
[5061] | 518 | |
---|
[9656] | 519 | void WorldEntity::toListS(const std::string& listName) |
---|
| 520 | { |
---|
| 521 | OM_LIST id = ObjectManager::StringToOMList(listName); |
---|
| 522 | if (id != OM_NULL) |
---|
| 523 | this->toList(id); |
---|
| 524 | else |
---|
| 525 | PRINTF(2)("List %s not found\n", listName.c_str()); |
---|
| 526 | } |
---|
| 527 | |
---|
| 528 | |
---|
[8037] | 529 | void WorldEntity::toReflectionList() |
---|
| 530 | { |
---|
| 531 | State::getObjectManager()->toReflectionList( this ); |
---|
| 532 | } |
---|
[6142] | 533 | |
---|
[8037] | 534 | void removeFromReflectionList() |
---|
| 535 | { |
---|
[9869] | 536 | /// TODO |
---|
| 537 | /// State::getObject |
---|
[8037] | 538 | } |
---|
[6142] | 539 | |
---|
[4261] | 540 | /** |
---|
[4885] | 541 | * sets the character attributes of a worldentity |
---|
[4836] | 542 | * @param character attributes |
---|
[4885] | 543 | * |
---|
| 544 | * these attributes don't have to be set, only use them, if you need them |
---|
[2043] | 545 | */ |
---|
[5498] | 546 | //void WorldEntity::setCharacterAttributes(CharacterAttributes* charAttr) |
---|
| 547 | //{} |
---|
[2036] | 548 | |
---|
[3583] | 549 | |
---|
[2043] | 550 | /** |
---|
[5029] | 551 | * this function is called, when two entities collide |
---|
| 552 | * @param entity: the world entity with whom it collides |
---|
| 553 | * |
---|
| 554 | * Implement behaviour like damage application or other miscellaneous collision stuff in this function |
---|
| 555 | */ |
---|
| 556 | void WorldEntity::collidesWith(WorldEntity* entity, const Vector& location) |
---|
| 557 | { |
---|
[5498] | 558 | /** |
---|
| 559 | * THIS IS A DEFAULT COLLISION-Effect. |
---|
| 560 | * IF YOU WANT TO CREATE A SPECIFIC COLLISION ON EACH OBJECT |
---|
| 561 | * USE:: |
---|
| 562 | * if (entity->isA(CL_WHAT_YOU_ARE_LOOKING_FOR)) { printf "dothings"; }; |
---|
| 563 | * |
---|
| 564 | * You can always define a default Action.... don't be affraid just test it :) |
---|
| 565 | */ |
---|
[9406] | 566 | // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z); |
---|
[5029] | 567 | } |
---|
| 568 | |
---|
[2043] | 569 | |
---|
| 570 | /** |
---|
[8186] | 571 | * this function is called, when two entities collide |
---|
| 572 | * @param entity: the world entity with whom it collides |
---|
| 573 | * |
---|
| 574 | * Implement behaviour like damage application or other miscellaneous collision stuff in this function |
---|
| 575 | */ |
---|
| 576 | void WorldEntity::collidesWithGround(const Vector& location) |
---|
| 577 | { |
---|
[9406] | 578 | PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassCName() ); |
---|
[8186] | 579 | } |
---|
| 580 | |
---|
| 581 | void WorldEntity::collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2) |
---|
| 582 | { |
---|
[8190] | 583 | |
---|
[9406] | 584 | // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassCName() ); |
---|
[8190] | 585 | |
---|
[8186] | 586 | Vector v = this->getAbsDirX(); |
---|
[8490] | 587 | v.x *= 10.1; |
---|
| 588 | v.y *= 10.1; |
---|
| 589 | v.z *= 10.1; |
---|
| 590 | Vector u = Vector(0.0,-20.0,0.0); |
---|
[8190] | 591 | |
---|
[8490] | 592 | |
---|
| 593 | if(!(this->getAbsCoor().x == ray_2.x && this->getAbsCoor().y == ray_2.y && this->getAbsCoor().z == ray_2.z) ) |
---|
[8186] | 594 | { |
---|
[8190] | 595 | |
---|
[9869] | 596 | this->setAbsCoor(ray_2 - v); |
---|
[8490] | 597 | |
---|
[8186] | 598 | } |
---|
[9869] | 599 | else |
---|
[8186] | 600 | { |
---|
| 601 | if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z) |
---|
| 602 | { |
---|
[8190] | 603 | this->setAbsCoor(feet -u ); |
---|
[8186] | 604 | } |
---|
[8190] | 605 | |
---|
| 606 | this->setAbsCoor(ray_2 - v); |
---|
| 607 | |
---|
[8186] | 608 | } |
---|
[8490] | 609 | |
---|
| 610 | |
---|
[8186] | 611 | } |
---|
| 612 | |
---|
| 613 | /** |
---|
[5498] | 614 | * this is called immediately after the Entity has been constructed, initialized and then Spawned into the World |
---|
[4885] | 615 | * |
---|
[5498] | 616 | */ |
---|
[3229] | 617 | void WorldEntity::postSpawn () |
---|
[6430] | 618 | {} |
---|
[2043] | 619 | |
---|
[3583] | 620 | |
---|
[2043] | 621 | /** |
---|
[6959] | 622 | * this method is called by the world if the WorldEntity leaves the game |
---|
[5498] | 623 | */ |
---|
[6959] | 624 | void WorldEntity::leaveWorld () |
---|
[6430] | 625 | {} |
---|
[2043] | 626 | |
---|
[3583] | 627 | |
---|
[2190] | 628 | /** |
---|
[7085] | 629 | * resets the WorldEntity to its initial values. eg. used for multiplayer games: respawning |
---|
| 630 | */ |
---|
| 631 | void WorldEntity::reset() |
---|
[9235] | 632 | { |
---|
| 633 | this->setHealth( this->getHealthMax() ); |
---|
| 634 | } |
---|
[7085] | 635 | |
---|
| 636 | /** |
---|
[4836] | 637 | * this method is called every frame |
---|
| 638 | * @param time: the time in seconds that has passed since the last tick |
---|
[4885] | 639 | * |
---|
| 640 | * Handle all stuff that should update with time inside this method (movement, animation, etc.) |
---|
[2043] | 641 | */ |
---|
[4570] | 642 | void WorldEntity::tick(float time) |
---|
[10096] | 643 | { |
---|
| 644 | } |
---|
[3583] | 645 | |
---|
[5498] | 646 | |
---|
[3583] | 647 | /** |
---|
[4836] | 648 | * the entity is drawn onto the screen with this function |
---|
[4885] | 649 | * |
---|
| 650 | * This is a central function of an entity: call it to let the entity painted to the screen. |
---|
| 651 | * Just override this function with whatever you want to be drawn. |
---|
[3365] | 652 | */ |
---|
[5500] | 653 | void WorldEntity::draw() const |
---|
[3803] | 654 | { |
---|
[9406] | 655 | //PRINTF(0)("(%s::%s)\n", this->getClassCName(), this->getName()); |
---|
[6281] | 656 | // assert(!unlikely(this->models.empty())); |
---|
[6002] | 657 | { |
---|
| 658 | glMatrixMode(GL_MODELVIEW); |
---|
| 659 | glPushMatrix(); |
---|
[4570] | 660 | |
---|
[6002] | 661 | /* translate */ |
---|
| 662 | glTranslatef (this->getAbsCoor ().x, |
---|
| 663 | this->getAbsCoor ().y, |
---|
| 664 | this->getAbsCoor ().z); |
---|
[6004] | 665 | Vector tmpRot = this->getAbsDir().getSpacialAxis(); |
---|
| 666 | glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); |
---|
[2043] | 667 | |
---|
[6004] | 668 | |
---|
| 669 | // This Draws the LOD's |
---|
[7014] | 670 | float cameraDistance = State::getCamera()->distance(this); |
---|
[6004] | 671 | if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL) |
---|
[6002] | 672 | { |
---|
[6222] | 673 | this->models[2]->draw(); |
---|
[6004] | 674 | } |
---|
| 675 | else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL) |
---|
[6002] | 676 | { |
---|
| 677 | this->models[1]->draw(); |
---|
[6004] | 678 | } |
---|
| 679 | else if (this->models.size() >= 1 && this->models[0] != NULL) |
---|
[6002] | 680 | { |
---|
| 681 | this->models[0]->draw(); |
---|
| 682 | } |
---|
[8724] | 683 | |
---|
[9869] | 684 | // if( this->aabbNode != NULL) |
---|
| 685 | // this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true); |
---|
[8724] | 686 | |
---|
[6002] | 687 | glPopMatrix(); |
---|
| 688 | } |
---|
[3803] | 689 | } |
---|
[3583] | 690 | |
---|
[6430] | 691 | /** |
---|
[6700] | 692 | * @param health the Health to add. |
---|
| 693 | * @returns the health left (this->healthMax - health+this->health) |
---|
[6430] | 694 | */ |
---|
[6700] | 695 | float WorldEntity::increaseHealth(float health) |
---|
[6430] | 696 | { |
---|
[6700] | 697 | this->health += health; |
---|
| 698 | if (this->health > this->healthMax) |
---|
[6430] | 699 | { |
---|
[6700] | 700 | float retHealth = this->healthMax - this->health; |
---|
| 701 | this->health = this->healthMax; |
---|
| 702 | this->updateHealthWidget(); |
---|
| 703 | return retHealth; |
---|
[6430] | 704 | } |
---|
[6700] | 705 | this->updateHealthWidget(); |
---|
[6430] | 706 | return 0.0; |
---|
| 707 | } |
---|
[6281] | 708 | |
---|
[5498] | 709 | /** |
---|
[6700] | 710 | * @param health the Health to be removed |
---|
[6430] | 711 | * @returns 0.0 or the rest, that was not substracted (bellow 0.0) |
---|
| 712 | */ |
---|
[6700] | 713 | float WorldEntity::decreaseHealth(float health) |
---|
[6430] | 714 | { |
---|
[6700] | 715 | this->health -= health; |
---|
[6430] | 716 | |
---|
[6700] | 717 | if (this->health < 0) |
---|
[6430] | 718 | { |
---|
[6700] | 719 | float retHealth = -this->health; |
---|
| 720 | this->health = 0.0f; |
---|
| 721 | this->updateHealthWidget(); |
---|
| 722 | return retHealth; |
---|
[6430] | 723 | } |
---|
[6700] | 724 | this->updateHealthWidget(); |
---|
[6430] | 725 | return 0.0; |
---|
| 726 | |
---|
| 727 | } |
---|
| 728 | |
---|
| 729 | /** |
---|
[6700] | 730 | * @param maxHealth the maximal health that can be loaded onto the entity. |
---|
[6430] | 731 | */ |
---|
[6700] | 732 | void WorldEntity::setHealthMax(float healthMax) |
---|
[6430] | 733 | { |
---|
[6700] | 734 | this->healthMax = healthMax; |
---|
| 735 | if (this->health > this->healthMax) |
---|
[6430] | 736 | { |
---|
[9406] | 737 | PRINTF(3)("new maxHealth is bigger as the old health. Did you really intend to do this for (%s::%s)\n", this->getClassCName(), this->getCName()); |
---|
[6700] | 738 | this->health = this->healthMax; |
---|
[6430] | 739 | } |
---|
[6700] | 740 | this->updateHealthWidget(); |
---|
[6430] | 741 | } |
---|
| 742 | |
---|
[6431] | 743 | /** |
---|
[6700] | 744 | * @brief creates the HealthWidget |
---|
[6431] | 745 | * |
---|
[6700] | 746 | * since not all entities need an HealthWidget, it is only created on request. |
---|
[6431] | 747 | */ |
---|
[6700] | 748 | void WorldEntity::createHealthWidget() |
---|
[6430] | 749 | { |
---|
[6700] | 750 | if (this->healthWidget == NULL) |
---|
[6430] | 751 | { |
---|
[8974] | 752 | this->healthWidget = new OrxGui::GLGuiEnergyWidget(); |
---|
[8977] | 753 | this->healthWidget->setDisplayedName(std::string(this->getClassName()) + " Energy:"); |
---|
[6700] | 754 | this->healthWidget->setSize2D(30,400); |
---|
| 755 | this->healthWidget->setAbsCoor2D(10,100); |
---|
[6430] | 756 | |
---|
[6700] | 757 | this->updateHealthWidget(); |
---|
[6430] | 758 | } |
---|
| 759 | else |
---|
[9406] | 760 | PRINTF(3)("Allready created the HealthWidget for %s::%s\n", this->getClassCName(), this->getCName()); |
---|
[6430] | 761 | } |
---|
| 762 | |
---|
[6700] | 763 | void WorldEntity::increaseHealthMax(float increaseHealth) |
---|
[6440] | 764 | { |
---|
[6700] | 765 | this->healthMax += increaseHealth; |
---|
| 766 | this->updateHealthWidget(); |
---|
[6440] | 767 | } |
---|
| 768 | |
---|
[6700] | 769 | |
---|
[7779] | 770 | OrxGui::GLGuiWidget* WorldEntity::getHealthWidget() |
---|
[6700] | 771 | { |
---|
| 772 | this->createHealthWidget(); |
---|
| 773 | return this->healthWidget; |
---|
| 774 | } |
---|
| 775 | |
---|
[6431] | 776 | /** |
---|
[6700] | 777 | * @param visibility shows or hides the health-bar |
---|
[6431] | 778 | * (creates the widget if needed) |
---|
| 779 | */ |
---|
[6700] | 780 | void WorldEntity::setHealthWidgetVisibilit(bool visibility) |
---|
[6430] | 781 | { |
---|
[7198] | 782 | if (visibility) |
---|
| 783 | { |
---|
| 784 | if (this->healthWidget != NULL) |
---|
| 785 | this->healthWidget->show(); |
---|
| 786 | else |
---|
[6430] | 787 | { |
---|
[7198] | 788 | this->createHealthWidget(); |
---|
| 789 | this->updateHealthWidget(); |
---|
| 790 | this->healthWidget->show(); |
---|
[6430] | 791 | } |
---|
[7198] | 792 | } |
---|
| 793 | else if (this->healthWidget != NULL) |
---|
| 794 | this->healthWidget->hide(); |
---|
[6430] | 795 | } |
---|
| 796 | |
---|
[8724] | 797 | |
---|
[6431] | 798 | /** |
---|
[8724] | 799 | * hit the world entity with |
---|
| 800 | * @param damage damage to be dealt |
---|
| 801 | */ |
---|
[9008] | 802 | void WorldEntity::hit(float damage, WorldEntity* killer) |
---|
[8724] | 803 | { |
---|
| 804 | this->decreaseHealth(damage); |
---|
| 805 | |
---|
[9406] | 806 | PRINTF(5)("Hit me: %s::%s now only %f/%f health\n", this->getClassCName(), this->getCName(), this->getHealth(), this->getHealthMax()); |
---|
[8777] | 807 | |
---|
[8724] | 808 | if( this->getHealth() > 0) |
---|
| 809 | { |
---|
| 810 | // any small explosion animaitions |
---|
| 811 | } |
---|
| 812 | else |
---|
| 813 | { |
---|
[9235] | 814 | this->destroy( killer ); |
---|
[8724] | 815 | } |
---|
| 816 | } |
---|
| 817 | |
---|
| 818 | |
---|
| 819 | /** |
---|
[8777] | 820 | * destoys the world entity |
---|
| 821 | */ |
---|
[9235] | 822 | void WorldEntity::destroy(WorldEntity* killer) |
---|
[8777] | 823 | { |
---|
| 824 | this->toList(OM_DEAD); |
---|
| 825 | } |
---|
| 826 | |
---|
| 827 | |
---|
| 828 | /** |
---|
[6700] | 829 | * @brief updates the HealthWidget |
---|
[6431] | 830 | */ |
---|
[6700] | 831 | void WorldEntity::updateHealthWidget() |
---|
[6430] | 832 | { |
---|
[6700] | 833 | if (this->healthWidget != NULL) |
---|
[6430] | 834 | { |
---|
[6700] | 835 | this->healthWidget->setMaximum(this->healthMax); |
---|
| 836 | this->healthWidget->setValue(this->health); |
---|
[6430] | 837 | } |
---|
| 838 | } |
---|
| 839 | |
---|
| 840 | |
---|
| 841 | /** |
---|
[5498] | 842 | * DEBUG-DRAW OF THE BV-Tree. |
---|
| 843 | * @param depth What depth to draw |
---|
| 844 | * @param drawMode the mode to draw this entity under |
---|
| 845 | */ |
---|
[7711] | 846 | void WorldEntity::drawBVTree(int depth, int drawMode) const |
---|
[4684] | 847 | { |
---|
| 848 | glMatrixMode(GL_MODELVIEW); |
---|
| 849 | glPushMatrix(); |
---|
| 850 | /* translate */ |
---|
| 851 | glTranslatef (this->getAbsCoor ().x, |
---|
| 852 | this->getAbsCoor ().y, |
---|
| 853 | this->getAbsCoor ().z); |
---|
| 854 | /* rotate */ |
---|
[4998] | 855 | Vector tmpRot = this->getAbsDir().getSpacialAxis(); |
---|
| 856 | glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); |
---|
[4684] | 857 | |
---|
[7711] | 858 | |
---|
[4684] | 859 | if (this->obbTree) |
---|
| 860 | this->obbTree->drawBV(depth, drawMode); |
---|
[7711] | 861 | |
---|
| 862 | |
---|
[4684] | 863 | glPopMatrix(); |
---|
| 864 | } |
---|
[6341] | 865 | |
---|
[6424] | 866 | |
---|
[6341] | 867 | /** |
---|
[6424] | 868 | * Debug the WorldEntity |
---|
| 869 | */ |
---|
| 870 | void WorldEntity::debugEntity() const |
---|
| 871 | { |
---|
[9406] | 872 | PRINT(0)("WorldEntity %s::%s (DEBUG)\n", this->getClassCName(), this->getCName()); |
---|
[6424] | 873 | this->debugNode(); |
---|
[9656] | 874 | PRINT(0)("List: %s ; ModelCount %d - ", ObjectManager::OMListToString(this->objectListNumber).c_str(), this->models.size()); |
---|
[6424] | 875 | for (unsigned int i = 0; i < this->models.size(); i++) |
---|
| 876 | { |
---|
| 877 | if (models[i] != NULL) |
---|
[9406] | 878 | PRINT(0)(" : %d:%s", i, this->models[i]->getCName()); |
---|
[6424] | 879 | } |
---|
| 880 | PRINT(0)("\n"); |
---|
| 881 | |
---|
| 882 | } |
---|
| 883 | |
---|
| 884 | |
---|
| 885 | /** |
---|
[7954] | 886 | * handler for changes on registred vars |
---|
| 887 | * @param id id's which changed |
---|
[6341] | 888 | */ |
---|
[7954] | 889 | void WorldEntity::varChangeHandler( std::list< int > & id ) |
---|
[6341] | 890 | { |
---|
[7954] | 891 | if ( std::find( id.begin(), id.end(), modelFileName_handle ) != id.end() || |
---|
| 892 | std::find( id.begin(), id.end(), scaling_handle ) != id.end() |
---|
| 893 | ) |
---|
[6341] | 894 | { |
---|
[7954] | 895 | loadModel( modelFileName, scaling ); |
---|
[6341] | 896 | } |
---|
| 897 | |
---|
[9008] | 898 | if ( std::find( id.begin(), id.end(), list_handle ) != id.end() ) |
---|
| 899 | { |
---|
| 900 | this->toList( (OM_LIST)list_write ); |
---|
| 901 | } |
---|
[9235] | 902 | |
---|
[9110] | 903 | if ( std::find( id.begin(), id.end(), health_handle ) != id.end() ) |
---|
| 904 | { |
---|
| 905 | this->setHealth( health_write ); |
---|
| 906 | } |
---|
[9235] | 907 | |
---|
[9110] | 908 | if ( std::find( id.begin(), id.end(), healthMax_handle ) != id.end() ) |
---|
| 909 | { |
---|
| 910 | this->setHealthMax( healthMax_write ); |
---|
| 911 | } |
---|
[9008] | 912 | |
---|
[7954] | 913 | PNode::varChangeHandler( id ); |
---|
[6341] | 914 | } |
---|
| 915 | |
---|