Minor update...

Q3 clients can connect to q1 gamecode (sv_listen_q3).
hacked support for SendFlags. It'll work compatibly, just not efficiently.
Unified shared qc builtins.
fteqcc supports int |= float, more params in macros, &~= operator.
Additional recent DP QC extensions.
Particle system abstraction. 'r_particlesystem classic' (vs null or script) will revert to truly classic particles.
Nexuiz might run again.
Network address revamp (sv_port and sv_port_ipv6 can both be used to specify an ipv4 address:port and both corrently accept clients). localhost now properly favours ipv4 (use ::1 for ipv6 localhost).
Download system revamp.
Numerous other changes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3051 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-11-09 22:29:28 +00:00
parent bf8eed727e
commit dce284811e
145 changed files with 49415 additions and 18759 deletions

View File

@ -266,6 +266,9 @@ CLIENT_OBJS = $(CLIENT_ASM_OBJS) \
net_master.o \
r_bulleten.o \
r_part.o \
p_script.o \
p_null.o \
p_classic.o \
r_partset.o \
r_efrag.o \
renderer.o \

View File

@ -33,7 +33,8 @@ char *VMQ3_StringFromHandle(int handle);
int VMQ3_StringToHandle(char *str);
extern model_t mod_known[];
#define VM_FROMMHANDLE(a) (a?mod_known+a-1:NULL)
extern int mod_numknown;
#define VM_FROMMHANDLE(a) ((a&&((unsigned int)a)<=mod_numknown)?mod_known+a-1:NULL)
#define VM_TOMHANDLE(a) (a?a-mod_known+1:0)
extern shader_t r_shaders[];
@ -1031,13 +1032,13 @@ vec3_t listener_up;
break;
case CG_FTE_FINDPARTICLEEFFECT:
return P_FindParticleType(VM_POINTER(arg[0]));
return pe->FindParticleType(VM_POINTER(arg[0]));
case CG_FTE_SPAWNPARTICLEEFFECT:
return P_RunParticleEffectState(VM_POINTER(arg[0]), VM_POINTER(arg[1]), VM_FLOAT(arg[2]), VM_LONG(arg[3]), VM_POINTER(arg[4]));
return pe->RunParticleEffectState(VM_POINTER(arg[0]), VM_POINTER(arg[1]), VM_FLOAT(arg[2]), VM_LONG(arg[3]), VM_POINTER(arg[4]));
case CG_FTE_SPAWNPARTICLETRAIL:
return P_ParticleTrail(VM_POINTER(arg[0]), VM_POINTER(arg[1]), VM_LONG(arg[2]), VM_POINTER(arg[3]));
return pe->ParticleTrail(VM_POINTER(arg[0]), VM_POINTER(arg[1]), VM_LONG(arg[2]), VM_POINTER(arg[3]));
case CG_FTE_FREEPARTICLESTATE:
P_DelinkTrailstate(VM_POINTER(arg[0]));
pe->DelinkTrailstate(VM_POINTER(arg[0]));
break;
default:
Con_Printf("Q3CG: Bad system trap: %d\n", fn);

View File

@ -1155,7 +1155,7 @@ void CL_Record_f (void)
else
MSG_WriteByte (&buf, j);
MSG_WriteByte (&buf, ent->frame);
MSG_WriteByte (&buf, ent->frame1);
MSG_WriteByte (&buf, 0);
MSG_WriteByte (&buf, ent->skinnum);
for (j=0 ; j<3 ; j++)

View File

