scope zoom, stunt dot, ammo counters more responsive under net latency, HUD order more sensible, forced origin no longer default

This commit is contained in:
Christopher Dawalt 2021-08-20 20:20:35 -04:00
parent abfc215d27
commit b8fd0a0f6f
62 changed files with 569 additions and 252 deletions

View File

@ -29,8 +29,7 @@ vector g_hudres;
/*
// Do we need these? Note the similarly named "g_hud_color" already above!
// Going to keep the latter two for compatability.
// Yes using old VGUI is kinda crappy but good for now.
vector vHUDColor; // Defined in HUD_Draw (HUD.c)
vector vHUDColor;
*/
vector g_UI_Color;

4
src/client/draw.h Normal file
View File

@ -0,0 +1,4 @@
void TS_HUD_DamageDraw(void);
void TS_HUD_drawPainArrows(void);
void TS_HUD_drawPainFlash(void);

View File

@ -27,19 +27,40 @@ extern var string g_damage_spr_l;
extern var string g_damage_spr_r;
void drawPainArrows(void);
void drawPainFlash(void);
void Custom_DamageDraw(void);
// WARNING: don't try drawing any 2D things on screen here, they'll be rendered on top of
// and ultimately lost, at least I think that's how it goes
// WARNING: don't try drawing any 2D things on screen here, they'll be rendered
// over soon and ultimately lost, at least I think that's how it goes
void
ClientGame_PreDraw(void)
{
player pl = (player)pSeat->m_ePlayer;
// TODO: may as well make TS_View_HandleZoom a player method at this point,
// do the state check inside player then
if(pl.iState == PLAYER_STATE::SPAWNED){
TS_View_HandleZoom();
}
}
pl.viewzoom = pl.flZoomCurrent;
// PreDraw is called right after viewzoom is set by Nuclide, so this overrides
// it. That is fine.
// Although, the 'setproperty' line already happened by the time this
// method was reached, so these areas from Nuclide need to be redone.
////////////////////////////////////////////////////////////////////
setproperty(VF_AFOV, cvar("fov") * pl.viewzoom);
if (autocvar_zoom_sensitivity && pl.viewzoom < 1.0f) {
setsensitivityscaler(pl.viewzoom * autocvar_zoom_sensitivity);
} else {
setsensitivityscaler(pl.viewzoom);
}
if (pl.viewzoom <= 0.0f) {
setsensitivityscaler(1.0f);
}
////////////////////////////////////////////////////////////////////
}//ClientGame_PreDraw
// Happens right before the CSQC_RenderScene call seen in Nuclide's client/draw.qc.
@ -62,10 +83,6 @@ Custom_LatePreDraw(void)
void
ClientGame_PostDraw(void)
{
// This is just the right place - occurs right beofre a HUD_Draw call so that the HUD
// is drawn on top of the potentially bright-red pain flash, rather than obscurred by it
Custom_DamageDraw();
// To replicate what Nuclide does for the normal muzzle flash entity in frame-logic:
// reduce the alpha every frame to quickly fade away
entity m_eMuzzleflashAkimbo = pSeatLocal->m_eMuzzleflashAkimbo;
@ -83,7 +100,7 @@ ClientGame_PostDraw(void)
// copied from Nuclide
void
drawPainArrows(void)
TS_HUD_drawPainArrows(void)
{
vector center;
vector rel_pos;
@ -133,7 +150,7 @@ drawPainArrows(void)
// and now for the screen-wide pain flash.
void
drawPainFlash(void)
TS_HUD_drawPainFlash(void)
{
//drawfill( video_mins, video_res, clrRed, VGUI_WINDOW_FGALPHA );
@ -153,7 +170,7 @@ drawPainFlash(void)
void
Custom_DamageDraw(void){
TS_HUD_DamageDraw(void){
// No alpha, or dead? No pain drawing
if(
@ -163,8 +180,8 @@ Custom_DamageDraw(void){
return;
}
drawPainFlash();
drawPainArrows();
TS_HUD_drawPainFlash();
TS_HUD_drawPainArrows();
// Nuclide's default had no modifier on clframetime ( * 1).
pSeat->m_flDamageAlpha -= clframetime * 1.7;

View File

@ -185,6 +185,10 @@ ClientGame_EventParse(float fHeader)
case EVENT_TS::EQUIP_CALLBACK:{
EV_EquipCallback();
}break;
case EVENT_TS::TEST_CALLBACK:{
int arg_mesageID = readint();
EV_TestCallback(arg_mesageID);
}break;
case EVENT_TS::SOUNDPITCHED:{
SoundPitched_Receive();
}break;

View File

@ -76,21 +76,24 @@ HUD_Draw(void)
g_hud_color = autocvar_con_color * (1 / 255);
/* little point in not drawing these, even if you don't have a suit */
Weapons_DrawCrosshair();
TS_HUD_DrawWeaponSelect();
Obituary_Draw();
Textmenu_Draw();
//TAGGG - NEw
//////////////////////////////////////////////////////////////
// moved to shared/player.qc, clientside player::preThink
// moved to shared/player.qc
//TS_View_HandleZoom();
//printfline("SCOPE LEVEL %.2f", pl.flZoomCurrent);
if(pl.flZoomCurrent < 0.5){ //is this < 40/80 mag? yes.
HUD_DrawScope();
// TS custom damage draw method.
// Done here to be drawn on top of the Scope.
TS_HUD_DamageDraw();
}else{
// Draw the crosshair over damage, rather not shade over important UI, but
// up to taste here
TS_HUD_DamageDraw();
// We'll leave details like extra details for the lasersight and the
// weight bars at a bare minimum (should be drawn at all times, oversight
// in TS 2.1 that they're missing from melee views like with knives,
@ -99,6 +102,17 @@ HUD_Draw(void)
}
//////////////////////////////////////////////////////////////
// Assuming that drawing these on top of the scope is a good idea.
// "Weapons_DrawCrosshair" is for tapping into the weapon's drawHUD methods,
// Nuclide methods in its weapons struct
Weapons_DrawCrosshair();
TS_HUD_DrawWeaponSelect();
Obituary_Draw();
Textmenu_Draw();
//TAGGG - new
//////////////////////////////////////////////////////////////
drawTimer();

View File

@ -131,7 +131,10 @@ HUD_DrawCrosshair(void){
int thirdBelongingTo = 0;
float ratioNumber = getViewPitchRelativeRatio(pl.pitch);
// pl.pitch is only updated on server pings, might not be wise to use here,
// looks choppy with any kind of ping time
float ratioNumber = getViewPitchRelativeRatio(view_angles.x);
float newDegreeRad = (ratioNumber * (270 - 90) + 90) * (M_PI/180);
//printfline("MY ANGLE? %.2f", (ratioNumber * (270 - 90) + 90) );

View File

@ -51,6 +51,7 @@ hud_weaponselect.h
inventory_logic_draw.h
view.h
hud.h
draw.h
// Yes, really, server/entity... We have a clientside rendering component to this.
../server/entity/ts_powerup.h

View File

@ -111,8 +111,6 @@ drawSpriteNumber(
// Convenience methods for drawing without any font-related struct, just some font's
// load ID. Otherwise close to the engine-provided drawstring and drawtextfield
// methods. "drawfont" is a global provided by the engine (fteextensions.qc).
// Compare with src/vgui/font.cpp's "Font_DrawText" and "Font_DrawField" which take a
// font struct.
void
Gfx_Text(vector vPos, string sText, vector vSize, vector vRGB, float flAlpha, float flDrawFlag, float flFont)
{

View File

@ -205,7 +205,8 @@ TS_View_ChangeViewModelPost(void)
SAVE_STATE(pl.weapontime);
//TAGGG - NEW VAR
SAVE_STATE(pl.w_attack_akimbo_next);
SAVE_STATE(pl.flZoomTarget);
SAVE_STATE(pl.iZoomLevel);
//SAVE_STATE(pl.flZoomTarget);
//TAGGG - also new line. It is a good idea to reset the event
// on changing models, right?
@ -789,6 +790,10 @@ TS_View_ShowMuzzleflash(int index, int akimboChoice)
}
}
//var int oldZoomLevel = 0;
//TAGGG - loaned from The Wastes.
void TS_View_HandleZoom(void)
{
@ -808,15 +813,23 @@ void TS_View_HandleZoom(void)
//printfline("WHATS GOING ON %.2f %.2f %.2f %.2f %.2f", pl.flZoomEnd, pl.flZoomTarget, pl.flZoomStart, pl.flZoomLerp, pl.flZoomCurrent);
//TAGGG - any references to STAT_VIEWZOOM are now garbage.
// Rely on pl.flZoomTarget instead, it's sent to the client every frame
// and should be handled serverside anyway.
// flZoomEnd is actually the "target" zoom we want to reach.
// flZoomStart is the zoom we started at, at the time of the change.
// flZoomLerp is how far along we are from oldZoom to currentZoom.
// flZoomCurrent is the actual zoom we are at this very moment.
//TAGGG - no other codebase refers to STAT_VIEWZOOM, best to replace anything
// involving that.
// in case of some unexpected change.
// TODO: this might have an issue if the player were to change weapons and end up
// on the same zoom level as a previous weapon, despite the two weapons having
// different target values (like 0.4 vs. 0.6) at their own zoom level #1's.
// A check for being a different equipped weapon type
// (pl.activeweapon vs. pl.activeweapon_zoomprev, set only by setZoomLevel)
// ought to work. But that would be a very strange case anyway
if(pl.iZoomLevel != pl.iZoomLevelPrev){
pl.setZoomLevel(pl.iZoomLevel);
}
if (pl.flZoomEnd != pl.flZoomTarget ) {
//printfline("NEW ZOOM DETECTED: %.2f -> %.2f (zoomlev: %i)", pl.flZoomEnd, pl.flZoomTarget, pl.iZoomLevel);
// is setting flZoomStart to flZoomEnd or flZoomCurrent a better idea?
// at flZoomEnd means, on changing before the current lerp has finished, it jumps to beginning
// at the end point of the lerp in progress. But starting at flZoomCurrent might be smoother?
@ -834,6 +847,7 @@ void TS_View_HandleZoom(void)
// 0.8 can be safe.
// The Wastes default was 4.
// !!! clframetime, frametime, or input_timelength ?
pl.flZoomLerp += clframetime * 5.7;
if(pl.flZoomLerp >= 1.0){
@ -848,7 +862,7 @@ void TS_View_HandleZoom(void)
// Set this, since Nuclide will read it in and apply instantly.
// So same effect without having to edit Nuclide, this pipes it over for it
// to do the setproperty thing below to apply
pl.viewzoom = pl.flZoomCurrent;
//pl.viewzoom = pl.flZoomCurrent;
////setproperty(VF_AFOV, DEFAULT_FOV * pl.flZoomCurrent);
////setsensitivityscaler(pl.flZoomCurrent);

View File

@ -38,6 +38,9 @@ var int autocvar_mp_friendlyfire = FALSE;
var int autocvar_fcs_swapteams = FALSE; /* Swaps spawnpoints */
var int autocvar_fcs_maxmoney = 99999; //TAGG - was 16000.
var int autocvar_debug_spawnpointforced = 0;
//TAGGG - not used, don't know if the TS really supported denying weapon drop-ables.
// Doesn't mean that can't be implemented anyway (check this CVar, and if on while about
// to spawn a drop-able, deny the request and don't drop at all on player death)

View File

@ -857,22 +857,32 @@ TSMultiplayerRules::PlayerRespawn(base_player pp, int fTeam)
// If so whatever picks a spawn point should probably come with a spawn point to
// put the player anyway, including droptofloor.
if(autocvar_debug_spawnpointforced == 1){
#ifdef TS_CUSTOM_SPAWN_ORIGIN
myOrigin = TS_CUSTOM_SPAWN_ORIGIN;
myOrigin = TS_CUSTOM_SPAWN_ORIGIN;
#else
myOrigin = eSpawn.origin;
printfline("WARNING! debug_spawnpointforced set, but TS_CUSTOM_SPAWN_ORIGIN is not defined!");
myOrigin = eSpawn.origin;
#endif
#ifdef TS_CUSTOM_SPAWN_VANGLE
pl.angles = TS_CUSTOM_SPAWN_VANGLE;
pl.v_angle = TS_CUSTOM_SPAWN_VANGLE;
pl.angles = TS_CUSTOM_SPAWN_VANGLE;
#else
pl.angles = eSpawn.angles;
printfline("WARNING! debug_spawnpointforced set, but TS_CUSTOM_SPAWN_VANGLE is not defined!");
pl.angles = eSpawn.angles;
#endif
}else{
myOrigin = eSpawn.origin;
pl.angles = eSpawn.angles;
}
// Why do we have to do this now? No clue.
// something about animation.h maybe? I Forget.
pl.v_angle = pl.angles;
#endif
Client_FixAngle(pl, pl.angles);

View File

@ -25,9 +25,12 @@
// FORCE A SPAWN LOC. Sometimes easier for testing to have a constant set of spawn coords/angle.
// Use with the right start params to jump into the map at debug.
// FORCE A SPAWN LOC. Sometimes easier for testing to have a constant set of
// spawn coords/angle.
// Below intneded for TS Bikini unlesss otherwise noted.
// Only applies if CVar "debug_spawnpoints" is set
// I forget, only origins
//#define TS_CUSTOM_SPAWN_ORIGIN '21 -1291 -380'
//#define TS_CUSTOM_SPAWN_ORIGIN '-754 569 -380'
@ -39,8 +42,7 @@
//#define TS_CUSTOM_SPAWN_ORIGIN [93.1, -80.0, -380.0]
//#define TS_CUSTOM_SPAWN_VANGLE [0.0, 90.0, 0.0]
// ts_awaken: the ledge thingy.
// ts_awaken: the ledge
//#define TS_CUSTOM_SPAWN_ORIGIN [12.4, -1350.6, -292.0]
//#define TS_CUSTOM_SPAWN_VANGLE [-12.5, 0.5, 0.0]

View File

@ -1,5 +1,4 @@
enum TS_GameMode{
DEATHMATCH,
TEAM_DEATHMATCH,

View File

@ -12,6 +12,7 @@ void TS_playerEquippedWeapon_Shared(player pl, int newWeaponEquipped, BOOL useAk
void _TS_playerEquippedWeapon(player pl, int newWeaponEquipped, BOOL useAkimbo);
void TS_playerEquippedWeapon(player pl, int newWeaponEquipped, BOOL useAkimbo);
void EV_EquipCallback(void);
void EV_TestCallback(int arg_messageID);
#endif
#ifdef SERVER
void _TS_playerEquippedWeapon(player pl, int newWeaponEquipped, BOOL useAkimbo);

View File

@ -188,27 +188,6 @@ TS_playerEquippedWeapon(player pl, int newWeaponEquipped, BOOL useAkimbo){
}
// EXPERIMENTAL. If the currently equipped weapon has been changed, reject
// messages received between the time I sent an order to change the current wepaon
// and the time it takes to get a response that the new weapon was seen by the server.
// This stops out-of-date calls coming in from reverting the zoom (or whatever other var)
// back to the old state.
// Or, example:
// Var A is networked (server sends updates to the client of its current value to keep it
// from going too far out of sync).
// var A starts at 30 both places. Say the ping is 500 milliseconds.
// Client sets var A to 12, sends a message to the server to have it changed too.
// But, during those 500 milliseconds to reach the server, messages sent from the server
// with the old A value (30), sent before the client sent the A-update to the server, reach
// the client and rever the value of A back to that 30.
// Only after the A-update of 12 reaches the server and the server updates the client back
// does that stop.
void
EV_EquipCallback(void){
player pl = (player)self;
pl.equippedWeaponWaitingForCallback = FALSE;
}
#endif
#ifdef SERVER
// that's it really serverside.
@ -254,6 +233,89 @@ CSEv_TS_playerEquippedWeapon_ii(int newWeaponEquipped, BOOL useAkimbo){
#ifdef SERVER
void
CSEv_TS_Test_i(int arg){
player pl = (player)self;
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EVENT_TS::TEST_CALLBACK );
WriteInt( MSG_MULTICAST, arg );
msg_entity = pl;
multicast( [0,0,0], MULTICAST_ONE_R );
}
#else
// begins from clientside! Manually call from wherever
// DUMMIED FOR NOW. If seriously used, the player needs a global counter
// that goes up with each call of this function (where globTemp is).
void TestCallback_Initiate(void){
/*
globTemp = ((float)globTemp + 1); //% 255; // use a byte or not?
pl.equippedWeaponWaitingForCallback = TRUE;
pl.equippedWeaponWaitingForCallback_ID = globTemp;
pl.equippedWeaponWaitingForCallback_maxWaitTime = time + 0.8;
sendevent("TS_Test", "i", pl.equippedWeaponWaitingForCallback_ID);
*/
}
// EXPERIMENTAL. If the currently equipped weapon has been changed, reject
// messages received between the time I sent an order to change the current wepaon
// and the time it takes to get a response that the new weapon was seen by the server.
// This stops out-of-date calls coming in from reverting the zoom (or whatever other var)
// back to the old state.
// Or, example:
// Var A is networked (server sends updates to the client of its current value to keep it
// from going too far out of sync).
// var A starts at 30 both places. Say the ping is 500 milliseconds.
// Client sets var A to 12, sends a message to the server to have it changed too.
// But, during those 500 milliseconds to reach the server, messages sent from the server
// with the old A value (30), sent before the client sent the A-update to the server, reach
// the client and rever the value of A back to that 30.
// Only after the A-update of 12 reaches the server and the server updates the client back
// does that stop.
void
EV_EquipCallback(void){
player pl = (player)self;
pl.equippedWeaponWaitingForCallback = FALSE;
}
void
EV_TestCallback(int arg_messageID){
player pl = (player)self;
if(pl.equippedWeaponWaitingForCallback == FALSE){
printfline("??? Not expecting a callback message!");
}
if(arg_messageID == pl.equippedWeaponWaitingForCallback_ID){
printfline("EV_TestCallback: Received up to date message!");
pl.equippedWeaponWaitingForCallback = FALSE;
}else{
printfline("EV_TestCallback: Message out of date! Exp:%i Recv:%i", pl.equippedWeaponWaitingForCallback_ID, arg_messageID);
}
}
#endif
// The server may want to tell the client to reset its viewmodel.
// DUMMIED - nevermind that for now, assuming the logic is called from server/client
// individually like a lot of weapon's logic.
@ -518,10 +580,10 @@ _TS_playerChangeFiremode(void ) {
//this power of 2 is a valid fireMode? pick it
(*fireModeVar) = currentChoice;
#ifdef CLIENT
#ifdef CLIENT
// effectively SAVE_STATE on whatever choice
(*fireModeVar_net) = currentChoice;
#endif
#endif
return;
}
@ -595,9 +657,9 @@ _TS_playerUseItems(void){
#if defined(CLIENT_CMD_SAFEMODE) && defined(CLIENT)
// Have a much simpler version instead
#ifdef CLIENT
#ifdef CLIENT
localsound("weapons/switch.wav", CHAN_AUTO, 1.0f);
#endif
#endif
return;
#endif
@ -842,6 +904,8 @@ CSEv_TS_Debug_getAngle_(void ) {
// Note that trying to exceed an ammo's max allowed ammount still caps at the ammmo's capacity.
// And if the player can't afford the ammount, the next greatest ammount to use the remaining money
// will be used instead.
// !!! PENDING REMOVAL.
// Nothing calls this, and it's the wrong name anyway (_i, should be _ii at the end I belive).
void
CSEv_PlayerBuyAmmo_TS_i( int iAmmoTypeID, int iAmmoAmount ) {
player pl = (player)self;

View File

@ -11,6 +11,7 @@ enum EVENT_TS{
//DROP_WEAPON,
FX_TS_EXPLOSION_GRENADE,
EQUIP_CALLBACK,
TEST_CALLBACK,
SOUNDPITCHED,
SOUNDPITCHED_CHANNEL,
TEST,

View File

@ -136,9 +136,9 @@ Game_Input(void)
if(pl.doFiremodeChange){
// so they say?
#ifdef CLIENT
#ifdef CLIENT
//sendevent("TS_playerChangeFiremode", "");
#endif
#endif
int iOldFiremode = pl.ary_myWeapons[pl.inventoryEquippedIndex].iFireMode;
_TS_playerChangeFiremode();
pl.doFiremodeChange = FALSE;

View File

@ -121,19 +121,26 @@ class player:base_player
// Set this (or the setZoom method) to tap into the lerp system properly.
// When noticed (client/view.qc), the current zoom value goes to flZoomStart and
// flZoomTarget goes to flZoomEnd. The lerp goes from Start to End for a smooth transition.
PREDICTED_FLOAT(flZoomTarget);
// TODO - soon, no longer serverside, not even involved there anymore at all.
// This can still be on server and clientside, since determining it from iZoomLevel
// given a weapon is possible (ak47's zoom #1 is this, barrett's zoom #1 is that, etc.)
//PREDICTED_FLOAT(flZoomTarget);
float flZoomTarget;
#ifdef CLIENT
float flZoomEnd;
float flZoomStart;
float flZoomLerp;
float flZoomCurrent;
float flZoomTarget;
float iZoomLevelPrev; // for clientside to detect a change
#endif
////////////////////////////////
#ifdef CLIENT
BOOL equippedWeaponWaitingForCallback;
int equippedWeaponWaitingForCallback_ID;
float equippedWeaponWaitingForCallback_maxWaitTime;
@ -484,8 +491,9 @@ class player:base_player
virtual vector(vector vecInputAngles)View_approachAngleOffsetTarget;
virtual void (void)updateTimers;
virtual void(float arg_theZoom) setZoom;
virtual void(int arg_iZoomLevel) setZoomLevel;
virtual void(void) resetZoom;
virtual void(void) resetZoomSoft;
virtual void(int arg_newIndex) setInventoryEquippedIndex;

View File

@ -18,7 +18,7 @@
// little test
//var float otherTimer = 0;
//#define FORCE_NETWORK_ALL_INVENTORY
#define FORCE_NETWORK_ALL_INVENTORY
/* all potential SendFlags bits we can possibly send */
@ -172,6 +172,12 @@ player::ReceiveEntity(float new, float fl)
// printfline("WELL hey WHAT:%i new:%i", oldPlayerWeapEq, inventoryEquippedIndex);
//}
// TODO! Test surrounding with this
if(!equippedWeaponWaitingForCallback){
}
// important to keep pl.activeweapon in sync
inventoryEquippedIndex = inventoryEquippedIndex_temp;
//setInventoryEquippedIndex(inventoryEquippedIndex_temp);
@ -188,19 +194,25 @@ player::ReceiveEntity(float new, float fl)
isReloading = readbyte();
isChangingIronsight = readbyte();
//flZoomTarget = readfloat();
float tempThing = readfloat();
/*
if(tempThing != flZoomTarget){
printfline("flZoomTarget change! %.2f - %.2f", flZoomTarget, tempThing);
}
*/
// That's a good thing, yes?
if(!equippedWeaponWaitingForCallback){
flZoomTarget = tempThing;
if(fl & PLAYER_UNUSED2){
//float flZoomTarget_temp = readfloat();
//flZoomTarget = flZoomTarget_temp;
int iZoomLevel_temp = readbyte();
if(iZoomLevel_temp != iZoomLevel){
// printfline("!!! ZoomLevel change A. %i -> %i (%.2f)", iZoomLevel, iZoomLevel_temp, time);
}
if(!equippedWeaponWaitingForCallback){
iZoomLevel = iZoomLevel_temp;
}
}
iZoomLevel = readbyte();
nextAkimboAttackPreference = readbyte();
akimboDualFireToleranceTime = readfloat();
grenadeFireIndex = readbyte() - 1;
@ -291,8 +303,10 @@ player::ReceiveEntity(float new, float fl)
// TODO! Check for any change in ammo values like this:
// Or maybe not, looks like Weapons_AmmoUpdate isn't needed for FreeTS, HUD draw methods
// already use the current weapon's ammo valus per weapon on the HUD without it
// if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
Weapons_AmmoUpdate(this);
//Weapons_AmmoUpdate(this);
setorigin(this, origin);
@ -348,9 +362,12 @@ so we can roll them back later.
void
player::PredictPreFrame(void)
{
//printfline("---PREDIT PRE FRAME");
/* the generic client attributes */
base_player::PredictPreFrame();
// client's way of calling prethink
preThink();
@ -394,7 +411,7 @@ player::PredictPreFrame(void)
SAVE_STATE(w_attack_akimbo_next);
SAVE_STATE(isReloading);
SAVE_STATE(isChangingIronsight);
SAVE_STATE(flZoomTarget);
//SAVE_STATE(flZoomTarget);
SAVE_STATE(iZoomLevel);
SAVE_STATE(nextAkimboAttackPreference);
SAVE_STATE(akimboDualFireToleranceTime);
@ -450,6 +467,10 @@ player::PredictPreFrame(void)
SAVE_STATE_ARY(ary_ammoTotal, i);
}
// viewzoom must be set by the end of PrePredict or else it will not
// reach the Nuclide logic looking at it in time to be applied.
// No need here now I think?
//this.viewzoom = this.flZoomCurrent;
}
/*
@ -462,9 +483,21 @@ Where we roll back our values to the ones last sent/verified by the server.
void
player::PredictPostFrame(void)
{
//printfline("---PREDIT POST FRAME");
/*
#ifdef CLIENT
if(iState == PLAYER_STATE::SPAWNED){
TS_View_HandleZoom();
}
#endif
*/
/* the generic client attributes */
base_player::PredictPostFrame();
// client's way of calling postthink
postThink();
@ -508,8 +541,17 @@ player::PredictPostFrame(void)
ROLL_BACK(w_attack_akimbo_next);
ROLL_BACK(isReloading);
ROLL_BACK(isChangingIronsight);
ROLL_BACK(flZoomTarget);
//ROLL_BACK(flZoomTarget);
/*
if(iZoomLevel != iZoomLevel_net){
printfline("!!! ZoomLevel change B. %i -> %i (%.2f)", iZoomLevel, iZoomLevel_net, time);
}
*/
ROLL_BACK(iZoomLevel);
ROLL_BACK(nextAkimboAttackPreference);
ROLL_BACK(akimboDualFireToleranceTime);
ROLL_BACK(grenadeFireIndex);
@ -567,6 +609,7 @@ player::PredictPostFrame(void)
void
player::EvaluateEntity(void)
{
/* the generic client attributes */
base_player::EvaluateEntity();
@ -699,7 +742,14 @@ player::EvaluateEntity(void)
}
// iZoomLevel or flZoomTarget ?
if(
//ATTR_CHANGED(flZoomTarget)
//||
ATTR_CHANGED(iZoomLevel)
){
SendFlags |= PLAYER_UNUSED2;
}
SAVE_STATE(anim_top);
@ -714,7 +764,7 @@ player::EvaluateEntity(void)
SAVE_STATE(w_attack_akimbo_next);
SAVE_STATE(isReloading);
SAVE_STATE(isChangingIronsight);
SAVE_STATE(flZoomTarget);
//SAVE_STATE(flZoomTarget);
SAVE_STATE(iZoomLevel);
SAVE_STATE(nextAkimboAttackPreference);
SAVE_STATE(akimboDualFireToleranceTime);
@ -883,8 +933,10 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteFloat(MSG_ENTITY, w_attack_akimbo_next );
WriteByte(MSG_ENTITY, isReloading );
WriteByte(MSG_ENTITY, isChangingIronsight );
WriteFloat(MSG_ENTITY, flZoomTarget);
WriteByte(MSG_ENTITY, iZoomLevel);
if(fChanged & PLAYER_UNUSED2){
//WriteFloat(MSG_ENTITY, flZoomTarget);
WriteByte(MSG_ENTITY, iZoomLevel);
}
WriteByte(MSG_ENTITY, nextAkimboAttackPreference);
WriteFloat(MSG_ENTITY, akimboDualFireToleranceTime);
WriteByte(MSG_ENTITY, grenadeFireIndex + 1);
@ -1097,6 +1149,7 @@ player::reset(BOOL resetInventory){
// should this even make any assumptions about this?
//iState = ?;
resetZoom();
#ifdef CLIENT
@ -1153,7 +1206,6 @@ player::reset(BOOL resetInventory){
doFiremodeChange = FALSE;
//Grenade stuff
printfline("I set grenadeFireIndex to -1, D!");
grenadeFireIndex = -1;
grenadeHeldDuration = -1;
grenadeSpawnTime = -1;
@ -1250,6 +1302,8 @@ vector
player::View_approachAngleOffsetTarget(vector vecInputAngles)
{
float frametimeUse;
// is this wise?
#ifdef CLIENT
frametimeUse = clframetime;
#else
@ -1287,7 +1341,7 @@ player::View_approachAngleOffsetTarget(vector vecInputAngles)
// little test
var float input_timelengthSum = 0;
//var float input_timelengthSum = 0;
// Count down my custom timers, called by ts/src/shared/input.qc, which is called
// by Nuclide's PMove, same place that counts down w_attack_next.
@ -1316,7 +1370,6 @@ player::updateTimers(void){
}
*/
fAccuracyKickbackStartCooldown = max(0, fAccuracyKickbackStartCooldown - input_timelength);
if(fKarateStamina < 1.0){
@ -1336,15 +1389,29 @@ player::updateTimers(void){
}
}//kickbackStartCooldown check
}//updateTimers
void
player::setZoom(float arg_theZoom)
{
//printfline("setZoom: %.2f", arg_theZoom);
flZoomTarget = arg_theZoom;
player::setZoomLevel(int arg_iZoomLevel){
iZoomLevel = arg_iZoomLevel;
#ifdef CLIENT
iZoomLevelPrev = iZoomLevel;
#endif
weapondata_basic_t* myDat = getEquippedWeaponData();
if(myDat != NULL){
if(myDat.funOnSetZoomLevel != NULL){
myDat.funOnSetZoomLevel(this);
}
}
}
// forget any zoom-related settings instantly.
// Unsure if a message should be sent to the client if called from the server, or assume the
// calls coincide.
@ -1353,19 +1420,31 @@ player::resetZoom(void)
{
iZoomLevel = 0;
viewzoom = 1.0f;
setZoom(1.0f); // sets flZoomTarget
flZoomTarget = 1.0f;
#ifdef CLIENT
// IMPORTANT! ZoomLerp under 0 tries to involve flZoomOld, set or not
flZoomLerp = 1.0f;
/*
SAVE_STATE(iZoomLevel);
SAVE_STATE(viewzoom);
SAVE_STATE(flZoomTarget);
//SAVE_STATE(flZoomTarget);
*/
flZoomEnd = 1.0f;
flZoomCurrent = 1.0f;
#endif
}
// similar as above, but still go for the transition smoothness,
// not an instant change
void
player::resetZoomSoft(void)
{
iZoomLevel = 0;
flZoomTarget = 1.0f;
}
void
player::setInventoryEquippedIndex(int arg_newIndex)
{
@ -1454,6 +1533,8 @@ player::setInventoryEquippedIndex_Akimbo(int arg_newIndex, BOOL useAkimbo)
// (force a sendoff, expect it area)
#ifdef SERVER
// Force a sendoff!
SendFlags |= PLAYER_WEAPON;
@ -1592,6 +1673,8 @@ player::shotgunAddAmmoTime_setCooldownSetTime(void){
#ifdef SERVER
// (Comment may be out of date, verify if serverside postthink or setting think methods
// anywhere still has issues)
// runs every frame server-side. postthink, oddly enough, does not.
// Even cumulative 'frametime' readings do not at all add up to the real passage of time.
// Looks like we have to do this with server calling our think instead... it's own frame
@ -1606,15 +1689,10 @@ player::shotgunAddAmmoTime_setCooldownSetTime(void){
void
player::frameThink_fromServer(void){
if(autocvar_sv_printoutspam == 1){
printfline("My state: %d", iState);
printfline("STATUS: %d, %i", activeweapon, inventoryEquippedIndex);
}
// no, leave that to shared/input.qc
//updateTimers();
preThinkShared();
//preThinkShared();
}// frameThink_fromServer
@ -1624,12 +1702,15 @@ player::frameThink_fromServer(void){
#ifdef CLIENT
// preThink & postThink are supporter client and serverside.
// They're not built-in methods per entity nor called by Nuclide.
// For clientside, preThink/postThink are called by prediction pre/post methods.
// For serverside, gamerules "Player(Pre/Post)Frame" events call these for every
// player.
// An above comment says there were problems with serverside postthink, but unsure
// if that is still the case.
// Note that these pre/postThink's aren't game events, they're just called
// before/after prediction accordingly, and every single rendered frame.
// Unlike serverside preThink / postThink, which (I think?) are called independent of any
// logic frame-rate on the server.
#ifdef CLIENT
void
player::preThink(void){
weapondynamic_t dynaRef;
@ -1639,15 +1720,11 @@ player::preThink(void){
gFun_UI_EventGrabber_DebugMethod();
}
if(time >= equippedWeaponWaitingForCallback_maxWaitTime){
// stop then
equippedWeaponWaitingForCallback = FALSE;
}
// Called before rendering, so this is an acceptable place.
TS_View_HandleZoom();
//callWeaponThink();
@ -1714,8 +1791,6 @@ player::preThink(void){
}//preThink
void
player::postThink(void){
@ -1742,23 +1817,24 @@ player::postThink(void){
}
}//postThink
#endif
#endif // CLIENT
// preThink & postThink are serverside only.
// Now supported clientside as separate implementations (see above)
// we have other ways for handling logic clientside.
#ifdef SERVER
void
player::preThink(void){
if(autocvar_sv_printoutspam == 1){
printfline("My state: %d", iState);
printfline("STATUS: %d, %i", activeweapon, inventoryEquippedIndex);
}
//self.angles += '0 0.3 0';
//self.v_angle = self.angles;
// TODO - for clientside, this would need to involve the "view_angles" global
// instead! Unsure if the macro GET_VIEW_ANGLES is good enough
v_angle = View_approachAngleOffsetTarget(v_angle);
preThinkShared();
}// preThink
@ -1775,6 +1851,22 @@ player::postThink(void){
void
player::preThinkShared(void){
// TODO: make this view kickback properly predicted
#ifdef CLIENT
//printfline("So what is my view ang?? %.2f %.2f", view_angles[0], view_angles[1]);
// TODO - for clientside, this would need to involve the "view_angles" global
// instead! Unsure if the macro GET_VIEW_ANGLES is good enough
//v_angle = View_approachAngleOffsetTarget(v_angle);
//view_angles = View_approachAngleOffsetTarget(view_angles);
#else
//printfline("So what is my view ang?? %.2f %.2f", this.v_angle[0], this.v_angle[1]);
this.v_angle = View_approachAngleOffsetTarget(this.v_angle);
#endif
// little test
//otherTimer += frametime;

View File

@ -249,8 +249,9 @@ if (pl.inputSecondaryTapFrameCount == 0)\
// be aware of the player
class player;
// extern?
const vector g_vZero = [0,0,0];
extern const vector g_vZero;

View File

@ -1,8 +1,5 @@
//easy ref.
const vector g_vZero = [0,0,0];
@ -337,7 +334,7 @@ void entityRemoveRespawnFlag(CBaseEntity arg_this){
void
TS_Weapons_ViewAnimation(int i, float fDuration)
{
//printfline("TS_Weapons_ViewAnimation: %i %.2f", i, fDuration);
printfline("TS_Weapons_ViewAnimation: %i %.2f", i, fDuration);
player pl = (player)self;
pl.w_idle_next = fDuration;
@ -352,7 +349,7 @@ TS_Weapons_ViewAnimation(int i, float fDuration)
void
TS_Weapons_ViewAnimation_noLaserLock(int i, float fDuration)
{
//printfline("TS_Weapons_ViewAnimation_noLaserLock: %i %.2f", i, fDuration);
printfline("TS_Weapons_ViewAnimation_noLaserLock: %i %.2f", i, fDuration);
player pl = (player)self;
pl.w_idle_next = fDuration;
@ -368,7 +365,7 @@ TS_Weapons_ViewAnimation_noLaserLock(int i, float fDuration)
void
TS_Weapons_ViewAnimation_EndIdle(int i, float fDuration)
{
//printfline("TS_Weapons_ViewAnimation_EndIdle: %i %.2f", i, fDuration);
printfline("TS_Weapons_ViewAnimation_EndIdle: %i %.2f", i, fDuration);
player pl = (player)self;
pl.w_idle_next = fDuration;
@ -383,7 +380,7 @@ TS_Weapons_ViewAnimation_EndIdle(int i, float fDuration)
void
TS_Weapons_ViewAnimation_EndIdle_custom(int i, float fDuration, float fIdleEndOffset)
{
//printfline("TS_Weapons_ViewAnimation_EndIdle_custom: %i %.2f %.2f", i, fDuration, fIdleEndOffset);
printfline("TS_Weapons_ViewAnimation_EndIdle_custom: %i %.2f %.2f", i, fDuration, fIdleEndOffset);
player pl = (player)self;
pl.w_idle_next = fDuration;

View File

@ -443,10 +443,8 @@ typedef struct{
// bind "c" "+alt2"
void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock;
// We'll handle firing animations (weapon recoil mainly) in their own methods.
// Little too much going on. Number of animations to cylce through (shoot1, shoot2)?
// separate batch for firing in semi-auto mode (sshoot1, sshoot2)?
// and new ones for ironsight firing sometimes?
// This event is for recently changing the zoom level on the player.
void(player pl) funOnSetZoomLevel;
int iAnim_Idle_Index;
@ -512,7 +510,8 @@ typedef struct{
void(player pl, weapondynamic_t arg_thisWeapon) funOnThink;
void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock;
void(player pl) funOnSetZoomLevel;
int iAnim_Idle_Index;
@ -587,6 +586,7 @@ typedef struct{
void(player pl, weapondynamic_t arg_thisWeapon) funOnThink;
void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock;
void(player pl) funOnSetZoomLevel;
int iAnim_Idle_Index;
@ -651,6 +651,7 @@ typedef struct{
void(player pl, weapondynamic_t arg_thisWeapon) funOnThink;
void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock;
void(player pl) funOnSetZoomLevel;
int iAnim_Idle_Index;
@ -700,6 +701,7 @@ typedef struct{
void(player pl, weapondynamic_t arg_thisWeapon) funOnThink;
void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock;
void(player pl) funOnSetZoomLevel;
int iAnim_Idle_Index;
@ -778,7 +780,6 @@ typedef struct{
} weapondata_shotgun_extra_t;
//TODO. Is extern'ing these earlier possible?
ammodata_t* ary_ammoData[AMMO_ID::LAST_ID];
#ifdef CLIENT

View File

@ -273,7 +273,6 @@ weapon_base_onPrimaryAttack_melee_fromCustomDirection(
}// weapon_base_onPrimaryAttack_melee
// Apparently serverside-only? ok...
void
weapon_base_onAttack(player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, int attackTypeUsed)
{
@ -294,7 +293,6 @@ void
weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, int shellCount, int attackTypeUsed)
{
#ifdef SERVER
weapondata_gun_t baseRef = *((weapondata_gun_t*)basePRef);
float randoAngFactor = randomInRange_f(0, 1);
@ -336,6 +334,7 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
//float maxer = 1.00/128;
#ifdef SERVER
//TAGGG - NOTE!
// Nuclide does not support custom range as of now, nor how to tell how far penetration can go.
// Old FreeTS did penetration distance by reducing range by 3 times as far as any solid object
@ -356,6 +355,7 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
myPenetrationCount = 0;
}
TraceAttack_SetPenetrationPower(myPenetrationCount);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////
@ -363,7 +363,9 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
// like "WEAPON_ID::Glock18". Consider sending that as a parameter to be available here
if(attackTypeUsed & BITS_AKIMBOCHOICE_LEFT){
//left
#ifdef SERVER
TraceAttack_FireBullets(shellCount, (pl.origin + pl.view_ofs), baseRef.fAttackDamage, [acc, acc], (int)pl.activeweapon);
#endif
arg_thisWeapon.iClipLeft -= 1;
toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * randomInRange_f(miner, maxer);
pl.vViewAngleOffsetTarget += toGo;
@ -371,8 +373,9 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
if(attackTypeUsed & BITS_AKIMBOCHOICE_RIGHT){
//right
#ifdef SERVER
TraceAttack_FireBullets(shellCount, (pl.origin + pl.view_ofs), baseRef.fAttackDamage, [acc, acc], (int)pl.activeweapon);
#endif
arg_thisWeapon.iClipAkimboLeft -= 1;
toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * randomInRange_f(miner, maxer);
pl.vViewAngleOffsetTarget += toGo;
@ -391,12 +394,9 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami
pl.fAccuracyKickback = 0.1;
}
// TODO - third person.
// TODO - third person. This is mad old isn't it
//Animation_ShootWeapon( pl );
#else
//CLIENTSIDE
#endif
}// weapon_base_onAttack
@ -498,8 +498,7 @@ weapon_shotgun_reload(
}
pl.isChangingIronsight = FALSE;
//pl.resetZoom();
pl.setZoom(1.0f);
pl.resetZoomSoft();
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
@ -1287,7 +1286,7 @@ weapon_akimbo_fullAttackChoice(
*/
}
\
}
return finalAkimboChoice;
@ -1366,8 +1365,7 @@ weapon_gun_Reload(
}
pl.isChangingIronsight = FALSE;
//pl.resetZoom();
pl.setZoom(1.0f);
pl.resetZoomSoft();
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
@ -1410,8 +1408,7 @@ weapon_gun_Reload_CustomSequence(
}
pl.isChangingIronsight = FALSE;
//pl.resetZoom();
pl.setZoom(1.0f);
pl.resetZoomSoft();
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
@ -1432,13 +1429,19 @@ weapon_ironsight_Reload(
){
weapondata_ironsight_t baseRef = *basePRef;
/*
if (pl.w_attack_next > 0.0){
return;
}
*/
if ( pl.isReloading || pl.isChangingIronsight){
//blocked
return;
}
//if ( self.fAttackFinished > time ) {
// return;
//}
if(pl.ary_ammoTotal[baseRef.iAmmoDataID] <= 0){
//also no. Having no ammo in the pool to take from means no reloading.
@ -1451,19 +1454,19 @@ weapon_ironsight_Reload(
}
}else{
//akimbo, allows reloading for either being less than full
if(arg_thisWeapon.iClipLeft >= baseRef.iClipMax && arg_thisWeapon.iClipAkimboLeft >= baseRef.iClipMax){
if(arg_thisWeapon.iClipLeft >= baseRef.iClipMax && arg_thisWeapon.iClipAkimboLeft >= baseRef.iClipMax){
return; //both full? don't reload!
}
}
pl.isChangingIronsight = FALSE;
//pl.resetZoom();
pl.setZoom(1.0f);
pl.resetZoomSoft();
pl.aryNextBurstShotTime_softLength = 0;
pl.aryNextBurstShotTime_listenIndex = -1;
pl.isReloading = TRUE;
weapon_base_setWholeAttackDelay(pl, baseRef.fAnim_Reload_Duration);
//printfline("not ironsite rite %i", arg_thisWeapon.iIronSight);
if(!arg_thisWeapon.iIronSight){
TS_Weapons_ViewAnimation(baseRef.iAnim_Reload_Index, baseRef.fAnim_Reload_Duration );
}else{
@ -1644,6 +1647,8 @@ weapon_gun_onThink_burstFireLogic(
}// weapon_gun_onThink
void
weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_thisWeapon)
{
@ -2000,6 +2005,7 @@ weapondata_basic_t weapon_none =
weapons_dummyfun,
weapons_dummyfun,
weapons_dummyfun,
NULL,
0,
0,
0.0f,
@ -2031,6 +2037,7 @@ weapondata_basic_t weapon_none_akimbo =
weapons_dummyfun,
weapons_dummyfun,
weapons_dummyfun,
NULL,
0,
0,
0.0f,
@ -2049,9 +2056,7 @@ weapondata_basic_t weapon_none_akimbo =
//include after all weapons have been defined? (that is, compile weapon.c (here), then weapon-specific files, then a new file containing setupWeaponData)
//Or would it make sense to extern the structs here and keep this method in the same file?
// (compile weapon-specific files first, then weapon.c)
void
setupWeaponData(void)
{

View File

@ -24,6 +24,13 @@ void weapon_ak47_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_ak47_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_ak47_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.40f;break;
case 2:pl.flZoomTarget = 0.1625f;break;
}
}
weapondata_ironsight_t weapon_ak47 =
{
@ -38,6 +45,7 @@ weapondata_ironsight_t weapon_ak47 =
weapon_ak47_onSecondaryAttackRelease,
weapon_ak47_onThink,
weapon_ak47_onColdCock,
weapon_ak47_onSetZoomLevel,
weaponseq_ak47::idle,
weaponseq_ak47::draw,
31.0f / 35.0f,
@ -171,6 +179,7 @@ w_ak47_primary(void)
}
void
w_ak47_secondary(void)
{
@ -180,13 +189,20 @@ w_ak47_secondary(void)
INPUT_SECONDARY_TAP_GATE
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.1625f);break;
}
//int iZoomLevel_old = pl.iZoomLevel;
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 3;
//printfline("!!! ZoomLevel change MANUAL %i -> %i (%.2f) inputframe:%i", iZoomLevel_old, pl.iZoomLevel, time, input_sequence);
pl.setZoomLevel(newZoomLevel);
// IDEA: have a var set by that EquipmentCallback thing instead that's networked,
// so: client: set "waitingForCallback" to FALSE. SendEvent("...")
// server: modify "waitingForCallback", set to TRUE.
// (because that var is networked, the client will see it when it updates).
// Or don't, that might be stupidly wasteful from being sent every frame when the
// sheer majority do not involve weapon changes.
}else{
if(pl.w_attack_next > 0){
return;
@ -194,7 +210,6 @@ w_ak47_secondary(void)
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon);
}
}
void

View File

@ -39,6 +39,7 @@ weapondata_gun_t weapon_akimbocolts =
weapon_akimbocolts_akimbo_onSecondaryAttackRelease,
weapon_akimbocolts_akimbo_onThink,
weapon_akimbocolts_akimbo_onColdCock,
NULL,
weaponseq_akimbocolts::idle,
weaponseq_akimbocolts::draw,
31.0f / 30.0f,

View File

@ -20,6 +20,13 @@ void weapon_barrettm82_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_barrettm82_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_barrettm82_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.40f;break;
case 2:pl.flZoomTarget = 0.10f;break;
}
}
weapondata_gun_t weapon_barrettm82 =
{
@ -34,6 +41,7 @@ weapondata_gun_t weapon_barrettm82 =
weapon_barrettm82_onSecondaryAttackRelease,
weapon_barrettm82_onThink,
weapon_barrettm82_onColdCock,
weapon_barrettm82_onSetZoomLevel,
weaponseq_barrettm82::idle,
weaponseq_barrettm82::draw,
31.0f / 30.0f,
@ -174,12 +182,8 @@ w_barrettm82_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.10f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 3;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -24,6 +24,12 @@ void weapon_benellim3_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_benellim3_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_benellim3_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.50f;break;
}
}
weapondata_gun_t weapon_benellim3 =
{
@ -38,6 +44,7 @@ weapondata_gun_t weapon_benellim3 =
weapon_benellim3_onSecondaryAttackRelease,
weapon_benellim3_onThink,
weapon_benellim3_onColdCock,
weapon_benellim3_onSetZoomLevel,
weaponseq_benellim3::idle,
weaponseq_benellim3::draw,
31.0f / 30.0f,
@ -242,11 +249,8 @@ w_benellim3_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -35,6 +35,7 @@ weapondata_gun_t weapon_beretta =
weapon_beretta_onSecondaryAttackRelease,
weapon_beretta_onThink,
weapon_beretta_onColdCock,
NULL,
weaponseq_beretta::idle,
weaponseq_beretta::draw,
31.0f / 30.0f,

View File

@ -63,6 +63,7 @@ weapondata_gun_t weapon_beretta_akimbo =
weapon_beretta_akimbo_onSecondaryAttackRelease,
weapon_beretta_akimbo_onThink,
weapon_beretta_akimbo_onColdCock,
NULL,
weaponseq_beretta_akimbo::idle_1,
weaponseq_beretta_akimbo::draw,
41.0f / 55.0f,

View File

@ -40,6 +40,7 @@ weapondata_throwable_t weapon_combatknife =
weapon_combatknife_onSecondaryAttackRelease,
weapon_combatknife_onThink,
weapon_combatknife_onColdCock,
NULL,
weaponseq_combatknife::idle,
weaponseq_combatknife::draw,
31.0f / 30.0f,
@ -146,8 +147,6 @@ w_combatknife_primary(void)
}
#endif
//Animation_ShootWeapon( self );
//self.fAttackFinished = time + wptKNIFE.fAttackFinished;
// actually do this animation the same regardless as far as we know.
// Do these go through some kind of cycle, I forget

View File

@ -20,6 +20,12 @@ void weapon_contenderg2_onThink(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_contenderg2_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_contenderg2_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.325f;break;
}
}
weapondata_gun_t weapon_contenderg2 =
{
@ -34,6 +40,7 @@ weapondata_gun_t weapon_contenderg2 =
weapon_contenderg2_onSecondaryAttackRelease,
weapon_contenderg2_onThink,
weapon_contenderg2_onColdCock,
weapon_contenderg2_onSetZoomLevel,
weaponseq_contenderg2::idle,
weaponseq_contenderg2::draw,
31.0f / 30.0f,
@ -176,11 +183,8 @@ w_contenderg2_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.325f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -26,6 +26,12 @@ void weapon_deserteagle_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_deserteagle_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_deserteagle_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.75f;break;
}
}
weapondata_ironsight_t weapon_deserteagle =
{
@ -40,6 +46,7 @@ weapondata_ironsight_t weapon_deserteagle =
weapon_deserteagle_onSecondaryAttackRelease,
weapon_deserteagle_onThink,
weapon_deserteagle_onColdCock,
weapon_deserteagle_onSetZoomLevel,
weaponseq_deserteagle::idle,
weaponseq_deserteagle::draw,
31.0f / 50.0f,
@ -223,11 +230,8 @@ w_deserteagle_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.75f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}else{
if(pl.w_attack_next > 0){
return;

View File

@ -33,6 +33,7 @@ weapondata_gun_t weapon_fiveseven =
weapon_fiveseven_onSecondaryAttackRelease,
weapon_fiveseven_onThink,
weapon_fiveseven_onColdCock,
NULL,
weaponseq_fiveseven::idle,
weaponseq_fiveseven::draw,
31.0f / 30.0f,

View File

@ -34,6 +34,7 @@ weapondata_gun_t weapon_fiveseven_akimbo =
weapon_fiveseven_akimbo_onSecondaryAttackRelease,
weapon_fiveseven_akimbo_onThink,
weapon_fiveseven_akimbo_onColdCock,
NULL,
weaponseq_fiveseven_akimbo::idle,
weaponseq_fiveseven_akimbo::draw,
31.0f / 40.0f,

View File

@ -34,6 +34,7 @@ weapondata_gun_t weapon_glock18 =
weapon_glock18_onSecondaryAttackRelease,
weapon_glock18_onThink,
weapon_glock18_onColdCock,
NULL,
weaponseq_glock18::idle,
weaponseq_glock18::draw,
31.0f / 30.0f,

View File

@ -34,6 +34,7 @@ weapondata_gun_t weapon_glock20 =
weapon_glock20_onSecondaryAttackRelease,
weapon_glock20_onThink,
weapon_glock20_onColdCock,
NULL,
weaponseq_glock20::idle,
weaponseq_glock20::draw,
31.0f / 30.0f,

View File

@ -20,6 +20,12 @@ void weapon_hkpdw_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_hkpdw_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_hkpdw_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.50f;break;
}
}
weapondata_gun_t weapon_hkpdw =
{
@ -34,6 +40,7 @@ weapondata_gun_t weapon_hkpdw =
weapon_hkpdw_onSecondaryAttackRelease,
weapon_hkpdw_onThink,
weapon_hkpdw_onColdCock,
weapon_hkpdw_onSetZoomLevel,
weaponseq_hkpdw::idle,
weaponseq_hkpdw::draw,
31.0f / 30.0f,
@ -184,11 +191,8 @@ w_hkpdw_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -45,6 +45,7 @@ weapondata_basic_t weapon_karate =
weapon_karate_onSecondaryAttackRelease,
weapon_karate_onThink,
weapon_karate_onColdCock,
NULL,
weaponseq_karate::idle,
weaponseq_karate::draw,
31 / 35, // 31/35 ?
@ -152,7 +153,6 @@ w_karate_primary(void)
}
#endif
//Animation_ShootWeapon( self );
pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.085, 1);
int r = (float)input_sequence % 4;
@ -283,7 +283,6 @@ w_karate_secondary(void)
w_karate_determineSecondaryAttack(hitRep, meleeAnimToPlay);
pl.fUncrouchBlockDelay = 1.0f;
//Animation_ShootWeapon( self );
#ifdef SERVER
// need the fleshhit sound

View File

@ -33,6 +33,7 @@ weapondata_melee_t weapon_katana =
weapon_katana_onSecondaryAttackRelease,
weapon_katana_onThink,
weapon_katana_onColdCock,
NULL,
weaponseq_katana::idle,
weaponseq_katana::draw,
31.0f / 33.0f,
@ -141,10 +142,6 @@ w_katana_primary(void)
pl.fMoveBlockDelay = 1.0f;
pl.fUncrouchBlockDelay = 1.0f;
// So this works now? Or not.
#ifdef CLIENT
//SAVE_STATE(pl.fUncrouchBlockDelay);
#endif
}else{
// Check. Are we moving backwards, enough?? And not looking up/down too far?

View File

@ -30,6 +30,13 @@ void weapon_m16a4_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_m16a4_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_m16a4_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.40f;break;
case 2:pl.flZoomTarget = 0.10f;break;
}
}
weapondata_ironsight_t weapon_m16a4 =
{
@ -44,6 +51,7 @@ weapondata_ironsight_t weapon_m16a4 =
weapon_m16a4_onSecondaryAttackRelease,
weapon_m16a4_onThink,
weapon_m16a4_onColdCock,
weapon_m16a4_onSetZoomLevel,
weaponseq_m16a4::idle,
weaponseq_m16a4::draw,
31.0f / 35.0f,
@ -231,12 +239,8 @@ w_m16a4_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
case 2:pl.setZoom(0.10f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 3;
pl.setZoomLevel(newZoomLevel);
}else{
if(pl.w_attack_next > 0){
return;

View File

@ -51,6 +51,12 @@ void weapon_m4a1_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
}
void weapon_m4a1_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.325f;break;
}
}
weapondata_ironsight_t weapon_m4a1 =
@ -66,6 +72,7 @@ weapondata_ironsight_t weapon_m4a1 =
weapon_m4a1_onSecondaryAttackRelease,
weapon_m4a1_onThink,
weapon_m4a1_onColdCock,
weapon_m4a1_onSetZoomLevel,
weaponseq_m4a1::idle,
weaponseq_m4a1::draw,
31.0f / 35.0f,
@ -242,11 +249,9 @@ w_m4a1_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.325f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}else{
if(pl.w_attack_next > 0){
return;

View File

@ -31,6 +31,7 @@ weapondata_gun_t weapon_m60 =
weapon_m60_onSecondaryAttackRelease,
weapon_m60_onThink,
weapon_m60_onColdCock,
NULL,
weaponseq_m60::idle,
weaponseq_m60::draw,
31.0f / 33.0f,

View File

@ -19,8 +19,7 @@ void weapon_m61grenade_onSecondaryAttackRelease(player pl, weapondynamic_t arg_t
}
//Serverside only method, generates an entity
// TODO - just be an entity in its own file at this point.
// Serverside only method, generates an entity
#ifdef SERVER
void weapon_m61grenade_spawnProjectile(player pl, weapondynamic_t arg_thisWeapon, BOOL wasToss, float heldDuration){
makevectors( GET_VIEW_ANGLES );
@ -149,6 +148,7 @@ weapondata_throwable_t weapon_m61grenade =
weapon_m61grenade_onSecondaryAttackRelease,
weapon_m61grenade_onThink,
weapon_m61grenade_onColdCock,
NULL,
weaponseq_m61grenade::idle,
weaponseq_m61grenade::draw,
31.0f / 40.0f,

View File

@ -47,6 +47,7 @@ weapondata_ironsight_t weapon_mac10 =
weapon_mac10_onSecondaryAttackRelease,
weapon_mac10_onThink,
weapon_mac10_onColdCock,
NULL,
weaponseq_mac10::idle,
weaponseq_mac10::draw,
31.0f / 30.0f,

View File

@ -46,6 +46,7 @@ weapondata_ironsight_t weapon_miniuzi =
weapon_miniuzi_onSecondaryAttackRelease,
weapon_miniuzi_onThink,
weapon_miniuzi_onColdCock,
NULL,
weaponseq_miniuzi::idle,
weaponseq_miniuzi::draw,
31.0f / 30.0f,

View File

@ -54,6 +54,7 @@ weapondata_gun_t weapon_miniuzi_akimbo =
weapon_miniuzi_akimbo_onSecondaryAttackRelease,
weapon_miniuzi_akimbo_onThink,
weapon_miniuzi_akimbo_onColdCock,
NULL,
weaponseq_miniuzi_akimbo::akimbo_idle,
weaponseq_miniuzi_akimbo::akimbo_draw,
31.0f / 35.0f,

View File

@ -45,6 +45,7 @@ weapondata_ironsight_t weapon_mossberg500 =
weapon_mossberg500_onSecondaryAttackRelease,
weapon_mossberg500_onThink,
weapon_mossberg500_onColdCock,
NULL,
weaponseq_mossberg500::idle,
weaponseq_mossberg500::draw,
31.0f / 35.0f,

View File

@ -27,6 +27,12 @@ void weapon_mp5k_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_mp5k_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_mp5k_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.40f;break;
}
}
weapondata_ironsight_t weapon_mp5k =
{
@ -41,6 +47,7 @@ weapondata_ironsight_t weapon_mp5k =
weapon_mp5k_onSecondaryAttackRelease,
weapon_mp5k_onThink,
weapon_mp5k_onColdCock,
weapon_mp5k_onSetZoomLevel,
weaponseq_mp5k::idle,
weaponseq_mp5k::draw,
31.0f / 30.0f,
@ -227,11 +234,8 @@ w_mp5k_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}else{
if(pl.w_attack_next > 0){
return;

View File

@ -21,6 +21,12 @@ void weapon_mp5sd_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_mp5sd_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_mp5sd_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.40f;break;
}
}
weapondata_gun_t weapon_mp5sd =
{
@ -35,6 +41,7 @@ weapondata_gun_t weapon_mp5sd =
weapon_mp5sd_onSecondaryAttackRelease,
weapon_mp5sd_onThink,
weapon_mp5sd_onColdCock,
weapon_mp5sd_onSetZoomLevel,
weaponseq_mp5sd::idle,
weaponseq_mp5sd::draw,
31.0f / 30.0f,
@ -197,11 +204,8 @@ w_mp5sd_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.40f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -19,6 +19,12 @@ void weapon_ragingbull_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_ragingbull_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_ragingbull_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.50f;break;
}
}
weapondata_gun_t weapon_ragingbull =
{
@ -33,6 +39,7 @@ weapondata_gun_t weapon_ragingbull =
weapon_ragingbull_onSecondaryAttackRelease,
weapon_ragingbull_onThink,
weapon_ragingbull_onColdCock,
weapon_ragingbull_onSetZoomLevel,
weaponseq_ragingbull::idle,
weaponseq_ragingbull::draw,
31.0f / 33.0f,
@ -171,11 +178,8 @@ w_ragingbull_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -33,6 +33,7 @@ weapondata_gun_t weapon_rugermk1 =
weapon_rugermk1_onSecondaryAttackRelease,
weapon_rugermk1_onThink,
weapon_rugermk1_onColdCock,
NULL,
weaponseq_rugermk1::idle,
weaponseq_rugermk1::draw,
31.0f / 35.0f,

View File

@ -63,6 +63,7 @@ weapondata_ironsight_t weapon_sawedoff =
weapon_sawedoff_onSecondaryAttackRelease,
weapon_sawedoff_onThink,
weapon_sawedoff_onColdCock,
NULL,
weaponseq_sawedoff::idle,
weaponseq_sawedoff::draw,
31.0f / 33.0f,

View File

@ -31,6 +31,7 @@ weapondata_throwable_t weapon_sealknife =
weapon_sealknife_onSecondaryAttackRelease,
weapon_sealknife_onThink,
weapon_sealknife_onColdCock,
NULL,
weaponseq_sealknife::idle,
weaponseq_sealknife::draw,
31.0f / 30.0f,
@ -138,8 +139,6 @@ w_sealknife_primary(void)
}
#endif
//Animation_ShootWeapon( self );
//self.fAttackFinished = time + wptKNIFE.fAttackFinished;
// actually do this animation the same regardless as far as we know.
int r = (float)input_sequence % 3;

View File

@ -35,6 +35,7 @@ weapondata_gun_t weapon_skorpion =
weapon_skorpion_onSecondaryAttackRelease,
weapon_skorpion_onThink,
weapon_skorpion_onColdCock,
NULL,
weaponseq_skorpion::idle,
weaponseq_skorpion::draw,
31.0f / 30.0f,

View File

@ -34,6 +34,7 @@ weapondata_gun_t weapon_skorpion_akimbo =
weapon_skorpion_akimbo_onSecondaryAttackRelease,
weapon_skorpion_akimbo_onThink,
weapon_skorpion_akimbo_onColdCock,
NULL,
weaponseq_skorpion_akimbo::idle,
weaponseq_skorpion_akimbo::draw,
31.0f / 30.0f,

View File

@ -41,6 +41,7 @@ weapondata_ironsight_t weapon_socommk23 =
weapon_socommk23_onSecondaryAttackRelease,
weapon_socommk23_onThink,
weapon_socommk23_onColdCock,
NULL,
weaponseq_socommk23::idleb,
weaponseq_socommk23::drawb,
31.0f / 40.0f,

View File

@ -46,6 +46,7 @@ weapondata_ironsight_t weapon_socommk23_akimbo =
weapon_socommk23_akimbo_onSecondaryAttackRelease,
weapon_socommk23_akimbo_onThink,
weapon_socommk23_akimbo_onColdCock,
NULL,
weaponseq_socommk23_akimbo::idle,
weaponseq_socommk23_akimbo::draw,
31.0f / 40.0f,

View File

@ -38,6 +38,7 @@ weapondata_gun_t weapon_spas12 =
weapon_spas12_onSecondaryAttackRelease,
weapon_spas12_onThink,
weapon_spas12_onColdCock,
NULL,
weaponseq_spas12::idle,
weaponseq_spas12::draw,
31.0f / 30.0f,

View File

@ -18,6 +18,12 @@ void weapon_steyraug_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_steyraug_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_steyraug_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.50f;break;
}
}
weapondata_gun_t weapon_steyraug =
{
@ -32,6 +38,7 @@ weapondata_gun_t weapon_steyraug =
weapon_steyraug_onSecondaryAttackRelease,
weapon_steyraug_onThink,
weapon_steyraug_onColdCock,
weapon_steyraug_onSetZoomLevel,
weaponseq_steyraug::idle,
weaponseq_steyraug::draw,
31.0f / 30.0f,
@ -176,11 +183,8 @@ w_steyraug_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -39,6 +39,7 @@ weapondata_ironsight_t weapon_steyrtmp =
weapon_steyrtmp_onSecondaryAttackRelease,
weapon_steyrtmp_onThink,
weapon_steyrtmp_onColdCock,
NULL,
weaponseq_steyrtmp::idle,
weaponseq_steyrtmp::draw,
31.0f / 35.0f,

View File

@ -20,6 +20,12 @@ void weapon_ump_onThink(player pl, weapondynamic_t arg_thisWeapon){
void weapon_ump_onColdCock(player pl, weapondynamic_t arg_thisWeapon){
}
void weapon_ump_onSetZoomLevel(player pl){
switch(pl.iZoomLevel){
case 0:pl.flZoomTarget = 1.00f;break;
case 1:pl.flZoomTarget = 0.50f;break;
}
}
weapondata_gun_t weapon_ump =
{
@ -34,6 +40,7 @@ weapondata_gun_t weapon_ump =
weapon_ump_onSecondaryAttackRelease,
weapon_ump_onThink,
weapon_ump_onColdCock,
weapon_ump_onSetZoomLevel,
weaponseq_ump::idle,
weaponseq_ump::draw,
26.0f / 35.0f,
@ -187,11 +194,8 @@ w_ump_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case 0:pl.setZoom(1.00f);break;
case 1:pl.setZoom(0.50f);break;
}
int newZoomLevel = ((float)pl.iZoomLevel + 1) % 2;
pl.setZoomLevel(newZoomLevel);
}
}

View File

@ -31,6 +31,7 @@ weapondata_gun_t weapon_usas12 =
weapon_usas12_onSecondaryAttackRelease,
weapon_usas12_onThink,
weapon_usas12_onColdCock,
NULL,
weaponseq_usas12::idle,
weaponseq_usas12::draw,
31.0f / 30.0f,