From: Mario Date: Sun, 2 Aug 2015 04:20:22 +0000 (+1000) Subject: Merge branch 'master' into Mario/ons_updates X-Git-Tag: xonotic-v0.8.2~2050^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fc2be4c1e7547ae97301f7966333e4dc858baf92;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Mario/ons_updates # Conflicts: # qcsrc/client/hud.qc # qcsrc/client/hud.qh # qcsrc/client/main.qc # qcsrc/common/constants.qh # qcsrc/common/stats.qh # qcsrc/server/autocvars.qh # qcsrc/server/bot/havocbot/havocbot.qc # qcsrc/server/mutators/gamemode_onslaught.qc --- fc2be4c1e7547ae97301f7966333e4dc858baf92 diff --cc qcsrc/client/hud.qc index 05c1ed3f2,e0dc1d91b..06cf45334 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -1,11 -1,23 +1,26 @@@ + #include "hud.qh" + #include "_all.qh" + + #include "hud_config.qh" +#include "mapvoting.qh" #include "scoreboard.qh" + #include "sortlist.qh" #include "teamradar.qh" + #include "t_items.qh" + ++#include "../dpdefs/keycodes.qh" ++ #include "../common/buffs.qh" + #include "../common/constants.qh" #include "../common/counting.qh" + #include "../common/deathtypes.qh" #include "../common/mapinfo.qh" #include "../common/nades.qh" - #include "../server/t_items.qh" + #include "../common/stats.qh" + + #include "../csqcmodellib/cl_player.qh" + + #include "../warpzonelib/mathlib.qh" /* ================== @@@ -2160,10 -1996,7 +2160,10 @@@ void HUD_Radar(void } } } - + + if ( hud_panel_radar_temp_hidden ) + return; + HUD_Panel_UpdateCvars(); float f = 0; @@@ -2317,27 -2150,8 +2317,27 @@@ for(tm = world; (tm = find(tm, classname, "radarlink")); ) draw_teamradar_link(tm.origin, tm.velocity, tm.team); - ++ + vector coord; + vector brightcolor; for(tm = world; (tm = findflags(tm, teamradar_icon, 0xFFFFFF)); ) + { + if ( hud_panel_radar_mouse ) + if ( tm.health > 0 ) + if ( tm.team == myteam+1 ) + { + coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(tm.origin)); + if ( vlen(mousepos-coord) < 8 ) + { + brightcolor_x = min(1,tm.teamradar_color_x*1.5); + brightcolor_y = min(1,tm.teamradar_color_y*1.5); + brightcolor_z = min(1,tm.teamradar_color_z*1.5); + drawpic(coord - '8 8 0', "gfx/teamradar_icon_glow", '16 16 0', brightcolor, panel_fg_alpha, 0); + } + } - ++ draw_teamradar_icon(tm.origin, tm.teamradar_icon, tm, tm.teamradar_color, panel_fg_alpha); + } for(tm = world; (tm = find(tm, classname, "entcs_receiver")); ) { color2 = GetPlayerColor(tm.sv_entnum); @@@ -2347,21 -2161,6 +2347,21 @@@ draw_teamradar_player(view_origin, view_angles, '1 1 1'); drawresetcliparea(); - ++ + if ( hud_panel_radar_mouse ) + { + string message = "Click to select teleport destination"; - ++ + if ( getstati(STAT_HEALTH) <= 0 ) + { + message = "Click to select spawn location"; + } - ++ + drawcolorcodedstring(pos + '0.5 0 0' * (mySize_x - stringwidth(message, true, hud_fontsize)) - '0 1 0' * hud_fontsize_y * 2, + message, hud_fontsize, hud_panel_radar_foreground_alpha, DRAWFLAG_NORMAL); - ++ + hud_panel_radar_bottom = pos_y + mySize_y + hud_fontsize_y; + } } // Score (#7) @@@ -4514,16 -4338,8 +4539,16 @@@ void HUD_CenterPrint (void hud_fade_alpha = 1 - autocvar__menu_alpha; } HUD_Panel_UpdateCvars(); - + - if(scoreboard_fade_alpha) + if ( HUD_Radar_Clickable() ) + { + if (hud_panel_radar_bottom >= 0.96 * vid_conheight) + return; - ++ + panel_pos = eY * hud_panel_radar_bottom + eX * 0.5 * (vid_conwidth - panel_size_x); + panel_size_y = min(panel_size_y, vid_conheight - hud_panel_radar_bottom); + } + else if(scoreboard_fade_alpha) { hud_fade_alpha = hud_fade_alpha_save; diff --cc qcsrc/client/hud.qh index 251e9f23b,5bc2ca4a7..74701acff --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@@ -12,16 -12,24 +12,29 @@@ int HUD_PANEL_LAST int panel_order[HUD_PANEL_MAX]; string hud_panelorder_prev; +bool hud_draw_maximized; +bool hud_panel_radar_maximized; +bool hud_panel_radar_mouse; +float hud_panel_radar_bottom; +bool hud_panel_radar_temp_hidden; +bool chat_panel_modified; +bool radar_panel_modified; + +void HUD_Radar_Hide_Maximized(); + + void HUD_Reset (void); + void HUD_Main (void); + + int vote_yescount; + int vote_nocount; + int vote_needed; + int vote_highlighted; // currently selected vote + + int vote_active; // is there an active vote? + int vote_prev; // previous state of vote_active to check for a change + float vote_alpha; + float vote_change; // "time" when vote_active changed + -float hud_draw_maximized; -float hud_panel_radar_maximized; -float chat_panel_modified; -float radar_panel_modified; - vector mousepos; vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click) vector panel_click_resizeorigin; // coordinates for opposite point when resizing diff --cc qcsrc/client/hud_config.qc index 4ddc049ba,4b55bb40e..abe674022 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@@ -631,14 -626,14 +626,6 @@@ void HUD_Panel_Arrow_Action(float nPrim } } --const int S_MOUSE1 = 1; --const int S_MOUSE2 = 2; --const int S_MOUSE3 = 4; --int mouseClicked; --int prevMouseClicked; // previous state --float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks --vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks -- void HUD_Panel_EnableMenu(); entity tab_panels[HUD_PANEL_MAX]; entity tab_panel; diff --cc qcsrc/client/hud_config.qh index 000000000,cc1d4d563..39dc65991 mode 000000,100644..100644 --- a/qcsrc/client/hud_config.qh +++ b/qcsrc/client/hud_config.qh @@@ -1,0 -1,14 +1,22 @@@ + #ifndef HUD_CONFIG_H + #define HUD_CONFIG_H + + void HUD_Panel_ExportCfg(string cfgname); + + void HUD_Panel_Mouse(); + + void HUD_Configure_Frame(); + + void HUD_Configure_PostDraw(); + + float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary); + ++const int S_MOUSE1 = 1; ++const int S_MOUSE2 = 2; ++const int S_MOUSE3 = 4; ++int mouseClicked; ++int prevMouseClicked; // previous state ++float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks ++vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks ++ + #endif diff --cc qcsrc/client/main.qc index 11c3217d3,982056fcb..5068a6a4e --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@@ -1,5 -1,15 +1,17 @@@ + #include "main.qh" + #include "_all.qh" + + #include "casings.qh" +#include "controlpoint.qh" + #include "csqcmodel_hooks.qh" + #include "damage.qh" + #include "effects.qh" +#include "generator.qh" + #include "gibs.qh" + #include "hook.qh" + #include "hud.qh" + #include "hud_config.qh" + #include "laser.qh" #include "mapvoting.qh" #include "modeleffects.qh" #include "particles.qh" diff --cc qcsrc/client/mapvoting.qc index 28b81fc51,f00ee544c..e75214a4e --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@@ -1,6 -1,49 +1,48 @@@ #include "mapvoting.qh" + #include "_all.qh" + + #include "hud.qh" #include "scoreboard.qh" + #include "../common/mapinfo.qh" + #include "../common/util.qh" + + #include "../dpdefs/keycodes.qh" + + + int mv_num_maps; + -float mv_active; + string mv_maps[MAPVOTE_COUNT]; + string mv_pics[MAPVOTE_COUNT]; + string mv_pk3[MAPVOTE_COUNT]; // map pk3 name or gametype human readable name + string mv_desc[MAPVOTE_COUNT]; + float mv_preview[MAPVOTE_COUNT]; + float mv_votes[MAPVOTE_COUNT]; + float mv_flags[MAPVOTE_COUNT]; + float mv_flags_start[MAPVOTE_COUNT]; + entity mv_pk3list; + float mv_abstain; + float mv_ownvote; + float mv_detail; + float mv_timeout; + float mv_top2_time; + float mv_top2_alpha; + + vector mv_mousepos; + int mv_selection; + int mv_columns; + int mv_mouse_selection; + int mv_selection_keyboard; + + float gametypevote; + string mapvote_chosenmap; + vector gtv_text_size; + vector gtv_text_size_small; + + const int NUM_SSDIRS = 4; + string ssdirs[NUM_SSDIRS]; + int n_ssdirs; + string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize) { string pre, post; diff --cc qcsrc/client/mapvoting.qh index 8a4133e50,9c7086efc..7a9a511a2 --- a/qcsrc/client/mapvoting.qh +++ b/qcsrc/client/mapvoting.qh @@@ -74,8 -11,4 +11,6 @@@ float MapVote_InputEvent(float bInputTy void Ent_MapVote(); void Net_MapVote_Picture(); ++ ++float mv_active; #endif diff --cc qcsrc/client/progs.src index 81d349ff6,a9d0c565a..60cb99675 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@@ -10,12 -9,10 +10,11 @@@ controlpoint.q csqcmodel_hooks.qc damage.qc effects.qc +generator.qc gibs.qc hook.qc - hud_config.qc hud.qc - laser.qc + hud_config.qc main.qc mapvoting.qc miscfunctions.qc diff --cc qcsrc/common/constants.qh index df4f4ffc7,939c6d7c1..4fb15af86 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -78,8 -104,17 +104,19 @@@ const int ENT_CLIENT_ELIMINATEDPLAYERS const int ENT_CLIENT_TURRET = 40; const int ENT_CLIENT_AUXILIARYXHAIR = 50; const int ENT_CLIENT_VEHICLE = 60; - const int ENT_CLIENT_GENERATOR = 61; - const int ENT_CLIENT_CONTROLPOINT_ICON = 62; + const int ENT_CLIENT_LADDER = 61; + const int ENT_CLIENT_TRIGGER_PUSH = 62; + const int ENT_CLIENT_TARGET_PUSH = 63; + const int ENT_CLIENT_CONVEYOR = 64; + const int ENT_CLIENT_DOOR = 65; + const int ENT_CLIENT_TRAIN = 66; + const int ENT_CLIENT_PLAT = 67; + const int ENT_CLIENT_TRIGGER_IMPULSE = 68; + const int ENT_CLIENT_SWAMP = 69; + const int ENT_CLIENT_CORNER = 70; + const int ENT_CLIENT_KEYLOCK = 71; ++const int ENT_CLIENT_GENERATOR = 72; ++const int ENT_CLIENT_CONTROLPOINT_ICON = 73; const int ENT_CLIENT_HEALING_ORB = 80; diff --cc qcsrc/common/stats.qh index cbb0d7ba9,b488df1cf..f461d8b62 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@@ -92,9 -107,9 +107,9 @@@ const int STAT_HEALING_ORB_ALPHA const int STAT_PLASMA = 84; const int STAT_OK_AMMO_CHARGE = 85; const int STAT_OK_AMMO_CHARGEPOOL = 86; - const int STAT_ROUNDLOST = 87; - // 88 empty? - // 89 empty? + const int STAT_FROZEN = 87; + const int STAT_REVIVE_PROGRESS = 88; -// 89 empty? ++const int STAT_ROUNDLOST = 89; // 90 empty? // 91 empty? // 92 empty? diff --cc qcsrc/common/triggers/triggers.qh index 000000000,474f797af..c8e593f9c mode 000000,100644..100644 --- a/qcsrc/common/triggers/triggers.qh +++ b/qcsrc/common/triggers/triggers.qh @@@ -1,0 -1,52 +1,54 @@@ + #ifndef TRIGGERS_H + #define TRIGGERS_H + + const float SF_TRIGGER_INIT = 1; + const float SF_TRIGGER_UPDATE = 2; + const float SF_TRIGGER_RESET = 4; + + const float SPAWNFLAG_NOMESSAGE = 1; + const float SPAWNFLAG_NOTOUCH = 1; + + .void() trigger_touch; + + .float antiwall_flag; // Variable to define what to do with func_clientwall + // 0 == do nothing, 1 == deactivate, 2 == activate + + .float height; + + .float nottargeted; + #define IFTARGETED if(!self.nottargeted && self.targetname != "") + + .float lip; + + // used elsewhere (will fix) + #ifdef SVQC + void trigger_common_write(bool withtarget); + + string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin); + + void target_voicescript_next(entity pl); + void target_voicescript_clear(entity pl); + #endif + + .float volume, atten; + + .vector dest; + ++void FixSize(entity e); ++ + #ifdef CSQC + void trigger_common_read(bool withtarget); + void trigger_remove_generic(); + + .float active; + .string target; + .string targetname; + + const int ACTIVE_NOT = 0; + const int ACTIVE_ACTIVE = 1; + const int ACTIVE_IDLE = 2; + const int ACTIVE_BUSY = 2; + const int ACTIVE_TOGGLE = 3; + #endif + + #endif diff --cc qcsrc/server/autocvars.qh index 0044b16b7,51b14aa08..4a779e034 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@@ -419,38 -419,43 +419,38 @@@ float autocvar_g_nexball_delay_goal float autocvar_g_nexball_delay_start; float autocvar_g_nexball_football_bouncefactor; float autocvar_g_nexball_football_bouncestop; - float autocvar_g_nexball_goalleadlimit; + int autocvar_g_nexball_goalleadlimit; #define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit") - float autocvar_g_nexball_radar_showallplayers; - float autocvar_g_nexball_sound_bounce; - float autocvar_g_nexball_trail_color; + bool autocvar_g_nexball_radar_showallplayers; + bool autocvar_g_nexball_sound_bounce; + int autocvar_g_nexball_trail_color; //float autocvar_g_nick_flood_penalty; - float autocvar_g_nick_flood_penalty_red; - float autocvar_g_nick_flood_penalty_yellow; + int autocvar_g_nick_flood_penalty_red; + int autocvar_g_nick_flood_penalty_yellow; //float autocvar_g_nick_flood_timeout; - float autocvar_g_nix_with_healtharmor; - float autocvar_g_nix_with_blaster; - float autocvar_g_nix_with_powerups; - float autocvar_g_nodepthtestitems; - float autocvar_g_nodepthtestplayers; - float autocvar_g_norecoil; - float autocvar_g_pickup_cells_max; - float autocvar_g_pickup_plasma_max; - float autocvar_g_pickup_fuel_max; - float autocvar_g_pickup_items; - float autocvar_g_pickup_nails_max; - float autocvar_g_pickup_rockets_max; - float autocvar_g_pickup_shells_max; + bool autocvar_g_nix_with_healtharmor; + bool autocvar_g_nix_with_blaster; + bool autocvar_g_nix_with_powerups; + bool autocvar_g_nodepthtestitems; + bool autocvar_g_nodepthtestplayers; + bool autocvar_g_norecoil; -float autocvar_g_onslaught_cp_buildhealth; -float autocvar_g_onslaught_cp_buildtime; -float autocvar_g_onslaught_cp_health; -float autocvar_g_onslaught_cp_regen; -float autocvar_g_onslaught_gen_health; + int autocvar_g_pickup_cells_max; + int autocvar_g_pickup_plasma_max; + int autocvar_g_pickup_fuel_max; + int autocvar_g_pickup_items; + int autocvar_g_pickup_nails_max; + int autocvar_g_pickup_rockets_max; + int autocvar_g_pickup_shells_max; float autocvar_g_player_alpha; float autocvar_g_player_brightness; - float autocvar_g_playerclip_collisions; - float autocvar_g_powerups; - float autocvar_g_projectiles_damage; - float autocvar_g_projectiles_keep_owner; - float autocvar_g_projectiles_newton_style; + bool autocvar_g_playerclip_collisions; + int autocvar_g_powerups; + int autocvar_g_projectiles_damage; + bool autocvar_g_projectiles_keep_owner; + int autocvar_g_projectiles_newton_style; float autocvar_g_projectiles_newton_style_2_maxfactor; float autocvar_g_projectiles_newton_style_2_minfactor; - float autocvar_g_projectiles_spread_style; + int autocvar_g_projectiles_spread_style; #define autocvar_g_race_laps_limit cvar("g_race_laps_limit") float autocvar_g_race_qualifying_timelimit; float autocvar_g_race_qualifying_timelimit_override; @@@ -844,42 -831,21 +826,45 @@@ bool autocvar_g_overkill_ammo_charge float autocvar_g_overkill_ammo_charge_notice; float autocvar_g_overkill_ammo_charge_limit; float autocvar_g_spawn_near_teammate_distance; - float autocvar_g_spawn_near_teammate_ignore_spawnpoint; + bool autocvar_g_spawn_near_teammate_ignore_spawnpoint; float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay; float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death; - float autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health; - float autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath; +float autocvar_g_onslaught_debug; +float autocvar_g_onslaught_teleport_wait; - float autocvar_g_onslaught_spawn_at_controlpoints; - var float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; ++bool autocvar_g_onslaught_spawn_at_controlpoints; ++bool autocvar_g_onslaught_spawn_at_generator; ++float autocvar_g_onslaught_cp_proxydecap; ++float autocvar_g_onslaught_cp_proxydecap_distance = 512; ++float autocvar_g_onslaught_cp_proxydecap_dps = 100; ++float autocvar_g_onslaught_spawn_at_controlpoints_chance = 0.5; +float autocvar_g_onslaught_spawn_at_controlpoints_random; - float autocvar_g_onslaught_spawn_at_generator; +float autocvar_g_onslaught_spawn_at_generator_chance; +float autocvar_g_onslaught_spawn_at_generator_random; - float autocvar_g_onslaught_cp_proxydecap; - var float autocvar_g_onslaught_cp_proxydecap_distance = 512; - var float autocvar_g_onslaught_cp_proxydecap_dps = 100; +float autocvar_g_onslaught_cp_buildhealth; +float autocvar_g_onslaught_cp_buildtime; +float autocvar_g_onslaught_cp_health; +float autocvar_g_onslaught_cp_regen; +float autocvar_g_onslaught_gen_health; - var float autocvar_g_onslaught_shield_force = 100; ++float autocvar_g_onslaught_shield_force = 100; +float autocvar_g_onslaught_allow_vehicle_touch; +float autocvar_g_onslaught_round_timelimit; +float autocvar_g_onslaught_point_limit; +float autocvar_g_onslaught_warmup; +float autocvar_g_onslaught_teleport_radius; +float autocvar_g_onslaught_spawn_choose; +float autocvar_g_onslaught_click_radius; + int autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health; + bool autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath; + bool autocvar_g_physics_clientselect; + string autocvar_g_physics_clientselect_options; + string autocvar_g_physics_clientselect_default; float autocvar_g_buffs_waypoint_distance; - float autocvar_g_buffs_randomize; + bool autocvar_g_buffs_randomize; float autocvar_g_buffs_random_lifetime; - float autocvar_g_buffs_random_location; - float autocvar_g_buffs_random_location_attempts; - float autocvar_g_buffs_spawn_count; - float autocvar_g_buffs_replace_powerups; + bool autocvar_g_buffs_random_location; + int autocvar_g_buffs_random_location_attempts; + int autocvar_g_buffs_spawn_count; + bool autocvar_g_buffs_replace_powerups; float autocvar_g_buffs_cooldown_activate; float autocvar_g_buffs_cooldown_respawn; float autocvar_g_buffs_resistance_blockpercent; diff --cc qcsrc/server/bot/havocbot/role_onslaught.qc index 119ea83c8,6924f5122..000000000 deleted file mode 100644,100644 --- a/qcsrc/server/bot/havocbot/role_onslaught.qc +++ /dev/null @@@ -1,369 -1,381 +1,0 @@@ -#include "../../_all.qh" - -#include "havocbot.qh" - -#include "../bot.qh" -#include "../navigation.qh" -#include "../waypoints.qh" - -#include "../../mutators/mutators_include.qh" - -#include "../../../common/teams.qh" - --const int HAVOCBOT_ONS_ROLE_NONE = 0; --const int HAVOCBOT_ONS_ROLE_DEFENSE = 2; --const int HAVOCBOT_ONS_ROLE_ASSISTANT = 4; --const int HAVOCBOT_ONS_ROLE_OFFENSE = 8; -- --.int havocbot_role_flags; --.float havocbot_attack_time; -- --.void() havocbot_role; --.void() havocbot_previous_role; -- --void() havocbot_role_ons_defense; --void() havocbot_role_ons_offense; --void() havocbot_role_ons_assistant; -- --void(entity bot) havocbot_ons_reset_role; --void(float ratingscale, vector org, float sradius) havocbot_goalrating_items; --void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers; -- --.float isshielded; --.float iscaptured; --.float islinked; --.float isgenneighbor_blue, iscpneighbor_blue; --.float isgenneighbor_red, iscpneighbor_red; -- --.entity havocbot_ons_target; -- --void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius) --{ -- entity head; -- float t, i, c, needarmor = false, needweapons = false; -- -- // Needs armor/health? -- if(self.health<100) -- needarmor = true; -- -- // Needs weapons? -- c = 0; -- for(i = WEP_FIRST; i <= WEP_LAST ; ++i) -- { -- // Find weapon -- if(self.weapons & WepSet_FromWeapon(i)) -- if(++c>=4) -- break; -- } -- -- if(c<4) -- needweapons = true; -- -- if(!needweapons && !needarmor) -- return; -- --// dprint(self.netname, " needs weapons ", ftos(needweapons) , "\n"); --// dprint(self.netname, " needs armor ", ftos(needarmor) , "\n"); -- -- // See what is around -- head = findchainfloat(bot_pickup, true); -- while (head) -- { -- // gather health and armor only -- if (head.solid) -- if ( ((head.health || head.armorvalue) && needarmor) || (head.weapons && needweapons ) ) -- if (vlen(head.origin - org) < sradius) -- { -- t = head.bot_pickupevalfunc(self, head); -- if (t > 0) -- navigation_routerating(head, t * ratingscale, 500); -- } -- head = head.chain; -- } --} -- --void havocbot_role_ons_setrole(entity bot, float role) --{ -- dprint(strcat(bot.netname," switched to ")); -- switch(role) -- { -- case HAVOCBOT_ONS_ROLE_DEFENSE: -- dprint("defense"); -- bot.havocbot_role = havocbot_role_ons_defense; -- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE; -- bot.havocbot_role_timeout = 0; -- break; -- case HAVOCBOT_ONS_ROLE_ASSISTANT: -- dprint("assistant"); -- bot.havocbot_role = havocbot_role_ons_assistant; -- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT; -- bot.havocbot_role_timeout = 0; -- break; -- case HAVOCBOT_ONS_ROLE_OFFENSE: -- dprint("offense"); -- bot.havocbot_role = havocbot_role_ons_offense; -- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE; -- bot.havocbot_role_timeout = 0; -- break; -- } -- dprint("\n"); --} -- --float havocbot_ons_teamcount(entity bot, int role) --{ -- float c = 0; -- entity head; -- -- FOR_EACH_PLAYER(head) -- if(head.team==self.team) -- if(head.havocbot_role_flags & role) -- ++c; -- -- return c; --} -- --void havocbot_goalrating_ons_controlpoints_attack(float ratingscale) --{ -- entity cp, cp1, cp2, best, pl, wp; -- float radius, found, bestvalue, c; -- -- cp1 = cp2 = findchain(classname, "onslaught_controlpoint"); -- -- // Filter control points -- for (; cp2; cp2 = cp2.chain) -- { -- cp2.wpcost = c = 0; -- cp2.wpconsidered = false; -- -- if(cp2.isshielded) -- continue; -- -- // Ignore owned controlpoints -- if(self.team == NUM_TEAM_1) -- { -- if( (cp2.isgenneighbor_blue || cp2.iscpneighbor_blue) && !(cp2.isgenneighbor_red || cp2.iscpneighbor_red) ) -- continue; -- } -- else if(self.team == NUM_TEAM_2) -- { -- if( (cp2.isgenneighbor_red || cp2.iscpneighbor_red) && !(cp2.isgenneighbor_blue || cp2.iscpneighbor_blue) ) -- continue; -- } -- -- // Count team mates interested in this control point -- // (easier and cleaner than keeping counters per cp and teams) -- FOR_EACH_PLAYER(pl) -- if(pl.team==self.team) -- if(pl.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE) -- if(pl.havocbot_ons_target==cp2) -- ++c; -- -- // NOTE: probably decrease the cost of attackable control points -- cp2.wpcost = c; -- cp2.wpconsidered = true; -- } -- -- // We'll consider only the best case -- bestvalue = 99999999999; -- cp = world; -- for (; cp1; cp1 = cp1.chain) -- { -- if (!cp1.wpconsidered) -- continue; -- -- if(cp1.wpcost self.havocbot_role_timeout) -- { -- havocbot_ons_reset_role(self); -- return; -- } -- -- if(self.havocbot_attack_time>time) -- return; -- -- if (self.bot_strategytime < time) -- { -- navigation_goalrating_start(); -- havocbot_goalrating_enemyplayers(20000, self.origin, 650); -- if(!havocbot_goalrating_ons_generator_attack(20000)) -- havocbot_goalrating_ons_controlpoints_attack(20000); -- havocbot_goalrating_ons_offenseitems(10000, self.origin, 10000); -- navigation_goalrating_end(); -- -- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval; -- } --} -- --void havocbot_role_ons_assistant() --{ -- havocbot_ons_reset_role(self); --} -- --void havocbot_role_ons_defense() --{ -- havocbot_ons_reset_role(self); --} -- --void havocbot_ons_reset_role(entity bot) --{ -- entity head; -- float c; -- -- if(self.deadflag != DEAD_NO) -- return; -- -- bot.havocbot_ons_target = world; -- -- // TODO: Defend control points or generator if necessary -- -- // if there is only me on the team switch to offense -- c = 0; -- FOR_EACH_PLAYER(head) -- if(head.team==self.team) -- ++c; -- -- if(c==1) -- { -- havocbot_role_ons_setrole(bot, HAVOCBOT_ONS_ROLE_OFFENSE); -- return; -- } -- -- havocbot_role_ons_setrole(bot, HAVOCBOT_ONS_ROLE_OFFENSE); --} -- --void havocbot_chooserole_ons() --{ -- havocbot_ons_reset_role(self); --} diff --cc qcsrc/server/bot/havocbot/roles.qc index 9b62088de,65ea2a809..6df91ce6e --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/havocbot/roles.qc @@@ -1,3 -1,11 +1,10 @@@ + #include "../../_all.qh" + + #include "havocbot.qh" + #include "role_keyhunt.qh" -#include "role_onslaught.qh" + + #include "../bot.qh" + #include "../navigation.qh" .float max_armorvalue; .float havocbot_role_timeout; diff --cc qcsrc/server/miscfunctions.qh index f19f53fd0,12dbe3a2c..80637a877 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@@ -32,6 -32,46 +32,44 @@@ float cvar_normal(string n .float uncustomizeentityforclient_set; .float nottargeted; + entity eliminatedPlayers; + void EliminatedPlayers_Init(float(entity) isEliminated_func); + + string admin_name(void); + + void write_recordmarker(entity pl, float tstart, float dt); + + void play2all(string samp); + + void DistributeEvenly_Init(float amount, float totalweight); + float DistributeEvenly_Get(float weight); + + void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2); + + void shockwave_spawn(string m, vector org, float sz, float t1, float t2); + -vector randompos(vector m1, vector m2); - + void play2team(float t, string filename); + + void GetCvars_handleFloat(string thisname, float f, .float field, string name); + + float spamsound(entity e, float chan, string samp, float vol, float _atten); + + void GetCvars_handleString(string thisname, float f, .string field, string name); + + void precache_all_playermodels(string pattern); + + void soundat(entity e, vector o, float chan, string samp, float vol, float _atten); + + void defer(float fdelay, void() func); + + void UncustomizeEntitiesRun(); + void InitializeEntitiesRun(); + + void stopsoundto(float _dest, entity e, float chan); + void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten); + float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float d); + + vector shotorg_adjust(vector vecs, float y_is_right, float visual); float DistributeEvenly_amount; float DistributeEvenly_totalweight; diff --cc qcsrc/server/mutators/gamemode_onslaught.qc index a05e6c137,c99643169..a785cc15b --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@@ -1,111 -1,86 +1,103 @@@ + #include "../_all.qh" + + #include "gamemode.qh" +#include "../controlpoint.qh" +#include "../generator.qh" -float autocvar_g_onslaught_spawn_at_controlpoints; -float autocvar_g_onslaught_spawn_at_generator; -float autocvar_g_onslaught_cp_proxydecap; -float autocvar_g_onslaught_cp_proxydecap_distance = 512; -float autocvar_g_onslaught_cp_proxydecap_dps = 100; ++vector randompos(vector m1, vector m2) ++{ ++ vector v; ++ m2 = m2 - m1; ++ v_x = m2_x * random() + m1_x; ++ v_y = m2_y * random() + m1_y; ++ v_z = m2_z * random() + m1_z; ++ return v; ++} + -void onslaught_generator_updatesprite(entity e); -void onslaught_controlpoint_updatesprite(entity e); -void onslaught_link_checkupdate(); +// ======================= +// CaptureShield Functions +// ======================= -.entity sprite; -.string target2; -.float iscaptured; -.float islinked; -.float isgenneighbor_red; -.float isgenneighbor_blue; -.float iscpneighbor_red; -.float iscpneighbor_blue; -.float isshielded; -.float lasthealth; -.float lastteam; -.float lastshielded; -.float lastcaptured; +bool ons_CaptureShield_Customize() +{ + entity e = WaypointSprite_getviewentity(other); -entity ons_red_generator; -entity ons_blue_generator; + if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; } + if(SAME_TEAM(self, e)) { return false; } -void ons_gib_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) -{ - self.velocity = self.velocity + vforce; + return true; } -.float giblifetime; -void ons_throwgib_think() +void ons_CaptureShield_Touch() { - float d; + if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; } + if(!IS_PLAYER(other)) { return; } + if(SAME_TEAM(other, self)) { return; } - self.nextthink = time + 0.05; + vector mymid = (self.absmin + self.absmax) * 0.5; + vector othermid = (other.absmin + other.absmax) * 0.5; - d = self.giblifetime - time; + Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * ons_captureshield_force); - if(d<0) + if(IS_REAL_CLIENT(other)) { - self.think = SUB_Remove; - return; + play2(other, "onslaught/damageblockedbyshield.wav"); + + if(self.enemy.classname == "onslaught_generator") + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); + else + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED); } - if(d<1) - self.alpha = d; +} - if(d>2) - if(random()<0.6) - pointparticles(particleeffectnum("onslaught_generator_gib_flame"), self.origin, '0 0 0', 1); +void ons_CaptureShield_Reset() +{ + self.colormap = self.enemy.colormap; + self.team = self.enemy.team; } -void ons_throwgib(vector v_from, vector v_to, string smodel, float f_lifetime, float b_burn) +void ons_CaptureShield_Spawn(entity generator, bool is_generator) { - entity gib; + entity shield = spawn(); + + shield.enemy = generator; + shield.team = generator.team; + shield.colormap = generator.colormap; + shield.reset = ons_CaptureShield_Reset; + shield.touch = ons_CaptureShield_Touch; + shield.customizeentityforclient = ons_CaptureShield_Customize; + shield.classname = "ons_captureshield"; + shield.effects = EF_ADDITIVE; + shield.movetype = MOVETYPE_NOCLIP; + shield.solid = SOLID_TRIGGER; + shield.avelocity = '7 0 11'; + shield.scale = 1; + shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3"); + + precache_model(shield.model); + setorigin(shield, generator.origin); + setmodel(shield, shield.model); + setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs); +} - gib = spawn(); - setmodel(gib, smodel); - setorigin(gib, v_from); - gib.solid = SOLID_BBOX; - gib.movetype = MOVETYPE_BOUNCE; - gib.takedamage = DAMAGE_YES; - gib.event_damage = ons_gib_damage; - gib.health = -1; - gib.effects = EF_LOWPRECISION; - gib.flags = FL_NOTARGET; - gib.velocity = v_to; - gib.giblifetime = time + f_lifetime; +// ========== +// Junk Pile +// ========== - if (b_burn) +void ons_debug(string input) +{ + switch(autocvar_g_onslaught_debug) { - gib.think = ons_throwgib_think; - gib.nextthink = time + 0.05; + case 1: dprint(input); break; + case 2: print(input); break; } - else - SUB_SetFade(gib, gib.giblifetime, 2); +} + - void FixSize(entity e) - { - e.mins_x = rint(e.mins_x); - e.mins_y = rint(e.mins_y); - e.mins_z = rint(e.mins_z); - - e.maxs_x = rint(e.maxs_x); - e.maxs_y = rint(e.maxs_y); - e.maxs_z = rint(e.maxs_z); - } - - vector randompos(vector m1, vector m2) - { - vector v; - m2 = m2 - m1; - v_x = m2_x * random() + m1_x; - v_y = m2_y * random() + m1_y; - v_z = m2_z * random() + m1_z; - return v; - } - +void setmodel_fixsize(entity e, string m) +{ + setmodel(e, m); + FixSize(e); } void onslaught_updatelinks() diff --cc qcsrc/server/mutators/gamemode_onslaught.qh index 7cebb172d,000000000..c6c3d1814 mode 100644,000000..100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qh +++ b/qcsrc/server/mutators/gamemode_onslaught.qh @@@ -1,93 -1,0 +1,93 @@@ +// these are needed since mutators are compiled last + +#ifdef SVQC + +.entity ons_toucher; // player who touched the control point + +// control point / generator constants +const float ONS_CP_THINKRATE = 0.2; +const float GEN_THINKRATE = 1; - #define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13)) ++#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) +const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128'); +const vector CPICON_OFFSET = ('0 0 96'); + +// list of generators on the map +entity ons_worldgeneratorlist; +.entity ons_worldgeneratornext; +.entity ons_stalegeneratornext; + +// list of control points on the map +entity ons_worldcplist; +.entity ons_worldcpnext; +.entity ons_stalecpnext; + +// list of links on the map +entity ons_worldlinklist; +.entity ons_worldlinknext; +.entity ons_stalelinknext; + +// definitions +.entity sprite; +.string target2; +.int iscaptured; +.int islinked; +.int isshielded; +.float lasthealth; +.int lastteam; +.int lastshielded; +.int lastcaptured; + +.bool waslinked; + +bool ons_stalemate; + +.float teleport_antispam; + +.bool ons_roundlost; + +// waypoint sprites +.entity bot_basewaypoint; // generator waypointsprite + +.bool isgenneighbor[17]; +.bool iscpneighbor[17]; +float ons_notification_time[17]; + +.float ons_overtime_damagedelay; + +.vector ons_deathloc; + +.entity ons_spawn_by; + +// declarations for functions used outside gamemode_onslaught.qc +void ons_Generator_UpdateSprite(entity e); +void ons_ControlPoint_UpdateSprite(entity e); +bool ons_ControlPoint_Attackable(entity cp, int teamnumber); + +// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet +float ons_captureshield_force; // push force of the shield + +// bot player logic +const int HAVOCBOT_ONS_ROLE_NONE = 0; +const int HAVOCBOT_ONS_ROLE_DEFENSE = 2; +const int HAVOCBOT_ONS_ROLE_ASSISTANT = 4; +const int HAVOCBOT_ONS_ROLE_OFFENSE = 8; + +.entity havocbot_ons_target; + +.int havocbot_role_flags; +.float havocbot_attack_time; + +void havocbot_role_ons_defense(); +void havocbot_role_ons_offense(); +void havocbot_role_ons_assistant(); + +void havocbot_ons_reset_role(entity bot); +void havocbot_goalrating_items(float ratingscale, vector org, float sradius); +void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius); + +// score rule declarations +const int ST_ONS_CAPS = 1; +const int SP_ONS_CAPS = 4; +const int SP_ONS_TAKES = 6; + +#endif diff --cc qcsrc/server/progs.src index a496de32c,ab87642aa..12a4f8182 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@@ -13,14 -12,9 +12,10 @@@ campaign.q cheats.qc cl_client.qc cl_impulse.qc - cl_physics.qc cl_player.qc +controlpoint.qc csqceffects.qc - // ctf.qc - // domination.qc ent_cs.qc - func_breakable.qc g_casings.qc g_damage.qc g_hook.qc @@@ -27,10 -22,8 +23,9 @@@ g_models.qc g_subs.qc g_tetris.qc - g_triggers.qc g_violence.qc g_world.qc +generator.qc ipban.qc item_key.qc mapvoting.qc @@@ -52,25 -42,22 +44,21 @@@ sv_main.q teamplay.qc t_halflife.qc t_items.qc - t_jumppads.qc - t_plats.qc t_quake3.qc t_quake.qc - t_swamp.qc - t_teleporters.qc waypointsprites.qc + bot/aim.qc bot/bot.qc + bot/navigation.qc + bot/scripting.qc + bot/waypoints.qc - command/banning.qc - command/cmd.qc - command/common.qc - command/getreplies.qc - command/radarmap.qc - command/sv_cmd.qc - command/vote.qc + bot/havocbot/havocbot.qc + bot/havocbot/role_keyhunt.qc -bot/havocbot/role_onslaught.qc + bot/havocbot/roles.qc + + command/all.qc mutators/mutators_include.qc mutators/mutators.qc