GLOBAL void TP_Msg_Took_f (void) { extern cvar_t tp_name_lg, tp_name_rl, tp_name_gl, tp_name_sng, tp_name_backpack, tp_name_cells, tp_name_rockets, tp_name_mh, tp_name_ra, tp_name_ya, tp_name_ga, tp_name_flag, tp_name_rune1, tp_name_rune2, tp_name_rune3, tp_name_rune4; MSGPART took = ""; MSGPART at_location = " $[{%Y}$]"; // %Y is took location, remembers for 15 secs MSGPART powerup = ""; MSGPART took_msg = ""; if (TOOK_EMPTY()) return; if (TOOK(quad) || TOOK(pent) || TOOK(ring)) { TP_GetNeed(); if (DEAD()) { TP_Msg_QuadDead_f(); return; } // Note that we check if you are holding powerup. This is because TOOK remembers for 15 seconds. // So a case could arise where you took quad then died less than 15 seconds later, and you'd be reporting "team need %u" (because $colored_powerups would be empty) else if ((NEED(health) || NEED(armor) || NEED_WEAPON() || NEED(rockets) || NEED(cells)) && HAVE_POWERUP()) took = "{&c0b0team&cfff} $colored_powerups need %u"; else if (HAVE_QUAD() || HAVE_RING()) // notice we can't send this check to tp_msgenemypwr, because if enemy with powerup is in your view, tp_enemypwr reports enemypwr first, but in this function you want to report TEAM powerup. took = "{&c0b0team&cfff} $colored_powerups"; else { // In this case, you took quad or ring and died before 15 secs later. So just report what you need, nothing about powerups. took = "need %u"; //notice we don't say quad over, because it could be that you held ring. No way to distinguish } } else { if (TOOK(rl)) took = tp_name_rl.string; else if (TOOK(lg)) took = tp_name_lg.string; else if (TOOK(gl)) took = tp_name_gl.string; else if (TOOK(sng)) took = tp_name_sng.string; else if (TOOK(pack)) took = tp_name_backpack.string; else if (TOOK(cells)) took = tp_name_cells.string; else if (TOOK(rockets)) took = tp_name_rockets.string; else if (TOOK(mh)) took = tp_name_mh.string; else if (TOOK(ra)) took = tp_name_ra.string; else if (TOOK(ya)) took = tp_name_ya.string; else if (TOOK(ga)) took = tp_name_ga.string; else if (TOOK(flag)) took = tp_name_flag.string; else if (TOOK(rune1)) took = tp_name_rune1.string; else if (TOOK(rune2)) took = tp_name_rune2.string; else if (TOOK(rune3)) took = tp_name_rune3.string; else if (TOOK(rune4)) took = tp_name_rune4.string; else took = "{$took}"; // This should never happen took_msg = "took "; if (HAVE_POWERUP()) powerup = "$colored_powerups "; else powerup = ""; } TP_Send_TeamSay("%s%s%s%s", powerup, took_msg, took, at_location); }
GLOBAL void TP_Msg_Took_f (void) { MSGPART took = ""; MSGPART at_location = ""; MSGPART powerup = ""; MSGPART took_msg = ""; if (TOOK_EMPTY()) return; else if (TOOK(quad) || TOOK(pent) || TOOK(ring)) { TP_GetNeed(); if (NEED(health) || NEED(armor) || NEED_WEAPON() || NEED(rockets) || NEED(cells)) { took = tp_ib_name_team " $colored_powerups need %u"; } else { // notice we can't send this check to tp_msgenemypwr, that's because if enemy with powerup is in your view, tp_enemypwr reports enemypwr first, but in this function you want to report TEAM powerup. took = tp_ib_name_team " $colored_powerups"; } } else { if (TOOK(rl)) took = tp_ib_name_rl; else if (TOOK(lg)) took = tp_ib_name_lg; else if (TOOK(gl)) took = tp_ib_name_gl; else if (TOOK(sng)) took = tp_ib_name_sng; else if (TOOK(pack)) took = tp_ib_name_backpack; else if (TOOK(rockets) || TOOK(cells)) took = "{$took}"; else if (TOOK(mh)) took = tp_ib_name_mh; else if (TOOK(ra)) took = tp_ib_name_ra; else if (TOOK(ya)) took = tp_ib_name_ya; else if (TOOK(ga)) took = tp_ib_name_ga; else if (TOOK(flag)) took = tp_ib_name_flag; else if (TOOK(rune1)) took = "$tp_name_rune1"; else if (TOOK(rune2)) took = "$tp_name_rune2"; else if (TOOK(rune3)) took = "$tp_name_rune3"; else if (TOOK(rune4)) took = "$tp_name_rune4"; else took = "{$took}"; // This should never happen if (HAVE_POWERUP()) { powerup = "$colored_short_powerups "; } else { powerup = ""; } at_location = " $[{%Y}$]"; // %Y is "forgotten" macro - location of item you took took_msg = "took "; } TP_Send_TeamSay("%s%s%s%s", powerup, took_msg, took, at_location); }