]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/balance_v2' into 'master'
authorMario <zacjardine@y7mail.com>
Sun, 21 Feb 2016 07:03:24 +0000 (07:03 +0000)
committerMario <zacjardine@y7mail.com>
Sun, 21 Feb 2016 07:03:24 +0000 (07:03 +0000)
Merge branch Mario/balance_v2 (Small merge request)

Some small adjustments to the weapon balance (mainly for the arc).

See merge request !281

52 files changed:
defaultXonotic.cfg
models/weapons/g_campingrifle.md3
models/weapons/g_hagar.md3
models/weapons/h_hagar.iqm
models/weapons/h_hagar.iqm.framegroups
models/weapons/v_campingrifle.md3
models/weapons/v_hagar.md3
mutators.cfg
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/mapvoting.qc
qcsrc/client/quickmenu.qc
qcsrc/client/view.qc
qcsrc/common/ent_cs.qc
qcsrc/common/items/item/jetpack.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/t_items.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/lib/_all.inc
qcsrc/lib/markdown.qh [new file with mode: 0644]
qcsrc/server/autocvars.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/events.qh
qcsrc/server/weapons/weaponsystem.qc
scripts/weapons.shader
textures/campingrifle.tga [deleted file]
textures/campingrifle_bump.tga [deleted file]
textures/campingrifle_gloss.tga [deleted file]
textures/campingrifle_glow.tga [deleted file]
textures/campingrifle_screen.tga [deleted file]
textures/hagar.tga [new file with mode: 0644]
textures/hagar2.tga [deleted file]
textures/hagar2_gloss.tga [deleted file]
textures/hagar2_glow.tga [deleted file]
textures/hagar2_norm.tga [deleted file]
textures/hagar2_reflect.tga [deleted file]
textures/hagar2_shirt.tga [deleted file]
textures/hagar_glow.tga [new file with mode: 0644]
textures/hagar_norm.tga [new file with mode: 0644]
textures/hagar_reflect.tga [new file with mode: 0644]
textures/hagar_shirt.tga [new file with mode: 0644]
textures/hagar_spec.tga [new file with mode: 0644]
textures/sniperrifle.tga [new file with mode: 0644]
textures/sniperrifle_bump.tga [new file with mode: 0644]
textures/sniperrifle_glow.tga [new file with mode: 0644]
textures/sniperrifle_reflect.tga [new file with mode: 0644]

index 7bc9466eb45bdec8b53dd4d28bd559d8927d8e51..50e0ad7e724bcf15dc9466f4940d0e08563a1a9a 100644 (file)
@@ -163,28 +163,21 @@ cl_bobmodel 1 // whether to have gun model move around on screen when moving (on
 cl_bobmodel_side 0.2 // amount the gun sways to the sides
 cl_bobmodel_speed 5 // rate at which the gun sways
 cl_bobmodel_up 0.1 // amount the gun sways up and down
-cl_leanmodel 1 // enables weapon leaning effect when looking around
-cl_leanmodel_side_speed 0.7 "gun leaning sideways speed"
-cl_leanmodel_side_limit 35 "gun leaning sideways limit"
-cl_leanmodel_side_highpass1 30 "gun leaning sideways pre-highpass in 1/s"
-cl_leanmodel_side_highpass 3 "gun leaning sideways highpass in 1/s"
-cl_leanmodel_side_lowpass 20 "gun leaning sideways lowpass in 1/s"
-cl_leanmodel_up_speed 0.65 "gun leaning upward speed"
-cl_leanmodel_up_limit 50 "gun leaning upward limit"
-cl_leanmodel_up_highpass1 5 "gun leaning upward pre-highpass in 1/s"
-cl_leanmodel_up_highpass 15 "gun leaning upward highpass in 1/s"
-cl_leanmodel_up_lowpass 20 "gun leaning upward lowpass in 1/s"
+
 cl_followmodel 1 // enables weapon pushing / pulling effect when walking
-cl_followmodel_side_speed 0.25 "gun following sideways speed"
-cl_followmodel_side_limit 6 "gun following sideways limit"
-cl_followmodel_side_highpass1 30 "gun following sideways pre-highpass in 1/s"
-cl_followmodel_side_highpass 5 "gun following sideways highpass in 1/s"
-cl_followmodel_side_lowpass 10 "gun following sideways lowpass in 1/s"
-cl_followmodel_up_speed 0.5 "gun following upward speed"
-cl_followmodel_up_limit 5 "gun following upward limit"
-cl_followmodel_up_highpass1 60 "gun following upward pre-highpass in 1/s"
-cl_followmodel_up_highpass 2 "gun following upward highpass in 1/s"
-cl_followmodel_up_lowpass 10 "gun following upward lowpass in 1/s"
+seta cl_followmodel_speed 0.3 "gun following speed"
+seta cl_followmodel_limit 1000 "gun following limit"
+seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)"
+seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time"
+seta cl_followmodel_highpass 0.05 "gun following highpass averaging time"
+seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time"
+
+cl_leanmodel 1 // enables weapon leaning effect when looking around
+seta cl_leanmodel_speed 0.3 "gun leaning speed"
+seta cl_leanmodel_limit 1000 "gun leaning limit"
+seta cl_leanmodel_highpass1 0.2 "gun leaning pre-highpass averaging time"
+seta cl_leanmodel_highpass 0.2 "gun leaning highpass averaging time"
+seta cl_leanmodel_lowpass 0.05 "gun leaning lowpass averaging time"
 
 cl_rollangle 0 // amount of view tilt when strafing, default is 2.0
 v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds
index 594e706f816163407b4e8e3324ca9963a4705f15..fd829833e283f41c4276b116966ec33f55116207 100644 (file)
Binary files a/models/weapons/g_campingrifle.md3 and b/models/weapons/g_campingrifle.md3 differ
index 6e21ba9f83a4d578b2b8454aacff8f9aeb3d6c73..2047627bf65db56cac69da5050a85deb20800edf 100644 (file)
Binary files a/models/weapons/g_hagar.md3 and b/models/weapons/g_hagar.md3 differ
index a51c6c4f5ed4238b772ffa4853ae24127aa9aeaf..fe87dac0304abecf381443d8a506c743948977a1 100644 (file)
Binary files a/models/weapons/h_hagar.iqm and b/models/weapons/h_hagar.iqm differ
index 0a59625b6a6aa297525c008a66ba879537a5ac08..e02cf0f641f77d9e1a8e8a2d937e87e8e2e9377a 100644 (file)
@@ -1,4 +1,9 @@
-1 8 20 0 // fire
-9 5 20 0 // fire2
-15 200 20 1 // idle
-215 40 20 0 // reload
+/*
+Generated framegroups file for h_hagar
+Used by DarkPlaces to simulate frame groups in DPM models.
+*/
+
+1 11 15 1 // h_hagar fire
+12 9 60 1 // h_hagar fire2
+21 51 5 1 // h_hagar idle
+72 21 30 1 // h_hagar reload
index 251e79f75cf7390d99a516981b7cf14de58fc58b..e9990ebc320bcd84302633c7db9f08a9bd757532 100644 (file)
Binary files a/models/weapons/v_campingrifle.md3 and b/models/weapons/v_campingrifle.md3 differ
index 19a245343322da6aa2dbfbb7de9b9a96c63264cf..f1f08b0108f984ae73ea0cb9e11bffa012e1dff6 100644 (file)
Binary files a/models/weapons/v_hagar.md3 and b/models/weapons/v_hagar.md3 differ
index dd8d96a5670fbd35ac9ddd0a7d6a10af5a497f12..894caec140649a58e163b7bc431af0bd93b40ee5 100644 (file)
@@ -182,6 +182,8 @@ set g_nades 0 "enable off-hand grenades"
 set g_nades_throw_offset "0 0 0" "nade throwing offset"
 set g_nades_spawn 1 "give nades right away when player spawns rather than delaying entire refire"
 set g_nades_client_select 0 "allow client side selection of nade type"