@ -972,6 +972,7 @@ void CLNQ_ParseEntity(unsigned int bits)
{
pack->max_entities = pack->num_entities+1;
pack->entities = BZ_Realloc(pack->entities, sizeof(entity_state_t)*pack->max_entities);
memset(pack->entities + pack->num_entities, 0, sizeof(entity_state_t));
}
lasttime = realtime;
state = &pack->entities[pack->num_entities++];
@ -1166,9 +1167,17 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent, int tagnum)
int model = 0; //these two are only initialised because msvc sucks at detecting usage.
int frame = 0;
int frame2 = cl.lerpents[tagent].frame;
int frame2;
float frame2ness;
if (tagent > cl.maxlerpents)
{
Con_Printf("tag entity out of range!\n");
return;
}
frame2 = cl.lerpents[tagent].frame;
ent->keynum = tagent;
ps = CL_FindPacketEntity(tagent);
@ -1684,8 +1693,8 @@ void CL_LinkPacketEntities (void)
ent->drawflags = state->hexen2flags;
// set frame
ent->frame = state->frame;
ent->oldframe = le->frame;
ent->frame1 = state->frame;
ent->frame2 = le->frame;
ent->frame1time = cl.servertime - le->framechange;
ent->frame2time = cl.servertime - le->oldframechange;
@ -1759,8 +1768,8 @@ void CL_LinkPacketEntities (void)
}
if (i == cl_oldnumvisedicts)
{
P_DelinkTrailstate(&(cl.lerpents[state->number].trailstate));
P_DelinkTrailstate(&(cl.lerpents[state->number].emitstate));
pe->DelinkTrailstate(&(cl.lerpents[state->number].trailstate));
pe->DelinkTrailstate(&(cl.lerpents[state->number].emitstate));
continue; // not in last message
}
@ -1775,8 +1784,8 @@ void CL_LinkPacketEntities (void)
if (model->particletrail >= 0)
{
if (P_ParticleTrail (old_origin, ent->origin, model->particletrail, &(le->trailstate)))
P_ParticleTrailIndex(old_origin, ent->origin, model->traildefaultindex, 0, &(le->trailstate));
if (pe->ParticleTrail (old_origin, ent->origin, model->particletrail, &(le->trailstate)))
pe->ParticleTrailIndex(old_origin, ent->origin, model->traildefaultindex, 0, &(le->trailstate));
}
{
@ -1805,15 +1814,15 @@ void CL_LinkPacketEntities (void)
dclr[2] = 0.05;
}
}
else if (model->flags & EF_FIREBALL)
else if (model->flags & EFH2_FIREBALL)
{
rad = 120 - (rand() % 20);
}
else if (model->flags & EF_ACIDBALL)
else if (model->flags & EFH2_ACIDBALL)
{
rad = 120 - (rand() % 20);
}
else if (model->flags & EF_SPIT)
else if (model->flags & EFH2_SPIT)
{
// as far as I can tell this effect inverses the light...
dclr[0] = -dclr[0];
@ -2235,7 +2244,7 @@ void CL_LinkProjectiles (void)
#endif
ent->model = cl.model_precache[pr->modelindex];
ent->skinnum = 0;
ent->frame = 0;
ent->frame1 = 0;
ent->flags = 0;
#ifdef SWQUAKE
ent->palremap = D_IdentityRemap();
@ -2493,7 +2502,7 @@ void CL_ParsePlayerinfo (void)
else
state->weaponframe = 0;
if (cl.worldmodel && (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife))
if (cl.worldmodel && cl.worldmodel->fromgame == fg_quake)
state->hullnum = 1;
else
state->hullnum = 56;
@ -2629,27 +2638,27 @@ void CL_AddFlagModels (entity_t *ent, int team)
return;
f = 14;
if (ent->frame >= 29 && ent->frame <= 40) {
if (ent->frame >= 29 && ent->frame <= 34) { //axpain
if (ent->frame == 29) f = f + 2;
else if (ent->frame == 30) f = f + 8;
else if (ent->frame == 31) f = f + 12;
else if (ent->frame == 32) f = f + 11;
else if (ent->frame == 33) f = f + 10;
else if (ent->frame == 34) f = f + 4;
} else if (ent->frame >= 35 && ent->frame <= 40) { // pain
if (ent->frame == 35) f = f + 2;
else if (ent->frame == 36) f = f + 10;
else if (ent->frame == 37) f = f + 10;
else if (ent->frame == 38) f = f + 8;
else if (ent->frame == 39) f = f + 4;
else if (ent->frame == 40) f = f + 2;
if (ent->frame1 >= 29 && ent->frame1 <= 40) {
if (ent->frame1 >= 29 && ent->frame1 <= 34) { //axpain
if (ent->frame1 == 29) f = f + 2;
else if (ent->frame1 == 30) f = f + 8;
else if (ent->frame1 == 31) f = f + 12;
else if (ent->frame1 == 32) f = f + 11;
else if (ent->frame1 == 33) f = f + 10;
else if (ent->frame1 == 34) f = f + 4;
} else if (ent->frame1 >= 35 && ent->frame1 <= 40) { // pain
if (ent->frame1 == 35) f = f + 2;
else if (ent->frame1 == 36) f = f + 10;
else if (ent->frame1 == 37) f = f + 10;
else if (ent->frame1 == 38) f = f + 8;
else if (ent->frame1 == 39) f = f + 4;
else if (ent->frame1 == 40) f = f + 2;
}
} else if (ent->frame >= 103 && ent->frame <= 118) {
if (ent->frame >= 103 && ent->frame <= 104) f = f + 6; //nailattack
else if (ent->frame >= 105 && ent->frame <= 106) f = f + 6; //light
else if (ent->frame >= 107 && ent->frame <= 112) f = f + 7; //rocketattack
else if (ent->frame >= 112 && ent->frame <= 118) f = f + 7; //shotattack
} else if (ent->frame1 >= 103 && ent->frame1 <= 118) {
if (ent->frame1 >= 103 && ent->frame1 <= 104) f = f + 6; //nailattack
else if (ent->frame1 >= 105 && ent->frame1 <= 106) f = f + 6; //light
else if (ent->frame1 >= 107 && ent->frame1 <= 112) f = f + 7; //rocketattack
else if (ent->frame1 >= 112 && ent->frame1 <= 118) f = f + 7; //shotattack
}
newent = CL_NewTempEntity ();
@ -2681,7 +2690,7 @@ void CL_AddVWeapModel(entity_t *player, int model)
VectorCopy(player->angles, newent->angles);
newent->skinnum = player->skinnum;
newent->model = cl.model_precache[model];
newent->frame = player->frame;
newent->frame1 = player->frame1;
VectorCopy(newent->angles, angles);
angles[0]*=-1;
@ -2770,10 +2779,10 @@ void CL_LinkPlayers (void)
ent->frame1time = cl.time - cl.lerpplayers[j].framechange;
ent->frame2time = cl.time - cl.lerpplayers[j].oldframechange;
if (ent->frame != cl.lerpplayers[j].frame)
if (ent->frame1 != cl.lerpplayers[j].frame)
{
ent->oldframe = ent->frame;
ent->frame = cl.lerpplayers[j].frame;
ent->frame2 = ent->frame1;
ent->frame1 = cl.lerpplayers[j].frame;
}
ent->lerpfrac = 1-(realtime - cl.lerpplayers[j].framechange)*10;
@ -2880,8 +2889,6 @@ void CL_LinkPlayers (void)
pmove.numphysent = oldphysent;
VectorCopy (exact.origin, ent->origin);
}
if (cl.worldmodel->fromgame == fg_halflife)
ent->origin[2]-=12;
if (state->effects & QWEF_FLAG1)
CL_AddFlagModels (ent, 0);
@ -2973,20 +2980,20 @@ void CL_LinkViewModel(void)
ent.shaderRGBAf[2] = 1;
ent.shaderRGBAf[3] = alpha;
ent.frame = cl.viewent[r_refdef.currentplayernum].frame;
ent.oldframe = oldframe[r_refdef.currentplayernum];
ent.frame1 = cl.viewent[r_refdef.currentplayernum].frame1;
ent.frame2 = oldframe[r_refdef.currentplayernum];
if (ent.frame != prevframe[r_refdef.currentplayernum])
if (ent.frame1 != prevframe[r_refdef.currentplayernum])
{
oldframe[r_refdef.currentplayernum] = ent.oldframe = prevframe[r_refdef.currentplayernum];
oldframe[r_refdef.currentplayernum] = ent.frame2 = prevframe[r_refdef.currentplayernum];
lerptime[r_refdef.currentplayernum] = realtime;
}
prevframe[r_refdef.currentplayernum] = ent.frame;
prevframe[r_refdef.currentplayernum] = ent.frame1;
if (ent.model != oldmodel[r_refdef.currentplayernum])
{
oldmodel[r_refdef.currentplayernum] = ent.model;
oldframe[r_refdef.currentplayernum] = ent.oldframe = ent.frame;
oldframe[r_refdef.currentplayernum] = ent.frame2 = ent.frame1;
lerptime[r_refdef.currentplayernum] = realtime;
}
ent.lerpfrac = 1-(realtime-lerptime[r_refdef.currentplayernum])*10;

View File

@ -352,15 +352,15 @@ char Ignore_Check_Flood(char *s, int flags, int offset) {
char name[MAX_INFO_STRING];
if ( !(
( (ignore_flood.value == 1 && (flags == 1 || flags == 4)) ||
( (ignore_flood.value == 1 && (flags & TPM_NORMAL || flags & TPM_SPECTATOR)) ||
(ignore_flood.value == 2 && flags != 0) )
) )
return NO_IGNORE_NO_ADD;
if (flags == 1 || flags == 4) {
if (flags == 1 || flags == TPM_SPECTATOR) {
p = 0;
q = offset - 3;
} else if (flags == 2) {
} else if (flags == TPM_TEAM) {
p = 1;
q = offset - 4;
} else if (flags == 8) {

View File

@ -842,8 +842,8 @@ void CLNQ_SendCmd(sizebuf_t *buf)
if (nq_dp_protocol > 0 && cls.signon == 4)
{
MSG_WriteByte(&cls.netchan.message, 50);
MSG_WriteLong(&cls.netchan.message, cl_latestframenum);
MSG_WriteByte(buf, clcdp_ackframe);
MSG_WriteLong(buf, cl_latestframenum);
}
memset(&independantphysics[0], 0, sizeof(independantphysics[0]));
@ -872,7 +872,11 @@ float CL_FilterTime (double time, float wantfps) //now returns the extra time no
else
{
fpscap = cls.maxfps ? max (30.0, cls.maxfps) : 0x7fff;
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type == NA_IRC)
fps = bound (0.1, wantfps, fpscap); //if we're connected via irc, allow a greatly reduced minimum cap
else
#endif
if (wantfps < 1)
fps = fpscap;
else
@ -1466,6 +1470,9 @@ void CL_SendCmd (double frametime)
buf.cursize = 0;
buf.data = data;
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type != NA_IRC)
#endif
if (msecs>150) //q2 has 200 slop.
msecs=150;
@ -1476,6 +1483,9 @@ void CL_SendCmd (double frametime)
msecs=0; //erm.
msecstouse = (int)msecs; //casts round down.
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type != NA_IRC)
#endif
if (msecstouse > 200) // cap at 200 to avoid servers splitting movement more than four times
msecstouse = 200;
@ -1494,13 +1504,21 @@ void CL_SendCmd (double frametime)
if (!cl_indepphysics.value)
{
// while we're not playing send a slow keepalive fullsend to stop mvdsv from screwing up
if (cls.state < ca_active && CL_FilterTime(msecstouse, 12.5) == false)
if (cls.state < ca_active && CL_FilterTime(msecstouse,
#ifdef IRCCONNECT //don't spam irc.
cls.netchan.remote_address.type == NA_IRC?0.5:
#endif
12.5) == false)
fullsend = false;
else if (cl_netfps.value > 0)
{
int spare;
spare = CL_FilterTime(msecstouse, cl_netfps.value);
if (!spare && msecstouse < 200)
if (!spare && (msecstouse < 200
#ifdef IRCCONNECT
|| cls.netchan.remote_address.type == NA_IRC
#endif
))
fullsend = false;
if (spare > cl_sparemsec.value)
spare = cl_sparemsec.value;
@ -1548,13 +1566,18 @@ void CL_SendCmd (double frametime)
next = clientcmdlist->next;
if (clientcmdlist->reliable)
{
if (cls.netchan.message.cursize + 2+strlen(clientcmdlist->command) > cls.netchan.message.maxsize)
break;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, clientcmdlist->command);
}
else
{
MSG_WriteByte (&buf, clc_stringcmd);
MSG_WriteString (&buf, clientcmdlist->command);
if (buf.cursize + 2+strlen(clientcmdlist->command) <= buf.maxsize)
{
MSG_WriteByte (&buf, clc_stringcmd);
MSG_WriteString (&buf, clientcmdlist->command);
}
}
Con_DPrintf("Sending stringcmd %s\n", clientcmdlist->command);
Z_Free(clientcmdlist);
@ -1613,8 +1636,27 @@ void CL_SendCmd (double frametime)
if (cls.demorecording)
CL_WriteDemoCmd(cmd);
//shamelessly stolen from fuhquake
if (cl_c2spps.value>0)
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type == NA_IRC)
{
if (dropcount >= 2)
{
dropcount = 0;
}
else
{
// don't count this message when calculating PL
cl.frames[i].receivedtime = -3;
// drop this message
cls.netchan.outgoing_sequence++;
dropcount++;
return;
}
}
else
#endif
//shamelessly stolen from fuhquake
if (cl_c2spps.value>0)
{
pps_balance += frametime;
// never drop more than 2 messages in a row -- that'll cause PL

View File

@ -129,14 +129,15 @@ cvar_t cl_gunanglex = SCVAR("cl_gunanglex", "0");
cvar_t cl_gunangley = SCVAR("cl_gunangley", "0");
cvar_t cl_gunanglez = SCVAR("cl_gunanglez", "0");
cvar_t allow_download_csprogs = SCVAR("allow_download_csprogs", "0");
cvar_t allow_download_csprogs = SCVARF("allow_download_csprogs", "0", CVAR_NOTFROMSERVER);
cvar_t allow_download_redirection = SCVARF("allow_download_redirection", "0", CVAR_NOTFROMSERVER);
cvar_t requiredownloads = SCVARF("requiredownloads","1", CVAR_ARCHIVE);
cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1");
cvar_t cl_item_bobbing = SCVAR("cl_model_bobbing", "0");
cvar_t cl_countpendingpl = SCVAR("cl_countpendingpl", "0");
cvar_t requiredownloads = SCVARF("requiredownloads","1", CVAR_ARCHIVE);
cvar_t cl_standardchat = SCVARF("cl_standardchat", "0", CVAR_ARCHIVE);
cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for mm2, 3 for both
cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE);
@ -396,6 +397,7 @@ void CL_SendConnectPacket (
int compressioncrc
/*, ...*/) //dmw new parms
{
extern cvar_t qport;
netadr_t adr;
char data[2048];
char playerinfo2[MAX_INFO_STRING];
@ -456,7 +458,8 @@ void CL_SendConnectPacket (
connect_time = realtime+t2-t1; // for retransmit requests
cls.qport = Cvar_VariableValue("qport");
cls.qport = qport.value;
Cvar_SetValue(&qport, (cls.qport+1)&0xffff);
// Info_SetValueForStarKey (cls.userinfo, "*ip", NET_AdrToString(adr), MAX_INFO_STRING);
@ -641,6 +644,9 @@ void CL_CheckForResend (void)
CLQ3_SendAuthPacket(adr);
#endif
if (connect_tries == 0)
NET_EnsureRoute(cls.sockets, "conn", cls.servername);
#ifdef NQPROT
if (connect_type || ((connect_tries&3)==3))
{
@ -796,72 +802,28 @@ void CLNQ_Connect_f (void)
}
#endif
#ifdef IRCCONNECT
struct ftenet_generic_connection_s *FTENET_IRCConnect_EstablishConnection(qboolean isserver, char *address);
void CL_IRCConnect_f (void)
{
CL_Disconnect_f ();
if (FTENET_AddToCollection(cls.sockets, "TCP", Cmd_Argv(2), FTENET_IRCConnect_EstablishConnection))
{
char *server;
server = Cmd_Argv (1);
strcpy(cls.servername, "irc://");
Q_strncpyz (cls.servername+6, server, sizeof(cls.servername)-6);
CL_BeginServerConnect();
}
}
#endif
#ifdef TCPCONNECT
void CL_TCPConnect_f (void)
{
char buffer[6];
int newsocket;
int len;
int _true = true;
float giveuptime;
char *server;
if (Cmd_Argc() != 2)
{
Con_TPrintf (TLC_SYNTAX_CONNECT);
return;
}
server = Cmd_Argv (1);
CL_Disconnect_f ();
Q_strncpyz (cls.servername, server, sizeof(cls.servername));
NET_StringToAdr(cls.servername, &cls.sockettcpdest);
if (cls.sockettcp != INVALID_SOCKET)
closesocket (cls.sockettcp);
cls.sockettcp = INVALID_SOCKET;
cls.tcpinlen = 0;
newsocket = TCP_OpenStream(cls.sockettcpdest);
if (newsocket == INVALID_SOCKET)
{
//failed
Con_Printf("Failed to connect, server is either down, firewalled, or on a different port\n");
return;
}
Con_Printf("Waiting for confirmation of server (10 secs)\n");
giveuptime = Sys_DoubleTime() + 10;
while(giveuptime > Sys_DoubleTime())
{
len = recv(newsocket, buffer, sizeof(buffer), 0);
if (!strncmp(buffer, "qizmo\n", 6))
{
cls.sockettcp = newsocket;
break;
}
SCR_UpdateScreen();
}
if (cls.sockettcp == INVALID_SOCKET)
{
Con_Printf("Timeout - wrong server type\n");
closesocket(newsocket);
return;
}
Con_Printf("Confirmed\n");
send(cls.sockettcp, buffer, sizeof(buffer), 0);
setsockopt(cls.sockettcp, IPPROTO_TCP, TCP_NODELAY, (char *)&_true, sizeof(_true));
CL_BeginServerConnect();
Cbuf_InsertText(va("connect tcp://%s", Cmd_Argv(1)), Cmd_ExecLevel, true);
}
#endif
@ -990,7 +952,10 @@ void CL_ClearState (void)
for (i = 0; i < UPDATE_BACKUP; i++)
{
if (cl.frames[i].packet_entities.entities)
{
Z_Free(cl.frames[i].packet_entities.entities);
cl.frames[i].packet_entities.entities = NULL;
}
}
if (cl.lerpents)
@ -1049,6 +1014,8 @@ void CL_ClearState (void)
cl.oldgametime = 0;
cl.gametime = 0;
cl.gametimemark = 0;
CL_RegisterParticles();
}
/*
@ -1124,6 +1091,7 @@ void CL_Disconnect (void)
}
cls.state = ca_disconnected;
cls.protocol = CP_UNKNOWN;
cls.demoplayback = DPB_NONE;
cls.demorecording = cls.timedemo = false;
@ -1192,7 +1160,6 @@ void CL_Disconnect (void)
V_ClearCShifts();
}
cls.protocol = CP_UNKNOWN;
cl.servercount = 0;
cls.findtrack = false;
cls.realserverip.type = NA_INVALID;
@ -1200,15 +1167,10 @@ void CL_Disconnect (void)
Validation_DelatchRulesets();
#ifdef TCPCONNECT
if (cls.sockettcp != INVALID_SOCKET)
{
closesocket(cls.sockettcp);
cls.sockettcp = INVALID_SOCKET;
}
//disconnects it, without disconnecting the others.
FTENET_AddToCollection(cls.sockets, "TCP", NULL, NULL);
#endif
cls.qport++; //a hack I picked up from qizmo
Cvar_ForceSet(&cl_servername, "none");
}
@ -1402,9 +1364,6 @@ void CL_CheckServerInfo(void)
if (cl.spectator || cls.demoplayback || atoi(Info_ValueForKey(cl.serverinfo, "mirrors")))
cls.allow_mirrors=true;
if (cl.spectator || cls.demoplayback || atoi(Info_ValueForKey(cl.serverinfo, "allow_shaders")))
cls.allow_shaders=true;
if (cl.spectator || cls.demoplayback || atoi(Info_ValueForKey(cl.serverinfo, "allow_luma")))
cls.allow_luma=true;
@ -1774,18 +1733,7 @@ void CL_Packet_f (void)
}
*out = 0;
#ifdef TCPCONNECT
{
int tcpsock; //extra code to stop the packet command from sending to the server via tcp
tcpsock = cls.sockettcp;
cls.sockettcp = -1;
NET_SendPacket (NS_CLIENT, out-send, send, adr);
cls.sockettcp = tcpsock;
}
#else
NET_SendPacket (NS_CLIENT, out-send, send, adr);
#endif
if (Cmd_FromGamecode())
{
@ -1925,8 +1873,13 @@ void CL_Changing_f (void)
S_StopAllSounds (true);
cl.intermission = 0;
cls.state = ca_connected; // not active anymore, but not disconnected
Con_TPrintf (TLC_CHANGINGMAP);
if (cls.state)
{
cls.state = ca_connected; // not active anymore, but not disconnected
Con_TPrintf (TLC_CHANGINGMAP);
}
else
Con_Printf("Changing while not connected\n");
#ifdef NQPROT
cls.signon=0;
@ -2031,6 +1984,30 @@ void CL_ConnectionlessPacket (void)
return;
}
if (c == A2C_PRINT)
{
if (!strncmp(net_message.data+msg_readcount, "\\chunk", 6))
{
if (NET_CompareBaseAdr(cls.netchan.remote_address, net_from) == false)
if (cls.realserverip.type == NA_INVALID || NET_CompareBaseAdr(cls.realserverip, net_from) == false)
return; //only use it if it came from the real server's ip (this breaks on proxies).
MSG_ReadLong();
MSG_ReadChar();
MSG_ReadChar();
if (CL_ParseOOBDownload())
{
if (msg_readcount != net_message.cursize)
{
Con_Printf ("junk on the end of the packet\n");
CL_Disconnect_f();
}
}
return;
}
}
if (cls.demoplayback == DPB_NONE)
Con_TPrintf (TL_ST_COLON, NET_AdrToString (adr, sizeof(adr), net_from));
// Con_DPrintf ("%s", net_message.data + 4);
@ -2626,38 +2603,62 @@ void CL_Download_f (void)
return;
}
CL_CheckOrEnqueDownloadFile(url, url);
CL_CheckOrEnqueDownloadFile(url, url, DLLF_REQUIRED|DLLF_VERBOSE);
return;
}
CL_EnqueDownload(url, url, true, true);
CL_EnqueDownload(url, url, DLLF_REQUIRED|DLLF_OVERWRITE|DLLF_VERBOSE);
}
/*
strcpy(cls.downloadname, url);
void CL_DownloadSize_f(void)
{
downloadlist_t *dl;
char *name;
char *size;
char *redirection;
_snprintf (cls.downloadname, sizeof(cls.downloadname), "%s/%s", com_gamedir, url);
//if this is a demo.. urm?
//ignore it. This saves any spam.
if (cls.demoplayback)
return;
p = cls.downloadname;
for (;;)
name = Cmd_Argv(1);
size = Cmd_Argv(2);
if (!strcmp(size, "e"))
{
if ((q = strchr(p, '/')) != NULL)
{
*q = 0;
Sys_mkdir(cls.downloadname);
*q = '/';
p = q + 1;
} else
break;
Con_Printf("Download of \"%s\" failed. Not found.\n", name);
CL_DownloadFailed(name);
}
else if (!strcmp(size, "p"))
{
Con_Printf("Download of \"%s\" failed. Not allowed.\n", name);
CL_DownloadFailed(name);
}
else if (!strcmp(size, "r"))
{
redirection = Cmd_Argv(3);
COM_StripExtension(cls.downloadname, cls.downloadtempname);
COM_DefaultExtension(cls.downloadtempname, ".tmp");
if (cls.down
// cls.downloadqw = fopen (cls.downloadname, "wb");
cls.downloadmethod = DL_QWPENDING;
dl = CL_DownloadFailed(name);
CL_SendClientCommand("download %s\n",url);*/
if (allow_download_redirection.value)
{
Con_DPrintf("Download of \"%s\" redirected to \"%s\".\n", name, redirection);
CL_CheckOrEnqueDownloadFile(redirection, NULL, dl->flags);
}
else
Con_Printf("Download of \"%s\" redirected to \"%s\". Prevented by allow_download_redirection.\n", name, redirection);
}
else
{
for (dl = cl.downloadlist; dl; dl = dl->next)
{
if (!strcmp(dl->name, name))
{
dl->size = strtoul(size, NULL, 0);
return;
}
}
}
}
void CL_FinishDownload(char *filename, char *tempname);
@ -2676,9 +2677,10 @@ void CL_ForceStopDownload (qboolean finish)
}
VFS_CLOSE (cls.downloadqw);
cls.downloadqw = NULL;
if (finish)
CL_FinishDownload(cls.downloadname, cls.downloadtempname);
CL_DownloadFinished(cls.downloadname, cls.downloadtempname);
else
{
char *tempname;
@ -2694,7 +2696,6 @@ void CL_ForceStopDownload (qboolean finish)
FS_Remove(tempname+6, FS_SKINS);
}
*cls.downloadname = '\0';
cls.downloadqw = NULL;
cls.downloadpercent = 0;
// get another file if needed
@ -2962,6 +2963,9 @@ void CL_Init (void)
#ifdef TCPCONNECT
Cmd_AddCommand ("tcpconnect", CL_TCPConnect_f);
#endif
#ifdef IRCCONNECT
Cmd_AddCommand ("ircconnect", CL_IRCConnect_f);
#endif
#ifdef NQPROT
Cmd_AddCommand ("nqconnect", CLNQ_Connect_f);
#endif
@ -2980,6 +2984,7 @@ void CL_Init (void)
Cmd_AddCommand ("color", CL_Color_f);
Cmd_AddCommand ("download", CL_Download_f);
Cmd_AddCommand ("dlsize", CL_DownloadSize_f);
Cmd_AddCommand ("nextul", CL_NextUpload);
Cmd_AddCommand ("stopul", CL_StopUpload);
@ -3373,6 +3378,8 @@ void Host_Frame (double time)
CL_QTVPoll();
TP_UpdateAutoStatus();
}
static void simple_crypt(char *buf, int len)

View File

@ -45,6 +45,15 @@ typedef enum{
SLKEY_TIMELIMIT,
SLKEY_FRAGLIMIT,
SLKEY_MOD,
SLKEY_PROTOCOL,
SLKEY_NUMBOTS,
SLKEY_NUMHUMANS,
SLKEY_QCSTATUS,
// SLKEY_PLAYERS, //eep!
SLKEY_ISFAVORITE,//eep!
SLKEY_TOOMANY,
SLKEY_CUSTOM
} hostcachekey_t;
@ -90,12 +99,22 @@ typedef struct serverinfo_s {
qbyte sends;
qbyte insortedlist;
qbyte numhumans;
qbyte numbots;
qbyte freeslots;
qbyte protocol;
char modname[8+1];
char qcstatus[8+1];
char gamedir[8+1];
char map[16];
unsigned short gameversion;
unsigned short ping;
short tl;
short fl;
char gamedir[8+1];
char map[16];
float refreshtime;
@ -153,6 +172,7 @@ int Master_KeyForName(char *keyname);
float Master_ReadKeyFloat(serverinfo_t *server, int keynum);
char *Master_ReadKeyString(serverinfo_t *server, int keynum);
void Master_SortServers(void);
void Master_SetSortField(hostcachekey_t field, qboolean descending);
hostcachekey_t Master_GetSortField(void);
qboolean Master_GetSortDescending(void);

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ int VARGS Plug_SCR_CenterPrint(void *offset, unsigned int mask, const int *arg)
if (qrenderer <= 0)
return 0;
SCR_CenterPrint(0, VM_POINTER(arg[0]));
SCR_CenterPrint(0, VM_POINTER(arg[0]), true);
return 0;
}
int VARGS Plug_Media_ShowFrameRGBA_32(void *offset, unsigned int mask, const int *arg)

View File

@ -400,7 +400,7 @@ void CL_PredictUsercmd (int pnum, player_state_t *from, player_state_t *to, user
pmove.onladder = false;
pmove.hullnum = from->hullnum;
if (cl.worldmodel->fromgame == fg_quake2 || cl.worldmodel->fromgame == fg_quake3 || pmove.hullnum > MAX_MAP_HULLSM)
if (cl.worldmodel->fromgame != fg_quake)
{
player_mins[0] = -16;
player_mins[1] = -16;
@ -418,7 +418,7 @@ void CL_PredictUsercmd (int pnum, player_state_t *from, player_state_t *to, user
VectorCopy(cl.worldmodel->hulls[pmove.hullnum].clip_maxs, player_maxs);
}
if (DEFAULT_VIEWHEIGHT > player_maxs[2])
{
{ //this hack is for hexen2.
player_maxs[2] -= player_mins[2];
player_mins[2] = 0;
}

View File

@ -431,12 +431,15 @@ Called for important messages that should stay in the center of the screen
for a few moments
==============
*/
void SCR_CenterPrint (int pnum, char *str)
void SCR_CenterPrint (int pnum, char *str, qboolean fromgamecode)
{
if (!fromgamecode)
{
#ifdef CSQC_DAT
if (CSQC_CenterPrint(str)) //csqc nabbed it.
return;
if (CSQC_CenterPrint(str)) //csqc nabbed it.
return;
#endif
}
if (Cmd_AliasExist("f_centerprint", RESTRICT_LOCAL))
{
@ -808,7 +811,7 @@ void SCR_ShowPic_Create(void)
sp->x = MSG_ReadShort();
sp->y = MSG_ReadShort();
CL_CheckOrEnqueDownloadFile(sp->picname, sp->picname);
CL_CheckOrEnqueDownloadFile(sp->picname, sp->picname, 0);
}
void SCR_ShowPic_Hide(void)
@ -856,7 +859,7 @@ void SCR_ShowPic_Update(void)
sp->picname = Z_Malloc(strlen(s)+1);
strcpy(sp->picname, s);
CL_CheckOrEnqueDownloadFile(sp->picname, sp->picname);
CL_CheckOrEnqueDownloadFile(sp->picname, sp->picname, 0);
}
void SCR_ShowPic_Script_f(void)
@ -1442,7 +1445,11 @@ void SCR_DrawLoading (void)
{
if(Draw_ScalePic)
Draw_ScalePic(0, 0, vid.width, vid.height, Draw_SafeCachePic (levelshotname));
else
Draw_ConsoleBackground(vid.height);
}
else
Draw_ConsoleBackground(vid.height);
if (COM_FDepthFile("gfx/loading.lmp", true) < COM_FDepthFile("gfx/menu/loading.lmp", true))
{ //quake files

View File

@ -25,6 +25,64 @@ entity_state_t *CL_FindPacketEntity(int num);
#define R_AddDecals(a) //disabled for now
int
pt_gunshot=P_INVALID,
ptdp_gunshotquad=P_INVALID,
pt_spike=P_INVALID,
ptdp_spikequad=P_INVALID,
pt_superspike=P_INVALID,
ptdp_superspikequad=P_INVALID,
pt_wizspike=P_INVALID,
pt_knightspike=P_INVALID,
pt_explosion=P_INVALID,
ptdp_explosionquad=P_INVALID,
pt_tarexplosion=P_INVALID,
pt_teleportsplash=P_INVALID,
pt_lavasplash=P_INVALID,
ptdp_smallflash=P_INVALID,
ptdp_flamejet=P_INVALID,
ptdp_flame=P_INVALID,
ptdp_blood=P_INVALID,
ptdp_spark=P_INVALID,
ptdp_plasmaburn=P_INVALID,
ptdp_tei_g3=P_INVALID,
ptdp_tei_smoke=P_INVALID,
ptdp_tei_bigexplosion=P_INVALID,
ptdp_tei_plasmahit=P_INVALID,
ptdp_stardust=P_INVALID,
rt_rocket=P_INVALID,
rt_grenade=P_INVALID,
rt_blood=P_INVALID,
rt_wizspike=P_INVALID,
rt_slightblood=P_INVALID,
rt_knightspike=P_INVALID,
rt_vorespike=P_INVALID,
rtdp_neharasmoke=P_INVALID,
rtdp_nexuizplasma=P_INVALID,
rtdp_glowtrail=P_INVALID,
ptqw_blood=P_INVALID,
ptqw_lightningblood=P_INVALID,
ptq2_blood=P_INVALID,
rtq2_railtrail=P_INVALID,
rtq2_blastertrail=P_INVALID,
ptq2_blasterparticles=P_INVALID,
rtq2_bubbletrail=P_INVALID,
rtq2_gib=P_INVALID,
rtq2_rocket=P_INVALID,
rtq2_grenade=P_INVALID,
rtqw_railtrail=P_INVALID,
rtfte_lightning1=P_INVALID,
ptfte_lightning1_end=P_INVALID,
rtfte_lightning2=P_INVALID,
ptfte_lightning2_end=P_INVALID,
rtfte_lightning3=P_INVALID,
ptfte_lightning3_end=P_INVALID,
ptfte_bullet=P_INVALID,
ptfte_superbullet=P_INVALID;
#ifdef Q2CLIENT
typedef enum
{
@ -219,6 +277,67 @@ void CL_InitTEnts (void)
Cvar_Register (&r_explosionlight, "Temporary entity control");
}
void CL_RegisterParticles(void)
{
pt_gunshot = P_ParticleTypeForName("TE_GUNSHOT"); /*shotgun*/
ptdp_gunshotquad = P_ParticleTypeForName("TE_GUNSHOTQUAD"); /*DP: quadded shotgun*/
pt_spike = P_ParticleTypeForName("TE_SPIKE"); /*nailgun*/
ptdp_spikequad = P_ParticleTypeForName("TE_SPIKEQUAD"); /*DP: quadded nailgun*/
pt_superspike = P_ParticleTypeForName("TE_SUPERSPIKE"); /*nailgun*/
ptdp_superspikequad = P_ParticleTypeForName("TE_SUPERSPIKEQUAD"); /*DP: quadded nailgun*/
pt_wizspike = P_ParticleTypeForName("TE_WIZSPIKE"); //scrag missile impact
pt_knightspike = P_ParticleTypeForName("TE_KNIGHTSPIKE"); //hellknight missile impact
pt_explosion = P_ParticleTypeForName("TE_EXPLOSION");/*rocket/grenade launcher impacts/far too many things*/
ptdp_explosionquad = P_ParticleTypeForName("TE_EXPLOSIONQUAD"); /*nailgun*/
pt_tarexplosion = P_ParticleTypeForName("TE_TAREXPLOSION");//tarbaby/spawn dying.
pt_teleportsplash = P_ParticleTypeForName("TE_TELEPORT");/*teleporters*/
pt_lavasplash = P_ParticleTypeForName("TE_LAVASPLASH"); //e1m7 boss dying.
ptdp_smallflash = P_ParticleTypeForName("TE_SMALLFLASH"); //DP:
ptdp_flamejet = P_ParticleTypeForName("TE_FLAMEJET"); //DP:
ptdp_flame = P_ParticleTypeForName("EF_FLAME"); //DP:
ptdp_blood = P_ParticleTypeForName("TE_BLOOD"); /*when you hit something with the shotgun/axe/nailgun - nq uses the general particle builtin*/
ptdp_spark = P_ParticleTypeForName("TE_SPARK");//DPTE_SPARK
ptdp_plasmaburn = P_ParticleTypeForName("TE_PLASMABURN");
ptdp_tei_g3 = P_ParticleTypeForName("TE_TEI_G3");
ptdp_tei_smoke = P_ParticleTypeForName("TE_TEI_SMOKE");
ptdp_tei_bigexplosion = P_ParticleTypeForName("TE_TEI_BIGEXPLOSION");
ptdp_tei_plasmahit = P_ParticleTypeForName("TE_TEI_PLASMAHIT");
ptdp_stardust = P_ParticleTypeForName("EF_STARDUST");
rt_rocket = P_ParticleTypeForName("TR_ROCKET"); /*rocket trail*/
rt_grenade = P_ParticleTypeForName("TR_GRENADE"); /*grenade trail*/
rt_blood = P_ParticleTypeForName("TR_BLOOD"); /*blood trail*/
rt_wizspike = P_ParticleTypeForName("TR_WIZSPIKE");
rt_slightblood = P_ParticleTypeForName("TR_SLIGHTBLOOD");
rt_knightspike = P_ParticleTypeForName("TR_KNIGHTSPIKE");
rt_vorespike = P_ParticleTypeForName("TR_VORESPIKE");
rtdp_neharasmoke = P_ParticleTypeForName("TR_NEHAHRASMOKE");
rtdp_nexuizplasma = P_ParticleTypeForName("TR_NEXUIZPLASMA");
rtdp_glowtrail = P_ParticleTypeForName("TR_GLOWTRAIL");
/*internal to psystem*/ P_ParticleTypeForName("SVC_PARTICLE");
ptqw_blood = P_ParticleTypeForName("TE_BLOOD");
ptqw_lightningblood = P_ParticleTypeForName("TE_LIGHTNINGBLOOD");
ptq2_blood = P_ParticleTypeForName("TE_BLOOD");
rtq2_railtrail = P_ParticleTypeForName("TR_RAILTRAIL");
rtq2_blastertrail = P_ParticleTypeForName("TR_BLASTERTRAIL");
ptq2_blasterparticles = P_ParticleTypeForName("TE_BLASTERPARTICLES");
rtq2_bubbletrail = P_ParticleTypeForName("TE_BUBBLETRAIL");
rtq2_gib = P_ParticleTypeForName("TR_GIB");
rtq2_rocket = P_ParticleTypeForName("TR_ROCKET");
rtq2_grenade = P_ParticleTypeForName("TR_GRENADE");
rtqw_railtrail = P_ParticleTypeForName("TE_RAILTRAIL");
rtfte_lightning1 = P_ParticleTypeForName("TE_LIGHTNING1");
ptfte_lightning1_end = P_ParticleTypeForName("TE_LIGHTNING1_END");
rtfte_lightning2 = P_ParticleTypeForName("TE_LIGHTNING2");
ptfte_lightning2_end = P_ParticleTypeForName("TE_LIGHTNING2_END");
rtfte_lightning3 = P_ParticleTypeForName("TE_LIGHTNING3");
ptfte_lightning3_end = P_ParticleTypeForName("TE_LIGHTNING3_END");
ptfte_bullet = P_ParticleTypeForName("TE_BULLET");
ptfte_superbullet = P_ParticleTypeForName("TE_SUPERBULLET");
}
#ifdef Q2CLIENT
enum {
q2cl_mod_explode,
@ -368,14 +487,14 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
if (ent < 0 && ent >= -512) //a zquake concept. ent between -1 and -maxplayers is to be taken to be a railtrail from a particular player instead of a beam.
{
// TODO: add support for those finnicky colored railtrails...
if (P_ParticleTrail(start, end, rt_railtrail, NULL))
if (P_ParticleTrail(start, end, rtqw_railtrail, NULL))
P_ParticleTrailIndex(start, end, 208, 8, NULL);
return;
}
default:
m = Mod_ForName("progs/bolt.mdl", false);
btype = rt_lightning1;
etype = pt_lightning1_end;
btype = rtfte_lightning1;
etype = ptfte_lightning1_end;
break;
case 1:
if (ent < 0 && ent >= -MAX_CLIENTS) //based on the railgun concept - this adds a rogue style TE_BEAM effect.
@ -388,14 +507,14 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
else
{
m = Mod_ForName("progs/bolt2.mdl", false);
btype = rt_lightning2;
etype = pt_lightning2_end;
btype = rtfte_lightning2;
etype = ptfte_lightning2_end;
}
break;
case 2:
m = Mod_ForName("progs/bolt3.mdl", false);
btype = rt_lightning3;
etype = pt_lightning3_end;
btype = rtfte_lightning3;
etype = ptfte_lightning3_end;
break;
#ifdef Q2CLIENT
case 3:
@ -424,7 +543,7 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
}
}
if (etype >= 0 && cls.state == ca_active && P_TypeIsLoaded(etype))
if (etype >= 0 && cls.state == ca_active && etype != P_INVALID)
{
if (cl_beam_trace.value)
{
@ -530,12 +649,12 @@ void CL_ParseStream (int type)
case TE_STREAM_ICECHUNKS:
b->model = Mod_ForName("models/stice.mdl", true);
b->flags |= 2;
b->particleeffect = P_AllocateParticleType("te_stream_icechunks");
b->particleeffect = P_FindParticleType("te_stream_icechunks");
R_AddStain(end, -10, -10, 0, 20);
break;
case TE_STREAM_SUNSTAFF1:
b->model = Mod_ForName("models/stsunsf1.mdl", true);
b->particleeffect = P_AllocateParticleType("te_stream_sunstaff1");
b->particleeffect = P_FindParticleType("te_stream_sunstaff1");
if (b->particleeffect < 0)
{
b2 = CL_NewBeam(ent, tag+128);
@ -549,7 +668,7 @@ void CL_ParseStream (int type)
break;
case TE_STREAM_SUNSTAFF2:
b->model = Mod_ForName("models/stsunsf1.mdl", true);
b->particleeffect = P_AllocateParticleType("te_stream_sunstaff2");
b->particleeffect = P_FindParticleType("te_stream_sunstaff2");
R_AddStain(end, -10, -10, -10, 20);
break;
}
@ -578,6 +697,17 @@ void CL_ParseTEnt (void)
int cnt, colour;
type = MSG_ReadByte ();
#ifdef CSQC_DAT
if (type != TE_GUNSHOT)
{
//I know I'm going to regret this.
if (CSQC_ParseTempEntity((unsigned char)type))
return;
}
#endif
switch (type)
{
case TE_WIZSPIKE: // spike hitting wall
@ -614,7 +744,7 @@ void CL_ParseTEnt (void)
R_AddStain(pos, -10, -10, -10, 20);
R_AddDecals(pos);
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_spikequad"))
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_spikequad))
if (P_RunParticleEffectType(pos, NULL, 1, pt_spike))
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
P_RunParticleEffect (pos, vec3_origin, 0, 10);
@ -665,7 +795,7 @@ void CL_ParseTEnt (void)
R_AddStain(pos, -10, -10, -10, 20);
R_AddDecals(pos);
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_superspikequad"))
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_superspikequad))
if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike))
if (P_RunParticleEffectType(pos, NULL, 2, pt_spike))
if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot))
@ -722,7 +852,7 @@ void CL_ParseTEnt (void)
R_AddStain(pos, -10, -10, -10, 20);
R_AddDecals(pos);
if (P_RunParticleEffectType(pos, NULL, 1, pt_bullet))
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_bullet))
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
P_RunParticleEffect (pos, vec3_origin, 0, 10);
@ -747,8 +877,8 @@ void CL_ParseTEnt (void)
R_AddStain(pos, -10, -10, -10, 20);
R_AddDecals(pos);
if (P_RunParticleEffectType(pos, NULL, 1, pt_superbullet))
if (P_RunParticleEffectType(pos, NULL, 2, pt_bullet))
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_superbullet))
if (P_RunParticleEffectType(pos, NULL, 2, ptfte_bullet))
if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot))
P_RunParticleEffect (pos, vec3_origin, 0, 20);
@ -772,7 +902,7 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_explosionquad"))
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_explosionquad))
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
@ -883,7 +1013,7 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_tei_bigexplosion"))
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_tei_bigexplosion))
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
@ -914,7 +1044,7 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
P_BlobExplosion (pos);
P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion);
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
@ -931,7 +1061,7 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
P_LavaSplash (pos);
P_RunParticleEffectType(pos, NULL, 1, pt_lavasplash);
break;
case TE_TELEPORT:
@ -948,7 +1078,7 @@ void CL_ParseTEnt (void)
R_AddStain(pos, -10, -10, -10, 20);
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_gunshotquad"))
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_gunshotquad))
if (P_RunParticleEffectType(pos, NULL, 1, pt_gunshot))
P_RunParticleEffect (pos, vec3_origin, 0, 20);
@ -977,8 +1107,9 @@ void CL_ParseTEnt (void)
R_AddStain(pos, 0, -10, -10, 40);
if (P_RunParticleEffectType(pos, NULL, cnt, pt_blood))
P_RunParticleEffect (pos, vec3_origin, 73, 20*cnt);
if (P_RunParticleEffectType(pos, NULL, cnt, ptqw_blood))
if (P_RunParticleEffectType(pos, NULL, cnt, ptdp_blood))
P_RunParticleEffect (pos, vec3_origin, 73, 20*cnt);
break;
@ -989,7 +1120,7 @@ void CL_ParseTEnt (void)
R_AddStain(pos, 1, -10, -10, 20);
if (P_RunParticleEffectType(pos, NULL, 1, pt_lightningblood))
if (P_RunParticleEffectType(pos, NULL, 1, ptqw_lightningblood))
P_RunParticleEffect (pos, vec3_origin, 225, 50);
break;
@ -1003,8 +1134,9 @@ void CL_ParseTEnt (void)
pos2[1] = MSG_ReadCoord ();
pos2[2] = MSG_ReadCoord ();
if (P_ParticleTrail(pos, pos2, rt_railtrail, NULL))
P_ParticleTrailIndex(pos, pos2, 208, 8, NULL);
if (P_ParticleTrail(pos, pos2, rtqw_railtrail, NULL))
if (P_ParticleTrail(pos, pos2, rtq2_railtrail, NULL))
P_ParticleTrailIndex(pos, pos2, 208, 8, NULL);
break;
case TE_STREAM_CHAIN:
@ -1029,7 +1161,7 @@ void CL_ParseTEnt (void)
cnt = MSG_ReadByte ();
P_RunParticleEffectType(pos, pos2, cnt, pt_blood);
P_RunParticleEffectType(pos, pos2, cnt, ptdp_blood);
break;
case DPTE_SPARK:
@ -1043,8 +1175,7 @@ void CL_ParseTEnt (void)
cnt = MSG_ReadByte ();
{
extern int pt_spark;
P_RunParticleEffectType(pos, pos2, cnt, pt_spark);
P_RunParticleEffectType(pos, pos2, cnt, ptdp_spark);
}
break;
@ -1118,7 +1249,7 @@ void CL_ParseTEnt (void)
// count
cnt = MSG_ReadByte ();
if (P_RunParticleEffectTypeString(pos, pos2, cnt, "te_flamejet"))
if (P_RunParticleEffectType(pos, pos2, cnt, ptdp_flamejet))
P_RunParticleEffect (pos, pos2, 232, cnt);
break;
@ -1177,8 +1308,7 @@ void CL_ParseTEnt (void)
//count
cnt = MSG_ReadByte ();
{
extern int pt_smoke;
P_RunParticleEffectType(pos, pos2, cnt, pt_smoke);
P_RunParticleEffectType(pos, pos2, cnt, ptdp_tei_smoke);
}
break;
@ -1194,8 +1324,7 @@ void CL_ParseTEnt (void)
cnt = MSG_ReadByte ();
{
extern int pt_plasma;
P_RunParticleEffectType(pos, pos2, cnt, pt_plasma);
P_RunParticleEffectType(pos, pos2, cnt, ptdp_tei_plasmahit);
}
break;
@ -1324,7 +1453,7 @@ void CL_ParseCustomTEnt(void)
t->netstyle = MSG_ReadByte();
str = MSG_ReadString();
t->particleeffecttype = P_AllocateParticleType(str);
t->particleeffecttype = P_ParticleTypeForName(str);
if (t->netstyle & CTE_STAINS)
{
@ -1431,6 +1560,60 @@ void CL_ClearCustomTEnts(void)
customtenttype[i].particleeffecttype = -1;
}
void CLDP_ParseTrailParticles(void)
{
int entityindex;
int effectindex;
vec3_t start, end;
trailstate_t **ts;
entityindex = (unsigned short)MSG_ReadShort();
effectindex = (unsigned short)MSG_ReadShort();
start[0] = MSG_ReadCoord();
start[1] = MSG_ReadCoord();
start[2] = MSG_ReadCoord();
end[0] = MSG_ReadCoord();
end[1] = MSG_ReadCoord();
end[2] = MSG_ReadCoord();
if (entityindex && (unsigned int)entityindex < MAX_EDICTS)
ts = &cl.lerpents[entityindex].trailstate;
else
ts = NULL;
effectindex = P_ParticleTypeForName(COM_Effectinfo_ForNumber(effectindex));
if (P_ParticleTrail(start, end, effectindex, ts))
P_ParticleTrail(start, end, rt_blood, ts);
}
void CLDP_ParsePointParticles(qboolean compact)
{
vec3_t org, dir;
unsigned int count, effectindex;
effectindex = (unsigned short)MSG_ReadShort();
org[0] = MSG_ReadCoord();
org[1] = MSG_ReadCoord();
org[2] = MSG_ReadCoord();
if (compact)
{
dir[0] = dir[1] = dir[2] = 0;
count = 1;
}
else
{
dir[0] = MSG_ReadCoord();
dir[1] = MSG_ReadCoord();
dir[2] = MSG_ReadCoord();
count = (unsigned short)MSG_ReadShort();
}
effectindex = P_ParticleTypeForName(COM_Effectinfo_ForNumber(effectindex));
if (P_RunParticleEffectType(org, dir, count, effectindex))
P_RunParticleEffect (org, dir, 15, 15);
}
void CLNQ_ParseParticleEffect (void)
{
vec3_t org, dir;
@ -1612,8 +1795,9 @@ void CLQ2_ParseTEnt (void)
case Q2TE_BLOOD: // bullet hitting flesh
MSG_ReadPos (pos);
MSG_ReadDir (dir);
if (P_RunParticleEffectType(pos, dir, 1, pt_blood))
P_RunParticleEffect(pos, dir, 0xe8, 60);
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blood))
if (P_RunParticleEffectType(pos, dir, 1, ptqw_blood))
P_RunParticleEffect(pos, dir, 0xe8, 60);
R_AddStain(pos, 0, -10, -10, 40);
break;
@ -1707,7 +1891,7 @@ void CLQ2_ParseTEnt (void)
case Q2TE_BLUEHYPERBLASTER:
MSG_ReadPos (pos);
MSG_ReadPos (dir);
if (P_RunParticleEffectType(pos, dir, 1, pt_blasterparticles))
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
P_RunParticleEffect (pos, dir, 0xe0, 40);
break;
@ -1715,7 +1899,7 @@ void CLQ2_ParseTEnt (void)
MSG_ReadPos (pos);
MSG_ReadDir (dir);
if (P_RunParticleEffectType(pos, dir, 1, pt_blasterparticles))
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
P_RunParticleEffect (pos, dir, 0xe0, 40);
R_AddStain(pos, 0, -5, -10, 20);
@ -1764,7 +1948,7 @@ void CLQ2_ParseTEnt (void)
case Q2TE_RAILTRAIL: // railgun effect
MSG_ReadPos (pos);
MSG_ReadPos (pos2);
if (P_ParticleTrail(pos, pos2, rt_railtrail, NULL))
if (P_ParticleTrail(pos, pos2, rtq2_railtrail, NULL))
P_ParticleTrailIndex(pos, pos2, 0x74, 8, NULL);
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("weapons/railgf1a.wav"), 1, ATTN_NORM, 0);
break;
@ -1971,7 +2155,7 @@ void CLQ2_ParseTEnt (void)
case Q2TE_BUBBLETRAIL:
MSG_ReadPos (pos);
MSG_ReadPos (pos2);
if (P_ParticleTrail(pos, pos2, rt_bubbletrail, NULL))
if (P_ParticleTrail(pos, pos2, rtq2_bubbletrail, NULL))
P_ParticleTrailIndex(pos, pos2, 4, 8, NULL);
break;
@ -2042,7 +2226,7 @@ void CLQ2_ParseTEnt (void)
MSG_ReadDir (dir);
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_blaster2"))
if (P_RunParticleEffectType(pos, dir, 1, pt_blasterparticles))
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
P_RunParticleEffect (pos, dir, 0xd0, 40);
R_AddStain(pos, -10, 0, -10, 20);
@ -2092,7 +2276,7 @@ void CLQ2_ParseTEnt (void)
MSG_ReadDir (dir);
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_blaster2"))
if (P_RunParticleEffectType(pos, dir, 1, pt_blasterparticles))
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
P_RunParticleEffect (pos, dir, 0x6f, 40);
R_AddStain(pos, -10, -2, 0, 20);
@ -2146,7 +2330,7 @@ void CLQ2_ParseTEnt (void)
case Q2TE_DEBUGTRAIL:
MSG_ReadPos (pos);
MSG_ReadPos (pos2);
if (P_ParticleTrail(pos, pos2, P_AllocateParticleType("te_debugtrail"), NULL))
if (P_ParticleTrail(pos, pos2, P_FindParticleType("te_debugtrail"), NULL))
P_ParticleTrailIndex(pos, pos2, 116, 8, NULL);
break;
@ -2251,7 +2435,7 @@ void CLQ2_ParseTEnt (void)
MSG_ReadPos (pos);
MSG_ReadDir (dir);
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_moreblood"))
if (P_RunParticleEffectType(pos, dir, 4, pt_blood))
if (P_RunParticleEffectType(pos, dir, 4, ptqw_blood))
P_RunParticleEffect(pos, dir, 0xe8, 250);
break;
/*
@ -2673,8 +2857,8 @@ void CL_UpdateExplosions (void)
AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]);
VectorInverse(ent->axis[1]);
ent->model = ex->model;
ent->frame = (int)f+firstframe;
ent->oldframe = of+firstframe;
ent->frame1 = (int)f+firstframe;
ent->frame2 = of+firstframe;
ent->lerpfrac = 1-(f - (int)f);
ent->shaderRGBAf[3] = 1.0 - f/(numframes);
ent->flags = ex->flags;

View File

@ -347,9 +347,12 @@ typedef struct q3refEntity_s {
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching
#define Q3RF_MINLIGHT 1
#define Q3RF_THIRD_PERSON 2 // don't draw through eyes, only mirrors (player bodies, chat sprites)
#define Q3RF_FIRST_PERSON 4 // only draw through eyes (view weapon, damage blood blob)
#define Q3RF_DEPTHHACK 8 // for view weapon Z crunching
#define Q3RF_NOSHADOW 64
#define Q3RF_LIGHTING_ORIGIN 128
#define MAX_VMQ3_CACHED_STRINGS 1024
char *stringcache[1024];
@ -394,8 +397,8 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
cl_visedicts = cl_visedicts_list[0];
memset(&ent, 0, sizeof(ent));
ent.model = VM_FROMMHANDLE(q3->hModel);
ent.frame = q3->frame;
ent.oldframe = q3->oldframe;
ent.frame1 = q3->frame;
ent.frame2 = q3->oldframe;
memcpy(ent.axis, q3->axis, sizeof(q3->axis));
ent.lerpfrac = q3->backlerp;
ent.scale = q3->radius;
@ -409,6 +412,10 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
ent.shaderRGBAf[1] = q3->shaderRGBA[1]/255.0f;
ent.shaderRGBAf[2] = q3->shaderRGBA[2]/255.0f;
ent.shaderRGBAf[3] = q3->shaderRGBA[3]/255.0f;
// if (ent.shaderRGBAf[3] <= 0)
// return;
#ifdef Q3SHADERS
ent.forcedshader = VM_FROMSHANDLE(q3->customShader);
ent.shaderTime = q3->shaderTime;

View File

@ -140,6 +140,7 @@ typedef struct player_info_s
{
int userid;
char userinfo[EXTENDED_INFO_STRING];
char teamstatus[128];
// scoreboard information
char name[MAX_SCOREBOARDNAME];
@ -330,16 +331,8 @@ typedef struct
char servername[MAX_OSPATH]; // name of server from original connect
int qport;
int socketip;
int socketip6;
int socketipx;
#ifdef TCPCONNECT
int sockettcp;
netadr_t sockettcpdest;
unsigned char tcpinbuffer[1500];
int tcpinlen;
#endif
struct ftenet_connections_s *sockets;
enum {DL_NONE, DL_QW, DL_QWCHUNKS, DL_Q3, DL_DARKPLACES, DL_QWPENDING, DL_HTTP, DL_FTP} downloadmethod;
vfsfile_t *downloadqw; // file transfer from server
@ -410,6 +403,13 @@ extern int nq_dp_protocol;
typedef struct downloadlist_s {
char name[128];
char localname[128];
unsigned int size;
unsigned int flags;
#define DLLF_VERBOSE 1 //tell the user that its downloading
#define DLLF_REQUIRED 2 //means that it won't load models etc until its downloaded (ie: requiredownloads 0 makes no difference)
#define DLLF_OVERWRITE 4 //overwrite it even if it already exists
#define DLLF_SIZEUNKNOWN 8
#define DLLF_IGNOREFAILED 16
struct downloadlist_s *next;
} downloadlist_t;
@ -723,6 +723,7 @@ extern entity_t cl_visedicts_list[2][MAX_VISEDICTS];
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];
qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);
qboolean Q2TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);
//
// cl_input
@ -810,8 +811,9 @@ void CLNQ_ParseServerMessage (void);
void CLQ2_ParseServerMessage (void);
#endif
void CL_NewTranslation (int slot);
qboolean CL_CheckOrEnqueDownloadFile (char *filename, char *localname);
qboolean CL_EnqueDownload(char *filename, char *localname, qboolean verbose, qboolean ignorefailedlist);
qboolean CL_CheckOrEnqueDownloadFile (char *filename, char *localname, unsigned int flags);
qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags);
downloadlist_t *CL_DownloadFailed(char *name);
qboolean CL_IsUploading(void);
void CL_NextUpload(void);
void CL_StartUpload (qbyte *data, int size);
@ -843,6 +845,7 @@ void DropPunchAngle (int pnum);
//
// cl_tent
//
void CL_RegisterParticles(void);
void CL_InitTEnts (void);
void CL_ClearTEnts (void);
void CL_ClearCustomTEnts(void);
@ -854,6 +857,9 @@ void CL_ParseParticleEffect2 (void);
void CL_ParseParticleEffect3 (void);
void CL_ParseParticleEffect4 (void);
void CLDP_ParseTrailParticles(void);
void CLDP_ParsePointParticles(qboolean compact);
//
// cl_ents.c
//
@ -901,7 +907,11 @@ void CSQC_RegisterCvarsAndThings(void);
qboolean CSQC_DrawView(void);
void CSQC_Shutdown(void);
qboolean CSQC_StuffCmd(char *cmd);
qboolean CSQC_LoadResource(char *resname, char *restype);
qboolean CSQC_CenterPrint(char *cmd);
void CSQC_Input_Frame(usercmd_t *cmd);
void CSQC_WorldLoaded(void);
qboolean CSQC_ParseTempEntity(unsigned char firstbyte);
qboolean CSQC_ConsoleCommand(char *cmd);
qboolean CSQC_KeyPress(int key, qboolean down);
int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation);
@ -953,6 +963,7 @@ void vectoangles(vec3_t vec, vec3_t ang);
#define TPM_TEAM 2
#define TPM_SPECTATOR 4
#define TPM_FAKED 16
#define TPM_OBSERVEDTEAM 32
void CL_Say (qboolean team, char *extra);
int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr);
@ -974,6 +985,7 @@ void TP_SearchForMsgTriggers (char *s, int level);
qboolean TP_SoundTrigger(char *message);
void TP_StatChanged (int stat, int value);
qboolean TP_SuppressMessage(char *buf);
colourised_t *TP_FindColours(char *name);
//
// skin.c
@ -1081,6 +1093,14 @@ struct cin_s *Media_StartCin(char *name);
int Media_UpdateForShader(int texnum, cin_t *cin);
void Media_ShutdownCin(cin_t *cin);
//these accept NULL for cin to mean the current fullscreen video
void Media_Gecko_KeyPress (struct cin_s *cin, int code, int event);
void Media_Send_Command(cin_t *cin, char *command);
void Media_Send_MouseMove(cin_t *cin, float x, float y);
void Media_Send_Resize(cin_t *cin, int x, int y);
void Media_Send_GetSize(cin_t *cin, int *x, int *y);
void Media_Send_KeyEvent(cin_t *cin, int button, int event);
void MVD_Interpolate(void);
int Stats_GetKills(int playernum);

View File

@ -1354,15 +1354,15 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
// set frame
if (effects & Q2EF_ANIM01)
ent.frame = autoanim & 1;
ent.frame1 = autoanim & 1;
else if (effects & Q2EF_ANIM23)
ent.frame = 2 + (autoanim & 1);
ent.frame1 = 2 + (autoanim & 1);
else if (effects & Q2EF_ANIM_ALL)
ent.frame = autoanim;
ent.frame1 = autoanim;
else if (effects & Q2EF_ANIM_ALLFAST)
ent.frame = cl.time / 100;
ent.frame1 = cl.time / 100;
else
ent.frame = s1->frame;
ent.frame1 = s1->frame;
// quad and pent can do different things on client
if (effects & Q2EF_PENT)
@ -1395,7 +1395,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
}
// pmm
//======
ent.oldframe = cent->prev.frame;
ent.frame2 = cent->prev.frame;
ent.lerpfrac = cl.lerpfrac;
if (renderfx & (Q2RF_FRAMELERP|Q2RF_BEAM))
@ -1719,7 +1719,8 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
if (effects & Q2EF_ROCKET)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_rocket, &cent->trailstate))
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_rocket, &cent->trailstate))
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_rocket, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xdc, 4, &cent->trailstate);
V_AddLight (ent.origin, 200, 0.2, 0.2, 0);
@ -1736,7 +1737,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
}
else
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_blastertrail, &cent->trailstate))
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_blastertrail, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xe0, 1, &cent->trailstate);
V_AddLight (ent.origin, 200, 0.2, 0.2, 0);
}
@ -1751,13 +1752,15 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
}
else if (effects & Q2EF_GIB)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_gib, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xe8, 8, &cent->trailstate);
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_gib, &cent->trailstate))
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_blood, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xe8, 8, &cent->trailstate);
}
else if (effects & Q2EF_GRENADE)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_grenade, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 4, 8, &cent->trailstate);
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_grenade, &cent->trailstate))
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_grenade, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 4, 8, &cent->trailstate);
}
else if (effects & Q2EF_FLIES)
{
@ -1854,7 +1857,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
if (effects & Q2EF_ANIM_ALLFAST)
{
P_ParticleTrail(cent->lerp_origin, ent.origin, rt_blastertrail, &cent->trailstate);
P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_blastertrail, &cent->trailstate);
}
V_AddLight (ent.origin, 130, 0.2, 0.1, 0.1);
}
@ -1925,11 +1928,11 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
gun.angles[1] = cl_gunangley.value;
gun.angles[2] = cl_gunanglez.value;
gun.frame = ps->gunframe;
if (gun.frame == 0)
gun.oldframe = 0; // just changed weapons, don't lerp from old
gun.frame1 = ps->gunframe;
if (gun.frame1 == 0)
gun.frame2 = 0; // just changed weapons, don't lerp from old
else
gun.oldframe = ops->gunframe;
gun.frame2 = ops->gunframe;
gun.flags = Q2RF_MINLIGHT | Q2RF_DEPTHHACK | Q2RF_WEAPONMODEL;
gun.lerpfrac = 1-cl.lerpfrac;

View File

@ -1,6 +1,7 @@
#include "quakedef.h"
#include "shader.h"
//urm, yeah, this is more than just parse.
#ifdef Q3CLIENT
@ -536,7 +537,7 @@ void CLQ3_ParseGameState(void)
if(msg_badread)
{
Host_EndGame("CL_ParseGameState: read past end of server message");
Host_EndGame("CLQ3_ParseGameState: read past end of server message");
}
if(c == svcq3_eom)
@ -549,17 +550,17 @@ void CLQ3_ParseGameState(void)
switch(c)
{
default:
Host_EndGame("CL_ParseGameState: bad command byte");
Host_EndGame("CLQ3_ParseGameState: bad command byte");
break;
case svcq3_configstring:
index = MSG_ReadShort();
index = MSG_ReadBits(16);
if (index < 0 || index >= MAX_Q3_CONFIGSTRINGS)
{
Host_EndGame("CL_ParseGameState: configString index %i out of range", index);
Host_EndGame("CLQ3_ParseGameState: configString index %i out of range", index);
}
configString = MSG_ReadString();
if (index == 1)
if (index == CFGSTR_SYSINFO)
{
//check some things.
cl.servercount = atoi(Info_ValueForKey(configString, "sv_serverid"));
@ -572,7 +573,7 @@ void CLQ3_ParseGameState(void)
index = MSG_ReadBits(GENTITYNUM_BITS);
if (index < 0 || index >= MAX_GENTITIES)
{
Host_EndGame("CL_ParseGameState: baseline index %i out of range", index);
Host_EndGame("CLQ3_ParseGameState: baseline index %i out of range", index);
}
MSG_Q3_ReadDeltaEntity(NULL, &ccs.baselines[index], index);
break;
@ -582,7 +583,7 @@ void CLQ3_ParseGameState(void)
cl.playernum[0] = MSG_ReadLong();
ccs.fs_key = MSG_ReadLong();
if (!CLQ3_SystemInfoChanged(CG_GetConfigString(1)))
if (!CLQ3_SystemInfoChanged(CG_GetConfigString(CFGSTR_SYSINFO)))
return;
CG_Restart_f();

View File

@ -211,6 +211,7 @@ typedef struct frame_s {
#define TEXTCMD_MASK (TEXTCMD_BACKUP-1)
#define MAX_Q3_CONFIGSTRINGS 1024
#define CFGSTR_SYSINFO 1
#define GENTITYNUM_BITS 10
#define MAX_GENTITIES (1<<GENTITYNUM_BITS)

View File

@ -361,7 +361,9 @@ void Con_ToggleConsole_f (void)
if (key_dest == key_console)
{
if (cls.state == ca_active || Media_PlayingFullScreen()
if (m_state)
key_dest = key_menu;
else if (cls.state == ca_active || Media_PlayingFullScreen()
#ifdef VM_UI
|| UI_MenuState()
#endif
@ -1325,8 +1327,9 @@ void Con_DrawConsole (int lines, qboolean noback)
char *txt;
int row;
unsigned char dlbar[1024];
unsigned char progresspercenttext[128];
char *progresstext;
float progresspercent;
int progresspercent;
#ifdef RUNTIMELIGHTING
extern model_t *lightmodel;
@ -1411,14 +1414,32 @@ void Con_DrawConsole (int lines, qboolean noback)
progresstext = NULL;
progresspercent = 0;
*progresspercenttext = 0;
// draw the download bar
// figure out width
if (cls.downloadmethod)
{
unsigned int count, total;
qboolean extra;
progresstext = cls.downloadname;
progresspercent = cls.downloadpercent;
if ((int)(realtime/2)&1)
sprintf(progresspercenttext, " %02d%% (%ukbps)", progresspercent, CL_DownloadRate()/1000);
else
{
CL_GetDownloadSizes(&count, &total, &extra);
if (total == 0)
{
//just show progress
sprintf(progresspercenttext, " %02d%%", progresspercent);
}
else
{
sprintf(progresspercenttext, " %02d%% (%u%skb)", progresspercent, total/1024, extra?"+":"");
}
}
}
#ifdef RUNTIMELIGHTING
else if (lightmodel)
@ -1426,7 +1447,8 @@ void Con_DrawConsole (int lines, qboolean noback)
if (relitsurface < lightmodel->numsurfaces)
{
progresstext = "light";
progresspercent = (relitsurface*100.0f) / lightmodel->numsurfaces;
progresspercent = (int)((relitsurface*100.0f) / lightmodel->numsurfaces);
sprintf(progresspercenttext, " %02d%%", progresspercent);
}
}
#endif
@ -1438,17 +1460,18 @@ void Con_DrawConsole (int lines, qboolean noback)
else
txt = progresstext;
x = curcon->linewidth - ((curcon->linewidth * 7) / 40);
y = x - strlen(txt) - 8;
x = curcon->linewidth;// - ((curcon->linewidth * 7) / 40);
y = x - strlen(txt) - 4;
i = curcon->linewidth/3;
if (strlen(txt) > i)
{
y = x - i - 11;
y = x - i - 7;
Q_strncpyN(dlbar, txt, i);
strcat(dlbar, "...");
}
else
strcpy(dlbar, txt);
y -= strlen(progresspercenttext);
strcat(dlbar, ": ");
i = strlen(dlbar);
dlbar[i++] = '\x80';
@ -1469,7 +1492,7 @@ void Con_DrawConsole (int lines, qboolean noback)
dlbar[i++] = '\x82';
dlbar[i] = 0;
sprintf(dlbar + strlen(dlbar), " %02d%%", (int)progresspercent);
strcpy(dlbar + strlen(dlbar), progresspercenttext);
// draw it
y = curcon->vislines-22 + 8;

View File

@ -58,6 +58,7 @@ void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue);
extern cvar_t con_displaypossibilities;
cvar_t con_selectioncolour = SCVARFC("con_selectioncolour", "0", CVAR_RENDERERCALLBACK, Con_Selectioncolour_Callback);
cvar_t con_echochat = SCVAR("con_echochat", "0");
extern cvar_t cl_chatmode;
static int KeyModifier (qboolean shift, qboolean alt, qboolean ctrl)
@ -359,6 +360,8 @@ void CompleteCommand (qboolean force)
//lines typed at the main console enter here
void Con_ExecuteLine(console_t *con, char *line)
{
qboolean waschat = false;
con_commandmatch=1;
if (line[0] == '\\' || line[0] == '/')
Cbuf_AddText (line+1, RESTRICT_LOCAL); // skip the >
@ -368,7 +371,7 @@ void Con_ExecuteLine(console_t *con, char *line)
else if (cls.protocol == CP_QUAKE2)
Cbuf_AddText (line, RESTRICT_LOCAL); // send the command to the server via console, and let the server convert to chat
#endif
else
else if (*line)
{ // convert to a chat message
if (cl_chatmode.value == 1 || ((cls.state >= ca_connected && cl_chatmode.value == 2) && (strncmp(line, "say ", 4))))
{
@ -376,12 +379,14 @@ void Con_ExecuteLine(console_t *con, char *line)
Cbuf_AddText ("say_team ", RESTRICT_LOCAL);
else
Cbuf_AddText ("say ", RESTRICT_LOCAL);
waschat = true;
}
Cbuf_AddText (line, RESTRICT_LOCAL); // skip the >
}
Cbuf_AddText ("\n", RESTRICT_LOCAL);
Con_Printf ("]%s\n",line);
if (!waschat || con_echochat.value)
Con_Printf ("]%s\n",line);
if (cls.state == ca_disconnected)
SCR_UpdateScreen (); // force an update, because the command
// may take some time
@ -1337,6 +1342,7 @@ void Key_Init (void)
Cmd_AddCommand ("unbindall",Key_Unbindall_f);
Cvar_Register (&con_selectioncolour, "Console variables");
Cvar_Register (&con_echochat, "Console variables");
}
qboolean Key_MouseShouldBeFree(void)
@ -1493,6 +1499,16 @@ void Key_Event (int key, qboolean down)
if (key == K_SHIFT)
shift_down = down;
if (key == K_ESCAPE)
if (shift_down)
{
if (down)
{
Con_ToggleConsole_f();
return;
}
}
//yes, csqc is allowed to steal the escape key.
if (key != '`' && key != '~')
if (key_dest == key_game)
@ -1556,6 +1572,14 @@ void Key_Event (int key, qboolean down)
return;
}
#ifndef NOMEDIA
if (key_dest == key_game && Media_PlayingFullScreen())
{
Media_Send_KeyEvent(NULL, key, down?0:1);
return;
}
#endif
//
// key up events only generate commands if the game key binding is
// a button command (leading + sign). These will occur even in console mode,

File diff suppressed because it is too large Load Diff

View File

@ -157,10 +157,11 @@ void M_Menu_SinglePlayer_f (void)
cvar_t *pc;
static char *classlist[] = {
"Random",
"Barbarian",
"Crusader",
"Paladin",
"Crusader",
"Necromancer",
"Assasin",
"Demoness",
NULL
};
static char *classvalues[] = {
@ -169,6 +170,7 @@ void M_Menu_SinglePlayer_f (void)
"2",
"3",
"4",
"5",
NULL
};
menu = M_CreateMenu(0);

View File

@ -217,6 +217,12 @@ M_ToggleMenu_f
*/
void M_ToggleMenu_f (void)
{
if (m_state)
{
key_dest = key_menu;
return;
}
#ifdef MENU_DAT
if (MP_Toggle())
return;

View File

@ -86,7 +86,7 @@ extern void SCR_EndLoadingPlaque (void);
extern void SCR_DrawConsole (qboolean noback);
extern void SCR_SetUpToDrawConsole (void);
extern void SCR_EraseCenterString (void);
extern void SCR_CenterPrint (int pnum, char *str);
extern void SCR_CenterPrint (int pnum, char *str, qboolean fromgamecode);
#endif

View File

@ -49,7 +49,7 @@ static serverinfo_t **visibleservers;
static int numvisibleservers;
static int maxvisibleservers;
static qboolean needsort;
static double nextsort;
static hostcachekey_t sortfield;
static qboolean decreasingorder;
@ -241,7 +241,13 @@ qboolean Master_PassesMasks(serverinfo_t *a)
res = Master_CompareInteger(a->maxplayers, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_FREEPLAYERS:
res = Master_CompareInteger(a->maxplayers-a->players, visrules[i].operandi, visrules[i].compareop);
res = Master_CompareInteger(a->freeslots, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_NUMBOTS:
res = Master_CompareInteger(a->numbots, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_NUMHUMANS:
res = Master_CompareInteger(a->numhumans, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_TIMELIMIT:
res = Master_CompareInteger(a->tl, visrules[i].operandi, visrules[i].compareop);
@ -249,6 +255,9 @@ qboolean Master_PassesMasks(serverinfo_t *a)
case SLKEY_FRAGLIMIT:
res = Master_CompareInteger(a->fl, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_PROTOCOL:
res = Master_CompareInteger(a->fl, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_MAP:
res = Master_CompareString(a->map, visrules[i].operands, visrules[i].compareop);
@ -263,6 +272,12 @@ qboolean Master_PassesMasks(serverinfo_t *a)
case SLKEY_BASEGAME:
res = Master_CompareInteger(a->special, visrules[i].operandi, visrules[i].compareop);
break;
case SLKEY_MOD:
res = Master_CompareString(a->modname, visrules[i].operands, visrules[i].compareop);
break;
case SLKEY_QCSTATUS:
res = Master_CompareString(a->qcstatus, visrules[i].operands, visrules[i].compareop);
break;
default:
continue;
}
@ -285,6 +300,7 @@ void Master_SetMaskString(qboolean or, hostcachekey_t field, char *param, slist_
if (numvisrules == MAX_VISRULES)
return; //just don't add it.
nextsort = 0;
visrules[numvisrules].fieldindex = field;
visrules[numvisrules].compareop = testop;
visrules[numvisrules].operands = param;
@ -296,6 +312,7 @@ void Master_SetMaskInteger(qboolean or, hostcachekey_t field, int param, slist_t
if (numvisrules == MAX_VISRULES)
return; //just don't add it.
nextsort = 0;
visrules[numvisrules].fieldindex = field;
visrules[numvisrules].compareop = testop;
visrules[numvisrules].operandi = param;
@ -304,6 +321,7 @@ void Master_SetMaskInteger(qboolean or, hostcachekey_t field, int param, slist_t
}
void Master_SetSortField(hostcachekey_t field, qboolean descending)
{
nextsort = 0;
sortfield = field;
decreasingorder = descending;
}
@ -388,13 +406,13 @@ void Master_SortServers(void)
Master_ResortServer(server);
}
needsort = false;
nextsort = Sys_DoubleTime() + 8;
}
serverinfo_t *Master_SortedServer(int idx)
{
if (needsort)
Master_SortServers();
// if (nextsort < Sys_DoubleTime())
// Master_SortServers();
if (idx < 0 || idx >= numvisibleservers)
return NULL;
@ -404,7 +422,7 @@ serverinfo_t *Master_SortedServer(int idx)
int Master_NumSorted(void)
{
// if (needsort)
if (nextsort < Sys_DoubleTime())
Master_SortServers();
return numvisibleservers;
@ -434,6 +452,14 @@ float Master_ReadKeyFloat(serverinfo_t *server, int keynum)
return server->tl;
case SLKEY_FRAGLIMIT:
return server->fl;
case SLKEY_PROTOCOL:
return server->protocol;
case SLKEY_NUMBOTS:
return server->numbots;
case SLKEY_NUMHUMANS:
return server->numhumans;
case SLKEY_ISFAVORITE:
return !!(server->special & SS_FAVORITE);
default:
return atof(Master_ReadKeyString(server, keynum));
@ -462,6 +488,11 @@ char *Master_ReadKeyString(serverinfo_t *server, int keynum)
case SLKEY_GAMEDIR:
return server->gamedir;
case SLKEY_MOD:
return server->modname;
case SLKEY_QCSTATUS:
return server->qcstatus;
default:
{
static char s[64];
@ -491,12 +522,24 @@ int Master_KeyForName(char *keyname)
return SLKEY_MAXPLAYERS;
else if (!strcmp(keyname, "numplayers"))
return SLKEY_NUMPLAYERS;
else if (!strcmp(keyname, "freeplayers"))
else if (!strcmp(keyname, "freeplayers") || !strcmp(keyname, "freeslots"))
return SLKEY_FREEPLAYERS;
else if (!strcmp(keyname, "gamedir") || !strcmp(keyname, "game") || !strcmp(keyname, "*gamedir") || !strcmp(keyname, "mod"))
else if (!strcmp(keyname, "gamedir") || !strcmp(keyname, "game") || !strcmp(keyname, "*gamedir"))
return SLKEY_GAMEDIR;
else if (!strcmp(keyname, "special"))
return SLKEY_BASEGAME;
else if (!strcmp(keyname, "mod"))
return SLKEY_MOD;
else if (!strcmp(keyname, "protocol"))
return SLKEY_PROTOCOL;
else if (!strcmp(keyname, "numbots"))
return SLKEY_NUMBOTS;
else if (!strcmp(keyname, "numhumans"))
return SLKEY_NUMHUMANS;
else if (!strcmp(keyname, "qcstatus"))
return SLKEY_QCSTATUS;
else if (!strcmp(keyname, "isfavorite"))
return SLKEY_ISFAVORITE;
else if (slist_customkeys == SLIST_MAXKEYS)
return SLKEY_TOOMANY;
@ -531,6 +574,13 @@ void Master_AddMaster (char *address, int type, char *description)
return;
}
#pragma message("Master_AddMaster: add ipv6. don't care about tcp/irc.")
if (adr.type != NA_IP && adr.type != NA_IPX)
{
Con_Printf("Fixme: unable to poll address family\n", address);
return;
}
if (type < MT_SINGLEQW) //broadcasts
{
if (adr.type == NA_IP)
@ -726,6 +776,8 @@ void NET_SendPollPacket(int len, void *data, netadr_t to)
int ret;
struct sockaddr_qstorage addr;
#pragma message("NET_SendPollPacket: no support for ipv6")
NetadrToSockadr (&to, &addr);
#ifdef USEIPX
if (((struct sockaddr*)&addr)->sa_family == AF_IPX)
@ -741,6 +793,7 @@ void NET_SendPollPacket(int len, void *data, netadr_t to)
}
else
#endif
if (((struct sockaddr*)&addr)->sa_family == AF_INET)
{
lastpollsockUDP++;
if (lastpollsockUDP>=POLLUDPSOCKETS)
@ -751,6 +804,8 @@ void NET_SendPollPacket(int len, void *data, netadr_t to)
return; //bother
ret = sendto (pollsocketsUDP[lastpollsockUDP], data, len, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in) );
}
else
return;
if (ret == -1)
{
@ -1036,6 +1091,8 @@ void MasterInfo_ProcessHTTP(char *name, qboolean success, int type)
info->next = firstserver;
firstserver = info;
Master_ResortServer(info);
}
}
@ -1572,6 +1629,15 @@ int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite)
Q_strncpyz(info->gamedir, Info_ValueForKey(msg, "*gamedir"), sizeof(info->gamedir));
Q_strncpyz(info->map, Info_ValueForKey(msg, "map"), sizeof(info->map));
}
Q_strncpyz(info->qcstatus, Info_ValueForKey(msg, "qcstatus"), sizeof(info->qcstatus));
Q_strncpyz(info->modname, Info_ValueForKey(msg, "modname"), sizeof(info->modname));
info->protocol = atoi(Info_ValueForKey(msg, "protocol"));
info->gameversion = atoi(Info_ValueForKey(msg, "gameversion"));
info->numbots = atoi(Info_ValueForKey(msg, "bots"));
info->numhumans = info->players - info->numbots;
info->freeslots = info->maxplayers - info->players;
strcpy(details.info, msg);
msg = msg+strlen(msg)+1;
@ -1744,6 +1810,8 @@ void CL_MasterListParse(int type, qboolean slashpad)
info->next = last;
last = info;
Master_ResortServer(info);
}
}

753
engine/client/p_classic.c Normal file
View File

@ -0,0 +1,753 @@
#include "quakedef.h"
#ifdef PSET_CLASSIC
#include "glquake.h"
void D_DrawParticleTrans (vec3_t porg, float palpha, float pscale, unsigned int pcolour, blendmode_t blendmode);
cvar_t gl_solidparticles = SCVAR("gl_solidparticles", "0");
typedef enum {
DODGY,
ROCKET_TRAIL,
ALT_ROCKET_TRAIL,
BLOOD_TRAIL,
GRENADE_TRAIL,
BIG_BLOOD_TRAIL,
TRACER1_TRAIL,
TRACER2_TRAIL,
VOOR_TRAIL,
BLOBEXPLOSION_POINT,
LAVASPLASH_POINT,
EXPLOSION_POINT,
TELEPORTSPLASH_POINT,
EFFECTTYPE_MAX
} effect_type_t;
typedef struct cparticle_s {
enum {
pt_static,
pt_fire,
pt_explode,
pt_explode2,
pt_blob,
pt_blob2,
pt_grav,
pt_slowgrav
} type;
float die;
vec3_t org;
vec3_t vel;
float ramp;
unsigned char color;
struct cparticle_s *next;
} cparticle_t;
#define DEFAULT_NUM_PARTICLES 2048
#define ABSOLUTE_MIN_PARTICLES 512
#define ABSOLUTE_MAX_PARTICLES 8192
static int r_numparticles;
static cparticle_t *particles, *active_particles, *free_particles;
static int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
static int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
static int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
//obtains an index for the name, even if it is unknown (one can be loaded after. will only fail if the effect limit is reached)
//technically this function is not meant to fail often, but thats fine so long as the other functions are meant to safely reject invalid effect numbers.
static int PClassic_ParticleTypeForName(char *name)
{
if (!stricmp("tr_rocket", name))
return ROCKET_TRAIL;
if (!stricmp("tr_altrocket", name))
return ALT_ROCKET_TRAIL;
if (!stricmp("tr_slightblood", name))
return BLOOD_TRAIL;
if (!stricmp("tr_grenade", name))
return GRENADE_TRAIL;
if (!stricmp("tr_blood", name))
return BIG_BLOOD_TRAIL;
if (!stricmp("tr_wizspike", name))
return TRACER1_TRAIL;
if (!stricmp("tr_knightspike", name))
return TRACER2_TRAIL;
if (!stricmp("tr_vorespike", name))
return VOOR_TRAIL;
if (!stricmp("te_tarexplosion", name))
return BLOBEXPLOSION_POINT;
if (!stricmp("te_lavasplash", name))
return LAVASPLASH_POINT;
if (!stricmp("te_lavasplash", name))
return LAVASPLASH_POINT;
if (!stricmp("te_explosion", name))
return EXPLOSION_POINT;
if (!stricmp("te_teleport", name))
return TELEPORTSPLASH_POINT;
return P_INVALID;
}
//returns a valid effect if both its existance is known, and it is fully functional
static int PClassic_FindParticleType(char *name)
{
return P_ParticleTypeForName(name);
}
//a convienience function.
static int PClassic_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name)
{
int efnum = P_FindParticleType(name);
return P_RunParticleEffectState(org, dir, count, efnum, NULL);
}
//DP extension: add particles within a box that look like rain or snow.
static void PClassic_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname)
{
}
//DP extension: add particles within a box.
static void PClassic_RunParticleCube(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, qboolean gravity, float jitter)
{
}
//hexen2 support: add particles flying out from a point with a randomized speed
static void PClassic_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count)
{
}
//hexen2 support: add particles within a box.
static void PClassic_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count)
{
}
//hexen2 support: add particles around the spot in a radius. no idea what the 'effect' field is.
static void PClassic_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count)
{
}
//this function is used as a fallback in case a trail effect is unknown.
static void PClassic_ParticleTrailIndex (vec3_t start, vec3_t end, int color, int crnd, trailstate_t **tsk)
{
}
//this function is called to tell the particle system about surfaces that might emit particles at map startup.
static void PClassic_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
{
}
//the one-time initialisation function, called no mater which renderer is active.
static void PClassic_InitParticles (void)
{
int i;
if ((i = COM_CheckParm ("-particles")) && i + 1 < com_argc) {
r_numparticles = (int) (Q_atoi(com_argv[i + 1]));
r_numparticles = bound(ABSOLUTE_MIN_PARTICLES, r_numparticles, ABSOLUTE_MAX_PARTICLES);
} else {
r_numparticles = DEFAULT_NUM_PARTICLES;
}
particles = (cparticle_t *) BZ_Malloc (r_numparticles * sizeof(cparticle_t), "classic:particles");
CL_RegisterParticles();
}
static void PClassic_ShutdownParticles(void)
{
BZ_Free(particles);
}
//called when an entity is removed from the world, taking its trailstate with it.
static void PClassic_DelinkTrailstate(trailstate_t **tsk)
{
//classic has no concept of trail states.
}
//wipes all the particles ready for the next map.
static void PClassic_ClearParticles (void)
{
int i;
free_particles = &particles[0];
active_particles = NULL;
for (i = 0;i < r_numparticles; i++)
particles[i].next = &particles[i+1];
particles[r_numparticles - 1].next = NULL;
}
//draws all the active particles.
static void PClassic_DrawParticles(void)
{
RSpeedLocals();
cparticle_t *p, *kill;
int i;
float time2, time3, time1, dvel, frametime, grav;
#ifdef RGLQUAKE
unsigned char *at, theAlpha;
vec3_t up, right;
float dist, scale, r_partscale;
#endif
if (!active_particles)
return;
switch(qrenderer)
{
#ifdef RGLQUAKE
case QR_OPENGL:
r_partscale = 0.004 * tan (r_refdef.fov_x * (M_PI / 180) * 0.5f);
GL_Bind(particlecqtexture);
qglEnable (GL_BLEND);
if (!gl_solidparticles.value)
qglDepthMask (GL_FALSE);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qglBegin (GL_TRIANGLES);
VectorScale (vup, 1.5, up);
VectorScale (vright, 1.5, right);
break;
#endif
#ifdef SWQUAKE
case QR_SOFTWARE:
VectorScale (vright, xscaleshrink, r_pright);
VectorScale (vup, yscaleshrink, r_pup);
VectorCopy (vpn, r_ppn);
break;
#endif
default:
return;
}
frametime = host_frametime;
if (cl.paused)
frametime = 0;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;
grav = frametime * 800 * 0.05;
dvel = 4 * frametime;
while(1)
{
kill = active_particles;
if (kill && kill->die < cl.time)
{
active_particles = kill->next;
kill->next = free_particles;
free_particles = kill;
continue;
}
break;
}
for (p = active_particles; p ; p = p->next)
{
while (1)
{
kill = p->next;
if (kill && kill->die < cl.time)
{
p->next = kill->next;
kill->next = free_particles;
free_particles = kill;
continue;
}
break;
}
switch(qrenderer)
{
#ifdef RGLQUAKE
case QR_OPENGL:
// hack a scale up to keep particles from disapearing
dist = (p->org[0] - r_origin[0]) * vpn[0] + (p->org[1] - r_origin[1]) * vpn[1] + (p->org[2] - r_origin[2]) * vpn[2];
scale = 1 + dist * r_partscale;
at = (qbyte *) &d_8to24rgbtable[(int)p->color];
if (p->type == pt_fire)
theAlpha = 255 * (6 - p->ramp) / 6;
else
theAlpha = 255;
qglColor4ub (*at, *(at + 1), *(at + 2), theAlpha);
qglTexCoord2f (0, 0); qglVertex3fv (p->org);
qglTexCoord2f (1, 0); qglVertex3f (p->org[0] + up[0] * scale, p->org[1] + up[1] * scale, p->org[2] + up[2] * scale);
qglTexCoord2f (0, 1); qglVertex3f (p->org[0] + right[0] * scale, p->org[1] + right[1] * scale, p->org[2] + right[2] * scale);
break;
#endif
#ifdef SWQUAKE
case QR_SOFTWARE:
D_DrawParticleTrans (p->org, 1, 1, p->color, BM_BLEND);
break;
#endif
}
p->org[0] += p->vel[0] * frametime;
p->org[1] += p->vel[1] * frametime;
p->org[2] += p->vel[2] * frametime;
switch (p->type)
{
case pt_static:
break;
case pt_fire:
p->ramp += time1;
if (p->ramp >= 6)
p->die = -1;
else
p->color = ramp3[(int) p->ramp];
p->vel[2] += grav;
break;
case pt_explode:
p->ramp += time2;
if (p->ramp >=8)
p->die = -1;
else
p->color = ramp1[(int) p->ramp];
for (i = 0; i < 3; i++)
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav * 30;
break;
case pt_explode2:
p->ramp += time3;
if (p->ramp >=8)
p->die = -1;
else
p->color = ramp2[(int) p->ramp];
for (i = 0; i < 3; i++)
p->vel[i] -= p->vel[i] * frametime;
p->vel[2] -= grav * 30;
break;
case pt_blob:
for (i = 0; i < 3; i++)
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_blob2:
for (i = 0; i < 2; i++)
p->vel[i] -= p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_slowgrav:
case pt_grav:
p->vel[2] -= grav;
break;
}
}
switch(qrenderer)
{
#ifdef RGLQUAKE
case QR_OPENGL:
qglEnd ();
qglDisable (GL_BLEND);
qglDepthMask (GL_TRUE);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
qglColor3ub (255, 255, 255);
break;
#endif
default:
break;
}
//this... is hard to explain.
//please don't make me do so.
#ifdef RGLQUAKE
RSpeedRemark();
qglBegin(GL_QUADS);
RQ_RenderDistAndClear();
qglEnd();
RSpeedEnd(RSPEED_PARTICLESDRAW);
#endif
}
//called to set up the rendering state (opengl)
static void PClassic_FlushRenderer(void)
{
}
static void Classic_ParticleExplosion (vec3_t org)
{
int i, j;
cparticle_t *p;
for (i = 0; i < 1024; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = cl.time + 5;
p->color = ramp1[0];
p->ramp = rand() & 3;
if (i & 1)
{
p->type = pt_explode;
for (j = 0; j < 3; j++)
{
p->org[j] = org[j] + ((rand() % 32) - 16);
p->vel[j] = (rand() % 512) - 256;
}
}
else
{
p->type = pt_explode2;
for (j = 0; j < 3; j++)
{
p->org[j] = org[j] + ((rand() % 32) - 16);
p->vel[j] = (rand()%512) - 256;
}
}
}
}
static void Classic_BlobExplosion (vec3_t org)
{
int i, j;
cparticle_t *p;
for (i = 0; i < 1024; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = cl.time + 1 + (rand() & 8) * 0.05;
if (i & 1)
{
p->type = pt_blob;
p->color = 66 + rand() % 6;
for (j = 0; j < 3; j++)
{
p->org[j] = org[j] + ((rand() % 32) - 16);
p->vel[j] = (rand() % 512) - 256;
}
}
else
{
p->type = pt_blob2;
p->color = 150 + rand() % 6;
for (j = 0; j < 3; j++)
{
p->org[j] = org[j] + ((rand() % 32) - 16);
p->vel[j] = (rand() % 512) - 256;
}
}
}
}
static void Classic_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
{
int i, j, scale;
cparticle_t *p;
if (!dir)
dir = vec3_origin;
scale = (count > 130) ? 3 : (count > 20) ? 2 : 1;
for (i = 0; i < count; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = cl.time + 0.1 * (rand() % 5);
p->color = (color & ~7) + (rand() & 7);
p->type = pt_grav;
for (j = 0; j < 3; j++)
{
p->org[j] = org[j] + scale * ((rand() & 15) - 8);
p->vel[j] = dir[j] * 15;
}
}
}
static void Classic_LavaSplash (vec3_t org)
{
int i, j, k;
cparticle_t *p;
float vel;
vec3_t dir;
for (i = -16; i < 16; i++)
{
for (j = -16; j < 16; j++)
{
for (k = 0; k < 1; k++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = cl.time + 2 + (rand() & 31) * 0.02;
p->color = 224 + (rand() & 7);
p->type = pt_grav;
dir[0] = j * 8 + (rand() & 7);
dir[1] = i * 8 + (rand() & 7);
dir[2] = 256;
p->org[0] = org[0] + dir[0];
p->org[1] = org[1] + dir[1];
p->org[2] = org[2] + (rand() & 63);
VectorNormalizeFast (dir);
vel = 50 + (rand() & 63);
VectorScale (dir, vel, p->vel);
}
}
}
}
static void Classic_TeleportSplash (vec3_t org)
{
int i, j, k;
cparticle_t *p;
float vel;
vec3_t dir;
for (i = -16; i < 16; i += 4)
{
for (j = -16; j < 16; j += 4)
{
for (k = -24; k < 32; k += 4)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = cl.time + 0.2 + (rand() & 7) * 0.02;
p->color = 7 + (rand() & 7);
p->type = pt_grav;
dir[0] = j * 8;
dir[1] = i * 8;
dir[2] = k * 8;
p->org[0] = org[0] + i + (rand() & 3);
p->org[1] = org[1] + j + (rand() & 3);
p->org[2] = org[2] + k + (rand() & 3);
VectorNormalizeFast (dir);
vel = 50 + (rand() & 63);
VectorScale (dir, vel, p->vel);
}
}
}
}
static void Classic_ParticleTrail (vec3_t start, vec3_t end, vec3_t *trail_origin, effect_type_t type)
{
vec3_t point, delta, dir;
float len;
int i, j, num_particles;
cparticle_t *p;
static int tracercount;
VectorCopy (start, point);
VectorSubtract (end, start, delta);
if (!(len = VectorLength (delta)))
goto done;
VectorScale(delta, 1 / len, dir); //unit vector in direction of trail
switch (type) {
case ALT_ROCKET_TRAIL:
len /= 1.5; break;
case BLOOD_TRAIL:
len /= 6; break;
default:
len /= 3; break;
}
if (!(num_particles = (int) len))
goto done;
VectorScale (delta, 1.0 / num_particles, delta);
for (i = 0; i < num_particles && free_particles; i++) {
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
VectorClear (p->vel);
p->die = cl.time + 2;
switch(type) {
case GRENADE_TRAIL:
p->ramp = (rand() & 3) + 2;
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() % 6) - 3);
break;
case BLOOD_TRAIL:
p->type = pt_slowgrav;
p->color = 67 + (rand() & 3);
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() % 6) - 3);
break;
case BIG_BLOOD_TRAIL:
p->type = pt_slowgrav;
p->color = 67 + (rand() & 3);
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() % 6) - 3);
break;
case TRACER1_TRAIL:
case TRACER2_TRAIL:
p->die = cl.time + 0.5;
p->type = pt_static;
if (type == TRACER1_TRAIL)
p->color = 52 + ((tracercount & 4) << 1);
else
p->color = 230 + ((tracercount & 4) << 1);
tracercount++;
VectorCopy (point, p->org);
if (tracercount & 1) {
p->vel[0] = 90 * dir[1];
p->vel[1] = 90 * -dir[0];
} else {
p->vel[0] = 90 * -dir[1];
p->vel[1] = 90 * dir[0];
}
break;
case VOOR_TRAIL:
p->color = 9 * 16 + 8 + (rand() & 3);
p->type = pt_static;
p->die = cl.time + 0.3;
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() & 15) - 8);
break;
case ALT_ROCKET_TRAIL:
p->ramp = (rand() & 3);
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() % 6) - 3);
break;
case ROCKET_TRAIL:
default:
p->ramp = (rand() & 3);
p->color = ramp3[(int) p->ramp];
p->type = pt_fire;
for (j = 0; j < 3; j++)
p->org[j] = point[j] + ((rand() % 6) - 3);
break;
}
VectorAdd (point, delta, point);
}
done:
if (trail_origin)
VectorCopy(point, *trail_origin);
}
//builds a trail from here to there. The trail state can be used to remember how far you got last frame.
static int PClassic_ParticleTrail (vec3_t startpos, vec3_t end, int type, trailstate_t **tsk)
{
if (type == P_INVALID)
return 1;
Classic_ParticleTrail(startpos, end, NULL, type);
return 0;
}
//svc_tempentity support: this is the function that handles 'special' point effects.
//use the trail state so fast/slow frames keep the correct particle counts on certain every-frame effects
static int PClassic_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk)
{
switch(typenum)
{
case BLOBEXPLOSION_POINT:
Classic_BlobExplosion(org);
break;
case LAVASPLASH_POINT:
Classic_LavaSplash(org);
break;
case EXPLOSION_POINT:
Classic_ParticleExplosion(org);
break;
case TELEPORTSPLASH_POINT:
Classic_TeleportSplash(org);
break;
default:
return 1;
}
return 0;
}
//svc_particle support: add X particles with the given colour, velocity, and aproximate origin.
static void PClassic_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
{
Classic_RunParticleEffect(org, dir, color, count);
}
particleengine_t pe_classic =
{
"Classic",
NULL,
PClassic_ParticleTypeForName,
PClassic_FindParticleType,
PClassic_RunParticleEffectTypeString,
PClassic_ParticleTrail,
PClassic_RunParticleEffectState,
PClassic_RunParticleWeather,
PClassic_RunParticleCube,
PClassic_RunParticleEffect,
PClassic_RunParticleEffect2,
PClassic_RunParticleEffect3,
PClassic_RunParticleEffect4,
PClassic_ParticleTrailIndex,
PClassic_EmitSkyEffectTris,
PClassic_InitParticles,
PClassic_ShutdownParticles,
PClassic_DelinkTrailstate,
PClassic_ClearParticles,
PClassic_DrawParticles,
PClassic_FlushRenderer
};
#endif

87
engine/client/p_null.c Normal file
View File

@ -0,0 +1,87 @@
#include "quakedef.h"
#include "glquake.h"
#include "particles.h"
//obtains an index for the name, even if it is unknown (one can be loaded after. will only fail if the effect limit is reached)
static int PNULL_ParticleTypeForName(char *name)
{
Con_Printf("P_ParticleTypeForName %s\n", name);
return P_INVALID;
}
//returns a valid effect if its existance is known, even if simply referenced. This should be phased out.
static int PNULL_FindParticleType(char *name)
{
Con_Printf("P_FindParticleType %s\n", name);
return P_INVALID;
}
static int PNULL_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name){return 1;}
static int PNULL_ParticleTrail (vec3_t startpos, vec3_t end, int type, trailstate_t **tsk){return 1;}
static int PNULL_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk){return 1;}
static void PNULL_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname){}
static void PNULL_RunParticleCube(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, qboolean gravity, float jitter){}
static void PNULL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count){}
static void PNULL_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count){}
static void PNULL_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count){}
static void PNULL_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count){}
static void PNULL_ParticleTrailIndex (vec3_t start, vec3_t end, int color, int crnd, trailstate_t **tsk){}
static void PNULL_EmitSkyEffectTris(model_t *mod, msurface_t *fa){}
static void PNULL_InitParticles (void)
{
CL_RegisterParticles();
}
static void PNULL_ShutdownParticles(void)
{
}
static void PNULL_DelinkTrailstate(trailstate_t **tsk){}
static void PNULL_ClearParticles (void){}
static void PNULL_DrawParticles(void)
{
RSpeedLocals();
RSpeedRemark();
#ifdef GLQUAKE
qglBegin(GL_QUADS);
RQ_RenderDistAndClear();
qglEnd();
#endif
RSpeedEnd(RSPEED_PARTICLESDRAW);
}
static void PNULL_FlushRenderer(void)
{
}
particleengine_t pe_null =
{
"null",
"none",
PNULL_ParticleTypeForName,
PNULL_FindParticleType,
PNULL_RunParticleEffectTypeString,
PNULL_ParticleTrail,
PNULL_RunParticleEffectState,
PNULL_RunParticleWeather,
PNULL_RunParticleCube,
PNULL_RunParticleEffect,
PNULL_RunParticleEffect2,
PNULL_RunParticleEffect3,
PNULL_RunParticleEffect4,
PNULL_ParticleTrailIndex,
PNULL_EmitSkyEffectTris,
PNULL_InitParticles,
PNULL_ShutdownParticles,
PNULL_DelinkTrailstate,
PNULL_ClearParticles,
PNULL_DrawParticles,
PNULL_FlushRenderer
};

4340
engine/client/p_script.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -248,7 +248,11 @@ void PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//float isserver(void) = #60;
void PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef CLIENTONLY
G_FLOAT(OFS_RETURN) = false;
#else
G_FLOAT(OFS_RETURN) = sv.state != ss_dead;
#endif
}
//float clientstate(void) = #62;
@ -309,8 +313,12 @@ void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
pic = Draw_SafePicFromWad(str);
else
{
if (cls.state && !sv.active)
CL_CheckOrEnqueDownloadFile(str, str);
if (cls.state
#ifndef CLIENTONLY
&& !sv.active
#endif
)
CL_CheckOrEnqueDownloadFile(str, str, 0);
pic = Draw_SafeCachePic(str);
}
@ -397,6 +405,18 @@ void PF_CL_drawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
pos[0] += size[0];
}
}
void PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
PF_strlen(prinst, pr_globals);
// G_FLOAT(OFS_RETURN)*=8;
}
#define DRAWFLAG_NORMAL 0
#define DRAWFLAG_ADD 1
#define DRAWFLAG_MODULATE 2
#define DRAWFLAG_MODULATE2 3
#ifdef Q3SHADERS
void GLDraw_ShaderPic (int x, int y, int width, int height, shader_t *pic, float r, float g, float b, float a);
#endif
@ -451,6 +471,67 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 1;
}
void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
char *picname = PR_GetStringOfs(prinst, OFS_PARM2);
float *srcPos = G_VECTOR(OFS_PARM3);
float *srcSize = G_VECTOR(OFS_PARM4);
float *rgb = G_VECTOR(OFS_PARM5);
float alpha = G_FLOAT(OFS_PARM6);
int flag = (int) G_FLOAT(OFS_PARM7);
mpic_t *p;
if(pos[2] || size[2])
Con_Printf("VM_drawsubpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
#ifdef Q3SHADERS
shader_t *s;
s = R_RegisterCustom(picname, NULL);
if (s)
{
GLDraw_ShaderPic(pos[0], pos[1], size[0], size[1], s, rgb[0], rgb[1], rgb[2], alpha);
return;
}
#endif
if (flag == 1) //add
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
else if(flag == 2) //modulate
qglBlendFunc(GL_DST_COLOR, GL_ZERO);
else if(flag == 3) //modulate*2
qglBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else //blend
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
#endif
p = Draw_SafeCachePic(picname);
if (Draw_ImageColours)
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
if (Draw_Image)
Draw_Image( pos[0], pos[1],
size[0], size[1],
srcPos[0], srcPos[1],
srcPos[0]+srcSize[0], srcPos[1]+srcSize[1],
p);
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif
G_FLOAT(OFS_RETURN) = 1;
}
//float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -582,7 +663,8 @@ void PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
break;
case 2:
// key_menu
key_dest = key_menu;
if (key_dest != key_console)
key_dest = key_menu;
m_state = m_menu_dat;
break;
case 1:
@ -737,6 +819,8 @@ void PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_global
switch(hcg)
{
case SLIST_HOSTCACHEVIEWCOUNT:
CL_QueryServers();
NET_CheckPollSockets();
G_FLOAT(OFS_RETURN) = Master_NumSorted();
return;
case SLIST_HOSTCACHETOTALCOUNT:
@ -791,6 +875,7 @@ void PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_gl
//void resorthostcache(void) = #618;
void PF_M_resorthostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_SortServers();
}
//void sethostcachesort(float fld, float descending) = #619;
void PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -1250,11 +1335,51 @@ builtin_t menu_builtins[] = {
//100
skip100
//200
skip100
skip10
skip10
//220
skip1
PF_strstrofs, // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
PF_str2chr, // #222 float(string str, float ofs) str2chr (FTE_STRINGS)
PF_chr2str, // #223 string(float c, ...) chr2str (FTE_STRINGS)
PF_strconv, // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS)
PF_strpad, // #225 string(float chars, string s, ...) strpad (FTE_STRINGS)
PF_infoadd, // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS)
PF_infoget, // #227 string(string info, string key) infoget (FTE_STRINGS)
PF_strncmp, // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
PF_strncasecmp, // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
//230
PF_strncasecmp, // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
skip1
skip1
skip1
skip1
skip1
skip1
skip1
skip1
skip1
//240
skip10
skip50
//300
skip100
//400
skip50
skip10
skip10
skip10
skip10
//440
PF_buf_create, // #440 float() buf_create (DP_QC_STRINGBUFFERS)
PF_buf_del, // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
PF_buf_getsize, // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
PF_buf_copy, // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
PF_buf_sort, // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
PF_buf_implode, // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
PF_bufstr_get, // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
PF_bufstr_set, // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
PF_bufstr_add, // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
PF_bufstr_free, // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
//450
PF_Fixme,//0
PF_CL_is_cached_pic,//1
@ -1268,24 +1393,82 @@ builtin_t menu_builtins[] = {
PF_CL_drawresetcliparea,//9
//460
PF_CL_drawgetimagesize,//10
skip1
skip1
skip1
skip1
skip1
skip1
skip1
skip1
skip1
PF_CL_drawgetimagesize,//460
PF_cin_open, // #461
PF_cin_close, // #462
PF_cin_setstate, // #463
PF_cin_getstate, // #464
PF_cin_restart, // #465
PF_drawline, // #466
PF_drawcolorcodedstring, // #467
PF_CL_stringwidth, // #468
PF_CL_drawsubpic, // #469
//470
skip10
skip1 // #470
PF_asin, // #471
PF_acos, // #472
PF_atan, // #473
PF_atan2, // #474
PF_tan, // #475
PF_strlennocol, // #476
PF_strdecolorize, // #477
PF_strftime, // #478
PF_tokenizebyseparator, // #479
//480
skip10
PF_strtolower, // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase
PF_strtoupper, // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase
skip1 // #482
skip1 // #483
PF_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
PF_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
skip1 // #486
PF_gecko_create, // #487 float gecko_create( string name )
PF_gecko_destroy, // #488 void gecko_destroy( string name )
PF_gecko_navigate, // #489 void gecko_navigate( string name, string URI )
//490
skip10
PF_gecko_keyevent, // #490 float gecko_keyevent( string name, float key, float eventtype )
PF_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y )
PF_gecko_resize, // #492 void gecko_resize( string name, float w, float h )
PF_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name )
PF_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
PF_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE)
skip1 // #496
skip1 // #497
skip1 // #498
skip1 // #499
//500
skip100
skip1 // #500
skip1 // #501
skip1 // #502
PF_whichpack, // #503 string(string) whichpack = #503;
skip1 // #504
skip1 // #505
skip1 // #506
skip1 // #507
skip1 // #508
skip1 // #509
//510
PF_uri_escape, // #510 string(string in) uri_escape = #510;
PF_uri_unescape, // #511 string(string in) uri_unescape = #511;
PF_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
PF_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET)
skip1 // #514
skip1 // #515
skip1 // #516
skip1 // #517
skip1 // #518
skip1 // #519
//520
skip10
skip10
skip10
skip50
//600
skip1
PF_cl_setkeydest,
@ -1458,7 +1641,7 @@ void MP_Init (void)
menuprogparms.gametime = &menutime;
menuprogparms.sv_edicts = (edict_t **)&menu_edicts;
menuprogparms.sv_edicts = (struct edict_s **)&menu_edicts;
menuprogparms.sv_num_edicts = &num_menu_edicts;
menuprogparms.useeditor = NULL;//sorry... QCEditor;//void (*useeditor) (char *filename, int line, int nump, char **parms);
@ -1539,6 +1722,8 @@ void MP_Reload_f(void)
void MP_RegisterCvarsAndCmds(void)
{
PF_Common_RegisterCvars();
Cmd_AddCommand("coredump_menuqc", MP_CoreDump_f);
Cmd_AddCommand("menu_restart", MP_Reload_f);

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@ typedef enum {
RT_MAX_REF_ENTITY_TYPE
} refEntityType_t;
#define MAX_BONE_CONTROLLERS 5
typedef struct entity_s
{
int keynum; // for matching entities in different frames
@ -68,14 +69,10 @@ typedef struct entity_s
vec3_t oldangles;
struct model_s *model; // NULL = no model
int frame;
int skinnum; // for Alias models
struct player_info_s *scoreboard; // identify player
float frame1time;
float frame2time;
struct efrag_s *efrag; // linked list of efrags (FIXME)
int visframe; // last frame this entity was
// found in an active leaf
@ -90,7 +87,24 @@ typedef struct entity_s
// that splits bmodel, or NULL if
// not split
float bonecontrols[4];
int frame1;
int frame2;
float frame1time;
float frame2time;
float lerpfrac;
#ifdef HALFLIFEMODELS
float subblendfrac; //hl models are weird
float bonecontrols[MAX_BONE_CONTROLLERS]; //hl special bone controllers
float basesubblendfrac;//hl models are weird
#endif
int baseframe1; //used to control legs animations
int baseframe2;
float baseframe1time;
float baseframe2time;
float baselerpfrac;//
int basebone; //the base frame fills bones up to this one (thus if 0, base sequence is not used).
int flags;
@ -114,8 +128,6 @@ typedef struct entity_s
#ifdef SWQUAKE
struct palremap_s *palremap;
#endif
float lerpfrac;
int oldframe;
} entity_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!

View File

@ -705,7 +705,7 @@ void Renderer_Init(void)
Cmd_AddCommand("bul_make", R_BulletenForce_f);
P_InitParticles();
P_InitParticleSystem();
R_InitTextures();
RQ_Init();
}
@ -2216,7 +2216,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
float *pintervals, fullinterval, targettime, time;
psprite = currententity->model->cache.data;
frame = currententity->frame;
frame = currententity->frame1;
if ((frame >= psprite->numframes) || (frame < 0))
{
@ -2368,7 +2368,7 @@ texture_t *R_TextureAnimation (texture_t *base)
int reletive;
int count;
if (currententity->frame)
if (currententity->frame1)
{
if (base->alternate_anims)
base = base->alternate_anims;

View File

@ -1,3 +1,6 @@
#ifndef RENDERQUE_H
#define RENDERQUE_H
void RQ_AddDistReorder(void (*render) (void *, void *), void *data1, void *data2, float *pos);
void RQ_RenderDistAndClear(void);
@ -9,3 +12,5 @@ typedef struct renderque_s
void *data1;
void *data2;
} renderque_t;
#endif

View File

@ -29,6 +29,7 @@ cvar_t scr_scoreboard_newstyle = SCVAR("scr_scoreboard_newstyle", "1"); // New s
cvar_t scr_scoreboard_showfrags = SCVAR("scr_scoreboard_showfrags", "0");
cvar_t scr_scoreboard_teamscores = SCVAR("scr_scoreboard_teamscores", "1");
cvar_t scr_scoreboard_titleseperator = SCVAR("scr_scoreboard_titleseperator", "1");
cvar_t sbar_teamstatus = SCVAR("sbar_teamstatus", "1");
//===========================================
//rogue changed and added defines
@ -74,6 +75,8 @@ int sb_hexen2_cur_item;//hexen2 hud
qboolean sb_hexen2_extra_info;//show the extra stuff
float sb_hexen2_item_time;
qboolean sbar_parsingteamstatuses; //so we don't eat it if its not displayed
#define STAT_MINUS 10 // num frame for '-' stats digit
mpic_t *sb_nums[2][11];
mpic_t *sb_colon, *sb_slash;
@ -236,6 +239,17 @@ void Draw_FunString(int x, int y, unsigned char *str)
x += 8;
continue;
}
if (*str == '&' && str[1] == 'c')
{
// ezQuake color codes
if (ishexcode(str[2]) && ishexcode(str[3]) && ishexcode(str[4]))
{
// Just strip it for now
// TODO: Colorize the console properly
str += 5;
continue;
}
}
messedup:
Draw_ColouredCharacter (x, y, (*str++) | ext);
x += 8;
@ -1040,6 +1054,8 @@ void Sbar_Init (void)
Cvar_Register(&scr_scoreboard_teamscores, "Scoreboard settings");
Cvar_Register(&scr_scoreboard_titleseperator, "Scoreboard settings");
Cvar_Register(&sbar_teamstatus, "Status bar settings");
Cmd_AddCommand ("+showscores", Sbar_ShowScores);
Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
@ -1962,10 +1978,11 @@ void Sbar_Hexen2DrawExtra (int pnum)
float val;
char *pclassname[] = {
"Unknown",
"Barbarian",
"Crusader",
"Paladin",
"Assasin"
"Crusader",
"Necromancer",
"Assasin",
"Demoness"
};
if (!sb_hexen2_extra_info)
@ -2045,7 +2062,7 @@ void Sbar_Hexen2DrawExtra (int pnum)
}
}
Sbar_DrawPic(134, 50, Draw_CachePic(va("gfx/cport%d.lmp", pclass)));
Sbar_DrawPic(134, 50, Draw_SafeCachePic(va("gfx/cport%d.lmp", pclass)));
}
void Sbar_Hexen2DrawBasic(int pnum)
@ -2104,6 +2121,121 @@ void Sbar_Hexen2DrawBasic(int pnum)
Sbar_Hexen2DrawItem(pnum, 144, 3, sb_hexen2_cur_item);
}
void Sbar_DrawTeamStatus(void)
{
int p;
int y;
int track;
if (!sbar_teamstatus.value)
return;
y = -32;
track = Cam_TrackNum(0);
if (track == -1 || !cl.spectator)
track = cl.playernum[0];
for (p = 0; p < MAX_CLIENTS; p++)
{
if (cl.playernum[0] == p) //self is not shown
continue;
if (track == p) //nor is the person you are tracking
continue;
if (!*cl.players[p].teamstatus) //only show them if they have something. no blank lines thanks
continue;
if (strcmp(cl.players[p].team, cl.players[track].team))
continue;
if (*cl.players[p].name)
{
Sbar_DrawFunString (0, y, cl.players[p].teamstatus);
y-=8;
}
}
sbar_parsingteamstatuses = true;
}
qboolean Sbar_UpdateTeamStatus(player_info_t *player, char *status)
{
qboolean aswhite = false;
char *outb;
int outlen;
char *msgstart;
char *ledstatus;
if (*status != '\r')// && !(strchr(status, 0x86) || strchr(status, 0x87) || strchr(status, 0x88) || strchr(status, 0x89)))
{
if (*status != 'x' || status[1] != '\r')
return false;
status++;
}
if (*status == '\r')
{
while (*status == ' ' || *status == '\r')
status++;
ledstatus = status;
if (*(unsigned char*)ledstatus >= 0x86 && *(unsigned char*)ledstatus <= 0x89)
{
msgstart = strchr(status, ':');
if (!status)
return false;
if (msgstart)
status = msgstart+1;
else
ledstatus = NULL;
}
else
ledstatus = NULL;
}
else
ledstatus = NULL;
while (*status == ' ' || *status == '\r')
status++;
//fixme: handle { and } stuff (assume red?)
outb = player->teamstatus;
outlen = sizeof(player->teamstatus)-1;
if (ledstatus)
{
*outb++ = *ledstatus;
outlen--;
}
while(outlen>0 && *status)
{
if (*status == '{')
{
aswhite=true;
status++;
continue;
}
if (aswhite)
{
if (*status == '}')
{
aswhite = false;
status++;
continue;
}
*outb++ = *status++;
}
else
*outb++ = *status++|128;
outlen--;
}
*outb = '\0';
if (sbar_teamstatus.value == 2)
return sbar_parsingteamstatuses;
return false;
}
/*
===============
Sbar_Draw
@ -2121,6 +2253,8 @@ void Sbar_Draw (void)
if ((sb_updates >= vid.numpages) && !headsup)
return;
sbar_parsingteamstatuses = false;
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2)
@ -2263,6 +2397,8 @@ void Sbar_Draw (void)
#endif
if (sb_lines > 0)
Sbar_DrawTeamStatus();
if (sb_lines > 0 && cl.deathmatch)
Sbar_MiniDeathmatchOverlay ();

View File

@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int sb_lines; // scan lines to draw
void Sbar_Init (void);
struct player_info_s;
qboolean Sbar_UpdateTeamStatus(struct player_info_s *player, char *status);
#ifdef RGLQUAKE
void Sbar_ReInit (void);
#endif

View File

@ -160,8 +160,8 @@ void Skin_Find (player_info_t *sc)
model = Mod_ForName(va("players/%s/tris.mdl", name), false);
else
#endif
model = Mod_ForName(va("models/players/%s.mdl", name), false);
if (model->type == mod_dummy)
model = NULL;//Mod_ForName(va("models/players/%s.mdl", name), false);
if (model && model->type == mod_dummy)
model = NULL;
*s = '/';
}
@ -533,7 +533,7 @@ void Skin_NextDownload (void)
if (strchr(sc->skin->name, ' ')) //skip over skins using a space
continue;
CL_CheckOrEnqueDownloadFile(va("skins/%s.pcx", sc->skin->name), NULL);
CL_CheckOrEnqueDownloadFile(va("skins/%s.pcx", sc->skin->name), NULL, 0);
}
// now load them in for real

View File

@ -190,6 +190,16 @@ int OV_DecodeSome(sfx_t *s, int minlength)
bytesread = p_ov_read(&dec->vf, dec->mediatemprecode, decodesize, bigendianp, 2, 1, &current_section);
if (bytesread <= 0)
{
if (bytesread != 0) //0==eof
{
Con_Printf("ogg decoding failed\n");
return 1;
}
return 0;
}
SND_ResampleStream(dec->mediatemprecode,
dec->srcspeed,
2,

View File

@ -385,7 +385,7 @@ void *Sys_GetGameAPI(void *parms)
else
snprintf(name, sizeof(name), "%s/%s/%s", curpath, searchpath, gamename);
game_library = dlopen (name, RTLD_LAZY );
game_library = dlopen (name, RTLD_LAZY);
if (game_library)
{
GetGameAPI = (void *)dlsym (game_library, "GetGameAPI");
@ -402,6 +402,34 @@ void *Sys_GetGameAPI(void *parms)
return 0;
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
dlclose((void*)lib)
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
HMODULE lib;
lib = dlopen (name, RTLD_LAZY);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = dlsym(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
// =======================================================================
// Sleeps for microseconds
// =======================================================================

View File

@ -348,6 +348,34 @@ void Sys_UnloadGame(void)
}
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
dlclose((void*)lib)
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
HMODULE lib;
lib = dlopen (name, RTLD_LAZY);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = dlsym(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
int main(int argc, char **argv)
{
double oldtime, newtime;

View File

@ -5,6 +5,8 @@
#include <SDL_thread.h>
#endif
#include <SDL_loadso.h>
#ifndef WIN32
#include <fcntl.h>
@ -149,6 +151,33 @@ void *Sys_GetGameAPI (void *parms)
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
SDL_UnloadObject((void*)lib)
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
void *lib;
lib = SDL_LoadObject(name);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = SDL_LoadFunction(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
//used to see if a file exists or not.

View File

@ -38,6 +38,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
void Sys_CloseLibrary(dllhandle_t *lib)
{
FreeLibrary((HMODULE)lib);
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
HMODULE lib;
lib = LoadLibrary(name);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = GetProcAddress(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
static HINSTANCE game_library;
@ -457,7 +485,7 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
DWORD flOldProtect;
//@@@ copy on write or just read-write?
if (!VirtualProtect((LPVOID)startaddr, length, PAGE_READWRITE, &flOldProtect))
if (!VirtualProtect((LPVOID)startaddr, length, PAGE_EXECUTE_READWRITE, &flOldProtect))
{
char str[1024];

View File

@ -65,8 +65,8 @@ static void Validation_Version(void)
{
char sr[256];
char *s = sr;
char *auth = "";
char authbuf[256];
char *auth = authbuf;
extern cvar_t r_shadow_realtime_world, r_drawflat;

View File

@ -1198,7 +1198,7 @@ void V_CalcRefdef (int pnum)
view->model = NULL;
else
view->model = cl.model_precache[cl.stats[pnum][STAT_WEAPON]];
view->frame = view_message?view_message->weaponframe:0;
view->frame1 = view_message?view_message->weaponframe:0;
#ifdef SWQUAKE
view->palremap = D_IdentityRemap();
#endif

View File

@ -584,7 +584,7 @@ qboolean Wad_NextDownload (void)
if (wadname[9])
{
if (COM_FCheckExists(wadname+9)) //wad is in root dir, so we don't need to try textures.
CL_CheckOrEnqueDownloadFile(wadname, wadname);
CL_CheckOrEnqueDownloadFile(wadname, wadname, DLLF_REQUIRED); //don't skip this one, or the world is white.
}
wads[i] = k;

View File

@ -76,6 +76,7 @@ void TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue);
TP_CVAR(cl_parseSay, "1"); \
TP_CVAR(cl_parseFunChars, "1"); \
TP_CVAR(cl_triggers, "1"); \
TP_CVAR(tp_autostatus, "$name $location"); /* things which will not always change, but are useful */ \
TP_CVAR(tp_forceTriggers, "0"); \
TP_CVAR(tp_loadlocs, "1"); \
TP_CVARC(cl_teamskin, "", TP_SkinCvar_Callback); \
@ -170,6 +171,7 @@ TP_CVARS;
extern cvar_t host_mapname;
void TP_UpdateAutoStatus(void);
static void TP_FindModelNumbers (void);
static void TP_FindPoint (void);
char *TP_LocationName (vec3_t location);
@ -179,6 +181,9 @@ char *TP_LocationName (vec3_t location);
// this structure is cleared after entering a new map
typedef struct tvars_s {
char autoteamstatus[256];
float autoteamstatus_time;
int health;
int items;
int olditems;
@ -1084,7 +1089,7 @@ char *Macro_CombinedHealth(void)
//work out the max useful armour
//this will under-exagurate, due to usage of ceil based on damage
m = h/(1-t);
if (a > m)
if (a > m && m > 0)
a = m;
h = h + a;
@ -2006,6 +2011,7 @@ void TP_NewMap (void)
strlcpy (last_map, "", sizeof(last_map));
}
TP_UpdateAutoStatus();
TP_ExecTrigger ("f_newmap");
}
@ -2061,14 +2067,28 @@ int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr)
*plr = player;
}
// check messagemode2
else if (s[0] == '(' && len+4 <= msglen && !cl.spectator &&
else if (s[0] == '(' && len+4 <= msglen &&
!strncmp(s+len+1, "): ", 3) &&
!strncmp(name, s+1, len))
{
// no team messages in teamplay 0, except for our own
if (i == cl.playernum[SP] || ( cl.teamplay &&
!strcmp(cl.players[cl.playernum[SP]].team, player->team)) )
flags |= TPM_TEAM;
if (cl.spectator)
{
unsigned int track = Cam_TrackNum(0);
if (i == track || ( cl.teamplay &&
!strcmp(cl.players[track].team, player->team)) )
{
flags |= TPM_OBSERVEDTEAM;
}
}
else
{
if (i == cl.playernum[SP] || ( cl.teamplay &&
!strcmp(cl.players[cl.playernum[SP]].team, player->team)) )
{
flags |= TPM_TEAM;
}
}
*offset = len + 4;
*plr = player;
@ -2997,6 +3017,43 @@ nothing:
}
void TP_UpdateAutoStatus(void)
{
char newstatusbuf[sizeof(vars.autoteamstatus)];
char *newstatus;
if (vars.autoteamstatus_time < realtime)
return;
newstatus = Cmd_ExpandString(tp_autostatus.string, newstatusbuf, sizeof(newstatusbuf), tp_autostatus.restriction, true, true);
newstatus = TP_ParseMacroString(newstatus);
if (!strcmp(newstatus, vars.autoteamstatus))
return;
if (!*vars.autoteamstatus && !vars.health)
{
if (cls.state != ca_active)
strcpy(vars.autoteamstatus, newstatus);
return; //don't start it with a death (stops spamming of locations when we originally connect, before spawning)
}
strcpy(vars.autoteamstatus, newstatus);
if (strchr(tp_autostatus.string, ';'))
return; //don't take risks
if (tp_autostatus.latched_string)
return;
if (cl.spectator) //don't spam as spectators, that's just silly
return;
if (!cl.teamplay) //don't spam in deathmatch, that's just pointless
return;
//the tp code will reexpand it as part of the say team
Cbuf_AddText(va("say_team $\\%s\n", tp_autostatus.string), RESTRICT_LOCAL);
vars.autoteamstatus_time = realtime + 3;
}
void TP_StatChanged (int stat, int value)
{
int i;
@ -3013,10 +3070,8 @@ void TP_StatChanged (int stat, int value)
if (!cl.spectator && CountTeammates())
TP_ExecTrigger ("f_respawn");
}
vars.health = value;
return;
}
if (vars.health > 0)
else if (vars.health > 0)
{ // We have just died
vars.droppedweapon = cl.stats[SP][STAT_ACTIVEWEAPON];
@ -3068,6 +3123,8 @@ void TP_StatChanged (int stat, int value)
}
vars.stat_framecounts[stat] = cls.framecount;
TP_UpdateAutoStatus();
}
@ -3430,6 +3487,7 @@ void CL_SayMe_f (void)
void CL_SayTeam_f (void)
{
vars.autoteamstatus_time = realtime + 3;
CL_Say (true, NULL);
}
#endif

