Exemplo n.º 1
0
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())
	{
	}
}
Exemplo n.º 2
0
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();
	}
}
Exemplo n.º 3
0
// 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();
}
Exemplo n.º 4
0
    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));
    }
Exemplo n.º 5
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Vec3 Node::convertLocalToWorldPosition(const Vec3 &v)
 {
     //FIX?
     if (needsUpdate_)
         recache();
     
     return cached_transform_ * position_;
 }
Exemplo n.º 6
0
// 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();
}
Exemplo n.º 7
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Vec3 Node::convertWorldToLocalPosition(const Vec3 &v)
 {
     //FIX?
     if (needsUpdate_)
         recache();
     
     return cached_transform_.inverse() * position_;
 }
Exemplo n.º 8
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Quat Node::convertLocalToWorldOrientation(const Quat &v)
 {
     //FIX!
     if (needsUpdate_)
         recache();
     
     return v * derivedOrientation_;
 }
Exemplo n.º 9
0
 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();
     }
 }
Exemplo n.º 10
0
// 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();
}
Exemplo n.º 11
0
	Plane::Plane(const PM::vec3& pos, const PM::vec3& xAxis, const PM::vec3& yAxis) :
		mPosition(pos), mXAxis(xAxis), mYAxis(yAxis)
	{
		recache();
	}
Exemplo n.º 12
0
UIVMItem::UIVMItem(const CMachine &aMachine)
    : m_machine(aMachine)
{
    recache();
}
Exemplo n.º 13
0
	void Plane::setAxis(const PM::vec3& xAxis, const PM::vec3& yAxis)
	{
		mXAxis = xAxis;
		mYAxis = yAxis;
		recache();
	}
Exemplo n.º 14
0
// 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();
}
Exemplo n.º 15
0
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();
}
Exemplo n.º 16
0
	void Plane::setYAxis(const PM::vec3& v)
	{
		mYAxis = v;
		recache();
	}
Exemplo n.º 17
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Quat Node::getDerivedOrientation()
 {
     if (getNeedsUpdate())
         recache();
     return derivedOrientation_;
 }
Exemplo n.º 18
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Vec3 Node::getDerivedScale()
 {
     if (getNeedsUpdate())
         recache();
     return derivedScale_;
 }
Exemplo n.º 19
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Vec3 Node::getDerivedPosition()
 {
     if (getNeedsUpdate())
         recache();
     return derivedPosition_;
 }
Exemplo n.º 20
0
Arquivo: Node.cpp Projeto: Sudoka/D3
 Mat4 & Node::getCachedTransformRef()
 {
     if (getNeedsUpdate())
         recache();
     return cached_transform_;
 }