void Mod::applyStart() { enqueueModStart = 0; core->popAllStates(); core->clearGarbage(); recache(); dsq->continuity.reset(); // load the mod-init.lua file // which is in the root of the mod's folder // e.g. _mods/recachetest/ std::string scriptPath = path + "mod-init.lua"; debugLog("scriptPath: " + scriptPath); if (!dsq->runScript(scriptPath, "init")) { debugLog("MOD: runscript failed"); dsq->continuity.reset(); setActive(false); dsq->continuity.reset(); dsq->title(); } if (isActive() && dsq->game->sceneToLoad.empty()) { debugLog("MOD: no scene loaded in mod-init"); dsq->continuity.reset(); setActive(false); dsq->continuity.reset(); dsq->title(); } else if (isActive()) { } }
void Mod::setActive(bool a) { bool wasActive = active; active = a; if (wasActive != active) { if (!active) { name = path = ""; dsq->secondaryTexturePath = ""; dsq->sound->audioPath2 = ""; dsq->sound->setVoicePath2(""); SkeletalSprite::secondaryAnimationPath = ""; dsq->particleBank2 = ""; dsq->shotBank2 = ""; Shot::loadShotBank(dsq->shotBank1, dsq->shotBank2); particleManager->loadParticleBank(dsq->particleBank1, dsq->particleBank2); dsq->setFilter(dsq->dsq_filter); recache(); } dsq->game->loadEntityTypeList(); } }
// remove the element at index void GrowableCache::remove (int index) { GrowableElement *e = _elements->at(index); assert(e != NULL, "e != NULL"); _elements->remove(e); delete e; recache(); }
void MoveSplineUpdatable::PrepareMoveSplineArgs(MoveSplineInitArgs& args, UnitMoveFlag& moveFlag_new) { // There is a big chance that current position is outdated in case movement was already launched. // So, to lauch new movement from current _real_ position need update old state if (isEnabled()) recache(1); mov_assert(!args.path.empty()); args.path[0] = m_owner.GetPosition3(); //correct first vertex args.splineId = m_owner.Updater().NewMoveSplineId(); args.initialOrientation = m_owner.GetPosition().orientation; // logic from client here: { moveFlag_new &= ~(UnitMoveFlag::Mask_Directions | UnitMoveFlag::Mask_Moving); moveFlag_new.backward = args.flags.backward; //moveFlag_new.forward = !args.flags.backward && !args.flags.falling; moveFlag_new.forward = true; moveFlag_new.spline_enabled = true; moveFlag_new.walk_mode = !args.flags.runmode; if (args.flags.falling) // disable flying { moveFlag_new &= ~(UnitMoveFlag::Pitch_Up | UnitMoveFlag::Pitch_Down | UnitMoveFlag::Ascending | UnitMoveFlag::Descending | UnitMoveFlag::Flying); } } // select velocity if was not selected if (args.velocity == 0.f) args.velocity = m_owner.GetParameter(UnitMovementImpl::SelectSpeedType(moveFlag_new & ~UnitMoveFlag::Spline_Enabled)); }
Vec3 Node::convertLocalToWorldPosition(const Vec3 &v) { //FIX? if (needsUpdate_) recache(); return cached_transform_ * position_; }
// clear out all elements, release all heap space and // let our listener know that things have changed. void GrowableCache::clear() { int len = _elements->length(); for (int i=0; i<len; i++) { delete _elements->at(i); } _elements->clear(); recache(); }
Vec3 Node::convertWorldToLocalPosition(const Vec3 &v) { //FIX? if (needsUpdate_) recache(); return cached_transform_.inverse() * position_; }
Quat Node::convertLocalToWorldOrientation(const Quat &v) { //FIX! if (needsUpdate_) recache(); return v * derivedOrientation_; }
void MoveSplineUpdatable::Execute(TaskExecutor_Args& args) { if (isEnabled()) { recache(1); if (isEnabled()) // migh became disabled during recache args.executor.AddTask(args.callback, NextUpdateTime(), args.objectId); } if (uint32 size = events.size()) { uint32 itr = 0; while (m_listener && itr < size) m_listener->OnEvent(events[itr++]); events.clear(); } }
// insert a copy of the element using lessthan() void GrowableCache::insert(GrowableElement* e) { GrowableElement *new_e = e->clone(); _elements->append(new_e); int n = length()-2; for (int i=n; i>=0; i--) { GrowableElement *e1 = _elements->at(i); GrowableElement *e2 = _elements->at(i+1); if (e2->lessThan(e1)) { _elements->at_put(i+1, e1); _elements->at_put(i, e2); } } recache(); }
Plane::Plane(const PM::vec3& pos, const PM::vec3& xAxis, const PM::vec3& yAxis) : mPosition(pos), mXAxis(xAxis), mYAxis(yAxis) { recache(); }
UIVMItem::UIVMItem(const CMachine &aMachine) : m_machine(aMachine) { recache(); }
void Plane::setAxis(const PM::vec3& xAxis, const PM::vec3& yAxis) { mXAxis = xAxis; mYAxis = yAxis; recache(); }
// append a copy of the element to the end of the collection void GrowableCache::append(GrowableElement* e) { GrowableElement *new_e = e->clone(); _elements->append(new_e); recache(); }
void GrowableCache::initialize(void *this_obj, void listener_fun(void *, address*) ) { _this_obj = this_obj; _listener_fun = listener_fun; _elements = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<GrowableElement*>(5,true); recache(); }
void Plane::setYAxis(const PM::vec3& v) { mYAxis = v; recache(); }
Quat Node::getDerivedOrientation() { if (getNeedsUpdate()) recache(); return derivedOrientation_; }
Vec3 Node::getDerivedScale() { if (getNeedsUpdate()) recache(); return derivedScale_; }
Vec3 Node::getDerivedPosition() { if (getNeedsUpdate()) recache(); return derivedPosition_; }
Mat4 & Node::getCachedTransformRef() { if (getNeedsUpdate()) recache(); return cached_transform_; }