astyle
parent
00a944ce24
commit
ef6a1262c5
|
@ -19,7 +19,8 @@
|
|||
*/
|
||||
|
||||
// 0
|
||||
{ 1.23, 1.30, 1.47, 1.35, 1.56, 1.71, 1.37, 1.38,
|
||||
{
|
||||
1.23, 1.30, 1.47, 1.35, 1.56, 1.71, 1.37, 1.38,
|
||||
1.59, 1.60, 1.79, 1.97, 1.88, 1.92, 1.79, 1.02,
|
||||
0.93, 1.07, 0.82, 0.87, 0.88, 0.94, 0.96, 1.14,
|
||||
1.11, 0.82, 0.83, 0.89, 0.89, 0.86, 0.94, 0.91,
|
||||
|
@ -54,7 +55,8 @@
|
|||
},
|
||||
|
||||
// 1
|
||||
{ 1.26, 1.26, 1.48, 1.23, 1.50, 1.71, 1.14, 1.19,
|
||||
{
|
||||
1.26, 1.26, 1.48, 1.23, 1.50, 1.71, 1.14, 1.19,
|
||||
1.38, 1.46, 1.64, 1.94, 1.87, 1.84, 1.71, 1.02,
|
||||
0.92, 1.00, 0.79, 0.85, 0.84, 0.91, 0.90, 0.98,
|
||||
0.99, 0.77, 0.77, 0.83, 0.82, 0.79, 0.86, 0.84,
|
||||
|
@ -89,7 +91,8 @@
|
|||
},
|
||||
|
||||
// 2
|
||||
{ 1.34, 1.27, 1.53, 1.17, 1.46, 1.71, 0.98, 1.05,
|
||||
{
|
||||
1.34, 1.27, 1.53, 1.17, 1.46, 1.71, 0.98, 1.05,
|
||||
1.20, 1.34, 1.48, 1.86, 1.82, 1.71, 1.62, 1.09,
|
||||
0.94, 0.99, 0.79, 0.85, 0.82, 0.90, 0.87, 0.93,
|
||||
0.96, 0.76, 0.74, 0.79, 0.76, 0.74, 0.79, 0.78,
|
||||
|
@ -124,7 +127,8 @@
|
|||
},
|
||||
|
||||
// 3
|
||||
{ 1.46, 1.34, 1.60, 1.16, 1.46, 1.71, 0.94, 0.99,
|
||||
{
|
||||
1.46, 1.34, 1.60, 1.16, 1.46, 1.71, 0.94, 0.99,
|
||||
1.05, 1.26, 1.33, 1.74, 1.76, 1.57, 1.54, 1.23,
|
||||
0.98, 1.05, 0.83, 0.89, 0.84, 0.92, 0.87, 0.91,
|
||||
0.96, 0.78, 0.74, 0.79, 0.72, 0.72, 0.75, 0.76,
|
||||
|
@ -159,7 +163,8 @@
|
|||
},
|
||||
|
||||
// 4
|
||||
{ 1.60, 1.44, 1.68, 1.22, 1.49, 1.71, 0.93, 0.99,
|
||||
{
|
||||
1.60, 1.44, 1.68, 1.22, 1.49, 1.71, 0.93, 0.99,
|
||||
0.99, 1.23, 1.22, 1.60, 1.68, 1.44, 1.49, 1.40,
|
||||
1.14, 1.19, 0.89, 0.96, 0.89, 0.97, 0.89, 0.91,
|
||||
0.98, 0.82, 0.76, 0.82, 0.71, 0.72, 0.73, 0.76,
|
||||
|
@ -194,7 +199,8 @@
|
|||
},
|
||||
|
||||
// 5
|
||||
{ 1.74, 1.57, 1.76, 1.33, 1.54, 1.71, 0.94, 1.05,
|
||||
{
|
||||
1.74, 1.57, 1.76, 1.33, 1.54, 1.71, 0.94, 1.05,
|
||||
0.99, 1.26, 1.16, 1.46, 1.60, 1.34, 1.46, 1.59,
|
||||
1.37, 1.37, 0.97, 1.11, 0.96, 1.10, 0.95, 0.94,
|
||||
1.08, 0.89, 0.82, 0.88, 0.72, 0.76, 0.75, 0.80,
|
||||
|
@ -229,7 +235,8 @@
|
|||
},
|
||||
|
||||
// 6
|
||||
{ 1.86, 1.71, 1.82, 1.48, 1.62, 1.71, 0.98, 1.20,
|
||||
{
|
||||
1.86, 1.71, 1.82, 1.48, 1.62, 1.71, 0.98, 1.20,
|
||||
1.05, 1.34, 1.17, 1.34, 1.53, 1.27, 1.46, 1.77,
|
||||
1.60, 1.57, 1.16, 1.38, 1.12, 1.35, 1.06, 1.00,
|
||||
1.28, 0.97, 0.89, 0.95, 0.76, 0.81, 0.79, 0.86,
|
||||
|
@ -264,7 +271,8 @@
|
|||
},
|
||||
|
||||
// 7
|
||||
{ 1.94, 1.84, 1.87, 1.64, 1.71, 1.71, 1.14, 1.38,
|
||||
{
|
||||
1.94, 1.84, 1.87, 1.64, 1.71, 1.71, 1.14, 1.38,
|
||||
1.19, 1.46, 1.23, 1.26, 1.48, 1.26, 1.50, 1.91,
|
||||
1.80, 1.76, 1.41, 1.61, 1.39, 1.59, 1.33, 1.24,
|
||||
1.51, 1.18, 0.97, 1.11, 0.82, 0.88, 0.86, 0.94,
|
||||
|
@ -299,7 +307,8 @@
|
|||
},
|
||||
|
||||
// 8
|
||||
{ 1.97, 1.92, 1.88, 1.79, 1.79, 1.71, 1.37, 1.59,
|
||||
{
|
||||
1.97, 1.92, 1.88, 1.79, 1.79, 1.71, 1.37, 1.59,
|
||||
1.38, 1.60, 1.35, 1.23, 1.47, 1.30, 1.56, 1.99,
|
||||
1.93, 1.90, 1.60, 1.78, 1.61, 1.79, 1.57, 1.48,
|
||||
1.72, 1.40, 1.14, 1.37, 0.89, 0.96, 0.94, 1.07,
|
||||
|
@ -334,7 +343,8 @@
|
|||
},
|
||||
|
||||
// 9
|
||||
{ 1.94, 1.97, 1.87, 1.91, 1.85, 1.71, 1.60, 1.77,
|
||||
{
|
||||
1.94, 1.97, 1.87, 1.91, 1.85, 1.71, 1.60, 1.77,
|
||||
1.58, 1.74, 1.51, 1.26, 1.48, 1.39, 1.64, 1.99,
|
||||
1.97, 1.99, 1.70, 1.85, 1.76, 1.91, 1.76, 1.70,
|
||||
1.88, 1.55, 1.33, 1.57, 0.96, 1.08, 1.05, 1.31,
|
||||
|
@ -369,7 +379,8 @@
|
|||
},
|
||||
|
||||
// 10
|
||||
{ 1.86, 1.95, 1.82, 1.98, 1.89, 1.71, 1.80, 1.91,
|
||||
{
|
||||
1.86, 1.95, 1.82, 1.98, 1.89, 1.71, 1.80, 1.91,
|
||||
1.77, 1.86, 1.67, 1.34, 1.53, 1.51, 1.72, 1.92,
|
||||
1.91, 1.99, 1.69, 1.82, 1.80, 1.94, 1.87, 1.86,
|
||||
1.97, 1.59, 1.44, 1.69, 1.05, 1.24, 1.27, 1.49,
|
||||
|
@ -404,7 +415,8 @@
|
|||
},
|
||||
|
||||
// 11
|
||||
{ 1.74, 1.89, 1.76, 1.98, 1.89, 1.71, 1.93, 1.99,
|
||||
{
|
||||
1.74, 1.89, 1.76, 1.98, 1.89, 1.71, 1.93, 1.99,
|
||||
1.91, 1.94, 1.82, 1.46, 1.60, 1.65, 1.80, 1.79,
|
||||
1.77, 1.92, 1.57, 1.69, 1.74, 1.87, 1.88, 1.94,
|
||||
1.98, 1.53, 1.45, 1.70, 1.18, 1.32, 1.42, 1.58,
|
||||
|
@ -439,7 +451,8 @@
|
|||
},
|
||||
|
||||
// 12
|
||||
{ 1.60, 1.78, 1.68, 1.93, 1.86, 1.71, 1.97, 1.99,
|
||||
{
|
||||
1.60, 1.78, 1.68, 1.93, 1.86, 1.71, 1.97, 1.99,
|
||||
1.99, 1.97, 1.93, 1.60, 1.68, 1.78, 1.86, 1.61,
|
||||
1.57, 1.79, 1.37, 1.48, 1.59, 1.72, 1.79, 1.92,
|
||||
1.90, 1.38, 1.35, 1.60, 1.23, 1.30, 1.47, 1.56,
|
||||
|
@ -474,7 +487,8 @@
|
|||
},
|
||||
|
||||
// 13
|
||||
{ 1.46, 1.65, 1.60, 1.82, 1.80, 1.71, 1.93, 1.91,
|
||||
{
|
||||
1.46, 1.65, 1.60, 1.82, 1.80, 1.71, 1.93, 1.91,
|
||||
1.99, 1.94, 1.98, 1.74, 1.76, 1.89, 1.89, 1.42,
|
||||
1.34, 1.61, 1.11, 1.22, 1.36, 1.50, 1.61, 1.81,
|
||||
1.75, 1.15, 1.17, 1.41, 1.18, 1.19, 1.42, 1.44,
|
||||
|
@ -509,7 +523,8 @@
|
|||
},
|
||||
|
||||
// 14
|
||||
{ 1.34, 1.51, 1.53, 1.67, 1.72, 1.71, 1.80, 1.77,
|
||||
{
|
||||
1.34, 1.51, 1.53, 1.67, 1.72, 1.71, 1.80, 1.77,
|
||||
1.91, 1.86, 1.98, 1.86, 1.82, 1.95, 1.89, 1.24,
|
||||
1.10, 1.41, 0.95, 0.99, 1.09, 1.25, 1.37, 1.63,
|
||||
1.55, 0.96, 0.98, 1.16, 1.05, 1.00, 1.27, 1.23,
|
||||
|
@ -544,7 +559,8 @@
|
|||
},
|
||||
|
||||
// 15
|
||||
{ 1.26, 1.39, 1.48, 1.51, 1.64, 1.71, 1.60, 1.58,
|
||||
{
|
||||
1.26, 1.39, 1.48, 1.51, 1.64, 1.71, 1.60, 1.58,
|
||||
1.77, 1.74, 1.91, 1.94, 1.87, 1.97, 1.85, 1.10,
|
||||
0.97, 1.22, 0.88, 0.92, 0.95, 1.01, 1.11, 1.39,
|
||||
1.32, 0.88, 0.90, 0.97, 0.96, 0.93, 1.05, 0.99,
|
||||
|
|
|
@ -45,7 +45,8 @@ void CFG_ReadCvars (const char **vars, int32_t num_vars)
|
|||
|
||||
j = 0;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
i = 0;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
// we expect a line in the format that Cvar_WriteVariables
|
||||
|
@ -104,7 +105,8 @@ void CFG_ReadCvars (const char **vars, int32_t num_vars)
|
|||
if(j == num_vars)
|
||||
break;
|
||||
|
||||
} while (!FS_feof(cfg_file) && !FS_ferror(cfg_file));
|
||||
}
|
||||
while(!FS_feof(cfg_file) && !FS_ferror(cfg_file));
|
||||
|
||||
FS_rewind(cfg_file);
|
||||
}
|
||||
|
|
|
@ -425,7 +425,8 @@ void CL_PlayDemo_f (void)
|
|||
c = getc(cls.demofile);
|
||||
if(c == '\n')
|
||||
break;
|
||||
if (c == '-') {
|
||||
if(c == '-')
|
||||
{
|
||||
neg = true;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,8 @@ void KeyUp (kbutton_t *b)
|
|||
if(c[0])
|
||||
k = atoi(c);
|
||||
else
|
||||
{ // typed manually at the console, assume for unsticking, so clear all
|
||||
{
|
||||
// typed manually at the console, assume for unsticking, so clear all
|
||||
b->down[0] = b->down[1] = 0;
|
||||
b->state = 4; // impulse up
|
||||
return;
|
||||
|
@ -119,49 +120,152 @@ void KeyUp (kbutton_t *b)
|
|||
b->state |= 4; // impulse up
|
||||
}
|
||||
|
||||
void IN_KLookDown (void) {KeyDown(&in_klook);}
|
||||
void IN_KLookUp (void) {KeyUp(&in_klook);}
|
||||
void IN_MLookDown (void) {KeyDown(&in_mlook);}
|
||||
void IN_MLookUp (void) {
|
||||
void IN_KLookDown(void)
|
||||
{
|
||||
KeyDown(&in_klook);
|
||||
}
|
||||
void IN_KLookUp(void)
|
||||
{
|
||||
KeyUp(&in_klook);
|
||||
}
|
||||
void IN_MLookDown(void)
|
||||
{
|
||||
KeyDown(&in_mlook);
|
||||
}
|
||||
void IN_MLookUp(void)
|
||||
{
|
||||
KeyUp(&in_mlook);
|
||||
if(!(in_mlook.state & 1) && lookspring.value)
|
||||
V_StartPitchDrift();
|
||||
}
|
||||
void IN_UpDown(void) {KeyDown(&in_up);}
|
||||
void IN_UpUp(void) {KeyUp(&in_up);}
|
||||
void IN_DownDown(void) {KeyDown(&in_down);}
|
||||
void IN_DownUp(void) {KeyUp(&in_down);}
|
||||
void IN_LeftDown(void) {KeyDown(&in_left);}
|
||||
void IN_LeftUp(void) {KeyUp(&in_left);}
|
||||
void IN_RightDown(void) {KeyDown(&in_right);}
|
||||
void IN_RightUp(void) {KeyUp(&in_right);}
|
||||
void IN_ForwardDown(void) {KeyDown(&in_forward);}
|
||||
void IN_ForwardUp(void) {KeyUp(&in_forward);}
|
||||
void IN_BackDown(void) {KeyDown(&in_back);}
|
||||
void IN_BackUp(void) {KeyUp(&in_back);}
|
||||
void IN_LookupDown(void) {KeyDown(&in_lookup);}
|
||||
void IN_LookupUp(void) {KeyUp(&in_lookup);}
|
||||
void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
|
||||
void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
|
||||
void IN_MoveleftDown(void) {KeyDown(&in_moveleft);}
|
||||
void IN_MoveleftUp(void) {KeyUp(&in_moveleft);}
|
||||
void IN_MoverightDown(void) {KeyDown(&in_moveright);}
|
||||
void IN_MoverightUp(void) {KeyUp(&in_moveright);}
|
||||
void IN_UpDown(void)
|
||||
{
|
||||
KeyDown(&in_up);
|
||||
}
|
||||
void IN_UpUp(void)
|
||||
{
|
||||
KeyUp(&in_up);
|
||||
}
|
||||
void IN_DownDown(void)
|
||||
{
|
||||
KeyDown(&in_down);
|
||||
}
|
||||
void IN_DownUp(void)
|
||||
{
|
||||
KeyUp(&in_down);
|
||||
}
|
||||
void IN_LeftDown(void)
|
||||
{
|
||||
KeyDown(&in_left);
|
||||
}
|
||||
void IN_LeftUp(void)
|
||||
{
|
||||
KeyUp(&in_left);
|
||||
}
|
||||
void IN_RightDown(void)
|
||||
{
|
||||
KeyDown(&in_right);
|
||||
}
|
||||
void IN_RightUp(void)
|
||||
{
|
||||
KeyUp(&in_right);
|
||||
}
|
||||
void IN_ForwardDown(void)
|
||||
{
|
||||
KeyDown(&in_forward);
|
||||
}
|
||||
void IN_ForwardUp(void)
|
||||
{
|
||||
KeyUp(&in_forward);
|
||||
}
|
||||
void IN_BackDown(void)
|
||||
{
|
||||
KeyDown(&in_back);
|
||||
}
|
||||
void IN_BackUp(void)
|
||||
{
|
||||
KeyUp(&in_back);
|
||||
}
|
||||
void IN_LookupDown(void)
|
||||
{
|
||||
KeyDown(&in_lookup);
|
||||
}
|
||||
void IN_LookupUp(void)
|
||||
{
|
||||
KeyUp(&in_lookup);
|
||||
}
|
||||
void IN_LookdownDown(void)
|
||||
{
|
||||
KeyDown(&in_lookdown);
|
||||
}
|
||||
void IN_LookdownUp(void)
|
||||
{
|
||||
KeyUp(&in_lookdown);
|
||||
}
|
||||
void IN_MoveleftDown(void)
|
||||
{
|
||||
KeyDown(&in_moveleft);
|
||||
}
|
||||
void IN_MoveleftUp(void)
|
||||
{
|
||||
KeyUp(&in_moveleft);
|
||||
}
|
||||
void IN_MoverightDown(void)
|
||||
{
|
||||
KeyDown(&in_moveright);
|
||||
}
|
||||
void IN_MoverightUp(void)
|
||||
{
|
||||
KeyUp(&in_moveright);
|
||||
}
|
||||
|
||||
void IN_SpeedDown(void) {KeyDown(&in_speed);}
|
||||
void IN_SpeedUp(void) {KeyUp(&in_speed);}
|
||||
void IN_StrafeDown(void) {KeyDown(&in_strafe);}
|
||||
void IN_StrafeUp(void) {KeyUp(&in_strafe);}
|
||||
void IN_SpeedDown(void)
|
||||
{
|
||||
KeyDown(&in_speed);
|
||||
}
|
||||
void IN_SpeedUp(void)
|
||||
{
|
||||
KeyUp(&in_speed);
|
||||
}
|
||||
void IN_StrafeDown(void)
|
||||
{
|
||||
KeyDown(&in_strafe);
|
||||
}
|
||||
void IN_StrafeUp(void)
|
||||
{
|
||||
KeyUp(&in_strafe);
|
||||
}
|
||||
|
||||
void IN_AttackDown(void) {KeyDown(&in_attack);}
|
||||
void IN_AttackUp(void) {KeyUp(&in_attack);}
|
||||
void IN_AttackDown(void)
|
||||
{
|
||||
KeyDown(&in_attack);
|
||||
}
|
||||
void IN_AttackUp(void)
|
||||
{
|
||||
KeyUp(&in_attack);
|
||||
}
|
||||
|
||||
void IN_UseDown (void) {KeyDown(&in_use);}
|
||||
void IN_UseUp (void) {KeyUp(&in_use);}
|
||||
void IN_JumpDown (void) {KeyDown(&in_jump);}
|
||||
void IN_JumpUp (void) {KeyUp(&in_jump);}
|
||||
void IN_UseDown(void)
|
||||
{
|
||||
KeyDown(&in_use);
|
||||
}
|
||||
void IN_UseUp(void)
|
||||
{
|
||||
KeyUp(&in_use);
|
||||
}
|
||||
void IN_JumpDown(void)
|
||||
{
|
||||
KeyDown(&in_jump);
|
||||
}
|
||||
void IN_JumpUp(void)
|
||||
{
|
||||
KeyUp(&in_jump);
|
||||
}
|
||||
|
||||
void IN_Impulse (void) {in_impulse=Q_atoi(Cmd_Argv(1));}
|
||||
void IN_Impulse(void)
|
||||
{
|
||||
in_impulse = Q_atoi(Cmd_Argv(1));
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
|
|
|
@ -444,7 +444,8 @@ void CL_RelinkEntities (void)
|
|||
for(i = 1, ent = cl_entities + 1 ; i < cl.num_entities ; i++, ent++)
|
||||
{
|
||||
if(!ent->model)
|
||||
{ // empty slot
|
||||
{
|
||||
// empty slot
|
||||
|
||||
// ericw -- efrags are only used for static entities in GLQuake
|
||||
// ent can't be static, so this is a no-op.
|
||||
|
@ -464,13 +465,15 @@ void CL_RelinkEntities (void)
|
|||
VectorCopy(ent->origin, oldorg);
|
||||
|
||||
if(ent->forcelink)
|
||||
{ // the entity was not updated in the last message
|
||||
{
|
||||
// the entity was not updated in the last message
|
||||
// so move to the final spot
|
||||
VectorCopy(ent->msg_origins[0], ent->origin);
|
||||
VectorCopy(ent->msg_angles[0], ent->angles);
|
||||
}
|
||||
else
|
||||
{ // if the delta is large, assume a teleport and don't lerp
|
||||
{
|
||||
// if the delta is large, assume a teleport and don't lerp
|
||||
f = frac;
|
||||
for(j = 0 ; j < 3 ; j++)
|
||||
{
|
||||
|
@ -614,7 +617,8 @@ int32_t CL_ReadFromServer (void)
|
|||
|
||||
cl.last_received_message = realtime;
|
||||
CL_ParseServerMessage();
|
||||
} while (ret && cls.state == ca_connected);
|
||||
}
|
||||
while(ret && cls.state == ca_connected);
|
||||
|
||||
if(cl_shownet.value)
|
||||
Con_Printf("\n");
|
||||
|
|
|
@ -229,7 +229,8 @@ void CL_KeepaliveMessage (void)
|
|||
Host_Error("CL_KeepaliveMessage: datagram wasn't a nop");
|
||||
break;
|
||||
}
|
||||
} while (ret);
|
||||
}
|
||||
while(ret);
|
||||
|
||||
net_message = old;
|
||||
memcpy(net_message.data, olddata, net_message.cursize);
|
||||
|
@ -276,7 +277,8 @@ void CL_ParseServerInfo (void)
|
|||
// parse protocol version number
|
||||
i = MSG_ReadLong();
|
||||
//johnfitz -- support multiple protocols
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ) {
|
||||
if(i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||
{
|
||||
Con_Printf("\n"); //because there's no newline after serverinfo print
|
||||
Host_Error("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32 "", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
}
|
||||
|
@ -430,7 +432,8 @@ void CL_ParseUpdate (int32_t bits)
|
|||
int32_t skin;
|
||||
|
||||
if(cls.signon == SIGNONS - 1)
|
||||
{ // first update is the final signon stage
|
||||
{
|
||||
// first update is the final signon stage
|
||||
cls.signon = SIGNONS;
|
||||
CL_SignonReply();
|
||||
}
|
||||
|
@ -621,7 +624,8 @@ void CL_ParseUpdate (int32_t bits)
|
|||
//johnfitz
|
||||
|
||||
if(forcelink)
|
||||
{ // didn't have an update last message
|
||||
{
|
||||
// didn't have an update last message
|
||||
VectorCopy(ent->msg_origins[0], ent->msg_origins[1]);
|
||||
VectorCopy(ent->msg_origins[0], ent->origin);
|
||||
VectorCopy(ent->msg_angles[0], ent->msg_angles[1]);
|
||||
|
@ -715,7 +719,8 @@ void CL_ParseClientdata (void)
|
|||
i = MSG_ReadLong();
|
||||
|
||||
if(cl.items != i)
|
||||
{ // set flash times
|
||||
{
|
||||
// set flash times
|
||||
Sbar_Changed();
|
||||
for(j = 0; j < 32; j++)
|
||||
if((i & (1 << j)) && !(cl.items & (1 << j)))
|
||||
|
|
|
@ -89,7 +89,8 @@ typedef struct
|
|||
#define MAX_DEMOS 8
|
||||
#define MAX_DEMONAME 16
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
ca_dedicated, // a dedicated server with no ability to start a client
|
||||
ca_disconnected, // full screen console with no connection
|
||||
ca_connected // valid netcon, talking to a server
|
||||
|
|
|
@ -193,7 +193,8 @@ void Cbuf_Execute (void)
|
|||
Cmd_ExecuteString(line, src_command);
|
||||
|
||||
if(cmd_wait)
|
||||
{ // skip out while text still remains in buffer, leaving it
|
||||
{
|
||||
// skip out while text still remains in buffer, leaving it
|
||||
// for next frame
|
||||
cmd_wait = false;
|
||||
break;
|
||||
|
@ -637,7 +638,8 @@ void Cmd_TokenizeString (const char *text)
|
|||
}
|
||||
|
||||
if(*text == '\n')
|
||||
{ // a newline seperates commands in the buffer
|
||||
{
|
||||
// a newline seperates commands in the buffer
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
|
106
source/common.c
106
source/common.c
|
@ -165,7 +165,8 @@ int32_t q_strcasecmp(const char * s1, const char * s2)
|
|||
c2 = q_tolower(*p2++);
|
||||
if(c1 == '\0')
|
||||
break;
|
||||
} while (c1 == c2);
|
||||
}
|
||||
while(c1 == c2);
|
||||
|
||||
return (int32_t)(c1 - c2);
|
||||
}
|
||||
|
@ -185,7 +186,8 @@ int32_t q_strncasecmp(const char *s1, const char *s2, size_t n)
|
|||
c2 = q_tolower(*p2++);
|
||||
if(c1 == '\0' || c1 != c2)
|
||||
break;
|
||||
} while (--n > 0);
|
||||
}
|
||||
while(--n > 0);
|
||||
|
||||
return (int32_t)(c1 - c2);
|
||||
}
|
||||
|
@ -869,7 +871,8 @@ const char *MSG_ReadString (void)
|
|||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string) - 1);
|
||||
}
|
||||
while(l < sizeof(string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
|
@ -981,11 +984,13 @@ void SZ_Print (sizebuf_t *buf, const char *data)
|
|||
int32_t len = Q_strlen(data) + 1;
|
||||
|
||||
if(buf->data[buf->cursize - 1])
|
||||
{ /* no trailing 0 */
|
||||
{
|
||||
/* no trailing 0 */
|
||||
Q_memcpy((byte *)SZ_GetSpace(buf, len), data, len);
|
||||
}
|
||||
else
|
||||
{ /* write over trailing 0 */
|
||||
{
|
||||
/* write over trailing 0 */
|
||||
Q_memcpy((byte *)SZ_GetSpace(buf, len - 1) - 1, data, len);
|
||||
}
|
||||
}
|
||||
|
@ -1236,7 +1241,8 @@ skipwhite:
|
|||
/* commented out the check for ':' so that ip:port works */
|
||||
if(c == '{' || c == '}' || c == '(' || c == ')' || c == '\''/* || c == ':' */)
|
||||
break;
|
||||
} while (c > 32);
|
||||
}
|
||||
while(c > 32);
|
||||
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
|
@ -1569,7 +1575,8 @@ void COM_CreatePath (char *path)
|
|||
for(ofs = path + 1; *ofs; ofs++)
|
||||
{
|
||||
if(*ofs == '/')
|
||||
{ // create the directory
|
||||
{
|
||||
// create the directory
|
||||
*ofs = 0;
|
||||
Sys_mkdir(path);
|
||||
*ofs = '/';
|
||||
|
@ -1641,7 +1648,8 @@ static int32_t COM_FindFile (const char *filename, int32_t *handle, FILE **file,
|
|||
return com_filesize;
|
||||
}
|
||||
else if(file)
|
||||
{ /* open a new file on the pakfile */
|
||||
{
|
||||
/* open a new file on the pakfile */
|
||||
*file = fopen(pak->filename, "rb");
|
||||
if(*file)
|
||||
fseek(*file, pak->files[i].filepos, SEEK_SET);
|
||||
|
@ -1656,7 +1664,8 @@ static int32_t COM_FindFile (const char *filename, int32_t *handle, FILE **file,
|
|||
else /* check a file in the directory tree */
|
||||
{
|
||||
if(!registered.value)
|
||||
{ /* if not a registered version, don't ever go beyond base */
|
||||
{
|
||||
/* if not a registered version, don't ever go beyond base */
|
||||
if(strchr(filename, '/') || strchr(filename, '\\'))
|
||||
continue;
|
||||
}
|
||||
|
@ -2050,21 +2059,24 @@ _add_path:
|
|||
pak = COM_LoadPackFile(pakfile);
|
||||
if(i != 0 || path_id != 1 || fitzmode)
|
||||
qspak = NULL;
|
||||
else {
|
||||
else
|
||||
{
|
||||
bool old = com_modified;
|
||||
if(been_here) base = host_parms->userdir;
|
||||
q_snprintf(pakfile, sizeof(pakfile), "%s/quakespasm.pak", base);
|
||||
qspak = COM_LoadPackFile(pakfile);
|
||||
com_modified = old;
|
||||
}
|
||||
if (pak) {
|
||||
if(pak)
|
||||
{
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
search->pack = pak;
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
if (qspak) {
|
||||
if(qspak)
|
||||
{
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
search->pack = qspak;
|
||||
|
@ -2109,11 +2121,13 @@ static void COM_Game_f (void)
|
|||
|
||||
if(*p2)
|
||||
{
|
||||
if (strcmp(p2,"-hipnotic") && strcmp(p2,"-rogue") && strcmp(p2,"-quoth")) {
|
||||
if(strcmp(p2, "-hipnotic") && strcmp(p2, "-rogue") && strcmp(p2, "-quoth"))
|
||||
{
|
||||
Con_Printf("invalid mission pack argument to \"game\"\n");
|
||||
return;
|
||||
}
|
||||
if (!q_strcasecmp(p, GAMENAME)) {
|
||||
if(!q_strcasecmp(p, GAMENAME))
|
||||
{
|
||||
Con_Printf("no mission pack arguments to %s game\n", GAMENAME);
|
||||
return;
|
||||
}
|
||||
|
@ -2121,8 +2135,10 @@ static void COM_Game_f (void)
|
|||
|
||||
if(!q_strcasecmp(p, COM_SkipPath(com_gamedir))) //no change
|
||||
{
|
||||
if (com_searchpaths->path_id > 1) { //current game not id1
|
||||
if (*p2 && com_searchpaths->path_id == 2) {
|
||||
if(com_searchpaths->path_id > 1) //current game not id1
|
||||
{
|
||||
if(*p2 && com_searchpaths->path_id == 2)
|
||||
{
|
||||
// rely on QuakeSpasm extension treating '-game missionpack'
|
||||
// as '-missionpack', otherwise would be a mess
|
||||
if(!q_strcasecmp(p, &p2[1]))
|
||||
|
@ -2133,7 +2149,9 @@ static void COM_Game_f (void)
|
|||
Con_Printf("reloading game \"%s\" without mission pack support\n", p);
|
||||
else goto _same;
|
||||
}
|
||||
else { _same:
|
||||
else
|
||||
{
|
||||
_same:
|
||||
Con_Printf("\"game\" is already \"%s\"\n", COM_SkipPath(com_gamedir));
|
||||
return;
|
||||
}
|
||||
|
@ -2167,7 +2185,8 @@ static void COM_Game_f (void)
|
|||
|
||||
if(q_strcasecmp(p, GAMENAME)) //game is not id1
|
||||
{
|
||||
if (*p2) {
|
||||
if(*p2)
|
||||
{
|
||||
COM_AddGameDirectory(com_basedir, &p2[1]);
|
||||
standard_quake = false;
|
||||
if(!strcmp(p2, "-hipnotic") || !strcmp(p2, "-quoth"))
|
||||
|
@ -2177,14 +2196,17 @@ static void COM_Game_f (void)
|
|||
if(q_strcasecmp(p, &p2[1])) //don't load twice
|
||||
COM_AddGameDirectory(com_basedir, p);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
COM_AddGameDirectory(com_basedir, p);
|
||||
// QuakeSpasm extension: treat '-game missionpack' as '-missionpack'
|
||||
if (!q_strcasecmp(p,"hipnotic") || !q_strcasecmp(p,"quoth")) {
|
||||
if(!q_strcasecmp(p, "hipnotic") || !q_strcasecmp(p, "quoth"))
|
||||
{
|
||||
hipnotic = true;
|
||||
standard_quake = false;
|
||||
}
|
||||
else if (!q_strcasecmp(p,"rogue")) {
|
||||
else if(!q_strcasecmp(p, "rogue"))
|
||||
{
|
||||
rogue = true;
|
||||
standard_quake = false;
|
||||
}
|
||||
|
@ -2274,14 +2296,17 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
|
|||
if(COM_CheckParm("-rogue") && !q_strcasecmp(p, "rogue")) p = NULL;
|
||||
if(COM_CheckParm("-hipnotic") && !q_strcasecmp(p, "hipnotic")) p = NULL;
|
||||
if(COM_CheckParm("-quoth") && !q_strcasecmp(p, "quoth")) p = NULL;
|
||||
if (p != NULL) {
|
||||
if(p != NULL)
|
||||
{
|
||||
COM_AddGameDirectory(com_basedir, p);
|
||||
// QuakeSpasm extension: treat '-game missionpack' as '-missionpack'
|
||||
if (!q_strcasecmp(p,"rogue")) {
|
||||
if(!q_strcasecmp(p, "rogue"))
|
||||
{
|
||||
rogue = true;
|
||||
standard_quake = false;
|
||||
}
|
||||
if (!q_strcasecmp(p,"hipnotic") || !q_strcasecmp(p,"quoth")) {
|
||||
if(!q_strcasecmp(p, "hipnotic") || !q_strcasecmp(p, "quoth"))
|
||||
{
|
||||
hipnotic = true;
|
||||
standard_quake = false;
|
||||
}
|
||||
|
@ -2304,15 +2329,18 @@ size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh)
|
|||
long bytes_read;
|
||||
size_t nmemb_read;
|
||||
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return 0;
|
||||
}
|
||||
if (!ptr) {
|
||||
if(!ptr)
|
||||
{
|
||||
errno = EFAULT;
|
||||
return 0;
|
||||
}
|
||||
if (!size || !nmemb) { /* no error, just zero bytes wanted */
|
||||
if(!size || !nmemb) /* no error, just zero bytes wanted */
|
||||
{
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2340,7 +2368,8 @@ int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence)
|
|||
* the quake/hexen2 file system is 32 bits, anyway. */
|
||||
int32_t ret;
|
||||
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2362,7 +2391,8 @@ int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
if(offset < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2380,7 +2410,8 @@ int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence)
|
|||
|
||||
int32_t FS_fclose(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2389,7 +2420,8 @@ int32_t FS_fclose(fshandle_t *fh)
|
|||
|
||||
long FS_ftell(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2406,7 +2438,8 @@ void FS_rewind(fshandle_t *fh)
|
|||
|
||||
int32_t FS_feof(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2417,7 +2450,8 @@ int32_t FS_feof(fshandle_t *fh)
|
|||
|
||||
int32_t FS_ferror(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2426,7 +2460,8 @@ int32_t FS_ferror(fshandle_t *fh)
|
|||
|
||||
int32_t FS_fgetc(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return EOF;
|
||||
}
|
||||
|
@ -2454,7 +2489,8 @@ char *FS_fgets(char *s, int32_t size, fshandle_t *fh)
|
|||
|
||||
long FS_filelength(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
if(!fh)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -797,7 +797,8 @@ void AddToTabList (const char *name, const char *type)
|
|||
if(strcmp(name, insert->name) < 0)
|
||||
break;
|
||||
insert = insert->next;
|
||||
} while (insert != tablist);
|
||||
}
|
||||
while(insert != tablist);
|
||||
|
||||
t->next = insert;
|
||||
t->prev = insert->prev;
|
||||
|
@ -852,7 +853,8 @@ const char *FindCompletion (const char *partial, filelist_item_t *filelist, int3
|
|||
matched[sizeof(matched) - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{ // find max common
|
||||
{
|
||||
// find max common
|
||||
i_matched = matched;
|
||||
i_name = file->name;
|
||||
while(*i_matched && (*i_matched == *i_name))
|
||||
|
@ -1004,7 +1006,8 @@ void Con_TabComplete (void)
|
|||
{
|
||||
Con_SafePrintf(" %s (%s)\n", t->name, t->type);
|
||||
t = t->next;
|
||||
} while (t != tablist);
|
||||
}
|
||||
while(t != tablist);
|
||||
Con_SafePrintf("\n");
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1033,8 @@ void Con_TabComplete (void)
|
|||
break;
|
||||
}
|
||||
t = t->next;
|
||||
} while (t != tablist);
|
||||
}
|
||||
while(t != tablist);
|
||||
}
|
||||
Hunk_FreeToLowMark(mark); //it's okay to free it here because match is a pointer to persistent data
|
||||
|
||||
|
@ -1262,7 +1266,8 @@ void Con_NotifyBox (const char *text)
|
|||
Sys_Sleep(16);
|
||||
t2 = Sys_DoubleTime();
|
||||
realtime += t2 - t1; // make the cursor blink
|
||||
} while (lastkey == -1 && lastchar == -1);
|
||||
}
|
||||
while(lastkey == -1 && lastchar == -1);
|
||||
Key_EndInputGrab();
|
||||
|
||||
Con_Printf("\n");
|
||||
|
|
|
@ -458,7 +458,8 @@ void Cvar_Set (const char *var_name, const char *value)
|
|||
|
||||
var = Cvar_FindVar(var_name);
|
||||
if(!var)
|
||||
{ // there is an error in C code if this happens
|
||||
{
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf("Cvar_Set: variable %s not found\n", var_name);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC((f)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
|
@ -66,7 +67,8 @@ static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
|||
if(p2 == NULL) return p1;
|
||||
return (p1 < p2) ? p1 : p2;
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
|
@ -74,7 +76,8 @@ static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
|||
if(p2 == NULL) return p1;
|
||||
return (p1 > p2) ? p1 : p2;
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strchr(_the_path, '/');
|
||||
const char *p2 = strchr(_the_path, '\\');
|
||||
|
@ -82,7 +85,8 @@ static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
|||
if(p2 == NULL) return p1;
|
||||
return (p1 < p2) ? p1 : p2;
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strrchr(_the_path, '/');
|
||||
const char *p2 = strrchr(_the_path, '\\');
|
||||
|
@ -91,7 +95,8 @@ static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
|||
return (p1 > p2) ? p1 : p2;
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
|
@ -99,7 +104,8 @@ static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
|||
if(p2 == NULL) return p1;
|
||||
return (p1 < p2) ? p1 : p2;
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
|
@ -123,33 +129,39 @@ static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
|||
#define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path)
|
||||
{
|
||||
char *p = strchr(_the_path, ':');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(char *_the_path)
|
||||
{
|
||||
char *p = strrchr(_the_path, '/');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
const char *p = strchr(_the_path, ':');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
const char *p = strrchr(_the_path, '/');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
char *p = strchr(_the_path, ':');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
char *p = strrchr(_the_path, '/');
|
||||
if(p != NULL) return p;
|
||||
return strchr(_the_path, ':');
|
||||
|
@ -167,23 +179,29 @@ static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
|||
#define STRIP_DRIVE_SPEC(f) (f)
|
||||
|
||||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path)
|
||||
{
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(char *_the_path)
|
||||
{
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline const char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path) {
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
return strchr(_the_path, '/');
|
||||
}
|
||||
static inline char *FIND_LAST_DIRSEP (const char *_the_path) {
|
||||
static inline char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
return strrchr(_the_path, '/');
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
|
|
@ -169,7 +169,8 @@ int32_t Scrap_AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y)
|
|||
best2 = scrap_allocated[texnum][i + j];
|
||||
}
|
||||
if(j == w)
|
||||
{ // this is a valid spot
|
||||
{
|
||||
// this is a valid spot
|
||||
*x = i;
|
||||
*y = best = best2;
|
||||
}
|
||||
|
|
|
@ -339,7 +339,8 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
|
|||
{
|
||||
*(float *)cmds++ = hscale * (*(float *)loadcmds++);
|
||||
*(float *)cmds++ = vscale * (*(float *)loadcmds++);
|
||||
} while (--count);
|
||||
}
|
||||
while(--count);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
|
|
|
@ -147,7 +147,8 @@ byte *Mod_DecompressVis (byte *in, qmodel_t *model)
|
|||
outend = mod_decompressed + row;
|
||||
|
||||
if(!in)
|
||||
{ // no vis info, so make all visible
|
||||
{
|
||||
// no vis info, so make all visible
|
||||
while(row)
|
||||
{
|
||||
*out++ = 0xff;
|
||||
|
@ -170,7 +171,8 @@ byte *Mod_DecompressVis (byte *in, qmodel_t *model)
|
|||
{
|
||||
if(out == outend)
|
||||
{
|
||||
if(!model->viswarn) {
|
||||
if(!model->viswarn)
|
||||
{
|
||||
model->viswarn = true;
|
||||
Con_Warning("Mod_DecompressVis: output overrun on model \"%s\"\n", model->name);
|
||||
}
|
||||
|
@ -179,7 +181,8 @@ byte *Mod_DecompressVis (byte *in, qmodel_t *model)
|
|||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
} while (out - mod_decompressed < row);
|
||||
}
|
||||
while(out - mod_decompressed < row);
|
||||
|
||||
return mod_decompressed;
|
||||
}
|
||||
|
@ -725,8 +728,7 @@ void Mod_LoadLighting (lump_t *l)
|
|||
Hunk_FreeToLowMark(mark);
|
||||
Con_DPrintf("ignored %s from a gamedir with lower priority\n", litfilename);
|
||||
}
|
||||
else
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
|
||||
else if(data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
|
||||
{
|
||||
i = LittleLong(((int32_t *)data)[1]);
|
||||
if(i == 1)
|
||||
|
@ -1910,7 +1912,8 @@ void Mod_LoadSubmodels (lump_t *l)
|
|||
for(i = 0 ; i < count ; i++, in++, out++)
|
||||
{
|
||||
for(j = 0 ; j < 3 ; j++)
|
||||
{ // spread the mins / maxs by a pixel
|
||||
{
|
||||
// spread the mins / maxs by a pixel
|
||||
out->mins[j] = LittleFloat(in->mins[j]) - 1;
|
||||
out->maxs[j] = LittleFloat(in->maxs[j]) + 1;
|
||||
out->origin[j] = LittleFloat(in->origin[j]);
|
||||
|
@ -2092,7 +2095,8 @@ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
|
|||
mod->numleafs = bm->visleafs;
|
||||
|
||||
if(i < mod->numsubmodels - 1)
|
||||
{ // duplicate the basic information
|
||||
{
|
||||
// duplicate the basic information
|
||||
char name[10];
|
||||
|
||||
sprintf(name, "*%" PRIi32 "", i + 1);
|
||||
|
@ -2359,7 +2363,8 @@ void *Mod_LoadAllSkins (int32_t numskins, daliasskintype_t *pskintype)
|
|||
for(j = 0 ; j < groupskins ; j++)
|
||||
{
|
||||
Mod_FloodFillSkin(skin, pheader->skinwidth, pheader->skinheight);
|
||||
if (j == 0) {
|
||||
if(j == 0)
|
||||
{
|
||||
texels = (byte *) Hunk_AllocName(size, loadname);
|
||||
pheader->texels[i] = texels - (byte *)pheader;
|
||||
memcpy(texels, (byte *)(pskintype), size);
|
||||
|
|
|
@ -77,7 +77,8 @@ typedef struct mplane_s
|
|||
|
||||
// ericw -- each texture has two chains, so we can clear the model chains
|
||||
// without affecting the world
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
chain_world = 0,
|
||||
chain_model = 1
|
||||
} texchain_t;
|
||||
|
@ -332,14 +333,16 @@ typedef struct
|
|||
} maliasgroup_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||
typedef struct mtriangle_s {
|
||||
typedef struct mtriangle_s
|
||||
{
|
||||
int32_t facesfront;
|
||||
int32_t vertindex[3];
|
||||
} mtriangle_t;
|
||||
|
||||
|
||||
#define MAX_SKINS 32
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
vec3_t scale;
|
||||
|
|
|
@ -94,7 +94,8 @@ void R_RenderDlight (dlight_t *light)
|
|||
|
||||
VectorSubtract(light->origin, r_origin, v);
|
||||
if(VectorLength(v) < rad)
|
||||
{ // view is inside the dlight
|
||||
{
|
||||
// view is inside the dlight
|
||||
AddLightBlend(1, 0.5, 0, light->radius * 0.0003);
|
||||
return;
|
||||
}
|
||||
|
@ -205,10 +206,14 @@ start:
|
|||
impact[j] = light->origin[j] - surf->plane->normal[j] * dist;
|
||||
// clamp center of light to corner and check brightness
|
||||
l = DotProduct(impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0];
|
||||
s = l+0.5;if (s < 0) s = 0;else if (s > surf->extents[0]) s = surf->extents[0];
|
||||
s = l + 0.5;
|
||||
if(s < 0) s = 0;
|
||||
else if(s > surf->extents[0]) s = surf->extents[0];
|
||||
s = l - s;
|
||||
l = DotProduct(impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1];
|
||||
t = l+0.5;if (t < 0) t = 0;else if (t > surf->extents[1]) t = surf->extents[1];
|
||||
t = l + 0.5;
|
||||
if(t < 0) t = 0;
|
||||
else if(t > surf->extents[1]) t = surf->extents[1];
|
||||
t = l - t;
|
||||
// compare to minimum light
|
||||
if((s * s + t * t + dist * dist) < maxdist)
|
||||
|
@ -351,10 +356,18 @@ loc0:
|
|||
for(maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++)
|
||||
{
|
||||
scale = (float) d_lightstylevalue[surf->styles[maps]] * 1.0 / 256.0;
|
||||
r00 += (float) lightmap[ 0] * scale;g00 += (float) lightmap[ 1] * scale;b00 += (float) lightmap[2] * scale;
|
||||
r01 += (float) lightmap[ 3] * scale;g01 += (float) lightmap[ 4] * scale;b01 += (float) lightmap[5] * scale;
|
||||
r10 += (float) lightmap[line3+0] * scale;g10 += (float) lightmap[line3+1] * scale;b10 += (float) lightmap[line3+2] * scale;
|
||||
r11 += (float) lightmap[line3+3] * scale;g11 += (float) lightmap[line3+4] * scale;b11 += (float) lightmap[line3+5] * scale;
|
||||
r00 += (float) lightmap[ 0] * scale;
|
||||
g00 += (float) lightmap[ 1] * scale;
|
||||
b00 += (float) lightmap[2] * scale;
|
||||
r01 += (float) lightmap[ 3] * scale;
|
||||
g01 += (float) lightmap[ 4] * scale;
|
||||
b01 += (float) lightmap[5] * scale;
|
||||
r10 += (float) lightmap[line3 + 0] * scale;
|
||||
g10 += (float) lightmap[line3 + 1] * scale;
|
||||
b10 += (float) lightmap[line3 + 2] * scale;
|
||||
r11 += (float) lightmap[line3 + 3] * scale;
|
||||
g11 += (float) lightmap[line3 + 4] * scale;
|
||||
b11 += (float) lightmap[line3 + 5] * scale;
|
||||
lightmap += ((surf->extents[0] >> 4) + 1) * ((surf->extents[1] >> 4) + 1) * 3; // LordHavoc: *3 for colored lighting
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,8 @@ void SCR_DrawCenterString (void) //actually do the drawing
|
|||
if(!*start)
|
||||
break;
|
||||
start++; // skip the \n
|
||||
} while (1);
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
void SCR_CheckDrawCenterString(void)
|
||||
|
@ -931,7 +932,8 @@ void SCR_DrawNotifyString (void)
|
|||
if(!*start)
|
||||
break;
|
||||
start++; // skip the \n
|
||||
} while (1);
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -969,7 +971,8 @@ int32_t SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout
|
|||
Key_GetGrabbedInput(&lastkey, &lastchar);
|
||||
Sys_Sleep(16);
|
||||
if(timeout) time2 = Sys_DoubleTime(); //johnfitz -- zero timeout means wait forever.
|
||||
} while (lastchar != 'y' && lastchar != 'Y' &&
|
||||
}
|
||||
while(lastchar != 'y' && lastchar != 'Y' &&
|
||||
lastchar != 'n' && lastchar != 'N' &&
|
||||
lastkey != K_ESCAPE &&
|
||||
lastkey != K_ABUTTON &&
|
||||
|
|
|
@ -48,7 +48,8 @@ cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE};
|
|||
|
||||
int32_t skytexorder[6] = {0, 2, 1, 3, 4, 5}; //for skybox
|
||||
|
||||
vec3_t skyclip[6] = {
|
||||
vec3_t skyclip[6] =
|
||||
{
|
||||
{1, 1, 0},
|
||||
{1, -1, 0},
|
||||
{0, -1, 1},
|
||||
|
@ -454,7 +455,8 @@ void Sky_ClipPoly (int32_t nump, vec3_t vecs, int32_t stage)
|
|||
}
|
||||
|
||||
if(!front || !back)
|
||||
{ // not clipped
|
||||
{
|
||||
// not clipped
|
||||
Sky_ClipPoly(nump, vecs, stage + 1);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ typedef struct
|
|||
int32_t minfilter;
|
||||
const char *name;
|
||||
} glmode_t;
|
||||
static glmode_t glmodes[] = {
|
||||
static glmode_t glmodes[] =
|
||||
{
|
||||
{GL_NEAREST, GL_NEAREST, "GL_NEAREST"},
|
||||
{GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST_MIPMAP_NEAREST"},
|
||||
{GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST_MIPMAP_LINEAR"},
|
||||
|
@ -189,7 +190,8 @@ static void TexMgr_Anisotropy_f (cvar_t *var)
|
|||
for(glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
/* TexMgr_SetFilterModes (glt);*/
|
||||
if (glt->flags & TEXPREF_MIPMAP) {
|
||||
if(glt->flags & TEXPREF_MIPMAP)
|
||||
{
|
||||
GL_Bind(glt);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmodes[glmode_idx].magfilter);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glmodes[glmode_idx].minfilter);
|
||||
|
@ -837,14 +839,70 @@ static void TexMgr_AlphaEdgeFix (byte *data, int32_t width, int32_t height)
|
|||
thispix = 4 * j;
|
||||
nextpix = 4 * ((j == width - 1) ? 0 : j + 1);
|
||||
|
||||
b = lastrow + lastpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = thisrow + lastpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = nextrow + lastpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = lastrow + thispix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = nextrow + thispix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = lastrow + nextpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = thisrow + nextpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = nextrow + nextpix; if (data[b+3]) {c[0] += data[b]; c[1] += data[b+1]; c[2] += data[b+2]; n++;}
|
||||
b = lastrow + lastpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = thisrow + lastpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = nextrow + lastpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = lastrow + thispix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = nextrow + thispix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = lastrow + nextpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = thisrow + nextpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
b = nextrow + nextpix;
|
||||
if(data[b + 3])
|
||||
{
|
||||
c[0] += data[b];
|
||||
c[1] += data[b + 1];
|
||||
c[2] += data[b + 2];
|
||||
n++;
|
||||
}
|
||||
|
||||
//average all non-transparent neighbors
|
||||
if(n)
|
||||
|
|
|
@ -43,7 +43,8 @@ enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA};
|
|||
|
||||
typedef uintptr_t src_offset_t;
|
||||
|
||||
typedef struct gltexture_s {
|
||||
typedef struct gltexture_s
|
||||
{
|
||||
//managed by texture manager
|
||||
GLuint texnum;
|
||||
struct gltexture_s *next;
|
||||
|
|
|
@ -45,7 +45,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define DEFAULT_REFRESHRATE 60
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t refreshrate;
|
||||
|
@ -517,16 +518,19 @@ static bool VID_SetMode (int32_t width, int32_t height, int32_t refreshrate, int
|
|||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
|
||||
draw_context = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
|
||||
if (!draw_context) { // scale back fsaa
|
||||
if(!draw_context) // scale back fsaa
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
draw_context = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
|
||||
}
|
||||
if (!draw_context) { // scale back SDL_GL_DEPTH_SIZE
|
||||
if(!draw_context) // scale back SDL_GL_DEPTH_SIZE
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
draw_context = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
|
||||
}
|
||||
if (!draw_context) { // scale back SDL_GL_STENCIL_SIZE
|
||||
if(!draw_context) // scale back SDL_GL_STENCIL_SIZE
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
|
||||
draw_context = SDL_CreateWindow(caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
|
||||
}
|
||||
|
@ -558,7 +562,8 @@ static bool VID_SetMode (int32_t width, int32_t height, int32_t refreshrate, int
|
|||
|
||||
/* Make window fullscreen if needed, and show the window */
|
||||
|
||||
if (fullscreen) {
|
||||
if(fullscreen)
|
||||
{
|
||||
Uint32 flags = vid_desktopfullscreen.value ?
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP :
|
||||
SDL_WINDOW_FULLSCREEN;
|
||||
|
@ -569,7 +574,8 @@ static bool VID_SetMode (int32_t width, int32_t height, int32_t refreshrate, int
|
|||
SDL_ShowWindow(draw_context);
|
||||
|
||||
/* Create GL context if needed */
|
||||
if (!gl_context) {
|
||||
if(!gl_context)
|
||||
{
|
||||
gl_context = SDL_GL_CreateContext(draw_context);
|
||||
if(!gl_context)
|
||||
Sys_Error("Couldn't create GL context");
|
||||
|
@ -841,7 +847,8 @@ static bool GL_ParseExtensionList (const char *list, const char *name)
|
|||
return false; // extension names must not have spaces
|
||||
|
||||
start = list;
|
||||
while (1) {
|
||||
while(1)
|
||||
{
|
||||
where = strstr(start, name);
|
||||
if(!where)
|
||||
break;
|
||||
|
@ -1371,7 +1378,8 @@ void VID_Init (void)
|
|||
"vid_vsync",
|
||||
"vid_fsaa",
|
||||
"vid_desktopfullscreen",
|
||||
"vid_borderless"};
|
||||
"vid_borderless"
|
||||
};
|
||||
#define num_readvars ( sizeof(read_vars)/sizeof(read_vars[0]) )
|
||||
|
||||
Cvar_RegisterVariable(&vid_fullscreen); //johnfitz
|
||||
|
@ -1556,7 +1564,8 @@ void VID_Toggle (void)
|
|||
goto vrestart;
|
||||
}
|
||||
|
||||
if (!VID_GetFullscreen()) {
|
||||
if(!VID_GetFullscreen())
|
||||
{
|
||||
flags = vid_desktopfullscreen.value ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
|
||||
|
@ -1620,7 +1629,8 @@ void VID_SyncCvars (void)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
VID_OPT_MODE,
|
||||
VID_OPT_BPP,
|
||||
VID_OPT_REFRESHRATE,
|
||||
|
@ -1633,7 +1643,8 @@ enum {
|
|||
|
||||
static int32_t video_options_cursor = 0;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t width, height;
|
||||
} vid_menu_mode;
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ void R_TimeRefresh_f (void);
|
|||
void R_ReadPointFile_f(void);
|
||||
texture_t *R_TextureAnimation(texture_t *base, int32_t frame);
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
|
||||
} ptype_t;
|
||||
|
||||
|
@ -240,7 +241,8 @@ extern float rs_megatexels;
|
|||
|
||||
//johnfitz -- track developer statistics that vary every frame
|
||||
extern cvar_t devstats;
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t packetsize;
|
||||
int32_t edicts;
|
||||
int32_t visedicts;
|
||||
|
@ -252,7 +254,8 @@ typedef struct {
|
|||
extern devstats_t dev_stats, dev_peakstats;
|
||||
|
||||
//ohnfitz -- reduce overflow warning spam
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
double packetsize;
|
||||
double efrags;
|
||||
double beams;
|
||||
|
@ -270,7 +273,8 @@ extern int32_t gl_warpimagesize; //johnfitz -- for water warp
|
|||
|
||||
extern bool r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_drawworld_cheatsafe; //johnfitz
|
||||
|
||||
typedef struct glsl_attrib_binding_s {
|
||||
typedef struct glsl_attrib_binding_s
|
||||
{
|
||||
const char *name;
|
||||
GLuint attrib;
|
||||
} glsl_attrib_binding_t;
|
||||
|
|
|
@ -147,7 +147,8 @@ void ExtraMaps_Init (void)
|
|||
{
|
||||
COM_StripExtension(fdat.cFileName, mapname, sizeof(mapname));
|
||||
ExtraMaps_Add(mapname);
|
||||
} while (FindNextFile(fhnd, &fdat));
|
||||
}
|
||||
while(FindNextFile(fhnd, &fdat));
|
||||
FindClose(fhnd);
|
||||
#else
|
||||
q_snprintf(filestring, sizeof(filestring), "%s/maps/", search->filename);
|
||||
|
@ -167,13 +168,15 @@ void ExtraMaps_Init (void)
|
|||
else //pakfile
|
||||
{
|
||||
if(!strstr(search->pack->filename, ignorepakdir))
|
||||
{ //don't list standard id maps
|
||||
{
|
||||
//don't list standard id maps
|
||||
for(i = 0, pak = search->pack; i < pak->numfiles; i++)
|
||||
{
|
||||
if(!strcmp(COM_FileGetExtension(pak->files[i].name), "bsp"))
|
||||
{
|
||||
if(pak->files[i].filelen > 32 * 1024)
|
||||
{ // don't list files under 32k (ammo boxes etc)
|
||||
{
|
||||
// don't list files under 32k (ammo boxes etc)
|
||||
COM_StripExtension(pak->files[i].name + 5, mapname, sizeof(mapname));
|
||||
ExtraMaps_Add(mapname);
|
||||
}
|
||||
|
@ -244,11 +247,13 @@ void Modlist_Init (void)
|
|||
continue;
|
||||
q_snprintf(mod_string, sizeof(mod_string), "%s/%s", com_basedir, fdat.cFileName);
|
||||
attribs = GetFileAttributes(mod_string);
|
||||
if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
if(attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
/* don't bother testing for pak files / progs.dat */
|
||||
Modlist_Add(fdat.cFileName);
|
||||
}
|
||||
} while (FindNextFile(fhnd, &fdat));
|
||||
}
|
||||
while(FindNextFile(fhnd, &fdat));
|
||||
|
||||
FindClose(fhnd);
|
||||
}
|
||||
|
@ -334,7 +339,8 @@ void DemoList_Init (void)
|
|||
{
|
||||
COM_StripExtension(fdat.cFileName, demname, sizeof(demname));
|
||||
FileList_Add(demname, &demolist);
|
||||
} while (FindNextFile(fhnd, &fdat));
|
||||
}
|
||||
while(FindNextFile(fhnd, &fdat));
|
||||
FindClose(fhnd);
|
||||
#else
|
||||
q_snprintf(filestring, sizeof(filestring), "%s/", search->filename);
|
||||
|
@ -354,7 +360,8 @@ void DemoList_Init (void)
|
|||
else //pakfile
|
||||
{
|
||||
if(!strstr(search->pack->filename, ignorepakdir))
|
||||
{ //don't list standard id demos
|
||||
{
|
||||
//don't list standard id demos
|
||||
for(i = 0, pak = search->pack; i < pak->numfiles; i++)
|
||||
{
|
||||
if(!strcmp(COM_FileGetExtension(pak->files[i].name), "dem"))
|
||||
|
@ -1224,17 +1231,21 @@ void Host_Loadgame_f (void)
|
|||
}
|
||||
|
||||
if(entnum == -1)
|
||||
{ // parse the global vars
|
||||
{
|
||||
// parse the global vars
|
||||
data = ED_ParseGlobals(data);
|
||||
}
|
||||
else
|
||||
{ // parse an edict
|
||||
{
|
||||
// parse an edict
|
||||
ent = EDICT_NUM(entnum);
|
||||
if (entnum < sv.num_edicts) {
|
||||
if(entnum < sv.num_edicts)
|
||||
{
|
||||
ent->free = false;
|
||||
memset(&ent->v, 0, progs->entityfields * 4);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
memset(ent, 0, pr_edict_size);
|
||||
}
|
||||
data = ED_ParseEdict(data, ent);
|
||||
|
@ -1635,7 +1646,8 @@ void Host_Spawn_f (void)
|
|||
|
||||
// run the entrance script
|
||||
if(sv.loadgame)
|
||||
{ // loaded games are fully inited allready
|
||||
{
|
||||
// loaded games are fully inited allready
|
||||
// if this is the last client to be connected, unpause
|
||||
sv.paused = false;
|
||||
}
|
||||
|
@ -2231,7 +2243,8 @@ void Host_Startdemos_f (void)
|
|||
{
|
||||
cls.demonum = 0;
|
||||
if(!fitzmode)
|
||||
{ /* QuakeSpasm customization: */
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
/* go straight to menu, no CL_NextDemo */
|
||||
cls.demonum = -1;
|
||||
Cbuf_InsertText("menu_main\n");
|
||||
|
|
|
@ -36,7 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static char loadfilename[MAX_OSPATH]; //file scope so that error messages can use it
|
||||
|
||||
typedef struct stdio_buffer_s {
|
||||
typedef struct stdio_buffer_s
|
||||
{
|
||||
FILE *f;
|
||||
uint8_t buffer[1024];
|
||||
int32_t size;
|
||||
|
@ -101,7 +102,8 @@ byte *Image_LoadImage (const char *name, int32_t *width, int32_t *height)
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
typedef struct targaheader_s {
|
||||
typedef struct targaheader_s
|
||||
{
|
||||
uint8_t id_length, colormap_type, image_type;
|
||||
uint16_t colormap_index, colormap_length;
|
||||
uint8_t colormap_size;
|
||||
|
@ -364,7 +366,8 @@ byte *Image_LoadTGA (FILE *fin, int32_t *width, int32_t *height)
|
|||
}
|
||||
}
|
||||
}
|
||||
breakOut:;
|
||||
breakOut:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
360
source/in_sdl.c
360
source/in_sdl.c
|
@ -434,7 +434,8 @@ static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone)
|
|||
joyaxis_t result = {0};
|
||||
vec_t magnitude = IN_AxisMagnitude(axis);
|
||||
|
||||
if ( magnitude > deadzone ) {
|
||||
if(magnitude > deadzone)
|
||||
{
|
||||
const vec_t new_magnitude = q_min(1.0, (magnitude - deadzone) / (1.0 - deadzone));
|
||||
const vec_t scale = new_magnitude / magnitude;
|
||||
result.x = axis.x * scale;
|
||||
|
@ -453,21 +454,36 @@ static int32_t IN_KeyForControllerButton(SDL_GameControllerButton button)
|
|||
{
|
||||
switch(button)
|
||||
{
|
||||
case SDL_CONTROLLER_BUTTON_A: return K_ABUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_B: return K_BBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_X: return K_XBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_Y: return K_YBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_BACK: return K_TAB;
|
||||
case SDL_CONTROLLER_BUTTON_START: return K_ESCAPE;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSTICK: return K_LTHUMB;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSTICK: return K_RTHUMB;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: return K_LSHOULDER;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: return K_RSHOULDER;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP: return K_UPARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN: return K_DOWNARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT: return K_LEFTARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return K_RIGHTARROW;
|
||||
default: return 0;
|
||||
case SDL_CONTROLLER_BUTTON_A:
|
||||
return K_ABUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
return K_BBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_X:
|
||||
return K_XBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_Y:
|
||||
return K_YBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_BACK:
|
||||
return K_TAB;
|
||||
case SDL_CONTROLLER_BUTTON_START:
|
||||
return K_ESCAPE;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSTICK:
|
||||
return K_LTHUMB;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSTICK:
|
||||
return K_RTHUMB;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
|
||||
return K_LSHOULDER;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
|
||||
return K_RSHOULDER;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||
return K_UPARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||
return K_DOWNARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||
return K_LEFTARROW;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||
return K_RIGHTARROW;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -699,120 +715,224 @@ static inline int32_t IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
|||
{
|
||||
switch(scancode)
|
||||
{
|
||||
case SDL_SCANCODE_TAB: return K_TAB;
|
||||
case SDL_SCANCODE_RETURN: return K_ENTER;
|
||||
case SDL_SCANCODE_RETURN2: return K_ENTER;
|
||||
case SDL_SCANCODE_ESCAPE: return K_ESCAPE;
|
||||
case SDL_SCANCODE_SPACE: return K_SPACE;
|
||||
case SDL_SCANCODE_TAB:
|
||||
return K_TAB;
|
||||
case SDL_SCANCODE_RETURN:
|
||||
return K_ENTER;
|
||||
case SDL_SCANCODE_RETURN2:
|
||||
return K_ENTER;
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
return K_ESCAPE;
|
||||
case SDL_SCANCODE_SPACE:
|
||||
return K_SPACE;
|
||||
|
||||
case SDL_SCANCODE_A: return 'a';
|
||||
case SDL_SCANCODE_B: return 'b';
|
||||
case SDL_SCANCODE_C: return 'c';
|
||||
case SDL_SCANCODE_D: return 'd';
|
||||
case SDL_SCANCODE_E: return 'e';
|
||||
case SDL_SCANCODE_F: return 'f';
|
||||
case SDL_SCANCODE_G: return 'g';
|
||||
case SDL_SCANCODE_H: return 'h';
|
||||
case SDL_SCANCODE_I: return 'i';
|
||||
case SDL_SCANCODE_J: return 'j';
|
||||
case SDL_SCANCODE_K: return 'k';
|
||||
case SDL_SCANCODE_L: return 'l';
|
||||
case SDL_SCANCODE_M: return 'm';
|
||||
case SDL_SCANCODE_N: return 'n';
|
||||
case SDL_SCANCODE_O: return 'o';
|
||||
case SDL_SCANCODE_P: return 'p';
|
||||
case SDL_SCANCODE_Q: return 'q';
|
||||
case SDL_SCANCODE_R: return 'r';
|
||||
case SDL_SCANCODE_S: return 's';
|
||||
case SDL_SCANCODE_T: return 't';
|
||||
case SDL_SCANCODE_U: return 'u';
|
||||
case SDL_SCANCODE_V: return 'v';
|
||||
case SDL_SCANCODE_W: return 'w';
|
||||
case SDL_SCANCODE_X: return 'x';
|
||||
case SDL_SCANCODE_Y: return 'y';
|
||||
case SDL_SCANCODE_Z: return 'z';
|
||||
case SDL_SCANCODE_A:
|
||||
return 'a';
|
||||
case SDL_SCANCODE_B:
|
||||
return 'b';
|
||||
case SDL_SCANCODE_C:
|
||||
return 'c';
|
||||
case SDL_SCANCODE_D:
|
||||
return 'd';
|
||||
case SDL_SCANCODE_E:
|
||||
return 'e';
|
||||
case SDL_SCANCODE_F:
|
||||
return 'f';
|
||||
case SDL_SCANCODE_G:
|
||||
return 'g';
|
||||
case SDL_SCANCODE_H:
|
||||
return 'h';
|
||||
case SDL_SCANCODE_I:
|
||||
return 'i';
|
||||
case SDL_SCANCODE_J:
|
||||
return 'j';
|
||||
case SDL_SCANCODE_K:
|
||||
return 'k';
|
||||
case SDL_SCANCODE_L:
|
||||
return 'l';
|
||||
case SDL_SCANCODE_M:
|
||||
return 'm';
|
||||
case SDL_SCANCODE_N:
|
||||
return 'n';
|
||||
case SDL_SCANCODE_O:
|
||||
return 'o';
|
||||
case SDL_SCANCODE_P:
|
||||
return 'p';
|
||||
case SDL_SCANCODE_Q:
|
||||
return 'q';
|
||||
case SDL_SCANCODE_R:
|
||||
return 'r';
|
||||
case SDL_SCANCODE_S:
|
||||
return 's';
|
||||
case SDL_SCANCODE_T:
|
||||
return 't';
|
||||
case SDL_SCANCODE_U:
|
||||
return 'u';
|
||||
case SDL_SCANCODE_V:
|
||||
return 'v';
|
||||
case SDL_SCANCODE_W:
|
||||
return 'w';
|
||||
case SDL_SCANCODE_X:
|
||||
return 'x';
|
||||
case SDL_SCANCODE_Y:
|
||||
return 'y';
|
||||
case SDL_SCANCODE_Z:
|
||||
return 'z';
|
||||
|
||||
case SDL_SCANCODE_1: return '1';
|
||||
case SDL_SCANCODE_2: return '2';
|
||||
case SDL_SCANCODE_3: return '3';
|
||||
case SDL_SCANCODE_4: return '4';
|
||||
case SDL_SCANCODE_5: return '5';
|
||||
case SDL_SCANCODE_6: return '6';
|
||||
case SDL_SCANCODE_7: return '7';
|
||||
case SDL_SCANCODE_8: return '8';
|
||||
case SDL_SCANCODE_9: return '9';
|
||||
case SDL_SCANCODE_0: return '0';
|
||||
case SDL_SCANCODE_1:
|
||||
return '1';
|
||||
case SDL_SCANCODE_2:
|
||||
return '2';
|
||||
case SDL_SCANCODE_3:
|
||||
return '3';
|
||||
case SDL_SCANCODE_4:
|
||||
return '4';
|
||||
case SDL_SCANCODE_5:
|
||||
return '5';
|
||||
case SDL_SCANCODE_6:
|
||||
return '6';
|
||||
case SDL_SCANCODE_7:
|
||||
return '7';
|
||||
case SDL_SCANCODE_8:
|
||||
return '8';
|
||||
case SDL_SCANCODE_9:
|
||||
return '9';
|
||||
case SDL_SCANCODE_0:
|
||||
return '0';
|
||||
|
||||
case SDL_SCANCODE_MINUS: return '-';
|
||||
case SDL_SCANCODE_EQUALS: return '=';
|
||||
case SDL_SCANCODE_LEFTBRACKET: return '[';
|
||||
case SDL_SCANCODE_RIGHTBRACKET: return ']';
|
||||
case SDL_SCANCODE_BACKSLASH: return '\\';
|
||||
case SDL_SCANCODE_NONUSHASH: return '#';
|
||||
case SDL_SCANCODE_SEMICOLON: return ';';
|
||||
case SDL_SCANCODE_APOSTROPHE: return '\'';
|
||||
case SDL_SCANCODE_GRAVE: return '`';
|
||||
case SDL_SCANCODE_COMMA: return ',';
|
||||
case SDL_SCANCODE_PERIOD: return '.';
|
||||
case SDL_SCANCODE_SLASH: return '/';
|
||||
case SDL_SCANCODE_NONUSBACKSLASH: return '\\';
|
||||
case SDL_SCANCODE_MINUS:
|
||||
return '-';
|
||||
case SDL_SCANCODE_EQUALS:
|
||||
return '=';
|
||||
case SDL_SCANCODE_LEFTBRACKET:
|
||||
return '[';
|
||||
case SDL_SCANCODE_RIGHTBRACKET:
|
||||
return ']';
|
||||
case SDL_SCANCODE_BACKSLASH:
|
||||
return '\\';
|
||||
case SDL_SCANCODE_NONUSHASH:
|
||||
return '#';
|
||||
case SDL_SCANCODE_SEMICOLON:
|
||||
return ';';
|
||||
case SDL_SCANCODE_APOSTROPHE:
|
||||
return '\'';
|
||||
case SDL_SCANCODE_GRAVE:
|
||||
return '`';
|
||||
case SDL_SCANCODE_COMMA:
|
||||
return ',';
|
||||
case SDL_SCANCODE_PERIOD:
|
||||
return '.';
|
||||
case SDL_SCANCODE_SLASH:
|
||||
return '/';
|
||||
case SDL_SCANCODE_NONUSBACKSLASH:
|
||||
return '\\';
|
||||
|
||||
case SDL_SCANCODE_BACKSPACE: return K_BACKSPACE;
|
||||
case SDL_SCANCODE_UP: return K_UPARROW;
|
||||
case SDL_SCANCODE_DOWN: return K_DOWNARROW;
|
||||
case SDL_SCANCODE_LEFT: return K_LEFTARROW;
|
||||
case SDL_SCANCODE_RIGHT: return K_RIGHTARROW;
|
||||
case SDL_SCANCODE_BACKSPACE:
|
||||
return K_BACKSPACE;
|
||||
case SDL_SCANCODE_UP:
|
||||
return K_UPARROW;
|
||||
case SDL_SCANCODE_DOWN:
|
||||
return K_DOWNARROW;
|
||||
case SDL_SCANCODE_LEFT:
|
||||
return K_LEFTARROW;
|
||||
case SDL_SCANCODE_RIGHT:
|
||||
return K_RIGHTARROW;
|
||||
|
||||
case SDL_SCANCODE_LALT: return K_ALT;
|
||||
case SDL_SCANCODE_RALT: return K_ALT;
|
||||
case SDL_SCANCODE_LCTRL: return K_CTRL;
|
||||
case SDL_SCANCODE_RCTRL: return K_CTRL;
|
||||
case SDL_SCANCODE_LSHIFT: return K_SHIFT;
|
||||
case SDL_SCANCODE_RSHIFT: return K_SHIFT;
|
||||
case SDL_SCANCODE_LALT:
|
||||
return K_ALT;
|
||||
case SDL_SCANCODE_RALT:
|
||||
return K_ALT;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
return K_CTRL;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
return K_CTRL;
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
return K_SHIFT;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
return K_SHIFT;
|
||||
|
||||
case SDL_SCANCODE_F1: return K_F1;
|
||||
case SDL_SCANCODE_F2: return K_F2;
|
||||
case SDL_SCANCODE_F3: return K_F3;
|
||||
case SDL_SCANCODE_F4: return K_F4;
|
||||
case SDL_SCANCODE_F5: return K_F5;
|
||||
case SDL_SCANCODE_F6: return K_F6;
|
||||
case SDL_SCANCODE_F7: return K_F7;
|
||||
case SDL_SCANCODE_F8: return K_F8;
|
||||
case SDL_SCANCODE_F9: return K_F9;
|
||||
case SDL_SCANCODE_F10: return K_F10;
|
||||
case SDL_SCANCODE_F11: return K_F11;
|
||||
case SDL_SCANCODE_F12: return K_F12;
|
||||
case SDL_SCANCODE_INSERT: return K_INS;
|
||||
case SDL_SCANCODE_DELETE: return K_DEL;
|
||||
case SDL_SCANCODE_PAGEDOWN: return K_PGDN;
|
||||
case SDL_SCANCODE_PAGEUP: return K_PGUP;
|
||||
case SDL_SCANCODE_HOME: return K_HOME;
|
||||
case SDL_SCANCODE_END: return K_END;
|
||||
case SDL_SCANCODE_F1:
|
||||
return K_F1;
|
||||
case SDL_SCANCODE_F2:
|
||||
return K_F2;
|
||||
case SDL_SCANCODE_F3:
|
||||
return K_F3;
|
||||
case SDL_SCANCODE_F4:
|
||||
return K_F4;
|
||||
case SDL_SCANCODE_F5:
|
||||
return K_F5;
|
||||
case SDL_SCANCODE_F6:
|
||||
return K_F6;
|
||||
case SDL_SCANCODE_F7:
|
||||
return K_F7;
|
||||
case SDL_SCANCODE_F8:
|
||||
return K_F8;
|
||||
case SDL_SCANCODE_F9:
|
||||
return K_F9;
|
||||
case SDL_SCANCODE_F10:
|
||||
return K_F10;
|
||||
case SDL_SCANCODE_F11:
|
||||
return K_F11;
|
||||
case SDL_SCANCODE_F12:
|
||||
return K_F12;
|
||||
case SDL_SCANCODE_INSERT:
|
||||
return K_INS;
|
||||
case SDL_SCANCODE_DELETE:
|
||||
return K_DEL;
|
||||
case SDL_SCANCODE_PAGEDOWN:
|
||||
return K_PGDN;
|
||||
case SDL_SCANCODE_PAGEUP:
|
||||
return K_PGUP;
|
||||
case SDL_SCANCODE_HOME:
|
||||
return K_HOME;
|
||||
case SDL_SCANCODE_END:
|
||||
return K_END;
|
||||
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR: return K_KP_NUMLOCK;
|
||||
case SDL_SCANCODE_KP_DIVIDE: return K_KP_SLASH;
|
||||
case SDL_SCANCODE_KP_MULTIPLY: return K_KP_STAR;
|
||||
case SDL_SCANCODE_KP_MINUS: return K_KP_MINUS;
|
||||
case SDL_SCANCODE_KP_7: return K_KP_HOME;
|
||||
case SDL_SCANCODE_KP_8: return K_KP_UPARROW;
|
||||
case SDL_SCANCODE_KP_9: return K_KP_PGUP;
|
||||
case SDL_SCANCODE_KP_PLUS: return K_KP_PLUS;
|
||||
case SDL_SCANCODE_KP_4: return K_KP_LEFTARROW;
|
||||
case SDL_SCANCODE_KP_5: return K_KP_5;
|
||||
case SDL_SCANCODE_KP_6: return K_KP_RIGHTARROW;
|
||||
case SDL_SCANCODE_KP_1: return K_KP_END;
|
||||
case SDL_SCANCODE_KP_2: return K_KP_DOWNARROW;
|
||||
case SDL_SCANCODE_KP_3: return K_KP_PGDN;
|
||||
case SDL_SCANCODE_KP_ENTER: return K_KP_ENTER;
|
||||
case SDL_SCANCODE_KP_0: return K_KP_INS;
|
||||
case SDL_SCANCODE_KP_PERIOD: return K_KP_DEL;
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
return K_KP_NUMLOCK;
|
||||
case SDL_SCANCODE_KP_DIVIDE:
|
||||
return K_KP_SLASH;
|
||||
case SDL_SCANCODE_KP_MULTIPLY:
|
||||
return K_KP_STAR;
|
||||
case SDL_SCANCODE_KP_MINUS:
|
||||
return K_KP_MINUS;
|
||||
case SDL_SCANCODE_KP_7:
|
||||
return K_KP_HOME;
|
||||
case SDL_SCANCODE_KP_8:
|
||||
return K_KP_UPARROW;
|
||||
case SDL_SCANCODE_KP_9:
|
||||
return K_KP_PGUP;
|
||||
case SDL_SCANCODE_KP_PLUS:
|
||||
return K_KP_PLUS;
|
||||
case SDL_SCANCODE_KP_4:
|
||||
return K_KP_LEFTARROW;
|
||||
case SDL_SCANCODE_KP_5:
|
||||
return K_KP_5;
|
||||
case SDL_SCANCODE_KP_6:
|
||||
return K_KP_RIGHTARROW;
|
||||
case SDL_SCANCODE_KP_1:
|
||||
return K_KP_END;
|
||||
case SDL_SCANCODE_KP_2:
|
||||
return K_KP_DOWNARROW;
|
||||
case SDL_SCANCODE_KP_3:
|
||||
return K_KP_PGDN;
|
||||
case SDL_SCANCODE_KP_ENTER:
|
||||
return K_KP_ENTER;
|
||||
case SDL_SCANCODE_KP_0:
|
||||
return K_KP_INS;
|
||||
case SDL_SCANCODE_KP_PERIOD:
|
||||
return K_KP_DEL;
|
||||
|
||||
case SDL_SCANCODE_LGUI: return K_COMMAND;
|
||||
case SDL_SCANCODE_RGUI: return K_COMMAND;
|
||||
case SDL_SCANCODE_LGUI:
|
||||
return K_COMMAND;
|
||||
case SDL_SCANCODE_RGUI:
|
||||
return K_COMMAND;
|
||||
|
||||
case SDL_SCANCODE_PAUSE: return K_PAUSE;
|
||||
case SDL_SCANCODE_PAUSE:
|
||||
return K_PAUSE;
|
||||
|
||||
default: return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,8 @@ void Key_Console (int32_t key)
|
|||
do
|
||||
{
|
||||
history_line = (history_line - 1) & 31;
|
||||
} while (history_line != edit_line && !key_lines[history_line][1]);
|
||||
}
|
||||
while(history_line != edit_line && !key_lines[history_line][1]);
|
||||
|
||||
if(history_line == edit_line)
|
||||
{
|
||||
|
@ -400,7 +401,8 @@ void Key_Console (int32_t key)
|
|||
do
|
||||
{
|
||||
history_line = (history_line + 1) & 31;
|
||||
} while (history_line != edit_line && !key_lines[history_line][1]);
|
||||
}
|
||||
while(history_line != edit_line && !key_lines[history_line][1]);
|
||||
|
||||
if(history_line == edit_line)
|
||||
Q_strcpy(workline, current);
|
||||
|
@ -417,12 +419,14 @@ void Key_Console (int32_t key)
|
|||
case 'v':
|
||||
case 'V':
|
||||
#if defined(PLATFORM_OSX) || defined(PLATFORM_MAC)
|
||||
if (keydown[K_COMMAND]) { /* Cmd+v paste (Mac-only) */
|
||||
if(keydown[K_COMMAND]) /* Cmd+v paste (Mac-only) */
|
||||
{
|
||||
PasteToConsole();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (keydown[K_CTRL]) { /* Ctrl+v paste */
|
||||
if(keydown[K_CTRL]) /* Ctrl+v paste */
|
||||
{
|
||||
PasteToConsole();
|
||||
return;
|
||||
}
|
||||
|
@ -430,7 +434,8 @@ void Key_Console (int32_t key)
|
|||
|
||||
case 'c':
|
||||
case 'C':
|
||||
if (keydown[K_CTRL]) { /* Ctrl+C: abort the line -- S.A */
|
||||
if(keydown[K_CTRL]) /* Ctrl+C: abort the line -- S.A */
|
||||
{
|
||||
Con_Printf("%s\n", workline);
|
||||
workline[0] = ']';
|
||||
workline[1] = 0;
|
||||
|
@ -578,7 +583,8 @@ const char *Key_KeynumToString (int32_t keynum)
|
|||
if(keynum == -1)
|
||||
return "<KEY NOT FOUND>";
|
||||
if(keynum > 32 && keynum < 127)
|
||||
{ // printable ascii
|
||||
{
|
||||
// printable ascii
|
||||
tinystr[0] = keynum;
|
||||
tinystr[1] = 0;
|
||||
return tinystr;
|
||||
|
@ -762,7 +768,8 @@ void History_Init (void)
|
|||
{
|
||||
c = fgetc(hf);
|
||||
key_lines[edit_line][i++] = c;
|
||||
} while (c != '\r' && c != '\n' && c != EOF && i < MAXCMDLINE);
|
||||
}
|
||||
while(c != '\r' && c != '\n' && c != EOF && i < MAXCMDLINE);
|
||||
key_lines[edit_line][i - 1] = 0;
|
||||
edit_line = (edit_line + 1) & (CMDLINES - 1);
|
||||
/* for people using a windows-generated history file on unix: */
|
||||
|
@ -775,7 +782,8 @@ void History_Init (void)
|
|||
ungetc(c, hf);
|
||||
else c = 0; /* loop once more, otherwise last line is lost */
|
||||
}
|
||||
} while (c != EOF && edit_line < CMDLINES);
|
||||
}
|
||||
while(c != EOF && edit_line < CMDLINES);
|
||||
fclose(hf);
|
||||
|
||||
history_line = edit_line = (edit_line - 1) & (CMDLINES - 1);
|
||||
|
@ -796,7 +804,8 @@ void History_Shutdown (void)
|
|||
do
|
||||
{
|
||||
i = (i + 1) & (CMDLINES - 1);
|
||||
} while (i != edit_line && !key_lines[i][1]);
|
||||
}
|
||||
while(i != edit_line && !key_lines[i][1]);
|
||||
|
||||
while(i != edit_line && key_lines[i][1])
|
||||
{
|
||||
|
@ -882,7 +891,8 @@ void Key_Init (void)
|
|||
Cmd_AddCommand("unbindall", Key_Unbindall_f);
|
||||
}
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
bool active;
|
||||
int32_t lastkey;
|
||||
int32_t lastchar;
|
||||
|
@ -1040,7 +1050,8 @@ void Key_Event (int32_t key, bool down)
|
|||
if(kb)
|
||||
{
|
||||
if(kb[0] == '+')
|
||||
{ // button commands add keynum as a parm
|
||||
{
|
||||
// button commands add keynum as a parm
|
||||
sprintf(cmd, "%s %" PRIi32 "\n", kb, key);
|
||||
Cbuf_AddText(cmd);
|
||||
}
|
||||
|
|
357
source/lodepng.c
357
source/lodepng.c
|
@ -479,22 +479,26 @@ static unsigned readBitsFromStream(size_t* bitpointer, const uint8_t* bitstream,
|
|||
/*the base lengths represented by codes 257-285*/
|
||||
static const unsigned LENGTHBASE[29]
|
||||
= {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258};
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258
|
||||
};
|
||||
|
||||
/*the extra bits used by codes 257-285 (added to base length)*/
|
||||
static const unsigned LENGTHEXTRA[29]
|
||||
= {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
|
||||
4, 4, 4, 4, 5, 5, 5, 5, 0};
|
||||
4, 4, 4, 4, 5, 5, 5, 5, 0
|
||||
};
|
||||
|
||||
/*the base backwards distances (the bits of distance codes appear after length codes and use their own huffman tree)*/
|
||||
static const unsigned DISTANCEBASE[30]
|
||||
= {1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
|
||||
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
|
||||
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
/*the extra bits of backwards distances (added to base)*/
|
||||
static const unsigned DISTANCEEXTRA[30]
|
||||
= {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
|
||||
8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13};
|
||||
8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
/*the order in which "code length alphabet code lengths" are stored, out of this
|
||||
the huffman tree of the dynamic huffman tree lengths is generated*/
|
||||
|
@ -1193,12 +1197,15 @@ static unsigned inflateHuffmanBlock(ucvector* out, const uint8_t* in, size_t* bp
|
|||
backward = start - distance;
|
||||
|
||||
if(!ucvector_resize(out, (*pos) + length)) ERROR_BREAK(83 /*alloc fail*/);
|
||||
if (distance < length) {
|
||||
if(distance < length)
|
||||
{
|
||||
for(forward = 0; forward < length; ++forward)
|
||||
{
|
||||
out->data[(*pos)++] = out->data[backward++];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(out->data + *pos, out->data + backward, length);
|
||||
*pos += length;
|
||||
}
|
||||
|
@ -1233,8 +1240,10 @@ static unsigned inflateNoCompression(ucvector* out, const uint8_t* in, size_t* b
|
|||
|
||||
/*read LEN (2 bytes) and NLEN (2 bytes)*/
|
||||
if(p + 4 >= inlength) return 52; /*error, bit pointer will jump past memory*/
|
||||
LEN = in[p] + 256u * in[p + 1]; p += 2;
|
||||
NLEN = in[p] + 256u * in[p + 1]; p += 2;
|
||||
LEN = in[p] + 256u * in[p + 1];
|
||||
p += 2;
|
||||
NLEN = in[p] + 256u * in[p + 1];
|
||||
p += 2;
|
||||
|
||||
/*check if 16-bit NLEN is really the one's complement of LEN*/
|
||||
if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/
|
||||
|
@ -1331,7 +1340,8 @@ static size_t searchCodeIndex(const unsigned* array, size_t array_size, size_t v
|
|||
size_t left = 1;
|
||||
size_t right = array_size - 1;
|
||||
|
||||
while(left <= right) {
|
||||
while(left <= right)
|
||||
{
|
||||
size_t mid = (left + right) >> 1;
|
||||
if(array[mid] >= value) right = mid - 1;
|
||||
else left = mid + 1;
|
||||
|
@ -1430,7 +1440,9 @@ static unsigned getHash(const uint8_t* data, size_t size, size_t pos)
|
|||
result ^= (unsigned)(data[pos + 0] << 0u);
|
||||
result ^= (unsigned)(data[pos + 1] << 4u);
|
||||
result ^= (unsigned)(data[pos + 2] << 8u);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t amount, i;
|
||||
if(pos >= size) return 0;
|
||||
amount = size - pos;
|
||||
|
@ -1816,8 +1828,10 @@ static unsigned deflateDynamic(ucvector* out, size_t* bp, Hash* hash,
|
|||
error = HuffmanTree_makeFromFrequencies(&tree_d, frequencies_d.data, 2, frequencies_d.size, 15);
|
||||
if(error) break;
|
||||
|
||||
numcodes_ll = tree_ll.numcodes; if(numcodes_ll > 286) numcodes_ll = 286;
|
||||
numcodes_d = tree_d.numcodes; if(numcodes_d > 30) numcodes_d = 30;
|
||||
numcodes_ll = tree_ll.numcodes;
|
||||
if(numcodes_ll > 286) numcodes_ll = 286;
|
||||
numcodes_d = tree_d.numcodes;
|
||||
if(numcodes_d > 30) numcodes_d = 30;
|
||||
/*store the code lengths of both generated trees in bitlen_lld*/
|
||||
for(i = 0; i != numcodes_ll; ++i) uivector_push_back(&bitlen_lld, HuffmanTree_getLength(&tree_ll, (unsigned)i));
|
||||
for(i = 0; i != numcodes_d; ++i) uivector_push_back(&bitlen_lld, HuffmanTree_getLength(&tree_d, (unsigned)i));
|
||||
|
@ -2320,7 +2334,8 @@ const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0,
|
|||
|
||||
#ifndef LODEPNG_NO_COMPILE_CRC
|
||||
/* CRC polynomial: 0xedb88320 */
|
||||
static unsigned lodepng_crc32_table[256] = {
|
||||
static unsigned lodepng_crc32_table[256] =
|
||||
{
|
||||
0u, 1996959894u, 3993919788u, 2567524794u, 124634137u, 1886057615u, 3915621685u, 2657392035u,
|
||||
249268274u, 2044508324u, 3772115230u, 2547177864u, 162941995u, 2125561021u, 3887607047u, 2428444049u,
|
||||
498536548u, 1789927666u, 4089016648u, 2227061214u, 450548861u, 1843258603u, 4107580753u, 2211677639u,
|
||||
|
@ -2549,12 +2564,23 @@ static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd
|
|||
{
|
||||
switch(colortype)
|
||||
{
|
||||
case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/
|
||||
case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/
|
||||
case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/
|
||||
case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/
|
||||
case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/
|
||||
default: return 31;
|
||||
case 0:
|
||||
if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37;
|
||||
break; /*grey*/
|
||||
case 2:
|
||||
if(!(bd == 8 || bd == 16)) return 37;
|
||||
break; /*RGB*/
|
||||
case 3:
|
||||
if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8)) return 37;
|
||||
break; /*palette*/
|
||||
case 4:
|
||||
if(!(bd == 8 || bd == 16)) return 37;
|
||||
break; /*grey + alpha*/
|
||||
case 6:
|
||||
if(!(bd == 8 || bd == 16)) return 37;
|
||||
break; /*RGBA*/
|
||||
default:
|
||||
return 31;
|
||||
}
|
||||
return 0; /*allowed color type / bits combination*/
|
||||
}
|
||||
|
@ -2563,11 +2589,16 @@ static unsigned getNumColorChannels(LodePNGColorType colortype)
|
|||
{
|
||||
switch(colortype)
|
||||
{
|
||||
case 0: return 1; /*grey*/
|
||||
case 2: return 3; /*RGB*/
|
||||
case 3: return 1; /*palette*/
|
||||
case 4: return 2; /*grey + alpha*/
|
||||
case 6: return 4; /*RGBA*/
|
||||
case 0:
|
||||
return 1; /*grey*/
|
||||
case 2:
|
||||
return 3; /*RGB*/
|
||||
case 3:
|
||||
return 1; /*palette*/
|
||||
case 4:
|
||||
return 2; /*grey + alpha*/
|
||||
case 6:
|
||||
return 4; /*RGBA*/
|
||||
}
|
||||
return 0; /*unexisting color type*/
|
||||
}
|
||||
|
@ -3191,7 +3222,9 @@ static void getPixelColorRGBA8(uint8_t* r, uint8_t* g,
|
|||
{
|
||||
if(mode->bitdepth == 8)
|
||||
{
|
||||
*r = in[i * 3 + 0]; *g = in[i * 3 + 1]; *b = in[i * 3 + 2];
|
||||
*r = in[i * 3 + 0];
|
||||
*g = in[i * 3 + 1];
|
||||
*b = in[i * 3 + 2];
|
||||
if(mode->key_defined && *r == mode->key_r && *g == mode->key_g && *b == mode->key_b) *a = 0;
|
||||
else *a = 255;
|
||||
}
|
||||
|
@ -4026,7 +4059,8 @@ static unsigned unfilterScanline(uint8_t* recon, const uint8_t* scanline, const
|
|||
}
|
||||
}
|
||||
break;
|
||||
default: return 36; /*error: unexisting filter type given*/
|
||||
default:
|
||||
return 36; /*error: unexisting filter type given*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -4178,7 +4212,8 @@ static unsigned postProcessScanlines(uint8_t* out, uint8_t* in,
|
|||
}
|
||||
else /*interlace_method is 1 (Adam7)*/
|
||||
{
|
||||
unsigned passw[7], passh[7]; size_t filter_passstart[8], padded_passstart[8], passstart[8];
|
||||
unsigned passw[7], passh[7];
|
||||
size_t filter_passstart[8], padded_passstart[8], passstart[8];
|
||||
unsigned i;
|
||||
|
||||
Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp);
|
||||
|
@ -4856,8 +4891,10 @@ void lodepng_state_copy(LodePNGState* dest, const LodePNGState* source)
|
|||
*dest = *source;
|
||||
lodepng_color_mode_init(&dest->info_raw);
|
||||
lodepng_info_init(&dest->info_png);
|
||||
dest->error = lodepng_color_mode_copy(&dest->info_raw, &source->info_raw); if(dest->error) return;
|
||||
dest->error = lodepng_info_copy(&dest->info_png, &source->info_png); if(dest->error) return;
|
||||
dest->error = lodepng_color_mode_copy(&dest->info_raw, &source->info_raw);
|
||||
if(dest->error) return;
|
||||
dest->error = lodepng_info_copy(&dest->info_png, &source->info_png);
|
||||
if(dest->error) return;
|
||||
}
|
||||
|
||||
#endif /* defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER) */
|
||||
|
@ -5197,7 +5234,8 @@ static void filterScanline(uint8_t* out, const uint8_t* scanline, const uint8_t*
|
|||
for(i = bytewidth; i < length; ++i) out[i] = (scanline[i] - scanline[i - bytewidth]);
|
||||
}
|
||||
break;
|
||||
default: return; /*unexisting filter type given*/
|
||||
default:
|
||||
return; /*unexisting filter type given*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5205,8 +5243,16 @@ static void filterScanline(uint8_t* out, const uint8_t* scanline, const uint8_t*
|
|||
static float flog2(float f)
|
||||
{
|
||||
float result = 0;
|
||||
while(f > 32) { result += 4; f /= 16; }
|
||||
while(f > 2) { ++result; f /= 2; }
|
||||
while(f > 32)
|
||||
{
|
||||
result += 4;
|
||||
f /= 16;
|
||||
}
|
||||
while(f > 2)
|
||||
{
|
||||
++result;
|
||||
f /= 2;
|
||||
}
|
||||
return result + 1.442695f * (f * f * f / 3 - 3 * f * f / 2 + 3 * f - 1.83333f);
|
||||
}
|
||||
|
||||
|
@ -5616,7 +5662,9 @@ static unsigned getPaletteTranslucency(const uint8_t* palette, size_t palettesiz
|
|||
{
|
||||
if(!key && palette[4 * i + 3] == 0)
|
||||
{
|
||||
r = palette[4 * i + 0]; g = palette[4 * i + 1]; b = palette[4 * i + 2];
|
||||
r = palette[4 * i + 0];
|
||||
g = palette[4 * i + 1];
|
||||
b = palette[4 * i + 2];
|
||||
key = 1;
|
||||
i = (size_t)(-1); /*restart from beginning, to detect earlier opaque colors with key's value*/
|
||||
}
|
||||
|
@ -5915,99 +5963,180 @@ const char* lodepng_error_text(unsigned code)
|
|||
{
|
||||
switch(code)
|
||||
{
|
||||
case 0: return "no error, everything went ok";
|
||||
case 1: return "nothing done yet"; /*the Encoder/Decoder has done nothing yet, error checking makes no sense yet*/
|
||||
case 10: return "end of input memory reached without huffman end code"; /*while huffman decoding*/
|
||||
case 11: return "error in code tree made it jump outside of huffman tree"; /*while huffman decoding*/
|
||||
case 13: return "problem while processing dynamic deflate block";
|
||||
case 14: return "problem while processing dynamic deflate block";
|
||||
case 15: return "problem while processing dynamic deflate block";
|
||||
case 16: return "unexisting code while processing dynamic deflate block";
|
||||
case 17: return "end of out buffer memory reached while inflating";
|
||||
case 18: return "invalid distance code while inflating";
|
||||
case 19: return "end of out buffer memory reached while inflating";
|
||||
case 20: return "invalid deflate block BTYPE encountered while decoding";
|
||||
case 21: return "NLEN is not ones complement of LEN in a deflate block";
|
||||
case 0:
|
||||
return "no error, everything went ok";
|
||||
case 1:
|
||||
return "nothing done yet"; /*the Encoder/Decoder has done nothing yet, error checking makes no sense yet*/
|
||||
case 10:
|
||||
return "end of input memory reached without huffman end code"; /*while huffman decoding*/
|
||||
case 11:
|
||||
return "error in code tree made it jump outside of huffman tree"; /*while huffman decoding*/
|
||||
case 13:
|
||||
return "problem while processing dynamic deflate block";
|
||||
case 14:
|
||||
return "problem while processing dynamic deflate block";
|
||||
case 15:
|
||||
return "problem while processing dynamic deflate block";
|
||||
case 16:
|
||||
return "unexisting code while processing dynamic deflate block";
|
||||
case 17:
|
||||
return "end of out buffer memory reached while inflating";
|
||||
case 18:
|
||||
return "invalid distance code while inflating";
|
||||
case 19:
|
||||
return "end of out buffer memory reached while inflating";
|
||||
case 20:
|
||||
return "invalid deflate block BTYPE encountered while decoding";
|
||||
case 21:
|
||||
return "NLEN is not ones complement of LEN in a deflate block";
|
||||
/*end of out buffer memory reached while inflating:
|
||||
This can happen if the inflated deflate data is longer than the amount of bytes required to fill up
|
||||
all the pixels of the image, given the color depth and image dimensions. Something that doesn't
|
||||
happen in a normal, well encoded, PNG image.*/
|
||||
case 22: return "end of out buffer memory reached while inflating";
|
||||
case 23: return "end of in buffer memory reached while inflating";
|
||||
case 24: return "invalid FCHECK in zlib header";
|
||||
case 25: return "invalid compression method in zlib header";
|
||||
case 26: return "FDICT encountered in zlib header while it's not used for PNG";
|
||||
case 27: return "PNG file is smaller than a PNG header";
|
||||
case 22:
|
||||
return "end of out buffer memory reached while inflating";
|
||||
case 23:
|
||||
return "end of in buffer memory reached while inflating";
|
||||
case 24:
|
||||
return "invalid FCHECK in zlib header";
|
||||
case 25:
|
||||
return "invalid compression method in zlib header";
|
||||
case 26:
|
||||
return "FDICT encountered in zlib header while it's not used for PNG";
|
||||
case 27:
|
||||
return "PNG file is smaller than a PNG header";
|
||||
/*Checks the magic file header, the first 8 bytes of the PNG file*/
|
||||
case 28: return "incorrect PNG signature, it's no PNG or corrupted";
|
||||
case 29: return "first chunk is not the header chunk";
|
||||
case 30: return "chunk length too large, chunk broken off at end of file";
|
||||
case 31: return "illegal PNG color type or bpp";
|
||||
case 32: return "illegal PNG compression method";
|
||||
case 33: return "illegal PNG filter method";
|
||||
case 34: return "illegal PNG interlace method";
|
||||
case 35: return "chunk length of a chunk is too large or the chunk too small";
|
||||
case 36: return "illegal PNG filter type encountered";
|
||||
case 37: return "illegal bit depth for this color type given";
|
||||
case 38: return "the palette is too big"; /*more than 256 colors*/
|
||||
case 39: return "more palette alpha values given in tRNS chunk than there are colors in the palette";
|
||||
case 40: return "tRNS chunk has wrong size for greyscale image";
|
||||
case 41: return "tRNS chunk has wrong size for RGB image";
|
||||
case 42: return "tRNS chunk appeared while it was not allowed for this color type";
|
||||
case 43: return "bKGD chunk has wrong size for palette image";
|
||||
case 44: return "bKGD chunk has wrong size for greyscale image";
|
||||
case 45: return "bKGD chunk has wrong size for RGB image";
|
||||
case 48: return "empty input buffer given to decoder. Maybe caused by non-existing file?";
|
||||
case 49: return "jumped past memory while generating dynamic huffman tree";
|
||||
case 50: return "jumped past memory while generating dynamic huffman tree";
|
||||
case 51: return "jumped past memory while inflating huffman block";
|
||||
case 52: return "jumped past memory while inflating";
|
||||
case 53: return "size of zlib data too small";
|
||||
case 54: return "repeat symbol in tree while there was no value symbol yet";
|
||||
case 28:
|
||||
return "incorrect PNG signature, it's no PNG or corrupted";
|
||||
case 29:
|
||||
return "first chunk is not the header chunk";
|
||||
case 30:
|
||||
return "chunk length too large, chunk broken off at end of file";
|
||||
case 31:
|
||||
return "illegal PNG color type or bpp";
|
||||
case 32:
|
||||
return "illegal PNG compression method";
|
||||
case 33:
|
||||
return "illegal PNG filter method";
|
||||
case 34:
|
||||
return "illegal PNG interlace method";
|
||||
case 35:
|
||||
return "chunk length of a chunk is too large or the chunk too small";
|
||||
case 36:
|
||||
return "illegal PNG filter type encountered";
|
||||
case 37:
|
||||
return "illegal bit depth for this color type given";
|
||||
case 38:
|
||||
return "the palette is too big"; /*more than 256 colors*/
|
||||
case 39:
|
||||
return "more palette alpha values given in tRNS chunk than there are colors in the palette";
|
||||
case 40:
|
||||
return "tRNS chunk has wrong size for greyscale image";
|
||||
case 41:
|
||||
return "tRNS chunk has wrong size for RGB image";
|
||||
case 42:
|
||||
return "tRNS chunk appeared while it was not allowed for this color type";
|
||||
case 43:
|
||||
return "bKGD chunk has wrong size for palette image";
|
||||
case 44:
|
||||
return "bKGD chunk has wrong size for greyscale image";
|
||||
case 45:
|
||||
return "bKGD chunk has wrong size for RGB image";
|
||||
case 48:
|
||||
return "empty input buffer given to decoder. Maybe caused by non-existing file?";
|
||||
case 49:
|
||||
return "jumped past memory while generating dynamic huffman tree";
|
||||
case 50:
|
||||
return "jumped past memory while generating dynamic huffman tree";
|
||||
case 51:
|
||||
return "jumped past memory while inflating huffman block";
|
||||
case 52:
|
||||
return "jumped past memory while inflating";
|
||||
case 53:
|
||||
return "size of zlib data too small";
|
||||
case 54:
|
||||
return "repeat symbol in tree while there was no value symbol yet";
|
||||
/*jumped past tree while generating huffman tree, this could be when the
|
||||
tree will have more leaves than symbols after generating it out of the
|
||||
given lenghts. They call this an oversubscribed dynamic bit lengths tree in zlib.*/
|
||||
case 55: return "jumped past tree while generating huffman tree";
|
||||
case 56: return "given output image colortype or bitdepth not supported for color conversion";
|
||||
case 57: return "invalid CRC encountered (checking CRC can be disabled)";
|
||||
case 58: return "invalid ADLER32 encountered (checking ADLER32 can be disabled)";
|
||||
case 59: return "requested color conversion not supported";
|
||||
case 60: return "invalid window size given in the settings of the encoder (must be 0-32768)";
|
||||
case 61: return "invalid BTYPE given in the settings of the encoder (only 0, 1 and 2 are allowed)";
|
||||
case 55:
|
||||
return "jumped past tree while generating huffman tree";
|
||||
case 56:
|
||||
return "given output image colortype or bitdepth not supported for color conversion";
|
||||
case 57:
|
||||
return "invalid CRC encountered (checking CRC can be disabled)";
|
||||
case 58:
|
||||
return "invalid ADLER32 encountered (checking ADLER32 can be disabled)";
|
||||
case 59:
|
||||
return "requested color conversion not supported";
|
||||
case 60:
|
||||
return "invalid window size given in the settings of the encoder (must be 0-32768)";
|
||||
case 61:
|
||||
return "invalid BTYPE given in the settings of the encoder (only 0, 1 and 2 are allowed)";
|
||||
/*LodePNG leaves the choice of RGB to greyscale conversion formula to the user.*/
|
||||
case 62: return "conversion from color to greyscale not supported";
|
||||
case 63: return "length of a chunk too long, max allowed for PNG is 2147483647 bytes per chunk"; /*(2^31-1)*/
|
||||
case 62:
|
||||
return "conversion from color to greyscale not supported";
|
||||
case 63:
|
||||
return "length of a chunk too long, max allowed for PNG is 2147483647 bytes per chunk"; /*(2^31-1)*/
|
||||
/*this would result in the inability of a deflated block to ever contain an end code. It must be at least 1.*/
|
||||
case 64: return "the length of the END symbol 256 in the Huffman tree is 0";
|
||||
case 66: return "the length of a text chunk keyword given to the encoder is longer than the maximum of 79 bytes";
|
||||
case 67: return "the length of a text chunk keyword given to the encoder is smaller than the minimum of 1 byte";
|
||||
case 68: return "tried to encode a PLTE chunk with a palette that has less than 1 or more than 256 colors";
|
||||
case 69: return "unknown chunk type with 'critical' flag encountered by the decoder";
|
||||
case 71: return "unexisting interlace mode given to encoder (must be 0 or 1)";
|
||||
case 72: return "while decoding, unexisting compression method encountering in zTXt or iTXt chunk (it must be 0)";
|
||||
case 73: return "invalid tIME chunk size";
|
||||
case 74: return "invalid pHYs chunk size";
|
||||
case 64:
|
||||
return "the length of the END symbol 256 in the Huffman tree is 0";
|
||||
case 66:
|
||||
return "the length of a text chunk keyword given to the encoder is longer than the maximum of 79 bytes";
|
||||
case 67:
|
||||
return "the length of a text chunk keyword given to the encoder is smaller than the minimum of 1 byte";
|
||||
case 68:
|
||||
return "tried to encode a PLTE chunk with a palette that has less than 1 or more than 256 colors";
|
||||
case 69:
|
||||
return "unknown chunk type with 'critical' flag encountered by the decoder";
|
||||
case 71:
|
||||
return "unexisting interlace mode given to encoder (must be 0 or 1)";
|
||||
case 72:
|
||||
return "while decoding, unexisting compression method encountering in zTXt or iTXt chunk (it must be 0)";
|
||||
case 73:
|
||||
return "invalid tIME chunk size";
|
||||
case 74:
|
||||
return "invalid pHYs chunk size";
|
||||
/*length could be wrong, or data chopped off*/
|
||||
case 75: return "no null termination char found while decoding text chunk";
|
||||
case 76: return "iTXt chunk too short to contain required bytes";
|
||||
case 77: return "integer overflow in buffer size";
|
||||
case 78: return "failed to open file for reading"; /*file doesn't exist or couldn't be opened for reading*/
|
||||
case 79: return "failed to open file for writing";
|
||||
case 80: return "tried creating a tree of 0 symbols";
|
||||
case 81: return "lazy matching at pos 0 is impossible";
|
||||
case 82: return "color conversion to palette requested while a color isn't in palette";
|
||||
case 83: return "memory allocation failed";
|
||||
case 84: return "given image too small to contain all pixels to be encoded";
|
||||
case 86: return "impossible offset in lz77 encoding (internal bug)";
|
||||
case 87: return "must provide custom zlib function pointer if LODEPNG_COMPILE_ZLIB is not defined";
|
||||
case 88: return "invalid filter strategy given for LodePNGEncoderSettings.filter_strategy";
|
||||
case 89: return "text chunk keyword too short or long: must have size 1-79";
|
||||
case 75:
|
||||
return "no null termination char found while decoding text chunk";
|
||||
case 76:
|
||||
return "iTXt chunk too short to contain required bytes";
|
||||
case 77:
|
||||
return "integer overflow in buffer size";
|
||||
case 78:
|
||||
return "failed to open file for reading"; /*file doesn't exist or couldn't be opened for reading*/
|
||||
case 79:
|
||||
return "failed to open file for writing";
|
||||
case 80:
|
||||
return "tried creating a tree of 0 symbols";
|
||||
case 81:
|
||||
return "lazy matching at pos 0 is impossible";
|
||||
case 82:
|
||||
return "color conversion to palette requested while a color isn't in palette";
|
||||
case 83:
|
||||
return "memory allocation failed";
|
||||
case 84:
|
||||
return "given image too small to contain all pixels to be encoded";
|
||||
case 86:
|
||||
return "impossible offset in lz77 encoding (internal bug)";
|
||||
case 87:
|
||||
return "must provide custom zlib function pointer if LODEPNG_COMPILE_ZLIB is not defined";
|
||||
case 88:
|
||||
return "invalid filter strategy given for LodePNGEncoderSettings.filter_strategy";
|
||||
case 89:
|
||||
return "text chunk keyword too short or long: must have size 1-79";
|
||||
/*the windowsize in the LodePNGCompressSettings. Requiring POT(==> & instead of %) makes encoding 12% faster.*/
|
||||
case 90: return "windowsize must be a power of two";
|
||||
case 91: return "invalid decompressed idat size";
|
||||
case 92: return "too many pixels, not supported";
|
||||
case 93: return "zero width or height is invalid";
|
||||
case 94: return "header chunk must have a size of 13 bytes";
|
||||
case 90:
|
||||
return "windowsize must be a power of two";
|
||||
case 91:
|
||||
return "invalid decompressed idat size";
|
||||
case 92:
|
||||
return "too many pixels, not supported";
|
||||
case 93:
|
||||
return "zero width or height is invalid";
|
||||
case 94:
|
||||
return "header chunk must have a size of 13 bytes";
|
||||
}
|
||||
return "unknown error code";
|
||||
}
|
||||
|
|
|
@ -45,11 +45,13 @@ static void Sys_InitSDL (void)
|
|||
|
||||
Sys_Printf("Found SDL version %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", sdl_version->major, sdl_version->minor, sdl_version->patch);
|
||||
if(SDL_VERSIONNUM(sdl_version->major, sdl_version->minor, sdl_version->patch) < SDL_REQUIREDVERSION)
|
||||
{ /*reject running under older SDL versions */
|
||||
{
|
||||
/*reject running under older SDL versions */
|
||||
Sys_Error("You need at least v%" PRIi32 ".%" PRIi32 ".%" PRIi32 " of SDL to run this game.", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z);
|
||||
}
|
||||
if(SDL_VERSIONNUM(sdl_version->major, sdl_version->minor, sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
|
||||
{ /*reject running under newer (1.3.x) SDL */
|
||||
{
|
||||
/*reject running under newer (1.3.x) SDL */
|
||||
Sys_Error("Your version of SDL library is incompatible with me.\n"
|
||||
"You need a library version in the line of %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,13 @@ extern vec3_t vec3_origin;
|
|||
#if 0 /* macro is violating strict aliasing rules */
|
||||
#define IS_NAN(x) (((*(int32_t *) (char *) &x) & nanmask) == nanmask)
|
||||
#else
|
||||
static inline int32_t IS_NAN (float x) {
|
||||
union { float f; int32_t i; } num;
|
||||
static inline int32_t IS_NAN(float x)
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
int32_t i;
|
||||
} num;
|
||||
num.f = x;
|
||||
return ((num.i & nanmask) == nanmask);
|
||||
}
|
||||
|
|
|
@ -1477,7 +1477,8 @@ void M_Keys_Key (int32_t k)
|
|||
int32_t keys[3];
|
||||
|
||||
if(bind_grab)
|
||||
{ // defining a key
|
||||
{
|
||||
// defining a key
|
||||
S_LocalSound("misc/menu1.wav");
|
||||
if((k != K_ESCAPE) && (k != '`'))
|
||||
{
|
||||
|
@ -2126,13 +2127,27 @@ void M_GameOptions_Draw (void)
|
|||
|
||||
switch((int32_t)teamplay.value)
|
||||
{
|
||||
case 1: msg = "No Friendly Fire"; break;
|
||||
case 2: msg = "Friendly Fire"; break;
|
||||
case 3: msg = "Tag"; break;
|
||||
case 4: msg = "Capture the Flag"; break;
|
||||
case 5: msg = "One Flag CTF"; break;
|
||||
case 6: msg = "Three Team CTF"; break;
|
||||
default: msg = "Off"; break;
|
||||
case 1:
|
||||
msg = "No Friendly Fire";
|
||||
break;
|
||||
case 2:
|
||||
msg = "Friendly Fire";
|
||||
break;
|
||||
case 3:
|
||||
msg = "Tag";
|
||||
break;
|
||||
case 4:
|
||||
msg = "Capture the Flag";
|
||||
break;
|
||||
case 5:
|
||||
msg = "One Flag CTF";
|
||||
break;
|
||||
case 6:
|
||||
msg = "Three Team CTF";
|
||||
break;
|
||||
default:
|
||||
msg = "Off";
|
||||
break;
|
||||
}
|
||||
M_Print(160, 72, msg);
|
||||
}
|
||||
|
@ -2142,9 +2157,15 @@ void M_GameOptions_Draw (void)
|
|||
|
||||
switch((int32_t)teamplay.value)
|
||||
{
|
||||
case 1: msg = "No Friendly Fire"; break;
|
||||
case 2: msg = "Friendly Fire"; break;
|
||||
default: msg = "Off"; break;
|
||||
case 1:
|
||||
msg = "No Friendly Fire";
|
||||
break;
|
||||
case 2:
|
||||
msg = "Friendly Fire";
|
||||
break;
|
||||
default:
|
||||
msg = "Off";
|
||||
break;
|
||||
}
|
||||
M_Print(160, 72, msg);
|
||||
}
|
||||
|
@ -2628,7 +2649,8 @@ void M_Draw (void)
|
|||
|
||||
case m_quit:
|
||||
if(!fitzmode)
|
||||
{ /* QuakeSpasm customization: */
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
/* Quit now! S.A. */
|
||||
key_dest = key_console;
|
||||
Host_Quit_f();
|
||||
|
|
|
@ -23,7 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef _QUAKE_MENU_H
|
||||
#define _QUAKE_MENU_H
|
||||
|
||||
enum m_state_e {
|
||||
enum m_state_e
|
||||
{
|
||||
m_none,
|
||||
m_main,
|
||||
m_singleplayer,
|
||||
|
|
|
@ -61,7 +61,8 @@ typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t;
|
|||
|
||||
typedef enum { ALIAS_SKIN_SINGLE = 0, ALIAS_SKIN_GROUP } aliasskintype_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
vec3_t scale;
|
||||
|
@ -81,13 +82,15 @@ typedef struct {
|
|||
|
||||
// TODO: could be shorts
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t onseam;
|
||||
int32_t s;
|
||||
int32_t t;
|
||||
} stvert_t;
|
||||
|
||||
typedef struct dtriangle_s {
|
||||
typedef struct dtriangle_s
|
||||
{
|
||||
int32_t facesfront;
|
||||
int32_t vertindex[3];
|
||||
} dtriangle_t;
|
||||
|
@ -97,40 +100,48 @@ typedef struct dtriangle_s {
|
|||
// This mirrors trivert_t in trilib.h, is present so Quake knows how to
|
||||
// load this data
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
byte v[3];
|
||||
byte lightnormalindex;
|
||||
} trivertx_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
trivertx_t bboxmin; // lightnormal isn't used
|
||||
trivertx_t bboxmax; // lightnormal isn't used
|
||||
char name[16]; // frame name from grabbing
|
||||
} daliasframe_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t numframes;
|
||||
trivertx_t bboxmin; // lightnormal isn't used
|
||||
trivertx_t bboxmax; // lightnormal isn't used
|
||||
} daliasgroup_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t numskins;
|
||||
} daliasskingroup_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} daliasinterval_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} daliasskininterval_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
aliasframetype_t type;
|
||||
} daliasframetype_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
aliasskintype_t type;
|
||||
} daliasskintype_t;
|
||||
|
||||
|
|
|
@ -688,9 +688,11 @@ static void PF_traceline (void)
|
|||
ent = G_EDICT(OFS_PARM3);
|
||||
|
||||
/* FIXME FIXME FIXME: Why do we hit this with certain progs.dat ?? */
|
||||
if (developer.value) {
|
||||
if(developer.value)
|
||||
{
|
||||
if(IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) ||
|
||||
IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2])) {
|
||||
IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2]))
|
||||
{
|
||||
Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
|
||||
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent));
|
||||
}
|
||||
|
@ -1071,7 +1073,8 @@ static void PR_CheckEmptyString (const char *s)
|
|||
}
|
||||
|
||||
static void PF_precache_file(void)
|
||||
{ // precache_file is only used to copy files with qcc, it does nothing
|
||||
{
|
||||
// precache_file is only used to copy files with qcc, it does nothing
|
||||
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1405,8 @@ static void PF_aim (void)
|
|||
continue; // to far to turn
|
||||
tr = SV_Move(start, vec3_origin, vec3_origin, end, false, ent);
|
||||
if(tr.ent == check)
|
||||
{ // can shoot at this one
|
||||
{
|
||||
// can shoot at this one
|
||||
bestdist = dist;
|
||||
bestent = check;
|
||||
}
|
||||
|
@ -1559,7 +1563,8 @@ static void PF_makestatic (void)
|
|||
ent = G_EDICT(OFS_PARM0);
|
||||
|
||||
//johnfitz -- don't send invisible static entities
|
||||
if (ent->alpha == ENTALPHA_ZERO) {
|
||||
if(ent->alpha == ENTALPHA_ZERO)
|
||||
{
|
||||
ED_Free(ent);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ int32_t pr_edict_size; // in bytes
|
|||
|
||||
uint16_t pr_crc;
|
||||
|
||||
int32_t type_size[8] = {
|
||||
int32_t type_size[8] =
|
||||
{
|
||||
1, // ev_void
|
||||
1, // sizeof(string_t) / 4 // ev_string
|
||||
1, // ev_float
|
||||
|
@ -60,7 +61,8 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s);
|
|||
#define MAX_FIELD_LEN 64
|
||||
#define GEFV_CACHESIZE 2
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
ddef_t *pcache;
|
||||
char field[MAX_FIELD_LEN];
|
||||
} gefv_cache;
|
||||
|
|
|
@ -243,7 +243,8 @@ void PR_Profile_f (void)
|
|||
num++;
|
||||
best->profile = 0;
|
||||
}
|
||||
} while (best);
|
||||
}
|
||||
while(best);
|
||||
}
|
||||
|
||||
|
||||
|
@ -609,7 +610,8 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
PR_RunError("NULL function");
|
||||
newf = &pr_functions[OPA->function];
|
||||
if(newf->first_statement < 0)
|
||||
{ // Built-in function
|
||||
{
|
||||
// Built-in function
|
||||
int32_t i = -newf->first_statement;
|
||||
if(i >= pr_numbuiltins)
|
||||
PR_RunError("Bad builtin call number %" PRIi32 "", i);
|
||||
|
@ -630,7 +632,8 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
pr_globals[OFS_RETURN + 2] = pr_globals[(uint16_t)st->a + 2];
|
||||
st = &pr_statements[PR_LeaveFunction()];
|
||||
if(pr_depth == exitdepth)
|
||||
{ // Done
|
||||
{
|
||||
// Done
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -63,10 +63,15 @@ static inline int32_t q_isblank(int32_t c)
|
|||
|
||||
static inline int32_t q_isspace(int32_t c)
|
||||
{
|
||||
switch(c) {
|
||||
case ' ': case '\t':
|
||||
case '\n': case '\r':
|
||||
case '\f': case '\v': return 1;
|
||||
switch(c)
|
||||
{
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\f':
|
||||
case '\v':
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ _Static_assert(sizeof(float) == 4, "float not correct size");
|
|||
_Static_assert(sizeof(int32_t) == 4, "int32_t not correct size");
|
||||
|
||||
/* make sure enums are the size of ints for structure packing */
|
||||
enum dummy_enum {
|
||||
enum dummy_enum
|
||||
{
|
||||
dummy_value
|
||||
};
|
||||
_Static_assert(sizeof(enum dummy_enum) == sizeof(int32_t), "enum not sizeof(int32_t)");
|
||||
|
|
|
@ -57,7 +57,8 @@ bool overbright; //johnfitz
|
|||
bool shading = true; //johnfitz -- if false, disable vertex shading for various reasons (fullbright, r_lightmap, showtris, etc)
|
||||
|
||||
//johnfitz -- struct for passing lerp information to drawing functions
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int16_t pose1;
|
||||
int16_t pose2;
|
||||
float blend;
|
||||
|
@ -121,7 +122,8 @@ GLAlias_CreateShaders
|
|||
*/
|
||||
void GLAlias_CreateShaders(void)
|
||||
{
|
||||
const glsl_attrib_binding_t bindings[] = {
|
||||
const glsl_attrib_binding_t bindings[] =
|
||||
{
|
||||
{ "TexCoords", texCoordsAttrIndex },
|
||||
{ "Pose1Vert", pose1VertexAttrIndex },
|
||||
{ "Pose1Normal", pose1NormalAttrIndex },
|
||||
|
@ -395,7 +397,8 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
|
|||
glVertex3f(verts1->v[0], verts1->v[1], verts1->v[2]);
|
||||
verts1++;
|
||||
}
|
||||
} while (--count);
|
||||
}
|
||||
while(--count);
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
@ -913,7 +916,8 @@ void GL_DrawAliasShadow (entity_t *e)
|
|||
float shadowmatrix[16] = {1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
SHADOW_SKEW_X, SHADOW_SKEW_Y, SHADOW_VSCALE, 0,
|
||||
0, 0, SHADOW_HEIGHT, 1};
|
||||
0, 0, SHADOW_HEIGHT, 1
|
||||
};
|
||||
float lheight;
|
||||
aliashdr_t *paliashdr;
|
||||
lerpdata_t lerpdata;
|
||||
|
|
|
@ -37,7 +37,8 @@ gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array
|
|||
|
||||
unsigned blocklights[BLOCK_WIDTH * BLOCK_HEIGHT * 3]; //johnfitz -- was 18*18, added lit support (*3) and loosened surface extents maximum (BLOCK_WIDTH*BLOCK_HEIGHT)
|
||||
|
||||
typedef struct glRect_s {
|
||||
typedef struct glRect_s
|
||||
{
|
||||
uint8_t l, t, w, h;
|
||||
} glRect_t;
|
||||
|
||||
|
@ -693,12 +694,14 @@ dynamic:
|
|||
{
|
||||
lightmap_modified[fa->lightmaptexturenum] = true;
|
||||
theRect = &lightmap_rectchange[fa->lightmaptexturenum];
|
||||
if (fa->light_t < theRect->t) {
|
||||
if(fa->light_t < theRect->t)
|
||||
{
|
||||
if(theRect->h)
|
||||
theRect->h += theRect->t - fa->light_t;
|
||||
theRect->t = fa->light_t;
|
||||
}
|
||||
if (fa->light_s < theRect->l) {
|
||||
if(fa->light_s < theRect->l)
|
||||
{
|
||||
if(theRect->w)
|
||||
theRect->w += theRect->l - fa->light_s;
|
||||
theRect->l = fa->light_s;
|
||||
|
@ -748,7 +751,8 @@ int32_t AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y)
|
|||
best2 = allocated[texnum][i + j];
|
||||
}
|
||||
if(j == w)
|
||||
{ // this is a valid spot
|
||||
{
|
||||
// this is a valid spot
|
||||
*x = i;
|
||||
*y = best = best2;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,8 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int32_t color, int32_t count)
|
|||
active_particles = p;
|
||||
|
||||
if(count == 1024)
|
||||
{ // rocket explosion
|
||||
{
|
||||
// rocket explosion
|
||||
p->die = cl.time + 5;
|
||||
p->color = ramp1[0];
|
||||
p->ramp = rand() & 3;
|
||||
|
|
|
@ -819,7 +819,8 @@ GLWorld_CreateShaders
|
|||
*/
|
||||
void GLWorld_CreateShaders(void)
|
||||
{
|
||||
const glsl_attrib_binding_t bindings[] = {
|
||||
const glsl_attrib_binding_t bindings[] =
|
||||
{
|
||||
{ "Vert", vertAttrIndex },
|
||||
{ "TexCoords", texCoordsAttrIndex },
|
||||
{ "LMCoords", LMCoordsAttrIndex }
|
||||
|
|
|
@ -369,7 +369,8 @@ int32_t Sbar_itoa (int32_t num, char *buf)
|
|||
dig = num / pow10;
|
||||
*str++ = '0' + dig;
|
||||
num -= dig * pow10;
|
||||
} while (pow10 != 1);
|
||||
}
|
||||
while(pow10 != 1);
|
||||
|
||||
*str = 0;
|
||||
|
||||
|
@ -506,7 +507,8 @@ void Sbar_SoloScoreboard (void)
|
|||
Sbar_DrawString(312 - strlen(str) * 8, 12, str);
|
||||
|
||||
if(!fitzmode)
|
||||
{ /* QuakeSpasm customization: */
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
q_snprintf(str, sizeof(str), "skill %" PRIi32 "", (int32_t)(skill.value + 0.5));
|
||||
Sbar_DrawString(160 - strlen(str) * 4, 12, str);
|
||||
|
||||
|
@ -689,7 +691,8 @@ void Sbar_DrawInventory (void)
|
|||
{
|
||||
time = cl.item_gettime[17 + i];
|
||||
if(time && time > cl.time - 2 && flashon)
|
||||
{ // flash frame
|
||||
{
|
||||
// flash frame
|
||||
sb_updates = 0;
|
||||
}
|
||||
else
|
||||
|
@ -714,7 +717,8 @@ void Sbar_DrawInventory (void)
|
|||
{
|
||||
time = cl.item_gettime[24 + i];
|
||||
if(time && time > cl.time - 2 && flashon)
|
||||
{ // flash frame
|
||||
{
|
||||
// flash frame
|
||||
sb_updates = 0;
|
||||
}
|
||||
else
|
||||
|
@ -736,7 +740,8 @@ void Sbar_DrawInventory (void)
|
|||
{
|
||||
time = cl.item_gettime[29 + i];
|
||||
if(time && time > cl.time - 2 && flashon)
|
||||
{ // flash frame
|
||||
{
|
||||
// flash frame
|
||||
sb_updates = 0;
|
||||
}
|
||||
else
|
||||
|
@ -757,7 +762,8 @@ void Sbar_DrawInventory (void)
|
|||
{
|
||||
time = cl.item_gettime[28 + i];
|
||||
if(time && time > cl.time - 2 && flashon)
|
||||
{ // flash frame
|
||||
{
|
||||
// flash frame
|
||||
sb_updates = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -57,7 +57,8 @@ extern cvar_t scr_sbaralpha; //johnfitz
|
|||
void SCR_UpdateWholeScreen(void);
|
||||
|
||||
//johnfitz -- stuff for 2d drawing control
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
CANVAS_NONE,
|
||||
CANVAS_DEFAULT,
|
||||
CANVAS_CONSOLE,
|
||||
|
|
|
@ -131,7 +131,8 @@ snd_stream_t *S_CodecOpenStreamType (const char *filename, uint32_t type)
|
|||
return NULL;
|
||||
}
|
||||
stream = S_CodecUtilOpen(filename, codec);
|
||||
if (stream) {
|
||||
if(stream)
|
||||
{
|
||||
if(codec->codec_open(stream))
|
||||
stream->status = STREAM_PLAY;
|
||||
else S_CodecUtilClose(&stream);
|
||||
|
@ -165,7 +166,8 @@ snd_stream_t *S_CodecOpenStreamExt (const char *filename)
|
|||
return NULL;
|
||||
}
|
||||
stream = S_CodecUtilOpen(filename, codec);
|
||||
if (stream) {
|
||||
if(stream)
|
||||
{
|
||||
if(codec->codec_open(stream))
|
||||
stream->status = STREAM_PLAY;
|
||||
else S_CodecUtilClose(&stream);
|
||||
|
@ -189,8 +191,10 @@ snd_stream_t *S_CodecOpenStreamAny (const char *filename)
|
|||
{
|
||||
q_snprintf(tmp, sizeof(tmp), "%s.%s", filename, codec->ext);
|
||||
stream = S_CodecUtilOpen(tmp, codec);
|
||||
if (stream) {
|
||||
if (codec->codec_open(stream)) {
|
||||
if(stream)
|
||||
{
|
||||
if(codec->codec_open(stream))
|
||||
{
|
||||
stream->status = STREAM_PLAY;
|
||||
return stream;
|
||||
}
|
||||
|
@ -216,7 +220,8 @@ snd_stream_t *S_CodecOpenStreamAny (const char *filename)
|
|||
return NULL;
|
||||
}
|
||||
stream = S_CodecUtilOpen(filename, codec);
|
||||
if (stream) {
|
||||
if(stream)
|
||||
{
|
||||
if(codec->codec_open(stream))
|
||||
stream->status = STREAM_PLAY;
|
||||
else S_CodecUtilClose(&stream);
|
||||
|
|
|
@ -37,7 +37,8 @@ typedef struct snd_info_s
|
|||
int32_t dataofs;
|
||||
} snd_info_t;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
STREAM_NONE = -1,
|
||||
STREAM_INIT,
|
||||
STREAM_PAUSE,
|
||||
|
|
|
@ -86,7 +86,8 @@ cvar_t snd_mixspeed = {"snd_mixspeed", "44100", CVAR_NONE};
|
|||
#endif
|
||||
|
||||
cvar_t snd_filterquality = {"snd_filterquality", SND_FILTERQUALITY_DEFAULT,
|
||||
CVAR_NONE};
|
||||
CVAR_NONE
|
||||
};
|
||||
|
||||
static cvar_t nosound = {"nosound", "0", CVAR_NONE};
|
||||
static cvar_t ambient_level = {"ambient_level", "0.3", CVAR_NONE};
|
||||
|
@ -364,7 +365,8 @@ channel_t *SND_PickChannel (int32_t entnum, int32_t entchannel)
|
|||
if(entchannel != 0 // channel 0 never overrides
|
||||
&& snd_channels[ch_idx].entnum == entnum
|
||||
&& (snd_channels[ch_idx].entchannel == entchannel || entchannel == -1))
|
||||
{ // always override sound from same entity
|
||||
{
|
||||
// always override sound from same entity
|
||||
first_to_die = ch_idx;
|
||||
break;
|
||||
}
|
||||
|
@ -883,7 +885,8 @@ static void GetSoundtime (void)
|
|||
buffers++; // buffer wrapped
|
||||
|
||||
if(paintedtime > 0x40000000)
|
||||
{ // time to chop things off to avoid 32 bit limits
|
||||
{
|
||||
// time to chop things off to avoid 32 bit limits
|
||||
buffers = 0;
|
||||
paintedtime = fullsamples;
|
||||
S_StopAllSounds(true);
|
||||
|
|
|
@ -67,7 +67,8 @@ typedef unsigned FLAC_SIZE_T;
|
|||
typedef size_t FLAC_SIZE_T;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
FLAC__StreamDecoder *decoder;
|
||||
fshandle_t *file;
|
||||
snd_info_t *info;
|
||||
|
@ -154,9 +155,11 @@ flac_write_func (const FLAC__StreamDecoder *decoder,
|
|||
flacfile_t *ff = (flacfile_t *) client_data;
|
||||
(void)decoder;
|
||||
|
||||
if (!ff->buffer) {
|
||||
if(!ff->buffer)
|
||||
{
|
||||
ff->buffer = (byte *) malloc(ff->info->blocksize * ff->info->channels * ff->info->width);
|
||||
if (!ff->buffer) {
|
||||
if(!ff->buffer)
|
||||
{
|
||||
ff->error = -1; /* needn't set this here, but... */
|
||||
Con_Printf("Insufficient memory for fLaC audio\n");
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
|
@ -333,7 +336,8 @@ static int32_t S_FLAC_CodecReadStream (snd_stream_t *stream, int32_t len, void *
|
|||
byte *buf = (byte *) buffer;
|
||||
int32_t count = 0;
|
||||
|
||||
while (len) {
|
||||
while(len)
|
||||
{
|
||||
int32_t res = 0;
|
||||
if(ff->size == ff->pos)
|
||||
FLAC__stream_decoder_process_single(ff->decoder);
|
||||
|
@ -341,15 +345,20 @@ static int32_t S_FLAC_CodecReadStream (snd_stream_t *stream, int32_t len, void *
|
|||
res = ff->size - ff->pos;
|
||||
if(res > len)
|
||||
res = len;
|
||||
if (res > 0) {
|
||||
if(res > 0)
|
||||
{
|
||||
memcpy(buf, ff->buffer + ff->pos, res);
|
||||
count += res;
|
||||
len -= res;
|
||||
buf += res;
|
||||
ff->pos += res;
|
||||
} else if (res < 0) { /* error */
|
||||
}
|
||||
else if(res < 0) /* error */
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_DPrintf("FLAC: EOF\n");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -242,7 +242,8 @@ static void DumpChunks (void)
|
|||
iff_chunk_len = GetLittleLong();
|
||||
Con_Printf("0x%x : %s (%" PRIi32 ")\n", (int32_t)(data_p - 4), str, iff_chunk_len);
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < iff_end);
|
||||
}
|
||||
while(data_p < iff_end);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -315,7 +316,8 @@ wavinfo_t GetWavinfo (const char *name, byte *wav, int32_t wavlength)
|
|||
if(data_p)
|
||||
{
|
||||
if(!strncmp((char *)data_p + 28, "mark", 4))
|
||||
{ // this is not a proper parse, but it works with cooledit...
|
||||
{
|
||||
// this is not a proper parse, but it works with cooledit...
|
||||
data_p += 24;
|
||||
i = GetLittleLong(); // samples in loop
|
||||
info.samples = info.loopstart + i;
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#define DMODE_SIMDMIXER 0x0800 /* enable SIMD mixing */
|
||||
#endif
|
||||
|
||||
typedef struct _mik_priv {
|
||||
typedef struct _mik_priv
|
||||
{
|
||||
/* struct MREADER in libmikmod <= 3.2.0-beta2
|
||||
* doesn't have iobase members. adding them here
|
||||
* so that if we compile against 3.2.0-beta2, we
|
||||
|
|
|
@ -194,7 +194,8 @@ static void S_MakeBlackmanWindowKernel(float *kernel, int32_t M, float f_c)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float *memory; // kernelsize floats
|
||||
float *kernel; // kernelsize floats
|
||||
int32_t kernelsize; // M+1, rounded up to be a multiple of 16
|
||||
|
@ -304,16 +305,26 @@ static void S_LowpassFilter(int32_t *data, int32_t stride, int32_t count,
|
|||
switch((int32_t)snd_filterquality.value)
|
||||
{
|
||||
case 1:
|
||||
M = 126; bw = 0.900; break;
|
||||
M = 126;
|
||||
bw = 0.900;
|
||||
break;
|
||||
case 2:
|
||||
M = 150; bw = 0.915; break;
|
||||
M = 150;
|
||||
bw = 0.915;
|
||||
break;
|
||||
case 3:
|
||||
M = 174; bw = 0.930; break;
|
||||
M = 174;
|
||||
bw = 0.930;
|
||||
break;
|
||||
case 4:
|
||||
M = 198; bw = 0.945; break;
|
||||
M = 198;
|
||||
bw = 0.945;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
M = 222; bw = 0.960; break;
|
||||
M = 222;
|
||||
bw = 0.960;
|
||||
break;
|
||||
}
|
||||
|
||||
f_c = (bw * 11025 / 2.0) / 44100.0;
|
||||
|
@ -367,7 +378,8 @@ void S_PaintChannels (int32_t endtime)
|
|||
ltime = paintedtime;
|
||||
|
||||
while(ltime < end)
|
||||
{ // paint up to end
|
||||
{
|
||||
// paint up to end
|
||||
if(ch->end < end)
|
||||
count = ch->end - ltime;
|
||||
else
|
||||
|
@ -394,7 +406,8 @@ void S_PaintChannels (int32_t endtime)
|
|||
ch->end = ltime + sc->length - ch->pos;
|
||||
}
|
||||
else
|
||||
{ // channel just stopped
|
||||
{
|
||||
// channel just stopped
|
||||
ch->sfx = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -421,7 +434,8 @@ void S_PaintChannels (int32_t endtime)
|
|||
|
||||
// paint in the music
|
||||
if(s_rawend >= paintedtime)
|
||||
{ // copy from the streaming sound source
|
||||
{
|
||||
// copy from the streaming sound source
|
||||
int32_t s;
|
||||
int32_t stop;
|
||||
|
||||
|
|
|
@ -372,7 +372,8 @@ static int32_t mp3_decode(snd_stream_t *stream, byte *buf, int32_t len)
|
|||
mad_timer_add(&p->timer, p->frame.header.duration);
|
||||
mad_synth_frame(&p->synth, &p->frame);
|
||||
p->cursamp = 0;
|
||||
} while (1);
|
||||
}
|
||||
while(1);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
@ -499,7 +500,8 @@ static int32_t S_MP3_CodecRewindStream (snd_stream_t *stream)
|
|||
size_t available = (p->stream.bufend - p->stream.this_frame);
|
||||
tagsize = mp3_tagsize(p->stream.this_frame, (size_t) available);
|
||||
if(tagsize)
|
||||
{ /* It's some ID3 tags, so just skip */
|
||||
{
|
||||
/* It's some ID3 tags, so just skip */
|
||||
if(tagsize >= available)
|
||||
{
|
||||
FS_fseek(&stream->fh,
|
||||
|
|
|
@ -37,7 +37,8 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int32_t len)
|
|||
(void)unused;
|
||||
|
||||
if(!shm)
|
||||
{ /* shouldn't happen, but just in case */
|
||||
{
|
||||
/* shouldn't happen, but just in case */
|
||||
memset(stream, 0, len);
|
||||
return;
|
||||
}
|
||||
|
@ -63,7 +64,8 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int32_t len)
|
|||
shm->samplepos += (len1 / (shm->samplebits / 8));
|
||||
}
|
||||
else
|
||||
{ /* wraparound? */
|
||||
{
|
||||
/* wraparound? */
|
||||
memcpy(stream + len1, shm->buffer, len2);
|
||||
shm->samplepos = (len2 / (shm->samplebits / 8));
|
||||
}
|
||||
|
@ -136,7 +138,8 @@ bool SNDDMA_Init (dma_t *dma)
|
|||
shm->channels = obtained.channels;
|
||||
tmp = (obtained.samples * obtained.channels) * 10;
|
||||
if(tmp & (tmp - 1))
|
||||
{ /* make it a power of two */
|
||||
{
|
||||
/* make it a power of two */
|
||||
val = 1;
|
||||
while(val < tmp)
|
||||
val <<= 1;
|
||||
|
|
|
@ -37,12 +37,14 @@ typedef int32_t fci_t; /* FCompactIndex */
|
|||
|
||||
#define UPKG_HDR_TAG 0x9e2a83c1
|
||||
|
||||
struct _genhist { /* for upkg versions >= 68 */
|
||||
struct _genhist /* for upkg versions >= 68 */
|
||||
{
|
||||
int32_t export_count;
|
||||
int32_t name_count;
|
||||
};
|
||||
|
||||
struct upkg_hdr {
|
||||
struct upkg_hdr
|
||||
{
|
||||
uint32_t tag; /* UPKG_HDR_TAG */
|
||||
int32_t file_version;
|
||||
uint32_t pkg_flags;
|
||||
|
@ -74,7 +76,8 @@ _Static_assert(sizeof(struct upkg_hdr) == UPKG_HDR_SIZE,
|
|||
#define UMUSIC_WAV 4
|
||||
#define UMUSIC_MP2 5
|
||||
|
||||
static const char *mustype[] = {
|
||||
static const char *mustype[] =
|
||||
{
|
||||
"IT", "S3M", "XM", "MOD",
|
||||
"WAV", "MP2", NULL
|
||||
};
|
||||
|
@ -93,19 +96,23 @@ static fci_t get_fci (const char *in, int32_t *pos)
|
|||
size = 1;
|
||||
a = in[0] & 0x3f;
|
||||
|
||||
if (in[0] & 0x40) {
|
||||
if(in[0] & 0x40)
|
||||
{
|
||||
size++;
|
||||
a |= (in[1] & 0x7f) << 6;
|
||||
|
||||
if (in[1] & 0x80) {
|
||||
if(in[1] & 0x80)
|
||||
{
|
||||
size++;
|
||||
a |= (in[2] & 0x7f) << 13;
|
||||
|
||||
if (in[2] & 0x80) {
|
||||
if(in[2] & 0x80)
|
||||
{
|
||||
size++;
|
||||
a |= (in[3] & 0x7f) << 20;
|
||||
|
||||
if (in[3] & 0x80) {
|
||||
if(in[3] & 0x80)
|
||||
{
|
||||
size++;
|
||||
a |= (in[4] & 0x3f) << 27;
|
||||
}
|
||||
|
@ -127,12 +134,14 @@ static int32_t get_objtype (fshandle_t *f, int32_t ofs, int32_t type)
|
|||
_retry:
|
||||
FS_fseek(f, ofs, SEEK_SET);
|
||||
FS_fread(sig, 16, 1, f);
|
||||
if (type == UMUSIC_IT) {
|
||||
if(type == UMUSIC_IT)
|
||||
{
|
||||
if(memcmp(sig, "IMPM", 4) == 0)
|
||||
return UMUSIC_IT;
|
||||
return -1;
|
||||
}
|
||||
if (type == UMUSIC_XM) {
|
||||
if(type == UMUSIC_XM)
|
||||
{
|
||||
if(memcmp(sig, "Extended Module:", 16) != 0)
|
||||
return -1;
|
||||
FS_fread(sig, 16, 1, f);
|
||||
|
@ -141,14 +150,16 @@ _retry:
|
|||
if(sig[5] != 0x1a) return -1;
|
||||
return UMUSIC_XM;
|
||||
}
|
||||
if (type == UMUSIC_MP2) {
|
||||
if(type == UMUSIC_MP2)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)sig;
|
||||
uint16_t u = ((p[0] << 8) | p[1]) & 0xFFFE;
|
||||
if(u == 0xFFFC || u == 0xFFF4)
|
||||
return UMUSIC_MP2;
|
||||
return -1;
|
||||
}
|
||||
if (type == UMUSIC_WAV) {
|
||||
if(type == UMUSIC_WAV)
|
||||
{
|
||||
if(memcmp(sig, "RIFF", 4) == 0 && memcmp(&sig[8], "WAVE", 4) == 0)
|
||||
return UMUSIC_WAV;
|
||||
return -1;
|
||||
|
@ -156,7 +167,8 @@ _retry:
|
|||
|
||||
FS_fseek(f, ofs + 44, SEEK_SET);
|
||||
FS_fread(sig, 4, 1, f);
|
||||
if (type == UMUSIC_S3M) {
|
||||
if(type == UMUSIC_S3M)
|
||||
{
|
||||
if(memcmp(sig, "SCRM", 4) == 0)
|
||||
return UMUSIC_S3M;
|
||||
/*return -1;*/
|
||||
|
@ -168,7 +180,8 @@ _retry:
|
|||
|
||||
FS_fseek(f, ofs + 1080, SEEK_SET);
|
||||
FS_fread(sig, 4, 1, f);
|
||||
if (type == UMUSIC_MOD) {
|
||||
if(type == UMUSIC_MOD)
|
||||
{
|
||||
if(memcmp(sig, "M.K.", 4) == 0 || memcmp(sig, "M!K!", 4) == 0)
|
||||
return UMUSIC_MOD;
|
||||
return -1;
|
||||
|
@ -207,14 +220,18 @@ static int32_t read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
|
|||
|
||||
if(idx >= hdr->name_count) return -1;
|
||||
buf[63] = '\0';
|
||||
for (i = 0, l = 0; i <= idx; i++) {
|
||||
for(i = 0, l = 0; i <= idx; i++)
|
||||
{
|
||||
FS_fseek(f, hdr->name_offset + l, SEEK_SET);
|
||||
FS_fread(buf, 1, 63, f);
|
||||
if (hdr->file_version >= 64) {
|
||||
if(hdr->file_version >= 64)
|
||||
{
|
||||
s = *(int8_t *)buf; /* numchars *including* terminator */
|
||||
if(s <= 0 || s > 64) return -1;
|
||||
l += s + 5; /* 1 for buf[0], 4 for int32_t name_flags */
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
l += (long)strlen(buf);
|
||||
l += 5; /* 1 for terminator, 4 for int32_t name_flags */
|
||||
}
|
||||
|
@ -259,8 +276,10 @@ static int32_t probe_umx (fshandle_t *f, const struct upkg_hdr *hdr,
|
|||
if(s <= 0 || s > fsiz - pos) return -1;
|
||||
|
||||
if(read_typname(f, hdr, t, buf) < 0) return -1;
|
||||
for (i = 0; mustype[i] != NULL; i++) {
|
||||
if (!q_strcasecmp(buf, mustype[i])) {
|
||||
for(i = 0; mustype[i] != NULL; i++)
|
||||
{
|
||||
if(!q_strcasecmp(buf, mustype[i]))
|
||||
{
|
||||
t = i;
|
||||
break;
|
||||
}
|
||||
|
@ -283,12 +302,14 @@ static int32_t probe_header (void *header)
|
|||
/* byte swap the header - all members are 32 bit LE values */
|
||||
p = (uint8_t *) header;
|
||||
swp = (uint32_t *) header;
|
||||
for (i = 0; i < UPKG_HDR_SIZE/4; i++, p += 4) {
|
||||
for(i = 0; i < UPKG_HDR_SIZE / 4; i++, p += 4)
|
||||
{
|
||||
swp[i] = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
|
||||
}
|
||||
|
||||
hdr = (struct upkg_hdr *) header;
|
||||
if (hdr->tag != UPKG_HDR_TAG) {
|
||||
if(hdr->tag != UPKG_HDR_TAG)
|
||||
{
|
||||
Con_DPrintf("Unknown header tag 0x%x\n", hdr->tag);
|
||||
return -1;
|
||||
}
|
||||
|
@ -297,14 +318,18 @@ static int32_t probe_header (void *header)
|
|||
hdr->export_count < 0 ||
|
||||
hdr->export_offset < 0 ||
|
||||
hdr->import_count < 0 ||
|
||||
hdr->import_offset < 0 ) {
|
||||
hdr->import_offset < 0)
|
||||
{
|
||||
Con_DPrintf("Negative values in header\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (hdr->file_version) {
|
||||
case 35: case 37: /* Unreal beta - */
|
||||
case 40: case 41: /* 1998 */
|
||||
switch(hdr->file_version)
|
||||
{
|
||||
case 35:
|
||||
case 37: /* Unreal beta - */
|
||||
case 40:
|
||||
case 41: /* 1998 */
|
||||
case 61:/* Unreal */
|
||||
case 62:/* Unreal Tournament */
|
||||
case 63:/* Return to NaPali */
|
||||
|
@ -349,7 +374,8 @@ static bool S_UMX_CodecOpenStream (snd_stream_t *stream)
|
|||
int32_t ofs = 0, size = 0;
|
||||
|
||||
type = process_upkg(&stream->fh, &ofs, &size);
|
||||
if (type < 0) {
|
||||
if(type < 0)
|
||||
{
|
||||
Con_DPrintf("%s: unrecognized umx\n", stream->name);
|
||||
return false;
|
||||
}
|
||||
|
@ -361,13 +387,17 @@ static bool S_UMX_CodecOpenStream (snd_stream_t *stream)
|
|||
stream->fh.length = size;
|
||||
FS_fseek(&stream->fh, 0, SEEK_SET);
|
||||
|
||||
switch (type) {
|
||||
switch(type)
|
||||
{
|
||||
case UMUSIC_IT:
|
||||
case UMUSIC_S3M:
|
||||
case UMUSIC_XM:
|
||||
case UMUSIC_MOD: return S_CodecForwardStream(stream, CODECTYPE_MOD);
|
||||
case UMUSIC_WAV: return S_CodecForwardStream(stream, CODECTYPE_WAV);
|
||||
case UMUSIC_MP2: return S_CodecForwardStream(stream, CODECTYPE_MP3);
|
||||
case UMUSIC_MOD:
|
||||
return S_CodecForwardStream(stream, CODECTYPE_MOD);
|
||||
case UMUSIC_WAV:
|
||||
return S_CodecForwardStream(stream, CODECTYPE_WAV);
|
||||
case UMUSIC_MP2:
|
||||
return S_CodecForwardStream(stream, CODECTYPE_MP3);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -139,7 +139,8 @@ static int32_t S_VORBIS_CodecReadStream (snd_stream_t *stream, int32_t bytes, vo
|
|||
int32_t cnt, res, rem;
|
||||
char * ptr;
|
||||
|
||||
cnt = 0; rem = bytes;
|
||||
cnt = 0;
|
||||
rem = bytes;
|
||||
ptr = (char *) buffer;
|
||||
while(1)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,8 @@ typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
|
|||
#endif
|
||||
|
||||
// TODO: shorten these?
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
int32_t type;
|
||||
|
@ -90,23 +91,27 @@ typedef struct {
|
|||
#define SPR_ORIENTED 3
|
||||
#define SPR_VP_PARALLEL_ORIENTED 4
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t origin[2];
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
} dspriteframe_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int32_t numframes;
|
||||
} dspritegroup_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} dspriteinterval_t;
|
||||
|
||||
typedef enum { SPR_SINGLE = 0, SPR_GROUP } spriteframetype_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
spriteframetype_t type;
|
||||
} dspriteframetype_t;
|
||||
|
||||
|
|
|
@ -254,16 +254,20 @@ static void stbiw__putc(stbi__write_context *s, uint8_t c)
|
|||
*/
|
||||
|
||||
static const uint8_t stbiw__jpg_ZigZag[] = { 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18,
|
||||
24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 };
|
||||
24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63
|
||||
};
|
||||
|
||||
static void stbiw__jpg_writeBits(stbi__write_context *s, int32_t *bitBufP, int32_t *bitCntP, const uint16_t *bs) {
|
||||
static void stbiw__jpg_writeBits(stbi__write_context *s, int32_t *bitBufP, int32_t *bitCntP, const uint16_t *bs)
|
||||
{
|
||||
int32_t bitBuf = *bitBufP, bitCnt = *bitCntP;
|
||||
bitCnt += bs[1];
|
||||
bitBuf |= bs[0] << (24 - bitCnt);
|
||||
while(bitCnt >= 8) {
|
||||
while(bitCnt >= 8)
|
||||
{
|
||||
uint8_t c = (bitBuf >> 16) & 255;
|
||||
stbiw__putc(s, c);
|
||||
if(c == 255) {
|
||||
if(c == 255)
|
||||
{
|
||||
stbiw__putc(s, 0);
|
||||
}
|
||||
bitBuf <<= 8;
|
||||
|
@ -273,7 +277,8 @@ static void stbiw__jpg_writeBits(stbi__write_context *s, int32_t *bitBufP, int32
|
|||
*bitCntP = bitCnt;
|
||||
}
|
||||
|
||||
static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) {
|
||||
static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p)
|
||||
{
|
||||
float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p;
|
||||
float z1, z2, z3, z4, z5, z11, z13;
|
||||
|
||||
|
@ -318,20 +323,26 @@ static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float
|
|||
*d1p = z11 + z4;
|
||||
*d7p = z11 - z4;
|
||||
|
||||
*d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6;
|
||||
*d0p = d0;
|
||||
*d2p = d2;
|
||||
*d4p = d4;
|
||||
*d6p = d6;
|
||||
}
|
||||
|
||||
static void stbiw__jpg_calcBits(int32_t val, uint16_t bits[2]) {
|
||||
static void stbiw__jpg_calcBits(int32_t val, uint16_t bits[2])
|
||||
{
|
||||
int32_t tmp1 = val < 0 ? -val : val;
|
||||
val = val < 0 ? val - 1 : val;
|
||||
bits[1] = 1;
|
||||
while(tmp1 >>= 1) {
|
||||
while(tmp1 >>= 1)
|
||||
{
|
||||
++bits[1];
|
||||
}
|
||||
bits[0] = val & ((1 << bits[1]) - 1);
|
||||
}
|
||||
|
||||
static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int32_t *bitCnt, float *CDU, float *fdtbl, int32_t DC, const uint16_t HTDC[256][2], const uint16_t HTAC[256][2]) {
|
||||
static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int32_t *bitCnt, float *CDU, float *fdtbl, int32_t DC, const uint16_t HTDC[256][2], const uint16_t HTAC[256][2])
|
||||
{
|
||||
uint16_t EOB[2];
|
||||
uint16_t M16zeroes[2];
|
||||
int32_t dataOff, i, diff, end0pos;
|
||||
|
@ -343,15 +354,18 @@ static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int
|
|||
M16zeroes[1] = HTAC[0xF0][1];
|
||||
|
||||
// DCT rows
|
||||
for(dataOff=0; dataOff<64; dataOff+=8) {
|
||||
for(dataOff = 0; dataOff < 64; dataOff += 8)
|
||||
{
|
||||
stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff + 1], &CDU[dataOff + 2], &CDU[dataOff + 3], &CDU[dataOff + 4], &CDU[dataOff + 5], &CDU[dataOff + 6], &CDU[dataOff + 7]);
|
||||
}
|
||||
// DCT columns
|
||||
for(dataOff=0; dataOff<8; ++dataOff) {
|
||||
for(dataOff = 0; dataOff < 8; ++dataOff)
|
||||
{
|
||||
stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff + 8], &CDU[dataOff + 16], &CDU[dataOff + 24], &CDU[dataOff + 32], &CDU[dataOff + 40], &CDU[dataOff + 48], &CDU[dataOff + 56]);
|
||||
}
|
||||
// Quantize/descale/zigzag the coefficients
|
||||
for(i=0; i<64; ++i) {
|
||||
for(i = 0; i < 64; ++i)
|
||||
{
|
||||
float v = CDU[i] * fdtbl[i];
|
||||
// DU[stbiw__jpg_ZigZag[i]] = (int32_t)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f));
|
||||
// ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway?
|
||||
|
@ -360,9 +374,12 @@ static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int
|
|||
|
||||
// Encode DC
|
||||
diff = DU[0] - DC;
|
||||
if (diff == 0) {
|
||||
if(diff == 0)
|
||||
{
|
||||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t bits[2];
|
||||
stbiw__jpg_calcBits(diff, bits);
|
||||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]);
|
||||
|
@ -370,21 +387,26 @@ static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int
|
|||
}
|
||||
// Encode ACs
|
||||
end0pos = 63;
|
||||
for(; (end0pos>0)&&(DU[end0pos]==0); --end0pos) {
|
||||
for(; (end0pos > 0) && (DU[end0pos] == 0); --end0pos)
|
||||
{
|
||||
}
|
||||
// end0pos = first element in reverse order !=0
|
||||
if(end0pos == 0) {
|
||||
if(end0pos == 0)
|
||||
{
|
||||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
|
||||
return DU[0];
|
||||
}
|
||||
for(i = 1; i <= end0pos; ++i) {
|
||||
for(i = 1; i <= end0pos; ++i)
|
||||
{
|
||||
int32_t startpos = i;
|
||||
int32_t nrzeroes;
|
||||
uint16_t bits[2];
|
||||
for (; DU[i]==0 && i<=end0pos; ++i) {
|
||||
for(; DU[i] == 0 && i <= end0pos; ++i)
|
||||
{
|
||||
}
|
||||
nrzeroes = i - startpos;
|
||||
if ( nrzeroes >= 16 ) {
|
||||
if(nrzeroes >= 16)
|
||||
{
|
||||
int32_t lng = nrzeroes >> 4;
|
||||
int32_t nrmarker;
|
||||
for(nrmarker = 1; nrmarker <= lng; ++nrmarker)
|
||||
|
@ -395,18 +417,21 @@ static int32_t stbiw__jpg_processDU(stbi__write_context *s, int32_t *bitBuf, int
|
|||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes << 4) + bits[1]]);
|
||||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
|
||||
}
|
||||
if(end0pos != 63) {
|
||||
if(end0pos != 63)
|
||||
{
|
||||
stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
|
||||
}
|
||||
return DU[0];
|
||||
}
|
||||
|
||||
static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_t height, int32_t comp, const void* data, int32_t quality) {
|
||||
static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_t height, int32_t comp, const void* data, int32_t quality)
|
||||
{
|
||||
// Constants that don't pollute global namespace
|
||||
static const uint8_t std_dc_luminance_nrcodes[] = {0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint8_t std_dc_luminance_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
|
||||
static const uint8_t std_ac_luminance_nrcodes[] = {0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d};
|
||||
static const uint8_t std_ac_luminance_values[] = {
|
||||
static const uint8_t std_ac_luminance_values[] =
|
||||
{
|
||||
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
|
@ -418,7 +443,8 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
static const uint8_t std_dc_chrominance_nrcodes[] = {0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
|
||||
static const uint8_t std_dc_chrominance_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
|
||||
static const uint8_t std_ac_chrominance_nrcodes[] = {0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77};
|
||||
static const uint8_t std_ac_chrominance_values[] = {
|
||||
static const uint8_t std_ac_chrominance_values[] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
|
@ -430,7 +456,8 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
// Huffman tables
|
||||
static const uint16_t YDC_HT[256][2] = { {0, 2}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {6, 3}, {14, 4}, {30, 5}, {62, 6}, {126, 7}, {254, 8}, {510, 9}};
|
||||
static const uint16_t UVDC_HT[256][2] = { {0, 2}, {1, 2}, {2, 2}, {6, 3}, {14, 4}, {30, 5}, {62, 6}, {126, 7}, {254, 8}, {510, 9}, {1022, 10}, {2046, 11}};
|
||||
static const uint16_t YAC_HT[256][2] = {
|
||||
static const uint16_t YAC_HT[256][2] =
|
||||
{
|
||||
{10, 4}, {0, 2}, {1, 2}, {4, 3}, {11, 4}, {26, 5}, {120, 7}, {248, 8}, {1014, 10}, {65410, 16}, {65411, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
{12, 4}, {27, 5}, {121, 7}, {502, 9}, {2038, 11}, {65412, 16}, {65413, 16}, {65414, 16}, {65415, 16}, {65416, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
{28, 5}, {249, 8}, {1015, 10}, {4084, 12}, {65417, 16}, {65418, 16}, {65419, 16}, {65420, 16}, {65421, 16}, {65422, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
|
@ -448,7 +475,8 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
{65515, 16}, {65516, 16}, {65517, 16}, {65518, 16}, {65519, 16}, {65520, 16}, {65521, 16}, {65522, 16}, {65523, 16}, {65524, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
{2041, 11}, {65525, 16}, {65526, 16}, {65527, 16}, {65528, 16}, {65529, 16}, {65530, 16}, {65531, 16}, {65532, 16}, {65533, 16}, {65534, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}
|
||||
};
|
||||
static const uint16_t UVAC_HT[256][2] = {
|
||||
static const uint16_t UVAC_HT[256][2] =
|
||||
{
|
||||
{0, 2}, {1, 2}, {4, 3}, {10, 4}, {24, 5}, {25, 5}, {56, 6}, {120, 7}, {500, 9}, {1014, 10}, {4084, 12}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
{11, 4}, {57, 6}, {246, 8}, {501, 9}, {2038, 11}, {4085, 12}, {65416, 16}, {65417, 16}, {65418, 16}, {65419, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
{26, 5}, {247, 8}, {1015, 10}, {4086, 12}, {32706, 15}, {65420, 16}, {65421, 16}, {65422, 16}, {65423, 16}, {65424, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
|
||||
|
@ -467,17 +495,21 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
{1018, 10}, {32707, 15}, {65526, 16}, {65527, 16}, {65528, 16}, {65529, 16}, {65530, 16}, {65531, 16}, {65532, 16}, {65533, 16}, {65534, 16}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}
|
||||
};
|
||||
static const int32_t YQT[] = {16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22,
|
||||
37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99};
|
||||
37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99
|
||||
};
|
||||
static const int32_t UVQT[] = {17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99,
|
||||
99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99};
|
||||
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f,
|
||||
1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f };
|
||||
1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f
|
||||
};
|
||||
|
||||
int32_t row, col, i, k;
|
||||
float fdtbl_Y[64], fdtbl_UV[64];
|
||||
uint8_t YTable[64], UVTable[64];
|
||||
|
||||
if(!data || !width || !height || comp > 4 || comp < 1) {
|
||||
if(!data || !width || !height || comp > 4 || comp < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -485,15 +517,18 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
quality = quality < 1 ? 1 : quality > 100 ? 100 : quality;
|
||||
quality = quality < 50 ? 5000 / quality : 200 - quality * 2;
|
||||
|
||||
for(i = 0; i < 64; ++i) {
|
||||
for(i = 0; i < 64; ++i)
|
||||
{
|
||||
int32_t uvti, yti = (YQT[i] * quality + 50) / 100;
|
||||
YTable[stbiw__jpg_ZigZag[i]] = (uint8_t)(yti < 1 ? 1 : yti > 255 ? 255 : yti);
|
||||
uvti = (UVQT[i] * quality + 50) / 100;
|
||||
UVTable[stbiw__jpg_ZigZag[i]] = (uint8_t)(uvti < 1 ? 1 : uvti > 255 ? 255 : uvti);
|
||||
}
|
||||
|
||||
for(row = 0, k = 0; row < 8; ++row) {
|
||||
for(col = 0; col < 8; ++col, ++k) {
|
||||
for(row = 0, k = 0; row < 8; ++row)
|
||||
{
|
||||
for(col = 0; col < 8; ++col, ++k)
|
||||
{
|
||||
fdtbl_Y[k] = 1 / (YTable [stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]);
|
||||
fdtbl_UV[k] = 1 / (UVTable[stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]);
|
||||
}
|
||||
|
@ -504,7 +539,8 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
static const uint8_t head0[] = { 0xFF, 0xD8, 0xFF, 0xE0, 0, 0x10, 'J', 'F', 'I', 'F', 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0xFF, 0xDB, 0, 0x84, 0 };
|
||||
static const uint8_t head2[] = { 0xFF, 0xDA, 0, 0xC, 3, 1, 0, 2, 0x11, 3, 0x11, 0, 0x3F, 0 };
|
||||
uint8_t head1[] = { 0xFF, 0xC0, 0, 0x11, 8, /*[5]*/0,/*[6]*/0,/*[7]*/0,/*[8]*/0,
|
||||
3,1,0x11,0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 };
|
||||
3, 1, 0x11, 0, 2, 0x11, 1, 3, 0x11, 1, 0xFF, 0xC4, 0x01, 0xA2, 0
|
||||
};
|
||||
head1[5] = (uint8_t)(height >> 8);
|
||||
head1[6] = STBIW_UCHAR(height);
|
||||
head1[7] = (uint8_t)(width >> 8);
|
||||
|
@ -537,17 +573,23 @@ static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_
|
|||
// comp == 2 is grey+alpha (alpha is ignored)
|
||||
int32_t ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0;
|
||||
int32_t x, y, pos;
|
||||
for(y = 0; y < height; y += 8) {
|
||||
for(x = 0; x < width; x += 8) {
|
||||
for(y = 0; y < height; y += 8)
|
||||
{
|
||||
for(x = 0; x < width; x += 8)
|
||||
{
|
||||
float YDU[64], UDU[64], VDU[64];
|
||||
for(row = y, pos = 0; row < y+8; ++row) {
|
||||
for(col = x; col < x+8; ++col, ++pos) {
|
||||
for(row = y, pos = 0; row < y + 8; ++row)
|
||||
{
|
||||
for(col = x; col < x + 8; ++col, ++pos)
|
||||
{
|
||||
int32_t p = row * width * comp + col * comp;
|
||||
float r, g, b;
|
||||
if(row >= height) {
|
||||
if(row >= height)
|
||||
{
|
||||
p -= width * comp * (row + 1 - height);
|
||||
}
|
||||
if(col >= width) {
|
||||
if(col >= width)
|
||||
{
|
||||
p -= comp * (col + 1 - width);
|
||||
}
|
||||
|
||||
|
@ -591,11 +633,13 @@ STBIWDEF int32_t stbi_write_jpg_to_func(stbi_write_func *func, void *context, in
|
|||
STBIWDEF int32_t stbi_write_jpg(char const *filename, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality)
|
||||
{
|
||||
stbi__write_context s;
|
||||
if (stbi__start_write_file(&s,filename)) {
|
||||
if(stbi__start_write_file(&s, filename))
|
||||
{
|
||||
int32_t r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
|
||||
stbi__end_write_file(&s);
|
||||
return r;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,8 +45,10 @@ q_strlcat (char *dst, const char *src, size_t siz)
|
|||
|
||||
if(n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
while(*s != '\0')
|
||||
{
|
||||
if(n != 1)
|
||||
{
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,18 @@ q_strlcpy (char *dst, const char *src, size_t siz)
|
|||
size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0) {
|
||||
while (--n != 0) {
|
||||
if(n != 0)
|
||||
{
|
||||
while(--n != 0)
|
||||
{
|
||||
if((*d++ = *s++) == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if(n == 0)
|
||||
{
|
||||
if(siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while(*s++)
|
||||
|
|
|
@ -492,7 +492,8 @@ void SV_AddToFatPVS (vec3_t org, mnode_t *node, qmodel_t *worldmodel) //johnfitz
|
|||
else if(d < -8)
|
||||
node = node->children[1];
|
||||
else
|
||||
{ // go down both
|
||||
{
|
||||
// go down both
|
||||
SV_AddToFatPVS(org, node->children[0], worldmodel); //johnfitz -- worldmodel as a parameter
|
||||
node = node->children[1];
|
||||
}
|
||||
|
|
|
@ -196,7 +196,8 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink)
|
|||
if(!SV_CheckBottom(ent))
|
||||
{
|
||||
if((int32_t)ent->v.flags & FL_PARTIALGROUND)
|
||||
{ // entity had floor mostly pulled out from underneath it
|
||||
{
|
||||
// entity had floor mostly pulled out from underneath it
|
||||
// and is trying to correct
|
||||
if(relink)
|
||||
SV_LinkEdict(ent, true);
|
||||
|
@ -250,7 +251,8 @@ bool SV_StepDirection (edict_t *ent, float yaw, float dist)
|
|||
{
|
||||
delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
|
||||
if(delta > 45 && delta < 315)
|
||||
{ // not turned far enough, so don't take the step
|
||||
{
|
||||
// not turned far enough, so don't take the step
|
||||
VectorCopy(oldorigin, ent->v.origin);
|
||||
}
|
||||
SV_LinkEdict(ent, true);
|
||||
|
|
|
@ -275,13 +275,15 @@ int32_t SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
|||
trace = SV_Move(ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent);
|
||||
|
||||
if(trace.allsolid)
|
||||
{ // entity is trapped in another solid
|
||||
{
|
||||
// entity is trapped in another solid
|
||||
VectorCopy(vec3_origin, ent->v.velocity);
|
||||
return 3;
|
||||
}
|
||||
|
||||
if(trace.fraction > 0)
|
||||
{ // actually covered some distance
|
||||
{
|
||||
// actually covered some distance
|
||||
VectorCopy(trace.endpos, ent->v.origin);
|
||||
VectorCopy(ent->v.velocity, original_velocity);
|
||||
numplanes = 0;
|
||||
|
@ -321,7 +323,8 @@ int32_t SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
|||
|
||||
// cliped to another plane
|
||||
if(numplanes >= MAX_CLIP_PLANES)
|
||||
{ // this shouldn't really happen
|
||||
{
|
||||
// this shouldn't really happen
|
||||
VectorCopy(vec3_origin, ent->v.velocity);
|
||||
return 3;
|
||||
}
|
||||
|
@ -346,11 +349,13 @@ int32_t SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
|||
}
|
||||
|
||||
if(i != numplanes)
|
||||
{ // go along this plane
|
||||
{
|
||||
// go along this plane
|
||||
VectorCopy(new_velocity, ent->v.velocity);
|
||||
}
|
||||
else
|
||||
{ // go along the crease
|
||||
{
|
||||
// go along the crease
|
||||
if(numplanes != 2)
|
||||
{
|
||||
// Con_Printf ("clip velocity, numplanes == %" PRIi32 "\n",numplanes);
|
||||
|
@ -527,11 +532,13 @@ void SV_PushMove (edict_t *pusher, float movetime)
|
|||
// if it is still inside the pusher, block
|
||||
block = SV_TestEntityPosition(check);
|
||||
if(block)
|
||||
{ // fail the move
|
||||
{
|
||||
// fail the move
|
||||
if(check->v.mins[0] == check->v.maxs[0])
|
||||
continue;
|
||||
if(check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
|
||||
{ // corpse
|
||||
{
|
||||
// corpse
|
||||
check->v.mins[0] = check->v.mins[1] = 0;
|
||||
VectorCopy(check->v.mins, check->v.maxs);
|
||||
continue;
|
||||
|
@ -760,14 +767,38 @@ int32_t SV_TryUnstick (edict_t *ent, vec3_t oldvel)
|
|||
// try pushing a little in an axial direction
|
||||
switch(i)
|
||||
{
|
||||
case 0: dir[0] = 2; dir[1] = 0; break;
|
||||
case 1: dir[0] = 0; dir[1] = 2; break;
|
||||
case 2: dir[0] = -2; dir[1] = 0; break;
|
||||
case 3: dir[0] = 0; dir[1] = -2; break;
|
||||
case 4: dir[0] = 2; dir[1] = 2; break;
|
||||
case 5: dir[0] = -2; dir[1] = 2; break;
|
||||
case 6: dir[0] = 2; dir[1] = -2; break;
|
||||
case 7: dir[0] = -2; dir[1] = -2; break;
|
||||
case 0:
|
||||
dir[0] = 2;
|
||||
dir[1] = 0;
|
||||
break;
|
||||
case 1:
|
||||
dir[0] = 0;
|
||||
dir[1] = 2;
|
||||
break;
|
||||
case 2:
|
||||
dir[0] = -2;
|
||||
dir[1] = 0;
|
||||
break;
|
||||
case 3:
|
||||
dir[0] = 0;
|
||||
dir[1] = -2;
|
||||
break;
|
||||
case 4:
|
||||
dir[0] = 2;
|
||||
dir[1] = 2;
|
||||
break;
|
||||
case 5:
|
||||
dir[0] = -2;
|
||||
dir[1] = 2;
|
||||
break;
|
||||
case 6:
|
||||
dir[0] = 2;
|
||||
dir[1] = -2;
|
||||
break;
|
||||
case 7:
|
||||
dir[0] = -2;
|
||||
dir[1] = -2;
|
||||
break;
|
||||
}
|
||||
|
||||
SV_PushEntity(ent, dir);
|
||||
|
@ -864,7 +895,8 @@ void SV_WalkMove (edict_t *ent)
|
|||
{
|
||||
if(fabs(oldorg[1] - ent->v.origin[1]) < 0.03125
|
||||
&& fabs(oldorg[0] - ent->v.origin[0]) < 0.03125)
|
||||
{ // stepping up didn't make any progress
|
||||
{
|
||||
// stepping up didn't make any progress
|
||||
clip = SV_TryUnstick(ent, oldvel);
|
||||
}
|
||||
}
|
||||
|
@ -1024,7 +1056,8 @@ void SV_CheckWaterTransition (edict_t *ent)
|
|||
cont = SV_PointContents(ent->v.origin);
|
||||
|
||||
if(!ent->v.watertype)
|
||||
{ // just spawned here
|
||||
{
|
||||
// just spawned here
|
||||
ent->v.watertype = cont;
|
||||
ent->v.waterlevel = 1;
|
||||
return;
|
||||
|
@ -1033,7 +1066,8 @@ void SV_CheckWaterTransition (edict_t *ent)
|
|||
if(cont <= CONTENTS_WATER)
|
||||
{
|
||||
if(ent->v.watertype == CONTENTS_EMPTY)
|
||||
{ // just crossed into water
|
||||
{
|
||||
// just crossed into water
|
||||
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||
}
|
||||
ent->v.watertype = cont;
|
||||
|
@ -1042,7 +1076,8 @@ void SV_CheckWaterTransition (edict_t *ent)
|
|||
else
|
||||
{
|
||||
if(ent->v.watertype != CONTENTS_EMPTY)
|
||||
{ // just crossed into water
|
||||
{
|
||||
// just crossed into water
|
||||
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||
}
|
||||
ent->v.watertype = CONTENTS_EMPTY;
|
||||
|
|
|
@ -355,7 +355,8 @@ void SV_AirMove (void)
|
|||
}
|
||||
|
||||
if(sv_player->v.movetype == MOVETYPE_NOCLIP)
|
||||
{ // noclip
|
||||
{
|
||||
// noclip
|
||||
VectorCopy(wishvel, velocity);
|
||||
}
|
||||
else if(onground)
|
||||
|
@ -364,7 +365,8 @@ void SV_AirMove (void)
|
|||
SV_Accelerate(wishspeed, wishdir);
|
||||
}
|
||||
else
|
||||
{ // not on ground, so little effect on velocity
|
||||
{
|
||||
// not on ground, so little effect on velocity
|
||||
SV_AirAccelerate(wishspeed, wishvel);
|
||||
}
|
||||
}
|
||||
|
@ -584,7 +586,8 @@ nextmsg:
|
|||
break;
|
||||
}
|
||||
}
|
||||
} while (ret == 1);
|
||||
}
|
||||
while(ret == 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
net_driver_t net_drivers[] =
|
||||
{
|
||||
{ "Loopback",
|
||||
{
|
||||
"Loopback",
|
||||
false,
|
||||
Loop_Init,
|
||||
Loop_Listen,
|
||||
|
@ -46,7 +47,8 @@ net_driver_t net_drivers[] =
|
|||
Loop_Shutdown
|
||||
},
|
||||
|
||||
{ "Datagram",
|
||||
{
|
||||
"Datagram",
|
||||
false,
|
||||
Datagram_Init,
|
||||
Datagram_Listen,
|
||||
|
@ -69,7 +71,8 @@ const int32_t net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0]));
|
|||
|
||||
net_landriver_t net_landrivers[] =
|
||||
{
|
||||
{ "UDP",
|
||||
{
|
||||
"UDP",
|
||||
false,
|
||||
0,
|
||||
UDP_Init,
|
||||
|
|
|
@ -271,7 +271,8 @@ static char const *Sys_GetUserDir(void)
|
|||
|
||||
#ifdef PLATFORM_OSX
|
||||
static char *OSX_StripAppBundle(char *dir)
|
||||
{ /* based on the ioquake3 project at icculus.org. */
|
||||
{
|
||||
/* based on the ioquake3 project at icculus.org. */
|
||||
static char osx_path[MAX_OSPATH];
|
||||
|
||||
q_strlcpy(osx_path, dir, sizeof(osx_path));
|
||||
|
@ -295,7 +296,8 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
|
|||
{
|
||||
perror("realpath");
|
||||
if(getcwd(dst, dstsize - 1) == NULL)
|
||||
_fail: Sys_Error ("Couldn't determine current directory");
|
||||
_fail:
|
||||
Sys_Error("Couldn't determine current directory");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -433,7 +433,8 @@ void V_CalcBlend (void)
|
|||
{
|
||||
float r, g, b, a, a2;
|
||||
int32_t j;
|
||||
cvar_t *cshiftpercent_cvars[NUM_CSHIFTS] = {
|
||||
cvar_t *cshiftpercent_cvars[NUM_CSHIFTS] =
|
||||
{
|
||||
&gl_cshiftpercent_contents,
|
||||
&gl_cshiftpercent_damage,
|
||||
&gl_cshiftpercent_bonus,
|
||||
|
|
|
@ -30,7 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
net_driver_t net_drivers[] =
|
||||
{
|
||||
{ "Loopback",
|
||||
{
|
||||
"Loopback",
|
||||
false,
|
||||
Loop_Init,
|
||||
Loop_Listen,
|
||||
|
@ -46,7 +47,8 @@ net_driver_t net_drivers[] =
|
|||
Loop_Shutdown
|
||||
},
|
||||
|
||||
{ "Datagram",
|
||||
{
|
||||
"Datagram",
|
||||
false,
|
||||
Datagram_Init,
|
||||
Datagram_Listen,
|
||||
|
@ -71,7 +73,8 @@ const int32_t net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0]));
|
|||
|
||||
net_landriver_t net_landrivers[] =
|
||||
{
|
||||
{ "Winsock TCPIP",
|
||||
{
|
||||
"Winsock TCPIP",
|
||||
false,
|
||||
0,
|
||||
WINS_Init,
|
||||
|
@ -94,7 +97,8 @@ net_landriver_t net_landrivers[] =
|
|||
WINS_SetSocketPort
|
||||
},
|
||||
|
||||
{ "Winsock IPX",
|
||||
{
|
||||
"Winsock IPX",
|
||||
false,
|
||||
0,
|
||||
WIPX_Init,
|
||||
|
|
|
@ -14,71 +14,134 @@ __wsaerr_static const char *__WSAE_StrError (int32_t err)
|
|||
{
|
||||
switch(err)
|
||||
{
|
||||
case 0: return "No error";
|
||||
case WSAEINTR: return "Interrupted system call"; /* 10004 */
|
||||
case WSAEBADF: return "Bad file number"; /* 10009 */
|
||||
case WSAEACCES: return "Permission denied"; /* 10013 */
|
||||
case WSAEFAULT: return "Bad address"; /* 10014 */
|
||||
case WSAEINVAL: return "Invalid argument (not bind)"; /* 10022 */
|
||||
case WSAEMFILE: return "Too many open files"; /* 10024 */
|
||||
case WSAEWOULDBLOCK: return "Operation would block"; /* 10035 */
|
||||
case WSAEINPROGRESS: return "Operation now in progress"; /* 10036 */
|
||||
case WSAEALREADY: return "Operation already in progress"; /* 10037 */
|
||||
case WSAENOTSOCK: return "Socket operation on non-socket"; /* 10038 */
|
||||
case WSAEDESTADDRREQ: return "Destination address required"; /* 10039 */
|
||||
case WSAEMSGSIZE: return "Message too long"; /* 10040 */
|
||||
case WSAEPROTOTYPE: return "Protocol wrong type for socket"; /* 10041 */
|
||||
case WSAENOPROTOOPT: return "Bad protocol option"; /* 10042 */
|
||||
case WSAEPROTONOSUPPORT: return "Protocol not supported"; /* 10043 */
|
||||
case WSAESOCKTNOSUPPORT: return "Socket type not supported"; /* 10044 */
|
||||
case WSAEOPNOTSUPP: return "Operation not supported on socket"; /* 10045 */
|
||||
case WSAEPFNOSUPPORT: return "Protocol family not supported"; /* 10046 */
|
||||
case WSAEAFNOSUPPORT: return "Address family not supported by protocol family"; /* 10047 */
|
||||
case WSAEADDRINUSE: return "Address already in use"; /* 10048 */
|
||||
case WSAEADDRNOTAVAIL: return "Can't assign requested address"; /* 10049 */
|
||||
case WSAENETDOWN: return "Network is down"; /* 10050 */
|
||||
case WSAENETUNREACH: return "Network is unreachable"; /* 10051 */
|
||||
case WSAENETRESET: return "Net dropped connection or reset"; /* 10052 */
|
||||
case WSAECONNABORTED: return "Software caused connection abort"; /* 10053 */
|
||||
case WSAECONNRESET: return "Connection reset by peer"; /* 10054 */
|
||||
case WSAENOBUFS: return "No buffer space available"; /* 10055 */
|
||||
case WSAEISCONN: return "Socket is already connected"; /* 10056 */
|
||||
case WSAENOTCONN: return "Socket is not connected"; /* 10057 */
|
||||
case WSAESHUTDOWN: return "Can't send after socket shutdown"; /* 10058 */
|
||||
case WSAETOOMANYREFS: return "Too many references, can't splice"; /* 10059 */
|
||||
case WSAETIMEDOUT: return "Connection timed out"; /* 10060 */
|
||||
case WSAECONNREFUSED: return "Connection refused"; /* 10061 */
|
||||
case WSAELOOP: return "Too many levels of symbolic links"; /* 10062 */
|
||||
case WSAENAMETOOLONG: return "File name too long"; /* 10063 */
|
||||
case WSAEHOSTDOWN: return "Host is down"; /* 10064 */
|
||||
case WSAEHOSTUNREACH: return "No Route to Host"; /* 10065 */
|
||||
case WSAENOTEMPTY: return "Directory not empty"; /* 10066 */
|
||||
case WSAEPROCLIM: return "Too many processes"; /* 10067 */
|
||||
case WSAEUSERS: return "Too many users"; /* 10068 */
|
||||
case WSAEDQUOT: return "Disc Quota Exceeded"; /* 10069 */
|
||||
case WSAESTALE: return "Stale NFS file handle"; /* 10070 */
|
||||
case WSAEREMOTE: return "Too many levels of remote in path"; /* 10071 */
|
||||
case WSAEDISCON: return "Graceful shutdown in progress"; /* 10101 */
|
||||
case 0:
|
||||
return "No error";
|
||||
case WSAEINTR:
|
||||
return "Interrupted system call"; /* 10004 */
|
||||
case WSAEBADF:
|
||||
return "Bad file number"; /* 10009 */
|
||||
case WSAEACCES:
|
||||
return "Permission denied"; /* 10013 */
|
||||
case WSAEFAULT:
|
||||
return "Bad address"; /* 10014 */
|
||||
case WSAEINVAL:
|
||||
return "Invalid argument (not bind)"; /* 10022 */
|
||||
case WSAEMFILE:
|
||||
return "Too many open files"; /* 10024 */
|
||||
case WSAEWOULDBLOCK:
|
||||
return "Operation would block"; /* 10035 */
|
||||
case WSAEINPROGRESS:
|
||||
return "Operation now in progress"; /* 10036 */
|
||||
case WSAEALREADY:
|
||||
return "Operation already in progress"; /* 10037 */
|
||||
case WSAENOTSOCK:
|
||||
return "Socket operation on non-socket"; /* 10038 */
|
||||
case WSAEDESTADDRREQ:
|
||||
return "Destination address required"; /* 10039 */
|
||||
case WSAEMSGSIZE:
|
||||
return "Message too long"; /* 10040 */
|
||||
case WSAEPROTOTYPE:
|
||||
return "Protocol wrong type for socket"; /* 10041 */
|
||||
case WSAENOPROTOOPT:
|
||||
return "Bad protocol option"; /* 10042 */
|
||||
case WSAEPROTONOSUPPORT:
|
||||
return "Protocol not supported"; /* 10043 */
|
||||
case WSAESOCKTNOSUPPORT:
|
||||
return "Socket type not supported"; /* 10044 */
|
||||
case WSAEOPNOTSUPP:
|
||||
return "Operation not supported on socket"; /* 10045 */
|
||||
case WSAEPFNOSUPPORT:
|
||||
return "Protocol family not supported"; /* 10046 */
|
||||
case WSAEAFNOSUPPORT:
|
||||
return "Address family not supported by protocol family"; /* 10047 */
|
||||
case WSAEADDRINUSE:
|
||||
return "Address already in use"; /* 10048 */
|
||||
case WSAEADDRNOTAVAIL:
|
||||
return "Can't assign requested address"; /* 10049 */
|
||||
case WSAENETDOWN:
|
||||
return "Network is down"; /* 10050 */
|
||||
case WSAENETUNREACH:
|
||||
return "Network is unreachable"; /* 10051 */
|
||||
case WSAENETRESET:
|
||||
return "Net dropped connection or reset"; /* 10052 */
|
||||
case WSAECONNABORTED:
|
||||
return "Software caused connection abort"; /* 10053 */
|
||||
case WSAECONNRESET:
|
||||
return "Connection reset by peer"; /* 10054 */
|
||||
case WSAENOBUFS:
|
||||
return "No buffer space available"; /* 10055 */
|
||||
case WSAEISCONN:
|
||||
return "Socket is already connected"; /* 10056 */
|
||||
case WSAENOTCONN:
|
||||
return "Socket is not connected"; /* 10057 */
|
||||
case WSAESHUTDOWN:
|
||||
return "Can't send after socket shutdown"; /* 10058 */
|
||||
case WSAETOOMANYREFS:
|
||||
return "Too many references, can't splice"; /* 10059 */
|
||||
case WSAETIMEDOUT:
|
||||
return "Connection timed out"; /* 10060 */
|
||||
case WSAECONNREFUSED:
|
||||
return "Connection refused"; /* 10061 */
|
||||
case WSAELOOP:
|
||||
return "Too many levels of symbolic links"; /* 10062 */
|
||||
case WSAENAMETOOLONG:
|
||||
return "File name too long"; /* 10063 */
|
||||
case WSAEHOSTDOWN:
|
||||
return "Host is down"; /* 10064 */
|
||||
case WSAEHOSTUNREACH:
|
||||
return "No Route to Host"; /* 10065 */
|
||||
case WSAENOTEMPTY:
|
||||
return "Directory not empty"; /* 10066 */
|
||||
case WSAEPROCLIM:
|
||||
return "Too many processes"; /* 10067 */
|
||||
case WSAEUSERS:
|
||||
return "Too many users"; /* 10068 */
|
||||
case WSAEDQUOT:
|
||||
return "Disc Quota Exceeded"; /* 10069 */
|
||||
case WSAESTALE:
|
||||
return "Stale NFS file handle"; /* 10070 */
|
||||
case WSAEREMOTE:
|
||||
return "Too many levels of remote in path"; /* 10071 */
|
||||
case WSAEDISCON:
|
||||
return "Graceful shutdown in progress"; /* 10101 */
|
||||
|
||||
case WSASYSNOTREADY: return "Network SubSystem is unavailable"; /* 10091 */
|
||||
case WSAVERNOTSUPPORTED: return "WINSOCK DLL Version out of range"; /* 10092 */
|
||||
case WSANOTINITIALISED: return "Successful WSASTARTUP not yet performed"; /* 10093 */
|
||||
case WSAHOST_NOT_FOUND: return "Authoritative answer: Host not found"; /* 11001 */
|
||||
case WSATRY_AGAIN: return "Non-Authoritative: Host not found or SERVERFAIL"; /* 11002 */
|
||||
case WSANO_RECOVERY: return "Non-Recoverable errors, FORMERR, REFUSED, NOTIMP"; /* 11003 */
|
||||
case WSANO_DATA: return "Valid name, no data record of requested type"; /* 11004 */
|
||||
case WSASYSNOTREADY:
|
||||
return "Network SubSystem is unavailable"; /* 10091 */
|
||||
case WSAVERNOTSUPPORTED:
|
||||
return "WINSOCK DLL Version out of range"; /* 10092 */
|
||||
case WSANOTINITIALISED:
|
||||
return "Successful WSASTARTUP not yet performed"; /* 10093 */
|
||||
case WSAHOST_NOT_FOUND:
|
||||
return "Authoritative answer: Host not found"; /* 11001 */
|
||||
case WSATRY_AGAIN:
|
||||
return "Non-Authoritative: Host not found or SERVERFAIL"; /* 11002 */
|
||||
case WSANO_RECOVERY:
|
||||
return "Non-Recoverable errors, FORMERR, REFUSED, NOTIMP"; /* 11003 */
|
||||
case WSANO_DATA:
|
||||
return "Valid name, no data record of requested type"; /* 11004 */
|
||||
|
||||
case WSAENOMORE: return "10102: No more results"; /* 10102 */
|
||||
case WSAECANCELLED: return "10103: Call has been canceled"; /* 10103 */
|
||||
case WSAEINVALIDPROCTABLE: return "Procedure call table is invalid"; /* 10104 */
|
||||
case WSAEINVALIDPROVIDER: return "Service provider is invalid"; /* 10105 */
|
||||
case WSAEPROVIDERFAILEDINIT: return "Service provider failed to initialize"; /* 10106 */
|
||||
case WSASYSCALLFAILURE: return "System call failure"; /* 10107 */
|
||||
case WSASERVICE_NOT_FOUND: return "Service not found"; /* 10108 */
|
||||
case WSATYPE_NOT_FOUND: return "Class type not found"; /* 10109 */
|
||||
case WSA_E_NO_MORE: return "10110: No more results"; /* 10110 */
|
||||
case WSA_E_CANCELLED: return "10111: Call was canceled"; /* 10111 */
|
||||
case WSAEREFUSED: return "Database query was refused"; /* 10112 */
|
||||
case WSAENOMORE:
|
||||
return "10102: No more results"; /* 10102 */
|
||||
case WSAECANCELLED:
|
||||
return "10103: Call has been canceled"; /* 10103 */
|
||||
case WSAEINVALIDPROCTABLE:
|
||||
return "Procedure call table is invalid"; /* 10104 */
|
||||
case WSAEINVALIDPROVIDER:
|
||||
return "Service provider is invalid"; /* 10105 */
|
||||
case WSAEPROVIDERFAILEDINIT:
|
||||
return "Service provider failed to initialize"; /* 10106 */
|
||||
case WSASYSCALLFAILURE:
|
||||
return "System call failure"; /* 10107 */
|
||||
case WSASERVICE_NOT_FOUND:
|
||||
return "Service not found"; /* 10108 */
|
||||
case WSATYPE_NOT_FOUND:
|
||||
return "Class type not found"; /* 10109 */
|
||||
case WSA_E_NO_MORE:
|
||||
return "10110: No more results"; /* 10110 */
|
||||
case WSA_E_CANCELLED:
|
||||
return "10111: Call was canceled"; /* 10111 */
|
||||
case WSAEREFUSED:
|
||||
return "Database query was refused"; /* 10112 */
|
||||
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -138,7 +138,8 @@ hull_t *SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
|
||||
// decide which clipping hull to use, based on the size
|
||||
if(ent->v.solid == SOLID_BSP)
|
||||
{ // explicit hulls in the BSP model
|
||||
{
|
||||
// explicit hulls in the BSP model
|
||||
if(ent->v.movetype != MOVETYPE_PUSH)
|
||||
Host_Error("SOLID_BSP without MOVETYPE_PUSH (%s at %f %f %f)",
|
||||
PR_GetString(ent->v.classname), ent->v.origin[0], ent->v.origin[1], ent->v.origin[2]);
|
||||
|
@ -162,7 +163,8 @@ hull_t *SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
VectorAdd(offset, ent->v.origin, offset);
|
||||
}
|
||||
else
|
||||
{ // create a temp hull from bounding box sizes
|
||||
{
|
||||
// create a temp hull from bounding box sizes
|
||||
|
||||
VectorSubtract(ent->v.mins, maxs, hullmins);
|
||||
VectorSubtract(ent->v.maxs, mins, hullmaxs);
|
||||
|
@ -458,7 +460,8 @@ void SV_LinkEdict (edict_t *ent, bool touch_triggers)
|
|||
ent->v.absmax[1] += 15;
|
||||
}
|
||||
else
|
||||
{ // because movement is clipped an epsilon away from an actual edge,
|
||||
{
|
||||
// because movement is clipped an epsilon away from an actual edge,
|
||||
// we must fully check even when bounding boxes don't quite touch
|
||||
ent->v.absmin[0] -= 1;
|
||||
ent->v.absmin[1] -= 1;
|
||||
|
@ -715,7 +718,8 @@ bool SV_RecursiveHullCheck (hull_t *hull, int32_t num, float p1f, float p2f, vec
|
|||
|
||||
while(SV_HullPointContents(hull, hull->firstclipnode, mid)
|
||||
== CONTENTS_SOLID)
|
||||
{ // shouldn't really happen, but does occasionally
|
||||
{
|
||||
// shouldn't really happen, but does occasionally
|
||||
frac -= 0.1;
|
||||
if(frac < 0)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,8 @@ void Z_Free (void *ptr)
|
|||
|
||||
other = block->prev;
|
||||
if(!other->tag)
|
||||
{ // merge with previous free block
|
||||
{
|
||||
// merge with previous free block
|
||||
other->size += block->size;
|
||||
other->next = block->next;
|
||||
other->next->prev = other;
|
||||
|
@ -99,7 +100,8 @@ void Z_Free (void *ptr)
|
|||
|
||||
other = block->next;
|
||||
if(!other->tag)
|
||||
{ // merge the next free block onto the end
|
||||
{
|
||||
// merge the next free block onto the end
|
||||
block->size += other->size;
|
||||
block->next = other->next;
|
||||
block->next->prev = block;
|
||||
|
@ -136,14 +138,16 @@ static void *Z_TagMalloc (int32_t size, int32_t tag)
|
|||
base = rover = rover->next;
|
||||
else
|
||||
rover = rover->next;
|
||||
} while (base->tag || base->size < size);
|
||||
}
|
||||
while(base->tag || base->size < size);
|
||||
|
||||
//
|
||||
// found a block big enough
|
||||
//
|
||||
extra = base->size - size;
|
||||
if(extra > MINFRAGMENT)
|
||||
{ // there will be a free fragment after the allocated block
|
||||
{
|
||||
// there will be a free fragment after the allocated block
|
||||
newblock = (memblock_t *)((byte *)base + size);
|
||||
newblock->size = extra;
|
||||
newblock->tag = 0; // free block
|
||||
|
@ -747,7 +751,8 @@ cache_system_t *Cache_TryAlloc (int32_t size, bool nobottom)
|
|||
if(!nobottom || cs != cache_head.next)
|
||||
{
|
||||
if((byte *)cs - (byte *)new_cs >= size)
|
||||
{ // found space
|
||||
{
|
||||
// found space
|
||||
memset(new_cs, 0, sizeof(*new_cs));
|
||||
new_cs->size = size;
|
||||
|
||||
|
@ -766,7 +771,8 @@ cache_system_t *Cache_TryAlloc (int32_t size, bool nobottom)
|
|||
new_cs = (cache_system_t *)((byte *)cs + cs->size);
|
||||
cs = cs->next;
|
||||
|
||||
} while (cs != &cache_head);
|
||||
}
|
||||
while(cs != &cache_head);
|
||||
|
||||
// try to allocate one at the very end
|
||||
if(hunk_base + hunk_size - hunk_high_used - (byte *)new_cs >= size)
|
||||
|
|
Loading…
Reference in New Issue