+set g_nades_pickup 1 "allow picking up thrown nades (not your own)"
+set g_nades_pickup_time 2 "time until picked up nade explodes"
 set g_nades_nade_lifetime 3.5
 set g_nades_nade_minforce 400
 set g_nades_nade_maxforce 2000
@@ -214,6 +216,7 @@ set g_nades_bonus_type 2 "Type of the bonus grenade. 1:normal 2:napalm 3:ice 4:t
 set g_nades_bonus_onstrength 1 "Always give bonus grenades to players that have the strength powerup"
 set g_nades_bonus_max 3 "Maximum number of bonus grenades"
 set g_nades_bonus_only 0 "Disallow regular nades, only bonus nades can be used"
+set g_nades_nade_small 0 "Use smaller nade size, makes shooting them harder, legacy setting"
 // Bonus score
 set g_nades_bonus_score_max   120 "Score value that will give a bonus nade"
 set g_nades_bonus_score_minor   5 "Score given for minor actions (pickups, regular frags etc.)"
index 9ca2a0ab5226f529c42af92c81777f13644c71f0..2ba78f798a1e45816a03043bbcafe2251fc3efe5 100644 (file)
@@ -1192,17 +1192,16 @@ void HUD_Panel_Mouse()
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
        }
        // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
-       const vector cursorsize = '32 32 0';
        float cursor_alpha = 1 - autocvar__menu_alpha;
 
        if(!mouse_over_panel)
-               drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+               draw_cursor_normal(mousepos, '1 1 1', cursor_alpha);
        else if(mouse_over_panel == 1)
-               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
        else if(mouse_over_panel == 2)
-               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha);
        else
-               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+               draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha);
 
        prevMouseClicked = mouseClicked;
 }
index 4ab16d05290edea6a7dd0f6885e4dbaf946a3c3a..4e4f90126a43f7e1326dce264ae4efa303707afc 100644 (file)
@@ -156,8 +156,7 @@ void HUD_Radar_Mouse()
        }
 
 
-       const vector cursor_size = '32 32 0';
-       drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursor_size, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+       draw_cursor_normal(mousepos, '1 1 1', 0.8);
 }
 
 void HUD_Radar()
index 7682198338308463520b72a815e03e4b8cd91b0d..aa490aa505c21e8c38fc46c52f0813da9b266ed8 100644 (file)
 
 #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
 
+void draw_cursor(vector pos, vector ofs, string img, vector col, float a)
+{
+       ofs = eX * (ofs.x * SIZE_CURSOR.x) + eY * (ofs.y * SIZE_CURSOR.y);
+       drawpic(pos - ofs, strcat(draw_currentSkin, img), SIZE_CURSOR, col, a, DRAWFLAG_NORMAL);
+}
+
+void draw_cursor_normal(vector pos, vector col, float a)
+{
+       draw_cursor(pos, OFFSET_CURSOR, "/cursor", col, a);
+}
+
+void LoadMenuSkinValues()
+{
+       int fh = -1;
+       if(cvar_string("menu_skin") != "")
+       {
+               draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+       }
+       if(fh < 0 && cvar_defstring("menu_skin") != "")
+       {
+               cvar_set("menu_skin", cvar_defstring("menu_skin"));
+               draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+       }
+       if(fh < 0)
+       {
+               draw_currentSkin = "gfx/menu/default";
+               fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+       }
+
+       draw_currentSkin = strzone(draw_currentSkin);
+
+       if(fh >= 0)
+       {
+               string s;
+               while((s = fgets(fh)))
+               {
+                       int n = tokenize_console(s);
+                       if (n < 2)
+                               continue;
+                       if(substring(argv(0), 0, 2) == "//")
+                               continue;
+                       if(argv(0) == "SIZE_CURSOR")
+                               SIZE_CURSOR = stov(substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+                       else if(argv(0) == "OFFSET_CURSOR")
+                               OFFSET_CURSOR = stov(substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+               }
+               fclose(fh);
+       }
+}
+
 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
 // Useful for precaching things
 
@@ -125,7 +177,7 @@ void CSQC_Init()
        }
 
        hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
-       draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));
+       LoadMenuSkinValues();
 }
 
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
index bed4daa268dc2a4afbe08995d70d7b3930913ca7..084dfba2f81ae92ca1a577c232b00353dedbf635 100644 (file)
@@ -40,6 +40,13 @@ float gametype;
 
 float FONT_USER = 8;
 
+
+vector OFFSET_CURSOR = '0 0 0';
+vector SIZE_CURSOR = '32 32 0';
+void draw_cursor(vector pos, vector ofs, string img, vector col, float a);
+void draw_cursor_normal(vector pos, vector col, float a);
+void LoadMenuSkinValues();
+
 // --------------------------------------------------------------------------
 // Scoreboard stuff
 
index 30c938aa33401debe100ee30941a2196ed04e22d..7071231651b2b69149bbbd2bf226abfe1df95496 100644 (file)
@@ -482,7 +482,7 @@ void MapVote_Draw()
                MapVote_DrawAbstain(pos, dist.x, xmax - xmin, tmp, i);
        }
 
-       drawpic(mv_mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), '32 32 0', '1 1 1', 1 - autocvar__menu_alpha, DRAWFLAG_NORMAL);
+       draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
 }
 
 void Cmd_MapVote_MapDownload(float argc)
index 90f6c171c88c621a3b7b72ad3631f62bec7c87e7..63416f2b017cf31cb35a1f58f37c9dc023c186cb 100644 (file)
@@ -531,8 +531,7 @@ void QuickMenu_Mouse()
                }
        }
 
-       vector cursorsize = '32 32 0';
-       drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+       draw_cursor_normal(mousepos, '1 1 1', 0.8);
 
        prevMouseClicked = mouseClicked;
 }
index 7288f253e768207f0376705948ba8b260d1509ed..debe7a5c1864bc312920bb8b2d8fb7619e955939 100644 (file)
@@ -39,33 +39,23 @@ float autocvar_cl_bobmodel_side;
 float autocvar_cl_bobmodel_up;
 
 float autocvar_cl_followmodel;
