8000 Update to released version of the game by tomkidd · Pull Request #1 · atsb/wrathplaces · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update to released version of the game #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions bspfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ typedef struct dplane_s
#define CONTENTSQ3_TRIGGER 0x40000000 // used by trigger entities
#define CONTENTSQ3_NODROP 0x80000000 // remove items that fall into this brush

#define CONTENTSWRATH_INTERACTCLIP 0x00000080 // Reki: dphitcontents is shit, this *should* passthrough directly but for some reason has
#define CONTENTSWRATH_UNUSED1 0x00000100 // to go through some hacky hardcoded translation layer... not good
#define CONTENTSWRATH_UNUSED2 0x00000200 //
#define CONTENTSWRATH_UNUSED3 0x00000400 //
#define CONTENTSWRATH_UNUSED4 0x00000800 //

#define SUPERCONTENTS_SOLID 0x00000001
#define SUPERCONTENTS_WATER 0x00000002
#define SUPERCONTENTS_SLIME 0x00000004
Expand All @@ -201,6 +207,11 @@ typedef struct dplane_s
#define SUPERCONTENTS_DONOTENTER 0x00000400
#define SUPERCONTENTS_BOTCLIP 0x00000800
#define SUPERCONTENTS_OPAQUE 0x00001000
#define SUPERCONTENTS_INTERACTCLIP 0x00002000
#define SUPERCONTENTS_WRATHUNUSED1 0x00004000
#define SUPERCONTENTS_WRATHUNUSED2 0x00008000
#define SUPERCONTENTS_WRATHUNUSED3 0x00010000
#define SUPERCONTENTS_WRATHUNUSED4 0x00020000
// TODO: is there any reason to define:
// fog?
// areaportal?
Expand Down
8 changes: 4 additions & 4 deletions cl_collision.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int
continue;
// don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
if ((clipgroup & (int)PRVM_clientedictfloat(touch, clipgroup)) != 0)

continue;
// don't clip points against points (they can't collide)
if (VectorCompare(PRVM_clientedictvector(touch, mins), PRVM_clientedictvector(touch, maxs)) && (type != MOVE_MISSILE || !((int)PRVM_clientedictfloat(touch, flags) & FL_MONSTER)))
Expand Down Expand Up @@ -607,8 +608,7 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
if (passedictprog == PRVM_clientedictedict(touch, owner))
continue;
// don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
if ((clipgroup & (int)PRVM_clientedictfloat(touch, clipgroup)) != 0)
continue;
if ((clipgroup & (int)PRVM_clientedictfloat(touch, clipgroup)) != 0) continue;
// don't clip points against points (they can't collide)
if (VectorCompare(PRVM_clientedictvector(touch, mins), PRVM_clientedictvector(touch, maxs)) && (type != MOVE_MISSILE || !((int)PRVM_clientedictfloat(touch, flags) & FL_MONSTER)))
continue;
Expand Down Expand Up @@ -856,8 +856,8 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
if (passedictprog == PRVM_clientedictedict(touch, owner))
continue;
// don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
if ((clipgroup & (int)PRVM_clientedictfloat(touch, clipgroup)) != 0)
continue;
if ((clipgroup & (int)PRVM_clientedictfloat(touch, clipgroup)) != 0) continue;

