lfnetwork.com mark read register faq members calendar

Thread: setting new bolt indexes
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-08-2006, 11:53 AM   #1
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
setting new bolt indexes

This probably might be impossible but I remember either ghoul2 or md3 models were dynamically anywhere on the model in soldier of fortune 2 (e.g. when you throw a knife at an opponent it sticks where it hit the player). Is there any way to replicate it in ja? Setting bolt indexes on models on parts with or without a bone name there. I looked at the sof2 function but the sticking missile function does not compile because of different trap functions


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-09-2006, 01:20 AM   #2
stubert
 
Join Date: Aug 2002
Location: Philadelphia
Posts: 227
jesus was a jedi =S
stubert is offline   you may: quote & reply,
Old 07-09-2006, 09:09 PM   #3
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
You might be right, but that is debatable.


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-10-2006, 08:50 PM   #4
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,176
How exactly does SOF2 do it? What sort of syscalls are we talking here?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-10-2006, 10:08 PM   #5
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Lemme show you the cg syscalls used in each of the trap_functions of the function then I will show the whole function:


//The trap functions w/ cg syscalls:

qboolean trap_G2_HaveWeGhoul2Models( void *ghoul2)
{
return (qboolean)(syscall(CG_G2_HAVEWEGHOULMODELS, ghoul2));
}

int trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo)
{
return syscall(CG_G2_COPYSPECIFICGHOUL2MODEL, g2From, modelFrom, g2To, modelTo);
}

int trap_G2API_FindBoltIndex(TGhoul2 ghoul2, const int modelIndex, const char *boneName)
{
return syscall(CG_G2_FINDBOLTINDEX, ghoul2, modelIndex, boneName);
}

qboolean trap_G2API_AttachG2Model(void *ghoul2From, int modelFrom, void *ghoul2To, int toBoltIndex, int toModel)
{
return (qboolean)(syscall(CG_G2_ATTACHG2MODEL, ghoul2From, modelFrom, ghoul2To, toBoltIndex, toModel));
}

//function to make the missile stick

void CG_HandleStickyMissile(centity_t *cent,entityState_t *es,vec3_t dir,int targetEnt)
{
int hitLoc;
qboolean altFire;
int ammoIndex;
weaponInfo_t *weaponInfo;
qboolean addBoltedMiss;
int missileIndex;
int boltIndex;

hitLoc=es->otherEntityNum2;
altFire=(cent->currentState.eFlags & EF_ALT_FIRING)!=0;

if ( cent->currentState.eFlags & EF_ALT_FIRING )
{
ammoIndex = weaponData[es->weapon].attack[ATTACK_ALTERNATE].ammoIndex;
}
else
{
ammoIndex = weaponData[es->weapon].attack[ATTACK_NORMAL].ammoIndex;
}

// Currently the only type of sticky missile is the thrown knife. Others might be added in future though.
addBoltedMiss=qfalse;
switch(es->weapon)
{
case AMMO_KNIFE:
if(altFire)
{
addBoltedMiss=qtrue;
}
break;

default:
break;
}

if(addBoltedMiss==qtrue)
{
centity_t* centTarget;

weaponInfo=&cg_weapons[es->weapon];
if(!trap_G2_HaveWeGhoul2Models(weaponInfo->weaponG2Model))
{
return;
}

centTarget = CG_GetEntity ( targetEnt );

missileIndex=trap_G2API_CopySpecificGhoul2Model(we aponInfo->weaponG2Model,0,centTarget->ghoul2,-1);
if(missileIndex!=-1)
{
// Com_Printf("Missile index=%i\n",missileIndex);
boltIndex=trap_G2API_FindBoltIndex(centTarget->ghoul2,0,"rhand");
if(boltIndex==-1)
{
boltIndex=trap_G2API_AddBolt(centTarget->ghoul2,0,"rhand");
}
if(boltIndex!=-1)
{
// Com_Printf("Bolt index=%i\n",boltIndex);
if(!trap_G2API_AttachG2Model(centTarget->ghoul2,missileIndex,centTarget->ghoul2,boltIndex,0))
{
// Com_Printf("Couldn't attach!\n");
}
}
}
}
}


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-10-2006, 10:53 PM   #6
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
qboolean trap_G2_HaveWeGhoul2Models(void *ghoul2) - same in jka

int trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo) - same in jka

int trap_G2API_FindBoltIndex(TGhoul2 ghoul2, const int modelIndex, const char *boneName) - not in jka at all

qboolean trap_G2API_AttachG2Model(void *ghoul2From, int modelFrom, void *ghoul2To, int toBoltIndex, int toModel) - same in jka

i suppose a way around trap_G2API_FindBoltIndex, is just store the boltindex somewhere when you copy/add the bolt. because trap_G2API_AddBolt you can do something like:

Code:
int boltIndex;
boltIndex = trap_G2API_AddBolt(ghoul2, 0, "jaw_bone");


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-10-2006, 10:23 PM   #7
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,176
The good news is that those at least look similar to the traps used in JKA. What differences have you noticed so far?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-10-2006, 11:05 PM   #8
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Also trap_G2API_CopySpecificGhoul2Model is a void in jka whereas in Sof2 it returns an int. I tried making the changes in the whole sdk make it an int but it would crash :/


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-11-2006, 12:19 AM   #9
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Quote:
Originally Posted by Tinny
Also trap_G2API_CopySpecificGhoul2Model is a void in jka whereas in Sof2 it returns an int. I tried making the changes in the whole sdk make it an int but it would crash :/
thats because its in cl_cgame.c that way to return for sof2 and in jka its not returning anything.

i think they did it this way is because they didn't intend for someone to make bolts like this in jedi :sweat


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-11-2006, 01:05 AM   #10
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,176
I'm with ensiform on this. trap_G2API_AddBolt should work as well as the findbolt syscall. Check out the OJP True View code to see how I used it for determining the camera positioning.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-11-2006, 05:58 PM   #11
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Alright, thanks a ton Razor and Ensi . Btw Ensi, know of any way of going around trap_G2API_CopySpecificGhoul2Model in jka so that something like it can return the required int?


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-11-2006, 08:47 PM   #12
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
you can't.

for a syscall to return an it, the engine must intercept the syscall like this:

Code:
case COPY_SPECIFIC_MODEL_G2_WHATEVER:
	return theEngineCall(...............);
for a void syscall it looks like this:

Code:
case COPY_SPECIFIC_MODEL_G2_WHATEVER:
	theEngineCall(...............);
	return 0;
so even if you changed the cg_syscall.c function to return int, it would always be giving you a 0.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-11-2006, 09:06 PM   #13
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,176
Oh, I see what you're talking about. It looks like SOF2 allows you to have the engine auto-decide the model index for ghoul2 copy. As far as I know, JKA uses specific defines, probably to ensure that the attached models are consistant. IE, first is main weapon, second is secondary saber, third is jetpack, etc.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-11-2006, 10:15 PM   #14
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Soo hmmm, could I do this? Set random values for the indeces not used. Say values between 4 and 20 and keep using them until they're all used up then start replacing the ones that were used the longest.


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-11-2006, 10:51 PM   #15
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,176
Quote:
Originally Posted by Tinny
Soo hmmm, could I do this? Set random values for the indeces not used. Say values between 4 and 20 and keep using them until they're all used up then start replacing the ones that were used the longest.
There's no need to do it randomly. You could just set the lower and upper model limits, scan thru that range for an open model slot, and then use it.

Quote:
You're best bet is to contact Rich Whitehouse (author of Ninjamod), as Ninja mod contained this very thing... I dunno if he'd honestly share how he did it though. :X
I actually asked this several years ago. According to Rich, he lost the source code shortly after the last release of the mod. As for his technique, I beleive he used the manual rendering method similar to what I used for the holstered weapons in OJP. You could technically use the ghoul2 method used in SOF2, but I don't think there's a way to define the position and orientation of the resulting model. As such, the model would just stick out of the player at what positioning the bone is at.

Quote:
also when i was looking over the jka code, what does the trap_G2API_CopyGhoul2Instance really do, because it seems it returns an int in jka.
Because it's not actually used in the code, it's hard to tell. Its function is probably very similar to what is used in SOF2. Just from the description, it sounds like it whole hog ghoul2 "instances" rather than specific ghoul2 "models" like trap_G2API_CopySpecificGhoul2Model.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-13-2006, 01:17 AM   #16
Vruki Salet
Junior Member
 
Vruki Salet's Avatar
 
Join Date: Aug 2005
Location: Somewhere else entirely
Posts: 443
Quote:
Originally Posted by razorace
the model would just stick out of the player at what positioning the bone is at
This might not be too much of a problem Tinny, if you only make hits to certain areas stick. Maybe it would look fine if you made it work just for the chest, stomach and back parts. Say parts that bend around more like arms don't have enough meat to make the knife stay in. Besides, as far as goes people running around with lots of knives sticking out them at funny angles, perhaps they shouldn't be running very far after they've got just *1* sticking out of them.
Vruki Salet is offline   you may: quote & reply,
Old 07-11-2006, 10:24 PM   #17
Griswald
 
Join Date: Aug 2002
Location: ent->ps.get_loc();
Posts: 25
You're best bet is to contact Rich Whitehouse (author of Ninjamod), as Ninja mod contained this very thing... I dunno if he'd honestly share how he did it though. :X

You can google his name to bring up his website.


-- Griswald, RKR Project Co-Leader
Griswald is offline   you may: quote & reply,
Old 07-11-2006, 10:25 PM   #18
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
you probably could.

also when i was looking over the jka code, what does the trap_G2API_CopyGhoul2Instance really do, because it seems it returns an int in jka. the parameters are a little different than copymodel but i dunno you could have a look at that too i guess. but my guess is again they wanted it to be the way it is in jka on purpose like razor has said again. i also don't have the sof2 sdk so i can't really help with their code.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-13-2006, 03:44 AM   #19
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Hehe, i'm not gonna do it with knives though


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 07-13-2006, 09:32 AM   #20
MeleeMaster
Rookie
 
MeleeMaster's Avatar
 
Join Date: May 2006
Posts: 158
LOL, to make it more RPG like, why don't you make a weapon model of a sandwich so you could throw it into somebodys mouth and it would stay there lol.


Your auto-blocking is in vain! Only SP source code modification can allow you to block my desann-style attacks without being staggered now!
MeleeMaster is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > setting new bolt indexes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:18 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.