-float autocvar_cl_followmodel_side_speed;
-float autocvar_cl_followmodel_side_highpass;
-float autocvar_cl_followmodel_side_highpass1;
-float autocvar_cl_followmodel_side_limit;
-float autocvar_cl_followmodel_side_lowpass;
-float autocvar_cl_followmodel_up_speed;
-float autocvar_cl_followmodel_up_highpass;
-float autocvar_cl_followmodel_up_highpass1;
-float autocvar_cl_followmodel_up_limit;
-float autocvar_cl_followmodel_up_lowpass;
+float autocvar_cl_followmodel_speed = 0.3;
+float autocvar_cl_followmodel_limit = 1000;
+float autocvar_cl_followmodel_velocity_lowpass = 0.05;
+float autocvar_cl_followmodel_highpass = 0.05;
+float autocvar_cl_followmodel_lowpass = 0.03;
 
 float autocvar_cl_leanmodel;
-float autocvar_cl_leanmodel_side_speed;
-float autocvar_cl_leanmodel_side_highpass;
-float autocvar_cl_leanmodel_side_highpass1;
-float autocvar_cl_leanmodel_side_lowpass;
-float autocvar_cl_leanmodel_side_limit;
-float autocvar_cl_leanmodel_up_speed;
-float autocvar_cl_leanmodel_up_highpass;
-float autocvar_cl_leanmodel_up_highpass1;
-float autocvar_cl_leanmodel_up_lowpass;
-float autocvar_cl_leanmodel_up_limit;
+float autocvar_cl_leanmodel_speed = 0.3;
+float autocvar_cl_leanmodel_limit = 1000;
+float autocvar_cl_leanmodel_highpass1 = 0.2;
+float autocvar_cl_leanmodel_highpass = 0.2;
+float autocvar_cl_leanmodel_lowpass = 0.05;
 
+#define avg_factor(avg_time) (1 - exp(-frametime / max(0.001, avg_time)))
 #define lowpass(value, frac, ref_store, ret) MACRO_BEGIN \
 { \
-       float __frac = bound(0, frac, 1); \
-       ret = ref_store = ref_store * (1 - __frac) + (value) * __frac; \
+       ret = ref_store = ref_store * (1 - frac) + (value) * frac; \
 } MACRO_END
 
 #define lowpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
@@ -86,31 +76,63 @@ float autocvar_cl_leanmodel_up_limit;
        ret = (value) - __f; \
 } MACRO_END
 
-#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
+#define lowpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \
 { \
-       lowpass(value.x, fracx, ref_store.x, ref_out.x); \
-       lowpass(value.y, fracy, ref_store.y, ref_out.y); \
-       lowpass(value.z, fracz, ref_store.z, ref_out.z); \
+       lowpass(value.x, frac, ref_store.x, ref_out.x); \
+       lowpass(value.y, frac, ref_store.y, ref_out.y); \
 } MACRO_END
 
-#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
+#define lowpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \
 { \
-       highpass(value.x, fracx, ref_store.x, ref_out.x); \
-       highpass(value.y, fracy, ref_store.y, ref_out.y); \
-       highpass(value.z, fracz, ref_store.z, ref_out.z); \
+       lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \
+       lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \
 } MACRO_END
 
-#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) MACRO_BEGIN \
+#define highpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \
 { \
-       highpass_limited(value.x, fracx, limitx, ref_store.x, ref_out.x); \
-       highpass_limited(value.y, fracy, limity, ref_store.y, ref_out.y); \
-       highpass_limited(value.z, fracz, limitz, ref_store.z, ref_out.z); \
+       highpass(value.x, frac, ref_store.x, ref_out.x); \
+       highpass(value.y, frac, ref_store.y, ref_out.y); \
 } MACRO_END
 
+#define highpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \
+{ \
+       highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \
+       highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \
+} MACRO_END
+
+#define lowpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \
+{ \
+       lowpass(value.x, frac, ref_store.x, ref_out.x); \
+       lowpass(value.y, frac, ref_store.y, ref_out.y); \
+       lowpass(value.z, frac, ref_store.z, ref_out.z); \
+} MACRO_END
+
+#define highpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \
+{ \
+       highpass(value.x, frac, ref_store.x, ref_out.x); \
+       highpass(value.y, frac, ref_store.y, ref_out.y); \
+       highpass(value.z, frac, ref_store.z, ref_out.z); \
+} MACRO_END
+
+#define highpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \
+{ \
+       highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \
+       highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \
+       highpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \
+} MACRO_END
+
+#define lowpass3_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \
+{ \
+       lowpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \
+       lowpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \
+       lowpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \
+} MACRO_END
+
+bool autocvar_cl_followmodel_velocity_absolute;
 void viewmodel_animate(entity this)
 {
        static float prevtime;
-       float frametime = (time - prevtime) * STAT(MOVEVARS_TIMESCALE);
+       float frametime = (time - prevtime);
        prevtime = time;
 
        if (autocvar_chase_active) return;
@@ -131,84 +153,90 @@ void viewmodel_animate(entity this)
        }
        oldonground = clonground;
 
-       vector gunorg = '0 0 0', gunangles = '0 0 0';
-       static vector gunorg_prev = '0 0 0', gunangles_prev = '0 0 0';
 
        bool teleported = view.csqcmodel_teleported;
 
-       // 1. if we teleported, clear the frametime... the lowpass will recover the previous value then
-       if (teleported)
+       float frac;
+       if(autocvar_cl_followmodel)
        {
-               // try to fix the first highpass; result is NOT
-               // perfect! TODO find a better fix
+               vector gunorg = '0 0 0';
+               static vector vel_average;
+               static vector gunorg_prev = '0 0 0';
+               static vector gunorg_adjustment_highpass;
+               static vector gunorg_adjustment_lowpass;
+
+               vector vel;
+               if(autocvar_cl_followmodel_velocity_absolute)
+                       vel = view.velocity;
+               else
+               {
+                       vector forward, right = '0 0 0', up = '0 0 0';
+                       MAKEVECTORS(makevectors, view_angles, forward, right, up);
+                       vel.x = view.velocity * forward;
+                       vel.y = view.velocity * right * -1;
+                       vel.z = view.velocity * up;
+               }
+
+               frac = avg_factor(autocvar_cl_followmodel_velocity_lowpass);
+               lowpass3_limited(vel, frac, autocvar_cl_followmodel_limit, vel_average, gunorg);
+
+               gunorg *= -autocvar_cl_followmodel_speed * 0.042;
+
+               // perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!)
+               // trick: we must do the lowpass LAST, so the lowpass vector IS the final vector!
+               frac = avg_factor(autocvar_cl_followmodel_highpass);
+               highpass3(gunorg, frac, gunorg_adjustment_highpass, gunorg);
+               frac = avg_factor(autocvar_cl_followmodel_lowpass);
+               lowpass3(gunorg, frac, gunorg_adjustment_lowpass, gunorg);
+
+               if(autocvar_cl_followmodel_velocity_absolute)
+               {
+                       vector fixed_gunorg;
+                       vector forward, right = '0 0 0', up = '0 0 0';
+                       MAKEVECTORS(makevectors, view_angles, forward, right, up);
+                       fixed_gunorg.x = gunorg * forward;
+                       fixed_gunorg.y = gunorg * right * -1;
+                       fixed_gunorg.z = gunorg * up;
+                       gunorg = fixed_gunorg;
+               }
+
+               this.origin += gunorg;
+       }
+
+       if(autocvar_cl_leanmodel)
+       {
+               vector gunangles = '0 0 0';
+               static vector gunangles_prev = '0 0 0';
+               static vector gunangles_highpass = '0 0 0';
+               static vector gunangles_adjustment_highpass;
+               static vector gunangles_adjustment_lowpass;
+
+               if (teleported)
+                       gunangles_prev = view_angles;
+
+               // in the highpass, we _store_ the DIFFERENCE to the actual view angles...
+               gunangles_highpass += gunangles_prev;
+               PITCH(gunangles_highpass) += 360 * floor((PITCH(view_angles) - PITCH(gunangles_highpass)) / 360 + 0.5);
+               YAW(gunangles_highpass) += 360 * floor((YAW(view_angles) - YAW(gunangles_highpass)) / 360 + 0.5);
+               ROLL(gunangles_highpass) += 360 * floor((ROLL(view_angles) - ROLL(gunangles_highpass)) / 360 + 0.5);
+               frac = avg_factor(autocvar_cl_leanmodel_highpass1);
+               highpass2_limited(view_angles, frac, autocvar_cl_leanmodel_limit, gunangles_highpass, gunangles);
                gunangles_prev = view_angles;
-               gunorg_prev = view_origin;
-       }
-
-       static vector gunorg_highpass = '0 0 0';
-
-       // 2. for the gun origin, only keep the high frequency (non-DC) parts, which is "somewhat like velocity"
-       gunorg_highpass += gunorg_prev;
-       highpass3_limited(view_origin,
-               frametime * autocvar_cl_followmodel_side_highpass1, autocvar_cl_followmodel_side_limit,
-               frametime * autocvar_cl_followmodel_side_highpass1, autocvar_cl_followmodel_side_limit,
-               frametime * autocvar_cl_followmodel_up_highpass1, autocvar_cl_followmodel_up_limit,
-               gunorg_highpass, gunorg);
-       gunorg_prev = view_origin;
-       gunorg_highpass -= gunorg_prev;
-
-       static vector gunangles_highpass = '0 0 0';
-
-       // in the highpass, we _store_ the DIFFERENCE to the actual view angles...
-       gunangles_highpass += gunangles_prev;
-       PITCH(gunangles_highpass) += 360 * floor((PITCH(view_angles) - PITCH(gunangles_highpass)) / 360 + 0.5);
-       YAW(gunangles_highpass) += 360 * floor((YAW(view_angles) - YAW(gunangles_highpass)) / 360 + 0.5);
-       ROLL(gunangles_highpass) += 360 * floor((ROLL(view_angles) - ROLL(gunangles_highpass)) / 360 + 0.5);
-       highpass3_limited(view_angles,
-               frametime * autocvar_cl_leanmodel_up_highpass1, autocvar_cl_leanmodel_up_limit,
-               frametime * autocvar_cl_leanmodel_side_highpass1, autocvar_cl_leanmodel_side_limit,
-               0, 0,
-               gunangles_highpass, gunangles);
-       gunangles_prev = view_angles;
-       gunangles_highpass -= gunangles_prev;
-
-       // 3. calculate the RAW adjustment vectors
-       gunorg.x *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_side_speed : 0);
-       gunorg.y *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_side_speed : 0);
-       gunorg.z *= (autocvar_cl_followmodel ? -autocvar_cl_followmodel_up_speed : 0);
-
-       PITCH(gunangles) *= (autocvar_cl_leanmodel ? -autocvar_cl_leanmodel_up_speed : 0);
-       YAW(gunangles) *= (autocvar_cl_leanmodel ? -autocvar_cl_leanmodel_side_speed : 0);
-       ROLL(gunangles) = 0;
-
-       static vector gunorg_adjustment_highpass;
-       static vector gunorg_adjustment_lowpass;
-       static vector gunangles_adjustment_highpass;
-       static vector gunangles_adjustment_lowpass;
-
-       // 4. perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!)
-       //    trick: we must do the lowpass LAST, so the lowpass vector IS the final vector!
-       highpass3(gunorg,
-               frametime * autocvar_cl_followmodel_side_highpass,
-               frametime * autocvar_cl_followmodel_side_highpass,
-               frametime * autocvar_cl_followmodel_up_highpass,
-               gunorg_adjustment_highpass, gunorg);
-       lowpass3(gunorg,
-               frametime * autocvar_cl_followmodel_side_lowpass,
-               frametime * autocvar_cl_followmodel_side_lowpass,
-               frametime * autocvar_cl_followmodel_up_lowpass,
-               gunorg_adjustment_lowpass, gunorg);
-       // we assume here: PITCH = 0, YAW = 1, ROLL = 2
-       highpass3(gunangles,
-               frametime * autocvar_cl_leanmodel_up_highpass,
-               frametime * autocvar_cl_leanmodel_side_highpass,
-               0,
-               gunangles_adjustment_highpass, gunangles);
-       lowpass3(gunangles,
-               frametime * autocvar_cl_leanmodel_up_lowpass,
-               frametime * autocvar_cl_leanmodel_side_lowpass,
-               0,
-               gunangles_adjustment_lowpass, gunangles);
+               gunangles_highpass -= gunangles_prev;
+
+               PITCH(gunangles) *= -autocvar_cl_leanmodel_speed;
+               YAW(gunangles) *= -autocvar_cl_leanmodel_speed;
+
+               // we assume here: PITCH = 0, YAW = 1, ROLL = 2
+               frac = avg_factor(autocvar_cl_leanmodel_highpass);
+               highpass2(gunangles, frac, gunangles_adjustment_highpass, gunangles);
+               frac = avg_factor(autocvar_cl_leanmodel_lowpass);
+               lowpass2(gunangles, frac, gunangles_adjustment_lowpass, gunangles);
+
+               gunangles.x = -gunangles.x; // pitch was inverted, now that actually matters
+               this.angles += gunangles;
+       }
+
        float xyspeed = bound(0, vlen(vec2(view.velocity)), 400);
 
        // vertical view bobbing code
@@ -229,7 +257,6 @@ void viewmodel_animate(entity this)
                // Sajt: I tried to smooth out the transitions between bob and no bob, which works
                // for the most part, but for some reason when you go through a message trigger or
                // pick up an item or anything like that it will momentarily jolt the gun.
-               vector forward, right = '0 0 0', up = '0 0 0';
                float bspeed;
                float t = 1;
                float s = time * autocvar_cl_bobmodel_speed;
@@ -251,17 +278,12 @@ void viewmodel_animate(entity this)
                        t *= 5;
                }
                bspeed = xyspeed * 0.01;
