PDA

View Full Version : jo style disruptor


divoid
12-23-2003, 08:53 AM
Im trying to restore the old style disruptor from jedi outcast, where you cant move if your zoomed in and charged. I have pretty much got it done, except for some jittering when you try to move. I believe this is due to the client prediction, since it only appears for me, and i cant see it when other clients do it.

so how can i get rid of the jitter, so when someone tries to move while zoomed in and charged, it doesnt do anything?

razorace
12-23-2003, 12:31 PM
Jittering is the result of you not making the nessicary changes to the PM sections of the code and not compiling/using both sides of the game (client and server).

divoid
12-25-2003, 09:06 PM
i seriously doubt you have to do anything to the client code, that would be extremely stupid. but what would you set for the pm style or whatever its called (not looking at code right now)? PM_FREEZE would sorta do it, but that screws with clipping....

Wudan
12-27-2003, 07:24 PM
If you change anything PM / BG wise, you must recompile both of the DLLs or you may not get the expected results. The jittering is because the client movement prediction is different from what the server is predicting.

You can probably hack something up in g_active.c and not screw up the client, IIRC.

divoid
12-27-2003, 07:50 PM
ya, thats what i figured (g_active.c), and ive tried a few things, but ran out of ideas quickly

Wudan
12-28-2003, 01:39 PM
Does it work now?

You can try browsing through the JK2 MP Source linked from my site in my sig, and try to find out where the disruptor's zoom gets interupted by player movement.

divoid
12-29-2003, 05:44 AM
i had sorted through the jk2 code looking for it before, but didnt find anything. i'll look again, maybe i missed something, and i'll just try some more stuff and if i get it, i'll post it here

razorace
12-30-2003, 06:17 AM
You're going to have to add a zoom check to PmoveSingle in bg_pmove.c that makes "stiffenedUp" = qtrue.

Wudan
12-30-2003, 02:38 PM
To make the disruptor cancel out if the player is moving, or moving above a specified velocity:

about line 7201 in bg_pmove.c (http://www.mt-wudan.com/jkamp/bg__pmove_8c-source.html)

Change this section in PM_Weapon():

if (pm->ps->weapon == WP_DISRUPTOR &&
pm->ps->zoomMode == 1)
{
if (pm_cancelOutZoom)
{
pm->ps->zoomMode = 0;
pm->ps->zoomFov = 0;
pm->ps->zoomLocked = qfalse;
pm->ps->zoomLockTime = 0;
PM_AddEvent( EV_DISRUPTOR_ZOOMSOUND );
return;
}

if (pm->cmd.forwardmove ||
pm->cmd.rightmove ||
pm->cmd.upmove > 0)
{
return;
}
}


To this:

if (pm->ps->weapon == WP_DISRUPTOR &&
pm->ps->zoomMode == 1)
{
if (pm->cmd.forwardmove ||
pm->cmd.rightmove ||
pm->cmd.upmove > 0)
{
pm_cancelOutZoom = qtrue;
}

if (pm_cancelOutZoom)
{
pm->ps->zoomMode = 0;
pm->ps->zoomFov = 0;
pm->ps->zoomLocked = qfalse;
pm->ps->zoomLockTime = 0;
PM_AddEvent( EV_DISRUPTOR_ZOOMSOUND );

}

return;
}


What this'll do is cancel the zoomMode if the player is moving at all. What you might want to try is this:


//here's a float for the player's velocity:
float playerspeed = 0;

if (pm->ps->weapon == WP_DISRUPTOR &&
pm->ps->zoomMode == 1)
{
playerspeed = VectorLength( pm->ps->velocity );
// the 5.0 is just ... a number -
//play with it to get the desired effect.
if ( playerspeed > 5.0 )
{
pm_cancelOutZoom = qtrue;
}

if (pm_cancelOutZoom)
{
pm->ps->zoomMode = 0;
pm->ps->zoomFov = 0;
pm->ps->zoomLocked = qfalse;
pm->ps->zoomLockTime = 0;
PM_AddEvent( EV_DISRUPTOR_ZOOMSOUND );

}
return;
}

Wudan
12-30-2003, 02:40 PM
After putting that in, you'll need to re-compile both your game and cgame dlls.

Wudan
12-31-2003, 06:40 PM
There's another similar check further down in the code that you'll need to replace with a playerspeed check - unless you want to keep the 'don't move while charging' thing.

A normal moving player goes about 250 units per second, 90 walking and 125 crouching.

There's a call to keep the player from jumping while zoomed, i took it out because it was lame - the speed checks'll kick em out anyway.