From: Lyberta Date: Thu, 31 Aug 2017 12:27:37 +0000 (+0300) Subject: Merged Lyberta/GunGame into Lyberta/master X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=369ba6dad03ee059d5a465fe22220c81be6bf2f1;p=xonotic%2Fxonotic-data.pk3dir.git Merged Lyberta/GunGame into Lyberta/master --- 369ba6dad03ee059d5a465fe22220c81be6bf2f1 diff --cc gamemodes-server.cfg index ed4c5c9b98,ab3b84b63e..1991f0c76f --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@@ -196,7 -198,15 +198,14 @@@ set g_inv_respawn_delay_large_count set g_inv_respawn_delay_max 0 set g_inv_respawn_waves 0 set g_inv_weapon_stay 0 + set g_gg_respawn_delay_small 0 + set g_gg_respawn_delay_small_count 0 + set g_gg_respawn_delay_large 0 + set g_gg_respawn_delay_large_count 0 + set g_gg_respawn_delay_max 0 + set g_gg_respawn_waves 0 + set g_gg_weapon_stay 0 - // ========= // assault // ========= @@@ -522,4 -532,8 +531,10 @@@ set g_invasion_teams 0 "number of team set g_invasion_team_spawns 1 "use team spawns in teamplay invasion mode" set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: complete the stage (note: use mapinfo to set this)" + // ========= + // gungame + // ========= + set g_gg 0 "GunGame: Kill players with all weapons" + set g_gg_weapons "vortex mortar machinegun hagar arc electro devastator crylink shotgun blaster" ++ +exec survival.cfg // Lyberta: surv diff --cc qcsrc/client/hud/panel/modicons.qc index cf41846892,c63683dc80..2513a803f3 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@@ -711,103 -711,38 +711,135 @@@ void HUD_Mod_Dom(vector myPos, vector m } } + void HUD_Mod_GG(vector pos, vector mySize) + { + mod_active = 1; // required in each mod function that always shows something + int stat_weapon = STAT(GUNGAME_LEADING_WEAPON); + vector pic_pos, pic_size; + if (mySize.x > mySize.y) + { + pic_pos = pos + eX * 0.25 * mySize.x; + pic_size = vec2(0.5 * mySize.x, mySize.y); + } + else + { + pic_pos = pos + eY * 0.25 * mySize.y; + pic_size = vec2(mySize.x, 0.5 * mySize.y); + } + string weapon_pic = string_null; + FOREACH(Weapons, it != WEP_Null, + { + if (it.m_id == stat_weapon) + { + weapon_pic = it.model2; + break; + } + }); + if (!weapon_pic) + { + return; + } + drawpic_aspect_skin(pic_pos, weapon_pic, pic_size, '1 1 1', 1, + DRAWFLAG_NORMAL); + } + +// Lyberta: surv +void HUD_Mod_SURV(vector mypos, vector mysize) +{ + mod_active = 1; // required in each mod function that always shows something + float defenderhealth = STAT(SURV_DEFENDER_HEALTH); + // Draw a health bar + float margin = mysize.y / 10; // Leave a small margin to be stylish + vector healthbarpos = mypos; + healthbarpos.x += margin; + healthbarpos.y += margin; + vector healthbarsize = mysize; + healthbarsize.x -= margin * 2; + healthbarsize.y -= margin * 2; + vector healthbarcolor; + healthbarcolor.z = 0; + if (defenderhealth > 0.5) + { + healthbarcolor.x = defenderhealth * -2 + 2; + healthbarcolor.y = 1; + } + else + { + healthbarcolor.x = 1; + healthbarcolor.y = defenderhealth; + } + HUD_Panel_DrawProgressBar(healthbarpos, healthbarsize, "progressbar", + defenderhealth, false, 0, healthbarcolor, 0.50, DRAWFLAG_NORMAL); + // Draw defender picture + int defenderteam = STAT(SURV_DEFENDER_TEAM); + string defenderpic = ""; + vector defendercolor; + switch (defenderteam) + { + case 1: + { + defenderpic = "player_red"; + defendercolor = '1 0 0'; + break; + } + case 2: + { + defenderpic = "player_blue"; + defendercolor = '0 0 1'; + break; + } + default: + { + defendercolor = '1 1 1'; + break; + } + } + vector picpos = mypos; + vector picsize = mysize; + picsize.x = picsize.y; + drawpic_aspect_skin(picpos, defenderpic, picsize, '1 1 1', 1, + DRAWFLAG_NORMAL); + // Draw number of defenders + int numalive = STAT(SURV_DEFENDERS_ALIVE); + vector alivepos = mypos; + alivepos.x += picsize.x; + vector alivesize = picsize; + drawstring_aspect(alivepos, ftos(numalive), alivesize, defendercolor, 1, + DRAWFLAG_NORMAL); + // Draw the time left + float roundtime = STAT(SURV_ROUND_TIME); + if (roundtime < 0) + { + roundtime = 0; + } + vector roundtimepos = mypos; + roundtimepos.x += picsize.x * 2; + vector roundtimesize = mysize; + roundtimesize.x = mysize.x - picsize.x * 2; + drawstring_aspect(roundtimepos, seconds_tostring(roundtime), roundtimesize, + '1 1 1', 1, DRAWFLAG_NORMAL); + if (autocvar_developer == 0) + { + return; + } + // Debug info below + int redalive = STAT(REDALIVE); + int bluealive = STAT(BLUEALIVE); + int yellowalive = STAT(YELLOWALIVE); + int pinkalive = STAT(PINKALIVE); + string message = strcat(ftos(redalive), "/", ftos(yellowalive)); + vector redpos = mypos; + redpos.y += mysize.y; + vector statsize = mysize; + statsize.x /= 2; + drawstring_aspect(redpos, message, statsize, '1 0 0', 1, DRAWFLAG_NORMAL); + message = strcat(ftos(bluealive), "/", ftos(pinkalive)); + vector bluepos = mypos; + bluepos.x += mysize.x / 2; + bluepos.y += mysize.y; + drawstring_aspect(bluepos, message, statsize, '0 0 1', 1, DRAWFLAG_NORMAL); +} + void HUD_ModIcons_SetFunc() { HUD_ModIcons_GameType = gametype.m_modicons; diff --cc qcsrc/common/mapinfo.qh index 40a3f59cb3,346e4077e3..834b38550a --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@@ -482,28 -482,26 +482,49 @@@ REGISTER_GAMETYPE(INVASION, NEW(Invasio //============================================================================= + #ifdef CSQC + void HUD_Mod_GG(vector pos, vector mySize); + #endif + CLASS(GunGame, Gametype) + INIT(GunGame) + { + this.gametype_init(this, _("GunGame"), "gg", "g_gg", false, "", "timelimit=20", _("Kill players with all weapons")); + } + METHOD(GunGame, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } + #ifdef CSQC + ATTRIB(GunGame, m_modicons, void(vector pos, vector mySize), HUD_Mod_GG); + #endif + ENDCLASS(GunGame) + REGISTER_GAMETYPE(GUNGAME, NEW(GunGame)); + #define g_gg IS_GAMETYPE(GUNGAME) + + //============================================================================= ++ +// Lyberta: adding survival gametype + +#ifdef CSQC +void HUD_Mod_SURV(vector pos, vector mySize); +#endif +CLASS(Survival, Gametype) + INIT(Survival) + { + this.gametype_init(this, _("Survival"), "surv", "g_surv", true, "", "timelimit=20 pointlimit=5 teams=2 leadlimit=0", _("Survive as long as you can")); + } + METHOD(Survival, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) - { - return true; - } ++ { ++ return true; ++ } +#ifdef CSQC + ATTRIB(Survival, m_modicons, void(vector pos, vector mySize), HUD_Mod_SURV); +#endif +ENDCLASS(Survival) +REGISTER_GAMETYPE(SURVIVAL, NEW(Survival)); +#define g_surv IS_GAMETYPE(SURVIVAL) + +//============================================================================= const int MAPINFO_FEATURE_WEAPONS = 1; // not defined for instagib-only maps const int MAPINFO_FEATURE_VEHICLES = 2; diff --cc qcsrc/common/stats.qh index cedc2d972c,8dc3511228..1469eb09be --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@@ -283,12 -281,9 +283,15 @@@ REGISTER_STAT(DOM_PPS_BLUE, float REGISTER_STAT(DOM_PPS_YELLOW, float) REGISTER_STAT(DOM_PPS_PINK, float) + // gungame + REGISTER_STAT(GUNGAME_LEADING_WEAPON, int) + +// Lyberta: survival +REGISTER_STAT(SURV_ROUND_TIME, float) +REGISTER_STAT(SURV_DEFENDER_TEAM, int) +REGISTER_STAT(SURV_DEFENDERS_ALIVE, int) +REGISTER_STAT(SURV_DEFENDER_HEALTH, float) + REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed) REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)