// don't clip points against points (they can't collide)
if (pointtrace && VectorCompare(PRVM_clientedictvector(touch, mins), PRVM_clientedictvector(touch, maxs)) && (type != MOVE_MISSILE || !((int)PRVM_clientedictfloat(touch, flags) & FL_MONSTER)))
continue;
Expand Down
2 changes: 1 addition & 1 deletion cl_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void CL_ReadDemoMessage(void)
cls.td_onesecondnexttime++;
}
}
else if (cl.time <= cl.mtime[0])
else if (cl.time < cl.mtime[0])
{
// don't need another message yet
return;
Expand Down
68 changes: 66 additions & 2 deletions cl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ CL_Input
Send the intended movement message to the server
================
*/
void CL_Input (void)
void CL_Input(void)
{
float mx, my;
static float old_mouse_x = 0, old_mouse_y = 0;
Expand Down Expand Up @@ -1306,6 +1306,20 @@ static void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
trace_t trace;
qboolean moving;

gravity = cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
if (cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
s->velocity[2] -= gravity * 0.5f;
else
s->velocity[2] -= gravity;
moving = s->velocity[0] || s->velocity[1];
CL_ClientMovement_Move(s);
if (!(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND) || !s->onground || (s->onground && moving))
{
if (cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
s->velocity[2] -= gravity * 0.5f;
}
return;

// jump if on ground with jump button pressed but only if it has been
// released at least once since the last jump
if (s->cmd.jump)
Expand Down Expand Up @@ -1814,7 +1828,7 @@ void CL_SendMove(void)
// ridiculous value rejection (matches qw)
if (cl.cmd.msec > 250)
cl.cmd.msec = 100;
cl.cmd.frametime = cl.cmd.msec * (1.0 / 1000.0);
cl.cmd.frametime = (cl.cmd.time - cl.movecmd[1].time);//cl.cmd.msec * (1.0 / 1000.0);

cl.cmd.predicted = cl_movement.integer != 0;

Expand Down Expand Up @@ -1842,6 +1856,7 @@ void CL_SendMove(void)
break;
case PROTOCOL_DARKPLACES6:
case PROTOCOL_DARKPLACES7:
case PROTOCOL_WRATH:
// FIXME: cl.cmd.buttons & 16 is +button5, Nexuiz/Xonotic specific
cl.cmd.crouch = (cl.cmd.buttons & 16) != 0;
break;
Expand All @@ -1850,7 +1865,10 @@ void CL_SendMove(void)
}

if (quemove)
{
CL_VM_Input_Frame(&cl.cmd);
cl.movecmd[0] = cl.cmd;
}

// don't predict more than 200fps
if (realtime >= cl.lastpackettime + 0.005)
Expand Down Expand Up @@ -2051,6 +2069,52 @@ void CL_SendMove(void)
MSG_WriteShort (&buf, cmd->cursor_entitynumber);
}
break;
case PROTOCOL_WRATH:
// set the maxusercmds variable to limit how many should be sent
maxusercmds = bound(1, cl_netrepeatinput.integer + 1, min(3, CL_MAX_USERCMDS));
// when movement prediction is off, there's not much point in repeating old input as it will just be ignored
if (!cl.cmd.predicted)
maxusercmds = 1;

// send the latest moves in order, the old ones will be
// ignored by the server harmlessly, however if the previous
// packets were lost these moves will be used
//
// this reduces packet loss impact on gameplay.
for (j = 0, cmd = &cl.movecmd[maxusercmds - 1]; j < maxusercmds; j++, cmd--)
{
// don't repeat any stale moves
if (cmd->sequence && cmd->sequence < cls.servermovesequence)
continue;
// 5/9 bytes
MSG_WriteByte(&buf, clc_move);
MSG_WriteLong(&buf, cmd->predicted ? cmd->sequence : 0);
MSG_WriteFloat(&buf, cmd->time); // last server packet time
MSG_WriteByte(&buf, cmd->msec); // last server packet time
// 10 bytes
MSG_WriteAngle32f(&buf, cmd->viewangles[0]);
MSG_WriteAngle32f(&buf, cmd->viewangles[1]);
MSG_WriteAngle16i(&buf, cmd->viewangles[2]);
// 6 bytes
MSG_WriteCoord16i(&buf, cmd->forwardmove);
MSG_WriteCoord16i(&buf, cmd->sidemove);
MSG_WriteCoord16i(&buf, cmd->upmove);
// 5 bytes
MSG_WriteLong(&buf, cmd->buttons);
MSG_WriteByte(&buf, cmd->impulse);
// PRYDON_CLIENTCURSOR
// 30 bytes
MSG_WriteShort(&buf, (short)(cmd->cursor_screen[0] * 32767.0f));
MSG_WriteShort(&buf, (short)(cmd->cursor_screen[1] * 32767.0f));
MSG_WriteFloat(&buf, cmd->cursor_start[0]);
MSG_WriteFloat(&buf, cmd->cursor_start[1]);
MSG_WriteFloat(&buf, cmd->cursor_start[2]);
MSG_WriteFloat(&buf, cmd->cursor_impact[0]);
MSG_WriteFloat(&buf, cmd->cursor_impact[1]);
MSG_WriteFloat(&buf, cmd->cursor_impact[2]);
MSG_WriteShort(&buf, cmd->cursor_entitynumber);
}
break;
case PROTOCOL_UNKNOWN:
break;
}
Expand Down
10 changes: 8 additions & 2 deletions cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "r_shadow.h"
#include "libcurl.h"
#include "snd_main.h"
#include "cl_steam.h"

// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
Expand Down Expand Up @@ -1540,8 +1541,8 @@ static void CL_LinkNetworkEntity(entity_t *e)
// FIXME: add ambient/diffuse/specular scales as an extension ontop of TENEBRAE_GFX_DLIGHTS?
Matrix4x4_Normalize(&dlightmatrix, &e->render.matrix);
Matrix4x4_Scale(&dlightmatrix, light[3], 1);
R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &dlightmatrix, light, e->state_current.lightstyle, e->state_current.skin > 0 ? va(vabuf, sizeof(vabuf), "cubemaps/%i", e->state_current.skin) : NULL, !(e->state_current.lightpflags & PFLAGS_NOSHADOW), (e->state_current.lightpflags & PFLAGS_CORONA) != 0, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
r_refdef.scene.lights[r_refdef.scene.numlights] = &r_refdef.scene.templights[r_refdef.scene.numlights];r_refdef.scene.numlights++;
R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &dlightmatrix, light, e->state_current.lightstyle, e->state_current.skin > 0 ? va(vabuf, sizeof(vabuf), "cubemaps/%i", e->state_current.skin) : NULL, !(e->state_current.lightpflags & PFLAGS_NOSHADOW), (e->state_current.lightpflags & PFLAGS_CORONA) != 0, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE | (e->state_current.lightpflags & PFLAGS_LODFADE ? LIGHTFLAG_DISTANCEFADE : 0));
r_refdef.scene.lights[r_refdef.scene.numlights] = &r_refdef.scene.templights[r_refdef.scene.numlights]; r_refdef.scene.numlights++;
}
// make the glow dlight
else if (dlightradius > 0 && (dlightcolor[0] || dlightcolor[1] || dlightcolor[2]) && !(e->render.flags & RENDER_VIEWMODEL) && r_refdef.scene.numlights < MAX_DLIGHTS)
Expand Down Expand Up @@ -1948,6 +1949,9 @@ void CL_UpdateWorld(void)
// decals, particles, and explosions will be updated during rneder
}

