MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / processMoveActions

Method processMoveActions

Source/BaseGameLayer.cpp:449–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449void BaseGameLayer::processMoveActions(float dt)
450{
451 for (auto dictObject : this->_effectManager->_activeMoveActions)
452 {
453 GroupProperties* currentGroup;
454 float x, y;
455 if (!this->_groups.contains(dictObject.first))
456 {
457 GroupProperties gp;
458 this->_groups.insert({dictObject.first, gp});
459 currentGroup = &gp;
460 }
461 else
462 currentGroup = &this->_groups[dictObject.first];
463 x = dictObject.second->_newPosOptimized.x;
464 y = dictObject.second->_newPosOptimized.y;
465
466 if (currentGroup && (x != 0 || y != 0))
467 {
468 for (auto obj : currentGroup->_objects)
469 {
470 if (!obj->_unkbool)
471 {
472 obj->_firstPosition.x = obj->_startPosition.x + obj->_startPosOffset.x;
473 obj->_firstPosition.y = obj->_startPosition.y + obj->_startPosOffset.y;
474 obj->_unkbool = true;
475 }
476
477 if (y != 0)
478 {
479 obj->_startPosOffset.y += y;
480 }
481 if (x != 0)
482 {
483 obj->_startPosOffset.x += x;
484
485 int sectionSize = this->_sectionObjects.size();
486 auto section = BaseGameLayer::sectionForPos(obj->_startPosition.x + obj->_startPosOffset.x);
487 section = section - 1 < 0 ? 0 : section - 1;
488 if (obj->_section != section)
489 {
490 auto vec = &this->_sectionObjects[obj->_section];
491 auto newEnd = std::partition(vec->begin(), vec->end(), [&](GameObject* a) { return a != obj; });
492 vec->resize(newEnd - vec->begin());
493 while (section >= sectionSize)
494 {
495 std::vector<GameObject*> vec;
496 this->_sectionObjects.push_back(vec);
497 sectionSize++;
498 }
499 this->_sectionObjects[section].push_back(obj);
500 obj->_section = section;
501 }
502 }
503 }
504 }
505 }
506}

Callers 1

Calls 3

sizeMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected