mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
Move qw's player_info_t to client/state.h
And use it instead of scoreboard_t in nq.
This commit is contained in:
parent
167dd2af9b
commit
52b714ea57
6 changed files with 68 additions and 43 deletions
58
include/client/state.h
Normal file
58
include/client/state.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
state.h
|
||||||
|
|
||||||
|
client state
|
||||||
|
|
||||||
|
Copyright (C) 2013 Bill Currie <bill@taniwha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@taniwha.org>
|
||||||
|
Date: 2013/01/31
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __client_state_h
|
||||||
|
#define __client_state_h
|
||||||
|
|
||||||
|
typedef struct player_info_s {
|
||||||
|
int userid;
|
||||||
|
struct info_s *userinfo;
|
||||||
|
|
||||||
|
// scoreboard information
|
||||||
|
struct info_key_s *name;
|
||||||
|
struct info_key_s *team;
|
||||||
|
struct info_key_s *chat;
|
||||||
|
float entertime;
|
||||||
|
int frags;
|
||||||
|
int ping;
|
||||||
|
byte pl;
|
||||||
|
|
||||||
|
// skin information
|
||||||
|
int topcolor;
|
||||||
|
int bottomcolor;
|
||||||
|
struct info_key_s *skinname;
|
||||||
|
struct skin_s *skin;
|
||||||
|
|
||||||
|
int spectator;
|
||||||
|
int stats[MAX_CL_STATS]; // health, etc
|
||||||
|
int prevcount;
|
||||||
|
} player_info_t;
|
||||||
|
|
||||||
|
#endif//__client_state_h
|
|
@ -38,6 +38,7 @@
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
|
||||||
#include "client/entities.h"
|
#include "client/entities.h"
|
||||||
|
#include "client/state.h"
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "netmain.h"
|
#include "netmain.h"
|
||||||
|
@ -53,16 +54,6 @@ typedef struct usercmd_s {
|
||||||
float upmove;
|
float upmove;
|
||||||
} usercmd_t;
|
} usercmd_t;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
struct info_s *info;
|
|
||||||
struct info_key_s *name;
|
|
||||||
float entertime;
|
|
||||||
int frags;
|
|
||||||
int topcolor;
|
|
||||||
int bottomcolor;
|
|
||||||
} scoreboard_t;
|
|
||||||
|
|
||||||
|
|
||||||
// client_state_t should hold all pieces of the client state
|
// client_state_t should hold all pieces of the client state
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -225,7 +216,7 @@ typedef struct {
|
||||||
int cdtrack; // cd audio
|
int cdtrack; // cd audio
|
||||||
|
|
||||||
// frag scoreboard
|
// frag scoreboard
|
||||||
scoreboard_t *scores; // [cl.maxclients]
|
player_info_t *scores; // [cl.maxclients]
|
||||||
|
|
||||||
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
||||||
} client_state_t;
|
} client_state_t;
|
||||||
|
|
|
@ -205,7 +205,7 @@ CL_ClearState (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < cl.maxclients; i++)
|
for (i = 0; i < cl.maxclients; i++)
|
||||||
Info_Destroy (cl.scores[i].info);
|
Info_Destroy (cl.scores[i].userinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// wipe the entire cl structure
|
// wipe the entire cl structure
|
||||||
|
|
|
@ -361,8 +361,8 @@ CL_ParseServerInfo (void)
|
||||||
}
|
}
|
||||||
cl.scores = Hunk_AllocName (cl.maxclients * sizeof (*cl.scores), "scores");
|
cl.scores = Hunk_AllocName (cl.maxclients * sizeof (*cl.scores), "scores");
|
||||||
for (i = 0; i < cl.maxclients; i++) {
|
for (i = 0; i < cl.maxclients; i++) {
|
||||||
cl.scores[i].info = Info_ParseString ("name\\", 0, 0);
|
cl.scores[i].userinfo = Info_ParseString ("name\\", 0, 0);
|
||||||
cl.scores[i].name = Info_Key (cl.scores[i].info, "name");
|
cl.scores[i].name = Info_Key (cl.scores[i].userinfo, "name");
|
||||||
cl.scores[i].topcolor = 0;
|
cl.scores[i].topcolor = 0;
|
||||||
cl.scores[i].bottomcolor = 0;
|
cl.scores[i].bottomcolor = 0;
|
||||||
}
|
}
|
||||||
|
@ -983,7 +983,7 @@ CL_ParseServerMessage (void)
|
||||||
if (i >= cl.maxclients)
|
if (i >= cl.maxclients)
|
||||||
Host_Error ("CL_ParseServerMessage: svc_updatename > "
|
Host_Error ("CL_ParseServerMessage: svc_updatename > "
|
||||||
"MAX_SCOREBOARD");
|
"MAX_SCOREBOARD");
|
||||||
Info_SetValueForKey (cl.scores[i].info, "name",
|
Info_SetValueForKey (cl.scores[i].userinfo, "name",
|
||||||
MSG_ReadString (net_message), 0);
|
MSG_ReadString (net_message), 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -574,7 +574,7 @@ draw_frags (view_t *view)
|
||||||
int i, k, l, p = -1;
|
int i, k, l, p = -1;
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
int x;
|
int x;
|
||||||
scoreboard_t *s;
|
player_info_t *s;
|
||||||
|
|
||||||
if (cl.maxclients == 1)
|
if (cl.maxclients == 1)
|
||||||
return;
|
return;
|
||||||
|
@ -800,7 +800,7 @@ static void
|
||||||
draw_rogue_face (view_t *view)
|
draw_rogue_face (view_t *view)
|
||||||
{
|
{
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
scoreboard_t *s;
|
player_info_t *s;
|
||||||
|
|
||||||
// PGM 01/19/97 - team color drawing
|
// PGM 01/19/97 - team color drawing
|
||||||
|
|
||||||
|
@ -1032,7 +1032,7 @@ Sbar_DeathmatchOverlay (view_t *view)
|
||||||
int i, k, l;
|
int i, k, l;
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
int x, y;
|
int x, y;
|
||||||
scoreboard_t *s;
|
player_info_t *s;
|
||||||
|
|
||||||
r_data->scr_copyeverything = 1;
|
r_data->scr_copyeverything = 1;
|
||||||
r_data->scr_fullupdate = 0;
|
r_data->scr_fullupdate = 0;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "QF/plugin/vid_render.h"
|
#include "QF/plugin/vid_render.h"
|
||||||
|
|
||||||
#include "client/entities.h"
|
#include "client/entities.h"
|
||||||
|
#include "client/state.h"
|
||||||
|
|
||||||
#include "netchan.h"
|
#include "netchan.h"
|
||||||
#include "qw/bothdefs.h"
|
#include "qw/bothdefs.h"
|
||||||
|
@ -62,31 +63,6 @@ typedef struct player_state_s {
|
||||||
|
|
||||||
} player_state_t;
|
} player_state_t;
|
||||||
|
|
||||||
typedef struct player_info_s {
|
|
||||||
int userid;
|
|
||||||
struct info_s *userinfo;
|
|
||||||
|
|
||||||
// scoreboard information
|
|
||||||
struct info_key_s *name;
|
|
||||||
struct info_key_s *team;
|
|
||||||
struct info_key_s *chat;
|
|
||||||
float entertime;
|
|
||||||
int frags;
|
|
||||||
int ping;
|
|
||||||
byte pl;
|
|
||||||
|
|
||||||
// skin information
|
|
||||||
int topcolor;
|
|
||||||
int bottomcolor;
|
|
||||||
struct info_key_s *skinname;
|
|
||||||
struct skin_s *skin;
|
|
||||||
|
|
||||||
int spectator;
|
|
||||||
int stats[MAX_CL_STATS]; // health, etc
|
|
||||||
int prevcount;
|
|
||||||
} player_info_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// generated on client side
|
// generated on client side
|
||||||
usercmd_t cmd; // cmd that generated the frame
|
usercmd_t cmd; // cmd that generated the frame
|
||||||
|
|
Loading…
Reference in a new issue