// Radar (#6)
//
- void HUD_Radar_Show_Maximized(float show,float clickable)
+
+float HUD_Radar_Clickable()
+{
+ return hud_panel_radar_mouse && !hud_panel_radar_temp_hidden;
+}
+
- hud_panel_radar_maximized = show;
++void HUD_Radar_Show_Maximized(bool doshow,float clickable)
+{
- if ( show )
++ hud_panel_radar_maximized = doshow;
+ hud_panel_radar_temp_hidden = 0;
+
++ if ( doshow )
+ {
+ if (clickable)
+ {
+ if(autocvar_hud_cursormode)
+ setcursormode(1);
+ hud_panel_radar_mouse = 1;
+ }
+ }
+ else if ( hud_panel_radar_mouse )
+ {
+ hud_panel_radar_mouse = 0;
+ mouseClicked = 0;
+ if(autocvar_hud_cursormode)
+ if(!mv_active)
+ setcursormode(0);
+ }
+}
+void HUD_Radar_Hide_Maximized()
+{
+ HUD_Radar_Show_Maximized(false,false);
+}
+
+
+float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
+{
+ if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
+ autocvar__hud_configure || mv_active)
+ return false;
+
+ if(bInputType == 3)
+ {
+ mousepos_x = nPrimary;
+ mousepos_y = nSecondary;
+ return true;
+ }
+
+ if(nPrimary == K_MOUSE1)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE1;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE1);
+ }
+ else if(nPrimary == K_MOUSE2)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE2;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE2);
+ }
+ else if ( nPrimary == K_ESCAPE && bInputType == 0 )
+ {
+ HUD_Radar_Hide_Maximized();
+ }
+ else
+ {
+ // allow console/use binds to work without hiding the map
+ string con_keys;
+ float keys;
+ float i;
+ con_keys = strcat(findkeysforcommand("toggleconsole", 0)," ",findkeysforcommand("+use", 0)) ;
+ keys = tokenize(con_keys); // findkeysforcommand returns data for this
+ for (i = 0; i < keys; ++i)
+ {
+ if(nPrimary == stof(argv(i)))
+ return false;
+ }
+
+ if ( getstati(STAT_HEALTH) <= 0 )
+ {
+ // Show scoreboard
+ if ( bInputType < 2 )
+ {
+ con_keys = findkeysforcommand("+showscores", 0);
+ keys = tokenize(con_keys);
+ for (i = 0; i < keys; ++i)
+ {
+ if ( nPrimary == stof(argv(i)) )
+ {
+ hud_panel_radar_temp_hidden = bInputType == 0;
+ return false;
+ }
+ }
+ }
+ }
+ else if ( bInputType == 0 )
+ HUD_Radar_Hide_Maximized();
+
+ return false;
+ }
+
+ return true;
+}
+
+void HUD_Radar_Mouse()
+{
+ if ( !hud_panel_radar_mouse ) return;
+ if(mv_active) return;
+
+ if ( intermission )
+ {
+ HUD_Radar_Hide_Maximized();
+ return;
+ }
+
+ if(mouseClicked & S_MOUSE2)
+ {
+ HUD_Radar_Hide_Maximized();
+ return;
+ }
+
+ if(!autocvar_hud_cursormode)
+ {
+ mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
+
+ mousepos_x = bound(0, mousepos_x, vid_conwidth);
+ mousepos_y = bound(0, mousepos_y, vid_conheight);
+ }
+
+ HUD_Panel_UpdateCvars();
+
+
+ panel_size = autocvar_hud_panel_radar_maximized_size;
+ panel_size_x = bound(0.2, panel_size_x, 1) * vid_conwidth;
+ panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight;
+ panel_pos_x = (vid_conwidth - panel_size_x) / 2;
+ panel_pos_y = (vid_conheight - panel_size_y) / 2;
+
+ if(mouseClicked & S_MOUSE1)
+ {
+ // click outside
+ if ( mousepos_x < panel_pos_x || mousepos_x > panel_pos_x + panel_size_x ||
+ mousepos_y < panel_pos_y || mousepos_y > panel_pos_y + panel_size_y )
+ {
+ HUD_Radar_Hide_Maximized();
+ return;
+ }
+ vector pos = teamradar_texcoord_to_3dcoord(teamradar_2dcoord_to_texcoord(mousepos),view_origin_z);
+ localcmd(sprintf("cmd ons_spawn %f %f %f",pos_x,pos_y,pos_z));
+
+ HUD_Radar_Hide_Maximized();
+ return;
+ }
+
+
+ const vector cursor_size = '32 32 0';
+ drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursor_size, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+}
+
void HUD_Radar(void)
{
+ if(intermission == 2) return;
if (!autocvar__hud_configure)
{
if (hud_panel_radar_maximized)
float spritelookupblinkvalue(string s)
{
+ if(substring(s, 0, 4) == "wpn-")
+ if(get_weaponinfo(stof(substring(s, 4, strlen(s)))).spawnflags & WEP_FLAG_SUPERWEAPON)
+ return 2;
+
switch(s)
{
- case "ons-cp-atck-neut": return 2;
- case "ons-cp-atck-red": return 2;
- case "ons-cp-atck-blue": return 2;
- case "ons-cp-dfnd-red": return 0.5;
- case "ons-cp-dfnd-blue": return 0.5;
+ case "ons-cp-atck": return 2;
+ case "ons-cp-dfnd": return 0.5;
+ case "item_health_mega": return 2;
+ case "item_armor_large": return 2;
case "item-invis": return 2;
case "item-extralife": return 2;
case "item-speed": return 2;
case "keycarrier-red": return _("Key carrier");
case "keycarrier-yellow": return _("Key carrier");
case "redbase": return _("Red base");
+ case "yellowbase": return _("Yellow base");
+ case "neutralbase": return _("White base");
+ case "pinkbase": return _("Pink base");
case "waypoint": return _("Waypoint");
- case "ons-gen-red": return _("Generator");
- case "ons-gen-blue": return _("Generator");
+ case "ons-gen": return _("Generator");
case "ons-gen-shielded": return _("Generator");
- case "ons-cp-neut": return _("Control point");
- case "ons-cp-red": return _("Control point");
- case "ons-cp-blue": return _("Control point");
- case "ons-cp-atck-neut": return _("Control point");
- case "ons-cp-atck-red": return _("Control point");
- case "ons-cp-atck-blue": return _("Control point");
- case "ons-cp-dfnd-red": return _("Control point");
- case "ons-cp-dfnd-blue": return _("Control point");
+ case "ons-cp": return _("Control point");
+ case "ons-cp-atck": return _("Control point");
+ case "ons-cp-dfnd": return _("Control point");
case "race-checkpoint": return _("Checkpoint");
case "race-finish": return _("Finish");
case "race-start": return _("Start");
const int STAT_OK_AMMO_CHARGEPOOL = 86;
const int STAT_FROZEN = 87;
const int STAT_REVIVE_PROGRESS = 88;
- const int STAT_ROUNDLOST = 89;
- // 90 empty?
- // 91 empty?
- // 92 empty?
- // 93 empty?
- // 94 empty?
- // 95 empty?
- // 96 empty?
- // 97 empty?
- // 98 empty?
- // 99 empty?
-
+ const int STAT_ARMOR_LARGE_TIME = 89;
+ const int STAT_HEALTH_MEGA_TIME = 90;
+ const int STAT_INVISIBLE_TIME = 91;
+ const int STAT_SPEED_TIME = 92;
+ const int STAT_EXTRALIFE_TIME = 93;
+ const int STAT_STRENGTH_TIME = 94;
+ const int STAT_SHIELD_TIME = 95;
+ const int STAT_FUELREGEN_TIME = 96;
+ const int STAT_JETPACK_TIME = 97;
+ const int STAT_SUPERWEAPONS_TIME = 98;
-// 99 empty?
++const int STAT_ROUNDLOST = 99;
/* The following stats change depending on the gamemode, so can share the same ID */
// IDs 100 to 104 reserved for gamemodes