Jump to content
The Dark Mod Forums

Recommended Posts

Posted (edited)

@OrbWeaver:

 

DR has support for Quake 3 map format and it works wonderfully, except that Quake 3 doesn't support "rotation" matrix on entities. Instead it has "angles" "Y Z X" spawnarg.

I am wondering if you can add conversion from Doom 3 "rotation" matrix into "angles" "Y Z X" when map is being saved into Quake 3 format. I am pretty positive DR converts angles into matrix, so angles should be naturally available.

 

To avoid messing with back and forth conversion, I am thinking writing "angles" spawnarg should be done along with "rotation" spawnarg. This way there would be no need to update any code pertaining to displaying entities with correct angles nor converting "angles" into "rotation" when loading Quake 3 maps made in DR. There is no need to update "angles" spawnargs in real-time either. Simply set new values to "angles" spawnarg when saving of the map is happening.

 

Could you please fix it? Thanks beforehand.

Edited by motorsep
Posted (edited)
I think I found what's needed to get this working, but I don't know programming well enough to implement it :/


This would get us angles:




vector3 eulerRad = getEulerAnglesXYZ();



And this would give us degrees for each axis:




float angX = radians_to_degrees(eulerRad.x())
float angY = radians_to_degrees(eulerRad.y())
float angZ = radians_to_degrees(eulerRad.z())



And in Doom3Group.cpp, EclassModel.cpp and GenericEntity.cpp we need to add that stuff. And I think in rotation.h is where DR writes entity's rotation spawnarg (so "angles" would be added there, I think).

Edited by motorsep
Posted

@OrbWeaver:

 

Could you please fix it? Thanks beforehand.

 

Sorry, but that's probably not going to happen in the short term. I have very little time to work on DR these days and any time I did spend would be focussed on issues that are critical for the Dark Mod, rather than improving support for third-party games that I don't play. However if you can persuade one of your programmers to fix the issue and send a pull request I can probably find the time to merge it.

  • Like 1
Posted

Can you please tell me if I am going in the right direction with the code ?

 

I'm not overly familiar with that part of the code, but what you have posted so far does seem logical and the Q3 parts of the GtkRadiant codebase should be pretty mature. But I think the only way to confirm that it is doing what you need is to test it in your game.

 

I suggest the first thing to do is get at least someone in your team set up to produce Windows DR builds from the Git sources. This will be useful because even if I were to miraculously fix the issue myself, I wouldn't have any way to provide a new Windows build for testing (but maybe you are all on Linux only and this isn't an issue).

Posted (edited)

I managed to compile master with no errors, but it crashes on launch. Will try compiling 2.0.2 tomorrow and see if that runs.

 

EDIT: Never mind, I managed to build master with MSVC2013 Community Edition (32bit for now).

Edited by motorsep
Posted (edited)

Problem solved! (with help of one of the guys who works with me)

 

In rotation.h in the following function :

void write(Entity* entity, bool isModel = false) const

add

Vector3 euler = m_rotation.getMatrix4().getEulerAnglesXYZDegrees();

at the beginning of the function. Then comment out the same line inside

if (!isModel)
        {

and add

std::string keyVal2 = std::to_string( euler[1] ) + ' ' + std::to_string( euler[2] ) + ' ' + std::to_string( euler[0] );

entity->setKeyValue( "angles", keyVal2 );

after

entity->setKeyValue("rotation", keyVal);

at the end of the function.

 

Done!

 

Full code:

void write(Entity* entity, bool isModel = false) const
	{
		Vector3 euler = m_rotation.getMatrix4().getEulerAnglesXYZDegrees();

		// greebo: Prevent the "angle" key from being used for models, they should always
		// have a rotation matrix written to their spawnargs. This should fix
		// the models hopping around after transforms
        if (!isModel)
        {
            //Vector3 euler = m_rotation.getMatrix4().getEulerAnglesXYZDegrees();

            if (euler[0] == 0 && euler[1] == 0)
            {
                entity->setKeyValue("rotation", "");
                write_angle(euler[2], entity);
                return;
            }

            // Non-z-rotations will fall through here
        }

        // The below call to reset the "angle" keyvalue will 
        // trigger callbacks and reset this matrix.
        std::string keyVal = m_rotation.getRotationKeyValue();

		entity->setKeyValue("angle", "");

        // This call will usually update the m_rotation member again
        entity->setKeyValue("rotation", keyVal);
		
	// motorsep 08-05-2015; writing Quake 3 "angles" 

	std::string keyVal2 = std::to_string( euler[1] ) + ' ' + std::to_string( euler[2] ) + ' ' + std::to_string( euler[0] );

	entity->setKeyValue( "angles", keyVal2 );
		// motorsep ends
}

P.S. I haven't worked with Git, so I don't really have time to mess with it to create pull request, sorry.

Edited by motorsep
Posted

Good job. I'll certainly consider merging this change, although I'll want to add some additional code to ensure that the new behaviour only applies in games that require it, probably via a setting in the .game file.

 

Do you know if Quake 3 ONLY requires the "angles" key, or does it need "rotation" as well?

Posted

I was thinking of having a check for the game type to be Quake 3 (in the .game file) but decided against it, since having "angles" in Doom 3 maps does no harm, and hopefully eventually Dark places engine (and maybe even ioquake3) and q3map2 compiler will support Doom 3's rotation matrix.

 

Right now Quake 3 and engines that support Quake 3 maps/content (Darkplaces engine for example) only support "angles" for func_statics and "angle" for entities like info_player_start (rotation around Z axis as I recall).

Join the conversation

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

Guest
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.

  • Recent Status Updates

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
×
×
  • Create New...