Jump to content

Home

Ghoul2 API Commands


razorace

Recommended Posts

In the spirit of renewed openness as suggested by Anakin, I'm openning this thread up as way for me to list all the data I got on the Ghoul2 system. I'll try to update this daily.

 

Commands:

 

int trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName)

Both; Syscall

 

Adds a "bolt" at the boneName on the model modelIndex. The boneName is the actual name of the model bone as seen in Modview. The bolt number that is assigned by this function is perminate for that model and are assigned in order. If you want say, the foot on the player model to be bolt #5, make sure it’s the 5th bolt to be added with trap_G2API_AddBolt. This is why some bolt numbers like 0 and 1 are always the same on the models since they are added right after the model is created. When a model is copied the bolts and their bolt numbers are also copied.

 

Inputs:

void *ghoul2: The Ghoul2 model set you want to check.

int modelIndex: The individal model you want in the ghoul2 model set.

const char *boneName: The name of location you want to create a bolt at. Bones (Example: “lhand”) and Tag Surfaces (which have a “*” in their name. Example: “*head_front”) are all valid locations.

 

Returns: The qhandle_t (int) number of the bolt.

 

 

qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)

Both; Syscall

This is a important one. You use this to get data about a given bolt.

 

Inputs:

void *ghoul2: The Ghoul2 model set you want to check.

int modelIndex: The individal model you want in the ghoul2 model set.

mdxaBone_t *matrix: Bone Matrix for storing all the bolt data.

const vec3_t angles: The basic orientation angles of the player. This is in yaw degrees ONLY. For the client side, this is a straight port from the TurAngles centity_t (cent) vector. For the server side, this is the YAW data of viewangles playerstate_t (ps) vector (just copy the vector to another vector and zero out PITCH and ROLL)

const vec3_t position: The vector position of the ghoul2 model. This is normally the LerpOrigin centity_t (cent) vector and the origin playerstate_t (ps) vector for the server side.

const int frameNum: This is actually the game time. Use level.time for the server and cg.time for the client.

qhandle_t *modelList: Link to models list. Use NULL for server side and cgs.gameModels for client side.

vec3_t scale: This is your model scaler vector. You can use your modelscaler stuff to make that model the correct size. For normal operation, simply using vector origin (vec3_origin) for the server and the modelScale centity_t (cent) vector for the client.

 

Returns: qtrue on success, qfalse on failure (meaning it couldn't find the bolt you asked for.)

 

 

qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex)

Both

 

Checks to see if you have a Ghoul2 model for that model number in the given ghoul2 model set.

 

Inputs:

void *ghlInfo: The Ghoul2 model set you want to check.

int modelIndex: Model number of the model slot you want to check.

 

Returns: qtrue if there’s a model, qfalse if there isn’t.

 

Data Structs:

 

mdxaBone_t

 

This is the struct where all the bone/bolt data is saved when you use trap_G2API_GetBoltMatrix. This is used for a LOT of stuff. With this data you can place effects, traces, etc right “on” that bone/bolt. Note that this isn’t how you actually attach models to a bone/bolt on a model.

 

float matrix[3][4]:

Matrix[0-2][0]: X axis orientation of bone (normalized vector)

Matrix[0-2][1]: Y axis orientation of bone (normalized vector)

 

Matrix[0-2][2]: Z axis orientation of bone (normalized vector)

 

Matrix[0-2][3]: Bone origin (in world coordinates)

 

Notes: I’m not 100% sure on the order of the orientation axis. They might be different for the game and cgame code. Also, the ModView axii X/Y axii are switched from the actual axii in 3dsm and in the code so watch out.

Link to comment
Share on other sites

Originally posted by Commodus

I could imagine how you would draw the model... using the trap_FX_AddRefEntityToScene() function and setting the refType_t (?) to RT_MODEL and then using the information you got from the matrix to render the model on the bolt.

I don't think that will work. First off, that's not really how you spawn ghoul2 models. Second, you'd have to deal with 72 bones, interplotation and bunch of other crap to recreate the system. Even then, it would probably run like crap. Wudan's approach is hard but probably the only real chance we got to do new animations.

That mdxaBone_t was just the kind of crack cocaine i was looking for Razor. It's the smoking gun. YEE-HA!

What have I done?!!! NNNNNOOOOO!!!! :D

Link to comment
Share on other sites

If I recall, guns in hand are not refentities, rather 'g2' instances.

 

You could specify a ref entity to refer to the gun and then scale it a little larger and add a cool shader effect to make the gun look "charged up" or something. Or you could just have fun with it and make it look like the gun is REALLY BIG.

Link to comment
Share on other sites

You are sort of correct. All the weapons have g2 instances client side. The server has only a saber hilt perminately attached to the right hand of the player. The refentity doesn't have control over the size or shader model thingies.

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...