Forum

Dead space like tps zooming action

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Re: Dead space like tps zooming action

Postby thommoboy » Fri Jan 13, 2012 9:15 am

Baker wrote:
thommoboy wrote:how would i make it so that when the player is zoomed in he moves half the speed?


Type in console cl_forwardspeed to find out what you forward speed is. Write it down. It may not be the default 350.

Type in console "fov 90; cl_forwardspeed 350". Move a little to feel the speed.
Type in console "fov 90; cl_forwardspeed 200". Move a little to feel the speed.
Type in console "fov 30; cl_forwardspeed 200". Move a little to feel the speed.
Type in console "fov 90; cl_forwardspeed 350". Back to normal.

Now messing with the player's cl_forwardspeed cvar but sending it via stuffcmd is not the proper way to do it any more than messing with the player fov via stuffcmd.

Still, it'll give you some ideas on how things work. There is a "haste" tutorial that ironically does it "wrong" too ... http://inside3d.com/showtutorial.php?id=122

The "correct" way is a bit involved and if you really want to do it "right" check out RuneQuake 1.3 source and search for "ath" for the rune of athletics that has code like:
http://www.runequake.com/html-source/runequake-1.3.0/
Code: Select all
Athlete_Run =
{
   if ((self.cl[CL_CMD_FORWARD] || self.cl[CL_CMD_SIDE]) && self.flags & FL_ONGROUND)
      self.velocity = self.velocity + self.velocity * 0.10;
};



could you adapt a solution to my code?
like add what you think in the CCamDoom ();
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby Baker » Fri Jan 13, 2012 10:11 am

What did you do for zoom? Post that here ...
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Dead space like tps zooming action

Postby thommoboy » Fri Jan 13, 2012 10:52 am

Code: Select all
void (float amount) CCamzoom =
{
        self.camview_z = self.camview_z + amount;
        if (self.camview_z > -5)
                self.camview_z = -5;
        if (self.camview_z < -10)
                self.camview_z = -10;
       
                self.camview_x = self.camview_x + amount;
        if (self.camview_x < 16)
                self.camview_x = -16;
        if (self.camview_x > -16)
                self.camview_x = -16;
       
                self.camview_y = self.camview_y + amount;
        if (self.camview_y < 12)
                self.camview_y = 12;
        if (self.camview_y > -12)
                self.camview_y = -12;
               
                self.camview_z = self.camview_z + amount;
        if (self.camview_z > -48)
                self.camview_z = -48;
        if (self.camview_z < -72)
                self.camview_z = -72;
};

void (float amount) CCamdoom =
{
                self.camview_z = self.camview_z + amount;
        if (self.camview_z > -16)
                self.camview_z = -16;
        if (self.camview_z < -16)
                self.camview_z = -16;
};


the Ccamdoom is the zoomed one. the CCamZoom is the Default Third Person Camera
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby Baker » Fri Jan 13, 2012 11:36 am

Maybe something like this ...

In client.qc in PlayerPreThink put this near the end of the function ....

Code: Select all
   if (self.zoomed && (self.velocity_x || self.velocity_y) && self.flags & FL_ONGROUND)
   {
      self.velocity = self.velocity  * 0.50; // We are zoomed with non-zero speed and on-ground.  Reduce speed by 50%
   }


You will need to add a .zoomed float in defs.qc and have that set self.zoomed = 1 when your zoom is in-effect and self.zoomed = 0 after it is no longer in effect.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Dead space like tps zooming action

Postby thommoboy » Fri Jan 13, 2012 12:01 pm

would i have to edit my code to fit this?
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby Baker » Fri Jan 13, 2012 2:56 pm

thommoboy wrote:would i have to edit my code to fit this?


Well, you need to find a place in your code that when it executes that the player is zoomed and set a variable or flag that the player entity is marked zoom. Then you do the rest of what is in my above post.

I don't know if English is your first language, but I really can't improve on the info and the info provided should be enough for you to make it work.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Dead space like tps zooming action

Postby thommoboy » Sat Jan 14, 2012 3:06 am

my first language is english its just my phone sucks at typing
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby thommoboy » Sat Jan 14, 2012 3:25 am

oh great now when i zoom on my psp it goes forward and backward a miniscule amount
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby thommoboy » Sat Jan 14, 2012 4:03 am

how would i get it working for psp?
thommoboy
 
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: Dead space like tps zooming action

Postby sniperz227 » Sat Jan 14, 2012 10:34 pm

Baker wrote:In the console type:

fov 90 (enter ... look at what is onscreen)
fov 60 (enter ... look at what is onscreen)
fov 30 (enter ... look at what is onscreen)
fov 10 (enter ... look at what is onscreen)

Then type fov 90 in console to restore to what is probably normal.

You can mess with the zoom on a client doing stuffcmd("fov whatever value")

Maybe part of the clue you are looking for


Baker you just hit 2 birds in what stone. i have an idea of how to d oiron sights now and you cleared what i was asking you for the sprint function and now i know you can use stuffcmd to use console stuff in the client thanks ! :D
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest