Add SELECT as usable key, HUD items (incomplete), more client-server stuff, all stats, progdefs unification

This commit is contained in:
Ryan Baldwin 2022-07-01 18:49:33 -07:00
parent 6eed77bbf1
commit 0ac6573d65
19 changed files with 412 additions and 260 deletions

Binary file not shown.

Binary file not shown.

View file

@ -149,7 +149,6 @@ void HUD_Init (void)
//Achievement_Init();
}
#if 0
/*
===============
HUD_NewMap
@ -302,7 +301,6 @@ void HUD_EndScreen (void)
}
//=============================================================================
//=============================================================================//
@ -449,7 +447,6 @@ void HUD_Point_Change (void)
}
}
}
#endif
/*
==================
@ -486,7 +483,7 @@ void HUD_Blood (void)
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);*/
}
#if 0
/*
===============
HUD_GetWorldText
@ -1070,10 +1067,8 @@ HUD_Perks
#define P_DEAD 64
#define P_MULE 128
#endif
int perk_order[9];
int current_perk_order;
#if 0
void HUD_Perks (void)
{
@ -1179,6 +1174,7 @@ char achievement_text[MAX_QPATH];
double achievement_time;
float smallsec;
int ach_pic;
void HUD_Achievement (void)
{
@ -1359,7 +1355,6 @@ void HUD_Weapon (void)
x_value = vid.width - 8 - l*8;
Draw_String (x_value, y_value, str);
}
#endif
/*
===============
@ -1389,16 +1384,13 @@ void HUD_Draw (void)
return;
}
char stuff[1024];
sprintf(stuff, "fov: %f", scr_fov.value);
Draw_String(0, 32, stuff);
/*
if (cl.stats[STAT_HEALTH] <= 0)
{
HUD_EndScreen ();
return;
}
*/
// HUD_Blood();
// HUD_Rounds();
// HUD_Perks();

View file

@ -1,2 +1,53 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// the status bar is only redrawn if something has changed, but if anything
// does, the entire thing will be redrawn for the next vid.numpages frames.
void HUD_Init (void);
// call whenever any of the client stats represented on the sbar changes
void HUD_Draw (void);
// called every frame by screen
// called each frame after the level has been completed
void HUD_NewMap (void);
extern double HUD_Change_time;
void HUD_Init (void);
//achievement stuff
#define MAX_ACHIEVEMENTS 5//23
typedef struct achievement_list_s
{
qpic_t *img;
int unlocked;
char name[64];
char description[256];
int progress;
} achievement_list_t;
void Achievement_Init (void);
extern achievement_list_t achievement_list[MAX_ACHIEVEMENTS];
extern qpic_t *achievement_locked;
void HUD_Parse_Achievement (int ach);

View file

@ -421,7 +421,6 @@ if (bits&(1<<i))
{
if (i > cl.maxclients)
Sys_Error ("i >= cl.maxclients");
ent->colormap = cl.scores[i-1].translations;
}
#ifdef GLQUAKE
@ -520,10 +519,12 @@ CL_ParseClientdata
Server information pertaining to this client only
==================
*/
extern int perk_order[9];
extern int current_perk_order;
void CL_ParseClientdata (int bits)
{
int i, j;
int i, s;
if (bits & SU_VIEWHEIGHT)
cl.viewheight = MSG_ReadChar ();
else
@ -533,7 +534,196 @@ void CL_ParseClientdata (int bits)
cl.idealpitch = MSG_ReadChar ();
else
cl.idealpitch = 0;
if (bits & SU_PERKS)
i = MSG_ReadLong ();
else
i = 0;
if (cl.perks != i)
{
if (i & 1 && !(cl.perks & 1))
{
perk_order[current_perk_order] = 1;
current_perk_order++;
}
if (i & 2 && !(cl.perks & 2))
{
perk_order[current_perk_order] = 2;
current_perk_order++;
}
if (i & 4 && !(cl.perks & 4))
{
perk_order[current_perk_order] = 4;
current_perk_order++;
}
if (i & 8 && !(cl.perks & 8))
{
perk_order[current_perk_order] = 8;
current_perk_order++;
}
if (i & 16 && !(cl.perks & 16))
{
perk_order[current_perk_order] = 16;
current_perk_order++;
}
if (i & 32 && !(cl.perks & 32))
{
perk_order[current_perk_order] = 32;
current_perk_order++;
}
if (i & 64 && !(cl.perks & 64))
{
perk_order[current_perk_order] = 64;
current_perk_order++;
}
if (i & 128 && !(cl.perks & 128))
{
perk_order[current_perk_order] = 128;
current_perk_order++;
}
if (cl.perks & 1 && !(i & 1))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 1)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 2 && !(i & 2))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 2)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 4 && !(i & 4))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 4)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 8 && !(i & 8))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 8)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 16 && !(i & 16))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 16)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 32 && !(i & 32))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 32)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 64 && !(i & 64))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 64)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
if (cl.perks & 128 && !(i & 128))
{
for (s = 0; s < 9; s++)
{
if (perk_order[s] == 128)
{
perk_order[s] = 0;
while (perk_order[s+1])
{
perk_order[s] = perk_order[s+1];
perk_order[s+1] = 0;
}
break;
}
}
current_perk_order--;
}
cl.perks = i;
}
cl.onground = (bits & SU_ONGROUND) != 0;
cl.inwater = (bits & SU_INWATER) != 0;
VectorCopy (cl.mvelocity[0], cl.mvelocity[1]);
for (i=0 ; i<3 ; i++)
{
@ -547,48 +737,61 @@ void CL_ParseClientdata (int bits)
cl.mvelocity[0][i] = 0;
}
// [always sent] if (bits & SU_ITEMS)
i = MSG_ReadLong ();
if (cl.items != i)
{ // set flash times
Sbar_Changed ();
for (j=0 ; j<32 ; j++)
if ( (i & (1<<j)) && !(cl.items & (1<<j)))
cl.item_gettime[j] = cl.time;
cl.items = i;
}
cl.onground = (bits & SU_ONGROUND) != 0;
cl.inwater = (bits & SU_INWATER) != 0;
if (bits & SU_WEAPONFRAME)
cl.stats[STAT_WEAPONFRAME] = MSG_ReadByte ();
else
cl.stats[STAT_WEAPONFRAME] = 0;
if (bits & SU_WEAPONSKIN)
cl.stats[STAT_WEAPONSKIN] = MSG_ReadByte ();
else
cl.stats[STAT_WEAPONSKIN] = 0;
if (bits & SU_WEAPON)
i = MSG_ReadByte ();
else
i = 0;
if (cl.stats[STAT_WEAPON] != i)
{
cl.stats[STAT_WEAPON] = i;
Sbar_Changed ();
}
i = MSG_ReadShort ();
if (cl.stats[STAT_HEALTH] != i)
if (bits & SU_GRENADES)
i = MSG_ReadLong ();
else
i = 0;
if (cl.stats[STAT_GRENADES] != i)
{
cl.stats[STAT_HEALTH] = i;
Sbar_Changed ();
HUD_Change_time = Sys_FloatTime() + 6;
cl.stats[STAT_GRENADES] = i;
}
i = MSG_ReadByte ();
i = MSG_ReadShort ();
if (cl.stats[STAT_PRIGRENADES] != i)
{
HUD_Change_time = Sys_FloatTime() + 6;
cl.stats[STAT_PRIGRENADES] = i;
}
i = MSG_ReadShort ();
if (cl.stats[STAT_SECGRENADES] != i)
{
HUD_Change_time = Sys_FloatTime() + 6;
cl.stats[STAT_SECGRENADES] = i;
}
i = MSG_ReadShort ();
if (cl.stats[STAT_HEALTH] != i)
cl.stats[STAT_HEALTH] = i;
i = MSG_ReadShort ();
if (cl.stats[STAT_AMMO] != i)
{
HUD_Change_time = Sys_FloatTime() + 6;
cl.stats[STAT_AMMO] = i;
Sbar_Changed ();
}
i = MSG_ReadByte ();
@ -602,6 +805,13 @@ void CL_ParseClientdata (int bits)
if (cl.stats[STAT_ZOOM] != i)
cl.stats[STAT_ZOOM] = i;
i = MSG_ReadByte ();
if (cl.stats[STAT_ACTIVEWEAPON] != i)
{
HUD_Change_time = Sys_FloatTime() + 6;
cl.stats[STAT_ACTIVEWEAPON] = i;
}
i = MSG_ReadByte ();
if (cl.stats[STAT_ROUNDS] != i)
cl.stats[STAT_ROUNDS] = i;
@ -611,61 +821,32 @@ void CL_ParseClientdata (int bits)
cl.stats[STAT_ROUNDCHANGE] = i;
i = MSG_ReadByte ();
if (cl.stats[STAT_X2] != i)
cl.stats[STAT_X2] = i;
if (standard_quake)
{
if (cl.stats[STAT_ACTIVEWEAPON] != i)
{
cl.stats[STAT_ACTIVEWEAPON] = i;
Sbar_Changed ();
}
}
else
{
if (cl.stats[STAT_ACTIVEWEAPON] != (1<<i))
{
cl.stats[STAT_ACTIVEWEAPON] = (1<<i);
Sbar_Changed ();
}
}
}
i = MSG_ReadByte ();
if (cl.stats[STAT_INSTA] != i)
cl.stats[STAT_INSTA] = i;
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
int i, j;
int top, bottom;
byte *dest, *source;
if (slot > cl.maxclients)
Sys_Error ("CL_NewTranslation: slot > cl.maxclients");
dest = cl.scores[slot].translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(cl.scores[slot].translations));
top = cl.scores[slot].colors & 0xf0;
bottom = (cl.scores[slot].colors &15)<<4;
#ifdef GLQUAKE
R_TranslatePlayerSkin (slot);
#endif
i = MSG_ReadByte ();
if (cl.progress_bar != i)
cl.progress_bar = i;
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
i = MSG_ReadByte ();
if (cl.stats[STAT_WEAPON2] != i)
cl.stats[STAT_WEAPON2] = i;
i = MSG_ReadByte ();
if (cl.stats[STAT_WEAPON2SKIN] != i)
cl.stats[STAT_WEAPON2SKIN] = i;
i = MSG_ReadByte ();
if (cl.stats[STAT_WEAPON2FRAME] != i)
cl.stats[STAT_WEAPON2FRAME] = i;
i = MSG_ReadByte ();
if (cl.stats[STAT_CURRENTMAG2] != i)
cl.stats[STAT_CURRENTMAG2] = i;
}
/*
@ -912,7 +1093,7 @@ void CL_ParseServerMessage (void)
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
cl.scores[i].frags = MSG_ReadShort ();
MSG_ReadShort ();
break;
case svc_updatecolors:
@ -920,8 +1101,7 @@ void CL_ParseServerMessage (void)
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
cl.scores[i].colors = MSG_ReadByte ();
CL_NewTranslation (i);
MSG_ReadByte ();
break;
case svc_particle:

View file

@ -42,9 +42,10 @@ typedef struct
{
char name[MAX_SCOREBOARDNAME];
float entertime;
int frags;
int colors; // two 4 bit fields
byte translations[VID_GRADES*256];
int points;
int maxpoints;
int kills;
int headshots;
} scoreboard_t;
typedef struct
@ -158,7 +159,7 @@ typedef struct
// information for local display
int stats[MAX_CL_STATS]; // health, etc
int perks; // Perk icons.
int items; // inventory bit flags
int progress_bar; // Perk icons.
float item_gettime[32]; // cl.time of aquiring item, for blinking
float faceanimtime; // use anim frame if cl.time < this

View file

@ -27,6 +27,7 @@ void Draw_Init (void);
void Draw_Character (int x, int y, int num);
void Draw_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic);
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_TransPic (int x, int y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
@ -37,5 +38,6 @@ void Draw_TileClear (int x, int y, int w, int h);
void Draw_Fill (int x, int y, int w, int h, int c);
void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str);
void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale);
qpic_t *Draw_PicFromWad (char *name);
qpic_t *Draw_CachePic (char *path);

View file

@ -625,6 +625,12 @@ void Draw_String (int x, int y, char *str)
}
}
void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale)
{
// naievil -- fixme, incomplete lol
Draw_String(x, y, text);
}
/*
================
Draw_DebugChar

View file

@ -667,9 +667,6 @@ void R_DrawViewModel (void)
if (!r_drawentities.value)
return;
if (cl.items & IT_INVISIBILITY)
return;
if (cl.stats[STAT_HEALTH] <= 0)
return;

View file

@ -245,8 +245,8 @@ void R_TranslatePlayerSkin (int playernum)
GL_DisableMultitexture();
top = cl.scores[playernum].colors & 0xf0;
bottom = (cl.scores[playernum].colors &15)<<4;
top = 0xf0;
bottom = (15)<<4;
for (i=0 ; i<256 ; i++)
translate[i] = i;

View file

@ -1263,6 +1263,9 @@ void SCR_UpdateScreen (void)
}
}
// naievil -- FIXME: the scr_fov is really bugged and only works with integer values
// this should have a weird workaround
//Con_Printf("Original fov: %d\tscr_fov: %f\tzoom: %d\n", original_fov, scr_fov.value, cl.stats[STAT_ZOOM]);
if (oldfov != scr_fov.value)
{

View file

@ -57,7 +57,7 @@ keyname_t keynames[] =
#ifdef _3DS
{"TAB", K_TAB},
{"START", K_ENTER},
{"SELECT", K_ESCAPE},
{"SELECT", K_SELECT},
{"SPACE", K_SPACE},
{"BACKSPACE", K_BACKSPACE},
{"PADUP", K_UPARROW},
@ -697,6 +697,7 @@ void Key_Event (int key, qboolean down)
M_Keydown (key);
break;
case key_game:
break;
case key_console:
M_ToggleMenu_f ();
break;

View file

@ -115,6 +115,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define K_MWHEELUP 239
#define K_MWHEELDOWN 240
// naievil -- this is for using the select button for a game key, which is important
#define K_SELECT 241
typedef enum {key_game, key_console, key_message, key_menu, key_menu_pause} keydest_t;

View file

@ -308,13 +308,6 @@ void M_Main_Key (int key)
{
switch (key)
{
case K_ESCAPE:
key_dest = key_game;
m_state = m_none;
cls.demonum = m_save_demonum;
if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
CL_NextDemo ();
break;
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@ -391,9 +384,6 @@ void M_SinglePlayer_Key (int key)
{
switch (key)
{
case K_ESCAPE:
M_Menu_Main_f ();
break;
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@ -531,9 +521,6 @@ void M_Load_Key (int k)
{
switch (k)
{
case K_ESCAPE:
M_Menu_SinglePlayer_f ();
break;
case K_ENTER:
S_LocalSound ("misc/menu2.wav");
@ -573,9 +560,6 @@ void M_Save_Key (int k)
{
switch (k)
{
case K_ESCAPE:
M_Menu_SinglePlayer_f ();
break;
case K_ENTER:
m_state = m_none;
@ -640,9 +624,6 @@ void M_MultiPlayer_Key (int key)
{
switch (key)
{
case K_ESCAPE:
M_Menu_Main_f ();
break;
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@ -748,9 +729,6 @@ void M_Setup_Key (int k)
switch (k)
{
case K_ESCAPE:
M_Menu_MultiPlayer_f ();
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -980,9 +958,6 @@ void M_Net_Key (int k)
again:
switch (k)
{
case K_ESCAPE:
M_Menu_MultiPlayer_f ();
break;
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@ -1240,10 +1215,6 @@ void M_Options_Key (int k)
{
switch (k)
{
case K_ESCAPE:
M_Menu_Main_f ();
break;
case K_ENTER:
m_entersound = true;
switch (options_cursor)
@ -1467,9 +1438,6 @@ void M_Keys_Key (int k)
switch (k)
{
case K_ESCAPE:
M_Menu_Options_f ();
break;
case K_LEFTARROW:
case K_UPARROW:
@ -1552,9 +1520,6 @@ void M_Help_Key (int key)
{
switch (key)
{
case K_ESCAPE:
M_Menu_Main_f ();
break;
case K_UPARROW:
case K_RIGHTARROW:
@ -1641,32 +1606,6 @@ void M_Menu_Quit_f (void)
void M_Quit_Key (int key)
{
switch (key)
{
case K_ESCAPE:
case 'n':
case 'N':
if (wasInMenus)
{
m_state = m_quit_prevstate;
m_entersound = true;
}
else
{
key_dest = key_game;
m_state = m_none;
}
break;
case 'Y':
case 'y':
key_dest = key_console;
Host_Quit_f ();
break;
default:
break;
}
}
@ -1844,9 +1783,6 @@ void M_SerialConfig_Key (int key)
switch (key)
{
case K_ESCAPE:
M_Menu_Net_f ();
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -2070,9 +2006,6 @@ void M_ModemConfig_Key (int key)
switch (key)
{
case K_ESCAPE:
M_Menu_SerialConfig_f ();
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -2272,9 +2205,6 @@ void M_LanConfig_Key (int key)
switch (key)
{
case K_ESCAPE:
M_Menu_Net_f ();
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -2774,9 +2704,6 @@ void M_GameOptions_Key (int key)
{
switch (key)
{
case K_ESCAPE:
M_Menu_Net_f ();
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
@ -2954,9 +2881,6 @@ void M_ServerList_Key (int k)
{
switch (k)
{
case K_ESCAPE:
M_Menu_LanConfig_f ();
break;
case K_SPACE:
M_Menu_Search_f ();

View file

@ -114,11 +114,18 @@ typedef struct
float kills;
float weapon;
string_t weaponmodel;
string_t weapon2model;
float weaponframe;
float weapon2frame;
float currentammo;
float currentmag;
float zoom;
float items;
float weaponskin;
float weapon2skin;
float primary_grenades;
float secondary_grenades;
float grenades;
float perks;
float takedamage;
int chain;
float deadflag;
@ -143,8 +150,6 @@ typedef struct
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
@ -157,8 +162,8 @@ typedef struct
float spawnflags;
string_t target;
string_t targetname;
float dmg_take;
float dmg_save;
float bleed_out;
float progress_bar;
int dmg_inflictor;
int owner;
vec3_t movedir;
@ -168,11 +173,14 @@ typedef struct
string_t noise1;
string_t noise2;
string_t noise3;
float x2_icon;
float insta_icon;
vec3_t ADS_Offset;
vec3_t Flash_Offset;
float Flash_Size;
string_t Weapon_Name;
string_t Weapon_Name_Touch;
float currentmag2;
float maxspeed;
float facingenemy;
} entvars_t;

View file

@ -49,13 +49,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SU_VELOCITY1 (1<<5)
#define SU_VELOCITY2 (1<<6)
#define SU_VELOCITY3 (1<<7)
//define SU_AIMENT (1<<8) AVAILABLE BIT
#define SU_ITEMS (1<<9)
#define SU_WEAPONSKIN (1<<7)
#define SU_PERKS (1<<9)
#define SU_ONGROUND (1<<10) // no data follows, the bit is it
#define SU_INWATER (1<<11) // no data follows, the bit is it
#define SU_WEAPONFRAME (1<<12)
#define SU_ARMOR (1<<13)
#define SU_WEAPON (1<<14)
#define SU_PRIGRENADES (1<<15)
#define SU_SECGRENADES (1<<16)
#define SU_GRENADES (1<<13)
// a sound with no channel is a local only sound
#define SND_VOLUME (1<<0) // a byte

View file

@ -181,11 +181,6 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color)
int fragsort[MAX_SCOREBOARD];
char scoreboardtext[MAX_SCOREBOARD][20];
int scoreboardtop[MAX_SCOREBOARD];
int scoreboardbottom[MAX_SCOREBOARD];
int scoreboardcount[MAX_SCOREBOARD];
int scoreboardlines;
/*
===============

View file

@ -571,33 +571,18 @@ void SV_CleanupEnts (void)
==================
SV_WriteClientdataToMessage
==================
*/
/*
==================
SV_WriteClientdataToMessage
==================
*/
void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
{
int bits;
int i;
edict_t *other;
int items;
#ifndef QUAKE2
eval_t *val;
#endif
//
// send a damage message
//
if (ent->v.dmg_take || ent->v.dmg_save)
{
other = PROG_TO_EDICT(ent->v.dmg_inflictor);
MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, ent->v.dmg_save);
MSG_WriteByte (msg, ent->v.dmg_take);
for (i=0 ; i<3 ; i++)
MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]));
ent->v.dmg_take = 0;
ent->v.dmg_save = 0;
}
//
// send the current viewpos offset from the view entity
@ -614,34 +599,22 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
}
bits = 0;
if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT)
bits |= SU_VIEWHEIGHT;
if (ent->v.idealpitch)
bits |= SU_IDEALPITCH;
// stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2
#ifdef QUAKE2
items = (int)ent->v.items | ((int)ent->v.items2 << 23);
#else
val = GetEdictFieldValue(ent, "items2");
if (ent->v.perks)
bits |= SU_PERKS;
if (val)
items = (int)ent->v.items | ((int)val->_float << 23);
else
items = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28);
#endif
bits |= SU_ITEMS;
if ( (int)ent->v.flags & FL_ONGROUND)
bits |= SU_ONGROUND;
if ( ent->v.waterlevel >= 2)
bits |= SU_INWATER;
for (i=0 ; i<3 ; i++)
{
if (ent->v.punchangle[i])
@ -649,16 +622,29 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
if (ent->v.velocity[i])
bits |= (SU_VELOCITY1<<i);
}
if (ent->v.weaponframe)
bits |= SU_WEAPONFRAME;
if (ent->v.armorvalue)
bits |= SU_ARMOR;
if (ent->v.weaponskin)
bits |= SU_WEAPONSKIN;
// if (ent->v.weapon)
if (ent->v.weapon)
bits |= SU_WEAPON;
//if (ent->v.perks)
// bits |= SU_PERKS;
if (ent->v.primary_grenades)
bits |= SU_PRIGRENADES;
//Think this is out of range of a short
//if (ent->v.secondary_grenades)
// bits |= SU_SECGRENADES;
if (ent->v.grenades)
bits |= SU_GRENADES;
// send the data
MSG_WriteByte (msg, svc_clientdata);
@ -670,6 +656,9 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
if (bits & SU_IDEALPITCH)
MSG_WriteChar (msg, ent->v.idealpitch);
if (bits & SU_PERKS)
MSG_WriteLong (msg, ent->v.perks);
for (i=0 ; i<3 ; i++)
{
if (bits & (SU_PUNCH1<<i))
@ -678,37 +667,34 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteChar (msg, ent->v.velocity[i]/16);
}
// [always sent] if (bits & SU_ITEMS)
MSG_WriteLong (msg, items);
if (bits & SU_WEAPONFRAME)
MSG_WriteByte (msg, ent->v.weaponframe);
if (bits & SU_WEAPONSKIN)
MSG_WriteByte (msg, ent->v.weaponskin);
if (bits & SU_WEAPON)
MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel));
if (bits & SU_GRENADES)
MSG_WriteLong (msg, ent->v.grenades);
MSG_WriteShort (msg, ent->v.primary_grenades);
MSG_WriteShort (msg, ent->v.secondary_grenades);
MSG_WriteShort (msg, ent->v.health);
MSG_WriteByte (msg, ent->v.currentammo);
MSG_WriteShort (msg, ent->v.currentammo);
MSG_WriteByte (msg, ent->v.currentmag);
MSG_WriteByte (msg, ent->v.zoom);
MSG_WriteByte (msg, ent->v.weapon);
MSG_WriteByte (msg, pr_global_struct->rounds);
MSG_WriteByte (msg, pr_global_struct->rounds_change);
if (standard_quake)
{
MSG_WriteByte (msg, ent->v.weapon);
}
else
{
for(i=0;i<32;i++)
{
if ( ((int)ent->v.weapon) & (1<<i) )
{
MSG_WriteByte (msg, i);
break;
}
}
}
MSG_WriteByte (msg, ent->v.x2_icon);
MSG_WriteByte (msg, ent->v.insta_icon);
MSG_WriteByte (msg, ent->v.progress_bar);
MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weapon2model));
MSG_WriteByte (msg, ent->v.weapon2skin);
MSG_WriteByte (msg, ent->v.weapon2frame);
MSG_WriteByte (msg, ent->v.currentmag2);
}
/*

View file

@ -212,6 +212,7 @@ void Sys_Sleep (void)
void Sys_DefaultConfig(void)
{
// naievil -- fixme I didn't do this
Cbuf_AddText ("bind ABUTTON +right\n");
Cbuf_AddText ("bind BBUTTON +lookdown\n");
Cbuf_AddText ("bind XBUTTON +lookup\n");
@ -226,7 +227,7 @@ void Sys_DefaultConfig(void)
void Sys_SetKeys(u32 keys, u32 state){
if( keys & KEY_SELECT)
Key_Event(K_ESCAPE, state);
Key_Event(K_SELECT, state);
if( keys & KEY_START)
Key_Event(K_ENTER, state);
if( keys & KEY_DUP)