-               MAKEVECTORS(makevectors, view_angles, forward, right, up);
-               float bobr = bspeed * autocvar_cl_bobmodel_side * autocvar_cl_viewmodel_scale * sin(s) * t;
-               gunorg += bobr * right;
-               float bobu = bspeed * autocvar_cl_bobmodel_up * autocvar_cl_viewmodel_scale * cos(s * 2) * t;
-               gunorg += bobu * up;
-       }
-       vector v = rotate(gunorg, YAW(view_angles) * DEG2RAD); // rotate world coordinates to relative ones
-       v.z = gunorg.z;
-       this.origin += v;
-       gunangles.x = -gunangles.x; // pitch was inverted, now that actually matters
-       this.angles += gunangles;
+               vector gunorg = '0 0 0';
+               gunorg.y += bspeed * autocvar_cl_bobmodel_side * autocvar_cl_viewmodel_scale * sin(s) * t;
+               gunorg.z += bspeed * autocvar_cl_bobmodel_up * autocvar_cl_viewmodel_scale * cos(s * 2) * t;
+
+               this.origin += gunorg;
+       }
 }
 
 .vector viewmodel_origin, viewmodel_angles;
@@ -271,6 +293,8 @@ void viewmodel_animate(entity this)
 
 void viewmodel_draw(entity this)
 {
+       if(!activeweapon)
+               return;
        int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
        float a = this.alpha;
        static bool wasinvehicle;
@@ -341,7 +365,6 @@ entity viewmodel;
 STATIC_INIT(viewmodel) {
     viewmodel = new(viewmodel);
     make_pure(viewmodel);
-       viewmodel.draw = viewmodel_draw;
 }
 
 entity porto;
@@ -1658,6 +1681,10 @@ void CSQC_UpdateView(float w, float h)
                ov_enabled = false;
        }
 
+       // run viewmodel_draw before updating view_angles to the angles calculated by WarpZone_FixView
+       // viewmodel_draw needs to use the view_angles set by the engine on every CSQC_UpdateView call
+       viewmodel_draw(viewmodel);
+
        // Render the Scene
        view_origin = getpropertyvec(VF_ORIGIN);
        view_angles = getpropertyvec(VF_ANGLES);
index ff67a72cdc21a0c5cf398a16de87918200ea64df..dbadc9abbd6eabe1ff1a5bbd8539bd0d247577a5 100644 (file)
        { vector v = '0 0 0'; v.y = ReadByte() / 256 * 360; this.angles = v; }) \
     \
        PROP(false, health, \
-       { WriteByte(chan, this.health / 10);  /* FIXME: use a better scale? */ }, \
+       { WriteByte(chan, bound(0, this.health / 10, 255));  /* FIXME: use a better scale? */ }, \
        { this.healthvalue = ReadByte() * 10; }) \
     \
        PROP(false, armorvalue, \
-       { WriteByte(chan, this.armorvalue / 10);  /* FIXME: use a better scale? */ }, \
+       { WriteByte(chan, bound(0, this.armorvalue / 10, 255));  /* FIXME: use a better scale? */ }, \
        { this.armorvalue = ReadByte() * 10; }) \
     \
        PROP(true, netname, \
index 006a36308f347c396388c08b453fe8269f1cb90a..7ccbe8fa3fdbf622290ed3864b538cae91fe2f1b 100644 (file)
@@ -1,6 +1,5 @@
 #ifdef SVQC
     #include <common/t_items.qh>
-    #include <server/constants.qh>
 #endif
 
 #include "ammo.qh"
@@ -46,7 +45,7 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
 MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3"));
 #endif
 
-REGISTER_ITEM(JetpackRegen, Pickup) {
+REGISTER_ITEM(JetpackRegen, Powerup) {
 #ifndef MENUQC
     this.m_model                =   MDL_JetpackRegen_ITEM;
 #endif
@@ -57,10 +56,7 @@ REGISTER_ITEM(JetpackRegen, Pickup) {
     this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
-    this.m_itemflags            =   FL_POWERUP;
     this.m_itemid               =   IT_FUEL_REGEN;
     this.m_pickupevalfunc       =   commodity_pickupevalfunc;
-    this.m_respawntime          =   GET(g_pickup_respawntime_powerup);
-    this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_powerup);
 #endif
 }
index e93c95ca6077bed5935373c47bf0e1426f4c3315..8b4f9234d04dcf216a3dc35e4c9ea9ebca0e0f42 100644 (file)
@@ -685,9 +685,7 @@ void HUD_Minigame_Mouse()
        if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) )
                HUD_MinigameMenu_MouseInput();
 
-       vector cursorsize = '32 32 0';
-       drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"),
-                       cursorsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       draw_cursor_normal(mousepos, '1 1 1', panel_fg_alpha);
 }
 
 bool HUD_Minigame_Showpanels()
index 9b32642a491a8f065ba9332d702cadf4312b7e99..903237f92b1fd6c86d6216b7667b4d1ece3bf770 100644 (file)
@@ -598,7 +598,6 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
        // this... is ridiculous (TODO: fix!)
        if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid)
        if(!frag_target.vehicle)
-       if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
        if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
        if(!IS_DEAD(frag_target))
        if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target))
index 3d91189e2569f094fb5777162e285c3b0690ed2e..408bd6fc853b2aff6411efba26ea27c1bef243e2 100644 (file)
@@ -68,7 +68,6 @@ bool Item_ItemsTime_Allow(GameItem it)
     return (false
     || it.instanceOfPowerup
     || Item_ItemsTime_SpectatorOnly(it)
-    || it == ITEM_JetpackRegen
     );
 }
 
index fcfce9ab77fb5f686013e9d162b874ec618c10ae..720a8f0e80ee8618744a1eb7bd7e90aaec03426c 100644 (file)
@@ -2,6 +2,12 @@
 
 #ifdef IMPLEMENTATION
 
+#ifdef SVQC
+bool autocvar_g_nades_nade_small;
+#endif
+
+REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small)
+
 #ifndef MENUQC
 entity Nade_TrailEffect(int proj, int nade_team)
 {
@@ -63,8 +69,16 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
 
        entity nade_type = Nade_FromProjectile(self.cnt);
        if (nade_type == NADE_TYPE_Null) return;
-       self.mins = '-16 -16 -16';
-       self.maxs = '16 16 16';
+       if(STAT(NADES_SMALL, NULL))
+       {
+               self.mins = '-8 -8 -8';
+               self.maxs = '8 8 8';
+       }
+       else
+       {
+               self.mins = '-16 -16 -16';
+               self.maxs = '16 16 16';
+       }
        self.colormod = nade_type.m_color;
        self.move_movetype = MOVETYPE_BOUNCE;
        self.move_touch = func_null;
@@ -657,6 +671,20 @@ void nade_boom()
        remove(self);
 }
 
