entWatch4: 'Paged' interface.
This commit is contained in:
parent
3c85a7e3de
commit
837e40a985
@ -35,31 +35,8 @@ public void OnMapStart()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action OnDisplayHUD(Handle timer)
|
public Action OnDisplayHUD(Handle timer)
|
||||||
{
|
{
|
||||||
int iZombiesCount;
|
int iHUDPages[3];
|
||||||
int iZombies[MAXPLAYERS+1];
|
char sHUDPanels[3][8][255]
|
||||||
|
|
||||||
int iHumansCount;
|
|
||||||
int iHumans[MAXPLAYERS+1];
|
|
||||||
|
|
||||||
int iSpecsCount;
|
|
||||||
int iSpecs[MAXPLAYERS+1];
|
|
||||||
|
|
||||||
for (int client = 1; client <= MaxClients; client++)
|
|
||||||
{
|
|
||||||
if (!IsClientInGame(client) || IsFakeClient(client))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch(GetClientTeam(client))
|
|
||||||
{
|
|
||||||
case(2): iZombies[iZombiesCount++] = client;
|
|
||||||
case(3): iHumans[iHumansCount++] = client;
|
|
||||||
default: iSpecs[iSpecsCount++] = client;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char sZombieHUD[255];
|
|
||||||
char sHumanHUD[255];
|
|
||||||
char sSpecHUD[255];
|
|
||||||
|
|
||||||
for (int index; index < EW_GetItemCount(); index++)
|
for (int index; index < EW_GetItemCount(); index++)
|
||||||
{
|
{
|
||||||
@ -67,32 +44,32 @@ public Action OnDisplayHUD(Handle timer)
|
|||||||
|
|
||||||
if (item.bClient && item.dConfig.bDisplayInterface)
|
if (item.bClient && item.dConfig.bDisplayInterface)
|
||||||
{
|
{
|
||||||
char sLine[64];
|
|
||||||
char sShort[32];
|
char sShort[32];
|
||||||
item.dConfig.GetShort(sShort, sizeof(sShort));
|
item.dConfig.GetShort(sShort, sizeof(sShort));
|
||||||
|
|
||||||
|
char sLine[96];
|
||||||
switch(item.dConfig.iMode)
|
switch(item.dConfig.iMode)
|
||||||
{
|
{
|
||||||
case MODE_COOLDOWN:
|
case MODE_COOLDOWN:
|
||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "R", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "R", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_MAXUSES:
|
case MODE_MAXUSES:
|
||||||
{
|
{
|
||||||
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_COOLDOWNMAXUSES:
|
case MODE_COOLDOWNMAXUSES:
|
||||||
@ -101,32 +78,32 @@ public Action OnDisplayHUD(Handle timer)
|
|||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_COOLDOWNCHARGES:
|
case MODE_COOLDOWNCHARGES:
|
||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "N/A", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "N/A", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,39 +111,63 @@ public Action OnDisplayHUD(Handle timer)
|
|||||||
{
|
{
|
||||||
case(2):
|
case(2):
|
||||||
{
|
{
|
||||||
if (strlen(sZombieHUD) + strlen(sLine) < sizeof(sZombieHUD))
|
if (strlen(sHUDPanels[1][iHUDPages[1]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[1]++;
|
||||||
{
|
|
||||||
StrCat(sZombieHUD, sizeof(sZombieHUD), sLine);
|
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), sLine);
|
||||||
}
|
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), "\n");
|
||||||
}
|
}
|
||||||
case(3):
|
case(3):
|
||||||
{
|
{
|
||||||
if (strlen(sHumanHUD) + strlen(sLine) < sizeof(sHumanHUD))
|
if (strlen(sHUDPanels[2][iHUDPages[2]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[2]++;
|
||||||
|
|
||||||
|
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), sLine);
|
||||||
|
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(sHUDPanels[0][iHUDPages[0]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[0]++;
|
||||||
|
|
||||||
|
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), sLine);
|
||||||
|
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int iPageUpdate;
|
||||||
|
static int iPageCurrent[3];
|
||||||
|
|
||||||
|
if (iPageUpdate >= 5)
|
||||||
{
|
{
|
||||||
StrCat(sHumanHUD, sizeof(sHumanHUD), sLine);
|
for (int iPageID; iPageID < 3; iPageID++)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen(sSpecHUD) + strlen(sLine) < sizeof(sSpecHUD))
|
|
||||||
{
|
{
|
||||||
StrCat(sSpecHUD, sizeof(sSpecHUD), sLine);
|
if (iPageCurrent[iPageID] >= iHUDPages[iPageID])
|
||||||
}
|
iPageCurrent[iPageID] = 0;
|
||||||
}
|
else
|
||||||
|
iPageCurrent[iPageID]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle hZombieMessage = StartMessage("KeyHintText", iZombies, iZombiesCount);
|
iPageUpdate = 0;
|
||||||
BfWriteByte(hZombieMessage, 1);
|
}
|
||||||
BfWriteString(hZombieMessage, sZombieHUD);
|
else
|
||||||
EndMessage();
|
iPageUpdate++;
|
||||||
|
|
||||||
Handle hHumanMessage = StartMessage("KeyHintText", iHumans, iHumansCount);
|
for (int client = 1; client <= MaxClients; client++)
|
||||||
BfWriteByte(hHumanMessage, 1);
|
{
|
||||||
BfWriteString(hHumanMessage, sHumanHUD);
|
if (!IsClientInGame(client) || IsFakeClient(client))
|
||||||
EndMessage();
|
continue;
|
||||||
|
|
||||||
Handle hSpecMessage = StartMessage("KeyHintText", iSpecs, iSpecsCount);
|
int iPanelID;
|
||||||
BfWriteByte(hSpecMessage, 1);
|
switch(GetClientTeam(client))
|
||||||
BfWriteString(hSpecMessage, sSpecHUD);
|
{
|
||||||
|
case(2): iPanelID = 1;
|
||||||
|
case(3): iPanelID = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sHUDPanels[iPanelID][iPageCurrent[iPanelID]][0])
|
||||||
|
{
|
||||||
|
Handle hMessage = StartMessageOne("KeyHintText", client);
|
||||||
|
BfWriteByte(hMessage, 1);
|
||||||
|
BfWriteString(hMessage, sHUDPanels[iPanelID][iPageCurrent[iPanelID]]);
|
||||||
EndMessage();
|
EndMessage();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user