mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
several little tweaks that more than make up for the reversion of low-copy
This commit is contained in:
parent
44b36e4d6b
commit
9bf575d081
4 changed files with 55 additions and 70 deletions
|
@ -153,33 +153,21 @@ MSG_GetReadCount (msg_t *msg)
|
|||
int
|
||||
MSG_ReadChar (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
if (msg->readcount + 1 <= msg->message->cursize)
|
||||
return (signed char) msg->message->data[msg->readcount++];
|
||||
|
||||
if (msg->readcount + 1 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (signed char) msg->message->data[msg->readcount];
|
||||
msg->readcount++;
|
||||
|
||||
return c;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadByte (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
if (msg->readcount + 1 <= msg->message->cursize)
|
||||
return (unsigned char) msg->message->data[msg->readcount++];
|
||||
|
||||
if (msg->readcount + 1 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (unsigned char) msg->message->data[msg->readcount];
|
||||
msg->readcount++;
|
||||
|
||||
return c;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -187,18 +175,16 @@ MSG_ReadShort (msg_t *msg)
|
|||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 2 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
if (msg->readcount + 2 <= msg->message->cursize) {
|
||||
c = (short) (msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8));
|
||||
msg->readcount += 2;
|
||||
return c;
|
||||
}
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
|
||||
c = (short) (msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8));
|
||||
|
||||
msg->readcount += 2;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -206,20 +192,17 @@ MSG_ReadLong (msg_t *msg)
|
|||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 4 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
if (msg->readcount + 4 <= msg->message->cursize) {
|
||||
c = msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8)
|
||||
+ (msg->message->data[msg->readcount + 2] << 16)
|
||||
+ (msg->message->data[msg->readcount + 3] << 24);
|
||||
msg->readcount += 4;
|
||||
return c;
|
||||
}
|
||||
|
||||
c = msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8)
|
||||
+ (msg->message->data[msg->readcount + 2] << 16)
|
||||
+ (msg->message->data[msg->readcount + 3] << 24);
|
||||
|
||||
msg->readcount += 4;
|
||||
|
||||
return c;
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -231,21 +214,21 @@ MSG_ReadFloat (msg_t *msg)
|
|||
int l;
|
||||
} dat;
|
||||
|
||||
if (msg->readcount + 4 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
if (msg->readcount + 4 <= msg->message->cursize) {
|
||||
dat.b[0] = msg->message->data[msg->readcount];
|
||||
dat.b[1] = msg->message->data[msg->readcount + 1];
|
||||
dat.b[2] = msg->message->data[msg->readcount + 2];
|
||||
dat.b[3] = msg->message->data[msg->readcount + 3];
|
||||
msg->readcount += 4;
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
dat.b[0] = msg->message->data[msg->readcount];
|
||||
dat.b[1] = msg->message->data[msg->readcount + 1];
|
||||
dat.b[2] = msg->message->data[msg->readcount + 2];
|
||||
dat.b[3] = msg->message->data[msg->readcount + 3];
|
||||
msg->readcount += 4;
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
@ -506,6 +506,9 @@ Hunk_TempAlloc (int size)
|
|||
size = (size + 15) & ~15;
|
||||
|
||||
if (hunk_tempactive) {
|
||||
if (hunk_high_used - hunk_tempmark >= size + sizeof (hunk_t)) {
|
||||
return (hunk_t *) (hunk_base + hunk_size - hunk_high_used) + 1;
|
||||
}
|
||||
Hunk_FreeToHighMark (hunk_tempmark);
|
||||
hunk_tempactive = false;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@ vec3_t shadevector;
|
|||
static void
|
||||
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
||||
{
|
||||
float l;
|
||||
float color[4];
|
||||
int count;
|
||||
int *order;
|
||||
|
@ -129,8 +128,7 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
|||
|
||||
if (!fb) {
|
||||
// normals and vertexes come from the frame list
|
||||
l = shadelight * verts->lightdot;
|
||||
VectorScale (shadecolor, l, color);
|
||||
VectorScale (shadecolor, verts->lightdot, color);
|
||||
|
||||
qfglColor4fv (color);
|
||||
}
|
||||
|
@ -289,7 +287,8 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
|
|||
vert_order_t *vo;
|
||||
|
||||
if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) {
|
||||
Con_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame);
|
||||
Con_Printf ("R_AliasSetupFrame: no such frame %d %s\n", frame,
|
||||
currententity->model->name);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
|
@ -439,13 +438,6 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
|||
if (cull && R_CullBox (mins, maxs))
|
||||
return;
|
||||
|
||||
// FIXME: shadecolor is supposed to be the lighting for the model, not
|
||||
// just colormod
|
||||
shadecolor[0] = e->colormod[0] * 2.0;
|
||||
shadecolor[1] = e->colormod[1] * 2.0;
|
||||
shadecolor[2] = e->colormod[2] * 2.0;
|
||||
modelalpha = e->alpha;
|
||||
|
||||
VectorCopy (e->origin, r_entorigin);
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
|
||||
|
@ -488,6 +480,11 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
|||
VectorNormalize (shadevector);
|
||||
}
|
||||
|
||||
shadecolor[0] = e->colormod[0] * 2.0 * shadelight;
|
||||
shadecolor[1] = e->colormod[1] * 2.0 * shadelight;
|
||||
shadecolor[2] = e->colormod[2] * 2.0 * shadelight;
|
||||
modelalpha = e->alpha;
|
||||
|
||||
// locate the proper data
|
||||
paliashdr = Cache_Get (&e->model->cache);
|
||||
c_alias_polys += paliashdr->mdl.numtris;
|
||||
|
|
|
@ -327,7 +327,7 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
msurface_t *surf;
|
||||
mtexinfo_t *tex;
|
||||
vec3_t mid;
|
||||
|
||||
loop:
|
||||
if (node->contents < 0)
|
||||
return -1; // didn't hit anything
|
||||
|
||||
|
@ -338,8 +338,10 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
back = DotProduct (end, plane->normal) - plane->dist;
|
||||
side = front < 0;
|
||||
|
||||
if ((back < 0) == side)
|
||||
return RecursiveLightPoint (node->children[side], start, end);
|
||||
if ((back < 0) == side) {
|
||||
node = node->children[side];
|
||||
goto loop;
|
||||
}
|
||||
|
||||
frac = front / (front - back);
|
||||
mid[0] = start[0] + (end[0] - start[0]) * frac;
|
||||
|
|
Loading…
Reference in a new issue