From: z411 Date: Fri, 2 Oct 2020 08:12:05 +0000 (-0300) Subject: Implemented duel shared inventory X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4d14b5600e611734b23dbd269f1c2da2df3bf627;p=xonotic%2Fxonotic-data.pk3dir.git Implemented duel shared inventory --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index e3451b3c7..0cea8df91 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -13,6 +13,7 @@ #include #include #include +#include // Scoreboard (#24) @@ -1262,8 +1263,11 @@ void Scoreboard_Duel_DrawTable(vector pos, bool invert, entity pl, entity tm) "items", hud_fontsize, '0.5 0.5 1', panel_fg_alpha, DRAWFLAG_NORMAL); tmp.y += hud_fontsize.y * 1.25; - FOREACH(Items, it.m_id == ITEM_ArmorMega.m_id || it.m_id == ITEM_HealthMega.m_id, { - tmp = Scoreboard_Duel_DrawPickup(tmp, true, it.m_icon, icon_sz, 0, invert); + FOREACH(Items, + it.m_id == ITEM_ArmorMega.m_id || + it.m_id == ITEM_HealthMega.m_id || + it.m_id == ITEM_ArmorBig.m_id, { + tmp = Scoreboard_Duel_DrawPickup(tmp, true, it.m_icon, icon_sz, inventoryslots[pl.sv_entnum].inv_items[it.m_id], invert); if(it.m_id == REGISTRY_MAX(Items)) break; @@ -1989,7 +1993,7 @@ void Scoreboard_Draw() if (autocvar_hud_panel_scoreboard_team_size_position != 1) // team size not on left { // put team score to the left of scoreboard (and team size to the right) - team_score_baseoffset = eY * hud_fontsize.y - eX * hud_fontsize.x * 0.5; + team_score_baseoffset = eY * hud_fontsize.y - eX * hud_fontsize.x * 1.5; team_size_baseoffset = eY * hud_fontsize.y + eX * hud_fontsize.x * 0.5; if(panel.current_panel_bg != "0") { @@ -2000,7 +2004,7 @@ void Scoreboard_Draw() else { // put team score to the right of scoreboard (and team size to the left) - team_score_baseoffset = eY * hud_fontsize.y + eX * hud_fontsize.x * 0.5; + team_score_baseoffset = eY * hud_fontsize.y + eX * hud_fontsize.x * 1.5; team_size_baseoffset = eY * hud_fontsize.y - eX * hud_fontsize.x * 0.5; if(panel.current_panel_bg != "0") { diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index ae26b1091..e46bb748a 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -2,6 +2,7 @@ #include #include +#include // z411 string hostname_full; diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index ca53f718d..f4abe5eb5 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -37,11 +37,16 @@ STATIC_INIT(Inventory) #endif #ifdef CSQC -Inventory g_inventory; +//Inventory g_inventory; +Inventory inventoryslots[255]; NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew) { make_pure(this); - g_inventory = this; + //g_inventory = this; + + float entnum = ReadByte(); + inventoryslots[entnum-1] = this; + const int majorBits = Readbits(Inventory_groups_major); for (int i = 0; i < Inventory_groups_major; ++i) { if (!(majorBits & BIT(i))) { @@ -116,7 +121,11 @@ bool Inventory_Send(Inventory this, Client to, int sf) TC(Inventory, this); WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY); TC(PlayerState, this.owner); - Inventory_Write(this); + + // z411 send entity number + WriteByte(MSG_ENTITY, etof(this.owner.m_client)); + + Inventory_Write(this); return true; } @@ -130,7 +139,8 @@ void Inventory_new(PlayerState this) { Inventory inv = NEW(Inventory), bak = NEW(Inventory); inv.inventory = bak; - setcefc(inv, Inventory_customize); + if(!g_duel) + setcefc(inv, Inventory_customize); Net_LinkEntity((inv.owner = this).inventory = inv, false, 0, Inventory_Send); } void Inventory_delete(entity e) { delete(e.inventory.inventory); delete(e.inventory); }