Page 1 of 1

Understanding the layout file format

Posted: Fri Mar 06, 2015 1:20 am UTC
by illwieckz

Hi, I'm writing a layout → entities translator for my bsp parser, so I need some help on the layout file format.

From pulse.bsp:

Code: Select all

{
"classname" "team_human_mgturret"
"origin" "5368 -1360 -1328"
"angle" "90"
}

From some layout.dat dumped from pulse:

Code: Select all

mgturret 5368.000000 -1360.000000 -1339.875000 0.000000 90.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 90.000000 0.000000

So I think it's something like that:

Code: Select all

mgturret "origin" 0.000000 "angle" 0.000000 0.000000 0.000000 1.000000 -0.000000 "angle" 0.000000

But why the angle is repeated two times? What are the other values? :smile:


Re: Undestanding the layout file format

Posted: Fri Mar 06, 2015 1:30 am UTC
by illwieckz

Ok, found that in src/gamelogic/game/g_buildable.cpp:

Code: Select all

	G_Printf( "layoutsave: saving layout to %s\n", fileName );

for ( i = MAX_CLIENTS; i < level.num_entities; i++ )
{
	ent = &level.gentities[ i ];

	if ( ent->s.eType != ET_BUILDABLE )
	{
		continue;
	}

	s = va( "%s %f %f %f %f %f %f %f %f %f %f %f %f\n",
	        BG_Buildable( ent->s.modelindex )->name,
	        ent->s.pos.trBase[ 0 ],
	        ent->s.pos.trBase[ 1 ],
	        ent->s.pos.trBase[ 2 ],
	        ent->s.angles[ 0 ],
	        ent->s.angles[ 1 ],
	        ent->s.angles[ 2 ],
	        ent->s.origin2[ 0 ],
	        ent->s.origin2[ 1 ],
	        ent->s.origin2[ 2 ],
	        ent->s.angles2[ 0 ],
	        ent->s.angles2[ 1 ],
	        ent->s.angles2[ 2 ] );
	trap_FS_Write( s, strlen( s ), f );
}

But what means these "origin2" and "angles2"?


Re: Undestanding the layout file format

Posted: Fri Mar 06, 2015 5:36 pm UTC
by Viech

pos.trBase should be the same as origin for buildables but maybe there are hackish exceptions… angles should be the buildables base angles, angles2 are turret aim angles. origin2 is actually a direction vector facing in surface normal direction (and thus should have pretty much the same information as angles if I don't miss on something). Yep, most of the gamelogic is a hacky piece of crap. :smile: