+++ /dev/null
-#ifdef CTF_EXAMPLE
-
-// NOTE: This file contains lots of debugging stuff
-// it is not really used... can be seen as another sample...
-
-string STR_PLAYER = "player";
-#define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
-
-string ctf_temp_1;
-float order_page;
-
-void menu_close()
-{
- menu_visible = false;
- menu_show = menu_show_error;
- menu_action = menu_sub_null;
-
- /*if(ctf_temp_1)
- strunzone(ctf_temp_1);*/
-
- localcmd("\nin_bindmap 0 0;");
-}
-
-void order_menu_render()
-{
- vector ps, po;
- float i, p, n;
- string frags, color;
- ps = '0 200 0';
- po = '0 8 0';
-
- color = getplayerkeyvalue(player_localentnum-1, "topcolor");
-
- if(getstati(STAT_CTF_STATE) == CTF_STATE_COMMANDER) {
- drawstring(ps, _("----- Order Menu -----"), '8 8 0', '1 1 0', 1, 0); ps += po;
- drawstring(ps, sprintf(_("Order: %s"), ctf_temp_1), '8 8 0', '1 1 0', 1, 0); ps += po;
- drawcolorcodedstring(ps, _("1) ^3previous page"), '8 8 0', 1, 0); ps += po;
- drawcolorcodedstring(ps, _("2) ^3next page"), '8 8 0', 1, 0); ps += po;
- for((n = 2), (p = i = 0); i < maxclients && n > 0; ++i) {
- frags = getplayerkeyvalue(i, "frags");
- if(!frags || (i+1) == player_localentnum)
- continue;
- if(frags == "-666" || getplayerkeyvalue(i, "topcolor") != color) // FIXME use GetPlayerTeam
- continue;
- ++p;
- if(p > (8*order_page))
- {
- // only render current page
- ++n;
- if(n == 10)
- n = 0;
- drawcolorcodedstring(ps, strcat(ftos(n), ") ", GetPlayerName(i), " : ", ftos(getstatf(STAT_CTF_STATE))), '8 8 0', 1, 0); ps += po;
- }
- }
- drawstring(ps, _("ESC) Exit Menu"), '8 8 0', '1 1 0', 1, 0); ps += po;
- } else {
- menu_close();
- }
-}
-
-float order_menu_action(float bInputType, float nPrimary, float nSecondary)
-{
- string arg;
- float p, i, n, chose;
- string frags, color;
- if(bInputType != 0) // key down wanted
- return FALSE;
-
- arg = chr2str(nSecondary);
- chose = stof(chr2str(nPrimary));
- //str2chr
- if(arg == "1") {
- color = getplayerkeyvalue(player_localentnum-1, "topcolor");
- ++order_page;
- for(p = i = 0; i < maxclients; ++i) {
- frags = getplayerkeyvalue(i, "frags");
- if(!frags || (i+1) == player_localentnum)
- continue;
- if(frags == "-666" || getplayerkeyvalue(i, "topcolor") != color) // FIXME use GetPlayerTeam
- continue;
- ++p;
- }
- if(p <= (8*order_page)) // no ppl on page
- order_page = 0;
- } else if(arg == "2") {
- color = getplayerkeyvalue(player_localentnum-1, "topcolor");
- --order_page;
- if(order_page < 0) {
- for(p = i = 0; i < maxclients; ++i) {
- frags = getplayerkeyvalue(i, "frags");
- if(!frags || (i+1) == player_localentnum)
- continue;
- if(frags == "-666" || getplayerkeyvalue(i, "topcolor") != color) // FIXME use GetPlayerTeam
- continue;
- ++p;
- }
- order_page = floor(p/8);
- }
- } else if(chose >= 3 && chose <= 9 || arg == "0") { // the 10 needs extra checking, assuming that stof(astring) returns 0
- if(chose == 0)
- chose = 10;
- n = 2;
- color = getplayerkeyvalue(player_localentnum-1, "topcolor");
- for(p = i = 0; i < maxclients && n > 0; ++i) {
- frags = getplayerkeyvalue(i, "frags");
- if(!frags || (i+1) == player_localentnum)
- continue;
- if(frags == "-666" || getplayerkeyvalue(i, "topcolor") != color) // FIXME use GetPlayerTeam
- continue;
- ++p;
- if(p > (8*order_page))
- {
- // only render current page
- ++n;
- if(n == chose) {
- n = 0;
- break;
- }
- }
- }
- if(n == 0) {
- //print(sprintf(_("Issuing order to: %d\n"), i+1));
- //print(strcat("cmd order #", ftos(i+1), " ", ctf_temp_1, ";\n"));
- localcmd(strcat("\ncmd order #", ftos(i+1), " ", ctf_temp_1, ";"));
- } else {
- print(sprintf(_("Couldn't find player %d\n"), chose));
- }
- return TRUE;
- } else if(nSecondary == K_ESCAPE) {
- strunzone(ctf_temp_1);
- menu_close();
- } else {
- //print(sprintf(_("Menu action %s does not exist.\n"), arg));
- return FALSE;
- }
- return TRUE;
-}
-
-void order_menu_show()
-{
- order_page = 0;
- menu_show = order_menu_render;
- menu_action = order_menu_action;
-}
-
-
-void ctf_menu_render()
-{
- vector ps, po;
- ps = '0 200 0';
- po = '0 8 0';
-
- if(getstati(STAT_CTF_STATE) == CTF_STATE_COMMANDER) {
- drawstring(ps, _("----- Command Menu -----"), '8 8 0', '1 1 0', 1, 0); ps += po;
- drawstring(ps, _("Issue orders:"), '8 8 0', '1 1 0', 1, 0); ps += po;
- drawstring(ps, _(" 1) Attack"), '8 8 0', '1 1 0', 1, 0);
- drawstring(ps + '80 0 0', " \x0F", '8 8 0', '1 1 1', 1, 0); ps += po;
- drawstring(ps, strcat(_(" 2) Defend"), " \x0E"), '8 8 0', '1 1 0', 1, 0); ps += po;
- ps += po;
- drawstring(ps, _("3) Resign from command."), '8 8 0', '1 1 0', 1, 0); ps += po;
- drawstring(ps, _("ESC) Exit Menu"), '8 8 0', '1 1 0', 1, 0); ps += po;
- } else {
- menu_close();
- }
-}
-
-float ctf_menu_action(float bInputType, float nPrimary, float nSecondary)
-{
- string arg;
- if(bInputType != 0) // key down wanted
- return FALSE;
-
- arg = chr2str(nSecondary);
-
- if(arg == "1") {
- ctf_temp_1 = strzone("attack");
- order_menu_show();
- } else if(arg == "2") {
- ctf_temp_1 = strzone("defend");
- order_menu_show();
- } else if(arg == "3") {
- localcmd("\ncmd order resign;");
- menu_close();
- } else if(nSecondary == K_ESCAPE) {
- menu_close();
- } else {
- //print(strcat("Menu action ", arg, " does not exist.\n"));
- return FALSE;
- }
- return TRUE;
-}
-
-void ctf_menu_show()
-{
- if(getstati(STAT_CTF_STATE) < 0)
- return;
- menu_show = ctf_menu_render;
- menu_action = ctf_menu_action;
- menu_visible = TRUE;
- //menu_default_binds();
-}
-
-void ctf_view()
-{
- float stat;
- stat = getstati(STAT_CTF_STATE);
- if(stat == CTF_STATE_ATTACK) {
- drawpic('0 0 0', "gfx/ctf_ic_atk.tga", '64 64 0', '1 1 1', 1, 0);
- } else if(stat == CTF_STATE_DEFEND) {
- drawpic('0 0 0', "gfx/ctf_ic_def.tga", '64 64 0', '1 1 1', 1, 0);
- } else if(stat == CTF_STATE_COMMANDER) {
- drawstring('0 0 0', _("You're commander!"), '8 8 0', '1 1 1', 1, 0);
- } else if(stat < 0) {
- } else {
- drawstring('0 0 0', _("Awaiting orders..."), '8 8 0', '1 1 1', 0.5, 0);
- }
-}
-
-#endif
string sign;
vector distribution_color;
entity tm, pl, me;
+#ifdef COMPAT_XON050_ENGINE
me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
+#else
+ me = playerslots[player_localentnum - 1];
+#endif
if((scores_flags[ps_primary] & SFL_TIME) && !teamplay) { // race/cts record display on HUD
string timer, distrtimer;
{
mod_active = 1; // race should never hide the mod icons panel
entity me;
- me = playerslots[player_localentnum - 1];
+ me = playerslots[player_localnum];
float t, score;
float f; // yet another function has this
score = me.(scores[ps_primary]);
drawcolorcodedstring_aspect(namepos, s, '1 0.2 0' * squareSize, panel_fg_alpha * a, DRAWFLAG_NORMAL);
drawstring_aspect(rankpos, rankname, '1 0.15 0' * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
} else if(race_status == 2) {
- if(race_status_name == GetPlayerName(player_localentnum -1) || !race_myrank || race_myrank < rank)
+ if(race_status_name == GetPlayerName(player_localnum) || !race_myrank || race_myrank < rank)
drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newrankgreen", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
else
drawpic_aspect_skin(medalPos + '0.1 0 0' * squareSize, "race_newrankyellow", '1 1 0' * 0.8 * squareSize, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
if(spectatee_status == -1)
s = _("^1Observing");
else
+#ifdef COMPAT_XON050_ENGINE
s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(spectatee_status - 1));
+#else
+ s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(player_localentnum - 1));
+#endif
drawInfoMessage(s)
if(spectatee_status == -1)
else if(gametype == GAME_LMS)
{
entity sk;
- sk = playerslots[player_localentnum - 1];
+ sk = playerslots[player_localnum];
if(sk.(scores[ps_primary]) >= 666)
s = _("^1Match has already begun");
else if(sk.(scores[ps_primary]) > 0)
drawfill(eY * i * hud_configure_realGridSize_y, eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
}
+#ifdef COMPAT_XON050_ENGINE
current_player = (spectatee_status > 0) ? spectatee_status : player_localentnum;
+#else
+ current_player = player_localentnum;
+#endif
// draw the dock
if(autocvar_hud_dock != "" && autocvar_hud_dock != "0")
{
if(pl.team != tm.team)
continue;
- HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1), i);
+ HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), i);
pos_y += 1.25 * hud_fontsize_y;
++i;
}
{
if(pl.team == COLOR_SPECTATOR)
continue;
- HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1), i);
+ HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), i);
pos_y += 1.25 * hud_fontsize_y;
++i;
}
continue;
n = grecordholder[i];
p = race_PlaceName(i+1);
- if(grecordholder[i] == GetPlayerName(player_localentnum - 1))
+ if(grecordholder[i] == GetPlayerName(player_localnum))
drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
else if(!mod(i, 2) && scoreboard_highlight)
drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
if(pl.team != COLOR_SPECTATOR)
continue;
pos_y += 1.25 * hud_fontsize_y;
- HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1), specs);
+ HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), specs);
++specs;
}