+void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype);
+void nade_pickup(entity this, entity thenade)
+{
+       spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, thenade.nade_type, thenade.pokenade_type);
+
+       // set refire so player can't even
+       this.nade_refire = time + autocvar_g_nades_nade_refire;
+       this.nade_timer = 0;
+
+       if(this.nade)
+               this.nade.nade_time_primed = thenade.nade_time_primed;
+}
+
+bool CanThrowNade(entity this);
 void nade_touch()
 {SELFPARAM();
        if(other)
@@ -664,6 +692,18 @@ void nade_touch()
 
        if(other == self.realowner)
                return; // no self impacts
+
+       if(autocvar_g_nades_pickup)
+       if(time >= self.spawnshieldtime)
+       if(!other.nade && self.health == self.max_health) // no boosted shot pickups, thank you very much
+       if(CanThrowNade(other)) // prevent some obvious things, like dead players
+       if(IS_REAL_CLIENT(other)) // above checks for IS_PLAYER, don't need to do it here
+       {
+               nade_pickup(other, self);
+               sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
+               remove(self);
+               return;
+       }
        /*float is_weapclip = 0;
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
        if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
@@ -766,7 +806,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
                nade_burn_spawn(this);
 }
 
-void toss_nade(entity e, vector _velocity, float _time)
+void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 {SELFPARAM();
        if(e.nade == world)
                return;
@@ -793,7 +833,10 @@ void toss_nade(entity e, vector _velocity, float _time)
        //setmodel(_nade, MDL_PROJECTILE_NADE);
        //setattachment(_nade, world, "");
        PROJECTILE_MAKETRIGGER(_nade);
-       setsize(_nade, '-16 -16 -16', '16 16 16');
+       if(STAT(NADES_SMALL, e))
+               setsize(_nade, '-8 -8 -8', '8 8 8');
+       else
+               setsize(_nade, '-16 -16 -16', '16 16 16');
        _nade.movetype = MOVETYPE_BOUNCE;
 
        tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, false, _nade);
@@ -809,7 +852,11 @@ void toss_nade(entity e, vector _velocity, float _time)
        else
                _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
 
+       if(set_owner)
+               _nade.realowner = e;
+
        _nade.touch = nade_touch;
+       _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
        _nade.health = autocvar_g_nades_nade_health;
        _nade.max_health = _nade.health;
        _nade.takedamage = DAMAGE_AIM;
@@ -881,7 +928,7 @@ MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
 float nade_customize()
 {SELFPARAM();
        //if(IS_SPEC(other)) { return false; }
-       if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner))
+       if(other == self.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == self.exteriormodeltoclient))
        {
                // somewhat hide the model, but keep the glow
                //self.effects = 0;
@@ -900,6 +947,42 @@ float nade_customize()
        return true;
 }
 
+void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype)
+{
+       entity n = new(nade), fn = new(fake_nade);
+
+       n.nade_type = bound(1, ntype, Nades_COUNT);
+       n.pokenade_type = pntype;
+
+       setmodel(n, MDL_PROJECTILE_NADE);
+       //setattachment(n, player, "bip01 l hand");
+       n.exteriormodeltoclient = player;
+       n.customizeentityforclient = nade_customize;
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
+       n.colormod = Nades_from(n.nade_type).m_color;
+       n.realowner = nowner;
+       n.colormap = player.colormap;
+       n.glowmod = player.glowmod;
+       n.wait = time + max(0, ntime);
+       n.nade_time_primed = time;
+       n.think = nade_beep;
+       n.nextthink = max(n.wait - 3, time);
+       n.projectiledeathtype = DEATH_NADE.m_id;
+
+       setmodel(fn, MDL_NADE_VIEW);
+       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+       setattachment(fn, player.(weaponentity), "");
+       fn.realowner = fn.owner = player;
+       fn.colormod = Nades_from(n.nade_type).m_color;
+       fn.colormap = player.colormap;
+       fn.glowmod = player.glowmod;
+       fn.think = SUB_Remove_self;
+       fn.nextthink = n.wait;
+
+       player.nade = n;
+       player.fake_nade = fn;
+}
+
 void nade_prime()
 {SELFPARAM();
        if(autocvar_g_nades_bonus_only)
@@ -912,71 +995,44 @@ void nade_prime()
        if(self.fake_nade)
                remove(self.fake_nade);
 
-       entity n = new(nade), fn = new(fake_nade);
+       int ntype;
+       string pntype = self.pokenade_type;
 
        if(self.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
-               n.nade_type = self.nade_type;
+               ntype = self.nade_type;
        else if (self.bonus_nades >= 1)
        {
-               n.nade_type = self.nade_type;
-               n.pokenade_type = self.pokenade_type;
+               ntype = self.nade_type;
+               pntype = self.pokenade_type;
                self.bonus_nades -= 1;
        }
        else
        {
-               n.nade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type);
-               n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
+               ntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type);
+               pntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
-       n.nade_type = bound(1, n.nade_type, Nades_COUNT);
-
-       setmodel(n, MDL_PROJECTILE_NADE);
-       //setattachment(n, self, "bip01 l hand");
-       n.exteriormodeltoclient = self;
-       n.customizeentityforclient = nade_customize;
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], self.team).eent_eff_name);
-       n.colormod = Nades_from(n.nade_type).m_color;
-       n.realowner = self;
-       n.colormap = self.colormap;
-       n.glowmod = self.glowmod;
-       n.wait = time + autocvar_g_nades_nade_lifetime;
-       n.nade_time_primed = time;
-       n.think = nade_beep;
-       n.nextthink = max(n.wait - 3, time);
-       n.projectiledeathtype = DEATH_NADE.m_id;
-
-       setmodel(fn, MDL_NADE_VIEW);
-       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-       setattachment(fn, self.(weaponentity), "");
-       fn.realowner = fn.owner = self;
-       fn.colormod = Nades_from(n.nade_type).m_color;
-       fn.colormap = self.colormap;
-       fn.glowmod = self.glowmod;
-       fn.think = SUB_Remove_self;
-       fn.nextthink = n.wait;
-
-       self.nade = n;
-       self.fake_nade = fn;
+       spawn_held_nade(self, self, autocvar_g_nades_nade_lifetime, ntype, pntype);
 }
 
-float CanThrowNade()
-{SELFPARAM();
-       if(self.vehicle)
+bool CanThrowNade(entity this)
+{
+       if(this.vehicle)
                return false;
 
        if(gameover)
                return false;
 
-       if(IS_DEAD(self))
+       if(IS_DEAD(this))
                return false;
 
        if (!autocvar_g_nades)
                return false; // allow turning them off mid match
 
-       if(forbidWeaponUse(self))
+       if(forbidWeaponUse(this))
                return false;
 
-       if (!IS_PLAYER(self))
+       if (!IS_PLAYER(this))
                return false;
 
        return true;
@@ -986,7 +1042,7 @@ float CanThrowNade()
 
 void nades_CheckThrow()
 {SELFPARAM();
-       if(!CanThrowNade())
+       if(!CanThrowNade(self))
                return;
 
        entity held_nade = self.nade;
@@ -1008,7 +1064,7 @@ void nades_CheckThrow()
                        float _force = time - held_nade.nade_time_primed;
                        _force /= autocvar_g_nades_nade_lifetime;
                        _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
-                       toss_nade(self, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
+                       toss_nade(self, true, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
                }
        }
 }
@@ -1027,7 +1083,7 @@ void nades_Clear(entity player)
 MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
 {
        if(vh_player.nade)
-               toss_nade(vh_player, '0 0 100', max(vh_player.nade.wait, time + 0.05));
+               toss_nade(vh_player, true, '0 0 100', max(vh_player.nade.wait, time + 0.05));
 
        return false;
 }
@@ -1046,10 +1102,10 @@ CLASS(NadeOffhand, OffhandWeapon)
                        held_nade.angles_y = player.angles.y;
 
                        if (time + 0.1 >= held_nade.wait)
-                               toss_nade(player, '0 0 0', time + 0.05);
+                               toss_nade(player, false, '0 0 0', time + 0.05);
                }
 
-        if (!CanThrowNade()) return;
+        if (!CanThrowNade(player)) return;
         if (!(time > player.nade_refire)) return;
                if (key_pressed) {
                        if (!held_nade) {
@@ -1062,7 +1118,7 @@ CLASS(NadeOffhand, OffhandWeapon)
                                float _force = time - held_nade.nade_time_primed;
                                _force /= autocvar_g_nades_nade_lifetime;
                                _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
-                               toss_nade(player, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
+                               toss_nade(player, false, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
                        }
                }
     }
@@ -1201,7 +1257,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
 {
        if(frag_target.nade)
        if(!STAT(FROZEN, frag_target) || !autocvar_g_freezetag_revive_nade)
-               toss_nade(frag_target, '0 0 100', max(frag_target.nade.wait, time + 0.05));
+               toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05));
 
        float killcount_bonus = ((frag_attacker.killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * frag_attacker.killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
 
@@ -1264,7 +1320,7 @@ MUTATOR_HOOKFUNCTION(nades, MonsterDies)
 MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
 {
        if(frag_target.nade)
-               toss_nade(frag_target, '0 0 0', time + 0.05);
+               toss_nade(frag_target, true, '0 0 0', time + 0.05);
 
        return false;
 }
index 0bb3ac1742e0e0991f9f90b5694fb17ef7b4b0ae..7003dfd7f1dd1a74176eace324b6ecf3317feed2 100644 (file)
@@ -1529,7 +1529,7 @@ spawnfunc(target_items)
                if(self.ammo_plasma != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_plasma), "plasma");
                if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel");
                if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health");
-               if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "armor");
+               if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor");
                FOREACH(Weapons, it != WEP_Null, LAMBDA(self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname)));
        }
        self.netname = strzone(self.netname);
index d531b8c3f29759f1c8a9c77e922c0199dc96c26c..6232db886e7a810c8f72b403803fb5c202563e77 100644 (file)
@@ -432,6 +432,7 @@ void CL_WeaponEntity_SetModel(entity this, string name)
 #endif
                        }
                        _setmodel(this.weaponchild, W_Model(strcat("v_", name, ".md3")));
+                       setsize(this.weaponchild, '0 0 0', '0 0 0');
                        setattachment(this.weaponchild, this, t);
                }
                else
@@ -440,6 +441,7 @@ void CL_WeaponEntity_SetModel(entity this, string name)
                        this.weaponchild = NULL;
                }
 
+               setsize(this, '0 0 0', '0 0 0');
                setorigin(this, '0 0 0');
                this.angles = '0 0 0';
                this.frame = 0;
index 303c5a25606ce69a669481f47e296b4336d56204..1d3ea78a5bf41c0ae8fa091f87aa9467674259ca 100644 (file)
@@ -328,6 +328,8 @@ void W_Arc_Beam_Think()
                ||
                IS_DEAD(self.owner)
                ||
+               gameover
+               ||
                (!self.owner.BUTTON_ATCK && !burst )
                ||
                STAT(FROZEN, self.owner)
index 307b4bd081c6f35cbbfe75eb87925bdd0f44ac2c..9aaf524493719d0171363d086cfd29db0944bf05 100644 (file)
@@ -49,6 +49,7 @@
 #include "linkedlist.qh"
 #include "log.qh"
 #include "map.qh"
+#include "markdown.qh"
 #include "math.qh"
 #include "misc.qh"
 #include "net.qh"
diff --git a/qcsrc/lib/markdown.qh b/qcsrc/lib/markdown.qh
new file mode 100644 (file)
index 0000000..63a4182
--- /dev/null
@@ -0,0 +1,65 @@
+#include "test.qh"
+
+/**
+ * handle string spacing as markdown:
+ *   - two spaces escape a linebreak (otherwise text wraps)
+ *   - two linebreaks become a paragraph (remain unchanged)
+ */
+string markdown(string s)
+{
+       string buf = "";
+       int lines = 0;
+       int spaces = 0;
+       FOREACH_CHAR(s, true, {
+               switch (it) {
+                       default:
+                               for (; spaces > 0; --spaces) {
+                                       buf = strcat(buf, " ");
+                               }
+                               buf = strcat(buf, chr2str(it));
+                               break;
+                       case ' ':
+                               spaces += 1;
+                               break;
+                       case '\n':
+                               lines += 1;
+                               if (lines > 1) {
+                                       lines = 0;
+                                       spaces = 0;
+                                       buf = strcat(buf, "\n\n");
+                                       break;
+                               }
+                               if (spaces < 2) {
+                                       spaces = 1;
+                               } else {
+                                       spaces = 0;
+                                       buf = strcat(buf, "\n");
+                               }
+                               break;
+               }
+       });
+       return buf;
+}
+
+TEST(Markdown, LineWrap)
+{
+       #define X(expect, in) MACRO_BEGIN \
+               string out = markdown(in); \
+               EXPECT_TRUE(expect == out); \
+               LOG_INFO(expect); \
+               LOG_INFO(out); \
+       MACRO_END
+
+       // identity
+       X("lorem ipsum", "lorem ipsum");
+       // trim trailing space
+       X("lorem ipsum", "lorem ipsum ");
+       // allow manual input wrapping
+       X("lorem ipsum", "lorem\nipsum");
+       // line break
+       X("lorem\nipsum", "lorem  \nipsum");
+       // paragraph
+       X("lorem\n\nipsum", "lorem\n\nipsum");
+       SUCCEED();
+       #undef X
+}
index 3c4e4c43fbc442e0d502e3d065a5fe8cd1714b8d..654bd2bc936efffaea6c0df1b8c0f1f6d72961ab 100644 (file)
@@ -465,6 +465,8 @@ vector autocvar_g_nades_throw_offset;
 bool autocvar_g_nades_spawn;
 int autocvar_g_nades_spawn_count;
 bool autocvar_g_nades_client_select;
+bool autocvar_g_nades_pickup = true;
+float autocvar_g_nades_pickup_time = 2;
 float autocvar_g_nades_nade_lifetime;
 float autocvar_g_nades_nade_minforce;
 float autocvar_g_nades_nade_maxforce;
index 9bd602426614ee8107ddf49517e4afc68fa4336d..2a3ef873413981b40c56f0fd8a4b205a91526f61 100644 (file)
@@ -1114,6 +1114,10 @@ void URI_Get_Callback(float id, float status, string data)
                // online ban list
                OnlineBanList_URI_Get_Callback(id, status, data);
        }