View File

@ -94,6 +94,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this.
#define PLUGINS
#define PSET_CLASSIC
#pragma message("temp")
#define CSQC_DAT
#define MENU_DAT
#ifndef SERVERONLY //don't be stupid, stupid.
#define CLIENTONLY
#endif
@ -135,14 +141,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VM_Q1 //q1 qvm gamecode interface
#define TCPCONNECT //a tcpconnect command, that allows the player to connect to tcp-encapsulated qw protocols.
#define IRCCONNECT //an ircconnect command, that allows the player to connect to irc-encapsulated qw protocols... yeah, really.
#define PLUGINS
#ifdef _DEBUG
// #define OFFSCREENGECKO
#endif
#define CSQC_DAT //support for csqc
#define MENU_DAT //support for menu.dat
#define Q3SHADERS
#define PSET_SCRIPT
#define PSET_CLASSIC
//#define PSET_DARKPLACES
// #define VOICECHAT //not added yet.
//these things were moved to plugins.
@ -180,6 +195,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef RUNTIMELIGHTING
#undef Q3SHADERS
#undef TERRAIN //not supported
#undef PSET_SCRIPT
#undef PSET_CLASSIC
#undef PSET_DARKPLACES
#endif
#ifdef CLIENTONLY //remove optional server components that make no sence on a client only build.
#undef Q2SERVER
@ -217,7 +236,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#if !defined(GLQUAKE)
#if !defined(GLQUAKE) && !defined(SERVERONLY)
#undef Q3BSPS
#endif
#if !defined(Q3BSPS)

View File

@ -1372,7 +1372,52 @@ void Cmd_TokenizeString (char *text, qboolean expandmacros, qboolean qctokenize)
cmd_argc++;
}
}
}
void Cmd_TokenizePunctation (char *text, char *punctuation)
{
int i;
// clear the args from the last string
for (i=0 ; i<cmd_argc ; i++)
Z_Free (cmd_argv[i]);
cmd_argc = 0;
Cmd_Args_Set(NULL);
while (1)
{
// skip whitespace up to a \n
while (*text && (unsigned)*text <= ' ' && *text != '\n')
{
text++;
}
if (*text == '\n')
{ // a newline seperates commands in the buffer
text++;
break;
}
if (!*text)
return;
if (cmd_argc == 1)
{
Cmd_Args_Set(text);
}
text = COM_ParseToken (text, punctuation);
if (!text)
return;
if (cmd_argc < MAX_ARGS)
{
cmd_argv[cmd_argc] = (char*)Z_Malloc (Q_strlen(com_token)+1);
Q_strcpy (cmd_argv[cmd_argc], com_token);
cmd_argc++;
}
}
}
@ -2547,6 +2592,24 @@ void Cmd_set_f(void)
text = Cmd_Args();
if (*text == '\"') //if it's already quoted, dequote it, and ignore trailing stuff, for q2/q3 compatability
text = Cmd_Argv(1);
else
{
end = strstr(text, "//");
if (end)
{
*end--;
while (end >= text)
{
if (*end == ' ')
end--;
else
break;
}
end++;
*(char*)end = 0;
}
}
forceflags = 0;
}

View File

@ -107,6 +107,7 @@ void Alias_WipeStuffedAliaes(void);
void Cmd_AddMacro(char *s, char *(*f)(void), int disputableintentions);
void Cmd_TokenizePunctation (char *text, char *punctuation);
void Cmd_TokenizeString (char *text, qboolean expandmacros, qboolean qctokenize);
// Takes a null terminated string. Does not need to be /n terminated.
// breaks the string up into arg tokens.

File diff suppressed because it is too large Load Diff

View File

@ -1,123 +1,123 @@
#include "hash.h"
#include "shader.h"
#if defined(ZYMOTICMODELS) || defined(MD5MODELS)
#define SKELETALMODELS
#include <stdlib.h>
#endif
#define MAX_BONES 256
typedef struct {
int ofs_indexes;
int numindexes;
int ofs_trineighbours;
int numskins;
#ifndef SERVERONLY
int ofsskins;
#endif
qboolean sharesverts; //used with models with two shaders using the same vertex - use last mesh's verts
qboolean sharesbones; //use last mesh's bones (please, never set this on the first mesh!)
int numverts;
#ifndef SERVERONLY
int ofs_st_array;
#endif
int groups;
int groupofs;
int nextsurf;
#ifdef SKELETALMODELS
int numbones;
int ofsbones;
int numtransforms;
int ofstransforms;
#endif
//these exist only in the root mesh.
int numtagframes;
int numtags;
int ofstags;
} galiasinfo_t;
//frame is an index into this
typedef struct {
#ifdef SKELETALMODELS
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from their parent.
//this is actually bad, and can result in bones shortening as they interpolate.
#endif
qboolean loop;
int numposes;
float rate;
int poseofs;
char name[64];
} galiasgroup_t;
typedef struct {
int ofsverts;
#ifndef SERVERONLY
int ofsnormals;
#endif
vec3_t scale;
vec3_t scale_origin;
} galiaspose_t;
#ifdef SKELETALMODELS
typedef struct {
char name[32];
int parent;
} galiasbone_t;
typedef struct {
//skeletal poses refer to this.
int vertexindex;
int boneindex;
vec4_t org;
} galisskeletaltransforms_t;
#endif
//we can't be bothered with animating skins.
//We'll load up to four of them but after that you're on your own
#ifndef SERVERONLY
typedef struct {
int skinwidth;
int skinheight;
int ofstexels; //this is 8bit for frame 0 only. only valid in q1 models without replacement textures, used for colourising player skins.
float skinspeed;
int texnums;
int ofstexnums;
char name [MAX_QPATH];
} galiasskin_t;
typedef struct {
int base;
int bump;
#include "hash.h"
#include "shader.h"
#if defined(ZYMOTICMODELS) || defined(MD5MODELS)
#define SKELETALMODELS
#include <stdlib.h>
#endif
#define MAX_BONES 256
typedef struct {
int ofs_indexes;
int numindexes;
int ofs_trineighbours;
int numskins;
#ifndef SERVERONLY
int ofsskins;
#endif
qboolean sharesverts; //used with models with two shaders using the same vertex - use last mesh's verts
qboolean sharesbones; //use last mesh's bones (please, never set this on the first mesh!)
int numverts;
#ifndef SERVERONLY
int ofs_st_array;
#endif
int groups;
int groupofs;
int nextsurf;
#ifdef SKELETALMODELS
int numbones;
int ofsbones;
int numtransforms;
int ofstransforms;
#endif
//these exist only in the root mesh.
int numtagframes;
int numtags;
int ofstags;
} galiasinfo_t;
//frame is an index into this
typedef struct {
#ifdef SKELETALMODELS
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from their parent.
//this is actually bad, and can result in bones shortening as they interpolate.
#endif
qboolean loop;
int numposes;
float rate;
int poseofs;
char name[64];
} galiasgroup_t;
typedef struct {
int ofsverts;
#ifndef SERVERONLY
int ofsnormals;
#endif
vec3_t scale;
vec3_t scale_origin;
} galiaspose_t;
#ifdef SKELETALMODELS
typedef struct {
char name[32];
int parent;
} galiasbone_t;
typedef struct {
//skeletal poses refer to this.
int vertexindex;
int boneindex;
vec4_t org;
} galisskeletaltransforms_t;
#endif
//we can't be bothered with animating skins.
//We'll load up to four of them but after that you're on your own
#ifndef SERVERONLY
typedef struct {
int skinwidth;
int skinheight;
int ofstexels; //this is 8bit for frame 0 only. only valid in q1 models without replacement textures, used for colourising player skins.
float skinspeed;
int texnums;
int ofstexnums;
char name [MAX_QPATH];
} galiasskin_t;
typedef struct {
int base;
int bump;
int fullbright;
int upperoverlay;
int loweroverlay;
#ifdef Q3SHADERS
shader_t *shader;
#endif
} galiastexnum_t;
typedef struct {
char name[MAX_QPATH];
galiastexnum_t texnum;
int loweroverlay;
#ifdef Q3SHADERS
shader_t *shader;
#endif
} galiastexnum_t;
typedef struct {
char name[MAX_QPATH];
galiastexnum_t texnum;
unsigned int tcolour;
unsigned int bcolour;
int skinnum;
bucket_t bucket;
} galiascolourmapped_t;
#endif
unsigned int bcolour;
int skinnum;
bucket_t bucket;
} galiascolourmapped_t;
#endif

View File

