Sniper Scope View

  • Thread starter Thread starter Wh1sp3r
  • Start date Start date
W

Wh1sp3r

Guest
Hello !

Here it goes : I created a texture for a sniper rifle scope. I also implemented zooming on the secondary attack of my weapon_sniper class.

Now I want to know where do I add my code to toggle the scope texture when the zoom is activated !? I know some code wich uses the view.h methods to add an overlay and show the scope texture, but I can't access the class from the weapon file on the server side code...

Hope this makes sense ! Thanks for helping !
 
the crossbow has a scope on it doesnt it? try looking into that. sorry i dont know anything about that. presumeably it toggles a a gui panel to show up wit hthe texture of your scope when you zoom in. so couldnt you put that with where you toggle it to zoom in on the +attack2 or whateva toggle the gui panel aswell.
 
if im not mistaken, the crossbow just changes the FOV, i dont think it draws an overlay on the screen but it shouldnt be too hard.
 
The crossbow doesn't change the interface, it just toggles the FOV, wich I added without any problem to my sniper class. I need to add an overlay when the zoom is toggled, but I don't seem to have any access to the gui within my weapon class.
 
I think I could take the hud_zoom example, wich checks if you are in the HEV suit to toggle zooming with the "Z" key... The zoom seems to be toggled server-side, the the hud_zoom handles the graphics on the client-side. But the suit zoom uses something like basehl2player and the weapons use baseplayer, i'm getting lost again :rolling:
 
Hud_zoom's where you want to look. You should have a clientside implementation of your weapon, which is where you'd stick the code for overlaying.

Basehl2player is a derived class of baseplayer - anything that can happen to a baseplayer can happen to a basehl2player.

-Angry Lawyer
 
When you say client-side implementation of my weapon, does that mean I must create the weapon class for my weapon on client side AND server side ? with the same name ?
 
Pretty much. Most of the weapons have a client-side implementation, although those that don't need anything extra use a stub instead.

Look at the way HL2DM handles client/server weapons - they use the same file, but certain parts are #ifdef CLIENT - so they only happen on the client, and some are #ifndef CLIENT - so that this code isn't replicated on the client.

-Angry Lawyer
 
Back
Top