PDA

View Full Version : Something's wrong with BOTH_STAND2TO1...


Scarlett
03-24-2003, 08:26 PM
I've had this problem for quite some time, but i'm determined to get it fixed now. As it is in single player, i wanted to do the fancy lightsaber arming/disarming animations. It half works the way i have it setup... the arming animation works perfectly, but then the disarming animation, BOTH_STAND2TO1, does nothing.. it just twitches the torso a bit.

Here's how it's set up, in g_cmds.c for Cmd_ToggleSaber_f:

if (ent->client && ent->client->ps.weaponTime < 1)
{
if (ent->client->ps.saberHolstered)
{
ent->client->ps.saberHolstered = qfalse;
//UPDATED: We want to do the fancy lightsaber arming animation -Scarlett
if (ent->client->ps.forceHandExtend == HANDEXTEND_NONE)
{
PM_SetAnim(SETANIM_TORSO, BOTH_STAND1TO2, SETANIM_FLAG_NORMAL|SETANIM_FLAG_HOLD|SETANIM_FLAG _HOLDLESS, 0);
}
G_Sound(ent, CHAN_AUTO, saberOnSound);
}
else
{
ent->client->ps.saberHolstered = qtrue;
//UPDATED: We want to do the fancy lightsaber disarming animation -Scarlett
//NOTE: Sadly, this animation isn't working right now...
if (ent->client->ps.forceHandExtend == HANDEXTEND_NONE)
{
PM_SetAnim(SETANIM_TORSO, BOTH_STAND2TO1, SETANIM_FLAG_NORMAL|SETANIM_FLAG_HOLD|SETANIM_FLAG _HOLDLESS, 0);
}
G_Sound(ent, CHAN_AUTO, saberOffSound);

//prevent anything from being done for 400ms after holster
ent->client->ps.weaponTime = 400;
}
}

There must be something wrong with the animation itself, because if you replace BOTH_STAND2TO1 with another animation it plays it fine...

Any ideas?

Scarlett
03-24-2003, 09:33 PM
Hmm... i just noticed something, in ModView the animation is displayed as "-BOTH_STAND2TO1".... i've also noticed that all the animations i've had problems like this with have the "-" before them in ModView as well. What significance does that have? Why is it there? Are they meant to be used in a certain way or what?

From what it appears, all the animations that are like that are basicly reversed versions of another and used for the "ending" animation....

razorace
03-24-2003, 10:07 PM
Interesting. Those animations are playing in reverse. I'm looking into this. The MP animation calls might not be set up to handle backward playing animations. If this is the case, I can probably rewrite it to make it do it anyway. :) Watch the JK2 animation thread (http://66.227.96.58/showthread.php?s=&threadid=76081) for the details of my research.

Scarlett
03-24-2003, 11:07 PM
Alright, i will. :)

Wudan
03-25-2003, 09:44 AM
Edited:
Ok Ok ... so I don't know wtf I'm talking about :)

Scarlett
03-25-2003, 12:37 PM
Unfortunatly, that change didn't fix anything, wudan. It also plays fine in ModView.

From animation.cfg:

// Format: enum, targetFrame, frameCount, loopFrame, frameSpeed
BOTH_STAND2TO1 12409 16 -1 -15


The frameSpeed is -15.... where as BOTH_STAND1TO2 is 20, which is the only difference between them. Hmm.. i'll try setting it's frame speed to 20 as well then....

Alright, now that i've done that, it's playing BOTH_STAND1TO2 instead... either that or it's playing it backwards, which I think is far more likely to be the case.

BOTH_STAND1TO2 and BOTH_STAND2TO1 must be the same animation, there's just two copies of it (which is what the "-" is for, to indicate it's playing in reverse) so they can specify each for different instances. So that's how to play animations backwards, set the frameSpeed to a negative value. However, it doesn't seem the multiplayer version has support for it...

Wudan
03-25-2003, 01:39 PM
Apparently, we don't :_(

Looks like a job for the GLA Tool I've been working on ... I've been considering that feature, so it's on the list to be added.

Wtf am I talking about? Why, specify a sequence and rip it, write the new sequence in reverse :)

You could just straight-merge it back in to the GLA, adding X more frames, but I'd also like the ability to remove frames that aren't used in MP.

razorace
03-25-2003, 01:47 PM
Scarlette is correct. The some of the animations are just reverse playing versions of other animations. The target frame is the same and the framerate is negative. You can see the frame tick backwards in modview too.

razorace
03-25-2003, 01:50 PM
Or you could take my approcact and try to hack the system to run animations in reverse. Assuming it's not engine side and it's possible in SP, it should be possible in MP.

Scarlett
03-25-2003, 01:52 PM
That'd be so nice to have something like that, wudan...

But i think it'd be good to get support for reverse animations in multiplayer as well (assuming it doesn't already and we just don't know about it).

razorace
03-25-2003, 02:05 PM
Well, if we can play animations in reverse we'd have the ability to "remix" the current animations without having to mess with the humaniod.gla (and force all our users to download the 7 meg + file over again)

Wudan
03-25-2003, 02:24 PM
There's a mention of it in the BG_ParseAnimationFile (not sure if that's the exact name), but if you wanted to edit the animation in reverse to have it different than the animation forward, the GLA tool is the way to go.

Of course, right now I'm just fleshing out an animation manipulation toolset ...

razorace
03-25-2003, 02:47 PM
Well, many animations will look fine without making changes (like BOTH_STAND2TO1).

razorace
03-25-2003, 06:20 PM
ok dokie. Unless Raven changed the animation call internals inside the engine (between SP and MP), reverse playing animations SHOULD work. Everything checks out up to the animation syscalls.

razorace
03-25-2003, 11:53 PM
Hmmm....Not good. I tried to run several backward running animations and they all don't seem to work. I've emailed Rich about it but my hope is fadeing.

The code seems to be ok, it's just the syscall that's messing things up. I guessing that this is some weird bandwidth saver by not allowing reversed animations. (which doesn't make sense cause only the animation name and timers are passed to the clients and not the framerate.

Unfortunately, this means that we're restricted to forward moving animations since the fix to this would probably require some engine code changes. Doh!

Wudan
03-26-2003, 09:04 AM
Hehehe ... an optimized MP GLA (that is, SP specific animations removed) would be much smaller than the SP GLA, anyway.

razorace
03-26-2003, 02:21 PM
Shazbot! Rich wrote back and says that that SP ghoul2 system is different than the MP system. He said my backup plan idea doesn't work but the current system might work (but doesn't). It looks like backward playing animations aren't possible in MP, but I'll still play with it a little more before I give up on it. :)

Wudan
03-26-2003, 04:16 PM
Oh well, guess good old fashioned GLA manipulation is still a good idea! :)

razorace
03-26-2003, 06:39 PM
Well, Rich suggested another idea I had originally where you play the backward animations one frame at a time. I'll try it but I'm not sure it'll work correctly cause you'd have to run the animation one frame forward as part of the call while actually playing it backwards. IE, it might look jerky.

razorace
03-30-2003, 10:14 PM
This is interesting. The animations are in fact playing like they should on the server but not on the client side. I'm still checking the code but I suspect it's due to the client setboneanim syscall being different than the server setboneanim. Unfortunately this means that I'll have to use a hack to run animations backwards (at least on the client side. )