return rgb;\r
}\r
\r
-void Sbar_DrawPic(string pic, vector position, vector dimensions, float background)\r
+vector Sbar_ConvertToScreen_PicScale(vector dimensions)\r
{\r
- vector pos, sz;\r
+ vector sz;\r
sz_x = vid_conwidth * dimensions_x;\r
sz_y = vid_conheight * dimensions_y;\r
+ return sz;\r
+}\r
+vector Sbar_ConvertToScreen_PicPosition(vector position, vector dimensions)\r
+{\r
+ vector pos, sz;\r
+ sz = Sbar_ConvertToScreen_PicScale(dimensions);\r
pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
pos_x -= sz_x / 2;\r
pos_y = (vid_conheight / 2) * bound(0, 1 - position_y, 2);\r
pos_y -= sz_y / 2;\r
+ return pos;\r
+}\r
+vector Sbar_ConvertToScreen_TextPosition(string text, vector position, float lettersize)\r
+{\r
+ vector pos, sz;\r
+ sz_x = sz_y = lettersize;\r
+ pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
+ pos_x -= stringwidth(text, FALSE, sz) * 0.5;\r
+ pos_y = (vid_conheight / 2) * bound(0, 1 - position_y, 2);\r
+ pos_y -= sz_y / 2;\r
+ return pos;\r
+}\r
+\r
+void Sbar_DrawPic(string pic, vector position, vector dimensions, float background)\r
+{\r
+ vector pos, sz;\r
+ pos = Sbar_ConvertToScreen_PicPosition(position, dimensions);\r
+ sz = Sbar_ConvertToScreen_PicScale(dimensions);\r
\r
if(background)\r
{\r
void Sbar_DrawString(string text, vector position, float lettersize)\r
{\r
vector pos, sz;\r
+ pos = Sbar_ConvertToScreen_TextPosition(text, position, lettersize);\r
sz_x = sz_y = lettersize;\r
- pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
- pos_x -= stringwidth(text, FALSE, sz) * 0.5;\r
- pos_y = (vid_conheight / 2) * bound(0, 1 - position_y, 2);\r
- pos_y -= sz_y / 2;\r
\r
drawstring(pos, text, sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
final_num = strcat(final_num, str);\r
\r
vector pos, sz;\r
+ pos = Sbar_ConvertToScreen_TextPosition(final_num, position, lettersize);\r
sz_x = sz_y = lettersize;\r
- pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
- pos_x -= stringwidth(final_num, FALSE, sz) * 0.5;\r
- pos_y = (vid_conheight / 2) * bound(0, 1 - position_y, 2);\r
- pos_y -= sz_y / 2;\r
\r
drawstring(pos, final_num, sz, rgb, alpha, dflags);\r
}\r
//return "error";\r
}\r
\r
+vector Sbar_GetVoreColor()\r
+{\r
+ // gets color based on vore status\r
+ if(getstati(STAT_VORE_EATEN))\r
+ {\r
+ if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team\r
+ return stov(cvar_string("sbar_stomachboard_color2"));\r
+ else\r
+ return stov(cvar_string("sbar_stomachboard_color3"));\r
+ }\r
+ else\r
+ return stov(cvar_string("sbar_stomachboard_color1"));\r
+}\r
+\r
+vector colorfade_current;\r
+vector Sbar_ColorFade(vector target_color)\r
+{\r
+ local float step;\r
+ step = cvar("sbar_stomachboard_status_fade") * frametime;\r
+\r
+ if(colorfade_current_x >= target_color_x + step)\r
+ colorfade_current_x -= step;\r
+ else if(colorfade_current_x <= target_color_x - step)\r
+ colorfade_current_x += step;\r
+\r
+ if(colorfade_current_y >= target_color_y + step)\r
+ colorfade_current_y -= step;\r
+ else if(colorfade_current_y <= target_color_y - step)\r
+ colorfade_current_y += step;\r
+\r
+ if(colorfade_current_z >= target_color_z + step)\r
+ colorfade_current_z -= step;\r
+ else if(colorfade_current_z <= target_color_z - step)\r
+ colorfade_current_z += step;\r
+\r
+ return colorfade_current;\r
+}\r
+\r
float xmin, xmax, ymin, ymax, sbwidth;\r
float sbar_fixscoreboardcolumnwidth_len;\r
float sbar_fixscoreboardcolumnwidth_iconlen;\r
}\r
}\r
\r
-float fieldcounter;\r
void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions)\r
{\r
// lists all players in the stomach\r
\r
string str;\r
float f, field, field_number;\r
- vector hl_color;\r
field_number = 3; // the number of components each row has\r
\r
- // center defined position on the x axis\r
- position_x -= dimensions_x / 2;\r
+ position = Sbar_ConvertToScreen_PicPosition(position, dimensions);\r
+ dimensions = Sbar_ConvertToScreen_PicScale(dimensions);\r
\r
// set font size to the height of each entry\r
vector font_sz;\r
font_sz_x = font_sz_y = dimensions_y;\r
\r
+ float fieldcounter;\r
for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
{\r
vector pos, sz;\r
pos = position;\r
sz = dimensions;\r
\r
- if(getstati(STAT_VORE_EATEN))\r
- {\r
- if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team\r
- hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
- else\r
- hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
- }\r
- else\r
- hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
- drawfill(pos, sz, hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ drawfill(pos, sz, Sbar_ColorFade(Sbar_GetVoreColor()), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
if(field == ST_NAME) {\r
}\r
}\r
\r
-float fieldcounter2;\r
void Sbar_PrintStomachboardItemPred(entity pl, vector position, vector dimensions)\r
{\r
// shows the name of our predator\r
\r
string str;\r
float f, field, field_number;\r
- vector hl_color;\r
field_number = 2; // the number of components each row has\r
\r
- // center defined position on the x axis\r
- position_x -= dimensions_x / 2;\r
+ position = Sbar_ConvertToScreen_PicPosition(position, dimensions);\r
+ dimensions = Sbar_ConvertToScreen_PicScale(dimensions);\r
\r
// set font size to the height of each entry\r
vector font_sz;\r
font_sz_x = font_sz_y = dimensions_y;\r
\r
- for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2)\r
+ float fieldcounter;\r
+ for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
{\r
vector pos, sz;\r
- field = -fieldcounter2;\r
+ field = -fieldcounter;\r
str = Sbar_GetStomachFieldPred(pl, field);\r
\r
// row highlighting\r
pos = position;\r
sz = dimensions;\r
\r
- if(getstati(STAT_VORE_EATEN))\r
- {\r
- if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team\r
- hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
- else\r
- hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
- }\r
- else\r
- hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
- drawfill(pos, sz, hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ drawfill(pos, sz, Sbar_ColorFade(Sbar_GetVoreColor()), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
if(field == STP_NAME) {\r
float vote_alpha;\r
float vote_change; // "time" when vote_active changed\r
\r
-vector stomachstatus_colorfade_current;\r
-vector StomachStatus_ColorFade(vector target_color)\r
-{\r
- local float step;\r
- step = cvar("sbar_stomachboard_status_fade") * frametime;\r
-\r
- if(stomachstatus_colorfade_current_x >= target_color_x + step)\r
- stomachstatus_colorfade_current_x -= step;\r
- else if(stomachstatus_colorfade_current_x <= target_color_x - step)\r
- stomachstatus_colorfade_current_x += step;\r
-\r
- if(stomachstatus_colorfade_current_y >= target_color_y + step)\r
- stomachstatus_colorfade_current_y -= step;\r
- else if(stomachstatus_colorfade_current_y <= target_color_y - step)\r
- stomachstatus_colorfade_current_y += step;\r
-\r
- if(stomachstatus_colorfade_current_z >= target_color_z + step)\r
- stomachstatus_colorfade_current_z -= step;\r
- else if(stomachstatus_colorfade_current_z <= target_color_z - step)\r
- stomachstatus_colorfade_current_z += step;\r
-\r
- return stomachstatus_colorfade_current;\r
-}\r
-\r
void Sbar_Draw (void)\r
{\r
// vectors for top right, bottom right, bottom and bottom left corners\r
\r
Sbar_Reset();\r
\r
- StomachStatus_ColorFade('0 0 0');\r
+ Sbar_ColorFade('0 0 0');\r
}\r
else\r
{\r
}\r
}\r
\r
- vector hl_color;\r
- string hl_string;\r
- if(getstati(STAT_VORE_EATEN))\r
- {\r
- if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team\r
- hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
- else\r
- hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
- hl_string = "predator:";\r
- }\r
- else\r
- {\r
- hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
- hl_string = "self:";\r
- }\r
- drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(hl_color), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(bottomleft - '-80 173 0', hl_string, '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', Sbar_ColorFade(Sbar_GetVoreColor()), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
\r
float stomach_load, stomach_maxload; // shows the predator's stomach load when we are eaten, and ours otherwise\r
stomach_load = getstati(STAT_VORE_LOAD);\r
hud_total_prey = 0;\r
pos = stov(cvar_string("hud_item_preylist_position"));\r
vector sz = stov(cvar_string("hud_item_preylist_scale"));\r
+ vector dir = stov(cvar_string("hud_item_preylist_entry_spacing")) * 2;\r
for(pl = players.sort_next; pl; pl = pl.sort_next)\r
{\r
if(pl.team == COLOR_SPECTATOR)\r
\r
if(f)\r
{\r
- if(l < cvar("hud_item_preylist_entries")) // limit the stomach board to the given number of entries\r
+ if(l < cvar("hud_item_preylist_entry_number")) // limit the stomach board to the given number of entries\r
{\r
Sbar_PrintStomachboardItem(pl, pos, sz);\r
\r
- // advance y position for each entry\r
- pos_y += sz_y * cvar("hud_item_preylist_spacing");\r
+ // advance position for each entry\r
+ pos_x += sz_x * dir_x;\r
+ pos_y += sz_y * dir_y;\r
l += 1;\r
}\r
++hud_total_prey;\r