Jump to content

DoorClass advanceThreads not called


Recommended Posts

I gave a try to the free DoorClass from http://www.richardsgamestudio.com/ and I couldn't get it to work. I tried to debug it and I notice that the Door::advanceThreads(F32 dt) function is not called and it contain important code to deal with the opened/closed state. I tried different things but got no success to get the advanceThreads call. I have been able to make it work by using the onSequenceEnd callback and hidding the ColMeshes with the script but I'd prefer to use the code..

Anyone have an idea about what's is happening? Something have changed in this area recently?

The parent ShapeBase::advanceThreads(F32 dt) get called, shouldn't the Door function be called before since it's a child? The function is public and from previous experience, it should be called...right? :oops: I think the code setup is made so that only the Door::advanceThreads(F32 dt) get called, what you think is missing?

You can grab the DoorClass files from there: http://www.richardsgamestudio.com/downloadDoorPack.html

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

I'm not sure, there is a small bug in Door::packUpdate and Door::unpackUpdate that dont update door property islocked on editor

The commented lines make work...


U32 Door::packUpdate(NetConnection *connection, U32 mask, BitStream *stream)
	Con::errorf(ConsoleLogEntry::General, "Door::packUpdate");
	U32 retMask = Parent::packUpdate(connection, mask, stream);
	//if (stream->writeFlag(mask & OpenMask))<--------if enabled, dont update door property islocked on editor 
	//if (stream->writeFlag(mask & LockMask))<--------if enabled, dont update door property islocked on editor 
	if (stream->writeFlag(key))
		stream->writeRangedU32(key->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
//...rest of code


why only stream->writeFlag(mask & LockMask) dont work however only stream->writeFlag(mIsLocked); work ? :?:


void Door::unpackUpdate(NetConnection *connection, BitStream *stream)
	Con::errorf(ConsoleLogEntry::General, "Door::unpackUpdate");
	Parent::unpackUpdate(connection, stream);
	mBlockCheckEnable = stream->readFlag();
	Con::errorf(ConsoleLogEntry::General, "mBlockCheckEnable %d",mBlockCheckEnable);
	//if (stream->readFlag())   <-------if enabled, dont update door property islocked on editor 
		mIsOpen = stream->readFlag();
		Con::errorf(ConsoleLogEntry::General, "mIsOpen %d",mIsOpen);
	//if (stream->readFlag()) <--------if enabled, dont update door property islocked on editor 
		mIsLocked = stream->readFlag();
		Con::errorf(ConsoleLogEntry::General, "mIsLocked %d",mIsLocked);
//...rest of code


if I am not mistaken, both BitStream::writeFlag() and BitStream::readFlag() foward the bit mask from bitNum , if i call two times subsequently I would not take the wrong bit ?

Thanks for any help!

Link to comment
Share on other sites

I can conclude that for boolean types, is not necessary pre check of bits as :

if (stream->writeFlag(mask & bitMask))

stream->writeFlag(mMyBool );

So instead I write and read directly the boolean...


stream->writeFlag(mMyBool );


mMyBool = stream->readFlag();

This is what I've seen in others codes as player.cpp ...

Link to comment
Share on other sites

  • 1 month later...

Hi all,

I was going to make my own topic for this, but since this post is so recent, I will add my question to this post, hopefully it will get seen.

I am also having issues with this resource. I have the code compiling with no difficulties, and I have created the example door provided with the resource in my level.

With the door closed, I cannot pass through it, which is expected.

I can then call %obj.opendoor(), which plays the open animation, provided the player isn't blocking the door, this is expected.

However, even with the door open, I still can't pass through, it seems there is an issue with the collision. This is the same issue I had with doors, which is why I downloaded this pack.

I also cannot play the closedoor() animation at all, it returns 0, even when the player is not blocking the door.

I tried this with and without the code changes given in this thread.

I think we really need a good door resource working and included in the engine, it is a standard feature with any game project. If I can't get the working, I will have to resort to my usual method of creating doors, which is to create a door object with no collision, then create another invisible object with collision, and move the invisible object as the door opens using .settransform().

This works, but it's not ideal, I'm sure we can do better!

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...