// Reki (May 4 2023): Run steam tick every render frame
Steam_Tick();

r_refdef.scene.time = cl.time;
}

Expand Down Expand Up @@ -2499,4 +2503,6 @@ void CL_Init (void)
CL_Screen_Init();

CL_Video_Init();

Steam_Startup();
}
120 changes: 119 additions & 1 deletion cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ const char *svc_strings[128] =
"svc_trailparticles", // 60 // [short] entnum [short] effectnum [vector] start [vector] end
"svc_pointparticles", // 61 // [short] effectnum [vector] start [vector] velocity [short] count
"svc_pointparticles1", // 62 // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
"", // 63
"", // 64
"svcwrath_advsound", // 65
"", // 66
"", // 67
"", // 68
"", // 69
};

const char *qw_svc_strings[128] =
Expand Down Expand Up @@ -270,6 +277,9 @@ static void CL_ParseStartSoundPacket(int largesoundindex)
sound_num = (unsigned short) MSG_ReadShort(&cl_message);
else
sound_num = MSG_ReadByte(&cl_message);

if (field_mask & SND_FLAGS)
fflags |= MSG_ReadByte(&cl_message);
}

channel = CHAN_NET2ENGINE(channel);
Expand All @@ -291,10 +301,90 @@ static void CL_ParseStartSoundPacket(int largesoundindex)
if (ent >= cl.max_entities)
CL_ExpandEntities(ent);

if( !CL_VM_Event_Sound(sound_num, volume / 255.0f, channel, attenuation, ent, pos, fflags, speed) )
if( !CL_VM_Event_Sound(sound_num, volume / 255.0f, channel, attenuation, ent, pos, fflags, speed, 0) )
S_StartSound_StartPosition_Flags (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0f, attenuation, 0, fflags, speed);
}

