Darkplaces VWEAP documentation?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
JasonX
Posts: 422
Joined: Tue Apr 21, 2009 2:08 pm

Darkplaces VWEAP documentation?

Post by JasonX »

Is there any documentation on the VWEAP support in DP?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Darkplaces VWEAP documentation?

Post by Spike »

//DP_ENT_EXTERIORMODELTOCLIENT
//idea: LordHavoc
//darkplaces implementation: LordHavoc
//fields:
.entity exteriormodeltoclient;
//description:
//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown.

//DP_GFX_QUAKE3MODELTAGS
//idea: id Software
//darkplaces implementation: LordHavoc
//field definitions:
.entity tag_entity; // entity this is attached to (call setattachment to set this)
.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
//builtin definitions:
void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
//description:
//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
//note 3: attaching to world turns off attachment
//note 4: the entity that this is attached to must be visible for this to work
//note 5: if an entity is attached to the player entity it will not be drawn in first person.

vwep = spawn();
setmodel(vwep, "progs/v_foo.mdl");
setattachment(vwep, self, "");
self.exteriormodeltoclient = self;

you'll need to update the frame+model as appropriate, and to somehow remove the entity when the player disconnects. dying can be awkward too.
if you're dual wielding, you probably want to spawn an extra entity for viewmodelforclient too.
if you're using iqms, or md3s, or equivelent, you can just name a tag instead of the "" above (assuming its oriented properly in blender/equivelent), and then you can use the vwep's frame for private weapon firing/idle animations instead of having to copy the player's frame in order to keep it somewhere within the vacinity of the player's moving hands.

if you're going with csqc, you can just update the modelindex and call addentity an extra time, so that the player entity gets added twice with two different models. if skeletal/md3, you can find the origin+angles of the hand with gettaginfo.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Darkplaces VWEAP documentation?

Post by Cobalt »

Interesting. Would the regular weapon pickup models work with this....I guess they would have to be reduced in scale using the .scale float....
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Darkplaces VWEAP documentation?

Post by Spike »

you'd have to deal with their EF_ROTATE thing somehow, and bias their origin. you'd probably also want to resize them.
these things are all possible, but its a bit easier to just make a new model as you would need to edit them anyway.
Post Reply