Unify 3DS/PSP cl_hud.c

This commit is contained in:
cypress 2024-09-05 18:08:13 -07:00
parent 222c87a7b2
commit 14f8678ac1
6 changed files with 207 additions and 94 deletions

View file

@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl_hud.c -- status bar code // cl_hud.c -- status bar code
#include "quakedef.h" #include "quakedef.h"
#include <pspgu.h>
#ifdef PSP_VFPU #ifdef __PSP__
#include <pspgu.h>
#include <pspmath.h> #include <pspmath.h>
#endif #endif // __PSP__
qpic_t *sb_round[5]; qpic_t *sb_round[5];
qpic_t *sb_round_num[10]; qpic_t *sb_round_num[10];
@ -43,20 +43,34 @@ qpic_t *mulepic;
qpic_t *fragpic; qpic_t *fragpic;
qpic_t *bettypic; qpic_t *bettypic;
#ifdef __PSP__
qpic_t *b_circle; qpic_t *b_circle;
qpic_t *b_square; qpic_t *b_square;
qpic_t *b_cross; qpic_t *b_cross;
qpic_t *b_triangle; qpic_t *b_triangle;
#elif _3DS
qpic_t *b_abutton;
qpic_t *b_bbutton;
qpic_t *b_xbutton;
qpic_t *b_ybutton;
#endif // __PSP__
qpic_t *b_left; qpic_t *b_left;
qpic_t *b_right; qpic_t *b_right;
qpic_t *b_up; qpic_t *b_up;
qpic_t *b_down; qpic_t *b_down;
qpic_t *b_lt; qpic_t *b_lt;
qpic_t *b_rt; qpic_t *b_rt;
#ifdef __PSP__
qpic_t *b_home;
#elif _3DS
qpic_t *b_zlt;
qpic_t *b_zrt;
#endif // __PSP__, _3DS
qpic_t *b_start; qpic_t *b_start;
qpic_t *b_select; qpic_t *b_select;
qpic_t *b_home;
qpic_t *fx_blood_lu; qpic_t *fx_blood_lu;
qpic_t *fx_blood_ru; qpic_t *fx_blood_ru;
@ -145,6 +159,7 @@ void HUD_Init (void)
fragpic = Draw_CachePic ("gfx/hud/frag"); fragpic = Draw_CachePic ("gfx/hud/frag");
bettypic = Draw_CachePic ("gfx/hud/betty"); bettypic = Draw_CachePic ("gfx/hud/betty");
#ifdef __PSP__
b_circle = Draw_CachePic ("gfx/butticons/circle"); b_circle = Draw_CachePic ("gfx/butticons/circle");
b_square = Draw_CachePic ("gfx/butticons/square"); b_square = Draw_CachePic ("gfx/butticons/square");
b_cross = Draw_CachePic ("gfx/butticons/cross"); b_cross = Draw_CachePic ("gfx/butticons/cross");
@ -158,6 +173,22 @@ void HUD_Init (void)
b_start = Draw_CachePic ("gfx/butticons/start"); b_start = Draw_CachePic ("gfx/butticons/start");
b_select = Draw_CachePic ("gfx/butticons/select"); b_select = Draw_CachePic ("gfx/butticons/select");
b_home = Draw_CachePic ("gfx/butticons/home"); b_home = Draw_CachePic ("gfx/butticons/home");
#elif _3DS
b_abutton = Draw_CachePic ("gfx/butticons/facebt_a");
b_bbutton = Draw_CachePic ("gfx/butticons/facebt_b");
b_ybutton = Draw_CachePic ("gfx/butticons/facebt_y");
b_xbutton = Draw_CachePic ("gfx/butticons/facebt_x");
b_left = Draw_CachePic ("gfx/butticons/dir_left");
b_right = Draw_CachePic ("gfx/butticons/dir_right");
b_up = Draw_CachePic ("gfx/butticons/dir_up");
b_down = Draw_CachePic ("gfx/butticons/dir_down");
b_lt = Draw_CachePic ("gfx/butticons/shldr_l");
b_rt = Draw_CachePic ("gfx/butticons/shldr_r");
b_zlt = Draw_CachePic ("gfx/butticons/shldr_zl");
b_zrt = Draw_CachePic ("gfx/butticons/shldr_zr");
b_start = Draw_CachePic ("gfx/butticons/func_sta");
b_select = Draw_CachePic ("gfx/butticons/func_sel");
#endif // __PSP__, _3DS
fx_blood_lu = Draw_CachePic ("gfx/hud/blood"); fx_blood_lu = Draw_CachePic ("gfx/hud/blood");
@ -166,7 +197,9 @@ void HUD_Init (void)
fx_blood_ld = Draw_CachePic ("gfx/hud/blood_bl"); fx_blood_ld = Draw_CachePic ("gfx/hud/blood_bl");
fx_blood_rd = Draw_CachePic ("gfx/hud/blood_br");*/ fx_blood_rd = Draw_CachePic ("gfx/hud/blood_br");*/
#ifdef __PSP__
Achievement_Init(); Achievement_Init();
#endif // __PSP__
} }
/* /*
@ -374,7 +407,7 @@ void HUD_Points (void)
x = 6; x = 6;
y = 200; y = vid.height - 72;
for (i=0 ; i<l ; i++) for (i=0 ; i<l ; i++)
{ {
k = pointsort[i]; k = pointsort[i];
@ -489,11 +522,11 @@ void HUD_Blood (void)
if (alpha <= 0.0) if (alpha <= 0.0)
return; return;
#ifdef PSP_VFPU #ifdef PSP_VFPU
float modifier = (vfpu_sinf(cl.time * 10) * 20) - 20;//always negative float modifier = (vfpu_sinf(cl.time * 10) * 20) - 20;//always negative
#else #else
float modifier = (sin(cl.time * 10) * 20) - 20;//always negative float modifier = (sin(cl.time * 10) * 20) - 20;//always negative
#endif #endif // PSP_VFPU
if(modifier < -35.0) if(modifier < -35.0)
modifier = -35.0; modifier = -35.0;
@ -504,11 +537,7 @@ void HUD_Blood (void)
return; return;
float color = 255.0 + modifier; float color = 255.0 + modifier;
Draw_ColorPic(0,0,fx_blood_lu,color,color,color,alpha); Draw_ColoredStretchPic(0, 0, fx_blood_lu, vid.width, vid.height, color, color, color, alpha);
//Draw_ColorPic (0, 0, fx_blood_lu, 82, 6, 6, alpha);
/*Draw_ColorPic (0, vid.height - fx_blood_ru->height, fx_blood_ld, 82, 6, 6, alpha);
Draw_ColorPic (vid.width - fx_blood_ru->width, 0, fx_blood_ru, 82, 6, 6, alpha);
Draw_ColorPic (vid.width - fx_blood_ru->width, vid.height - fx_blood_ru->height, fx_blood_rd, 82, 6, 6, alpha);*/
} }
/* /*
@ -740,8 +769,8 @@ void HUD_Rounds (void)
round_center_y = round_center_y + 1; round_center_y = round_center_y + 1;
if (round_center_x <= 5) if (round_center_x <= 5)
round_center_x = 5; round_center_x = 5;
if (round_center_y >= 220) if (round_center_y >= vid.height - sb_round[0]->height - 2)
round_center_y = 220; round_center_y = vid.height - sb_round[0]->height - 2;
} }
else if (cl.stats[STAT_ROUNDCHANGE] == 3)//shift to white else if (cl.stats[STAT_ROUNDCHANGE] == 3)//shift to white
{ {
@ -1222,13 +1251,13 @@ void HUD_Powerups (void)
// both are avail draw fixed order // both are avail draw fixed order
if (count == 2) { if (count == 2) {
Draw_StretchPic(211, 242, x2pic, 28, 28); Draw_StretchPic((vid.width/2) - 27, vid.height - 29, x2pic, 26, 26);
Draw_StretchPic(240, 242, instapic, 28, 28); Draw_StretchPic((vid.width/2) + 3, vid.height - 29, instapic, 26, 26);
} else { } else {
if (cl.stats[STAT_X2]) if (cl.stats[STAT_X2])
Draw_StretchPic(226, 242, x2pic, 28, 28); Draw_StretchPic((vid.width/2) - 13, vid.height - 29, x2pic, 26, 26);
if(cl.stats[STAT_INSTA]) if(cl.stats[STAT_INSTA])
Draw_StretchPic (226, 242, instapic, 28, 28); Draw_StretchPic ((vid.width/2) - 13, vid.height - 29, instapic, 26, 26);
} }
} }
@ -1246,8 +1275,8 @@ void HUD_ProgressBar (void)
progressbar = 100 - ((cl.progress_bar-sv.time)*10); progressbar = 100 - ((cl.progress_bar-sv.time)*10);
if (progressbar >= 100) if (progressbar >= 100)
progressbar = 100; progressbar = 100;
Draw_FillByColor ((vid.width)/2 - 51, vid.height*0.75 - 1, 102, 5, GU_RGBA(0, 0, 0,100)); Draw_FillByColor ((vid.width)/2 - 51, vid.height*0.75 - 1, 102, 5, 0, 0, 0,100);
Draw_FillByColor ((vid.width)/2 - 50, vid.height*0.75, progressbar, 3, GU_RGBA(255, 255, 255,100)); Draw_FillByColor ((vid.width)/2 - 50, vid.height*0.75, progressbar, 3, 255, 255, 255,100);
Draw_String ((vid.width - (88))/2, vid.height*0.75 + 10, "Reviving..."); Draw_String ((vid.width - (88))/2, vid.height*0.75 + 10, "Reviving...");
} }
@ -1298,7 +1327,10 @@ void HUD_Parse_Achievement (int ach)
achievement_time = Sys_FloatTime() + 10; achievement_time = Sys_FloatTime() + 10;
ach_pic = ach; ach_pic = ach;
achievement_list[ach].unlocked = 1; achievement_list[ach].unlocked = 1;
#ifdef __PSP__
Save_Achivements(); Save_Achivements();
#endif // __PSP__
} }
/* /*
@ -1348,9 +1380,9 @@ void HUD_Ammo (void)
// //
magstring = va("%i", cl.stats[STAT_CURRENTMAG]); magstring = va("%i", cl.stats[STAT_CURRENTMAG]);
if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG]) { if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG]) {
Draw_ColoredString((422 -(reslen)) - getTextWidth(magstring, 1), 247, magstring, 255, 0, 0, 255, 1); Draw_ColoredString(((vid.width - 55) - (reslen)) - getTextWidth(magstring, 1), vid.height - 25, magstring, 255, 0, 0, 255, 1);
} else { } else {
Draw_ColoredString((422 -(reslen)) - getTextWidth(magstring, 1), 247, magstring, 255, 255, 255, 255, 1); Draw_ColoredString(((vid.width - 55) - (reslen)) - getTextWidth(magstring, 1), vid.height - 25, magstring, 255, 255, 255, 255, 1);
} }
// //
@ -1358,9 +1390,9 @@ void HUD_Ammo (void)
// //
magstring = va("/%i", cl.stats[STAT_AMMO]); magstring = va("/%i", cl.stats[STAT_AMMO]);
if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) { if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) {
Draw_ColoredString(422 - getTextWidth(magstring, 1), 247, magstring, 255, 0, 0, 255, 1); Draw_ColoredString((vid.width - 55) - getTextWidth(magstring, 1), vid.height - 25, magstring, 255, 0, 0, 255, 1);
} else { } else {
Draw_ColoredString(422 - getTextWidth(magstring, 1), 247, magstring, 255, 255, 255, 255, 1); Draw_ColoredString((vid.width - 55) - getTextWidth(magstring, 1), vid.height - 25, magstring, 255, 255, 255, 255, 1);
} }
// //
@ -1369,9 +1401,9 @@ void HUD_Ammo (void)
if (IsDualWeapon(cl.stats[STAT_ACTIVEWEAPON])) { if (IsDualWeapon(cl.stats[STAT_ACTIVEWEAPON])) {
magstring = va("%i", cl.stats[STAT_CURRENTMAG2]); magstring = va("%i", cl.stats[STAT_CURRENTMAG2]);
if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_CURRENTMAG2]) { if (GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_CURRENTMAG2]) {
Draw_ColoredString(388 - strlen(magstring)*8, 247, magstring, 255, 0, 0, 255, 1); Draw_ColoredString((vid.width - 89) - strlen(magstring)*8, vid.height - 25, magstring, 255, 0, 0, 255, 1);
} else { } else {
Draw_ColoredString(388 - strlen(magstring)*8, 247, magstring, 255, 255, 255, 255, 1); Draw_ColoredString((vid.width - 89) - strlen(magstring)*8, vid.height - 25, magstring, 255, 255, 255, 255, 1);
} }
} }
} }
@ -1389,11 +1421,11 @@ void HUD_AmmoString (void)
int x; int x;
if (0 < cl.stats[STAT_AMMO] && cl.stats[STAT_CURRENTMAG] >= 0) { if (0 < cl.stats[STAT_AMMO] && cl.stats[STAT_CURRENTMAG] >= 0) {
Draw_ColoredStringCentered(164, "Reload", 255, 255, 255, 255, 1); Draw_ColoredStringCentered(vid.height - 100, "Reload", 255, 255, 255, 255, 1);
} else if (0 < cl.stats[STAT_CURRENTMAG]) { } else if (0 < cl.stats[STAT_CURRENTMAG]) {
Draw_ColoredStringCentered(164, "LOW AMMO", 255, 255, 0, 255, 1); Draw_ColoredStringCentered(vid.height - 100, "LOW AMMO", 255, 255, 0, 255, 1);
} else { } else {
Draw_ColoredStringCentered(164, "NO AMMO", 255, 0, 0, 255, 1); Draw_ColoredStringCentered(vid.height - 100, "NO AMMO", 255, 0, 0, 255, 1);
} }
} }
} }
@ -1408,23 +1440,23 @@ HUD_Grenades
void HUD_Grenades (void) void HUD_Grenades (void)
{ {
Draw_StretchPic (427, 232, fragpic, 22, 22); Draw_StretchPic (vid.width - 53, vid.height - 40, fragpic, 22, 22);
if (cl.stats[STAT_GRENADES] & UI_FRAG) if (cl.stats[STAT_GRENADES] & UI_FRAG)
{ {
if (cl.stats[STAT_PRIGRENADES] <= 0) if (cl.stats[STAT_PRIGRENADES] <= 0)
Draw_ColoredString (440, 247, va ("%i",cl.stats[STAT_PRIGRENADES]), 255, 0, 0, 255, 1); Draw_ColoredString (vid.width - 40, vid.height - 25, va ("%i",cl.stats[STAT_PRIGRENADES]), 255, 0, 0, 255, 1);
else else
Draw_String (440, 247, va ("%i",cl.stats[STAT_PRIGRENADES])); Draw_String (vid.width - 40, vid.height - 25, va ("%i",cl.stats[STAT_PRIGRENADES]));
} }
if (cl.stats[STAT_GRENADES] & UI_BETTY) if (cl.stats[STAT_GRENADES] & UI_BETTY)
{ {
Draw_StretchPic (448, 233, bettypic, 22, 22); Draw_StretchPic (vid.width - 32, vid.height - 40, bettypic, 22, 22);
if (cl.stats[STAT_PRIGRENADES] <= 0) if (cl.stats[STAT_PRIGRENADES] <= 0)
Draw_ColoredString (463, 247, va ("%i",cl.stats[STAT_SECGRENADES]), 255, 0, 0, 255, 1); Draw_ColoredString (vid.width - 17, vid.height - 25, va ("%i",cl.stats[STAT_SECGRENADES]), 255, 0, 0, 255, 1);
else else
Draw_String (463, 247, va ("%i",cl.stats[STAT_SECGRENADES])); Draw_String (vid.width - 17, vid.height - 25, va ("%i",cl.stats[STAT_SECGRENADES]));
} }
} }
@ -1438,12 +1470,12 @@ void HUD_Weapon (void)
char str[32]; char str[32];
float l; float l;
x_value = vid.width; x_value = vid.width;
y_value = 234; y_value = vid.height - 40;
strcpy(str, pr_strings+sv_player->v.Weapon_Name); strcpy(str, pr_strings+sv_player->v.Weapon_Name);
l = strlen(str); l = strlen(str);
x_value = 422 - getTextWidth(str, 1); x_value = (vid.width - 58) - getTextWidth(str, 1);
Draw_String (x_value, y_value, str); Draw_String (x_value, y_value, str);
} }
@ -1454,6 +1486,8 @@ HUD_BettyPrompt
*/ */
void HUD_BettyPrompt (void) void HUD_BettyPrompt (void)
{ {
#ifdef __PSP__
char str[64]; char str[64];
char str2[32]; char str2[32];
@ -1466,11 +1500,26 @@ void HUD_BettyPrompt (void)
Draw_ColoredStringCentered(60, str, 255, 255, 255, 255, 1); Draw_ColoredStringCentered(60, str, 255, 255, 255, 255, 1);
Draw_ColoredStringCentered(70, str2, 255, 255, 255, 255, 1); Draw_ColoredStringCentered(70, str2, 255, 255, 255, 255, 1);
// Draw_Pic (x + 11*8, 60, GetButtonIcon("+use"));
// Draw_Pic (x + 25*8, 60, GetButtonIcon("+grenade"));
Draw_Pic (x + getTextWidth("Double-tap ", 1) - 4, 60, GetButtonIcon("+use")); Draw_Pic (x + getTextWidth("Double-tap ", 1) - 4, 60, GetButtonIcon("+use"));
Draw_Pic (x + getTextWidth("Double-tap then press ", 1) - 4, 60, GetButtonIcon("+grenade")); Draw_Pic (x + getTextWidth("Double-tap then press ", 1) - 4, 60, GetButtonIcon("+grenade"));
#elif _3DS
char str[32];
char str2[32];
strcpy(str, va("Tap SWAP then press %s to\n", GetGrenadeButtonL()));
strcpy(str2, "place a Bouncing Betty\n");
int x;
x = (vid.width - getTextWidth(str, 1))/2;
Draw_ColoredStringCentered(60, str, 255, 255, 255, 255, 1);
Draw_ColoredStringCentered(72, str2, 255, 255, 255, 255, 1);
Draw_Pic (x + getTextWidth("Tap SWAP then press ", 1) - 4, 56, GetButtonIcon("+grenade"));
#endif // __PSP__, _3DS
} }
/* /*
@ -1485,7 +1534,7 @@ void HUD_PlayerName (void)
if (nameprint_time - sv.time < 1) if (nameprint_time - sv.time < 1)
alpha = (int)((nameprint_time - sv.time)*255); alpha = (int)((nameprint_time - sv.time)*255);
Draw_ColoredString(70, 203, player_name, 255, 255, 255, alpha, 1); Draw_ColoredString(70, vid.height - 70, player_name, 255, 255, 255, alpha, 1);
} }
/* /*
@ -1521,7 +1570,7 @@ float invertfloat(float input) {
void HUD_Screenflash (void) void HUD_Screenflash (void)
{ {
ScePspRGBA8888 color; int r, g, b, a;
float flash_alpha; float flash_alpha;
double percentage_complete = screenflash_worktime / (screenflash_duration - screenflash_starttime); double percentage_complete = screenflash_worktime / (screenflash_duration - screenflash_starttime);
@ -1548,13 +1597,13 @@ void HUD_Screenflash (void)
// Obtain the flash color // Obtain the flash color
switch(screenflash_color) { switch(screenflash_color) {
case SCREENFLASH_COLOR_BLACK: color = GU_RGBA(0, 0, 0, (int)(flash_alpha * 255)); break; case SCREENFLASH_COLOR_BLACK: r = 0; g = 0; b = 0; a = (int)(flash_alpha * 255); break;
case SCREENFLASH_COLOR_WHITE: color = GU_RGBA(255, 255, 255, (int)(flash_alpha * 255)); break; case SCREENFLASH_COLOR_WHITE: r = 255; g = 255; b = 255; a = (int)(flash_alpha * 255); break;
default: color = GU_RGBA(255, 0, 0, 255); break; default: r = 255; g = 0; b = 0; a = 255; break;
} }
screenflash_worktime += host_frametime; screenflash_worktime += host_frametime;
Draw_FillByColor(0, 0, vid.width, vid.height, color); Draw_FillByColor(0, 0, vid.width, vid.height, r, g, b, a);
} }
/* /*

View file

@ -28,6 +28,7 @@ void Draw_Pic (int x, int y, qpic_t *pic);
void Draw_PicIndex (int x, int y, int width, int height, int texture_index); void Draw_PicIndex (int x, int y, int width, int height, int texture_index);
void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value); void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value);
void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a); void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a);
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, int r, int g, int b, int a);
void Draw_ColoredString (int x, int y, char *text, float r, float g, float b, float a, int scale); void Draw_ColoredString (int x, int y, char *text, float r, float g, float b, float a, int scale);
void Draw_ColoredStringCentered(int y, char *text, float r, float g, float b, float a, int scale); void Draw_ColoredStringCentered(int y, char *text, float r, float g, float b, float a, int scale);
void Draw_TransPic (int x, int y, qpic_t *pic); void Draw_TransPic (int x, int y, qpic_t *pic);
@ -36,7 +37,7 @@ void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha);
void Draw_ConsoleBackground (int lines); void Draw_ConsoleBackground (int lines);
void Draw_LoadingFill(void); void Draw_LoadingFill(void);
void Draw_Fill (int x, int y, int w, int h, int c); void Draw_Fill (int x, int y, int w, int h, int c);
void Draw_FillByColor (int x, int y, int w, int h, unsigned int c); void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a);
void Draw_FadeScreen (void); void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str); void Draw_String (int x, int y, char *str);
int getTextWidth(char *str, int scale); int getTextWidth(char *str, int scale);

View file

@ -452,7 +452,7 @@ static void M_Start_Menu_Draw ()
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
Draw_ColoredStringCentered(vid.height - 64, "Press Start", 255, 0, 0, 255, 1); Draw_ColoredStringCentered(vid.height - 64, "Press Start", 255, 0, 0, 255, 1);
} }
@ -487,7 +487,7 @@ void M_Paused_Menu_f ()
static void M_Paused_Menu_Draw () static void M_Paused_Menu_Draw ()
{ {
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "PAUSED", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "PAUSED", 255, 255, 255, 255, 2);
@ -596,7 +596,7 @@ void M_Main_Draw (void)
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Version String // Version String
Draw_ColoredString((vid.width - getTextWidth(game_build_date, 1)) + 4, 5, game_build_date, 255, 255, 255, 255, 1); Draw_ColoredString((vid.width - getTextWidth(game_build_date, 1)) + 4, 5, game_build_date, 255, 255, 255, 255, 1);
@ -615,7 +615,7 @@ void M_Main_Draw (void)
Draw_ColoredString(10, 55, "Co-Op (Coming Soon!)", 128, 128, 128, 255, 1); Draw_ColoredString(10, 55, "Co-Op (Coming Soon!)", 128, 128, 128, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 68, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 68, 160, 2, 130, 130, 130, 255);
if (m_main_cursor == 1) if (m_main_cursor == 1)
Draw_ColoredString(10, 75, "Settings", 255, 0, 0, 255, 1); Draw_ColoredString(10, 75, "Settings", 255, 0, 0, 255, 1);
@ -628,7 +628,7 @@ void M_Main_Draw (void)
Draw_ColoredString(10, 85, "Achievements", 255, 255, 255, 255, 1); Draw_ColoredString(10, 85, "Achievements", 255, 255, 255, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 98, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 98, 160, 2, 130, 130, 130, 255);
if (m_main_cursor == 3) if (m_main_cursor == 3)
Draw_ColoredString(10, 105, "Credits", 255, 0, 0, 255, 1); Draw_ColoredString(10, 105, "Credits", 255, 0, 0, 255, 1);
@ -636,7 +636,7 @@ void M_Main_Draw (void)
Draw_ColoredString(10, 105, "Credits", 255, 255, 255, 255, 1); Draw_ColoredString(10, 105, "Credits", 255, 255, 255, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 118, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 118, 160, 2, 130, 130, 130, 255);
if (m_main_cursor == 4) if (m_main_cursor == 4)
Draw_ColoredString(10, 125, "Exit", 255, 0, 0, 255, 1); Draw_ColoredString(10, 125, "Exit", 255, 0, 0, 255, 1);
@ -877,7 +877,7 @@ void M_Map_Draw (void)
Draw_PicIndex(0, 0, 480, 272, menu_bk); Draw_PicIndex(0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "CUSTOM MAPS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "CUSTOM MAPS", 255, 255, 255, 255, 2);
@ -1092,7 +1092,7 @@ void M_SinglePlayer_Draw (void)
Draw_PicIndex(0, 0, 480, 272, menu_bk); Draw_PicIndex(0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "SOLO", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "SOLO", 255, 255, 255, 255, 2);
@ -1104,7 +1104,7 @@ void M_SinglePlayer_Draw (void)
Draw_ColoredString(10, 45, "Nacht der Untoten", 255, 255, 255, 255, 1); Draw_ColoredString(10, 45, "Nacht der Untoten", 255, 255, 255, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 58, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 58, 160, 2, 130, 130, 130, 255);
// Warehouse // Warehouse
if (m_singleplayer_cursor == 1) if (m_singleplayer_cursor == 1)
@ -1125,7 +1125,7 @@ void M_SinglePlayer_Draw (void)
Draw_ColoredString(10, 85, "Christmas Special", 255, 255, 255, 255, 1); Draw_ColoredString(10, 85, "Christmas Special", 255, 255, 255, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 98, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 98, 160, 2, 130, 130, 130, 255);
// Custom Maps // Custom Maps
if (m_singleplayer_cursor == 4) if (m_singleplayer_cursor == 4)
@ -1524,16 +1524,16 @@ void M_Achievement_Draw (void)
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
if (!m_achievement_selected) if (!m_achievement_selected)
{ {
Draw_FillByColor(15, 8, 225, 12, GU_RGBA(204, 0, 0, 100)); Draw_FillByColor(15, 8, 225, 12, 204, 0, 0, 100);
Draw_FillByColor(240, 8, 225, 12, GU_RGBA(0, 0, 0, 100)); Draw_FillByColor(240, 8, 225, 12, 0, 0, 0, 100);
if (total_unlocked_achievements <= 0) if (total_unlocked_achievements <= 0)
{ {
Draw_FillByColor(15, 25, vid.width - 30, 60, GU_RGBA (0, 0, 0, 100)); Draw_FillByColor(15, 25, vid.width - 30, 60, 0, 0, 0, 100);
Draw_Pic (20, 30 + y, achievement_locked); Draw_Pic (20, 30 + y, achievement_locked);
Draw_String (125, 30 + y, "No achievements unlocked :("); Draw_String (125, 30 + y, "No achievements unlocked :(");
} }
@ -1543,7 +1543,7 @@ void M_Achievement_Draw (void)
{ {
if (unlocked_achievement[i + m_achievement_scroll[0]] >= 0) if (unlocked_achievement[i + m_achievement_scroll[0]] >= 0)
{ {
Draw_FillByColor(15, 25 + y, vid.width - 30, 60, GU_RGBA (0, 0, 0, 100)); Draw_FillByColor(15, 25 + y, vid.width - 30, 60, 0, 0, 0, 100);
Draw_Pic (20, 30 + y, achievement_list[unlocked_achievement[i + m_achievement_scroll[0]]].img); Draw_Pic (20, 30 + y, achievement_list[unlocked_achievement[i + m_achievement_scroll[0]]].img);
Draw_String (125, 30 + y, achievement_list[unlocked_achievement[i + m_achievement_scroll[0]]].name); Draw_String (125, 30 + y, achievement_list[unlocked_achievement[i + m_achievement_scroll[0]]].name);
@ -1570,19 +1570,19 @@ void M_Achievement_Draw (void)
{ {
if (total_locked_achievements <= 0) if (total_locked_achievements <= 0)
{ {
Draw_FillByColor(15, 25, vid.width - 30, 60, GU_RGBA (0, 0, 0, 100)); Draw_FillByColor(15, 25, vid.width - 30, 60, 0, 0, 0, 100);
Draw_Pic (20, 30 + y, achievement_locked); Draw_Pic (20, 30 + y, achievement_locked);
Draw_String (125, 30 + y, "All achievements unlocked :)"); Draw_String (125, 30 + y, "All achievements unlocked :)");
} }
Draw_FillByColor(15, 8, 225, 12, GU_RGBA(0, 0, 0, 100)); Draw_FillByColor(15, 8, 225, 12, 0, 0, 0, 100);
Draw_FillByColor(240, 8, 225, 12, GU_RGBA(204, 0, 0, 100)); Draw_FillByColor(240, 8, 225, 12, 204, 0, 0, 100);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if (locked_achievement[i + m_achievement_scroll[1]] >= 0) if (locked_achievement[i + m_achievement_scroll[1]] >= 0)
{ {
Draw_FillByColor(15, 25 + y, vid.width - 30, 60, GU_RGBA (0, 0, 0, 100)); Draw_FillByColor(15, 25 + y, vid.width - 30, 60, 0, 0, 0, 100);
Draw_Pic (20, 30 + y, achievement_locked); Draw_Pic (20, 30 + y, achievement_locked);
Draw_String (125, 30 + y, achievement_list[locked_achievement[i + m_achievement_scroll[1]]].name); Draw_String (125, 30 + y, achievement_list[locked_achievement[i + m_achievement_scroll[1]]].name);
@ -2731,7 +2731,7 @@ void M_Screen_Draw (void)
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "GRAPHICS SETTINGS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "GRAPHICS SETTINGS", 255, 255, 255, 255, 2);
@ -3023,7 +3023,7 @@ void M_Gameplay_Draw (void)
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "CONTROL SETTINGS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "CONTROL SETTINGS", 255, 255, 255, 255, 2);
@ -3200,7 +3200,7 @@ void M_Options_Draw (void)
Draw_PicIndex (0, 0, 480, 272, menu_bk); Draw_PicIndex (0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "SETTINGS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "SETTINGS", 255, 255, 255, 255, 2);
@ -3224,7 +3224,7 @@ void M_Options_Draw (void)
Draw_ColoredString(10, 65, "Control Settings", 255, 255, 255, 255, 1); Draw_ColoredString(10, 65, "Control Settings", 255, 255, 255, 255, 1);
// Divider // Divider
Draw_FillByColor(10, 78, 160, 2, GU_RGBA(130, 130, 130, 255)); Draw_FillByColor(10, 78, 160, 2, 130, 130, 130, 255);
// Console // Console
if (options_cursor == 3) if (options_cursor == 3)
@ -3431,7 +3431,7 @@ void M_Keys_Draw (void)
Draw_PicIndex(0, 0, 480, 272, menu_bk); Draw_PicIndex(0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "CONTROLS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "CONTROLS", 255, 255, 255, 255, 2);
@ -3578,7 +3578,7 @@ void M_Credits_Draw (void)
Draw_PicIndex(0, 0, 480, 272, menu_bk); Draw_PicIndex(0, 0, 480, 272, menu_bk);
// Fill black to make everything easier to see // Fill black to make everything easier to see
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Header // Header
Draw_ColoredString(10, 10, "CREDITS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "CREDITS", 255, 255, 255, 255, 2);

View file

@ -620,6 +620,7 @@ void PF_sound (void)
attenuation = G_FLOAT(OFS_PARM4); attenuation = G_FLOAT(OFS_PARM4);
// AWFUL AWFUL HACK for limiting zombie sound variations // AWFUL AWFUL HACK for limiting zombie sound variations
#ifndef _3DS
#ifndef SLIM #ifndef SLIM
char* s = sample; char* s = sample;
@ -641,6 +642,7 @@ void PF_sound (void)
} }
#endif // SLIM #endif // SLIM
#endif // _3DS
if (volume < 0 || volume > 255) if (volume < 0 || volume > 255)
Sys_Error ("SV_StartSound: volume = %i", volume); Sys_Error ("SV_StartSound: volume = %i", volume);

View file

@ -931,6 +931,65 @@ void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value)
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices); sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices);
} }
/*
=============
Draw_ColoredStretchPic
=============
*/
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, int r, int g, int b, int a)
{
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
glpic_t *gl;
gl = (glpic_t *)pic->data;
if (!gl->index)
GL_Bind (nonetexture);
else
GL_Bind (gl->index);
struct vertex
{
unsigned short u, v;
short x, y, z;
};
vertex* const vertices = static_cast<vertex*>(sceGuGetMemory(sizeof(vertex) * 2));
const gltexture_t& glt = gltextures[gl->index];
vertices[0].u = 0;
vertices[0].v = 0;
vertices[0].x = x;
vertices[0].y = y;
vertices[0].z = 0;
if (gltextures[gl->index].islmp)
{
vertices[1].u = glt.original_width;
vertices[1].v = glt.original_height;
}
else
{
vertices[1].u = glt.width;
vertices[1].v = glt.height;
}
vertices[1].x = x + x_value;
vertices[1].y = y + y_value;
vertices[1].z = 0;
sceGuColor(GU_RGBA(
static_cast<unsigned int>(r),
static_cast<unsigned int>(g),
static_cast<unsigned int>(b),
static_cast<unsigned int>(a)));
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices);
sceGuColor(0xffffffff);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
}
/* /*
============= =============
Draw_TransPic Draw_TransPic
@ -1049,8 +1108,8 @@ void Draw_LoadingFill(void)
loading_cur_step = loading_cur_step_bk; loading_cur_step = loading_cur_step_bk;
float loadsize = loading_cur_step * (max_step / loading_num_step); float loadsize = loading_cur_step * (max_step / loading_num_step);
Draw_FillByColor (x - 2, y - 2, max_step + 4, size + 4, GU_RGBA(69, 69, 69, 255)); Draw_FillByColor (x - 2, y - 2, max_step + 4, size + 4, 69, 69, 69, 255);
Draw_FillByColor (x, y, loadsize, size, GU_RGBA(0, 0, 0, 200)); Draw_FillByColor (x, y, loadsize, size, 0, 0, 0, 200);
switch(loading_step) { switch(loading_step) {
case 1: text = "Loading Models.."; break; case 1: text = "Loading Models.."; break;
@ -1082,8 +1141,10 @@ Draw_FillByColor
Fills a box of pixels with a single color Fills a box of pixels with a single color
============= =============
*/ */
void Draw_FillByColor (int x, int y, int w, int h, unsigned int c) void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a)
{ {
unsigned int c = GU_RGBA(r, g, b, a);
struct vertex struct vertex
{ {
short x, y, z; short x, y, z;
@ -1337,8 +1398,8 @@ extern qboolean crosshair_pulse_grenade;
void Draw_Crosshair (void) void Draw_Crosshair (void)
{ {
if (cl_crosshair_debug.value) { if (cl_crosshair_debug.value) {
Draw_FillByColor(vid.width/2, 0, 1, 272, GU_RGBA(255, 0, 0, 255)); Draw_FillByColor(vid.width/2, 0, 1, 272, 255, 0, 0, 255);
Draw_FillByColor(0, vid.height/2, 480, 1, GU_RGBA(0, 255, 0, 255)); Draw_FillByColor(0, vid.height/2, 480, 1, 0, 255, 0, 255);
} }
if (cl.stats[STAT_HEALTH] <= 20) if (cl.stats[STAT_HEALTH] <= 20)
@ -1351,10 +1412,10 @@ void Draw_Crosshair (void)
Draw_Pic (112, 7, sniper_scope); Draw_Pic (112, 7, sniper_scope);
// And its borders // And its borders
Draw_FillByColor(0, 0, 480, 7, GU_RGBA(0, 0, 0, 255)); // Top Draw_FillByColor(0, 0, 480, 7, 0, 0, 0, 255); // Top
Draw_FillByColor(0, 263, 480, 9, GU_RGBA(0, 0, 0, 255)); // Bottom Draw_FillByColor(0, 263, 480, 9, 0, 0, 0, 255); // Bottom
Draw_FillByColor(0, 7, 112, 256, GU_RGBA(0, 0, 0, 255)); // Left Draw_FillByColor(0, 7, 112, 256, 0, 0, 0, 255); // Left
Draw_FillByColor(368, 7, 112, 256, GU_RGBA(0, 0, 0, 255)); // Right Draw_FillByColor(368, 7, 112, 256, 0, 0, 0, 255); // Right
} }
if (Hitmark_Time > sv.time) if (Hitmark_Time > sv.time)
@ -1420,22 +1481,22 @@ void Draw_Crosshair (void)
// Left // Left
x_value = x_center - crosshair_offset_step; x_value = x_center - crosshair_offset_step;
y_value = y_center; y_value = y_center;
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity)); Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col, (int)crosshair_opacity);
// Right // Right
x_value = x_center + crosshair_offset_step - 3; x_value = x_center + crosshair_offset_step - 3;
y_value = y_center; y_value = y_center;
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity)); Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col, (int)crosshair_opacity);
// Top // Top
x_value = x_center; x_value = x_center;
y_value = y_center - crosshair_offset_step; y_value = y_center - crosshair_offset_step;
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity)); Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, (int)crosshair_opacity);
// Bottom // Bottom
x_value = x_center; x_value = x_center;
y_value = y_center + crosshair_offset_step - 3; y_value = y_center + crosshair_offset_step - 3;
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, (int)col, (int)col, (int)crosshair_opacity)); Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, (int)crosshair_opacity);
} }
// Area of Effect (o) // Area of Effect (o)
else if (crosshair.value == 2) { else if (crosshair.value == 2) {
@ -1463,22 +1524,22 @@ void Draw_Crosshair (void)
// Left // Left
x_value = x_center - crosshair_offset_step; x_value = x_center - crosshair_offset_step;
y_value = y_center; y_value = y_center;
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, 255, 255, 255)); Draw_FillByColor(x_value, y_value, 3, 1, 255, 255, 255, 255);
// Right // Right
x_value = x_center + crosshair_offset_step - 2; x_value = x_center + crosshair_offset_step - 2;
y_value = y_center; y_value = y_center;
Draw_FillByColor(x_value, y_value, 3, 1, GU_RGBA(255, 255, 255, 255)); Draw_FillByColor(x_value, y_value, 3, 1, 255, 255, 255, 255);
// Top // Top
x_value = x_center; x_value = x_center;
y_value = y_center - crosshair_offset_step; y_value = y_center - crosshair_offset_step;
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, 255, 255, 255)); Draw_FillByColor(x_value, y_value, 1, 3, 255, 255, 255, 255);
// Bottom // Bottom
x_value = x_center; x_value = x_center;
y_value = y_center + crosshair_offset_step - 3; y_value = y_center + crosshair_offset_step - 3;
Draw_FillByColor(x_value, y_value, 1, 3, GU_RGBA(255, 255, 255, 255)); Draw_FillByColor(x_value, y_value, 1, 3, 255, 255, 255, 255);
} }
} }