+       else if (MUTATOR_CALLHOOK(URI_GetCallback, id, status, data))
+       {
+               // handled by a mutator
+       }
        else
        {
                LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".\n");
index 00d2716e4b6e287b5bdb2ffd9d2f0555fb203460..d81b2b1a5b630c62d0edb78e5c1dd94a6cf6a418 100644 (file)
@@ -846,4 +846,15 @@ MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
 float pct_curteam;
 float pct_newteam;
 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
+
+/**/
+#define EV_URI_GetCallback(i, o) \
+    /**/ i(float, uricb_id) \
+    /**/ i(float, uricb_status) \
+    /**/ i(string, uricb_data) \
+    /**/
+float uricb_id;
+float uricb_status;
+string uricb_data;
+MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
 #endif
index 4972d818f3a8db4be0c27a0076cef39d2f11f509..1637d867663333b6fef51d276e69ba532ef54e0d 100644 (file)
@@ -126,7 +126,11 @@ void CL_ExteriorWeaponentity_Think()
                this.weaponname = this.owner.weaponname;
                this.dmg = this.owner.modelindex;
                this.deadflag = this.owner.deadflag;
-               if (this.owner.weaponname != "") _setmodel(this, W_Model(strcat("v_", this.owner.weaponname, ".md3")));
+               if (this.owner.weaponname != "")
+               {
+                       _setmodel(this, W_Model(strcat("v_", this.owner.weaponname, ".md3")));
+                       setsize(this, '0 0 0', '0 0 0');
+               }
                else this.model = "";
 
                int tag_found;