@ -45,6 +45,7 @@ static char *safeargvs[NUM_SAFE_ARGVS] =
{"-stdvid", "-nolan", "-nosound", "-nocdaudio", "-nojoy", "-nomouse"};
cvar_t registered = SCVAR("registered","0");
cvar_t gameversion = SCVAR("gameversion","0");
cvar_t com_gamename = SCVAR("com_gamename", "");
qboolean com_modified; // set true if using non-id files
@ -2247,7 +2248,7 @@ char *COM_ParseToken (const char *data, const char *punctuation)
// skip whitespace
skipwhite:
while ( (c = *(unsigned char*)data) <= ' ')
while ( (c = *(unsigned char*)data) <= ' ' && c != '\r' && c != '\n')
{
if (c == 0)
{
@ -2257,6 +2258,19 @@ skipwhite:
data++;
}
//if windows, ignore the \r.
if (c == '\r' && data[1] == '\n')
c = *(unsigned char*)data++;
if (c == '\r' || c == '\n')
{
com_tokentype = TTP_LINEENDING;
com_token[0] = '\n';
com_token[1] = '\0';
data++;
return (char*)data;
}
// skip // comments
if (c=='/')
{
@ -2271,12 +2285,14 @@ skipwhite:
data+=2;
while (*data && (*data != '*' || data[1] != '/'))
data++;
data+=2;
if (*data)
data++;
if (*data)
data++;
goto skipwhite;
}
}
// handle quoted strings specially
if (c == '\"')
{
@ -2667,6 +2683,7 @@ void COM_Init (void)
registered.string = "0";
Cvar_Register (&registered, "Copy protection");
Cvar_Register (&gameversion, "Gamecode");
@ -2718,8 +2735,92 @@ int memsearch (qbyte *start, int count, int search)
return -1;
}
struct effectinfo_s
{
struct effectinfo_s *next;
int index;
char name[1];
};
struct effectinfo_s *effectinfo;
void COM_Effectinfo_Reset(void)
{
int fidx = 0;
char *f;
struct effectinfo_s *n;
while(effectinfo)
{
n = effectinfo->next;
Z_Free(effectinfo);
effectinfo = n;
}
f = COM_LoadMallocFile("effectinfo.txt");
if (!f)
return;
while (*f)
{
f = COM_ParseToken(f, NULL);
if (strcmp(com_token, "\n"))
{
if (!strcmp(com_token, "effect"))
{
f = COM_ParseToken(f, NULL);
//don't count duplicates
for (n = effectinfo; n; n = n->next)
{
if (!strcmp(com_token, n->name))
break;
}
if (!n)
{
n = Z_Malloc(sizeof(*n) + strlen(com_token));
n->next = effectinfo;
n->index = ++fidx;
effectinfo = n;
strcpy(n->name, com_token);
}
}
do
{
f = COM_ParseToken(f, NULL);
} while(*f && strcmp(com_token, "\n"));
}
}
}
unsigned int COM_Effectinfo_ForName(char *efname)
{
struct effectinfo_s *e;
if (!effectinfo)
COM_Effectinfo_Reset();
for (e = effectinfo; e; e = e->next)
{
if (!strcmp(efname, e->name))
return e->index;
}
return 0;
}
char *COM_Effectinfo_ForNumber(unsigned int efnum)
{
struct effectinfo_s *e;
if (!effectinfo)
COM_Effectinfo_Reset();
for (e = effectinfo; e; e = e->next)
{
if (e->index == efnum)
return e->name;
}
return "";
}
/*

View File

@ -229,7 +229,7 @@ float Q_atof (char *str);
extern char com_token[1024];
typedef enum {TTP_UNKNOWN, TTP_STRING} com_tokentype_t;
typedef enum {TTP_UNKNOWN, TTP_STRING, TTP_LINEENDING} com_tokentype_t;
extern com_tokentype_t com_tokentype;
extern qboolean com_eof;
@ -289,11 +289,15 @@ typedef struct {
int offset;
int len;
} flocation_t;
struct vfsfile_s;
typedef enum {FSLFRT_IFFOUND, FSLFRT_LENGTH, FSLFRT_DEPTH_OSONLY, FSLFRT_DEPTH_ANYPATH} FSLF_ReturnType_e;
//if loc is valid, loc->search is always filled in, the others are filled on success.
//returns -1 if couldn't find.
int FS_FLocateFile(char *filename, FSLF_ReturnType_e returntype, flocation_t *loc);
struct vfsfile_s *FS_OpenReadLocation(flocation_t *location);
char *FS_WhichPackForLocation(flocation_t *loc);
char *FS_GetPackHashes(char *buffer, int buffersize, qboolean referencedonly);
char *FS_GetPackNames(char *buffer, int buffersize, qboolean referencedonly);
@ -374,6 +378,10 @@ void COM_EnumerateFiles (char *match, int (*func)(char *, int, void *), void *pa
extern struct cvar_s registered;
extern qboolean standard_quake; //fixme: remove
void COM_Effectinfo_Reset(void);
unsigned int COM_Effectinfo_ForName(char *efname);
char *COM_Effectinfo_ForNumber(unsigned int efnum);
#define MAX_INFO_KEY 64
char *Info_ValueForKey (char *s, const char *key);
void Info_RemoveKey (char *s, const char *key);

View File

@ -91,6 +91,17 @@ unsigned short QCRC_Block (qbyte *start, int count)
return crc;
}
unsigned short QCRC_Block_AsLower (qbyte *start, int count)
{
unsigned short crc;
QCRC_Init (&crc);
while (count--)
crc = (crc << 8) ^ crctable[(crc >> 8) ^ tolower(*start++)];
return crc;
}
void QCRC_AddBlock (unsigned short *crcvalue, qbyte *start, int count)
{
while (count--)

View File

@ -24,3 +24,4 @@ void QCRC_AddBlock (unsigned short *crcvalue, qbyte *start, int count);
void QCRC_ProcessByte(unsigned short *crcvalue, qbyte data);
unsigned short QCRC_Value(unsigned short crcvalue);
unsigned short QCRC_Block (qbyte *start, int count);
unsigned short QCRC_Block_AsLower (qbyte *start, int count);

View File

@ -1180,8 +1180,9 @@ void Cvar_Unhook(cvar_t *cvar)
void Cvar_ForceCallback(cvar_t *var)
{
if (var->callback)
var->callback(var, var->string);
if (var)
if (var->callback)
var->callback(var, var->string);
}
void Cvar_ApplyCallbacks(int callbackflag)

View File

@ -79,6 +79,7 @@ typedef struct cvar_s
#define SCVARF(ConsoleName,Value, Flags) FCVAR(ConsoleName, NULL, Value, Flags)
#define SCVARC(ConsoleName,Value,Callback) FCVARC(ConsoleName, NULL, Value, 0, Callback)
#define SCVAR(ConsoleName,Value) FCVAR(ConsoleName, NULL, Value, 0)
#define CVARDP4(Flags,ConsoleName,Value,Description) FCVAR(ConsoleName, NULL, Value, Flags)
typedef struct cvar_group_s
{
@ -113,6 +114,9 @@ typedef struct cvar_group_s
#define CVAR_LATCHMASK (CVAR_LATCH|CVAR_RENDERERLATCH|CVAR_SERVEROVERRIDE|CVAR_CHEAT|CVAR_SEMICHEAT) //you're only allowed one of these.
#define CVAR_NEEDDEFAULT CVAR_CHEAT
//an alias
#define CVAR_SAVE CVAR_ARCHIVE
cvar_t *Cvar_Get (const char *var_name, const char *value, int flags, const char *groupname);
void Cvar_LockFromServer(cvar_t *var, const char *str);

View File

@ -1324,6 +1324,7 @@ typedef struct searchpath_s
qboolean istemporary;
void *handle;
char purepath[256]; //server tracks the path used to load them so it can tell the client
int crc_check; //client sorts packs according to this checksum
int crc_reply; //client sends a different crc back to the server, for the paks it's actually loaded.
@ -1335,9 +1336,9 @@ searchpath_t *com_searchpaths;
searchpath_t *com_purepaths;
searchpath_t *com_base_searchpaths; // without gamedirs
static void COM_AddDataFiles(char *pathto, searchpath_t *search, char *extension, searchpathfuncs_t *funcs);
static void COM_AddDataFiles(char *purepath, char *pathto, searchpath_t *search, char *extension, searchpathfuncs_t *funcs);
searchpath_t *COM_AddPathHandle(char *probablepath, searchpathfuncs_t *funcs, void *handle, qboolean copyprotect, qboolean istemporary, unsigned int loadstuff)
searchpath_t *COM_AddPathHandle(char *purepath, char *probablepath, searchpathfuncs_t *funcs, void *handle, qboolean copyprotect, qboolean istemporary, unsigned int loadstuff)
{
searchpath_t *search;
@ -1346,6 +1347,7 @@ searchpath_t *COM_AddPathHandle(char *probablepath, searchpathfuncs_t *funcs, vo
search->istemporary = istemporary;
search->handle = handle;
search->funcs = funcs;
Q_strncpyz(search->purepath, purepath, sizeof(search->purepath));
search->next = com_searchpaths;
com_searchpaths = search;
@ -1355,19 +1357,19 @@ searchpath_t *COM_AddPathHandle(char *probablepath, searchpathfuncs_t *funcs, vo
//add any data files too
if (loadstuff & 2)
COM_AddDataFiles(probablepath, search, "pak", &packfilefuncs);//q1/hl/h2/q2
COM_AddDataFiles(purepath, probablepath, search, "pak", &packfilefuncs);//q1/hl/h2/q2
//pk2s never existed.
#ifdef AVAIL_ZLIB
if (loadstuff & 4)
COM_AddDataFiles(probablepath, search, "pk3", &zipfilefuncs); //q3 + offspring
COM_AddDataFiles(purepath, probablepath, search, "pk3", &zipfilefuncs); //q3 + offspring
if (loadstuff & 8)
COM_AddDataFiles(probablepath, search, "pk4", &zipfilefuncs); //q4
COM_AddDataFiles(purepath, probablepath, search, "pk4", &zipfilefuncs); //q4
//we could easily add zip, but it's friendlier not to
#endif
#ifdef DOOMWADS
if (loadstuff & 16)
COM_AddDataFiles(probablepath, search, "wad", &doomwadfilefuncs); //q4
COM_AddDataFiles(purepath, probablepath, search, "wad", &doomwadfilefuncs); //q4
#endif
return search;
@ -1703,6 +1705,7 @@ int FS_FLocateFile(char *filename, FSLF_ReturnType_e returntype, flocation_t *lo
}
else
len = 0;
com_file_copyprotected = search->copyprotected;
goto out;
}
depth += (search->funcs != &osfilefuncs || returntype == FSLFRT_DEPTH_ANYPATH);
@ -1723,6 +1726,7 @@ int FS_FLocateFile(char *filename, FSLF_ReturnType_e returntype, flocation_t *lo
}
else
len = 1;
com_file_copyprotected = search->copyprotected;
goto out;
}
depth += (search->funcs != &osfilefuncs || returntype == FSLFRT_DEPTH_ANYPATH);
@ -1752,6 +1756,21 @@ out:
return depth;
}
char *FS_WhichPackForLocation(flocation_t *loc)
{
char *ret;
if (!loc->search)
return NULL; //huh? not a valid location.
ret = strchr(loc->search->purepath, '/');
if (!ret)
return NULL;
ret++;
if (strchr(ret, '/'))
return NULL;
return ret;
}
char *FS_GetPackHashes(char *buffer, int buffersize, qboolean referencedonly)
{
@ -1783,7 +1802,31 @@ char *FS_GetPackHashes(char *buffer, int buffersize, qboolean referencedonly)
}
char *FS_GetPackNames(char *buffer, int buffersize, qboolean referencedonly)
{
return "";
searchpath_t *search;
buffersize--;
*buffer = 0;
if (com_purepaths)
{
for (search = com_purepaths ; search ; search = search->nextpure)
{
Q_strncatz(buffer, va("%s ", search->purepath), buffersize);
}
return buffer;
}
else
{
for (search = com_searchpaths ; search ; search = search->next)
{
if (!search->crc_check && search->funcs->GeneratePureCRC)
search->crc_check = search->funcs->GeneratePureCRC(search->handle, 0, 0);
if (search->crc_check)
{
Q_strncatz(buffer, va("%s ", search->purepath), buffersize);
}
}
return buffer;
}
}
@ -2067,6 +2110,7 @@ vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto)
if (strcmp(mode, "ab"))
return NULL; //urm, unable to write/append
//if there can only be one file (eg: write access) find out where it is.
switch (relativeto)
{
case FS_GAMEONLY: //OS access only, no paks
@ -2130,6 +2174,16 @@ vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto)
return NULL;
}
vfsfile_t *FS_OpenReadLocation(flocation_t *location)
{
if (location->search)
{
com_file_copyprotected = location->search->copyprotected;
return VFS_Filter(NULL, location->search->funcs->OpenVFS(location->search->handle, location, "rb"));
}
return NULL;
}
int FS_Rename2(char *oldf, char *newf, int oldrelativeto, int newrelativeto)
{
char oldfullname[MAX_OSPATH];
@ -2534,6 +2588,7 @@ typedef struct {
searchpathfuncs_t *funcs;
searchpath_t *parentpath;
char *parentdesc;
char *puredesc;
} wildpaks_t;
static int COM_AddWildDataFiles (char *descriptor, int size, void *vparam)
@ -2544,6 +2599,7 @@ static int COM_AddWildDataFiles (char *descriptor, int size, void *vparam)
searchpath_t *search;
pack_t *pak;
char pakfile[MAX_OSPATH];
char purefile[MAX_OSPATH];
flocation_t loc;
sprintf (pakfile, "%s%s", param->parentdesc, descriptor);
@ -2566,22 +2622,28 @@ static int COM_AddWildDataFiles (char *descriptor, int size, void *vparam)
return true;
sprintf (pakfile, "%s%s/", param->parentdesc, descriptor);
COM_AddPathHandle(pakfile, funcs, pak, true, false, (unsigned int)-1);
if (*param->puredesc)
snprintf (purefile, sizeof(purefile), "%s/%s", param->puredesc, descriptor);
else
Q_strncpyz(purefile, descriptor, sizeof(purefile));
COM_AddPathHandle(purefile, pakfile, funcs, pak, true, false, (unsigned int)-1);
return true;
}
static void COM_AddDataFiles(char *pathto, searchpath_t *search, char *extension, searchpathfuncs_t *funcs)
static void COM_AddDataFiles(char *purepath, char *pathto, searchpath_t *search, char *extension, searchpathfuncs_t *funcs)
{
//search is the parent
int i;
void *handle;
char pakfile[MAX_OSPATH];
char purefile[MAX_OSPATH];
vfsfile_t *vfs;
flocation_t loc;
wildpaks_t wp;
//first load all the numbered pak files
for (i=0 ; ; i++)
{
snprintf (pakfile, sizeof(pakfile), "pak%i.%s", i, extension);
@ -2596,13 +2658,16 @@ static void COM_AddDataFiles(char *pathto, searchpath_t *search, char *extension
if (!handle)
break;
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s/", pathto, i, extension);
COM_AddPathHandle(pakfile, funcs, handle, true, false, (unsigned int)-1);
snprintf (purefile, sizeof(pakfile), "%spak%i.%s", purepath, i, extension);
COM_AddPathHandle(purefile, pakfile, funcs, handle, true, false, (unsigned int)-1);
}
//now load the random ones
sprintf (pakfile, "*.%s", extension);
wp.funcs = funcs;
wp.parentdesc = pathto;
wp.parentpath = search;
wp.puredesc = purepath;
search->funcs->EnumerateFiles(search->handle, pakfile, COM_AddWildDataFiles, &wp);
}
@ -2624,7 +2689,7 @@ Sets com_gamedir, adds the directory to the head of the path,
then loads and adds pak1.pak pak2.pak ...
================
*/
void COM_AddGameDirectory (char *dir, unsigned int loadstuff)
void COM_AddGameDirectory (char *puredir, char *dir, unsigned int loadstuff)
{
searchpath_t *search;
@ -2650,7 +2715,7 @@ void COM_AddGameDirectory (char *dir, unsigned int loadstuff)
p = Z_Malloc(strlen(dir)+1);
strcpy(p, dir);
COM_AddPathHandle(va("%s/", dir), &osfilefuncs, p, false, false, loadstuff);
COM_AddPathHandle((*dir?puredir:""), va("%s/", dir), &osfilefuncs, p, false, false, loadstuff);
}
char *COM_NextPath (char *prevpath)
@ -2684,7 +2749,7 @@ char *COM_GetPathInfo (int i, int *crc)
searchpath_t *s;
static char name[MAX_OSPATH];
char adr[MAX_ADR_SIZE];
// char adr[MAX_ADR_SIZE];
char *protocol;
for (s=com_searchpaths ; s ; s=s->next)
@ -2696,11 +2761,13 @@ char *COM_GetPathInfo (int i, int *crc)
if (i) //too high.
return NULL;
/*
#ifdef WEBSERVER
if (httpserver.value)
protocol = va("http://%s/", NET_AdrToString(adr, sizeof(adr), net_local_sv_ipadr));
else
#endif
*/
protocol = "qw://";
*crc = 0;//s->crc;
@ -2767,12 +2834,13 @@ void COM_Gamedir (char *dir)
//
Cache_Flush ();
COM_AddGameDirectory(va("%s%s", com_quakedir, dir), (unsigned int)-1);
COM_AddGameDirectory(dir, va("%s%s", com_quakedir, dir), (unsigned int)-1);
if (*com_homedir)
COM_AddGameDirectory(va("%s%s", com_homedir, dir), (unsigned int)-1);
COM_AddGameDirectory(dir, va("%s%s", com_homedir, dir), (unsigned int)-1);
#ifndef SERVERONLY
if (!isDedicated)
{
char fn[MAX_OSPATH];
FILE *f;
@ -2799,6 +2867,8 @@ void COM_Gamedir (char *dir)
}
#endif
COM_Effectinfo_Reset();
Validation_FlushFileList(); //prevent previous hacks from making a difference.
//FIXME: load new palette, if different cause a vid_restart.
@ -2983,7 +3053,7 @@ void FS_ReloadPackFilesFlags(unsigned int reloadflags)
//a lame way to fix pure paks
#ifndef SERVERONLY
if (cls.state)
if (cls.state && com_purepaths)
{
CL_Disconnect_f();
CL_Reconnect_f();
@ -3018,7 +3088,7 @@ void FS_ReloadPackFilesFlags(unsigned int reloadflags)
com_base_searchpaths = com_searchpaths;
if (oldpaths->funcs == &osfilefuncs)
COM_AddGameDirectory(oldpaths->handle, reloadflags);
COM_AddGameDirectory(oldpaths->purepath, oldpaths->handle, reloadflags);
oldpaths->funcs->ClosePath(oldpaths->handle);
Z_Free(oldpaths);
@ -3233,7 +3303,7 @@ void COM_InitFilesystem (void)
{
do //use multiple -basegames
{
COM_AddGameDirectory (va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
COM_AddGameDirectory (com_argv[i+1], va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
i = COM_CheckNextParm ("-basegame", i);
}
@ -3242,17 +3312,17 @@ void COM_InitFilesystem (void)
else
{
if (gamemode_info[gamenum].dir1)
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir1), (unsigned int)-1);
COM_AddGameDirectory (gamemode_info[gamenum].dir1, va("%s%s", com_quakedir, gamemode_info[gamenum].dir1), (unsigned int)-1);
if (gamemode_info[gamenum].dir2)
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir2), (unsigned int)-1);
COM_AddGameDirectory (gamemode_info[gamenum].dir2, va("%s%s", com_quakedir, gamemode_info[gamenum].dir2), (unsigned int)-1);
if (gamemode_info[gamenum].dir3)
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir3), (unsigned int)-1);
COM_AddGameDirectory (gamemode_info[gamenum].dir3, va("%s%s", com_quakedir, gamemode_info[gamenum].dir3), (unsigned int)-1);
if (gamemode_info[gamenum].dir4)
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir4), (unsigned int)-1);
COM_AddGameDirectory (gamemode_info[gamenum].dir4, va("%s%s", com_quakedir, gamemode_info[gamenum].dir4), (unsigned int)-1);
}
if (*com_homedir)
COM_AddGameDirectory (va("%sfte", com_homedir), (unsigned int)-1);
COM_AddGameDirectory ("fte", va("%sfte", com_homedir), (unsigned int)-1);
// any set gamedirs will be freed up to here
com_base_searchpaths = com_searchpaths;
@ -3260,7 +3330,7 @@ void COM_InitFilesystem (void)
i = COM_CheckParm ("-game"); //effectivly replace with +gamedir x (But overridable)
if (i && i < com_argc-1)
{
COM_AddGameDirectory (va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
COM_AddGameDirectory (com_argv[i+1], va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
#ifndef CLIENTONLY
Info_SetValueForStarKey (svs.info, "*gamedir", com_argv[i+1], MAX_SERVERINFO_STRING);

View File

@ -1046,12 +1046,13 @@ void *Mod_LoadWall(char *name)
COM_FileBase(name, ln, sizeof(ln));
if (!CL_CheckOrEnqueDownloadFile(name, NULL))
return NULL;
wal = (void *)COM_LoadMallocFile (name);
if (!wal)
{
//they will download eventually...
CL_CheckOrEnqueDownloadFile(name, NULL, 0);
return NULL;
}
wal->width = LittleLong(wal->width);
wal->height = LittleLong(wal->height);

View File

@ -103,14 +103,15 @@ static int huffBitPos;
Huff_PrepareTree
============
*/
static ID_INLINE void Huff_PrepareTree( tree_t tree ) {
static ID_INLINE void Huff_PrepareTree(tree_t tree)
{
void **node;
memset( tree, 0, sizeof( tree_t ) );
memset(tree, 0, sizeof(tree_t));
// create first node
node = &tree[263];
tree[0] = (void*)(VALUE( tree[0] )+1);
tree[0] = (void*)(VALUE(tree[0])+1);
node[7] = NODE_NONE;
tree[2] = node;
@ -126,13 +127,15 @@ static ID_INLINE void Huff_PrepareTree( tree_t tree ) {
Huff_GetNode
============
*/
static ID_INLINE void **Huff_GetNode( void **tree ) {
static ID_INLINE void **Huff_GetNode(void **tree)
{
void **node;
int value;
node = (void**)tree[262];
if( !node ) {
value = VALUE( tree[1] )++;
if (!node)
{
value = VALUE(tree[1])++;
node = &tree[value + 6407];
return node;
}
@ -146,24 +149,27 @@ static ID_INLINE void **Huff_GetNode( void **tree ) {
Huff_Swap
============
*/
static ID_INLINE void Huff_Swap( void **tree1, void **tree2, void **tree3 ) {
static ID_INLINE void Huff_Swap(void **tree1, void **tree2, void **tree3)
{
void **a, **b;
a = (void**)tree2[2];
if( a ) {
if( a[0] == tree2 ) {
if (a)
{
if (a[0] == tree2)
a[0] = tree3;
} else {
else
a[1] = tree3;
}
} else {
tree1[2] = tree3;
}
else
tree1[2] = tree3;
b = (void**)tree3[2];
if( b ) {
if( b[0] == tree3 ) {
if (b)
{
if (b[0] == tree3)
{
b[0] = tree2;
tree2[2] = b;
tree3[2] = a;
@ -186,7 +192,8 @@ static ID_INLINE void Huff_Swap( void **tree1, void **tree2, void **tree3 ) {
Huff_SwapTrees
============
*/
static ID_INLINE void Huff_SwapTrees( void **tree1, void **tree2 ) {
static ID_INLINE void Huff_SwapTrees(void **tree1, void **tree2)
{
void **temp;
temp = (void**)tree1[3];
@ -197,33 +204,27 @@ static ID_INLINE void Huff_SwapTrees( void **tree1, void **tree2 ) {
tree1[4] = tree2[4];
tree2[4] = temp;
if( tree1[3] == tree1 ) {
if (tree1[3] == tree1)
tree1[3] = tree2;
}
if( tree2[3] == tree2 ) {
if (tree2[3] == tree2)
tree2[3] = tree1;
}
temp = (void**)tree1[3];
if( temp ) {
if (temp)
temp[4] = tree1;
}
temp = (void**)tree2[3];
if( temp ) {
if (temp)
temp[4] = tree2;
}
temp = (void**)tree1[4];
if( temp ) {
if (temp)
temp[3] = tree1;
}
temp = (void**)tree2[4];
if( temp ) {
if (temp)
temp[3] = tree2;
}
}
@ -232,7 +233,8 @@ static ID_INLINE void Huff_SwapTrees( void **tree1, void **tree2 ) {
Huff_DeleteNode
============
*/
static ID_INLINE void Huff_DeleteNode( void **tree1, void **tree2 ) {
static ID_INLINE void Huff_DeleteNode(void **tree1, void **tree2)
{
tree2[0] = tree1[262];
tree1[262] = tree2;
}
@ -242,54 +244,68 @@ static ID_INLINE void Huff_DeleteNode( void **tree1, void **tree2 ) {
Huff_IncrementFreq_r
============
*/
static void Huff_IncrementFreq_r( void **tree1, void **tree2 ) {
static void Huff_IncrementFreq_r(void **tree1, void **tree2)
{
void **a, **b;
if( !tree2 ) {
if (!tree2)
{
return;
}
a = (void**)tree2[3];
if( a ) {
if (a)
{
a = (void**)a[6];
if( a == tree2[6] ) {
if (a == tree2[6])
{
b = (void**)tree2[5];
if( b[0] != tree2[2] ) {
Huff_Swap( tree1, (void**)b[0], tree2 );
if (b[0] != tree2[2])
{
Huff_Swap(tree1, (void**)b[0], tree2);
}
Huff_SwapTrees( (void**)b[0], tree2 );
Huff_SwapTrees((void**)b[0], tree2);
}
}
a = (void**)tree2[4];
if( a && a[6] == tree2[6] ) {
if (a && a[6] == tree2[6])
{
b = (void**)tree2[5];
b[0] = a;
} else {
}
else
{
a = (void**)tree2[5];
a[0] = 0;
Huff_DeleteNode( tree1, (void**)tree2[5] );
Huff_DeleteNode(tree1, (void**)tree2[5]);
}
VALUE( tree2[6] )++;
VALUE(tree2[6])++;
a = (void**)tree2[3];
if( a && a[6] == tree2[6] ) {
if (a && a[6] == tree2[6])
{
tree2[5] = a[5];
} else {
a = Huff_GetNode( tree1 );
}
else
{
a = Huff_GetNode(tree1);
tree2[5] = a;
a[0] = tree2;
}
if( tree2[2] ) {
Huff_IncrementFreq_r( tree1, (void**)tree2[2] );
if (tree2[2])
{
Huff_IncrementFreq_r(tree1, (void**)tree2[2]);
if( tree2[4] == tree2[2] ) {
Huff_SwapTrees( tree2, (void**)tree2[2] );
if (tree2[4] == tree2[2])
{
Huff_SwapTrees(tree2, (void**)tree2[2]);
a = (void**)tree2[5];
if( a[0] == tree2 ) {
if (a[0] == tree2)
{
a[0] = (void**)tree2[2];
}
}
@ -303,39 +319,47 @@ Huff_AddReference
Insert 'ch' into the tree or increment it's frequency
============
*/
static void Huff_AddReference( void **tree, int ch ) {
static void Huff_AddReference(void **tree, int ch)
{
void **a, **b, **c, **d;
int value;
ch &= 255;
if( tree[ch + 5] ) {
Huff_IncrementFreq_r( tree, (void**)tree[ch + 5] );
if (tree[ch + 5])
{
Huff_IncrementFreq_r(tree, (void**)tree[ch + 5]);
return; // already added
}
value = VALUE( tree[0] )++;
value = VALUE(tree[0])++;
b = &tree[value * 8 + 263];
value = VALUE( tree[0] )++;
value = VALUE(tree[0])++;
a = &tree[value * 8 + 263];
a[7] = NODE_NEXT;
a[6] = NODE_START;
d = (void**)tree[3];
a[3] = d[3];
if( a[3] ) {
if (a[3])
{
d = (void**)a[3];
d[4] = a;
d = (void**)a[3];
if( d[6] == NODE_START ) {
if (d[6] == NODE_START)
{
a[5] = d[5];
} else {
d = Huff_GetNode( tree );
}
else
{
d = Huff_GetNode(tree);
a[5] = d;
d[0] = a;
}
} else {
d = Huff_GetNode( tree );
}
else
{
d = Huff_GetNode(tree);
a[5] = d;
d[0] = a;
@ -344,22 +368,28 @@ static void Huff_AddReference( void **tree, int ch ) {
d = (void**)tree[3];
d[3] = a;
a[4] = (void**)tree[3];
b[7] = NODE( ch );
b[7] = NODE(ch);
b[6] = NODE_START;
d = (void**)tree[3];
b[3] = d[3];
if( b[3] ) {
if (b[3])
{
d = (void**)b[3];
d[4] = b;
if( d[6] == NODE_START ) {
if (d[6] == NODE_START)
{
b[5] = d[5];
} else {
d = Huff_GetNode( tree );
}
else
{
d = Huff_GetNode(tree);
b[5] = d;
d[0] = a;
}
} else {
d = Huff_GetNode( tree );
}
else
{
d = Huff_GetNode(tree);
b[5] = d;
d[0] = b;
}
@ -371,13 +401,19 @@ static void Huff_AddReference( void **tree, int ch ) {
b[0] = NULL;
d = (void**)tree[3];
c = (void**)d[2];
if( c ) {
if( c[0] == tree[3] ) {
if (c)
{
if (c[0] == tree[3])
{
c[0] = a;
} else {
}
else
{
c[1] = a;
}
} else {
}
else
{
tree[2] = a;
}
@ -390,7 +426,7 @@ static void Huff_AddReference( void **tree, int ch ) {
d[2] = a;
tree[ch + 5] = b;
Huff_IncrementFreq_r( tree, (void**)a[2] );
Huff_IncrementFreq_r(tree, (void**)a[2]);
}
/*
@ -408,8 +444,10 @@ Huff_EmitBit
Put one bit into buffer
============
*/
static ID_INLINE void Huff_EmitBit( int bit, qbyte *buffer ) {
if( !(huffBitPos & 7) ) {
static ID_INLINE void Huff_EmitBit(int bit, qbyte *buffer)
{
if (!(huffBitPos & 7))
{
buffer[huffBitPos >> 3] = 0;
}
@ -424,7 +462,8 @@ Huff_GetBit
Read one bit from buffer
============
*/
static ID_INLINE int Huff_GetBit( qbyte *buffer ) {
static ID_INLINE int Huff_GetBit(qbyte *buffer)
{
int bit;
bit = buffer[huffBitPos >> 3] >> (huffBitPos & 7);
@ -438,22 +477,28 @@ static ID_INLINE int Huff_GetBit( qbyte *buffer ) {
Huff_EmitPathToByte
============
*/
static ID_INLINE void Huff_EmitPathToByte( void **tree, void **subtree, qbyte *buffer ) {
if( tree[2] ) {
Huff_EmitPathToByte( (void**)tree[2], tree, buffer );
static ID_INLINE void Huff_EmitPathToByte(void **tree, void **subtree, qbyte *buffer)
{
if (tree[2])
{
Huff_EmitPathToByte((void**)tree[2], tree, buffer);
}
if( !subtree ) {
if (!subtree)
{
return;
}
//
// emit tree walking control bits
//
if( tree[1] == subtree ) {
Huff_EmitBit( 1, buffer );
} else {
Huff_EmitBit( 0, buffer );
if (tree[1] == subtree)
{
Huff_EmitBit(1, buffer);
}
else
{
Huff_EmitBit(0, buffer);
}
}
@ -464,27 +509,34 @@ Huff_GetByteFromTree
Get one qbyte using dynamic or static tree
============
*/
static ID_INLINE int Huff_GetByteFromTree( void **tree, qbyte *buffer ) {
if( !tree ) {
static ID_INLINE int Huff_GetByteFromTree(void **tree, qbyte *buffer)
{
if (!tree)
{
return 0;
}
//
// walk through the tree until we get a value
//
while( tree[7] == NODE_NEXT ) {
if( !Huff_GetBit( buffer ) ) {
while (tree[7] == NODE_NEXT)
{
if (!Huff_GetBit(buffer))
{
tree = (void**)tree[0];
} else {
}
else
{
tree = (void**)tree[1];
}
if( !tree ) {
if (!tree)
{
return 0;
}
}
return VALUE( tree[7] );
return VALUE(tree[7]);
}
/*
@ -494,7 +546,8 @@ Huff_EmitByteDynamic
Emit one qbyte using dynamic tree
============
*/
static void Huff_EmitByteDynamic( void **tree, int value, qbyte *buffer ) {
static void Huff_EmitByteDynamic(void **tree, int value, qbyte *buffer)
{
void **subtree;
int i;
@ -502,9 +555,11 @@ static void Huff_EmitByteDynamic( void **tree, int value, qbyte *buffer ) {
// if qbyte was already referenced, emit path to it
//
subtree = (void**)tree[value + 5];
if( subtree ) {
if( subtree[2] ) {
Huff_EmitPathToByte( (void**)subtree[2], subtree, buffer );
if (subtree)
{
if (subtree[2])
{
Huff_EmitPathToByte((void**)subtree[2], subtree, buffer);
}
return;
}
@ -512,10 +567,11 @@ static void Huff_EmitByteDynamic( void **tree, int value, qbyte *buffer ) {
//
// qbyte was not referenced, just emit 8 bits
//
Huff_EmitByteDynamic( tree, NOT_REFERENCED, buffer );
Huff_EmitByteDynamic(tree, NOT_REFERENCED, buffer);
for( i=7 ; i>=0 ; i-- ) {
Huff_EmitBit( (value >> i) & 1, buffer );
for (i = 7; i >= 0; i--)
{
Huff_EmitBit((value >> i) & 1, buffer);
}
}
@ -536,7 +592,8 @@ Compress message using dynamic Huffman tree,
beginning from specified offset
============
*/
void Huff_EncryptPacket( sizebuf_t *msg, int offset ) {
void Huff_EncryptPacket(sizebuf_t *msg, int offset)
{
tree_t tree;
qbyte buffer[MAX_NQMSGLEN];
qbyte *data;
@ -545,26 +602,28 @@ void Huff_EncryptPacket( sizebuf_t *msg, int offset ) {
int i;
data = msg->data + offset;
inLen = msg->cursize - offset;
if( inLen <= 0 || inLen >= MAX_NQMSGLEN ) {
inLen = msg->cursize - offset;
if (inLen <= 0 || inLen >= MAX_NQMSGLEN)
{
return;
}
Huff_PrepareTree( tree );
Huff_PrepareTree(tree);
buffer[0] = inLen >> 8;
buffer[1] = inLen & 0xFF;
huffBitPos = 16;
for( i=0 ; i<inLen ; i++ ) {
Huff_EmitByteDynamic( tree, data[i], buffer );
Huff_AddReference( tree, data[i] );
for (i = 0; i < inLen; i++)
{
Huff_EmitByteDynamic(tree, data[i], buffer);
Huff_AddReference(tree, data[i]);
}
outLen = (huffBitPos >> 3) + 1;
msg->cursize = offset + outLen;
memcpy( data, buffer, outLen );
memcpy(data, buffer, outLen);
}
@ -576,7 +635,8 @@ Decompress message using dynamic Huffman tree,
beginning from specified offset
============
*/
void Huff_DecryptPacket( sizebuf_t *msg, int offset ) {
void Huff_DecryptPacket(sizebuf_t *msg, int offset)
{
tree_t tree;
qbyte buffer[MAX_NQMSGLEN];
qbyte *data;
@ -587,42 +647,48 @@ void Huff_DecryptPacket( sizebuf_t *msg, int offset ) {
data = msg->data + offset;
inLen = msg->cursize - offset;
if( inLen <= 0 ) {
if (inLen <= 0)
{
return;
}
Huff_PrepareTree( tree );
Huff_PrepareTree(tree);
outLen = (data[0] << 8) + data[1];
huffBitPos = 16;
if( outLen > msg->maxsize - offset ) {
if (outLen > msg->maxsize - offset)
{
outLen = msg->maxsize - offset;
}
for( i=0 ; i<outLen ; i++ ) {
if( (huffBitPos >> 3) > inLen ) {
for (i = 0; i < outLen; i++)
{
if ((huffBitPos >> 3) > inLen)
{
buffer[i] = 0;
break;
}
ch = Huff_GetByteFromTree( (void**)tree[2], data );
ch = Huff_GetByteFromTree((void**)tree[2], data);
if( ch == NOT_REFERENCED ) {
if (ch == NOT_REFERENCED)
{
ch = 0; // just read 8 bits
for( j=0 ; j<8 ; j++ ) {
for (j = 0 ; j < 8 ; j++)
{
ch <<= 1;
ch |= Huff_GetBit( data );
ch |= Huff_GetBit(data);
}
}
buffer[i] = ch;
Huff_AddReference( tree, ch );
Huff_AddReference(tree, ch);
}
msg->cursize = offset + outLen;
memcpy( data, buffer, outLen );
memcpy(data, buffer, outLen);
}
/*
@ -630,9 +696,10 @@ void Huff_DecryptPacket( sizebuf_t *msg, int offset ) {
Huff_EmitByte
============
*/
void Huff_EmitByte( int ch, qbyte *buffer, int *count ) {
void Huff_EmitByte(int ch, qbyte *buffer, int *count)
{
huffBitPos = *count;
Huff_EmitPathToByte( (void**)huffTree[ch + 5], NULL, buffer );
Huff_EmitPathToByte((void**)huffTree[ch + 5], NULL, buffer);
*count = huffBitPos;
}
@ -641,11 +708,12 @@ void Huff_EmitByte( int ch, qbyte *buffer, int *count ) {
Huff_GetByte
============
*/
int Huff_GetByte( qbyte *buffer, int *count ) {
int Huff_GetByte(qbyte *buffer, int *count)
{
int ch;
huffBitPos = *count;
ch = Huff_GetByteFromTree( (void**)huffTree[2], buffer );
ch = Huff_GetByteFromTree((void**)huffTree[2], buffer);
*count = huffBitPos;
return ch;
@ -657,19 +725,22 @@ static int madetable;
Huff_Init
============
*/
void Huff_Init( int *huffCounts ) {
void Huff_Init(int *huffCounts)
{
int i, j;
if (!huffCounts)
huffCounts = q3huffCounts;
// build empty tree
Huff_PrepareTree( huffTree );
Huff_PrepareTree(huffTree);
// add all pre-defined qbyte references
for( i=0 ; i<256 ; i++ ) {
for( j=0 ; j<huffCounts[i] ; j++ ) {
Huff_AddReference( huffTree, i );
for (i = 0; i < 256; i++)
{
for (j = 0; j < huffCounts[i]; j++)
{
Huff_AddReference(huffTree, i);
}
huffCounts[i] = LittleLong(huffCounts[i]);
}
@ -724,12 +795,13 @@ void Huff_CompressPacket( sizebuf_t *msg, int offset )
data = msg->data + offset;
inLen = msg->cursize - offset;
if( inLen <= 0 || inLen >= MAX_NQMSGLEN ) {
if (inLen <= 0 || inLen >= MAX_NQMSGLEN)
{
return;
}
outLen = 0;
for( i=0 ; i<inLen ; i++ )
for (i=0; i < inLen; i++)
{
if (i == MAX_NQMSGLEN)
Sys_Error("Compression became too large\n");
@ -742,7 +814,7 @@ void Huff_CompressPacket( sizebuf_t *msg, int offset )
if (outLen > inLen)
{
memmove( data+1, data, inLen );
memmove(data+1, data, inLen);
data[0] = 0x80; //this would have grown the packet.
msg->cursize+=1;
return; //cap it at only 1 qbyte growth.
@ -756,7 +828,7 @@ void Huff_CompressPacket( sizebuf_t *msg, int offset )
}
if (msg->cursize > msg->maxsize)
Sys_Error("Compression became too large\n");
memcpy( data, buffer, outLen );
memcpy(data, buffer, outLen);
}
/*
@ -767,7 +839,7 @@ Decompress message using loaded Huffman tree,
beginning from specified offset
============
*/
void Huff_DecompressPacket( sizebuf_t *msg, int offset )
void Huff_DecompressPacket(sizebuf_t *msg, int offset)
{
qbyte buffer[MAX_NQMSGLEN];
qbyte *data;
@ -780,7 +852,8 @@ void Huff_DecompressPacket( sizebuf_t *msg, int offset )
data = msg->data + offset;
inLen = msg->cursize - offset;
if( inLen <= 0 || inLen >= MAX_NQMSGLEN ) {
if (inLen <= 0 || inLen >= MAX_NQMSGLEN)
{
return;
}
@ -797,7 +870,7 @@ void Huff_DecompressPacket( sizebuf_t *msg, int offset )
}
outLen = 0;
for( i=0 ; outLen<inLen ; i++ )
for(i=0; outLen < inLen; i++)
{
if (i == MAX_NQMSGLEN)
Sys_Error("Decompression became too large\n");
@ -807,7 +880,8 @@ void Huff_DecompressPacket( sizebuf_t *msg, int offset )
msg->cursize = offset + i;
if (msg->cursize > msg->maxsize)
Sys_Error("Decompression became too large\n");
memcpy( msg->data + offset, buffer, i );
memcpy(msg->data + offset, buffer, i);
}
#endif

View File

@ -355,7 +355,7 @@ int VectorCompare (vec3_t v1, vec3_t v2)
return 1;
}
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
void VectorMA (const vec3_t veca, const float scale, const vec3_t vecb, vec3_t vecc)
{
vecc[0] = veca[0] + scale*vecb[0];
vecc[1] = veca[1] + scale*vecb[1];
@ -409,6 +409,23 @@ vec_t Length(vec3_t v)
return length;
}
float Q_rsqrt(float number)
{
int i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * (int *) &y; // evil floating point bit level hacking
i = 0x5f3759df - (i >> 1); // what the fuck?
y = * (float *) &i;
y = y * (threehalfs - (x2 * y * y)); // 1st iteration
// y = y * (threehalfs - (x2 * y * y)); // 2nd iteration, this can be removed
return y;
}
float VectorNormalize (vec3_t v)
{
float length, ilength;
@ -425,7 +442,17 @@ float VectorNormalize (vec3_t v)
}
return length;
}
void VectorNormalizeFast(vec3_t v)
{
float ilength;
ilength = Q_rsqrt(DotProduct(v, v));
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
void VectorInverse (vec3_t v)
@ -861,6 +888,12 @@ void Matrix4_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
}
void Matrix4x4_CreateTranslate (matrix4x4_t *out, float x, float y, float z)
{
memcpy(out, Matrix4_NewTranslation(x, y, z), sizeof(*out));
}
void Matrix4_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
{
float tempmat[16];

View File

@ -97,11 +97,13 @@ int GreatestCommonDivisor (int i1, int i2);
fixed16_t Invert24To16 (fixed16_t val);
vec_t Length (vec3_t v);
void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up);
float Q_rsqrt(float number);
//used for crosshair stuff.
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
void Matrix4_Identity(float *outm);
void Matrix4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1);
void Matrix4x4_CreateTranslate (matrix4x4_t *out, float x, float y, float z);
void Matrix4_ModelMatrixFromAxis (float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
void Matrix4_ModelViewMatrix (float *modelview, vec3_t viewangles, vec3_t vieworg);
void Matrix4_ModelViewMatrixFromAxis (float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
@ -121,9 +123,10 @@ void R_ConcatTransforms (matrix3x4 in1, matrix3x4 in2, matrix3x4 out);
void RotatePointAroundVector (vec3_t dst, const vec3_t dir, const vec3_t point, float degrees);
int VectorCompare (vec3_t v1, vec3_t v2);
void VectorInverse (vec3_t v);
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
void VectorMA (const vec3_t veca, const float scale, const vec3_t vecb, vec3_t vecc);
float VectorNormalize (vec3_t v); // returns vector length
vec_t VectorNormalize2 (vec3_t v, vec3_t out);
void VectorNormalizeFast(vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
void VectorTransform (const vec3_t in1, matrix3x4 in2, vec3_t out);
void VectorVectors (vec3_t forward, vec3_t right, vec3_t up);

View File

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PORT_ANY -1
typedef enum {NA_INVALID, NA_LOOPBACK, NA_IP, NA_IPV6, NA_IPX, NA_BROADCAST_IP, NA_BROADCAST_IP6, NA_BROADCAST_IPX} netadrtype_t;
typedef enum {NA_INVALID, NA_LOOPBACK, NA_IP, NA_IPV6, NA_IPX, NA_BROADCAST_IP, NA_BROADCAST_IP6, NA_BROADCAST_IPX, NA_TCP, NA_TCPV6, NA_IRC} netadrtype_t;
typedef enum {NS_CLIENT, NS_SERVER} netsrc_t;
@ -35,9 +35,16 @@ typedef struct
qbyte ip[4];
qbyte ip6[16];
qbyte ipx[10];
#ifdef IRCCONNECT
struct {
char user[32];
char channel[12];
} irc;
#endif
} address;
unsigned short port;
unsigned short connum;
} netadr_t;
struct sockaddr_qstorage
@ -53,10 +60,6 @@ struct sockaddr_qstorage
};
extern netadr_t net_local_sv_ipadr;
extern netadr_t net_local_sv_ip6adr;
extern netadr_t net_local_sv_ipxadr;
extern netadr_t net_local_sv_tcpipadr;
extern netadr_t net_local_cl_ipadr;
extern netadr_t net_from; // address of who sent the packet
extern sizebuf_t net_message;
@ -68,6 +71,7 @@ extern cvar_t hostname;
int TCP_OpenStream (netadr_t remoteaddr); //makes things easier
struct ftenet_connections_s;
void NET_Init (void);
void NET_InitClient (void);
void NET_InitServer (void);
@ -76,6 +80,10 @@ void UDP_CloseSocket (int socket);
void NET_Shutdown (void);
qboolean NET_GetPacket (netsrc_t socket);
void NET_SendPacket (netsrc_t socket, int length, void *data, netadr_t to);
int NET_LocalAddressForRemote(struct ftenet_connections_s *collection, netadr_t *remote, netadr_t *local, int idx);
void NET_PrintAddresses(struct ftenet_connections_s *collection);
qboolean NET_AddressSmellsFunny(netadr_t a);
void NET_EnsureRoute(struct ftenet_connections_s *collection, char *routename, char *host);
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);

View File

@ -210,6 +210,14 @@ qboolean Netchan_CanPacket (netchan_t *chan, int rate)
return false;
}
void Netchan_Block (netchan_t *chan, int bytes, int rate)
{
if (chan->cleartime < realtime-0.25) //0.25 allows it to be a little bursty.
chan->cleartime = realtime + bytes/(float)rate;
else
chan->cleartime += bytes/(float)rate;
}
/*
===============
@ -389,10 +397,8 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
*(int*)send_buf = BigLong(NETFLAG_DATA | send.cursize);
NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address);
if (chan->cleartime < realtime)
chan->cleartime = realtime + send.cursize/(float)rate;
else
chan->cleartime += send.cursize/(float)rate;
Netchan_Block(chan, send.cursize, rate);
send.cursize = 0;
}
//send out the unreliable (if still unsent)
@ -407,11 +413,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
*(int*)send_buf = BigLong(NETFLAG_UNRELIABLE | send.cursize);
NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address);
if (chan->cleartime < realtime)
chan->cleartime = realtime + send.cursize/(float)rate;
else
chan->cleartime += send.cursize/(float)rate;
Netchan_Block(chan, send.cursize, rate);
send.cursize = 0;
}
return;
@ -447,6 +449,8 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
// write the packet header
send.data = send_buf;
send.maxsize = MAX_QWMSGLEN + PACKET_HEADER; //dmw: wasn't quite true.
if (chan->sock == NS_CLIENT)
send.maxsize += 2;
send.cursize = 0;
w1 = chan->outgoing_sequence | (send_reliable<<31);
@ -497,10 +501,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address);
}
if (chan->cleartime < realtime)
chan->cleartime = realtime + send.cursize/(float)rate;
else
chan->cleartime += send.cursize/(float)rate;
Netchan_Block(chan, send.cursize, rate);
#ifdef SERVERONLY
if (ServerPaused())
chan->cleartime = realtime;

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +1,63 @@
#ifndef _PARTICLES_H_
#define _PARTICLES_H_
extern int pt_explosion,
pt_pointfile,
pt_entityparticles,
pt_blob,
pt_blood,
pt_lightningblood,
extern int
pt_gunshot,
ptdp_gunshotquad,
pt_spike,
ptdp_spikequad,
pt_superspike,
ptdp_superspikequad,
pt_wizspike,
pt_knightspike,
pt_spike,
pt_superspike,
pt_lavasplash,
pt_explosion,
ptdp_explosionquad,
pt_tarexplosion,
pt_teleportsplash,
pt_blasterparticles,
pt_torch,
pt_flame,
pt_bullet,
pt_superbullet,
pe_default,
pe_defaulttrail;
extern int rt_blastertrail,
rt_railtrail,
rt_bubbletrail,
pt_lavasplash,
ptdp_smallflash,
ptdp_flamejet,
ptdp_flame,
ptdp_blood,
ptdp_spark,
ptdp_plasmaburn,
ptdp_tei_g3,
ptdp_tei_smoke,
ptdp_tei_bigexplosion,
ptdp_tei_plasmahit,
ptdp_stardust,
rt_rocket,
rt_grenade,
rt_gib,
rt_lightning1,
rt_lightning2,
rt_lightning3,
pt_lightning1_end,
pt_lightning2_end,
pt_lightning3_end;
/*
extern int rt_rocket_trail,
rt_smoke,
rt_blood,
rt_tracer,
rt_slight_blood,
rt_tracer2,
rt_voor_trail,
rt_fireball,
rt_ice,
rt_spit,
rt_spell,
rt_vorpal,
rt_setstaff,
rt_magicmissile,
rt_boneshard,
rt_scarab,
rt_acidball,
rt_bloodshot,
rt_blastertrail,
rt_railtrail,
rt_bubbletrail;
*/
rt_wizspike,
rt_slightblood,
rt_knightspike,
rt_vorespike,
rtdp_neharasmoke,
rtdp_nexuizplasma,
rtdp_glowtrail,
ptqw_blood,
ptqw_lightningblood,
ptq2_blood,
rtq2_railtrail,
rtq2_blastertrail,
ptq2_blasterparticles,
rtq2_bubbletrail,
rtq2_gib,
rtq2_rocket,
rtq2_grenade,
rtqw_railtrail, //common to zquake/fuhquake/fte
rtfte_lightning1,
ptfte_lightning1_end,
rtfte_lightning2,
ptfte_lightning2_end,
rtfte_lightning3,
ptfte_lightning3_end,
ptfte_bullet,
ptfte_superbullet;
struct beamseg_s;
@ -75,233 +75,75 @@ typedef struct trailstate_s {
} state2;
} trailstate_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
struct particle_s *next;
float die;
// driver-usable fields
vec3_t org;
float color; //used by sw renderer. To be removed.
vec3_t rgb;
float alpha;
float scale;
vec3_t vel; //renderer uses for sparks
float angle;
union {
float nextemit;
trailstate_t *trailstate;
} state;
// drivers never touch the following fields
float rotationspeed;
} particle_t;
typedef struct clippeddecal_s
{
struct clippeddecal_s *next;
float die;
vec3_t center;
vec3_t vertex[3];
vec2_t texcoords[3];
vec3_t rgb;
float alpha;
} clippeddecal_t;
#define BS_LASTSEG 0x1 // no draw to next, no delete
#define BS_DEAD 0x2 // segment is dead
#define BS_NODRAW 0x4 // only used for lerp switching
typedef struct beamseg_s
{
struct beamseg_s *next; // next in beamseg list
particle_t *p;
int flags; // flags for beamseg
vec3_t dir;
float texture_s;
} beamseg_t;
typedef struct skytris_s {
struct skytris_s *next;
vec3_t org;
vec3_t x;
vec3_t y;
float area;
float nexttime;
struct msurface_s *face;
} skytris_t;
//these could be deltas or absolutes depending on ramping mode.
typedef struct {
vec3_t rgb;
float alpha;
float scale;
float rotation;
} ramp_t;
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
// TODO: merge in alpha with rgb to gain benefit of vector opts
typedef struct part_type_s {
char name[MAX_QPATH];
char texname[MAX_QPATH];
vec3_t rgb;
vec3_t rgbchange;
vec3_t rgbrand;
int colorindex;
int colorrand;
float rgbchangetime;
vec3_t rgbrandsync;
float scale, alpha;
float alphachange;
float die, randdie;
float randomvel, veladd;
float orgadd;
float offsetspread;
float offsetspreadvert;
float randomvelvert;
float randscale;
float spawntime;
float spawnchance;
enum {PT_NORMAL, PT_SPARK, PT_SPARKFAN, PT_TEXTUREDSPARK, PT_BEAM, PT_DECAL} type;
blendmode_t blendmode;
float rotationstartmin, rotationstartrand;
float rotationmin, rotationrand;
float scaledelta;
float count;
float countrand;
int texturenum;
#ifdef D3DQUAKE
void *d3dtexture;
#endif
int assoc;
int cliptype;
int inwater;
float clipcount;
int emit;
float emittime;
float emitrand;
float emitstart;
float areaspread;
float areaspreadvert;
float scalefactor;
float invscalefactor;
float spawnparam1;
float spawnparam2;
/* float spawnparam3; */
float offsetup; // make this into a vec3_t later with dir, possibly for mdls
enum {
SM_BOX, //box = even spread within the area
SM_CIRCLE, //circle = around edge of a circle
SM_BALL, //ball = filled sphere
SM_SPIRAL, //spiral = spiral trail
SM_TRACER, //tracer = tracer trail
SM_TELEBOX, //telebox = q1-style telebox
SM_LAVASPLASH, //lavasplash = q1-style lavasplash
SM_UNICIRCLE, //unicircle = uniform circle
SM_FIELD, //field = synced field (brightfield, etc)
SM_DISTBALL // uneven distributed ball
} spawnmode;
float gravity;
vec3_t friction;
float clipbounce;
int stains;
enum {RAMP_NONE, RAMP_DELTA, RAMP_ABSOLUTE} rampmode;
int rampindexes;
ramp_t *ramp;
int loaded;
particle_t *particles;
clippeddecal_t *clippeddecals;
beamseg_t *beams;
skytris_t *skytris;
struct part_type_s *nexttorun;
unsigned int flags;
#define PT_VELOCITY 0x001
#define PT_FRICTION 0x002
#define PT_CHANGESCOLOUR 0x004
#define PT_CITRACER 0x008 // Q1-style tracer behavior for colorindex
#define PT_INVFRAMETIME 0x010 // apply inverse frametime to count (causes emits to be per frame)
#define PT_AVERAGETRAIL 0x020 // average trail points from start to end, useful with t_lightning, etc
#define PT_NOSTATE 0x040 // don't use trailstate for this emitter (careful with assoc...)
#define PT_NOSPREADFIRST 0x080 // don't randomize org/vel for first generated particle
#define PT_NOSPREADLAST 0x100 // don't randomize org/vel for last generated particle
unsigned int state;
#define PS_INRUNLIST 0x1 // particle type is currently in execution list
} part_type_t;
#define PARTICLE_Z_CLIP 8.0
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
#define frandom() (rand()*(1.0f/RAND_MAX))
#define crandom() (rand()*(2.0f/RAND_MAX)-1.0f)
#define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f)
//main functions
void P_DrawParticles (void);
void P_InitParticles (void);
void P_ClearParticles (void);
#define P_INVALID -1
//allocate a new effect
int P_ParticleTypeForName(char *name);
int P_AllocateParticleType(char *name); //find one if it exists, or create if it doesn't.
int P_FindParticleType(char *name); //checks if particle description 'name' exists, returns -1 if not.
int P_DescriptionIsLoaded(char *name); //returns true if it's usable.
qboolean P_TypeIsLoaded(int effect);
void P_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf);
// default particle effect
void P_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); //aka: the particle builtin.
//wierd effects
void P_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count); //these three are needed for hexen2.
void P_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count);
void P_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count);
void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk); //particles centered around a model, called every frame for those models.
//functions that spawn point effects (basically just pass throughs)
void P_BlobExplosion (vec3_t org); //tarbaby explosion or TF emp.
void P_LavaSplash (vec3_t org); //cthon dying, or a gas grenade.
void P_RunParticleCube(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, qboolean gravity, float jitter);
void P_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
//the core spawn function for trails. (trailstate can be null)
int P_ParticleTrail (vec3_t start, vec3_t end, int type, trailstate_t **trailstate);
void P_ParticleTrailIndex (vec3_t start, vec3_t end, int color, int rndcolor, trailstate_t **trailstate);
void P_DefaultTrail (struct model_s *model); //fills in the default particle properties for a loaded model. Should already have the model flags set.
//the core spawn function for point effects
int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk); //1 if failed
int P_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name); //1 if failed.
#define P_RunParticleEffectType(a,b,c,d) P_RunParticleEffectState(a,b,c,d,NULL)
void P_EmitSkyEffectTris(struct model_s *mod, struct msurface_s *fa);
// trailstate functions
void P_DelinkTrailstate(trailstate_t **tsk);
// used for callback
extern cvar_t r_particlesdesc;
struct model_s;
struct msurface_s;
void P_DefaultTrail (struct model_s *model);
void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk);//this is just a wrapper
#define P_ParticleTypeForName pe->ParticleTypeForName
#define P_FindParticleType pe->FindParticleType
#define P_RunParticleEffectTypeString pe->RunParticleEffectTypeString
#define P_ParticleTrail pe->ParticleTrail
#define P_RunParticleEffectState pe->RunParticleEffectState
#define P_RunParticleWeather pe->RunParticleWeather
#define P_RunParticleCube pe->RunParticleCube
#define P_RunParticleEffect pe->RunParticleEffect
#define P_RunParticleEffect2 pe->RunParticleEffect2
#define P_RunParticleEffect3 pe->RunParticleEffect3
#define P_RunParticleEffect4 pe->RunParticleEffect4
#define P_ParticleTrailIndex pe->ParticleTrailIndex
#define P_EmitSkyEffectTris pe->EmitSkyEffectTris
#define P_InitParticles pe->InitParticles
#define P_DelinkTrailstate pe->DelinkTrailstate
#define P_ClearParticles pe->ClearParticles
#define P_DrawParticles pe->DrawParticles
#define P_FlushRenderer pe->FlushRenderer
typedef struct {
char *name1;
char *name2;
int (*ParticleTypeForName) (char *name);
int (*FindParticleType) (char *name);
int (*RunParticleEffectTypeString) (vec3_t org, vec3_t dir, float count, char *name);
int (*ParticleTrail) (vec3_t startpos, vec3_t end, int type, trailstate_t **tsk);
int (*RunParticleEffectState) (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk);
void (*RunParticleWeather) (vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
void (*RunParticleCube) (vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, qboolean gravity, float jitter);
void (*RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count);
void (*RunParticleEffect2) (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count);
void (*RunParticleEffect3) (vec3_t org, vec3_t box, int color, int effect, int count);
void (*RunParticleEffect4) (vec3_t org, float radius, int color, int effect, int count);
void (*ParticleTrailIndex) (vec3_t start, vec3_t end, int color, int crnd, trailstate_t **tsk);
void (*EmitSkyEffectTris) (struct model_s *mod, struct msurface_s *fa);
void (*InitParticles) (void);
void (*ShutdownParticles) (void);
void (*DelinkTrailstate) (trailstate_t **tsk);
void (*ClearParticles) (void);
void (*DrawParticles) (void);
void (*FlushRenderer) (void);
} particleengine_t;
extern particleengine_t *pe;
#endif

2516
engine/common/pr_bgcmd.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,66 @@
#include "progtype.h"
#include "progslib.h"
#ifdef CLIENTONLY
typedef struct edict_s {
pbool isfree;
float freetime; // realtime when the object was freed
unsigned int entnum;
pbool readonly; //causes error when QC tries writing to it. (quake's world entity)
void *v;
} edict_t;
#endif
#define PF_cin_open PF_Fixme
#define PF_cin_close PF_Fixme
#define PF_cin_setstate PF_Fixme
#define PF_cin_getstate PF_Fixme
#define PF_cin_restart PF_Fixme
#define PF_drawline PF_Fixme
#define PF_drawcolorcodedstring PF_Fixme
#define PF_uri_get PF_Fixme
#define PF_strreplace PF_Fixme
#define PF_strireplace PF_Fixme
#define PF_gecko_create PF_Fixme
#define PF_gecko_destroy PF_Fixme
#define PF_gecko_navigate PF_Fixme
#define PF_gecko_keyevent PF_Fixme
#define PF_gecko_movemouse PF_Fixme
#define PF_gecko_resize PF_Fixme
#define PF_gecko_get_texture_extent PF_Fixme
#define PF_uri_get PF_Fixme
#define PF_pointsound PF_Fixme
#define PF_getsurfacepointattribute PF_Fixme
#define PF_gecko_mousemove PF_Fixme
#define PF_numentityfields PF_Fixme
#define PF_entityfieldname PF_Fixme
#define PF_entityfieldtype PF_Fixme
#define PF_getentityfieldstring PF_Fixme
#define PF_putentityfieldstring PF_Fixme
#define PF_WritePicture PF_Fixme
#define PF_ReadPicture PF_Fixme
#define G_PROG G_FLOAT
//the lh extension system asks for a name for the extension.
//the ebfs version is a function that returns a builtin number.
//thus lh's system requires various builtins to exist at specific numbers.
typedef struct lh_extension_s {
char *name;
int numbuiltins;
qboolean *enabled;
char *builtinnames[21]; //extend freely
} lh_extension_t;
extern lh_extension_t QSG_Extensions[];
extern unsigned int QSG_Extensions_count;
pbool QC_WriteFile(char *name, void *data, int len);
void *VARGS PR_CB_Malloc(int size); //these functions should be tracked by the library reliably, so there should be no need to track them ourselves.
void VARGS PR_CB_Free(void *mem);
void PF_InitTempStrings(progfuncs_t *prinst);
string_t PR_TempString(progfuncs_t *prinst, char *str); //returns a tempstring containing str
@ -19,6 +82,7 @@ void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -45,6 +109,11 @@ void PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -68,7 +137,15 @@ void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PR_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
@ -83,6 +160,7 @@ char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_glob
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...);
void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -91,6 +169,7 @@ void PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -140,11 +219,17 @@ void PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externcall (progfuncs_t *prinst, globalvars_t *pr_globals);
void PF_externrefcall (progfuncs_t *prinst, globalvars_t *pr_globals);
void PF_externvalue (progfuncs_t *prinst, globalvars_t *pr_globals);
void PF_externset (progfuncs_t *prinst, globalvars_t *pr_globals);
void PF_instr (progfuncs_t *prinst, globalvars_t *pr_globals);
void PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -157,6 +242,10 @@ void PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_edict_for_num (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
//these functions are from pr_menu.dat
void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -169,8 +258,11 @@ void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_stringwidth (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -180,8 +272,62 @@ void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
int QCEditor (progfuncs_t *prinst, char *filename, int line, int nump, char **parms);
void PF_Common_RegisterCvars(void);
// edict->solid values
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_PHASEH2 5
#define SOLID_CORPSE 5
#define SOLID_LADDER 20 //dmw. touch on edge, not blocking. Touching players have different physics. Otherwise a SOLID_TRIGGER
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// edict->flags
#define FL_FLY 1
#define FL_SWIM 2
#define FL_GLIMPSE 4
#define FL_CLIENT 8
#define FL_INWATER 16
#define FL_MONSTER 32
#define FL_GODMODE 64
#define FL_NOTARGET 128
#define FL_ITEM 256
#define FL_ONGROUND 512
#define FL_PARTIALGROUND 1024 // not all corners are valid
#define FL_WATERJUMP 2048 // player jumping out of water
#define FL_FINDABLE_NONSOLID 16384 //a cpqwsv feature
#define FL_MOVECHAIN_ANGLE 32768 // when in a move chain, will update the angle
#define FL_CLASS_DEPENDENT 2097152

View File

@ -254,6 +254,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcfte_updatestatstring 78
#define svcfte_updatestatfloat 79
#define svcfte_trailparticles 80 // [short] entnum [short] effectnum [vector] start [vector] end
#define svcfte_pointparticles 81 // [short] effectnum [vector] start [vector] velocity [short] count
#define svcfte_pointparticles1 82 // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
//DP extended svcs
#define svcdp_downloaddata 50
@ -264,6 +269,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcdp_spawnbaseline2 55
#define svcdp_entities 57
#define svcdp_csqcentities 58
#define svcdp_spawnstaticsound2 59 // [coord3] [short] samp [byte] vol [byte] aten
#define svcdp_trailparticles 60 // [short] entnum [short] effectnum [vector] start [vector] end
#define svcdp_pointparticles 61 // [short] effectnum [vector] start [vector] velocity [short] count
#define svcdp_pointparticles1 62 // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
@ -323,6 +332,7 @@ enum clcq2_ops_e
#define clc_tmove 6 // teleport request, spectator only
#define clc_upload 7 // teleport request, spectator only
#define clcdp_ackframe 50
#define clcdp_ackdownloaddata 51
@ -349,12 +359,11 @@ enum clcq2_ops_e
(1<<13))
#ifdef PEXT_HULLSIZE
#define PF_HULLSIZE_Z (1<<14)
#endif
#define PF_EXTRA_PFS (1<<15)
//FIXME: Resolve this.
// bits 11..13 are player move type bits
#ifdef PEXT_SCALE
#define PF_SCALE_Z (1<<16)
#endif
@ -364,9 +373,6 @@ enum clcq2_ops_e
#ifdef PEXT_FATNESS
#define PF_FATNESS_Z (1<<18)
#endif
#ifdef PEXT_HULLSIZE
#define PF_HULLSIZE_Z (1<<14)
#endif
#define PF_COLOURMOD (1<<19)
@ -761,6 +767,8 @@ typedef struct usercmd_s
//freestyle
qbyte weapon;
int servertime;
float fservertime;
float fclienttime;
} usercmd_t;
typedef struct q2usercmd_s

View File

@ -1656,6 +1656,7 @@ void MSG_Q3_ReadDeltaUsercmd(int key, const usercmd_t *from, usercmd_t *to)
to->servertime = MSG_ReadBits(8) + from->servertime;
else
to->servertime = MSG_ReadBits(32);
to->msec = to->servertime - from->servertime;
if (!MSG_ReadBits(1))
{
@ -1674,9 +1675,10 @@ void MSG_Q3_ReadDeltaUsercmd(int key, const usercmd_t *from, usercmd_t *to)
to->angles[0] = MSG_ReadDeltaKey(key, from->angles[0], 16);
to->angles[1] = MSG_ReadDeltaKey(key, from->angles[1], 16);
to->angles[2] = MSG_ReadDeltaKey(key, from->angles[2], 16);
to->forwardmove = MSG_ReadDeltaKey(key, from->forwardmove, 8);
to->sidemove = MSG_ReadDeltaKey(key, from->sidemove, 8);
to->upmove = MSG_ReadDeltaKey(key, from->upmove, 8);
//yeah, this is messy
to->forwardmove = (signed char)(unsigned char)MSG_ReadDeltaKey(key, (unsigned char)(signed char)from->forwardmove, 8);
to->sidemove = (signed char)(unsigned char)MSG_ReadDeltaKey(key, (unsigned char)(signed char)from->sidemove, 8);
to->upmove = (signed char)(unsigned char)MSG_ReadDeltaKey(key, (unsigned char)(signed char)from->upmove, 8);
to->buttons = MSG_ReadDeltaKey(key, from->buttons, 16);
to->weapon = MSG_ReadDeltaKey(key, from->weapon, 8);
}

View File

@ -236,6 +236,7 @@ void Sys_UnloadDLL(void *handle)
// ------------------------- * QVM files * -------------------------
#define VM_MAGIC 0x12721444
#define VM_MAGIC2 0x12721445
#define LL(x) x = LittleLong(x)
#pragma pack(push,1)
@ -252,6 +253,9 @@ typedef struct vmHeader_s
int dataLength; // should be byteswapped on load
int litLength; // copy as is
int bssLength; // zero filled memory appended to datalength
//valid only in V2.
int jtrgLength; // number of jump table targets
} vmHeader_t;
#pragma pack(pop)
@ -418,8 +422,15 @@ qvm_t *QVM_Load(const char *name, sys_callqvm_t syscall)
LL(header->litLength);
LL(header->bssLength);
if (header->vmMagic==VM_MAGIC2)
{ //version2 cotains a jump table of sorts
//it is redundant information and can be ignored
//its also more useful for jit rather than bytecode
LL(header->jtrgLength);
}
// check file
if(header->vmMagic!=VM_MAGIC || header->instructionCount<=0 || header->codeLength<=0)
if(header->vmMagic!=VM_MAGIC && header->vmMagic!=VM_MAGIC2 || header->instructionCount<=0 || header->codeLength<=0)
{
Con_Printf("%s: invalid qvm file\n", name);
BZ_Free(raw);

View File

@ -55,6 +55,14 @@ void VARGS Sys_Printf (char *fmt, ...);
void Sys_Quit (void);
typedef struct {
void **funcptr;
char *name;
} dllfunction_t;
typedef void *dllhandle_t;
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs);
void Sys_CloseLibrary(dllhandle_t *lib);
unsigned int Sys_Milliseconds (void);
double Sys_DoubleTime (void);

View File

@ -85,8 +85,6 @@ typedef struct q2trace_s
struct edict_s *ent; // not set by CM_*() functions
} q2trace_t;
#ifndef CLIENTONLY
#define MOVE_NORMAL 0
#define MOVE_NOMONSTERS 1
#define MOVE_MISSILE 2
@ -107,6 +105,7 @@ typedef struct areanode_s
#define AREA_DEPTH 4
#define AREA_NODES 32 //pow(2, AREA_DEPTH+1)
#ifndef CLIENTONLY
extern areanode_t sv_areanodes[AREA_NODES];

View File

@ -81,7 +81,7 @@ zone_t *zone_head;
void *zonelock;
#endif
static void Z_DumpTree()
static void Z_DumpTree(void)
{
zone_t *zone;
zone_t *nextlist;

View File

@ -98,7 +98,7 @@ static void Upload_Texture_32(LPDIRECTDRAWSURFACE7 surf, unsigned int *data, int
surf->lpVtbl->Unlock(surf, NULL);
}
void D3D_MipMap (qbyte *out, qbyte *in, int width, int height)
void D3D7_MipMap (qbyte *out, qbyte *in, int width, int height)
{
int i, j;
@ -117,7 +117,7 @@ void D3D_MipMap (qbyte *out, qbyte *in, int width, int height)
}
//create a basic shader from a 32bit image
void *D3D_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags)
void *D3D7_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags)
{
static unsigned char mipdata[(MAX_WIDTH/2)*(MAX_HEIGHT/2)][4];
@ -159,7 +159,7 @@ void *D3D_LoadTexture_32(char *name, unsigned int *data, int width, int height,
newsurf->lpVtbl->GetAttachedSurface(newsurf, &caps, &miptex);
while (miptex)
{
D3D_MipMap(mipdata, data, width, height);
D3D7_MipMap(mipdata, data, width, height);
data = mipdata;
width/=2;
height/=2;
@ -176,7 +176,7 @@ void *D3D_LoadTexture_32(char *name, unsigned int *data, int width, int height,
}
//create a basic shader from an 8bit image with 24bit palette
void *D3D_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix)
void *D3D7_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
@ -197,10 +197,10 @@ void *D3D_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int he
}
return D3D_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
return D3D7_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
void *D3D_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette)
void *D3D7_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette)
{
//just expands it to 32bpp and passes it on
static unsigned char out[MAX_WIDTH*MAX_HEIGHT][4];
@ -218,11 +218,11 @@ void *D3D_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int he
}
return D3D_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
return D3D7_LoadTexture_32(name, (unsigned int*)out, width, height, flags);
}
void D3D_UnloadTexture(LPDIRECTDRAWSURFACE7 tex)
void D3D7_UnloadTexture(LPDIRECTDRAWSURFACE7 tex)
{
tex->lpVtbl->Release(tex);
}
@ -253,7 +253,7 @@ static qbyte exptexture[16][16] =
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
};
void D3D_InitParticleTexture (void)
void D3D7_InitParticleTexture (void)
{
#define PARTICLETEXTURESIZE 64
int x,y;
@ -273,7 +273,7 @@ void D3D_InitParticleTexture (void)
data[y*16+x][3] = exptexture[x][y]*255/9.0;
}
}
d3dexplosiontexture = D3D_LoadTexture_32("", (unsigned int*)data, 16, 16, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
d3dexplosiontexture = D3D7_LoadTexture_32("", (unsigned int*)data, 16, 16, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
memset(data, 255, sizeof(data));
for (y = 0;y < PARTICLETEXTURESIZE;y++)
@ -288,7 +288,7 @@ void D3D_InitParticleTexture (void)
}
}
d3dballtexture = D3D_LoadTexture_32("", (unsigned int*)data, PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
d3dballtexture = D3D7_LoadTexture_32("", (unsigned int*)data, PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, TF_ALPHA|TF_NOTBUMPMAP|TF_NOMIPMAP);
}
@ -299,7 +299,7 @@ void D3D_InitParticleTexture (void)
mpic_t *(D3D_Draw_SafePicFromWad) (char *name)
mpic_t *(D3D7_Draw_SafePicFromWad) (char *name)
{
LPDIRECTDRAWSURFACE7 *p;
d3dcachepic_t *pic;
@ -333,13 +333,13 @@ mpic_t *(D3D_Draw_SafePicFromWad) (char *name)
{
*p = Mod_LoadReplacementTexture(pic->name, "wad", false, true, true);
if (!*p)
*p = D3D_LoadTexture_8_Pal24(name, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
*p = D3D7_LoadTexture_8_Pal24(name, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
}
// Con_Printf("Fixme: D3D_Draw_SafePicFromWad\n");
return &pic->pic;
}
mpic_t *(D3D_Draw_SafeCachePic) (char *path)
mpic_t *(D3D7_Draw_SafeCachePic) (char *path)
{
LPDIRECTDRAWSURFACE7 *p;
d3dcachepic_t *pic;
@ -370,20 +370,20 @@ mpic_t *(D3D_Draw_SafeCachePic) (char *path)
p = (LPDIRECTDRAWSURFACE7*)&pic->pic.data;
*p = Mod_LoadReplacementTexture(pic->name, "gfx", false, true, true);
if (!*p)
*p = D3D_LoadTexture_8_Pal24(path, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
*p = D3D7_LoadTexture_8_Pal24(path, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
// Con_Printf("Fixme: D3D_Draw_SafeCachePic\n");
return &pic->pic;
}
mpic_t *(D3D_Draw_CachePic) (char *path)
mpic_t *(D3D7_Draw_CachePic) (char *path)
{
mpic_t *pic;
pic = D3D_Draw_SafeCachePic(path);
pic = D3D7_Draw_SafeCachePic(path);
if (!pic)
Sys_Error("Couldn't load picture %s", path);
return pic;
}
void (D3D_Draw_ReInit) (void)
void (D3D7_Draw_ReInit) (void)
{
d3dmenu_numcachepics = 0;
@ -391,7 +391,7 @@ void (D3D_Draw_ReInit) (void)
draw_chars_tex = Mod_LoadReplacementTexture("conchars", "gfx", false, true, true);
if (!draw_chars_tex)
draw_chars_tex = D3D_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
draw_chars_tex = D3D7_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
//now emit the conchars picture as if from a wad.
@ -402,17 +402,17 @@ void (D3D_Draw_ReInit) (void)
d3dmenu_numcachepics++;
conback_tex = D3D_Draw_SafeCachePic("gfx/conback.lmp");
conback_tex = D3D7_Draw_SafeCachePic("gfx/conback.lmp");
Plug_DrawReloadImages();
D3D_InitParticleTexture();
D3D7_InitParticleTexture();
}
void (D3D_Draw_Init) (void)
void (D3D7_Draw_Init) (void)
{
D3D_Draw_ReInit();
D3D7_Draw_ReInit();
}
void (D3D_Draw_Character) (int x, int y, unsigned int num)
void (D3D7_Draw_Character) (int x, int y, unsigned int num)
{
int row;
int col;
@ -468,7 +468,7 @@ void (D3D_Draw_Character) (int x, int y, unsigned int num)
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D_Draw_ColouredCharacter) (int x, int y, unsigned int num)
void (D3D7_Draw_ColouredCharacter) (int x, int y, unsigned int num)
{
int row;
int col;
@ -533,39 +533,39 @@ void (D3D_Draw_ColouredCharacter) (int x, int y, unsigned int num)
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D_Draw_String) (int x, int y, const qbyte *str)
void (D3D7_Draw_String) (int x, int y, const qbyte *str)
{
while(*str)
{
D3D_Draw_Character(x, y, *str++);
D3D7_Draw_Character(x, y, *str++);
x+=8;
}
}
void (D3D_Draw_Alt_String) (int x, int y, const qbyte *str)
void (D3D7_Draw_Alt_String) (int x, int y, const qbyte *str)
{
while(*str)
{
D3D_Draw_Character(x, y, *str++ | 128);
D3D7_Draw_Character(x, y, *str++ | 128);
x+=8;
}
}
void (D3D_Draw_Crosshair) (void)
void (D3D7_Draw_Crosshair) (void)
{
D3D_Draw_Character(vid.width/2 - 4, vid.height/2 - 4, '+');
D3D7_Draw_Character(vid.width/2 - 4, vid.height/2 - 4, '+');
}
void (D3D_Draw_DebugChar) (qbyte num)
void (D3D7_Draw_DebugChar) (qbyte num)
{
Sys_Error("D3D function not implemented\n");
}
void (D3D_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation)
void (D3D7_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D_Draw_TileClear) (int x, int y, int w, int h)
void (D3D7_Draw_TileClear) (int x, int y, int w, int h)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D_Draw_Fill_I) (int x, int y, int w, int h, unsigned int imgcolour)
void (D3D7_Draw_Fill_I) (int x, int y, int w, int h, unsigned int imgcolour)
{
d3dquadvert[0].x = x;
d3dquadvert[0].y = y;
@ -618,7 +618,7 @@ void (D3D_Draw_Fill_I) (int x, int y, int w, int h, unsigned int imgcolour)
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
}
void (D3D_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b)
void (D3D7_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b)
{
char colours[4];
colours[0] = b*255;
@ -626,34 +626,34 @@ void (D3D_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float
colours[2] = r*255;
colours[3] = 255;
D3D_Draw_Fill_I(x, y, w, h, *(unsigned int*)colours);
D3D7_Draw_Fill_I(x, y, w, h, *(unsigned int*)colours);
}
void (D3D_Draw_Fill) (int x, int y, int w, int h, int c)
void (D3D7_Draw_Fill) (int x, int y, int w, int h, unsigned int c)
{
D3D_Draw_FillRGB(x, y, w, h, host_basepal[c*3+0]/255.0f, host_basepal[c*3+1]/255.0f, host_basepal[c*3+2]/255.0f);
D3D7_Draw_FillRGB(x, y, w, h, host_basepal[c*3+0]/255.0f, host_basepal[c*3+1]/255.0f, host_basepal[c*3+2]/255.0f);
}
void (D3D_Draw_FadeScreen) (void)
void (D3D7_Draw_FadeScreen) (void)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D_Draw_BeginDisc) (void)
void (D3D7_Draw_BeginDisc) (void)
{
// Sys_Error("D3D function not implemented\n");
}
void (D3D_Draw_EndDisc) (void)
void (D3D7_Draw_EndDisc) (void)
{
// Sys_Error("D3D function not implemented\n");
}
static int imgcolour;
void (D3D_Draw_Fill_Colours) (int x, int y, int w, int h)
void (D3D7_Draw_Fill_Colours) (int x, int y, int w, int h)
{
D3D_Draw_Fill_I(x, y, w, h, imgcolour);
D3D7_Draw_Fill_I(x, y, w, h, imgcolour);
}
void (D3D_Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic)
void (D3D7_Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic)
{
LPDIRECTDRAWSURFACE7 *p;
if (!conback_tex)
@ -700,11 +700,11 @@ void (D3D_Draw_Image) (float x, float y, float w, float h, float s1, float t1
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dquadvert, 4, d3dquadindexes, 6, 0);
}
void (D3D_Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic)
void (D3D7_Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic)
{
D3D_Draw_Image(x, y, width, height, 0, 0, 1, 1, pic);
D3D7_Draw_Image(x, y, width, height, 0, 0, 1, 1, pic);
}
void (D3D_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height)
void (D3D7_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height)
{
float s, t;
float sw, tw;
@ -715,21 +715,21 @@ void (D3D_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int wi
t = (float)srcy/pic->height;
sw = (float)width/pic->width;
tw = (float)height/pic->height;
D3D_Draw_Image(x, y, width, height, s, t, s+sw, t+tw, pic);
D3D7_Draw_Image(x, y, width, height, s, t, s+sw, t+tw, pic);
}
void (D3D_Draw_TransPic) (int x, int y, mpic_t *pic)
void (D3D7_Draw_TransPic) (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
D3D7_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void (D3D_Draw_Pic) (int x, int y, mpic_t *pic)
void (D3D7_Draw_Pic) (int x, int y, mpic_t *pic)
{
if (!pic)
return;
D3D_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
D3D7_Draw_Image(x, y, pic->width, pic->height, 0, 0, 1, 1, pic);
}
void (D3D_Draw_ImageColours) (float r, float g, float b, float a)
void (D3D7_Draw_ImageColours) (float r, float g, float b, float a)
{
unsigned char *c = (unsigned char *)&imgcolour;
@ -739,35 +739,35 @@ void (D3D_Draw_ImageColours) (float r, float g, float b, float a)
c[3] = a*255;
}
void (D3D_Draw_ConsoleBackground) (int lines)
void (D3D7_Draw_ConsoleBackground) (int lines)
{
D3D_Draw_ImageColours(1,1,1,1);
D3D_Draw_Image(0, 0, vid.width, lines, 0, 1 - (float)lines/vid.height, 1, 1, conback_tex);
D3D7_Draw_ImageColours(1,1,1,1);
D3D7_Draw_Image(0, 0, vid.width, lines, 0, 1 - (float)lines/vid.height, 1, 1, conback_tex);
}
void (D3D_Draw_EditorBackground) (int lines)
void (D3D7_Draw_EditorBackground) (int lines)
{
D3D_Draw_ConsoleBackground(lines);
D3D7_Draw_ConsoleBackground(lines);
}
void (D3D_Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight)
void (D3D7_Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
p = (LPDIRECTDRAWSURFACE7*)&pic.data;
*p = D3D_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
*p = D3D7_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D_Set2D ();
D3D_Draw_ImageColours(1,1,1,1);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D_UnloadTexture(*p);
D3D7_UnloadTexture(*p);
} //input is bottom up...
void (D3D_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight)
void (D3D7_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
@ -776,29 +776,29 @@ void (D3D_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight)
pic.height = inheight;
pic.flags = 0;
p = (LPDIRECTDRAWSURFACE7*)&pic.data;
*p = D3D_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
*p = D3D7_LoadTexture_32("", (unsigned int*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP);
D3D_Set2D ();
D3D_Draw_ImageColours(1,1,1,1);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D_Draw_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, &pic);
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D_UnloadTexture(*p);
D3D7_UnloadTexture(*p);
} //top down
void (D3D_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette)
void (D3D7_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette)
{
mpic_t pic;
LPDIRECTDRAWSURFACE7 *p;
p = (LPDIRECTDRAWSURFACE7*)&pic.data;
*p = D3D_LoadTexture_8_Pal24("", (unsigned char*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP, palette, 256);
*p = D3D7_LoadTexture_8_Pal24("", (unsigned char*)framedata, inwidth, inheight, TF_NOMIPMAP|TF_NOALPHA|TF_NOTBUMPMAP, palette, 256);
D3D_Set2D ();
D3D_Draw_ImageColours(1,1,1,1);
D3D7_Set2D ();
D3D7_Draw_ImageColours(1,1,1,1);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
D3D_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
D3D7_Draw_Image(0, 0, vid.width, vid.height, 0, 1, 1, 0, &pic);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
D3D_UnloadTexture(*p);
D3D7_UnloadTexture(*p);
} //paletted topdown (framedata is 8bit indexes into palette)
#endif

View File

@ -96,7 +96,7 @@ void d3d_GAliasFlushSkinCache(void)
skincolourmapped.numbuckets = 0;
}
static galiastexnum_t *D3D_ChooseSkin(galiasinfo_t *inf, char *modelname, int surfnum, entity_t *e)
static galiastexnum_t *D3D7_ChooseSkin(galiasinfo_t *inf, char *modelname, int surfnum, entity_t *e)
{
galiasskin_t *skins;
galiastexnum_t *texnums;
@ -346,7 +346,7 @@ static galiastexnum_t *D3D_ChooseSkin(galiasinfo_t *inf, char *modelname, int su
frac += fracstep;
}
}
texnums->base = D3D_LoadTexture_32 ("", pixels, scaled_width, scaled_height, 0);
texnums->base = D3D7_LoadTexture_32 ("", pixels, scaled_width, scaled_height, 0);
/* texnums->base = texture_extension_number++;
GL_Bind(texnums->base);
qglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
@ -603,7 +603,7 @@ static void LotsOfLightDirectionHacks(entity_t *e, model_t *m, vec3_t lightaxis[
qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha, float fg1time, float fg2time, qboolean nolightdir);
//draws currententity
void D3D_DrawAliasModel(void)
void D3D7_DrawAliasModel(void)
{
mesh_t mesh;
extern entity_t *currententity;
@ -676,9 +676,9 @@ if (e->flags & Q2RF_DEPTHHACK)
for(i = 0;; i++)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
skin = D3D_ChooseSkin(inf, m->name, e->skinnum, e);
skin = D3D7_ChooseSkin(inf, m->name, e->skinnum, e);
if (!skin)
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
else

View File

@ -1,7 +1,8 @@
#include "quakedef.h"
#ifdef D3DQUAKE
#include "d3dquake.h"
#include "glquake.h"
#include "glquake.h"
#include "renderque.h"
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern mleaf_t *r_viewleaf2, *r_oldviewleaf2;
@ -25,19 +26,19 @@ entity_t *currententity;
extern cvar_t gl_mindist;
void (D3D_R_DeInit) (void)
void (D3D7_R_DeInit) (void)
{
}
void (D3D_R_ReInit) (void)
void (D3D7_R_ReInit) (void)
{
}
void (D3D_R_Init) (void)
void (D3D7_R_Init) (void)
{
D3D_R_ReInit();
D3D7_R_ReInit();
}
//most of this is a direct copy from gl
void (D3D_SetupFrame) (void)
void (D3D7_SetupFrame) (void)
{
mleaf_t *leaf;
vec3_t temp;
@ -82,7 +83,7 @@ void (D3D_SetupFrame) (void)
V_SetContentsColor (r_viewleaf->contents);
}
void D3D_SetupViewPort(void)
void D3D7_SetupViewPort(void)
{
float screenaspect;
int glwidth = vid.width, glheight=vid.height;
@ -92,7 +93,7 @@ void D3D_SetupViewPort(void)
D3DVIEWPORT7 vport;
D3D_GetBufferSize(&glwidth, &glheight);
D3D7_GetBufferSize(&glwidth, &glheight);
//
// set up viewpoint
@ -305,7 +306,7 @@ struct {
float wms, wmt;
float lms, lmt;
} worldvert[64];
void D3D_DrawTextureChains(void)
void D3D7_DrawTextureChains(void)
{
texture_t *t;
msurface_t *s;
@ -429,7 +430,7 @@ pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTUR
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
}
void D3D_BaseBModelTextures(entity_t *e)
void D3D7_BaseBModelTextures(entity_t *e)
{
texture_t *t;
msurface_t *s;
@ -613,7 +614,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
return pspriteframe;
}
*/
static void D3D_DrawSpriteModel (entity_t *e)
static void D3D7_DrawSpriteModel (entity_t *e)
{
vec3_t point;
mspriteframe_t *frame;
@ -741,18 +742,18 @@ static void D3D_DrawSpriteModel (entity_t *e)
//==================================================================================
void D3DR_DrawSprite(void *e, void *parm)
void D3D7R_DrawSprite(void *e, void *parm)
{
currententity = e;
D3D_DrawSpriteModel (currententity);
D3D7_DrawSpriteModel (currententity);
// P_FlushRenderer();
}
qboolean D3D_ShouldDraw(void)
qboolean D3D7_ShouldDraw(void)
{
{
if (currententity->flags & Q2RF_EXTERNALMODEL)
@ -768,7 +769,7 @@ qboolean D3D_ShouldDraw(void)
}
void D3DR_DrawEntitiesOnList (void)
void D3D7R_DrawEntitiesOnList (void)
{
int i;
@ -780,14 +781,14 @@ void D3DR_DrawEntitiesOnList (void)
{
currententity = &cl_visedicts[i];
if (!D3D_ShouldDraw())
if (!D3D7_ShouldDraw())
continue;
switch (currententity->rtype)
{
case RT_SPRITE:
RQ_AddDistReorder(D3DR_DrawSprite, currententity, NULL, currententity->origin);
RQ_AddDistReorder(D3D7R_DrawSprite, currententity, NULL, currententity->origin);
continue;
#ifdef Q3SHADERS
case RT_BEAM:
@ -830,7 +831,7 @@ void D3DR_DrawEntitiesOnList (void)
case mod_alias:
// if (r_refdef.flags & Q2RDF_NOWORLDMODEL || !cl.worldmodel || cl.worldmodel->type != mod_brush || cl.worldmodel->fromgame == fg_doom)
D3D_DrawAliasModel ();
D3D7_DrawAliasModel ();
break;
#ifdef HALFLIFEMODELS
@ -841,11 +842,11 @@ void D3DR_DrawEntitiesOnList (void)
case mod_brush:
// if (!cl.worldmodel || cl.worldmodel->type != mod_brush || cl.worldmodel->fromgame == fg_doom)
D3D_BaseBModelTextures (currententity);
D3D7_BaseBModelTextures (currententity);
break;
case mod_sprite:
RQ_AddDistReorder(D3DR_DrawSprite, currententity, NULL, currententity->origin);
RQ_AddDistReorder(D3D7R_DrawSprite, currententity, NULL, currententity->origin);
break;
/*
#ifdef TERRAIN
@ -870,7 +871,7 @@ void D3DR_DrawEntitiesOnList (void)
}
}
void D3D_DrawWorld(void)
void D3D7_DrawWorld(void)
{
RSpeedLocals();
entity_t ent;
@ -928,7 +929,7 @@ void D3D_DrawWorld(void)
RSpeedEnd(RSPEED_WORLDNODE);
TRACE(("dbg: calling PPL_DrawWorld\n"));
// if (r_shadows.value >= 2 && gl_canstencil && gl_mtexable)
D3D_DrawTextureChains();
D3D7_DrawTextureChains();
// else
// DrawTextureChains (cl.worldmodel, 1, r_refdef.vieworg);
@ -939,7 +940,7 @@ void D3D_DrawWorld(void)
}
}
void D3D_R_RenderScene(void)
void D3D7_R_RenderScene(void)
{
if (!cl.worldmodel || (!cl.worldmodel->nodes && cl.worldmodel->type != mod_heightmap))
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
@ -947,19 +948,501 @@ void D3D_R_RenderScene(void)
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
{
R_MarkLeaves (); // done here so we know if we're in water
D3D_DrawWorld (); // adds static entities to the list
D3D7_DrawWorld (); // adds static entities to the list
}
D3DR_DrawEntitiesOnList ();
D3D7R_DrawEntitiesOnList ();
P_DrawParticles();
}
void (D3D_R_RenderView) (void)
void (D3D7_R_RenderView) (void)
{
D3D_SetupFrame();
D3D_SetupViewPort();
D3D7_SetupFrame();
D3D7_SetupViewPort();
R_SetFrustum();
D3D_R_RenderScene();
D3D7_R_RenderScene();
}
#endif
#ifdef PSET_SCRIPT
#include "particles.h"
#define TYPESONLY
#include "p_script.c"
#define APPLYD3DBLEND(bm) \
switch (bm) \
{ \
case BM_ADD: \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); \
break; \
case BM_SUBTRACT: \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR); \
break; \
case BM_BLENDCOLOUR: \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCCOLOR); \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR); \
break; \
case BM_BLEND: \
default: \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); \
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); \
break; \
}
static part_type_t *lastgltype;
extern vec3_t pright, pup;
static float particletime;
typedef struct d3dparticlevert_s {
float org[3];
unsigned int colour;
float s, t; //these could actually be preinitialised
} d3dparticlevert_t;
static d3dparticlevert_t d3dparticlevert[4];
typedef struct d3dparticlevertut_s {
float org[3];
unsigned int colour;
} d3dparticlevertut_t;
static d3dparticlevertut_t d3dparticlevertut[4];
static unsigned short d3dparticlevertindexes[] =
{
0, 1, 2,
0, 2, 3
};
static void D3D_DrawParticleBlob(particle_t *p, part_type_t *type)
{
float scale;
float x;
float y;
unsigned int colour;
int cb, cg, cr, ca;
if (lastgltype != type)
{
lastgltype = type;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
APPLYD3DBLEND(type->blendmode);
}
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
+ (p->org[2] - r_origin[2])*vpn[2];
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
if (scale < 20)
scale = 0.25;
else
scale = 0.25 + scale * 0.001;
cr = p->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = p->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = p->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = p->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
if (p->angle)
{
x = sin(p->angle)*scale;
y = cos(p->angle)*scale;
}
else
{
x = 0;
y = scale;
}
d3dparticlevert[0].s = 0;
d3dparticlevert[0].t = 0;
d3dparticlevert[0].colour = colour;
d3dparticlevert[0].org[0] = p->org[0] - x*pright[0] - y*pup[0];
d3dparticlevert[0].org[1] = p->org[1] - x*pright[1] - y*pup[1];
d3dparticlevert[0].org[2] = p->org[2] - x*pright[2] - y*pup[2];
d3dparticlevert[1].s = 0;
d3dparticlevert[1].t = 1;
d3dparticlevert[1].colour = colour;
d3dparticlevert[1].org[0] = p->org[0] - y*pright[0] + x*pup[0];
d3dparticlevert[1].org[1] = p->org[1] - y*pright[1] + x*pup[1];
d3dparticlevert[1].org[2] = p->org[2] - y*pright[2] + x*pup[2];
d3dparticlevert[2].s = 1;
d3dparticlevert[2].t = 1;
d3dparticlevert[2].colour = colour;
d3dparticlevert[2].org[0] = p->org[0] + x*pright[0] + y*pup[0];
d3dparticlevert[2].org[1] = p->org[1] + x*pright[1] + y*pup[1];
d3dparticlevert[2].org[2] = p->org[2] + x*pright[2] + y*pup[2];
d3dparticlevert[3].s = 1;
d3dparticlevert[3].t = 0;
d3dparticlevert[3].colour = colour;
d3dparticlevert[3].org[0] = p->org[0] + y*pright[0] - x*pup[0];
d3dparticlevert[3].org[1] = p->org[1] + y*pright[1] - x*pup[1];
d3dparticlevert[3].org[2] = p->org[2] + y*pright[2] - x*pup[2];
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
}
static void D3D_DrawParticleSpark(particle_t *p, part_type_t *type)
{
vec3_t v, crv, o2;
unsigned int colour;
int cb, cg, cr, ca;
if (lastgltype != type)
{
lastgltype = type;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
APPLYD3DBLEND(type->blendmode);
}
cr = p->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = p->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = p->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = p->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
VectorSubtract(r_refdef.vieworg, p->org, v);
CrossProduct(v, p->vel, crv);
VectorNormalize(crv);
VectorMA(p->org, -p->scale/2, crv, d3dparticlevert[0].org);
d3dparticlevert[0].s = 0;
d3dparticlevert[0].t = 0;
d3dparticlevert[0].colour = colour;
VectorMA(p->org, p->scale/2, crv, d3dparticlevert[1].org);
d3dparticlevert[1].s = 0;
d3dparticlevert[1].t = 1;
d3dparticlevert[1].colour = colour;
VectorMA(p->org, 0.1, p->vel, o2);
VectorSubtract(r_refdef.vieworg, o2, v);
CrossProduct(v, p->vel, crv);
VectorNormalize(crv);
VectorMA(o2, p->scale/2, crv, d3dparticlevert[2].org);
d3dparticlevert[2].s = 1;
d3dparticlevert[2].t = 1;
d3dparticlevert[2].colour = colour;
VectorMA(o2, -p->scale/2, crv, d3dparticlevert[3].org);
d3dparticlevert[3].s = 1;
d3dparticlevert[3].t = 0;
d3dparticlevert[3].colour = colour;
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
}
static void D3D_DrawParticleBeam(beamseg_t *b, part_type_t *type)
{
vec3_t v;
vec3_t crv;
beamseg_t *c;
particle_t *p;
particle_t *q;
float ts;
unsigned int colour;
int cb, cg, cr, ca;
if (lastgltype != type)
{
lastgltype = type;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
APPLYD3DBLEND(type->blendmode);
}
c = b->next;
q = c->p;
p = b->p;
cr = q->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = q->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = q->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = q->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
c = b->next;
q = c->p;
p = b->p;
VectorSubtract(r_refdef.vieworg, q->org, v);
VectorNormalize(v);
CrossProduct(c->dir, v, crv);
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(q->org, -q->scale, crv, d3dparticlevert[0].org);
d3dparticlevert[0].s = ts;
d3dparticlevert[0].t = 0;
d3dparticlevert[0].colour = colour;
VectorMA(q->org, q->scale, crv, d3dparticlevert[1].org);
d3dparticlevert[1].s = ts;
d3dparticlevert[1].t = 1;
d3dparticlevert[1].colour = colour;
cr = p->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = p->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = p->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = p->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
VectorSubtract(r_refdef.vieworg, p->org, v);
VectorNormalize(v);
CrossProduct(b->dir, v, crv); // replace with old p->dir?
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(p->org, p->scale, crv, d3dparticlevert[2].org);
d3dparticlevert[2].s = ts;
d3dparticlevert[2].t = 1;
d3dparticlevert[2].colour = colour;
VectorMA(p->org, -p->scale, crv, d3dparticlevert[3].org);
d3dparticlevert[3].s = ts;
d3dparticlevert[3].t = 0;
d3dparticlevert[3].colour = colour;
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
}
static void D3D_DrawParticleBeamUT(beamseg_t *b, part_type_t *type)
{
vec3_t v;
vec3_t crv;
beamseg_t *c;
particle_t *p;
particle_t *q;
float ts;
unsigned int colour;
int cb, cg, cr, ca;
// D3D_DrawParticleBeam(b, type);
// return;
if (lastgltype != type)
{
lastgltype = type;
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2);
APPLYD3DBLEND(type->blendmode);
}
c = b->next;
q = c->p;
p = b->p;
cr = q->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = q->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = q->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = q->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
c = b->next;
q = c->p;
p = b->p;
VectorSubtract(r_refdef.vieworg, q->org, v);
VectorNormalize(v);
CrossProduct(c->dir, v, crv);
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(q->org, -q->scale, crv, d3dparticlevertut[0].org);
d3dparticlevertut[0].colour = colour;
VectorMA(q->org, q->scale, crv, d3dparticlevertut[1].org);
d3dparticlevertut[1].colour = colour;
cr = p->rgb[0]*255;
if (cr < 0) cr = 0;
if (cr > 255) cr = 255;
cg = p->rgb[1]*255;
if (cg < 0) cg = 0;
if (cg > 255) cg = 255;
cb = p->rgb[2]*255;
if (cb < 0) cb = 0;
if (cb > 255) cb = 255;
ca = p->alpha*255;
if (ca < 0) ca = 0;
if (ca > 255) ca = 255;
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
VectorSubtract(r_refdef.vieworg, p->org, v);
VectorNormalize(v);
CrossProduct(b->dir, v, crv); // replace with old p->dir?
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
VectorMA(p->org, p->scale, crv, d3dparticlevertut[2].org);
d3dparticlevertut[2].colour = colour;
VectorMA(p->org, -p->scale, crv, d3dparticlevertut[3].org);
d3dparticlevertut[3].colour = colour;
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE, d3dparticlevertut, 4, d3dparticlevertindexes, 6, 0);
}
qboolean D3D7_DrawParticles(float ptime)
{
RSpeedLocals();
if (!pD3DDev)
return false;
particletime = ptime;
lastgltype = NULL;
PScript_DrawParticleTypes(D3D_DrawParticleBlob, D3D_DrawParticleSpark, D3D_DrawParticleSpark, D3D_DrawParticleSpark, D3D_DrawParticleBeam, D3D_DrawParticleBeamUT, NULL);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ZWRITEENABLE, FALSE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
RSpeedRemark();
RQ_RenderDistAndClear();
RSpeedEnd(RSPEED_PARTICLESDRAW);
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ZWRITEENABLE, TRUE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
return true;
}
#endif
#endif

View File

@ -15,7 +15,7 @@ lightmapinfo_t **lightmap;
void D3D_BuildSurfaceDisplayList (msurface_t *fa)
void D3D7_BuildSurfaceDisplayList (msurface_t *fa)
{
int i, lindex, lnumverts;
medge_t *pedges, *r_pedge;
@ -121,7 +121,7 @@ unsigned blocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE];
unsigned greenblklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE];
unsigned blueblklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE];
void D3DR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift)
void D3D7R_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift)
{
int smax, tmax;
int t;
@ -983,7 +983,7 @@ store:
int D3DFillBlock (int texnum, int w, int h, int x, int y)
int D3D7FillBlock (int texnum, int w, int h, int x, int y)
{
int i, l;
while (texnum >= numlightmaps) //allocate 4 more lightmap slots. not much memory usage, but we don't want any caps here.
@ -1100,7 +1100,7 @@ int D3D7_AllocBlock (int w, int h, int *x, int *y)
}
void D3D_CreateSurfaceLightmap (msurface_t *surf, int shift)
void D3D7_CreateSurfaceLightmap (msurface_t *surf, int shift)
{
int smax, tmax;
qbyte *base, *luxbase; stmap *stainbase;
@ -1122,7 +1122,7 @@ void D3D_CreateSurfaceLightmap (msurface_t *surf, int shift)
}
if (currentmodel->fromgame == fg_quake3)
D3DFillBlock(surf->lightmaptexturenum, smax, tmax, surf->light_s, surf->light_t);
D3D7FillBlock(surf->lightmaptexturenum, smax, tmax, surf->light_s, surf->light_t);
else
surf->lightmaptexturenum = D3D7_AllocBlock (smax, tmax, &surf->light_s, &surf->light_t);
base = lightmap[surf->lightmaptexturenum]->lightmaps;
@ -1134,7 +1134,7 @@ void D3D_CreateSurfaceLightmap (msurface_t *surf, int shift)
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
D3DR_BuildLightMap (surf, base, luxbase, stainbase, shift);
D3D7R_BuildLightMap (surf, base, luxbase, stainbase, shift);
}
@ -1237,7 +1237,7 @@ dynamic:
luxbase += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
stainbase = lightmap[fa->lightmaptexturenum]->stainmaps;
stainbase += (fa->light_t * LMBLOCK_WIDTH + fa->light_s) * 3;
D3DR_BuildLightMap (fa, base, luxbase, stainbase, shift);
D3D7R_BuildLightMap (fa, base, luxbase, stainbase, shift);
RSpeedEnd(RSPEED_DYNAMIC);
}
@ -1245,7 +1245,7 @@ dynamic:
LPDIRECTDRAWSURFACE7 D3D_NewLightmap(void)
LPDIRECTDRAWSURFACE7 D3D7_NewLightmap(void)
{
DWORD tflags = D3DX_TEXTURE_NOMIPMAP; //for now
DWORD twidth = LMBLOCK_WIDTH;
@ -1261,7 +1261,7 @@ LPDIRECTDRAWSURFACE7 D3D_NewLightmap(void)
return newsurf;
}
void D3D_BuildLightmaps (void)
void D3D7_BuildLightmaps (void)
{
DDSURFACEDESC2 desc;
@ -1321,11 +1321,11 @@ void D3D_BuildLightmaps (void)
for (i=0 ; i<m->numsurfaces ; i++)
{
D3D_CreateSurfaceLightmap (m->surfaces + i, shift);
D3D7_CreateSurfaceLightmap (m->surfaces + i, shift);
P_EmitSkyEffectTris(m, &m->surfaces[i]);
if (m->surfaces[i].mesh) //there are some surfaces that have a display list already (the subdivided ones)
continue;
D3D_BuildSurfaceDisplayList (m->surfaces + i);
D3D7_BuildSurfaceDisplayList (m->surfaces + i);
}
}
@ -1344,7 +1344,7 @@ void D3D_BuildLightmaps (void)
if (!lightmap_d3dtextures[i])
{
lightmap_d3dtextures[i] = D3D_NewLightmap();
lightmap_d3dtextures[i] = D3D7_NewLightmap();
if (!lightmap_d3dtextures[i])
{

View File

@ -10,9 +10,9 @@
#include "d3dx.h"
#include "glquake.h"
void *D3D_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags);
void *D3D_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
void *D3D_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
void *D3D7_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags);
void *D3D7_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
void *D3D7_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
/*
#define D3D9_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) (int)D3D9_LoadTexture_8_Pal32(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal)
#define D3D9_LoadTexture(skinname,width,height,data,usemips,alpha) (int)D3D9_LoadTexture_8_Pal24(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal, 255)
@ -30,10 +30,10 @@ void *D3D9_LoadTexture_8_Pal24(char *name, unsigned char *data, int width, int h
void *D3D9_LoadTexture_8_Pal32(char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
#define D3D_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D_LoadTexture_8_Pal32:D3D9_LoadTexture_8_Pal32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette)
#define D3D_LoadTexture8Pal24(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette, 255)
#define D3D_LoadTexture(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal, 255)
#define D3D_LoadTexture32(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D_LoadTexture_32:D3D9_LoadTexture_32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP)
#define D3D_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal32:D3D9_LoadTexture_8_Pal32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette)
#define D3D_LoadTexture8Pal24(skinname,width,height,data,palette,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, palette, 255)
#define D3D_LoadTexture(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_8_Pal24:D3D9_LoadTexture_8_Pal24)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP, host_basepal, 255)
#define D3D_LoadTexture32(skinname,width,height,data,usemips,alpha) (int)(pD3DDev?D3D7_LoadTexture_32:D3D9_LoadTexture_32)(skinname, data, width, height, (usemips?TF_MIPMAP:TF_NOMIPMAP) | (alpha?TF_ALPHA:TF_NOALPHA) | TF_NOTBUMPMAP)
#define D3D_LoadTextureFB(skinname,width,height,data,usemips,alpha) 0
#define D3D_LoadTexture8Bump(skinname,width,height,data,usemips,alpha) 0

View File

@ -107,7 +107,7 @@ qbyte GetPaletteIndex(int red, int green, int blue)
#endif
void BuildGammaTable (float g, float c);
void D3D_VID_GenPaletteTables (unsigned char *palette)
void D3D7_VID_GenPaletteTables (unsigned char *palette)
{
qbyte *pal;
unsigned r,g,b;
@ -489,7 +489,7 @@ static LRESULT WINAPI D3D7_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
qboolean D3D_VID_Init(rendererstate_t *info, unsigned char *palette)
qboolean D3D7_VID_Init(rendererstate_t *info, unsigned char *palette)
{
DWORD width = info->width;
DWORD height = info->height;
@ -650,7 +650,7 @@ qboolean D3D_VID_Init(rendererstate_t *info, unsigned char *palette)
GetWindowRect(mainwindow, &window_rect);
D3D_VID_GenPaletteTables(palette);
D3D7_VID_GenPaletteTables(palette);
@ -669,21 +669,21 @@ qboolean D3D_VID_Init(rendererstate_t *info, unsigned char *palette)
qboolean (D3D_R_CheckSky) (void)
qboolean (D3D7_R_CheckSky) (void)
{
return false;
}
void (D3D_R_SetSky) (char *name, float rotate, vec3_t axis)
void (D3D7_R_SetSky) (char *name, float rotate, vec3_t axis)
{
}
void (D3D_R_NewMap) (void)
void (D3D7_R_NewMap) (void)
{
extern int skytexturenum;
int i;
r_worldentity.model = cl.worldmodel;
GLR_AnimateLight();
D3D_BuildLightmaps();
D3D7_BuildLightmaps();
P_ClearParticles();
@ -703,70 +703,70 @@ void (D3D_R_NewMap) (void)
mleaf_t *r_viewleaf, *r_oldviewleaf;
mleaf_t *r_viewleaf2, *r_oldviewleaf2;
void (D3D_R_PreNewMap) (void)
void (D3D7_R_PreNewMap) (void)
{
r_viewleaf = NULL;
r_oldviewleaf = NULL;
r_viewleaf2 = NULL;
r_oldviewleaf2 = NULL;
}
int (D3D_R_LightPoint) (vec3_t point)
int (D3D7_R_LightPoint) (vec3_t point)
{
return 0;
}
void (D3D_R_PushDlights) (void)
void (D3D7_R_PushDlights) (void)
{
}
void (D3D_R_AddStain) (vec3_t org, float red, float green, float blue, float radius)
void (D3D7_R_AddStain) (vec3_t org, float red, float green, float blue, float radius)
{
}
void (D3D_R_LessenStains) (void)
void (D3D7_R_LessenStains) (void)
{
}
void (D3D_Mod_Init) (void)
void (D3D7_Mod_Init) (void)
{
}
void (D3D_Mod_ClearAll) (void)
void (D3D7_Mod_ClearAll) (void)
{
}
struct model_s *(D3D_Mod_ForName) (char *name, qboolean crash)
struct model_s *(D3D7_Mod_ForName) (char *name, qboolean crash)
{
return NULL;
}
struct model_s *(D3D_Mod_FindName) (char *name)
struct model_s *(D3D7_Mod_FindName) (char *name)
{
return NULL;
}
void *(D3D_Mod_Extradata) (struct model_s *mod)
void *(D3D7_Mod_Extradata) (struct model_s *mod)
{
return NULL;
} // handles caching
void (D3D_Mod_TouchModel) (char *name)
void (D3D7_Mod_TouchModel) (char *name)
{
}
void (D3D_Mod_NowLoadExternal) (void)
void (D3D7_Mod_NowLoadExternal) (void)
{
}
void (D3D_Mod_Think) (void)
void (D3D7_Mod_Think) (void)
{
}
qboolean(D3D_Mod_GetTag) (struct model_s *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result)
qboolean(D3D7_Mod_GetTag) (struct model_s *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result)
{
return false;
}
int (D3D_Mod_TagNumForName) (struct model_s *model, char *name)
int (D3D7_Mod_TagNumForName) (struct model_s *model, char *name)
{
return 0;
}
int (D3D_Mod_SkinForName) (struct model_s *model, char *name)
int (D3D7_Mod_SkinForName) (struct model_s *model, char *name)
{
return 0;
}
void (D3D_VID_DeInit) (void)
void (D3D7_VID_DeInit) (void)
{
if (pPrimary)
{
@ -799,39 +799,39 @@ void (D3D_VID_DeInit) (void)
mainwindow = NULL;
}
}
void (D3D_VID_LockBuffer) (void)
void (D3D7_VID_LockBuffer) (void)
{
}
void (D3D_VID_UnlockBuffer) (void)
void (D3D7_VID_UnlockBuffer) (void)
{
}
void (D3D_D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height)
void (D3D7_D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height)
{
}
void (D3D_D_EndDirectRect) (int x, int y, int width, int height)
void (D3D7_D_EndDirectRect) (int x, int y, int width, int height)
{
}
void (D3D_VID_ForceLockState) (int lk)
void (D3D7_VID_ForceLockState) (int lk)
{
}
int (D3D_VID_ForceUnlockedAndReturnState) (void)
int (D3D7_VID_ForceUnlockedAndReturnState) (void)
{
return 0;
}
void (D3D_VID_SetPalette) (unsigned char *palette)
void (D3D7_VID_SetPalette) (unsigned char *palette)
{
D3D_VID_GenPaletteTables(palette);
D3D7_VID_GenPaletteTables(palette);
}
void (D3D_VID_ShiftPalette) (unsigned char *palette)
void (D3D7_VID_ShiftPalette) (unsigned char *palette)
{
D3D_VID_GenPaletteTables(palette);
D3D7_VID_GenPaletteTables(palette);
}
char *(D3D_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight)
char *(D3D7_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight)
{
return NULL;
}
void (D3D_VID_SetWindowCaption) (char *msg)
void (D3D7_VID_SetWindowCaption) (char *msg)
{
SetWindowText(mainwindow, msg);
}
@ -841,7 +841,7 @@ void d3d7_ortho(float *m)
D3DXMatrixOrthoOffCenter((D3DXMATRIX*)m, 0, vid.width, vid.height, 0, -100, 100);
}
void D3D_Set2D (void)
void D3D7_Set2D (void)
{
int r;
float m[16];
@ -881,13 +881,13 @@ void D3D_Set2D (void)
// pD3DDev->lpVtbl->BeginScene(pD3DDev);
}
void D3D_GetBufferSize(int *width, int *height)
void D3D7_GetBufferSize(int *width, int *height)
{
pD3DX->lpVtbl->GetBufferSize((void*)pD3DX, width, height);
}
void (D3D_SCR_UpdateScreen) (void)
void (D3D7_SCR_UpdateScreen) (void)
{
extern cvar_t vid_conheight;
int uimenu;
@ -952,7 +952,7 @@ void (D3D_SCR_UpdateScreen) (void)
#endif
pD3DDev->lpVtbl->BeginScene(pD3DDev);
D3D_Set2D ();
D3D7_Set2D ();
/*
#ifdef TEXTEDITOR
if (editormodal)
@ -1023,7 +1023,7 @@ void (D3D_SCR_UpdateScreen) (void)
}
D3D_Set2D ();
D3D7_Set2D ();
// GLR_BrightenScreen();
@ -1087,82 +1087,82 @@ void (D3D_SCR_UpdateScreen) (void)
mpic_t *(D3D_Draw_SafePicFromWad) (char *name);
mpic_t *(D3D_Draw_CachePic) (char *path);
mpic_t *(D3D_Draw_SafeCachePic) (char *path);
void (D3D_Draw_Init) (void);
void (D3D_Draw_ReInit) (void);
void (D3D_Draw_Character) (int x, int y, unsigned int num);
void (D3D_Draw_ColouredCharacter) (int x, int y, unsigned int num);
void (D3D_Draw_String) (int x, int y, const qbyte *str);
void (D3D_Draw_Alt_String) (int x, int y, const qbyte *str);
void (D3D_Draw_Crosshair) (void);
void (D3D_Draw_DebugChar) (qbyte num);
void (D3D_Draw_Pic) (int x, int y, mpic_t *pic);
void (D3D_Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
void (D3D_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
void (D3D_Draw_TransPic) (int x, int y, mpic_t *pic);
void (D3D_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation);
void (D3D_Draw_ConsoleBackground) (int lines);
void (D3D_Draw_EditorBackground) (int lines);
void (D3D_Draw_TileClear) (int x, int y, int w, int h);
void (D3D_Draw_Fill) (int x, int y, int w, int h, int c);
void (D3D_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b);
void (D3D_Draw_FadeScreen) (void);
void (D3D_Draw_BeginDisc) (void);
void (D3D_Draw_EndDisc) (void);
mpic_t *(D3D7_Draw_SafePicFromWad) (char *name);
mpic_t *(D3D7_Draw_CachePic) (char *path);
mpic_t *(D3D7_Draw_SafeCachePic) (char *path);
void (D3D7_Draw_Init) (void);
void (D3D7_Draw_ReInit) (void);
void (D3D7_Draw_Character) (int x, int y, unsigned int num);
void (D3D7_Draw_ColouredCharacter) (int x, int y, unsigned int num);
void (D3D7_Draw_String) (int x, int y, const qbyte *str);
void (D3D7_Draw_Alt_String) (int x, int y, const qbyte *str);
void (D3D7_Draw_Crosshair) (void);
void (D3D7_Draw_DebugChar) (qbyte num);
void (D3D7_Draw_Pic) (int x, int y, mpic_t *pic);
void (D3D7_Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
void (D3D7_Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
void (D3D7_Draw_TransPic) (int x, int y, mpic_t *pic);
void (D3D7_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation);
void (D3D7_Draw_ConsoleBackground) (int lines);
void (D3D7_Draw_EditorBackground) (int lines);
void (D3D7_Draw_TileClear) (int x, int y, int w, int h);
void (D3D7_Draw_Fill) (int x, int y, int w, int h, int c);
void (D3D7_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b);
void (D3D7_Draw_FadeScreen) (void);
void (D3D7_Draw_BeginDisc) (void);
void (D3D7_Draw_EndDisc) (void);
void (D3D_Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic
void (D3D_Draw_ImageColours) (float r, float g, float b, float a);
void (D3D7_Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic
void (D3D7_Draw_ImageColours) (float r, float g, float b, float a);
void (D3D_R_Init) (void);
void (D3D_R_DeInit) (void);
void (D3D_R_ReInit) (void);
void (D3D_R_RenderView) (void); // must set r_refdef first
void (D3D7_R_Init) (void);
void (D3D7_R_DeInit) (void);
void (D3D7_R_ReInit) (void);
void (D3D7_R_RenderView) (void); // must set r_refdef first
qboolean (D3D_R_CheckSky) (void);
void (D3D_R_SetSky) (char *name, float rotate, vec3_t axis);
qboolean (D3D7_R_CheckSky) (void);
void (D3D7_R_SetSky) (char *name, float rotate, vec3_t axis);
void (D3D_R_NewMap) (void);
void (D3D_R_PreNewMap) (void);
int (D3D_R_LightPoint) (vec3_t point);
void (D3D7_R_NewMap) (void);
void (D3D7_R_PreNewMap) (void);
int (D3D7_R_LightPoint) (vec3_t point);
void (D3D_R_PushDlights) (void);
void (D3D_R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
void (D3D_R_LessenStains) (void);
void (D3D7_R_PushDlights) (void);
void (D3D7_R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
void (D3D7_R_LessenStains) (void);
void (D3D_Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up...
void (D3D_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down
void (D3D_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette)
void (D3D7_Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up...
void (D3D7_Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down
void (D3D7_Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette)
void (D3D_Mod_Init) (void);
void (D3D_Mod_ClearAll) (void);
struct model_s *(D3D_Mod_ForName) (char *name, qboolean crash);
struct model_s *(D3D_Mod_FindName) (char *name);
void *(D3D_Mod_Extradata) (struct model_s *mod); // handles caching
void (D3D_Mod_TouchModel) (char *name);
void (D3D7_Mod_Init) (void);
void (D3D7_Mod_ClearAll) (void);
struct model_s *(D3D7_Mod_ForName) (char *name, qboolean crash);
struct model_s *(D3D7_Mod_FindName) (char *name);
void *(D3D7_Mod_Extradata) (struct model_s *mod); // handles caching
void (D3D7_Mod_TouchModel) (char *name);
void (D3D_Mod_NowLoadExternal) (void);
void (D3D_Mod_Think) (void);
qboolean(D3D_Mod_GetTag) (struct model_s *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result);
int (D3D_Mod_TagNumForName) (struct model_s *model, char *name);
int (D3D_Mod_SkinForName) (struct model_s *model, char *name);
void (D3D7_Mod_NowLoadExternal) (void);
void (D3D7_Mod_Think) (void);
qboolean(D3D7_Mod_GetTag) (struct model_s *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result);
int (D3D7_Mod_TagNumForName) (struct model_s *model, char *name);
int (D3D7_Mod_SkinForName) (struct model_s *model, char *name);
qboolean (D3D_VID_Init) (rendererstate_t *info, unsigned char *palette);
void (D3D_VID_DeInit) (void);
void (D3D_VID_LockBuffer) (void);
void (D3D_VID_UnlockBuffer) (void);
void (D3D_D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height);
void (D3D_D_EndDirectRect) (int x, int y, int width, int height);
void (D3D_VID_ForceLockState) (int lk);
int (D3D_VID_ForceUnlockedAndReturnState) (void);
void (D3D_VID_SetPalette) (unsigned char *palette);
void (D3D_VID_ShiftPalette) (unsigned char *palette);
char *(D3D_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (D3D_VID_SetWindowCaption) (char *msg);
qboolean (D3D7_VID_Init) (rendererstate_t *info, unsigned char *palette);
void (D3D7_VID_DeInit) (void);
void (D3D7_VID_LockBuffer) (void);
void (D3D7_VID_UnlockBuffer) (void);
void (D3D7_D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height);
void (D3D7_D_EndDirectRect) (int x, int y, int width, int height);
void (D3D7_VID_ForceLockState) (int lk);
int (D3D7_VID_ForceUnlockedAndReturnState) (void);
void (D3D7_VID_SetPalette) (unsigned char *palette);
void (D3D7_VID_ShiftPalette) (unsigned char *palette);
char *(D3D7_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (D3D7_VID_SetWindowCaption) (char *msg);
void (D3D_SCR_UpdateScreen) (void);
void (D3D7_SCR_UpdateScreen) (void);
@ -1178,53 +1178,54 @@ rendererinfo_t d3d7rendererinfo =
},
QR_DIRECT3D,
D3D_Draw_SafePicFromWad,
D3D_Draw_CachePic,
D3D_Draw_SafeCachePic,
D3D_Draw_Init,
D3D_Draw_ReInit,
D3D_Draw_Character,
D3D_Draw_ColouredCharacter,
D3D_Draw_String,
D3D_Draw_Alt_String,
D3D_Draw_Crosshair,
D3D_Draw_DebugChar,
D3D_Draw_Pic,
D3D_Draw_ScalePic,
D3D_Draw_SubPic,
D3D_Draw_TransPic,
D3D_Draw_TransPicTranslate,
D3D_Draw_ConsoleBackground,
D3D_Draw_EditorBackground,
D3D_Draw_TileClear,
D3D_Draw_Fill,
D3D_Draw_FillRGB,
D3D_Draw_FadeScreen,
D3D_Draw_BeginDisc,
D3D_Draw_EndDisc,
D3D7_Draw_SafePicFromWad,
D3D7_Draw_CachePic,
D3D7_Draw_SafeCachePic,
D3D7_Draw_Init,
D3D7_Draw_ReInit,
D3D7_Draw_Character,
D3D7_Draw_ColouredCharacter,
NULL,
D3D7_Draw_String,
D3D7_Draw_Alt_String,
D3D7_Draw_Crosshair,
D3D7_Draw_DebugChar,
D3D7_Draw_Pic,
D3D7_Draw_ScalePic,
D3D7_Draw_SubPic,
D3D7_Draw_TransPic,
D3D7_Draw_TransPicTranslate,
D3D7_Draw_ConsoleBackground,
D3D7_Draw_EditorBackground,
D3D7_Draw_TileClear,
D3D7_Draw_Fill,
D3D7_Draw_FillRGB,
D3D7_Draw_FadeScreen,
D3D7_Draw_BeginDisc,
D3D7_Draw_EndDisc,
D3D_Draw_Image,
D3D_Draw_ImageColours,
D3D7_Draw_Image,
D3D7_Draw_ImageColours,
D3D_R_Init,
D3D_R_DeInit,
D3D_R_ReInit,
D3D_R_RenderView,
D3D7_R_Init,
D3D7_R_DeInit,
D3D7_R_ReInit,
D3D7_R_RenderView,
D3D_R_CheckSky,
D3D_R_SetSky,
D3D7_R_CheckSky,
D3D7_R_SetSky,
D3D_R_NewMap,
D3D_R_PreNewMap,
D3D_R_LightPoint,
D3D7_R_NewMap,
D3D7_R_PreNewMap,
D3D7_R_LightPoint,
D3D_R_PushDlights,
D3D_R_AddStain,
D3D_R_LessenStains,
D3D7_R_PushDlights,
D3D7_R_AddStain,
D3D7_R_LessenStains,
D3D_Media_ShowFrameBGR_24_Flip,
D3D_Media_ShowFrameRGBA_32,
D3D_Media_ShowFrame8bit,
D3D7_Media_ShowFrameBGR_24_Flip,
D3D7_Media_ShowFrameRGBA_32,
D3D7_Media_ShowFrame8bit,
GLMod_Init,
GLMod_ClearAll,
@ -1235,25 +1236,25 @@ rendererinfo_t d3d7rendererinfo =
GLMod_NowLoadExternal,
GLMod_Think,
D3D_Mod_GetTag,
D3D_Mod_TagNumForName,
D3D_Mod_SkinForName,
D3D7_Mod_GetTag,
D3D7_Mod_TagNumForName,
D3D7_Mod_SkinForName,
D3D_VID_Init,
D3D_VID_DeInit,
D3D_VID_LockBuffer,
D3D_VID_UnlockBuffer,
D3D_D_BeginDirectRect,
D3D_D_EndDirectRect,
D3D_VID_ForceLockState,
D3D_VID_ForceUnlockedAndReturnState,
D3D_VID_SetPalette,
D3D_VID_ShiftPalette,
D3D_VID_GetRGBInfo,
D3D_VID_SetWindowCaption,
D3D7_VID_Init,
D3D7_VID_DeInit,
D3D7_VID_LockBuffer,
D3D7_VID_UnlockBuffer,
D3D7_D_BeginDirectRect,
D3D7_D_EndDirectRect,
D3D7_VID_ForceLockState,
D3D7_VID_ForceUnlockedAndReturnState,
D3D7_VID_SetPalette,
D3D7_VID_ShiftPalette,
D3D7_VID_GetRGBInfo,
D3D7_VID_SetWindowCaption,
D3D_SCR_UpdateScreen
D3D7_SCR_UpdateScreen
};
#endif

View File

@ -691,7 +691,7 @@ void D3D9_Draw_FillRGB (int x, int y, int w, int h, float r, float g, float b
D3D9_Draw_Fill_I(x, y, w, h, *(unsigned int*)colours);
}
void D3D9_Draw_Fill (int x, int y, int w, int h, int c)
void D3D9_Draw_Fill (int x, int y, int w, int h, unsigned int c)
{
D3D9_Draw_FillRGB(x, y, w, h, host_basepal[c*3+0]/255.0f, host_basepal[c*3+1]/255.0f, host_basepal[c*3+2]/255.0f);
}
@ -700,8 +700,8 @@ void D3D9_Draw_FadeScreen (void)
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_BeginDisc (void)
{
// Sys_Error("D3D function not implemented\n");
{
// Sys_Error("D3D function not implemented\n");
}
void D3D9_Draw_EndDisc (void)
{

View File

@ -113,7 +113,7 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
Skin_Find(e->scoreboard);
tc = e->scoreboard->ttopcolor;
bc = e->scoreboard->tbottomcolor;
/*
//colour forcing
if (cl.splitclients<2 && !(cl.fpd & FPD_NO_FORCE_COLOR)) //no colour/skin forcing in splitscreen.
{
@ -139,7 +139,7 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
if (cl_enemybottomcolor>=0)
bc = cl_enemybottomcolor;
}
}
}*/
}
else
{
@ -305,6 +305,45 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
scaled_width = gl_max_size.value < 512 ? gl_max_size.value : 512;
scaled_height = gl_max_size.value < 512 ? gl_max_size.value : 512;
#if 1
{
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24rgbtable[i];
for (i = 0; i < 16; i++)
{
if (tc >= 16)
{
//assumption: row 0 is pure white.
*((unsigned char*)&translate32[TOP_RANGE+i]+0) = (((tc&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[i]+0))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+1) = (((tc&0x00ff00)>> 8)**((unsigned char*)&d_8to24rgbtable[i]+1))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+2) = (((tc&0x0000ff)>> 0)**((unsigned char*)&d_8to24rgbtable[i]+2))>>8;
*((unsigned char*)&translate32[TOP_RANGE+i]+3) = 0xff;
}
else
{
if (tc < 8)
translate32[TOP_RANGE+i] = d_8to24rgbtable[(tc<<4)+i];
else
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(tc<<4)+15-i];
}
if (bc >= 16)
{
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+0) = (((bc&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[i]+0))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+1) = (((bc&0x00ff00)>> 8)**((unsigned char*)&d_8to24rgbtable[i]+1))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+2) = (((bc&0x0000ff)>> 0)**((unsigned char*)&d_8to24rgbtable[i]+2))>>8;
*((unsigned char*)&translate32[BOTTOM_RANGE+i]+3) = 0xff;
}
else
{
if (bc < 8)
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(bc<<4)+i];
else
translate32[BOTTOM_RANGE+i] = d_8to24rgbtable[(bc<<4)+15-i];
}
}
}
#else
for (i=0 ; i<256 ; i++)
translate[i] = i;
@ -327,6 +366,7 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24rgbtable[translate[i]];
#endif
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
@ -680,7 +720,7 @@ if (e->flags & Q2RF_DEPTHHACK)
for(i = 0;; i++)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
skin = D3D9_ChooseSkin(inf, m->name, e->skinnum, e);
if (!skin)

View File

@ -1381,7 +1381,9 @@ void (D3D9_R_RenderView) (void)
#include "particles.h"
#include "particles.h"
#define TYPESONLY
#include "p_script.c"
#define APPLYD3D9BLEND(bm) \
switch (bm) \
@ -1417,7 +1419,7 @@ typedef struct d3dparticlevertut_s {
float org[3];
unsigned int colour;
} d3dparticlevertut_t;
d3dparticlevertut_t d3dparticlevertut[4];
d3dparticlevertut_t d3dparticlevertut[4];
part_type_t *lastd3dtype;
static vec3_t pright, pup;
@ -1857,7 +1859,7 @@ void D3D9_DrawParticles(float ptime)
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
lastd3dtype = NULL;
DrawParticleTypes(D3D9_DrawParticleBlob, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleBeam, D3D9_DrawParticleBeamUT, NULL);
PScript_DrawParticleTypes(D3D9_DrawParticleBlob, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleBeam, D3D9_DrawParticleBeamUT, NULL);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ZWRITEENABLE, FALSE );
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHATESTENABLE, FALSE );

View File

@ -1,4 +1,7 @@
//#include "ddraw.h"
//#include "ddraw.h"
#ifndef D3D9QUAKE_H
#define D3D9QUAKE_H
#include "d3d9.h"
@ -61,11 +64,13 @@ static void LotsOfLightDirectionHacks (entity_t *e, model_t *m, vec3_t lighta
// d3d9_rmain.c
//
void D3D9_BaseBModelTextures (entity_t *e);
/*
void D3D9_DrawParticleBeam (beamseg_t *b, part_type_t *type);
void D3D9_DrawParticleBeamUT (beamseg_t *b, part_type_t *type);
void D3D9_DrawParticleBlob (particle_t *p, part_type_t *type);
void D3D9_DrawParticleBlob (particle_t *p, part_type_t *type);
void D3D9_DrawParticleSpark (particle_t *p, part_type_t *type);
*/
void D3D9_DrawParticles (float ptime);
void D3D9_DrawParticleSpark (particle_t *p, part_type_t *type);
static void D3D9_DrawSpriteModel (entity_t *e);
void D3D9_DrawTextureChains (void);
void D3D9_DrawWorld (void);
@ -195,3 +200,5 @@ extern index_t dummyindex;
#else
#define D3DFMT_QINDEX D3DFMT_INDEX32
#endif
#endif

View File

@ -1453,7 +1453,8 @@ rendererinfo_t d3d9rendererinfo =
D3D9_Draw_Init,
D3D9_Draw_ReInit,
D3D9_Draw_Character,
D3D9_Draw_ColouredCharacter,
D3D9_Draw_ColouredCharacter,
NULL,
D3D9_Draw_String,
D3D9_Draw_Alt_String,
D3D9_Draw_Crosshair,

View File

@ -2,76 +2,132 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}"
ProjectSection(ProjectDependencies) = postProject
{382E6790-D1CA-48F5-8E53-D114635EB61D} = {382E6790-D1CA-48F5-8E53-D114635EB61D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gas2masm", "gas2masm.vcproj", "{382E6790-D1CA-48F5-8E53-D114635EB61D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
D3DDebug|Win32 = D3DDebug|Win32
D3DDebug|x64 = D3DDebug|x64
Debug Dedicated Server|Win32 = Debug Dedicated Server|Win32
Debug Dedicated Server|x64 = Debug Dedicated Server|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
GLDebug|Win32 = GLDebug|Win32
GLDebug|x64 = GLDebug|x64
GLRelease|Win32 = GLRelease|Win32
GLRelease|x64 = GLRelease|x64
MDebug|Win32 = MDebug|Win32
MDebug|x64 = MDebug|x64
MinGLDebug|Win32 = MinGLDebug|Win32
MinGLDebug|x64 = MinGLDebug|x64
MinGLRelease|Win32 = MinGLRelease|Win32
MinGLRelease|x64 = MinGLRelease|x64
MinSW|Win32 = MinSW|Win32
MinSW|x64 = MinSW|x64
MRelease|Win32 = MRelease|Win32
MRelease|x64 = MRelease|x64
Release Dedicated Server|Win32 = Release Dedicated Server|Win32
Release Dedicated Server|x64 = Release Dedicated Server|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.ActiveCfg = D3DDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.Build.0 = D3DDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|x64.ActiveCfg = D3DDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|x64.Build.0 = D3DDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|Win32.ActiveCfg = Debug Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|Win32.Build.0 = Debug Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.ActiveCfg = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.Build.0 = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|Win32.ActiveCfg = Debug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|Win32.Build.0 = Debug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.ActiveCfg = D3DDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.Build.0 = D3DDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.ActiveCfg = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.Build.0 = GLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.Build.0 = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.ActiveCfg = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.Build.0 = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.ActiveCfg = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.Build.0 = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.ActiveCfg = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|x64.Build.0 = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|Win32.ActiveCfg = MinGLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|Win32.Build.0 = MinGLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|x64.ActiveCfg = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLDebug|x64.Build.0 = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLRelease|Win32.ActiveCfg = MinGLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLRelease|Win32.Build.0 = MinGLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLRelease|x64.ActiveCfg = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLRelease|x64.Build.0 = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinSW|Win32.ActiveCfg = MinSW|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinSW|Win32.Build.0 = MinSW|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinSW|x64.ActiveCfg = MinSW|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinSW|x64.Build.0 = MinSW|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|Win32.ActiveCfg = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|Win32.Build.0 = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.ActiveCfg = MinSW|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.Build.0 = MinSW|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|Win32.ActiveCfg = Release Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|Win32.Build.0 = Release Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.ActiveCfg = Release|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.Build.0 = Release|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|Win32.ActiveCfg = Release|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|Win32.Build.0 = Release|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.ActiveCfg = Release|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.Build.0 = Release|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.D3DDebug|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Debug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.GLRelease|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MDebug|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLDebug|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinGLRelease|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinSW|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinSW|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinSW|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MinSW|x64.Build.0 = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.MRelease|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|x64.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release Dedicated Server|x64.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|Win32.ActiveCfg = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|Win32.Build.0 = Debug|Win32
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.ActiveCfg = Debug|x64
{382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,9 @@
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
@ -103,6 +106,97 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
TypeLibraryName=".\Debug/gas2masm.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
RuntimeLibrary="1"
PrecompiledHeaderFile="..\gas2masm\Debug\gas2masm.pch"
AssemblerListingLocation="..\gas2masm\Debug\"
ObjectFile="..\gas2masm\Debug\"
ProgramDataBaseFileName="..\gas2masm\Debug\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="1"
DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\gas2masm\Debug\gas2masm.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile="..\gas2masm\Debug\gas2masm.pdb"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/gas2masm.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

View File

@ -217,12 +217,12 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "ftequake___Win32_MinGLDebug"
# PROP Intermediate_Dir "ftequake___Win32_MinGLDebug"
# PROP Output_Dir "MinGLDebug"
# PROP Intermediate_Dir "MinGLDebug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NQPROT" /D "_DEBUG" /D "GLQUAKE" /D "SERVERDLL" /D "WIN32" /D "_WINDOWS" /D "Q2SERVER" /D "DYNAMIC_ENTS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLMinDebug/" /Fp".\GLMinDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLMinDebug/" /Fd".\GLMinDebug/" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
@ -250,7 +250,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /Gr /W3 /GX /O2 /Ob2 /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NOSOUNDASM" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "SERVERDLL" /D "NQPROT" /D "WIN32" /D "_WINDOWS" /D "Q2SERVER" /D "DYNAMIC_ENTS" /FR /YX /FD /c
# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR /Yu"quakedef.h" /FD /c
# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR"MinGLRelease/" /Fp"MinGLRelease/ftequake.pch" /Yu"quakedef.h" /Fo"MinGLRelease/" /Fd"MinGLRelease/" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
@ -470,6 +470,11 @@ SOURCE=..\server\pr_cmds.c
# End Source File
# Begin Source File
SOURCE=..\server\pr_q1qvm.c
# ADD CPP /Yu"qwsvdef.h"
# End Source File
# Begin Source File
SOURCE=..\server\savegame.c
# ADD CPP /Yu"qwsvdef.h"
# End Source File
@ -1971,6 +1976,133 @@ SOURCE=..\client\net_master.c
# End Source File
# Begin Source File
SOURCE=..\client\p_classic.c
!IF "$(CFG)" == "ftequake - Win32 Release"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\client\p_null.c
!IF "$(CFG)" == "ftequake - Win32 Release"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\client\p_script.c
!IF "$(CFG)" == "ftequake - Win32 Release"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\client\pr_csqc.c
!IF "$(CFG)" == "ftequake - Win32 Release"
@ -1987,6 +2119,8 @@ SOURCE=..\client\pr_csqc.c
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# PROP Intermediate_Dir "MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
@ -2029,6 +2163,8 @@ SOURCE=..\client\pr_menu.c
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# PROP Intermediate_Dir "MinGLDebug"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
@ -2200,6 +2336,7 @@ SOURCE=..\client\r_partset.c
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# PROP Exclude_From_Build 1
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
@ -2732,6 +2869,21 @@ SOURCE=..\client\snd_win.c
# End Source File
# Begin Source File
SOURCE=..\client\sys_linux.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\client\sys_morphos.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\client\sys_sdl.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\client\sys_win.c
!IF "$(CFG)" == "ftequake - Win32 Release"
@ -6053,6 +6205,10 @@ SOURCE=..\common\pmovetst.c
# End Source File
# Begin Source File
SOURCE=..\common\pr_bgcmd.c
# End Source File
# Begin Source File
SOURCE=..\common\q1bsp.c
# End Source File
# Begin Source File
@ -6122,6 +6278,317 @@ SOURCE=..\QCLIB\Comprout.c
# Begin Source File
SOURCE=..\qclib\execloop.h
!IF "$(CFG)" == "ftequake - Win32 Release"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
# Begin Custom Build
InputDir=\ftesvn - Copy\engine\qclib
InputPath=..\qclib\execloop.h
BuildCmds= \
copy "$(InputPath)" "$(InputDir)\execloop16d.h" \
copy "$(InputPath)" "$(InputDir)\execloop32.h" \
copy "$(InputPath)" "$(InputDir)\execloop32d.h" \
"$(InputDir)\execloop16d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\execloop32d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
@ -6141,6 +6608,7 @@ SOURCE=..\QCLIB\pr_edict.c
# Begin Source File
SOURCE=..\QCLIB\Pr_exec.c
# ADD CPP /D "SEPARATEINCLUDES"
# SUBTRACT CPP /WX /YX /Yc /Yu
# End Source File
# Begin Source File
@ -7424,7 +7892,7 @@ InputName=math
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# Begin Custom Build
OutDir=.\ftequake___Win32_MinGLDebug
OutDir=.\MinGLDebug
InputPath=..\common\math.s
InputName=math
@ -8282,7 +8750,7 @@ InputName=snd_mixa
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# Begin Custom Build
OutDir=.\ftequake___Win32_MinGLDebug
OutDir=.\MinGLDebug
InputPath=..\client\snd_mixa.s
InputName=snd_mixa
@ -8725,7 +9193,7 @@ InputName=sys_wina
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# Begin Custom Build
OutDir=.\ftequake___Win32_MinGLDebug
OutDir=.\MinGLDebug
InputPath=..\client\sys_wina.s
InputName=sys_wina
@ -8912,7 +9380,7 @@ InputName=worlda
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# Begin Custom Build
OutDir=.\ftequake___Win32_MinGLDebug
OutDir=.\MinGLDebug
InputPath=..\server\worlda.s
InputName=worlda
@ -9992,8 +10460,8 @@ SOURCE=..\client\winquake.rc
!IF "$(CFG)" == "ftequake - Win32 Release"
# ADD BASE RSC /l 0x809 /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client"
# ADD RSC /l 0x809 /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL"
# ADD BASE RSC /l 0x809 /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client"
# ADD RSC /l 0x809 /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL"
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"

View File

@ -30,6 +30,33 @@ Package=<4>
###############################################################################
Project: "hud"=..\..\plugins\hud\hud.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name q3asm2
End Project Dependency
}}}
###############################################################################
Project: "q3asm2"=..\..\Q3ASM2\q3asm2.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "qcc"=..\qclib\qcc.dsp - Package Owner=<4>
Package=<5>

View File

@ -1753,7 +1753,7 @@ void R_DrawGAliasModel (entity_t *e)
qglEnable (GL_BLEND);
qglBlendFunc(GL_ONE, GL_ONE);
}
else if ((e->model->flags & EF_SPECIAL_TRANS)) //hexen2 flags.
else if ((e->model->flags & EFH2_SPECIAL_TRANS)) //hexen2 flags.
{
qglEnable (GL_BLEND);
qglBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
@ -1766,12 +1766,12 @@ void R_DrawGAliasModel (entity_t *e)
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
e->shaderRGBAf[3] = r_wateralpha.value;
}
else if ((e->model->flags & EF_TRANSPARENT))
else if ((e->model->flags & EFH2_TRANSPARENT))
{
qglEnable (GL_BLEND);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
else if ((e->model->flags & EF_HOLEY))
else if ((e->model->flags & EFH2_HOLEY))
{
qglEnable (GL_ALPHA_TEST);
// qglEnable (GL_BLEND);
@ -1911,7 +1911,7 @@ void R_DrawGAliasModel (entity_t *e)
memset(&mesh, 0, sizeof(mesh));
for(surfnum=0; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)), surfnum++)
{
needrecolour = R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, nolightdir);
needrecolour = R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, nolightdir);
c_alias_polys += mesh.numindexes/3;
@ -2001,14 +2001,36 @@ void R_DrawGAliasModel (entity_t *e)
if (skin->loweroverlay && r_skin_overlays.value)
{
qglEnable(GL_BLEND);
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->shaderRGBAf[3]);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE);
mesh.colors_array = NULL;
if (e->scoreboard)
{
int c = e->scoreboard->tbottomcolor;
if (c >= 16)
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->shaderRGBAf[3]);
else if (c >= 8)
qglColor4f(host_basepal[c*16*3]/255.0f, host_basepal[c*16*3+1]/255.0f, host_basepal[c*16*3+2]/255.0f, e->shaderRGBAf[3]);
else
qglColor4f(host_basepal[15+c*16*3]/255.0f, host_basepal[15+c*16*3+1]/255.0f, host_basepal[15+c*16*3+2]/255.0f, e->shaderRGBAf[3]);
}
c_alias_polys += mesh.numindexes/3;
GL_DrawAliasMesh(&mesh, skin->loweroverlay);
}
if (skin->upperoverlay && r_skin_overlays.value)
{
qglEnable(GL_BLEND);
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->shaderRGBAf[3]);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE);
mesh.colors_array = NULL;
if (e->scoreboard)
{
int c = e->scoreboard->ttopcolor;
if (c >= 16)
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->shaderRGBAf[3]);
else if (c >= 8)
qglColor4f(host_basepal[c*16*3]/255.0f, host_basepal[c*16*3+1]/255.0f, host_basepal[c*16*3+2]/255.0f, e->shaderRGBAf[3]);
else
qglColor4f(host_basepal[15+c*16*3]/255.0f, host_basepal[15+c*16*3+1]/255.0f, host_basepal[15+c*16*3+2]/255.0f, e->shaderRGBAf[3]);
}
c_alias_polys += mesh.numindexes/3;
GL_DrawAliasMesh(&mesh, skin->upperoverlay);
}
@ -2101,9 +2123,9 @@ qglColor3f(0,0,1);
if (e->flags & Q2RF_DEPTHHACK)
qglDepthRange (gldepthmin, gldepthmax);
if ((currententity->model->flags & EF_SPECIAL_TRANS) && gl_cull.value)
if ((currententity->model->flags & EFH2_SPECIAL_TRANS) && gl_cull.value)
qglEnable( GL_CULL_FACE );
if ((currententity->model->flags & EF_HOLEY))
if ((currententity->model->flags & EFH2_HOLEY))
qglDisable( GL_ALPHA_TEST );
#ifdef SHOWLIGHTDIR //testing
@ -2596,7 +2618,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
{
if (inf->ofs_trineighbours)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, 1, e->frame1time, e->frame2time, true);
R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, 1, e->frame1time, e->frame2time, true);
R_CalcFacing(&mesh, lightorg);
R_ProjectShadowVolume(&mesh, lightorg);
R_DrawShadowVolume(&mesh);

View File

@ -145,37 +145,6 @@ cvar_t r_detailtextures = SCVAR("r_detailtextures", "1");
cvar_t r_showtris = SCVAR("r_showtris", "1");
cvar_t r_shownormals = SCVAR("r_shownormals", "1");
float Q_rsqrt( float number )
{
int i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( int * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
return y;
}
void VectorNormalizeFast( vec3_t v )
{
float ilength;
ilength = Q_rsqrt( DotProduct( v, v ) );
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
mat3_t axisDefault={{1, 0, 0},
{0, 1, 0},
{0, 0, 1}};
@ -1874,49 +1843,46 @@ void R_RenderMeshCombined ( meshbuffer_t *mb, shaderpass_t *pass )
{
GL_SelectTexture( mtexid0 + i );
if ( pass->blendmode )
switch ( pass->blendmode )
{
switch ( pass->blendmode )
{
case GL_DOT3_RGB_ARB:
GL_TexEnv (GL_COMBINE_EXT);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, pass->blendmode);
break;
case GL_DOT3_RGB_ARB:
GL_TexEnv (GL_COMBINE_EXT);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, pass->blendmode);
break;
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:
// these modes are best set with TexEnv, Combine4 would need much more setup
GL_TexEnv (pass->blendmode);
break;
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:
// these modes are best set with TexEnv, Combine4 would need much more setup
GL_TexEnv (pass->blendmode);
break;
case GL_DECAL:
// mimics Alpha-Blending in upper texture stage, but instead of multiplying the alpha-channel, theyre added
// this way it can be possible to use GL_DECAL in both texture-units, while still looking good
// normal mutlitexturing would multiply the alpha-channel which looks ugly
GL_TexEnv (GL_COMBINE_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_ADD);
case GL_DECAL:
// mimics Alpha-Blending in upper texture stage, but instead of multiplying the alpha-channel, theyre added
// this way it can be possible to use GL_DECAL in both texture-units, while still looking good
// normal mutlitexturing would multiply the alpha-channel which looks ugly
GL_TexEnv (GL_COMBINE_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_ADD);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, GL_SRC_ALPHA);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, GL_SRC_ALPHA);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
break;
}
}
else
{
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
break;
default:
GL_TexEnv (GL_COMBINE4_NV);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_ADD);
@ -2034,6 +2000,7 @@ void R_RenderMeshCombined ( meshbuffer_t *mb, shaderpass_t *pass )
qglTexEnvi (GL_TEXTURE_ENV, GL_OPERAND3_ALPHA_NV, GL_ONE_MINUS_SRC_ALPHA);
break;
}
break;
}
R_ModifyTextureCoords ( pass, i );

View File

@ -3095,7 +3095,7 @@ void GL_RoundDimensions(int *scaled_width, int *scaled_height, qboolean mipmap)
GL_Upload32
===============
*/
void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha)
void GL_Upload32_Int (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha, GLenum glcolormode)
{
int miplevel=0;
int samples;
@ -3108,6 +3108,20 @@ void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean m
scaled_height = height;
GL_RoundDimensions(&scaled_width, &scaled_height, mipmap);
if (alpha)
{ //make sure it does actually have those alpha pixels
int i;
alpha = false;
for (i = 3; i < width*height*4; i+=4)
{
if (((unsigned char*)data)[i] < 255)
{
alpha = true;
break;
}
}
}
TRACE(("dbg: GL_Upload32: %i %i\n", scaled_width, scaled_height));
if (scaled_width * scaled_height > sizeofuploadmemorybuffer/4)
@ -3130,7 +3144,7 @@ texels += scaled_width * scaled_height;
if (!mipmap||gl_config.sgis_generate_mipmap) //gotta love this with NPOT textures... :)
{
TRACE(("dbg: GL_Upload32: non-mipmapped/unscaled\n"));
qglTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
qglTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, glcolormode, GL_UNSIGNED_BYTE, data);
goto done;
}
memcpy (scaled, data, width*height*4);
@ -3139,7 +3153,7 @@ texels += scaled_width * scaled_height;
GL_ResampleTexture (data, width, height, scaled, scaled_width, scaled_height);
TRACE(("dbg: GL_Upload32: recaled\n"));
qglTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
qglTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, glcolormode, GL_UNSIGNED_BYTE, scaled);
if (mipmap && !gl_config.sgis_generate_mipmap)
{
miplevel = 0;
@ -3228,6 +3242,15 @@ done:
}
}
void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha)
{
GL_Upload32_Int(name, data, width, height, mipmap, alpha, GL_RGBA);
}
void GL_Upload32_BGRA (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha)
{
GL_Upload32_Int(name, data, width, height, mipmap, alpha, GL_BGRA_EXT);
}
void GL_Upload24BGR (char *name, qbyte *framedata, int inwidth, int inheight, qboolean mipmap, qboolean alpha)
{
int outwidth, outheight;

View File

@ -133,6 +133,13 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
return false;
}
if (header->numcontrollers > MAX_BONE_CONTROLLERS)
{
Con_Printf(CON_ERROR "Cannot load model %s - too many controllers %i\n", mod->name, header->numcontrollers);
Hunk_FreeToLowMark(start);
return false;
}
tex = (hlmdl_tex_t *) ((qbyte *) header + header->textures);
bones = (hlmdl_bone_t *) ((qbyte *) header + header->boneindex);
bonectls = (hlmdl_bonecontroller_t *) ((qbyte *) header + header->controllerindex);
@ -181,107 +188,19 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
return true;
}
/*
=======================================================================================================================
HL_CurSequence - return the current sequence
=======================================================================================================================
*/
int HL_CurSequence(hlmodel_t model)
{
return model.sequence;
}
/*
=======================================================================================================================
HL_NewSequence - animation control (just some range checking really)
=======================================================================================================================
*/
int HL_NewSequence(hlmodel_t *model, int _inew)
{
if(_inew < 0)
_inew = model->header->numseq - 1;
else if(_inew >= model->header->numseq)
_inew = 0;
model->sequence = _inew;
model->frame = 0;
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
hlmdl_sequencelist_t *pseqdesc;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if(_inew == 0)
{
pseqdesc = (hlmdl_sequencelist_t *) ((qbyte *) model->header + model->header->seqindex) + model->sequence;
}
else
{
pseqdesc = (hlmdl_sequencelist_t *) ((qbyte *) model->header + model->header->seqindex) + model->sequence;
}
Sys_Printf("Current Sequence: %s\n", pseqdesc->name);
}
return model->sequence;
}
/*
=======================================================================================================================
HL_SetController - control where the model is facing (upper body usually)
=======================================================================================================================
*/
void HL_SetController(hlmodel_t *model, int num, float value)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
int real, limit;
hlmdl_bonecontroller_t *control = (hlmdl_bonecontroller_t *)
((qbyte *) model->header + model->header->controllerindex);
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if(num >= model->header->numcontrollers) return;
if(num == 4)
{
limit = 64;
}
else
{
limit = 255;
}
if(control->type & (0x0008 | 0x0010 | 0x0020))
{
if(control->end < control->start) value = -value;
if(control->start + 359.0 >= control->end)
{
if(value > ((control->start + control->end) / 2.0) + 180) value = value - 360;
if(value < ((control->start + control->end) / 2.0) - 180) value = value + 360;
}
else
{
if(value > 360)
value = value - (int) (value / 360.0) * 360.0;
else if(value < 0)
value = value + (int) ((value / -360.0) + 1) * 360.0;
}
}
real = limit * (value - control[num].start) / (control[num].end - control[num].start);
if(real < 0) real = 0;
if(real > limit) real = limit;
model->controller[num] = real;
}
/*
=======================================================================================================================
HL_CalculateBones - calculate bone positions - quaternion+vector in one function
=======================================================================================================================
note, while ender may be proud of this function, it lacks the fact that interpolating eular angles is not as acurate as interpolating quaternions.
it is faster though.
*/
void HL_CalculateBones
(
int offset,
int frame,
float lerpfrac,
vec4_t adjust,
hlmdl_bone_t *bone,
hlmdl_anim_t *animation,
@ -291,6 +210,8 @@ void HL_CalculateBones
/*~~~~~~~~~~*/
int i;
vec3_t angle;
float lerpifrac = 1-lerpfrac;
float t;
/*~~~~~~~~~~*/
/* For each vector */
@ -318,18 +239,21 @@ void HL_CalculateBones
if(animvalue->num.valid > tempframe)
{
if(animvalue->num.valid > (tempframe + 1))
angle[i] += animvalue[tempframe + 1].value * 1; // + 0 * animvalue[tempframe + 2].value * bone->scale[o];
{
//we can lerp that
t = animvalue[tempframe + 1].value * lerpifrac + lerpfrac * animvalue[tempframe + 2].value;
}
else
angle[i] = animvalue[animvalue->num.valid].value;
angle[i] = bone->value[o] + angle[i] * bone->scale[o];
t = animvalue[animvalue->num.valid].value;
angle[i] = bone->value[o] + t * bone->scale[o];
}
else
{
if(animvalue->num.total <= tempframe + 1)
if(animvalue->num.total < tempframe + 1)
{
angle[i] +=
(animvalue[animvalue->num.valid].value * 1 +
0 * animvalue[animvalue->num.valid + 2].value) *
(animvalue[animvalue->num.valid].value * lerpifrac +
lerpfrac * animvalue[animvalue->num.valid + 2].value) *
bone->scale[o];
}
else
@ -339,7 +263,8 @@ void HL_CalculateBones
}
}
if(bone->bonecontroller[o] != -1) { /* Add the programmable offset. */
if(bone->bonecontroller[o] != -1)
{ /* Add the programmable offset. */
angle[i] += adjust[bone->bonecontroller[o]];
}
}
@ -380,7 +305,7 @@ void HL_CalcBoneAdj(hlmodel_t *model)
}
else
{
value = model->controller[j];
value = (model->controller[j]+1)*0.5; //shifted to give a valid range between -1 and 1, with 0 being mid-range.
if(value < 0)
value = 0;
else if(value > 1.0)
@ -401,15 +326,20 @@ void HL_CalcBoneAdj(hlmodel_t *model)
HL_SetupBones - determine where vertex should be using bone movements
=======================================================================================================================
*/
void HL_SetupBones(hlmodel_t *model)
void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt );
void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, float subblendfrac)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
int i;
float matrix[3][4];
static vec3_t positions[128];
static vec4_t quaternions[128];
static vec3_t positions[2];
static vec4_t quaternions[2], blended;
float frametime;
int frame;
hlmdl_sequencelist_t *sequence = (hlmdl_sequencelist_t *) ((qbyte *) model->header + model->header->seqindex) +
model->sequence;
((unsigned int)seqnum>=model->header->numseq?0:seqnum);
hlmdl_sequencedata_t *sequencedata = (hlmdl_sequencedata_t *)
((qbyte *) model->header + model->header->seqgroups) +
sequence->seqindex;
@ -417,40 +347,119 @@ void HL_SetupBones(hlmodel_t *model)
((qbyte *) model->header + sequencedata->data + sequence->index);
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
frametime = (cl.time - cl.lerpents[currententity->keynum].framechange)*sequence->timing;
frame = (int)frametime;
frametime -= frame;
if (!sequence->numframes)
return;
if(frame >= sequence->numframes)
{
if (sequence->motiontype&1)
frame = sequence->numframes-1;
else
frame %= sequence->numframes;
}
if (lastbone > model->header->numbones)
lastbone = model->header->numbones;
HL_CalcBoneAdj(model); /* Deal with programmable controllers */
if(sequence->motiontype & 0x0001) positions[sequence->motionbone][0] = 0.0;
if(sequence->motiontype & 0x0002) positions[sequence->motionbone][1] = 0.0;
if(sequence->motiontype & 0x0004) positions[sequence->motionbone][2] = 0.0;
/*FIXME:this is useless*/
/*
if(sequence->motiontype & 0x0001)
positions[sequence->motionbone][0] = 0.0;
if(sequence->motiontype & 0x0002)
positions[sequence->motionbone][1] = 0.0;
if(sequence->motiontype & 0x0004)
positions[sequence->motionbone][2] = 0.0;
*/
/* Sys_Printf("Frame: %i\n", model->frame); */
for(i = 0; i < model->header->numbones; i++)
{
/*
* There are two vector offsets in the structure. The first seems to be the
* positions of the bones, the second the quats of the bone matrix itself. We
* convert it inside the routine - Inconsistant, but hey.. so's the whole model
* format.
*/
HL_CalculateBones(0, model->frame, model->adjust, model->bones + i, animation + i, positions[i]);
HL_CalculateBones(3, model->frame, model->adjust, model->bones + i, animation + i, quaternions[i]);
/*
this is hellish.
a hl model blends:
4 controllers (on a player, it seems each one of them twists a separate bone in the chest)
a mouth (not used on players)
its a sequence (to be smooth we need to blend between two frames in the sequence)
up to four source animations (ironically used to pitch up/down)
alternate sequence (walking+firing)
frame2 (quake expectations.)
/* FIXME: Blend the bones and make them cry :) */
QuaternionGLMatrix(quaternions[i][0], quaternions[i][1], quaternions[i][2], quaternions[i][3], matrix);
matrix[0][3] = positions[i][0];
matrix[1][3] = positions[i][1];
matrix[2][3] = positions[i][2];
this is madness, quite frankly.
/* If we have a parent, take the addition. Otherwise just copy the values */
if(model->bones[i].parent>=0)
{
R_ConcatTransforms(transform_matrix[model->bones[i].parent], matrix, transform_matrix[i]);
}
else
{
memcpy(transform_matrix[i], matrix, 12 * sizeof(float));
}
}
luckily...
controllers and mouth control the entire thing. they should be interpolated outside, and have no affect on blending here
alternate sequences replace. we can just call this function twice (so long as bone ranges are incremental).
autoanimating sequence is handled inside HL_CalculateBones (sequences are weird and it has to be handled there anyway)
this means we only have sources and alternate frames left to cope with.
FIXME: we don't handle frame2.
*/
if (sequence->hasblendseq>1)
{
if (subblendfrac < 0)
subblendfrac = 0;
if (subblendfrac > 1)
subblendfrac = 1;
for(i = firstbone; i < lastbone; i++)
{
HL_CalculateBones(0, frame, frametime, model->adjust, model->bones + i, animation + i, positions[0]);
HL_CalculateBones(3, frame, frametime, model->adjust, model->bones + i, animation + i, quaternions[0]);
HL_CalculateBones(3, frame, frametime, model->adjust, model->bones + i, animation + i + model->header->numbones, quaternions[1]);
QuaternionSlerp(quaternions[0], quaternions[1], subblendfrac, blended);
QuaternionGLMatrix(blended[0], blended[1], blended[2], blended[3], matrix);
matrix[0][3] = positions[0][0];
matrix[1][3] = positions[0][1];
matrix[2][3] = positions[0][2];
/* If we have a parent, take the addition. Otherwise just copy the values */
if(model->bones[i].parent>=0)
{
R_ConcatTransforms(transform_matrix[model->bones[i].parent], matrix, transform_matrix[i]);
}
else
{
memcpy(transform_matrix[i], matrix, 12 * sizeof(float));
}
}
}
else
{
for(i = firstbone; i < lastbone; i++)
{
/*
* There are two vector offsets in the structure. The first seems to be the
* positions of the bones, the second the quats of the bone matrix itself. We
* convert it inside the routine - Inconsistant, but hey.. so's the whole model
* format.
*/
HL_CalculateBones(0, frame, frametime, model->adjust, model->bones + i, animation + i, positions[0]);
HL_CalculateBones(3, frame, frametime, model->adjust, model->bones + i, animation + i, quaternions[0]);
QuaternionGLMatrix(quaternions[0][0], quaternions[0][1], quaternions[0][2], quaternions[0][3], matrix);
matrix[0][3] = positions[0][0];
matrix[1][3] = positions[0][1];
matrix[2][3] = positions[0][2];
/* If we have a parent, take the addition. Otherwise just copy the values */
if(model->bones[i].parent>=0)
{
R_ConcatTransforms(transform_matrix[model->bones[i].parent], matrix, transform_matrix[i]);
}
else
{
memcpy(transform_matrix[i], matrix, 12 * sizeof(float));
}
}
}
}
/*
@ -465,7 +474,6 @@ void R_DrawHLModel(entity_t *curent)
hlmodel_t model;
int b, m, v;
short *skins;
hlmdl_sequencelist_t *sequence;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//general model
@ -474,38 +482,10 @@ void R_DrawHLModel(entity_t *curent)
model.bones = (hlmdl_bone_t *) ((char *)modelc + modelc->bones);
model.bonectls = (hlmdl_bonecontroller_t *) ((char *)modelc + modelc->bonectls);
//specific to entity
model.sequence = curent->frame;
model.frame = 0;
model.frametime = 0;
HL_NewSequence(&model, curent->frame);
skins = (short *) ((qbyte *) model.header + model.header->skins);
sequence = (hlmdl_sequencelist_t *) ((qbyte *) model.header + model.header->seqindex) +
model.sequence;
model.controller[0] = curent->bonecontrols[0];
model.controller[1] = curent->bonecontrols[1];
model.controller[2] = curent->bonecontrols[2];
model.controller[3] = curent->bonecontrols[3];
model.controller[4] = 0;//sin(cl.time)*127+127;
model.frametime += (cl.time - cl.lerpents[curent->keynum].framechange)*sequence->timing;
if (model.frametime>=1)
{
model.frame += (int) model.frametime;
model.frametime -= (int)model.frametime;
}
if (!sequence->numframes)
return;
if(model.frame >= sequence->numframes)
model.frame %= sequence->numframes;
if (sequence->motiontype)
model.frame = sequence->numframes-1;
for (b = 0; b < MAX_BONE_CONTROLLERS; b++)
model.controller[b] = curent->bonecontrols[b];
GL_TexEnv(GL_MODULATE);
@ -531,7 +511,8 @@ void R_DrawHLModel(entity_t *curent)
R_RotateForEntity (curent);
HL_SetupBones(&model); /* Setup the bones */
HL_SetupBones(&model, curent->baseframe1, 0, curent->basebone, (curent->basesubblendfrac+1)*0.5); /* Setup the bones */
HL_SetupBones(&model, curent->frame1, curent->basebone, model.header->numbones, (curent->subblendfrac+1)*0.5); /* Setup the bones */
/* Manipulate each mesh directly */
for(b = 0; b < model.header->numbodyparts; b++)

View File

@ -490,10 +490,10 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash)
// get string used for replacement tokens
ext = COM_FileExtension(mod->name);
if (!Q_strcasecmp(ext, "spr") || !Q_strcasecmp(ext, "sp2"))
replstr = NULL; // sprite
replstr = ""; // sprite
else if (!Q_strcasecmp(ext, "dsp")) // doom sprite
{
replstr = NULL;
replstr = "";
doomsprite = true;
}
else // assume models
@ -501,20 +501,17 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash)
// gl_load24bit 0 disables all replacements
if (!gl_load24bit.value)
replstr = NULL;
replstr = "";
COM_StripExtension(mod->name, mdlbase, sizeof(mdlbase));
while (1)
while (replstr)
{
for (replstr = COM_ParseStringSet(replstr); com_token[0] && !buf; replstr = COM_ParseStringSet(replstr))
replstr = COM_ParseStringSet(replstr);
if (replstr)
buf = (unsigned *)COM_LoadStackFile (va("%s.%s", mdlbase, com_token), stackbuf, sizeof(stackbuf));
if (!buf)
else
{
if (lastload) // only load unreplaced file once
break;
lastload = true;
buf = (unsigned *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf));
if (!buf)
{
@ -530,6 +527,8 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash)
break; // failed to load unreplaced file and nothing left
}
}
if (!buf)
continue;
//
// allocate a new model
@ -2234,6 +2233,9 @@ qboolean GLMod_LoadClipnodes (lump_t *l)
hull->clip_maxs[1] = 48;
hull->clip_maxs[2] = 50;
hull->available = true;
//6 isn't used.
//7 isn't used.
}
else if (loadmodel->fromgame == fg_halflife)
{
@ -2244,10 +2246,10 @@ qboolean GLMod_LoadClipnodes (lump_t *l)
hull->planes = loadmodel->planes;
hull->clip_mins[0] = -16;
hull->clip_mins[1] = -16;
hull->clip_mins[2] = -36;
hull->clip_mins[2] = -32;//-36 is correct here, but we'll just copy mvdsv instead.
hull->clip_maxs[0] = 16;
hull->clip_maxs[1] = 16;
hull->clip_maxs[2] = 36;
hull->clip_maxs[2] = hull->clip_mins[2]+72;
hull->available = true;
hull = &loadmodel->hulls[2];
@ -2260,7 +2262,7 @@ qboolean GLMod_LoadClipnodes (lump_t *l)
hull->clip_mins[2] = -32;
hull->clip_maxs[0] = 32;
hull->clip_maxs[1] = 32;
hull->clip_maxs[2] = 32;
hull->clip_maxs[2] = hull->clip_mins[2]+64;
hull->available = true;
hull = &loadmodel->hulls[3];
@ -2273,7 +2275,7 @@ qboolean GLMod_LoadClipnodes (lump_t *l)
hull->clip_mins[2] = -18;
hull->clip_maxs[0] = 16;
hull->clip_maxs[1] = 16;
hull->clip_maxs[2] = 18;
hull->clip_maxs[2] = hull->clip_mins[2]+36;
hull->available = true;
}
else

View File

@ -703,22 +703,22 @@ typedef enum {fg_quake, fg_quake2, fg_quake3, fg_halflife, fg_new, fg_doom} from
#define EF_TRACER3 128 // purple trail
//hexen2.
#define EF_FIREBALL 256 // Yellow transparent trail in all directions
#define EF_ICE 512 // Blue-white transparent trail, with gravity
#define EF_MIP_MAP 1024 // This model has mip-maps
#define EF_SPIT 2048 // Black transparent trail with negative light
#define EF_TRANSPARENT 4096 // Transparent sprite
#define EF_SPELL 8192 // Vertical spray of particles
#define EF_HOLEY 16384 // Solid model with color 0
#define EF_SPECIAL_TRANS 32768 // Translucency through the particle table
#define EF_FACE_VIEW 65536 // Poly Model always faces you
#define EF_VORP_MISSILE 131072 // leave a trail at top and bottom of model
#define EF_SET_STAFF 262144 // slowly move up and left/right
#define EF_MAGICMISSILE 524288 // a trickle of blue/white particles with gravity
#define EF_BONESHARD 1048576 // a trickle of brown particles with gravity
#define EF_SCARAB 2097152 // white transparent particles with little gravity
#define EF_ACIDBALL 4194304 // Green drippy acid shit
#define EF_BLOODSHOT 8388608 // Blood rain shot trail
#define EFH2_FIREBALL 256 // Yellow transparent trail in all directions
#define EFH2_ICE 512 // Blue-white transparent trail, with gravity
#define EFH2_MIP_MAP 1024 // This model has mip-maps
#define EFH2_SPIT 2048 // Black transparent trail with negative light
#define EFH2_TRANSPARENT 4096 // Transparent sprite
#define EFH2_SPELL 8192 // Vertical spray of particles
#define EFH2_HOLEY 16384 // Solid model with color 0
#define EFH2_SPECIAL_TRANS 32768 // Translucency through the particle table
#define EFH2_FACE_VIEW 65536 // Poly Model always faces you
#define EFH2_VORP_MISSILE 131072 // leave a trail at top and bottom of model
#define EFH2_SET_STAFF 262144 // slowly move up and left/right
#define EFH2_MAGICMISSILE 524288 // a trickle of blue/white particles with gravity
#define EFH2_BONESHARD 1048576 // a trickle of brown particles with gravity
#define EFH2_SCARAB 2097152 // white transparent particles with little gravity
#define EFH2_ACIDBALL 4194304 // Green drippy acid shit
#define EFH2_BLOODSHOT 8388608 // Blood rain shot trail
typedef union {
struct {

View File

@ -417,6 +417,8 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex)
{
if (!s->mesh) //urm.
continue;
if (s->mesh->numvertexes <= 1)
continue;
if (vi != s->lightmaptexturenum)
{
if (vi<0)
@ -1948,7 +1950,7 @@ void R_DrawLightning(entity_t *e)
vec3_t points[4];
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
int indexarray[6] = {0, 1, 2, 0, 2, 3};
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
mesh_t mesh;
meshbuffer_t mb;
@ -2016,7 +2018,7 @@ void R_DrawRailCore(entity_t *e)
meshbuffer_t mb;
vec3_t points[4];
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
int indexarray[6] = {0, 1, 2, 0, 2, 3};
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
int colors[4];
qbyte colorsb[4];
@ -2114,7 +2116,7 @@ void R_DrawBeam( entity_t *e )
scale = e->scale;
if (!scale)
scale = e->frame;
scale = e->frame1;
if (!scale)
scale = 6;
VectorScale( perpvec, scale / 2, perpvec );
@ -2129,7 +2131,7 @@ void R_DrawBeam( entity_t *e )
#ifdef Q3SHADERS
if (e->forcedshader)
{
int indexarray[NUM_BEAM_SEGS*6];
index_t indexarray[NUM_BEAM_SEGS*6];
vec2_t texcoords[NUM_BEAM_SEGS*2];
mesh_t mesh;
meshbuffer_t mb;

View File

@ -63,6 +63,7 @@ int c_brush_polys, c_alias_polys;
qboolean envmap; // true during envmap command capture
int particletexture; // little dot for particles
int particlecqtexture; // little dot for particles
int explosiontexture;
int balltexture;
int playertextures; // up to 16 color translated skins
@ -793,6 +794,9 @@ void R_PolyBlend (void)
if ((!v_blend[3] || !gl_nohwblend.value) && !cl.cshifts[CSHIFT_SERVER].percent)
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
GLV_CalcBlendServer(shift); //figure out the shift we need (normally just the server specified one)
//Con_Printf("R_PolyBlend(): %4.2f %4.2f %4.2f %4.2f\n",shift[0], shift[1], shift[2], shift[3]);
@ -835,6 +839,9 @@ void GLR_BrightenScreen (void)
if (gl_contrast.value <= 1.0)
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
f = gl_contrast.value;
f = min (f, 3);
@ -1661,6 +1668,9 @@ void GLR_RenderView (void)
if (qglGetError())
Con_Printf("GL Error drawing scene\n");
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
// SCENE POST PROCESSING
// we check if we need to use any shaders - currently it's just waterwarp
if (scenepp_ww_program)

View File

@ -122,9 +122,10 @@ static qbyte exptexture[16][16] =
{0,1,1,1,7,8,1,6,7,5,4,7,1,0,0,0},
{0,1,2,1,1,5,1,3,4,3,1,1,0,0,0,0},
{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
};
void R_InitParticleTexture (void)
{
#define PARTICLETEXTURESIZE 64
@ -156,6 +157,38 @@ void R_InitParticleTexture (void)
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//
// particle triangle texture
//
particlecqtexture = texture_extension_number++;
GL_Bind(particlecqtexture);
// clear to transparent white
for (x = 0; x < 32 * 32; x++)
{
data[x][0] = 255;
data[x][1] = 255;
data[x][2] = 255;
data[x][3] = 0;
}
//draw a circle in the top left.
for (x=0 ; x<16 ; x++)
{
for (y=0 ; y<16 ; y++)
{
if ((x - 7.5) * (x - 7.5) + (y - 7.5) * (y - 7.5) <= 8 * 8)
data[y*32+x][3] = 255;
}
}
qglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
explosiontexture = texture_extension_number++;
@ -1064,7 +1097,9 @@ void GLR_NewMap (void)
// FIXME: is this one short?
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
cl.worldmodel->leafs[i].efrags = NULL;
GLSurf_DeInit();
r_viewleaf = NULL;
r_viewcluster = -1;
r_oldviewcluster = 0;

View File

@ -754,6 +754,9 @@ void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *
#endif
int stride = LMBLOCK_WIDTH*lightmap_bytes;
if (!surf->samples)
return;
shift += 7; // increase to base value
surf->cached_dlight = (surf->dlightframe == r_framecount);
@ -3186,6 +3189,7 @@ int GLAllocBlock (int w, int h, int *x, int *y)
if (!lightmap[texnum])
{
lightmap[texnum] = Z_Malloc(sizeof(*lightmap[texnum]));
lightmap[texnum]->modified = true;
// reset stainmap since it now starts at 255
memset(lightmap[texnum]->stainmaps, 255, sizeof(lightmap[texnum]->stainmaps));
}
@ -3255,6 +3259,7 @@ int GLFillBlock (int texnum, int w, int h, int x, int y)
if (!lightmap[i])
{
lightmap[i] = BZ_Malloc(sizeof(*lightmap[i]));
lightmap[i]->modified = true;
for (l=0 ; l<LMBLOCK_HEIGHT ; l++)
{
lightmap[i]->allocated[l] = LMBLOCK_HEIGHT;
@ -3263,7 +3268,16 @@ int GLFillBlock (int texnum, int w, int h, int x, int y)
//maybe someone screwed with my lightmap...
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
if (cl.worldmodel->lightdata)
{
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
}
else
{
char basename[MAX_QPATH];
COM_StripExtension(cl.worldmodel->name, basename, sizeof(basename));
lightmap_textures[i] = Mod_LoadHiResTexture(va("%s/lm_%04i", basename, i), NULL, true, false, false);
lightmap[i]->modified = false;
}
}
else
@ -3522,6 +3536,7 @@ void GL_CreateSurfaceLightmap (msurface_t *surf, int shift)
void GLSurf_DeInit(void)
{
int i;
qglDeleteTextures(numlightmaps, lightmap_textures);
for (i = 0; i < numlightmaps; i++)
{
if (!lightmap[i])
@ -3658,11 +3673,13 @@ void GL_BuildLightmaps (void)
{
if (!lightmap[i])
break; // no more used
lightmap[i]->modified = false;
lightmap[i]->rectchange.l = LMBLOCK_WIDTH;
lightmap[i]->rectchange.t = LMBLOCK_HEIGHT;
lightmap[i]->rectchange.w = 0;
lightmap[i]->rectchange.h = 0;
if (!lightmap[i]->modified)
continue;
lightmap[i]->modified = false;
GL_Bind(lightmap_textures[i]);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

Some files were not shown because too many files have changed in this diff Show More