0
0
Fork 0
mirror of https://git.code.sf.net/p/quake/quakeforge synced 2025-03-21 18:01:15 +00:00

grievre's patch to enable fullbright skins, controlled rotation and server

control of various features
This commit is contained in:
Bill Currie 2004-07-11 01:41:01 +00:00
parent b36569eb9f
commit a89d8d23a3
6 changed files with 117 additions and 14 deletions

View file

@ -199,6 +199,26 @@ typedef struct
extern client_static_t cls;
#define FPD_NO_MACROS 0x0001 // Many clients ignore this, and it isn't used, but let's honor it
#define FPD_NO_TIMERS 0x0002 // We never allow timers anyway
#define FPD_NO_STRIGGER 0x0004 // Don't have soundtrigger yet, but this disables it
#define FPD_HIDE_PERCENTE 0x0020 // Ditto
#define FPD_HIDE_POINT 0x0080 // Can ignore if we do visibility checking for point
#define FPD_NO_TEAMSKIN 0x0100 // Disable skin force
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
#define FPD_HIDE_ITEM 0x0400 // No idea what this does
#define FPD_LIMIT_PITCH 0x4000 // Limit pitchspeed
#define FPD_LIMIT_YAW 0x8000 // Limit yawspeed
#define FPD_DEFAULT (FPD_HIDE_PERCENTE | FPD_NO_TEAMSKIN)
// These limits prevent a usable RJ script, requiring > 0.1 sec of turning time.
#define FPD_MAXPITCH 1000
#define FPD_MAXYAW 2000
// Default fbskins value. This should really be different for different gamedirs, but eh
#define FBSKINS_DEFAULT 0.0
/*
the client_state_t structure is wiped completely at every server signon
*/
@ -279,6 +299,8 @@ typedef struct
int no_pogo_stick;
int teamplay;
int watervis;
int fpd;
int fbskins;
// refresh related state
struct model_s *worldmodel; // cl_entitites[0].model
@ -333,6 +355,7 @@ extern struct cvar_s *hud_pl;
extern struct cvar_s *skin;
extern struct cvar_s *cl_fb_players;
#define MAX_STATIC_ENTITIES 128 // torches, etc

View file

@ -459,6 +459,15 @@ CL_LinkPacketEntities (void)
(*ent)->model = model = cl.model_precache[s1->modelindex];
(*ent)->min_light = 0;
(*ent)->fullbright = 0;
if (s1->modelindex == cl_playerindex) {
(*ent)->min_light = min (cl.fbskins, cl_fb_players->value);
if ((*ent)->min_light >= 1.0)
(*ent)->fullbright = 1;
}
// set colormap
if (s1->colormap && (s1->colormap <= MAX_CLIENTS)
&& cl.players[s1->colormap - 1].name[0]
@ -940,6 +949,10 @@ CL_LinkPlayers (void)
ent->frame = state->frame;
ent->colormap = info->translations;
ent->skinnum = state->skinnum;
ent->min_light = 0;
ent->fullbright = 0;
if (state->modelindex == cl_playerindex) { //XXX
// use custom skin
if (!info->skin)
@ -952,6 +965,11 @@ CL_LinkPlayers (void)
} else {
ent->skin = NULL;
}
ent->min_light = min (cl.fbskins, cl_fb_players->value);
if (ent->min_light >= 1.0)
ent->fullbright = 1;
} else {
ent->skin = NULL;
}

View file

@ -436,33 +436,42 @@ cvar_t *cl_yawspeed;
static void
CL_AdjustAngles (void)
{
float down, up, speed;
float down, up;
float pitchspeed, yawspeed;
if (in_speed.state & 1)
speed = host_frametime * cl_anglespeedkey->value;
else
speed = host_frametime;
pitchspeed = cl_pitchspeed->value;
yawspeed = cl_yawspeed->value;
if (in_speed.state & 1) {
pitchspeed *= cl_anglespeedkey->value;
yawspeed *= cl_anglespeedkey->value;
}
if ((cl.fpd & FPD_LIMIT_PITCH) && pitchspeed > FPD_MAXPITCH)
pitchspeed = FPD_MAXPITCH;
if ((cl.fpd & FPD_LIMIT_YAW) && pitchspeed > FPD_MAXYAW)
pitchspeed = FPD_MAXYAW;
if (!(in_strafe.state & 1)) {
cl.viewangles[YAW] -=
speed * cl_yawspeed->value * CL_KeyState (&in_right);
host_frametime * yawspeed * CL_KeyState (&in_right);
cl.viewangles[YAW] +=
speed * cl_yawspeed->value * CL_KeyState (&in_left);
host_frametime * yawspeed * CL_KeyState (&in_left);
cl.viewangles[YAW] = anglemod (cl.viewangles[YAW]);
}
if (in_klook.state & 1) {
V_StopPitchDrift ();
cl.viewangles[PITCH] -=
speed * cl_pitchspeed->value * CL_KeyState (&in_forward);
host_frametime * pitchspeed * CL_KeyState (&in_forward);
cl.viewangles[PITCH] +=
speed * cl_pitchspeed->value * CL_KeyState (&in_back);
host_frametime * pitchspeed * CL_KeyState (&in_back);
}
up = CL_KeyState (&in_lookup);
down = CL_KeyState (&in_lookdown);
cl.viewangles[PITCH] -= speed * cl_pitchspeed->value * up;
cl.viewangles[PITCH] += speed * cl_pitchspeed->value * down;
cl.viewangles[PITCH] -= host_frametime * pitchspeed * up;
cl.viewangles[PITCH] += host_frametime * pitchspeed * down;
if (up || down)
V_StopPitchDrift ();

View file

@ -166,6 +166,8 @@ cvar_t *localid;
cvar_t *cl_port;
cvar_t *cl_autorecord;
cvar_t *cl_fb_players;
static qboolean allowremotecmd = true;
/* info mirrors */
@ -396,6 +398,11 @@ CL_ClearState (void)
// wipe the entire cl structure
Info_Destroy (cl.serverinfo);
memset (&cl, 0, sizeof (cl));
// Note: we should probably hack around this and give diff values for diff gamedirs
cl.fpd = FPD_DEFAULT;
cl.fbskins = FBSKINS_DEFAULT;
for (i = 0; i < UPDATE_BACKUP; i++)
cl.frames[i].packet_entities.entities = cl_entities[i];
memset (cl_entities, 0, sizeof (cl_entities));
@ -625,6 +632,12 @@ CL_FullServerinfo_f (void)
if ((p = Info_ValueForKey (cl.serverinfo, "watervis")) && *p) {
cl.watervis = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "fpd")) && *p) {
cl.fpd = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "fbskins")) && *p) {
cl.fbskins = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
Cvar_Set (r_skyname, p);
}
@ -1075,6 +1088,30 @@ Force_CenterView_f (void)
cl.viewangles[PITCH] = 0;
}
static void
CL_PRotate_f (void)
{
if ((cl.fpd & FPD_LIMIT_PITCH) || Cmd_Argc() < 2)
return;
cl.viewangles[PITCH] += atoi (Cmd_Argv (1));
if (cl.viewangles[PITCH] < -70)
cl.viewangles[PITCH] = -70;
else if (cl.viewangles[PITCH] > 80)
cl.viewangles[PITCH] = 80;
}
static void
CL_Rotate_f (void)
{
if ((cl.fpd & FPD_LIMIT_YAW) || Cmd_Argc() < 2)
return;
cl.viewangles[YAW] += atoi (Cmd_Argv (1));
cl.viewangles[YAW] = anglemod (cl.viewangles[YAW]);
}
void
CL_SetState (cactive_t state)
{
@ -1177,6 +1214,8 @@ CL_Init (void)
"uploading");
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
"to be level");
Cmd_AddCommand ("rotate", CL_Rotate_f, "Look left or right a given amount. Usage: rotate <degrees>");
Cmd_AddCommand ("protate", CL_PRotate_f, "Look up or down a given amount. Usage: protate <degrees>");
// forward to server commands
Cmd_AddCommand ("kill", CL_Cmd_ForwardToServer, "Suicide :)");
Cmd_AddCommand ("pause", CL_Cmd_ForwardToServer, "Pause the game");
@ -1239,6 +1278,8 @@ CL_Init_Cvars (void)
"turn `run' speed multiplier");
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
"backward speed");
cl_fb_players = Cvar_Get ("cl_fb_players", "0", CVAR_ARCHIVE, NULL, "fullbrightness of player models. "
"server must allow (via fbskins serverinfo).");
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
"forward speed");
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,

View file

@ -1104,6 +1104,10 @@ CL_ServerInfo (void)
Sbar_DMO_Init_f (hud_scoreboard_uid); // HUD setup, cl.teamplay changed
} else if (strequal (key, "watervis")) {
cl.watervis = atoi (value);
} else if (strequal (key, "fpd")) {
cl.fpd = atoi (value);
} else if (strequal (key, "fbskins")) {
cl.fbskins = atoi (value);
// } else if (strequal (key, "*z_ext") {
// cl.z_ext = atoi (value);
// } else if (strequal (key, "pm_bunnyspeedcap") {

View file

@ -131,7 +131,7 @@ Team_ParseSay (const char *s)
size_t i, bracket;
static location_t *location = NULL;
if (!cl_parsesay->int_val)
if (!cl_parsesay->int_val || (cl.fpd & FPD_NO_MACROS))
return s;
i = 0;
@ -435,6 +435,13 @@ static const char *
Team_F_Skins (char *args)
{
int totalfb, l;
float allfb = 0.0;
allfb = min (cl.fbskins, cl_fb_players->value);
if (allfb >= 1.0) {
return "say Player models fullbright";
}
while (isspace ((byte) *args))
args++;
@ -442,8 +449,9 @@ Team_F_Skins (char *args)
if (l == 0) {
totalfb = Skin_FbPercent (0);
return va ("say Average percent fullbright for all loaded skins is "
"%d.%d%%", totalfb / 10, totalfb % 10);
return va ("say Player models have %f%% brightness\n"
"say Average percent fullbright for all loaded skins is "
"%d.%d%%", allfb * 100, totalfb / 10, totalfb % 10);
}
totalfb = Skin_FbPercent (args);