static void CL_ParseAdvancedSoundPacket(void)
{
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
int field_mask;
float attenuation;
float speed;
float trapezoid_frac;
int fflags = CHANNELFLAG_NONE;


field_mask = MSG_ReadByte(&cl_message);
if (field_mask & SND_MOREBYTES)
field_mask |= MSG_ReadByte(&cl_message) << 8;

if (field_mask & SND_VOLUME)
volume = MSG_ReadByte(&cl_message);
else
volume = DEFAULT_SOUND_PACKET_VOLUME;

if (field_mask & SND_ATTENUATION)
attenuation = MSG_ReadByte(&cl_message) / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

if (field_mask & SND_SPEEDUSHORT4000)
speed = ((unsigned short)MSG_ReadShort(&cl_message)) / 4000.0f;
else
speed = 1.0f;

if (field_mask & SND_LARGEENTITY)
{
ent = (unsigned short)MSG_ReadShort(&cl_message);
channel = MSG_ReadChar(&cl_message);
}
else
{
channel = (unsigned short)MSG_ReadShort(&cl_message);
ent = channel >> 3;
channel &= 7;
}

if ((field_mask & SND_LARGESOUND) || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
sound_num = (unsigned short)MSG_ReadShort(&cl_message);
else
sound_num = MSG_ReadByte(&cl_message);

if (field_mask & SND_FLAGS)
fflags |= MSG_ReadByte(&cl_message);

channel = CHAN_NET2ENGINE(channel);

MSG_ReadVector(&cl_message, pos, cls.protocol);

if (field_mask & SND_TRAPEZOID)
trapezoid_frac = MSG_ReadByte(&cl_message) / 0xFF;
else
trapezoid_frac = 0;

if (sound_num >= MAX_SOUNDS)
{
Con_Printf("CL_ParseAdvancedSoundPacket: sound_num (%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS);
return;
}

if (ent >= MAX_EDICTS)
{
Con_Printf("CL_ParseAdvancedSoundPacket: ent = %i", ent);
return;
}

if (ent >= cl.max_entities)
CL_ExpandEntities(ent);

if (!CL_VM_Event_Sound(sound_num, volume / 255.0f, channel, attenuation, ent, pos, fflags, speed, trapezoid_frac))
S_StartSound_StartPosition_Wrath(ent, channel, cl.sound_precache[sound_num], pos, volume / 255.0f, attenuation, 0, fflags, speed, trapezoid_frac);
}

/*
==================
CL_KeepaliveMessage
Expand Down Expand Up @@ -1555,6 +1645,12 @@ static void CL_SendPlayerInfo(void)
MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "name \"%s\"", cl_name.string));

if (cls.protocol == PROTOCOL_WRATH)
{
MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "protocolver \"%i\"", PROTOCOL_WRATH_CURRENT));
}

MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", cl_color.integer >> 4, cl_color.integer & 15));

Expand Down Expand Up @@ -3904,6 +4000,7 @@ void CL_ParseServerMessage(void)
strip_pqc = true;
break;
case PROTOCOL_DARKPLACES7:
case PROTOCOL_WRATH:
default:
// ProQuake does not support
// these protocols
Expand Down Expand Up @@ -4093,6 +4190,24 @@ void CL_ParseServerMessage(void)

case svc_signonnum:
i = MSG_ReadByte(&cl_message);

// Reki (April 13 2023): Hijacking this as I do in DOOMBRINGER to add subversioning
// hopefully not too janky?
if (i > 100)
{
switch (i)
{
case 101:
cls.protocolversion = MSG_ReadLong(&cl_message);
Con_Printf("Server protocol subversion is %lu\n", cls.protocolversion);
break;
default:
Host_Error("Received unknown hijack-signon %i", i);
break;
}
break;
}

// LordHavoc: it's rude to kick off the client if they missed the
// reconnect somehow, so allow signon 1 even if at signon 1
if (i <= cls.signon && i != 1)
Expand Down Expand Up @@ -4231,6 +4346,9 @@ void CL_ParseServerMessage(void)
case svc_pointparticles1:
CL_ParsePointParticles1();
break;
case svcwrath_advsound:
CL_ParseAdvancedSoundPacket();
break;
}
// R_TimeReport(svc_strings[cmd]);
}
Expand Down
Loading
0