}
}
+ 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;
//=============================================================================
- {
- return true;
- }
+ #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;
++ }
+#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;