razorace Posted April 1, 2003 Share Posted April 1, 2003 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 More sharing options...
Commodus Posted April 5, 2003 Share Posted April 5, 2003 Oh... interesting. Could this be used to say stick a helmet on top of a soldier's head (like in RTCW)? Also, what exactly does it return? A vec3_t or something else? Link to comment Share on other sites More sharing options...
razorace Posted April 5, 2003 Author Share Posted April 5, 2003 I'll explain that in the next installment. Link to comment Share on other sites More sharing options...
razorace Posted April 5, 2003 Author Share Posted April 5, 2003 Ok, just added the mdxaBone_t data. Tomorrow we'll go into one of the functions need to attach one Ghoul2 Model to another. Link to comment Share on other sites More sharing options...
babywax Posted April 5, 2003 Share Posted April 5, 2003 Looks like I came into modding at just the right time, making a mod that will require new animations for some of the new melee weapons I will be implementing! Cool to see people making this stuff before my eyes. Link to comment Share on other sites More sharing options...
razorace Posted April 5, 2003 Author Share Posted April 5, 2003 Well, unfortunately, even with the full data I'm slowly providing, there's no reasonable way to do new animations. Wudan's working on an animation program that would do new animations but it's some ways from completion. Link to comment Share on other sites More sharing options...
Commodus Posted April 5, 2003 Share Posted April 5, 2003 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. Link to comment Share on other sites More sharing options...
Wudan Posted April 5, 2003 Share Posted April 5, 2003 That mdxaBone_t was just the kind of crack cocaine i was looking for Razor. It's the smoking gun. YEE-HA! Link to comment Share on other sites More sharing options...
Commodus Posted April 5, 2003 Share Posted April 5, 2003 Wudan! go on #jk2coding at irc.quakenet.org ! Link to comment Share on other sites More sharing options...
razorace Posted April 5, 2003 Author Share Posted April 5, 2003 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!!!! Link to comment Share on other sites More sharing options...
Commodus Posted April 7, 2003 Share Posted April 7, 2003 Sorry - I meant the model that gets drawn on the bolt, not a player model. For that you need some way of reading the triangle point coordinates, and then using OpenGL you render them... Link to comment Share on other sites More sharing options...
Wudan Posted April 7, 2003 Share Posted April 7, 2003 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 More sharing options...
razorace Posted April 7, 2003 Author Share Posted April 7, 2003 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 More sharing options...
Wudan Posted April 7, 2003 Share Posted April 7, 2003 A refentity can reference a model, and a shader, and it can have specific draw-processing flags. This is how force sight works. Link to comment Share on other sites More sharing options...
razorace Posted April 7, 2003 Author Share Posted April 7, 2003 hmmmm....Well I guess. I was thinking it was a pointer to the model for some reason... Link to comment Share on other sites More sharing options...
Wudan Posted April 7, 2003 Share Posted April 7, 2003 Well, it isn't the actual model, it just copies the model. Link to comment Share on other sites More sharing options...
Commodus Posted April 8, 2003 Share Posted April 8, 2003 What other G2 API functions are there? Link to comment Share on other sites More sharing options...
razorace Posted April 8, 2003 Author Share Posted April 8, 2003 oh there's a ton more. Sorry, I just hadn't gotten to today's update yet. The internet was down for a while and then I had to clean my keyboard. Link to comment Share on other sites More sharing options...
razorace Posted April 8, 2003 Author Share Posted April 8, 2003 Just added trap_G2API_AddBolt. The data I've released so far, you'll know be able to get locational data on any model at basically any location you want. Isn't Ghoul2 great? Razor Ace Link to comment Share on other sites More sharing options...
Commodus Posted April 11, 2003 Share Posted April 11, 2003 Yea, G2 is great... everything's good. We just need to make GLA Neo. Link to comment Share on other sites More sharing options...
razorace Posted April 11, 2003 Author Share Posted April 11, 2003 GLA Neo? Link to comment Share on other sites More sharing options...
Commodus Posted April 11, 2003 Share Posted April 11, 2003 You know, the editing program that Wudan is making... Link to comment Share on other sites More sharing options...
razorace Posted April 11, 2003 Author Share Posted April 11, 2003 ah. anyway, I just added qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex) to the list. Link to comment Share on other sites More sharing options...
razorace Posted April 26, 2003 Author Share Posted April 26, 2003 *BUMP* sorry about the lack of updates. I've just been lazy. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.