View file

@ -1106,8 +1106,8 @@ void SCR_DrawLoadScreen (void)
if (lscreen_index > 0) if (lscreen_index > 0)
Draw_PicIndex(scr_vrect.x, scr_vrect.y, 480, 272, lscreen_index); Draw_PicIndex(scr_vrect.x, scr_vrect.y, 480, 272, lscreen_index);
Draw_FillByColor(0, 0, 480, 24, GU_RGBA(0, 0, 0, 150)); Draw_FillByColor(0, 0, 480, 24, 0, 0, 0, 150);
Draw_FillByColor(0, 248, 480, 24, GU_RGBA(0, 0, 0, 150)); Draw_FillByColor(0, 248, 480, 24, 0, 0, 0, 150);
Draw_ColoredString(2, 4, loadnamespec, 255, 255, 0, 255, 2); Draw_ColoredString(2, 4, loadnamespec, 255, 255, 0, 255, 2);
} }
@ -1561,7 +1561,7 @@ void SCR_UpdateScreen (void)
GL_Set2D (); GL_Set2D ();
if (v_gamma.value < 1) if (v_gamma.value < 1)
Draw_FillByColor(0, 0, 480, 272, GU_RGBA(255, 255, 255, (int)((1 - v_gamma.value)*255))); Draw_FillByColor(0, 0, 480, 272, 255, 255, 255, (int)((1 - v_gamma.value)*255));
Draw_Crosshair (); Draw_Crosshair ();