Understanding the layout file format

Ask questions about mapping in general, and show off your in-progress work.
Post Reply
User avatar
illwieckz
Project Head
Posts: 718
Joined: Sat Aug 11, 2012 7:22 pm UTC
Location: France
Contact:

Understanding the layout file format

Post 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:

Last edited by illwieckz on Sun Mar 08, 2015 4:35 am UTC, edited 1 time in total.
User avatar
illwieckz
Project Head
Posts: 718
Joined: Sat Aug 11, 2012 7:22 pm UTC
Location: France
Contact:

Re: Undestanding the layout file format

Post 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"?

User avatar
Viech
Project Head
Posts: 2139
Joined: Fri Aug 03, 2012 11:50 pm UTC
Location: Berlin

Re: Undestanding the layout file format

Post 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:

Responsible for: Arch Linux package & torrent distribution, Parpax (map), Chameleon (map texture editor), Sloth (material file generator), gameplay design & programming, artistic direction

Post Reply