index c5c673fbff9c6ad627a3b746f1c28c5c14bfcb59..bef31839299fda9518ad081b2e51b2d06af7c29a 100644 (file)
@@ -31,11 +31,11 @@ glauncher
                rgbgen lightingDiffuse
        }
 }
-hagar2
+hagar
 {
        dpreflectcube cubemaps/default/sky
        {
-               map textures/hagar2.tga
+               map textures/hagar.tga
                rgbgen lightingDiffuse
        }
 }
@@ -111,3 +111,11 @@ shotgun
                rgbgen lightingDiffuse
        }
 }
+SniperRifle
+{
+       dpreflectcube cubemaps/default/sky
+       {
+               map textures/sniperrifle.tga
+               rgbgen lightingDiffuse
+       }
+}
diff --git a/textures/campingrifle.tga b/textures/campingrifle.tga
deleted file mode 100644 (file)
index 6189b51..0000000
Binary files a/textures/campingrifle.tga and /dev/null differ
diff --git a/textures/campingrifle_bump.tga b/textures/campingrifle_bump.tga
deleted file mode 100644 (file)
index 28bd453..0000000
Binary files a/textures/campingrifle_bump.tga and /dev/null differ
diff --git a/textures/campingrifle_gloss.tga b/textures/campingrifle_gloss.tga
deleted file mode 100644 (file)
index 7f4b032..0000000
Binary files a/textures/campingrifle_gloss.tga and /dev/null differ
diff --git a/textures/campingrifle_glow.tga b/textures/campingrifle_glow.tga
deleted file mode 100644 (file)
index f425329..0000000
Binary files a/textures/campingrifle_glow.tga and /dev/null differ
diff --git a/textures/campingrifle_screen.tga b/textures/campingrifle_screen.tga
deleted file mode 100644 (file)
index 5ffda6f..0000000
Binary files a/textures/campingrifle_screen.tga and /dev/null differ
diff --git a/textures/hagar.tga b/textures/hagar.tga
new file mode 100644 (file)
index 0000000..1e2d5cf
Binary files /dev/null and b/textures/hagar.tga differ
diff --git a/textures/hagar2.tga b/textures/hagar2.tga
deleted file mode 100644 (file)
index f05fef9..0000000
Binary files a/textures/hagar2.tga and /dev/null differ
diff --git a/textures/hagar2_gloss.tga b/textures/hagar2_gloss.tga
deleted file mode 100644 (file)
index f4f597a..0000000
Binary files a/textures/hagar2_gloss.tga and /dev/null differ
diff --git a/textures/hagar2_glow.tga b/textures/hagar2_glow.tga
deleted file mode 100644 (file)
index cd4b353..0000000
Binary files a/textures/hagar2_glow.tga and /dev/null differ
diff --git a/textures/hagar2_norm.tga b/textures/hagar2_norm.tga
deleted file mode 100644 (file)
index 145509d..0000000
Binary files a/textures/hagar2_norm.tga and /dev/null differ
diff --git a/textures/hagar2_reflect.tga b/textures/hagar2_reflect.tga
deleted file mode 100644 (file)
index 1381edc..0000000
Binary files a/textures/hagar2_reflect.tga and /dev/null differ
diff --git a/textures/hagar2_shirt.tga b/textures/hagar2_shirt.tga
deleted file mode 100644 (file)
index 4527f7e..0000000
Binary files a/textures/hagar2_shirt.tga and /dev/null differ
diff --git a/textures/hagar_glow.tga b/textures/hagar_glow.tga
new file mode 100644 (file)
index 0000000..e1d9548
Binary files /dev/null and b/textures/hagar_glow.tga differ
diff --git a/textures/hagar_norm.tga b/textures/hagar_norm.tga
new file mode 100644 (file)
index 0000000..b758791
Binary files /dev/null and b/textures/hagar_norm.tga differ
diff --git a/textures/hagar_reflect.tga b/textures/hagar_reflect.tga
new file mode 100644 (file)
index 0000000..f784c2d
Binary files /dev/null and b/textures/hagar_reflect.tga differ
diff --git a/textures/hagar_shirt.tga b/textures/hagar_shirt.tga
new file mode 100644 (file)
index 0000000..270d446
Binary files /dev/null and b/textures/hagar_shirt.tga differ
diff --git a/textures/hagar_spec.tga b/textures/hagar_spec.tga
new file mode 100644 (file)
index 0000000..e44d88b
Binary files /dev/null and b/textures/hagar_spec.tga differ
diff --git a/textures/sniperrifle.tga b/textures/sniperrifle.tga
new file mode 100644 (file)
index 0000000..0448be7
Binary files /dev/null and b/textures/sniperrifle.tga differ
diff --git a/textures/sniperrifle_bump.tga b/textures/sniperrifle_bump.tga
new file mode 100644 (file)
index 0000000..2496bcb
Binary files /dev/null and b/textures/sniperrifle_bump.tga differ
diff --git a/textures/sniperrifle_glow.tga b/textures/sniperrifle_glow.tga
new file mode 100644 (file)
index 0000000..7767713
Binary files /dev/null and b/textures/sniperrifle_glow.tga differ
diff --git a/textures/sniperrifle_reflect.tga b/textures/sniperrifle_reflect.tga
new file mode 100644 (file)
index 0000000..ecd89a9
Binary files /dev/null and b/textures/sniperrifle_reflect.tga differ