Jump to content

Home

jo style disruptor


divoid

Recommended Posts

Posted

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?

Posted

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).

Posted

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....

Posted

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.

Posted

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.

Posted

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

Posted

To make the disruptor cancel out if the player is moving, or moving above a specified velocity:

 

about line 7201 in bg_pmove.c

 

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;
       }

Posted

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.

Archived

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

×
×
  • Create New...