mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 05:41:52 +00:00
Hopefully, the server will now run on 64bit archetectures.
Also, a piece of unitialialized memory should now be fixed. there's a con_centertext cvar added an extra default particle texture. further dp protocol compatability stuff. EF_ADDATIVE works on models and supposedly sprites. will do sw sprites too at some point. Linux makefile needs work still. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1017 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
98bbcc2c94
commit
4a0c02b685
48 changed files with 595 additions and 322 deletions
|
@ -782,7 +782,14 @@ void DP5_ParseDelta(entity_state_t *s)
|
||||||
// s->active = true;
|
// s->active = true;
|
||||||
}
|
}
|
||||||
if (bits & E5_FLAGS)
|
if (bits & E5_FLAGS)
|
||||||
s->flags = MSG_ReadByte();
|
{
|
||||||
|
int i = MSG_ReadByte();
|
||||||
|
s->flags = 0;
|
||||||
|
if (i & 4)
|
||||||
|
s->flags |= Q2RF_WEAPONMODEL|Q2RF_MINLIGHT|Q2RF_DEPTHHACK;
|
||||||
|
if (i & 8)
|
||||||
|
s->flags |= Q2RF_EXTERNALMODEL;
|
||||||
|
}
|
||||||
if (bits & E5_ORIGIN)
|
if (bits & E5_ORIGIN)
|
||||||
{
|
{
|
||||||
if (bits & E5_ORIGIN32)
|
if (bits & E5_ORIGIN32)
|
||||||
|
@ -922,7 +929,7 @@ void CLNQ_ParseDarkPlaces5Entities(void) //the things I do.. :o(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
from->flags = 0x80000000;
|
from->flags |= 0x80000000;
|
||||||
if (remove)
|
if (remove)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -683,7 +683,7 @@ void CLNQ_SendMove (usercmd_t *cmd, int pnum)
|
||||||
|
|
||||||
MSG_WriteByte (&buf, clc_move);
|
MSG_WriteByte (&buf, clc_move);
|
||||||
|
|
||||||
MSG_WriteFloat (&buf, cl.time); // so server can get ping times
|
MSG_WriteFloat (&buf, cl.gametime); // so server can get ping times
|
||||||
|
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
MSG_WriteAngle (&buf, cl.viewangles[pnum][i]);
|
MSG_WriteAngle (&buf, cl.viewangles[pnum][i]);
|
||||||
|
|
|
@ -4,18 +4,24 @@
|
||||||
#define SS_NETQUAKE 4
|
#define SS_NETQUAKE 4
|
||||||
#define SS_FAVORITE 8 //filter all others.
|
#define SS_FAVORITE 8 //filter all others.
|
||||||
#define SS_KEEPINFO 16
|
#define SS_KEEPINFO 16
|
||||||
|
#define SS_DARKPLACES 32
|
||||||
|
|
||||||
|
|
||||||
//despite not supporting nq or q2, we still load them. We just filter them. This is to make sure we properly write the listing files.
|
//despite not supporting nq or q2, we still load them. We just filter them. This is to make sure we properly write the listing files.
|
||||||
#define MT_BAD 0 //this would be an error
|
enum {
|
||||||
#define MT_BCASTQW 1 //-1status
|
MT_BAD, //this would be an error
|
||||||
#define MT_BCASTQ2 2 //-1status
|
MT_BCASTQW, //-1status
|
||||||
#define MT_BCASTNQ 3 //see code
|
MT_BCASTQ2, //-1status
|
||||||
#define MT_SINGLEQW 4 //-1status
|
MT_BCASTNQ, //see code
|
||||||
#define MT_SINGLEQ2 5 //-1status
|
MT_BCASTDP,
|
||||||
#define MT_SINGLENQ 6 //see code.
|
MT_SINGLEQW, //-1status
|
||||||
#define MT_MASTERQW 7 //c\n\0
|
MT_SINGLEQ2, //-1status
|
||||||
#define MT_MASTERQ2 8 //query
|
MT_SINGLENQ, //see code.
|
||||||
|
MT_SINGLEDP,
|
||||||
|
MT_MASTERQW, //c\n\0
|
||||||
|
MT_MASTERQ2, //query
|
||||||
|
MT_MASTERDP //-1getservers %s 3 empty full\x0A
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{
|
||||||
|
|
|
@ -1471,10 +1471,9 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
|
||||||
Host_EndGame ("Server returned version %i, not %i\nYou will need to use a different client.", protover, NQ_PROTOCOL_VERSION);
|
Host_EndGame ("Server returned version %i, not %i\nYou will need to use a different client.", protover, NQ_PROTOCOL_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MSG_ReadByte() > MAX_SCOREBOARD)
|
if (MSG_ReadByte() > MAX_CLIENTS)
|
||||||
{
|
{
|
||||||
Con_TPrintf (TLC_BAD_MAXCLIENTS);
|
Con_Printf ("Warning, this server supports more than 32 clients, additional clients will do bad things\n");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cl.splitclients = 1;
|
cl.splitclients = 1;
|
||||||
|
@ -3745,7 +3744,7 @@ void CLNQ_ParseServerMessage (void)
|
||||||
if (CL_ParseChat(s+1))
|
if (CL_ParseChat(s+1))
|
||||||
{
|
{
|
||||||
CL_ParsePrint(s+1, 3);
|
CL_ParsePrint(s+1, 3);
|
||||||
Con_TPrintf (TL_ST, Translate(s));
|
Con_Printf ("^3%s", Translate(s+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3873,12 +3872,16 @@ void CLNQ_ParseServerMessage (void)
|
||||||
case svc_updatename:
|
case svc_updatename:
|
||||||
Sbar_Changed ();
|
Sbar_Changed ();
|
||||||
i = MSG_ReadByte ();
|
i = MSG_ReadByte ();
|
||||||
|
if (i >= MAX_CLIENTS)
|
||||||
|
Host_EndGame ("CL_ParseServerMessage: svc_updatename > MAX_CLIENTS");
|
||||||
strcpy(cl.players[i].name, MSG_ReadString());
|
strcpy(cl.players[i].name, MSG_ReadString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case svc_updatefrags:
|
case svc_updatefrags:
|
||||||
Sbar_Changed ();
|
Sbar_Changed ();
|
||||||
i = MSG_ReadByte ();
|
i = MSG_ReadByte ();
|
||||||
|
if (i >= MAX_CLIENTS)
|
||||||
|
Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > MAX_CLIENTS");
|
||||||
cl.players[i].frags = MSG_ReadShort();
|
cl.players[i].frags = MSG_ReadShort();
|
||||||
break;
|
break;
|
||||||
case svc_updatecolors:
|
case svc_updatecolors:
|
||||||
|
@ -3886,8 +3889,8 @@ void CLNQ_ParseServerMessage (void)
|
||||||
int a;
|
int a;
|
||||||
Sbar_Changed ();
|
Sbar_Changed ();
|
||||||
i = MSG_ReadByte ();
|
i = MSG_ReadByte ();
|
||||||
if (i >= MAX_SCOREBOARD)
|
if (i >= MAX_CLIENTS)
|
||||||
Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
|
Host_EndGame ("CL_ParseServerMessage: svc_updatecolors > MAX_CLIENTS");
|
||||||
a = MSG_ReadByte ();
|
a = MSG_ReadByte ();
|
||||||
//FIXME:!!!!
|
//FIXME:!!!!
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ float con_cursorspeed = 4;
|
||||||
|
|
||||||
cvar_t con_numnotifylines = {"con_notifylines","4"}; //max lines to show
|
cvar_t con_numnotifylines = {"con_notifylines","4"}; //max lines to show
|
||||||
cvar_t con_notifytime = {"con_notifytime","3"}; //seconds
|
cvar_t con_notifytime = {"con_notifytime","3"}; //seconds
|
||||||
|
cvar_t con_centernotify = {"con_centernotify", "0"};
|
||||||
cvar_t con_displaypossabilities = {"con_displaypossabilities", "1"};
|
cvar_t con_displaypossabilities = {"con_displaypossabilities", "1"};
|
||||||
|
|
||||||
#define NUM_CON_TIMES 24
|
#define NUM_CON_TIMES 24
|
||||||
|
@ -507,6 +508,7 @@ void Con_Init (void)
|
||||||
// register our commands
|
// register our commands
|
||||||
//
|
//
|
||||||
Cvar_Register (&con_notifytime, "Console controls");
|
Cvar_Register (&con_notifytime, "Console controls");
|
||||||
|
Cvar_Register (&con_centernotify, "Console controls");
|
||||||
Cvar_Register (&con_numnotifylines, "Console controls");
|
Cvar_Register (&con_numnotifylines, "Console controls");
|
||||||
Cvar_Register (&con_displaypossabilities, "Console controls");
|
Cvar_Register (&con_displaypossabilities, "Console controls");
|
||||||
|
|
||||||
|
@ -960,6 +962,7 @@ void Con_DrawNotify (void)
|
||||||
char *s;
|
char *s;
|
||||||
int skip;
|
int skip;
|
||||||
int maxlines;
|
int maxlines;
|
||||||
|
int inset;
|
||||||
|
|
||||||
int mask=CON_WHITEMASK;
|
int mask=CON_WHITEMASK;
|
||||||
int maskstack[4];
|
int maskstack[4];
|
||||||
|
@ -979,25 +982,59 @@ void Con_DrawNotify (void)
|
||||||
maxlines = NUM_CON_TIMES;
|
maxlines = NUM_CON_TIMES;
|
||||||
|
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i= con->current-maxlines+1 ; i<=con->current ; i++)
|
if (con_centernotify.value)
|
||||||
{
|
{
|
||||||
if (i < 0)
|
for (i= con->current-maxlines+1 ; i<=con->current ; i++)
|
||||||
continue;
|
{
|
||||||
time = con_times[i % NUM_CON_TIMES];
|
if (i < 0)
|
||||||
if (time == 0)
|
continue;
|
||||||
continue;
|
time = con_times[i % NUM_CON_TIMES];
|
||||||
time = realtime - time;
|
if (time == 0)
|
||||||
if (time > con_notifytime.value)
|
continue;
|
||||||
continue;
|
time = realtime - time;
|
||||||
text = con->text + (i % con->totallines)*con->linewidth;
|
if (time > con_notifytime.value)
|
||||||
|
continue;
|
||||||
clearnotify = 0;
|
text = con->text + (i % con->totallines)*con->linewidth;
|
||||||
scr_copytop = 1;
|
|
||||||
|
clearnotify = 0;
|
||||||
|
scr_copytop = 1;
|
||||||
|
|
||||||
for (x = 0 ; x < con->linewidth ; x++)
|
for (x = con->linewidth-1 ; x >= 0 ; x--)
|
||||||
Draw_ColouredCharacter ( (x+1)<<3, v, text[x]);
|
{
|
||||||
|
if ((text[x]&0xff) != ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
inset = con->linewidth*4-x*4;
|
||||||
|
|
||||||
v += 8;
|
for (x = 0 ; x < con->linewidth ; x++)
|
||||||
|
Draw_ColouredCharacter ( inset + ((x+1)<<3), v, text[x]);
|
||||||
|
|
||||||
|
v += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i= con->current-maxlines+1 ; i<=con->current ; i++)
|
||||||
|
{
|
||||||
|
if (i < 0)
|
||||||
|
continue;
|
||||||
|
time = con_times[i % NUM_CON_TIMES];
|
||||||
|
if (time == 0)
|
||||||
|
continue;
|
||||||
|
time = realtime - time;
|
||||||
|
if (time > con_notifytime.value)
|
||||||
|
continue;
|
||||||
|
text = con->text + (i % con->totallines)*con->linewidth;
|
||||||
|
|
||||||
|
clearnotify = 0;
|
||||||
|
scr_copytop = 1;
|
||||||
|
|
||||||
|
for (x = 0 ; x < con->linewidth ; x++)
|
||||||
|
Draw_ColouredCharacter ( (x+1)<<3, v, text[x]);
|
||||||
|
|
||||||
|
v += 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,10 @@ qboolean M_IsFiltered(serverinfo_t *server) //figure out if we should filter a s
|
||||||
#ifdef NQPROT
|
#ifdef NQPROT
|
||||||
if (sb_hidenetquake.value)
|
if (sb_hidenetquake.value)
|
||||||
#endif
|
#endif
|
||||||
if (server->special & SS_NETQUAKE)
|
if (server->special & (SS_NETQUAKE|SS_DARKPLACES))
|
||||||
return true;
|
return true;
|
||||||
if (sb_hidequakeworld.value)
|
if (sb_hidequakeworld.value)
|
||||||
if (!(server->special & (SS_QUAKE2|SS_NETQUAKE)))
|
if (!(server->special & (SS_QUAKE2|SS_NETQUAKE|SS_DARKPLACES)))
|
||||||
return true;
|
return true;
|
||||||
if (sb_hideempty.value)
|
if (sb_hideempty.value)
|
||||||
if (!server->players)
|
if (!server->players)
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef int SOCKET;
|
||||||
cvar_t slist_cacheinfo = {"slist_cacheinfo", "0"}; //this proves dangerous, memory wise.
|
cvar_t slist_cacheinfo = {"slist_cacheinfo", "0"}; //this proves dangerous, memory wise.
|
||||||
cvar_t slist_writeserverstxt = {"slist_writeservers", "0"};
|
cvar_t slist_writeserverstxt = {"slist_writeservers", "0"};
|
||||||
|
|
||||||
void CL_MasterListParse(qboolean isq2);
|
void CL_MasterListParse(qboolean isq2, qboolean slashpad);
|
||||||
void CL_QueryServers(void);
|
void CL_QueryServers(void);
|
||||||
int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite);
|
int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ void Master_AddMaster (char *address, int type, char *description)
|
||||||
|
|
||||||
for (mast = master; mast; mast = mast->next)
|
for (mast = master; mast; mast = mast->next)
|
||||||
{
|
{
|
||||||
if (NET_CompareAdr(mast->adr, adr)) //already exists.
|
if (NET_CompareAdr(mast->adr, adr) && mast->type == type) //already exists.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mast = Z_Malloc(sizeof(master_t)+strlen(description));
|
mast = Z_Malloc(sizeof(master_t)+strlen(description));
|
||||||
|
@ -564,11 +564,15 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth)
|
||||||
servertype = MT_SINGLEQW;
|
servertype = MT_SINGLEQW;
|
||||||
else if (!strcmp(com_token, "single:q2"))
|
else if (!strcmp(com_token, "single:q2"))
|
||||||
servertype = MT_SINGLEQ2;
|
servertype = MT_SINGLEQ2;
|
||||||
|
else if (!strcmp(com_token, "single:dp"))
|
||||||
|
servertype = MT_SINGLEDP;
|
||||||
else if (!strcmp(com_token, "single:nq") || !strcmp(com_token, "single:q1"))
|
else if (!strcmp(com_token, "single:nq") || !strcmp(com_token, "single:q1"))
|
||||||
servertype = MT_SINGLENQ;
|
servertype = MT_SINGLENQ;
|
||||||
else if (!strcmp(com_token, "single"))
|
else if (!strcmp(com_token, "single"))
|
||||||
servertype = MT_SINGLEQW;
|
servertype = MT_SINGLEQW;
|
||||||
|
|
||||||
|
else if (!strcmp(com_token, "master:dp"))
|
||||||
|
servertype = MT_MASTERDP;
|
||||||
else if (!strcmp(com_token, "master:qw"))
|
else if (!strcmp(com_token, "master:qw"))
|
||||||
servertype = MT_MASTERQW;
|
servertype = MT_MASTERQW;
|
||||||
else if (!strcmp(com_token, "master:q2"))
|
else if (!strcmp(com_token, "master:q2"))
|
||||||
|
@ -582,6 +586,8 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth)
|
||||||
servertype = MT_BCASTQ2;
|
servertype = MT_BCASTQ2;
|
||||||
else if (!strcmp(com_token, "bcast:nq"))
|
else if (!strcmp(com_token, "bcast:nq"))
|
||||||
servertype = MT_BCASTNQ;
|
servertype = MT_BCASTNQ;
|
||||||
|
else if (!strcmp(com_token, "bcast:dp"))
|
||||||
|
servertype = MT_BCASTDP;
|
||||||
else if (!strcmp(com_token, "bcast"))
|
else if (!strcmp(com_token, "bcast"))
|
||||||
servertype = MT_BCASTQW;
|
servertype = MT_BCASTQW;
|
||||||
|
|
||||||
|
@ -753,10 +759,21 @@ int NET_CheckPollSockets(void)
|
||||||
CL_ReadServerInfo(MSG_ReadString(), MT_SINGLEQ2, false);
|
CL_ReadServerInfo(MSG_ReadString(), MT_SINGLEQ2, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (!strncmp(s, "getserversResponse\\", 19)) //parse a bit more...
|
||||||
|
{
|
||||||
|
msg_readcount = c+18-1;
|
||||||
|
CL_MasterListParse(SS_DARKPLACES, true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (!strncmp(s, "servers", 6)) //parse a bit more...
|
else if (!strncmp(s, "servers", 6)) //parse a bit more...
|
||||||
{
|
{
|
||||||
msg_readcount = c+7;
|
msg_readcount = c+7;
|
||||||
CL_MasterListParse(true);
|
CL_MasterListParse(SS_QUAKE2, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (!strcmp(s, "infoResponse")) //parse a bit more...
|
||||||
|
{
|
||||||
|
CL_ReadServerInfo(MSG_ReadString(), MT_SINGLEDP, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
msg_readcount = c;
|
msg_readcount = c;
|
||||||
|
@ -772,7 +789,7 @@ int NET_CheckPollSockets(void)
|
||||||
|
|
||||||
if (c == M2C_MASTER_REPLY) //qw master reply.
|
if (c == M2C_MASTER_REPLY) //qw master reply.
|
||||||
{
|
{
|
||||||
CL_MasterListParse(false);
|
CL_MasterListParse(false, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,7 +849,6 @@ void SListOptionChanged(serverinfo_t *newserver)
|
||||||
{
|
{
|
||||||
if (selectedserver.inuse)
|
if (selectedserver.inuse)
|
||||||
{
|
{
|
||||||
char data[16];
|
|
||||||
serverinfo_t *oldserver;
|
serverinfo_t *oldserver;
|
||||||
|
|
||||||
selectedserver.detail = NULL;
|
selectedserver.detail = NULL;
|
||||||
|
@ -870,9 +886,9 @@ void SListOptionChanged(serverinfo_t *newserver)
|
||||||
strcpy(newserver->moreinfo->info, "");
|
strcpy(newserver->moreinfo->info, "");
|
||||||
Info_SetValueForKey(newserver->moreinfo->info, "hostname", newserver->name, sizeof(newserver->moreinfo->info));
|
Info_SetValueForKey(newserver->moreinfo->info, "hostname", newserver->name, sizeof(newserver->moreinfo->info));
|
||||||
|
|
||||||
newserver->refreshtime = Sys_DoubleTime();
|
|
||||||
sprintf(data, "%c%c%c%cstatus", 255, 255, 255, 255);
|
newserver->sends++;
|
||||||
NET_SendPollPacket (strlen(data), data, newserver->adr);
|
Master_QueryServer(newserver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,6 +896,7 @@ void SListOptionChanged(serverinfo_t *newserver)
|
||||||
//don't try sending to servers we don't support
|
//don't try sending to servers we don't support
|
||||||
void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles)
|
void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles)
|
||||||
{
|
{
|
||||||
|
char *str;
|
||||||
if (!mast)
|
if (!mast)
|
||||||
return;
|
return;
|
||||||
switch(mast->type)
|
switch(mast->type)
|
||||||
|
@ -906,6 +923,15 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles)
|
||||||
NET_SendPollPacket(net_message.cursize, net_message.data, mast->adr);
|
NET_SendPollPacket(net_message.cursize, net_message.data, mast->adr);
|
||||||
SZ_Clear(&net_message);
|
SZ_Clear(&net_message);
|
||||||
break;
|
break;
|
||||||
|
case MT_MASTERDP:
|
||||||
|
str = va("%c%c%c%cgetservers %s %u empty full\x0A\n", 255, 255, 255, 255, "Nexuiz", 3);
|
||||||
|
NET_SendPollPacket (strlen(str), str, mast->adr);
|
||||||
|
break;
|
||||||
|
case MT_SINGLEDP:
|
||||||
|
case MT_BCASTDP:
|
||||||
|
str = va("%c%c%c%cgetinfo", 255, 255, 255, 255);
|
||||||
|
NET_SendPollPacket (strlen(str), str, mast->adr);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case MT_MASTERQW:
|
case MT_MASTERQW:
|
||||||
NET_SendPollPacket (3, "c\n", mast->adr);
|
NET_SendPollPacket (3, "c\n", mast->adr);
|
||||||
|
@ -944,6 +970,9 @@ void MasterInfo_WriteServers(void)
|
||||||
case MT_MASTERQ2:
|
case MT_MASTERQ2:
|
||||||
typename = "master:q2";
|
typename = "master:q2";
|
||||||
break;
|
break;
|
||||||
|
case MT_MASTERDP:
|
||||||
|
typename = "master:dp";
|
||||||
|
break;
|
||||||
case MT_BCASTQW:
|
case MT_BCASTQW:
|
||||||
typename = "bcast:qw";
|
typename = "bcast:qw";
|
||||||
break;
|
break;
|
||||||
|
@ -1033,6 +1062,13 @@ void MasterInfo_Begin(void)
|
||||||
Master_AddMaster("192.246.40.37:27900", MT_MASTERQ2, "id q2 Master.");
|
Master_AddMaster("192.246.40.37:27900", MT_MASTERQ2, "id q2 Master.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Master_AddMaster("ghdigital.com:27950", MT_MASTERDP, "DarkPlaces Master: Nexuiz");
|
||||||
|
Master_AddMaster("dpmaster.deathmask.net:27950", MT_MASTERDP, "DarkPlaces Master: Nexuiz");
|
||||||
|
Master_AddMaster("12.166.196.192:27950", MT_MASTERDP, "DarkPlaces Master: Nexuiz");
|
||||||
|
|
||||||
|
Master_AddMaster("255.255.255.255:26000", MT_BCASTDP, "Nearby DarkPlaces servers");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mast = master; mast; mast=mast->next)
|
for (mast = master; mast; mast=mast->next)
|
||||||
|
@ -1046,7 +1082,10 @@ void Master_QueryServer(serverinfo_t *server)
|
||||||
char data[2048];
|
char data[2048];
|
||||||
server->sends--;
|
server->sends--;
|
||||||
server->refreshtime = Sys_DoubleTime();
|
server->refreshtime = Sys_DoubleTime();
|
||||||
sprintf(data, "%c%c%c%cstatus", 255, 255, 255, 255);
|
if (server->special & SS_DARKPLACES)
|
||||||
|
sprintf(data, "%c%c%c%cgetinfo", 255, 255, 255, 255);
|
||||||
|
else
|
||||||
|
sprintf(data, "%c%c%c%cstatus", 255, 255, 255, 255);
|
||||||
NET_SendPollPacket (strlen(data), data, server->adr);
|
NET_SendPollPacket (strlen(data), data, server->adr);
|
||||||
}
|
}
|
||||||
//send a packet to each server in sequence.
|
//send a packet to each server in sequence.
|
||||||
|
@ -1199,7 +1238,9 @@ int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite)
|
||||||
info->special |= SS_FTESERVER;
|
info->special |= SS_FTESERVER;
|
||||||
|
|
||||||
|
|
||||||
if (servertype == MT_SINGLEQ2)
|
if (servertype == MT_SINGLEDP)
|
||||||
|
info->special |= SS_DARKPLACES;
|
||||||
|
else if (servertype == MT_SINGLEQ2)
|
||||||
info->special |= SS_QUAKE2;
|
info->special |= SS_QUAKE2;
|
||||||
else if (servertype == MT_SINGLENQ)
|
else if (servertype == MT_SINGLENQ)
|
||||||
info->special |= SS_NETQUAKE;
|
info->special |= SS_NETQUAKE;
|
||||||
|
@ -1218,7 +1259,7 @@ int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite)
|
||||||
info->tl = atoi(Info_ValueForKey(msg, "timelimit"));
|
info->tl = atoi(Info_ValueForKey(msg, "timelimit"));
|
||||||
info->fl = atoi(Info_ValueForKey(msg, "fraglimit"));
|
info->fl = atoi(Info_ValueForKey(msg, "fraglimit"));
|
||||||
|
|
||||||
if (servertype == MT_SINGLEQ2)
|
if (servertype == MT_SINGLEQ2 || servertype == MT_SINGLEDP)
|
||||||
{
|
{
|
||||||
Q_strncpyz(info->gamedir, Info_ValueForKey(msg, "gamename"), sizeof(info->gamedir));
|
Q_strncpyz(info->gamedir, Info_ValueForKey(msg, "gamename"), sizeof(info->gamedir));
|
||||||
Q_strncpyz(info->map, Info_ValueForKey(msg, "mapname"), sizeof(info->map));
|
Q_strncpyz(info->map, Info_ValueForKey(msg, "mapname"), sizeof(info->map));
|
||||||
|
@ -1346,7 +1387,7 @@ int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite)
|
||||||
}
|
}
|
||||||
|
|
||||||
//rewrite to scan for existing server instead of wiping all.
|
//rewrite to scan for existing server instead of wiping all.
|
||||||
void CL_MasterListParse(qboolean isq2)
|
void CL_MasterListParse(int type, qboolean slashpad)
|
||||||
{
|
{
|
||||||
serverinfo_t *info;
|
serverinfo_t *info;
|
||||||
serverinfo_t *last, *old;
|
serverinfo_t *last, *old;
|
||||||
|
@ -1356,8 +1397,14 @@ void CL_MasterListParse(qboolean isq2)
|
||||||
|
|
||||||
last = firstserver;
|
last = firstserver;
|
||||||
|
|
||||||
while(msg_readcount+1 < net_message.cursize)
|
while(msg_readcount+6 < net_message.cursize)
|
||||||
{
|
{
|
||||||
|
if (slashpad)
|
||||||
|
{
|
||||||
|
if (MSG_ReadByte() != '\\')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
info = Z_Malloc(sizeof(serverinfo_t));
|
info = Z_Malloc(sizeof(serverinfo_t));
|
||||||
info->adr.type = NA_IP;
|
info->adr.type = NA_IP;
|
||||||
info->adr.ip[0] = MSG_ReadByte();
|
info->adr.ip[0] = MSG_ReadByte();
|
||||||
|
@ -1368,6 +1415,11 @@ void CL_MasterListParse(qboolean isq2)
|
||||||
p1 = MSG_ReadByte();
|
p1 = MSG_ReadByte();
|
||||||
p2 = MSG_ReadByte();
|
p2 = MSG_ReadByte();
|
||||||
info->adr.port = (int)((short)(p1 + (p2<<8)));
|
info->adr.port = (int)((short)(p1 + (p2<<8)));
|
||||||
|
if (!info->adr.port)
|
||||||
|
{
|
||||||
|
Z_Free(info);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ((old = Master_InfoForServer(info->adr))) //remove if the server already exists.
|
if ((old = Master_InfoForServer(info->adr))) //remove if the server already exists.
|
||||||
{
|
{
|
||||||
old->sends = 1; //reset.
|
old->sends = 1; //reset.
|
||||||
|
@ -1375,7 +1427,8 @@ void CL_MasterListParse(qboolean isq2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->special = isq2?SS_QUAKE2:0;
|
info->sends = 1;
|
||||||
|
info->special = type;
|
||||||
info->refreshtime = 0;
|
info->refreshtime = 0;
|
||||||
|
|
||||||
sprintf(info->name, "%s", NET_AdrToString(info->adr));
|
sprintf(info->name, "%s", NET_AdrToString(info->adr));
|
||||||
|
|
|
@ -180,7 +180,7 @@ static void CSQC_InitFields(void)
|
||||||
#define fieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
#define fieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||||
#define fieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
#define fieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||||
#define fieldfunction(name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
#define fieldfunction(name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||||
csqcfields
|
csqcfields //any *64->int32 casts are erroneous, it's biased off NULL.
|
||||||
#undef fieldfloat
|
#undef fieldfloat
|
||||||
#undef fieldvector
|
#undef fieldvector
|
||||||
#undef fieldentity
|
#undef fieldentity
|
||||||
|
@ -190,7 +190,7 @@ csqcfields
|
||||||
|
|
||||||
static csqcedict_t *csqcent[MAX_EDICTS];
|
static csqcedict_t *csqcent[MAX_EDICTS];
|
||||||
|
|
||||||
#define RETURN_SSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
|
#define RETURN_SSTRING(s) (((string_t *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
|
||||||
char *PF_TempStr(void);
|
char *PF_TempStr(void);
|
||||||
|
|
||||||
static int csqcentsize;
|
static int csqcentsize;
|
||||||
|
@ -1655,6 +1655,7 @@ qboolean CSQC_DrawView(void)
|
||||||
|
|
||||||
r_secondaryview = 0;
|
r_secondaryview = 0;
|
||||||
|
|
||||||
|
DropPunchAngle (0);
|
||||||
if (cl.worldmodel)
|
if (cl.worldmodel)
|
||||||
R_LessenStains();
|
R_LessenStains();
|
||||||
|
|
||||||
|
|
|
@ -718,7 +718,6 @@ void PF_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globals
|
||||||
//float gethostcacheindexforkey(string key) = #622;
|
//float gethostcacheindexforkey(string key) = #622;
|
||||||
void PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
void PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char *keyname = PR_GetStringOfs(prinst, OFS_PARM0);
|
char *keyname = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||||
|
|
||||||
G_FLOAT(OFS_RETURN) = Master_KeyForName(keyname);
|
G_FLOAT(OFS_RETURN) = Master_KeyForName(keyname);
|
||||||
|
|
|
@ -329,6 +329,29 @@ static int CheckAssosiation(char *name, int from)
|
||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RGLQUAKE
|
||||||
|
void P_LoadTexture(part_type_t *ptype, qboolean warn)
|
||||||
|
{
|
||||||
|
if (strcmp(ptype->texname, "default"))
|
||||||
|
{
|
||||||
|
ptype->texturenum = Mod_LoadHiResTexture(ptype->texname, "particles", true, true, true);
|
||||||
|
|
||||||
|
if (!ptype->texturenum)
|
||||||
|
{
|
||||||
|
if (warn)
|
||||||
|
Con_DPrintf("Couldn't load texture %s for particle effect %s\n", ptype->texname, ptype->name);
|
||||||
|
|
||||||
|
if (strstr(ptype->texname, "glow") || strstr(ptype->texname, "ball"))
|
||||||
|
ptype->texturenum = balltexture;
|
||||||
|
else
|
||||||
|
ptype->texturenum = explosiontexture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ptype->texturenum = explosiontexture;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Uses FTE's multiline console stuff.
|
//Uses FTE's multiline console stuff.
|
||||||
//This is the function that loads the effect descriptions (via console).
|
//This is the function that loads the effect descriptions (via console).
|
||||||
void P_ParticleEffect_f(void)
|
void P_ParticleEffect_f(void)
|
||||||
|
@ -821,18 +844,7 @@ void P_ParticleEffect_f(void)
|
||||||
#ifdef RGLQUAKE
|
#ifdef RGLQUAKE
|
||||||
if (qrenderer == QR_OPENGL)
|
if (qrenderer == QR_OPENGL)
|
||||||
{
|
{
|
||||||
if (strcmp(ptype->texname, "default"))
|
P_LoadTexture(ptype, true);
|
||||||
{
|
|
||||||
ptype->texturenum = Mod_LoadHiResTexture(ptype->texname, "particles", true, true, true);
|
|
||||||
|
|
||||||
if (!ptype->texturenum)
|
|
||||||
{
|
|
||||||
Con_DPrintf("Couldn't load texture %s for particle effect %s\n", ptype->texname, ptype->name);
|
|
||||||
ptype->texturenum = explosiontexture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ptype->texturenum = explosiontexture;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1178,18 +1190,14 @@ void P_ClearParticles (void)
|
||||||
{
|
{
|
||||||
for (i = 0; i < numparticletypes; i++)
|
for (i = 0; i < numparticletypes; i++)
|
||||||
{
|
{
|
||||||
if (*part_type[i].texname)
|
P_LoadTexture(&part_type[i], false);
|
||||||
{
|
|
||||||
part_type[i].texturenum = Mod_LoadHiResTexture(part_type[i].texname, "particles", true, true, true);
|
|
||||||
if (!part_type[i].texturenum)
|
|
||||||
part_type[i].texturenum = explosiontexture;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < numparticletypes; i++)
|
for (i = 0; i < numparticletypes; i++)
|
||||||
{
|
{
|
||||||
|
part_type[i].clippeddecals = NULL;
|
||||||
part_type[i].particles = NULL;
|
part_type[i].particles = NULL;
|
||||||
part_type[i].beams = NULL;
|
part_type[i].beams = NULL;
|
||||||
part_type[i].skytris = NULL;
|
part_type[i].skytris = NULL;
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ TRACE(("dbg: R_ApplyRenderer: clearing world\n"));
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAX_MODELS; i++)
|
for (i = 0; i < MAX_MODELS; i++)
|
||||||
{
|
{
|
||||||
if (*sv.model_precache[i] && (!strcmp(sv.model_precache[i] + strlen(sv.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels))
|
if (sv.model_precache[i] && *sv.model_precache[i] && (!strcmp(sv.model_precache[i] + strlen(sv.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels))
|
||||||
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
||||||
else
|
else
|
||||||
sv.models[i] = NULL;
|
sv.models[i] = NULL;
|
||||||
|
|
|
@ -736,8 +736,6 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
|
||||||
{
|
{
|
||||||
scale = 1 + (dotright*sin(sc->yaw[i]*M_PI/180) + dotforward*cos(sc->yaw[i]*M_PI/180));// - dotup*cos(sc->pitch[0])*2;
|
scale = 1 + (dotright*sin(sc->yaw[i]*M_PI/180) + dotforward*cos(sc->yaw[i]*M_PI/180));// - dotup*cos(sc->pitch[0])*2;
|
||||||
scale = (1.0 - dist) * scale * sc->dist[i];
|
scale = (1.0 - dist) * scale * sc->dist[i];
|
||||||
// if (scale < 0.5)
|
|
||||||
// scale = 0.5;
|
|
||||||
ch->vol[i] = (int) (ch->master_vol * scale);
|
ch->vol[i] = (int) (ch->master_vol * scale);
|
||||||
if (ch->vol[i] < 0)
|
if (ch->vol[i] < 0)
|
||||||
ch->vol[i] = 0;
|
ch->vol[i] = 0;
|
||||||
|
|
|
@ -755,7 +755,7 @@ char *Sys_ConsoleInput (void)
|
||||||
char *clipText, *textCopied;
|
char *clipText, *textCopied;
|
||||||
|
|
||||||
if (!hinput)
|
if (!hinput)
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -290,9 +290,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// fall over
|
// fall over
|
||||||
#define ROLL 2
|
#define ROLL 2
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SCOREBOARD 16 // max numbers of players
|
|
||||||
|
|
||||||
#define SOUND_CHANNELS 8
|
#define SOUND_CHANNELS 8
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ static int mapisq3;
|
||||||
cvar_t map_noareas = {"map_noareas", "1"}; //1 for lack of mod support.
|
cvar_t map_noareas = {"map_noareas", "1"}; //1 for lack of mod support.
|
||||||
cvar_t map_noCurves = {"map_noCurves", "0", NULL, CVAR_CHEAT};
|
cvar_t map_noCurves = {"map_noCurves", "0", NULL, CVAR_CHEAT};
|
||||||
cvar_t map_autoopenportals = {"map_autoopenportals", "1"}; //1 for lack of mod support.
|
cvar_t map_autoopenportals = {"map_autoopenportals", "1"}; //1 for lack of mod support.
|
||||||
cvar_t r_subdivisions = {"r_subdivisions", "1"};
|
cvar_t r_subdivisions = {"r_subdivisions", "2"};
|
||||||
|
|
||||||
int CM_NumInlineModels (void);
|
int CM_NumInlineModels (void);
|
||||||
q2cmodel_t *CM_InlineModel (char *name);
|
q2cmodel_t *CM_InlineModel (char *name);
|
||||||
|
@ -5388,5 +5388,6 @@ void CM_Init(void) //register cvars.
|
||||||
Cvar_Register(&map_noareas, MAPOPTIONS);
|
Cvar_Register(&map_noareas, MAPOPTIONS);
|
||||||
Cvar_Register(&map_noCurves, MAPOPTIONS);
|
Cvar_Register(&map_noCurves, MAPOPTIONS);
|
||||||
Cvar_Register(&map_autoopenportals, MAPOPTIONS);
|
Cvar_Register(&map_autoopenportals, MAPOPTIONS);
|
||||||
|
Cvar_Register(&r_subdivisions, MAPOPTIONS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -177,8 +177,8 @@ plugin_t *Plug_Load(char *file)
|
||||||
newplug->next = plugs;
|
newplug->next = plugs;
|
||||||
plugs = newplug;
|
plugs = newplug;
|
||||||
|
|
||||||
argarray = (long)"Plug_GetEngineFunction";
|
argarray = 0;
|
||||||
VM_Call(newplug->vm, 0, Plug_FindBuiltin(NULL, ~0, &argarray));
|
VM_Call(newplug->vm, 0, Plug_FindBuiltin("Plug_GetEngineFunction", ~0, &argarray));
|
||||||
|
|
||||||
if (newplug->reschange)
|
if (newplug->reschange)
|
||||||
VM_Call(newplug->vm, newplug->reschange, vid.width, vid.height);
|
VM_Call(newplug->vm, newplug->reschange, vid.width, vid.height);
|
||||||
|
|
|
@ -624,14 +624,13 @@ void PM_AirMove (void)
|
||||||
PM_Accelerate (wishdir, wishspeed, movevars.accelerate);
|
PM_Accelerate (wishdir, wishspeed, movevars.accelerate);
|
||||||
pmove.velocity[2] -= movevars.entgravity * movevars.gravity * frametime;
|
pmove.velocity[2] -= movevars.entgravity * movevars.gravity * frametime;
|
||||||
|
|
||||||
if (!movevars.slidefix)
|
if (!pmove.velocity[0] && !pmove.velocity[1] && !movevars.slidyslopes)
|
||||||
pmove.velocity[2] = 0;
|
|
||||||
|
|
||||||
if (!pmove.velocity[0] && !pmove.velocity[1])
|
|
||||||
{
|
{
|
||||||
pmove.velocity[2] = 0;
|
pmove.velocity[2] = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (!movevars.slidefix && !movevars.slidyslopes)
|
||||||
|
pmove.velocity[2] = 0;
|
||||||
|
|
||||||
PM_StepSlideMove ();
|
PM_StepSlideMove ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ typedef struct {
|
||||||
qboolean slidefix;
|
qboolean slidefix;
|
||||||
qboolean airstep;
|
qboolean airstep;
|
||||||
qboolean walljump;
|
qboolean walljump;
|
||||||
|
qboolean slidyslopes;
|
||||||
} movevars_t;
|
} movevars_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -652,36 +652,6 @@ enum {
|
||||||
// entity_state_t is the information conveyed from the server
|
// entity_state_t is the information conveyed from the server
|
||||||
// in an update message
|
// in an update message
|
||||||
|
|
||||||
//FIXME: split the q2 vars.
|
|
||||||
#ifdef SERVERONLY
|
|
||||||
typedef struct entity_state_s
|
|
||||||
{
|
|
||||||
int number; // edict index
|
|
||||||
|
|
||||||
int flags; // nolerp, etc
|
|
||||||
vec3_t origin;
|
|
||||||
vec3_t angles;
|
|
||||||
int modelindex;
|
|
||||||
int frame;
|
|
||||||
int colormap;
|
|
||||||
int skinnum;
|
|
||||||
int effects;
|
|
||||||
|
|
||||||
#ifdef PEXT_SCALE
|
|
||||||
float scale;
|
|
||||||
#endif
|
|
||||||
#ifdef PEXT_TRANS
|
|
||||||
float trans;
|
|
||||||
#endif
|
|
||||||
#ifdef PEXT_FATNESS
|
|
||||||
float fatness;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
qbyte hexen2flags;
|
|
||||||
qbyte abslight;
|
|
||||||
qbyte dpflags;
|
|
||||||
} entity_state_t;
|
|
||||||
#else
|
|
||||||
typedef struct entity_state_s
|
typedef struct entity_state_s
|
||||||
{
|
{
|
||||||
int number; // edict index
|
int number; // edict index
|
||||||
|
@ -690,13 +660,13 @@ typedef struct entity_state_s
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
vec3_t old_origin; //q2
|
vec3_t old_origin; //q2
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
int modelindex;
|
unsigned short modelindex;
|
||||||
int modelindex2; //q2
|
unsigned short modelindex2; //q2
|
||||||
int modelindex3; //q2
|
unsigned short modelindex3; //q2
|
||||||
int modelindex4; //q2
|
unsigned short modelindex4; //q2
|
||||||
int frame;
|
unsigned short frame;
|
||||||
int colormap;
|
unsigned short colormap;
|
||||||
int skinnum;
|
unsigned short skinnum;
|
||||||
int effects;
|
int effects;
|
||||||
int renderfx; //q2
|
int renderfx; //q2
|
||||||
int sound; //q2
|
int sound; //q2
|
||||||
|
@ -716,8 +686,11 @@ typedef struct entity_state_s
|
||||||
qbyte abslight;
|
qbyte abslight;
|
||||||
qbyte dpflags;
|
qbyte dpflags;
|
||||||
qbyte solid;
|
qbyte solid;
|
||||||
|
|
||||||
|
qbyte glowsize;
|
||||||
|
qbyte glowcolour;
|
||||||
} entity_state_t;
|
} entity_state_t;
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_EXTENDED_PACKET_ENTITIES 256 //sanity limit.
|
#define MAX_EXTENDED_PACKET_ENTITIES 256 //sanity limit.
|
||||||
#define MAX_STANDARD_PACKET_ENTITIES 64 // doesn't count nails
|
#define MAX_STANDARD_PACKET_ENTITIES 64 // doesn't count nails
|
||||||
|
|
|
@ -512,7 +512,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
|
||||||
float *pose[4];
|
float *pose[4];
|
||||||
float mlerp; //minor lerp, poses within a group.
|
float mlerp; //minor lerp, poses within a group.
|
||||||
|
|
||||||
mlerp = cl.time*g1->rate;
|
mlerp = (cl.time-cl.lerpents[currententity->keynum].lerptime)*g1->rate;
|
||||||
frame1=mlerp;
|
frame1=mlerp;
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
mlerp-=frame1;
|
mlerp-=frame1;
|
||||||
|
@ -526,7 +526,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i
|
||||||
if (plerp[l]>0)
|
if (plerp[l]>0)
|
||||||
pose[l++] = (float *)((char *)g1 + g1->poseofs + sizeof(float)*inf->numbones*12*frame2);
|
pose[l++] = (float *)((char *)g1 + g1->poseofs + sizeof(float)*inf->numbones*12*frame2);
|
||||||
|
|
||||||
mlerp = cl.time*g2->rate;
|
mlerp = (cl.time-cl.lerpents[currententity->keynum].lerptime)*g2->rate;
|
||||||
frame1=mlerp;
|
frame1=mlerp;
|
||||||
frame2=frame1+1;
|
frame2=frame1+1;
|
||||||
mlerp-=frame1;
|
mlerp-=frame1;
|
||||||
|
@ -1067,6 +1067,25 @@ void GL_DrawAliasMesh_Sketch (mesh_t *mesh)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//called from sprite code.
|
||||||
|
/*
|
||||||
|
void GL_KnownState(void)
|
||||||
|
{
|
||||||
|
extern int gldepthfunc;
|
||||||
|
qglDepthFunc(gldepthfunc);
|
||||||
|
qglDepthMask(1);
|
||||||
|
if (gldepthmin == 0.5)
|
||||||
|
qglCullFace ( GL_BACK );
|
||||||
|
else
|
||||||
|
qglCullFace ( GL_FRONT );
|
||||||
|
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
|
||||||
|
qglEnable (GL_BLEND);
|
||||||
|
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
|
void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
|
||||||
{
|
{
|
||||||
extern int gldepthfunc;
|
extern int gldepthfunc;
|
||||||
|
@ -1292,7 +1311,12 @@ void R_DrawGAliasModel (entity_t *e)
|
||||||
qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
|
qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
|
||||||
|
|
||||||
// glColor3f( 1,1,1);
|
// glColor3f( 1,1,1);
|
||||||
if ((e->model->flags & EF_SPECIAL_TRANS)) //hexen2 flags.
|
if (e->flags & Q2RF_ADDATIVE)
|
||||||
|
{
|
||||||
|
qglEnable (GL_BLEND);
|
||||||
|
qglBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
}
|
||||||
|
else if ((e->model->flags & EF_SPECIAL_TRANS)) //hexen2 flags.
|
||||||
{
|
{
|
||||||
qglEnable (GL_BLEND);
|
qglEnable (GL_BLEND);
|
||||||
qglBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
|
qglBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
|
||||||
|
@ -1304,21 +1328,17 @@ void R_DrawGAliasModel (entity_t *e)
|
||||||
qglEnable (GL_BLEND);
|
qglEnable (GL_BLEND);
|
||||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
e->alpha = r_wateralpha.value;
|
e->alpha = r_wateralpha.value;
|
||||||
// qglColor4f( 1,1,1,r_wateralpha.value);
|
|
||||||
}
|
}
|
||||||
else if ((e->model->flags & EF_TRANSPARENT))
|
else if ((e->model->flags & EF_TRANSPARENT))
|
||||||
{
|
{
|
||||||
qglEnable (GL_BLEND);
|
qglEnable (GL_BLEND);
|
||||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
// qglColor3f( 1,1,1);
|
|
||||||
}
|
}
|
||||||
else if ((e->model->flags & EF_HOLEY))
|
else if ((e->model->flags & EF_HOLEY))
|
||||||
{
|
{
|
||||||
qglEnable (GL_ALPHA_TEST);
|
qglEnable (GL_ALPHA_TEST);
|
||||||
// qglEnable (GL_BLEND);
|
// qglEnable (GL_BLEND);
|
||||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
// qglColor3f( 1,1,1);
|
|
||||||
}
|
}
|
||||||
else if (e->alpha < 1)
|
else if (e->alpha < 1)
|
||||||
{
|
{
|
||||||
|
@ -1479,6 +1499,12 @@ void R_DrawGAliasModel (entity_t *e)
|
||||||
else if (skin->shader)
|
else if (skin->shader)
|
||||||
{
|
{
|
||||||
meshbuffer_t mb;
|
meshbuffer_t mb;
|
||||||
|
int olddst = skin->shader->numpasses?skin->shader->passes[0].blenddst:0;
|
||||||
|
|
||||||
|
if (e->flags & Q2RF_ADDATIVE && skin->shader->numpasses)
|
||||||
|
{ //hack the shader into submition.
|
||||||
|
skin->shader->passes[0].blenddst = GL_ONE;
|
||||||
|
}
|
||||||
|
|
||||||
mb.entity = &r_worldentity;
|
mb.entity = &r_worldentity;
|
||||||
mb.shader = skin->shader;
|
mb.shader = skin->shader;
|
||||||
|
@ -1492,6 +1518,11 @@ void R_DrawGAliasModel (entity_t *e)
|
||||||
R_PushMesh(&mesh, skin->shader->features | MF_NONBATCHED | MF_COLORS);
|
R_PushMesh(&mesh, skin->shader->features | MF_NONBATCHED | MF_COLORS);
|
||||||
|
|
||||||
R_RenderMeshBuffer ( &mb, false );
|
R_RenderMeshBuffer ( &mb, false );
|
||||||
|
|
||||||
|
if (e->flags & Q2RF_ADDATIVE && skin->shader->numpasses)
|
||||||
|
{ //hack the shader into submition.
|
||||||
|
skin->shader->passes[0].blenddst = olddst;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
|
|
|
@ -3251,8 +3251,6 @@ void GL_Upload8Pal32 (qbyte *data, qbyte *pal, int width, int height, qboolean
|
||||||
{
|
{
|
||||||
qbyte *trans = uploadmemorybufferintermediate;
|
qbyte *trans = uploadmemorybufferintermediate;
|
||||||
int i, s;
|
int i, s;
|
||||||
qboolean noalpha;
|
|
||||||
int p;
|
|
||||||
extern qbyte gammatable[256];
|
extern qbyte gammatable[256];
|
||||||
|
|
||||||
s = width*height;
|
s = width*height;
|
||||||
|
|
|
@ -1749,22 +1749,22 @@ void PPL_BaseEntTextures(void)
|
||||||
if (currententity->flags & Q2RF_EXTERNALMODEL)
|
if (currententity->flags & Q2RF_EXTERNALMODEL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// j = currententity->keynum;
|
j = currententity->keynum;
|
||||||
// while(j)
|
while(j)
|
||||||
// {
|
{
|
||||||
//
|
|
||||||
// if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
|
if (j == (cl.viewentity[r_refdef.currentplayernum]?cl.viewentity[r_refdef.currentplayernum]:(cl.playernum[r_refdef.currentplayernum]+1)))
|
||||||
// break;
|
break;
|
||||||
//
|
|
||||||
// j = cl.lerpents[j].tagent;
|
|
||||||
// }
|
|
||||||
// if (j)
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
// if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
|
j = cl.lerpents[j].tagent;
|
||||||
// continue;
|
}
|
||||||
// if (!Cam_DrawPlayer(0, currententity->keynum-1))
|
if (j)
|
||||||
// continue;
|
continue;
|
||||||
|
|
||||||
|
if (cl.viewentity[r_refdef.currentplayernum] && currententity->keynum == cl.viewentity[r_refdef.currentplayernum])
|
||||||
|
continue;
|
||||||
|
if (!Cam_DrawPlayer(0, currententity->keynum-1))
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currententity->flags & Q2RF_BEAM)
|
if (currententity->flags & Q2RF_BEAM)
|
||||||
|
|
|
@ -59,6 +59,7 @@ qboolean envmap; // true during envmap command capture
|
||||||
|
|
||||||
int particletexture; // little dot for particles
|
int particletexture; // little dot for particles
|
||||||
int explosiontexture;
|
int explosiontexture;
|
||||||
|
int balltexture;
|
||||||
int playertextures; // up to 16 color translated skins
|
int playertextures; // up to 16 color translated skins
|
||||||
|
|
||||||
int mirrortexturenum; // quake texturenum, not gltexturenum
|
int mirrortexturenum; // quake texturenum, not gltexturenum
|
||||||
|
@ -503,6 +504,22 @@ void R_DrawSpriteModel (entity_t *e)
|
||||||
|
|
||||||
GL_Bind(frame->gl_texturenum);
|
GL_Bind(frame->gl_texturenum);
|
||||||
|
|
||||||
|
{
|
||||||
|
extern int gldepthfunc;
|
||||||
|
qglDepthFunc(gldepthfunc);
|
||||||
|
qglDepthMask(1);
|
||||||
|
if (gldepthmin == 0.5)
|
||||||
|
qglCullFace ( GL_BACK );
|
||||||
|
else
|
||||||
|
qglCullFace ( GL_FRONT );
|
||||||
|
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
|
||||||
|
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
qglDisable (GL_ALPHA_TEST);
|
||||||
|
qglDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
if (e->flags & Q2RF_ADDATIVE)
|
if (e->flags & Q2RF_ADDATIVE)
|
||||||
{
|
{
|
||||||
qglEnable(GL_BLEND);
|
qglEnable(GL_BLEND);
|
||||||
|
|
|
@ -127,8 +127,10 @@ static qbyte exptexture[16][16] =
|
||||||
};
|
};
|
||||||
void R_InitParticleTexture (void)
|
void R_InitParticleTexture (void)
|
||||||
{
|
{
|
||||||
|
#define PARTICLETEXTURESIZE 64
|
||||||
int x,y;
|
int x,y;
|
||||||
qbyte data[16*16][4];
|
float dx, dy, d;
|
||||||
|
qbyte data[PARTICLETEXTURESIZE*PARTICLETEXTURESIZE][4];
|
||||||
|
|
||||||
//
|
//
|
||||||
// particle texture
|
// particle texture
|
||||||
|
@ -175,6 +177,26 @@ void R_InitParticleTexture (void)
|
||||||
|
|
||||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
|
||||||
|
memset(data, 255, sizeof(data));
|
||||||
|
for (y = 0;y < PARTICLETEXTURESIZE;y++)
|
||||||
|
{
|
||||||
|
dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
|
||||||
|
for (x = 0;x < PARTICLETEXTURESIZE;x++)
|
||||||
|
{
|
||||||
|
dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
|
||||||
|
d = 256 * (1 - (dx*dx+dy*dy));
|
||||||
|
d = bound(0, d, 255);
|
||||||
|
data[y*PARTICLETEXTURESIZE+x][3] = (qbyte) d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
balltexture = texture_extension_number++;
|
||||||
|
GL_Bind(balltexture);
|
||||||
|
qglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ void Shader_Free (shader_t *shader)
|
||||||
int i;
|
int i;
|
||||||
shaderpass_t *pass;
|
shaderpass_t *pass;
|
||||||
|
|
||||||
if ( shader->flags & SHADER_SKY ) {
|
if ( shader->skydome ) {
|
||||||
for ( i = 0; i < 5; i++ ) {
|
for ( i = 0; i < 5; i++ ) {
|
||||||
if (shader->skydome->meshes[i].xyz_array)
|
if (shader->skydome->meshes[i].xyz_array)
|
||||||
{
|
{
|
||||||
|
@ -1804,12 +1804,14 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
|
||||||
{
|
{
|
||||||
shaderpass_t *pass;
|
shaderpass_t *pass;
|
||||||
pass = &s->passes[0];
|
pass = &s->passes[0];
|
||||||
pass->flags = SHADER_PASS_DEPTHWRITE;
|
pass->flags = SHADER_PASS_BLEND|SHADER_PASS_DEPTHWRITE;
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
|
||||||
pass->depthfunc = GL_LEQUAL;
|
pass->depthfunc = GL_LEQUAL;
|
||||||
pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE;
|
pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE;
|
||||||
pass->numtcmods = 0;
|
pass->numtcmods = 0;
|
||||||
pass->tcgen = TC_GEN_BASE;
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->blendsrc = GL_SRC_ALPHA;
|
||||||
|
pass->blenddst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
pass->blendmode = GL_MODULATE;
|
pass->blendmode = GL_MODULATE;
|
||||||
pass->numMergedPasses = 1;
|
pass->numMergedPasses = 1;
|
||||||
pass->flush = R_RenderMeshGeneric;
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
@ -1821,7 +1823,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
|
||||||
|
|
||||||
s->numpasses = 1;
|
s->numpasses = 1;
|
||||||
s->numdeforms = 0;
|
s->numdeforms = 0;
|
||||||
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
s->flags = SHADER_PASS_BLEND|SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
||||||
s->features = MF_STCOORDS|MF_NORMALS;
|
s->features = MF_STCOORDS|MF_NORMALS;
|
||||||
s->sort = SHADER_SORT_OPAQUE;
|
s->sort = SHADER_SORT_OPAQUE;
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
|
|
@ -193,6 +193,7 @@ extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
extern qboolean envmap;
|
extern qboolean envmap;
|
||||||
extern int particletexture;
|
extern int particletexture;
|
||||||
extern int explosiontexture;
|
extern int explosiontexture;
|
||||||
|
extern int balltexture;
|
||||||
extern int netgraphtexture; // netgraph texture
|
extern int netgraphtexture; // netgraph texture
|
||||||
extern int playertextures;
|
extern int playertextures;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#define ioctlsocket ioctl
|
#define ioctlsocket ioctl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int ftpfilelistsocket;
|
||||||
|
|
||||||
char *COM_ParseOut (char *data, char *out, int outlen);
|
char *COM_ParseOut (char *data, char *out, int outlen);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void FTP_ServerShutdown(void)
|
||||||
|
|
||||||
static int SendFileNameTo(char *fname, int size, void *param)
|
static int SendFileNameTo(char *fname, int size, void *param)
|
||||||
{
|
{
|
||||||
int socket = (int)param; //64->32... this is safe due to where it's called from. It's just not so portable.
|
int socket = ftpfilelistsocket; //64->32... this is safe due to where it's called from. It's just not so portable.
|
||||||
// int i;
|
// int i;
|
||||||
char buffer[256+1];
|
char buffer[256+1];
|
||||||
char *slash;
|
char *slash;
|
||||||
|
@ -565,7 +565,8 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
|
||||||
strcat(buffer, "*");
|
strcat(buffer, "*");
|
||||||
QueueMessage (cl, "125 Opening FAKE ASCII mode data connection for file.\r\n");
|
QueueMessage (cl, "125 Opening FAKE ASCII mode data connection for file.\r\n");
|
||||||
|
|
||||||
COM_EnumerateFiles(buffer, SendFileNameTo, (void*)cl->datasock); //32->64 this is safe
|
ftpfilelistsocket = cl->datasock;
|
||||||
|
COM_EnumerateFiles(buffer, SendFileNameTo, NULL);
|
||||||
|
|
||||||
QueueMessage (cl, "226 Transfer complete.\r\n");
|
QueueMessage (cl, "226 Transfer complete.\r\n");
|
||||||
|
|
||||||
|
|
|
@ -640,8 +640,8 @@ int NET_SendToAll(sizebuf_t *data, int blocktime)
|
||||||
double start;
|
double start;
|
||||||
int i;
|
int i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
qboolean state1 [MAX_SCOREBOARD];
|
qboolean state1 [MAX_CLIENTS];
|
||||||
qboolean state2 [MAX_SCOREBOARD];
|
qboolean state2 [MAX_CLIENTS];
|
||||||
|
|
||||||
for (i=0, host_client = svs.clients ; i<32 ; i++, host_client++)
|
for (i=0, host_client = svs.clients ; i<32 ; i++, host_client++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#error Bad cont size
|
#error Bad cont size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ENGINEPOINTER(p) ((char*)(p) - progfuncs->stringtable)
|
||||||
|
#define QCPOINTER(p) (eval_t *)(p->_int+progfuncs->stringtable)
|
||||||
|
#define QCPOINTERM(p) (eval_t *)((p)+progfuncs->stringtable)
|
||||||
|
|
||||||
//rely upon just st
|
//rely upon just st
|
||||||
{
|
{
|
||||||
|
@ -286,15 +289,15 @@ reeval:
|
||||||
|
|
||||||
//store a value to a pointer
|
//store a value to a pointer
|
||||||
case OP_STOREP_IF:
|
case OP_STOREP_IF:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)OPA->_int;
|
ptr->_float = (float)OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_FI:
|
case OP_STOREP_FI:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = (int)OPA->_float;
|
ptr->_int = (int)OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_I:
|
case OP_STOREP_I:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_F:
|
case OP_STOREP_F:
|
||||||
|
@ -302,18 +305,18 @@ reeval:
|
||||||
case OP_STOREP_FLD: // integers
|
case OP_STOREP_FLD: // integers
|
||||||
case OP_STOREP_S:
|
case OP_STOREP_S:
|
||||||
case OP_STOREP_FNC: // pointers
|
case OP_STOREP_FNC: // pointers
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_V:
|
case OP_STOREP_V:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->vector[0] = OPA->vector[0];
|
ptr->vector[0] = OPA->vector[0];
|
||||||
ptr->vector[1] = OPA->vector[1];
|
ptr->vector[1] = OPA->vector[1];
|
||||||
ptr->vector[2] = OPA->vector[2];
|
ptr->vector[2] = OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_STOREP_C: //store character in a string
|
case OP_STOREP_C: //store character in a string
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
*(unsigned char *)ptr = (char)OPA->_float;
|
*(unsigned char *)ptr = (char)OPA->_float;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -326,11 +329,11 @@ reeval:
|
||||||
OPB->vector[2] *= OPA->_float;
|
OPB->vector[2] *= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_F: // e.f *= f
|
case OP_MULSTOREP_F: // e.f *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float *= OPA->_float);
|
OPC->_float = (ptr->_float *= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_V: // e.v *= f
|
case OP_MULSTOREP_V: // e.v *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
||||||
|
@ -340,7 +343,7 @@ reeval:
|
||||||
OPB->_float /= OPA->_float;
|
OPB->_float /= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_DIVSTOREP_F: // e.f /= f
|
case OP_DIVSTOREP_F: // e.f /= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float /= OPA->_float);
|
OPC->_float = (ptr->_float /= OPA->_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -353,11 +356,11 @@ reeval:
|
||||||
OPB->vector[2] += OPA->vector[2];
|
OPB->vector[2] += OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_F: // e.f += f
|
case OP_ADDSTOREP_F: // e.f += f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float += OPA->_float);
|
OPC->_float = (ptr->_float += OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_V: // e.v += v
|
case OP_ADDSTOREP_V: // e.v += v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
||||||
|
@ -372,11 +375,11 @@ reeval:
|
||||||
OPB->vector[2] -= OPA->vector[2];
|
OPB->vector[2] -= OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_F: // e.f -= f
|
case OP_SUBSTOREP_F: // e.f -= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float -= OPA->_float);
|
OPC->_float = (ptr->_float -= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_V: // e.v -= v
|
case OP_SUBSTOREP_V: // e.v -= v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
||||||
|
@ -394,7 +397,7 @@ reeval:
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
||||||
}
|
}
|
||||||
OPC->_int = (int)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
|
OPC->_int = ENGINEPOINTER((((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//load a field to a value
|
//load a field to a value
|
||||||
|
@ -533,9 +536,9 @@ reeval:
|
||||||
i -= externs->numglobalbuiltins;
|
i -= externs->numglobalbuiltins;
|
||||||
if (i >= current_progstate->numbuiltins)
|
if (i >= current_progstate->numbuiltins)
|
||||||
{
|
{
|
||||||
if (newf->first_statement == -0x7fffffff)
|
// if (newf->first_statement == -0x7fffffff)
|
||||||
((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
// ((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
||||||
else
|
// else
|
||||||
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -651,7 +654,7 @@ reeval:
|
||||||
|
|
||||||
//array/structure reading/riting.
|
//array/structure reading/riting.
|
||||||
case OP_GLOBALADDRESS:
|
case OP_GLOBALADDRESS:
|
||||||
OPC->_int = (int)(&OPA->_int) + OPB->_int;
|
OPC->_int = ENGINEPOINTER(&OPA->_int + OPB->_int/4);
|
||||||
break;
|
break;
|
||||||
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
||||||
OPC->_int = OPA->_int + OPB->_int*4;
|
OPC->_int = OPA->_int + OPB->_int*4;
|
||||||
|
@ -683,7 +686,7 @@ reeval:
|
||||||
OPC->_int = OPA->_int - OPB->_int;
|
OPC->_int = OPA->_int - OPB->_int;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_C: //load character from a string
|
case OP_LOADP_C: //load character from a string
|
||||||
ptr = (eval_t *)(OPA->_int + (int)OPB->_float);
|
ptr = QCPOINTERM(OPA->_int + (int)OPB->_float);
|
||||||
OPC->_float = *(unsigned char *)ptr;
|
OPC->_float = *(unsigned char *)ptr;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_I:
|
case OP_LOADP_I:
|
||||||
|
@ -692,12 +695,12 @@ reeval:
|
||||||
case OP_LOADP_ENT:
|
case OP_LOADP_ENT:
|
||||||
case OP_LOADP_S:
|
case OP_LOADP_S:
|
||||||
case OP_LOADP_FNC:
|
case OP_LOADP_FNC:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->_int = ptr->_int;
|
OPC->_int = ptr->_int;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_LOADP_V:
|
case OP_LOADP_V:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->vector[0] = ptr->vector[0];
|
OPC->vector[0] = ptr->vector[0];
|
||||||
OPC->vector[1] = ptr->vector[1];
|
OPC->vector[1] = ptr->vector[1];
|
||||||
OPC->vector[2] = ptr->vector[2];
|
OPC->vector[2] = ptr->vector[2];
|
||||||
|
@ -756,14 +759,14 @@ reeval:
|
||||||
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITSETP: // .b (+) a
|
case OP_BITSETP: // .b (+) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITCLR: // b (-) a
|
case OP_BITCLR: // b (-) a
|
||||||
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
case OP_BITCLRP: // .b (-) a
|
case OP_BITCLRP: // .b (-) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -984,8 +987,8 @@ reeval:
|
||||||
PR_RunError(progfuncs, "Progs boundcheck failed. Value is %i.", OPA->_int);
|
PR_RunError(progfuncs, "Progs boundcheck failed. Value is %i.", OPA->_int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_PUSH:
|
/* case OP_PUSH:
|
||||||
OPC->_int = (int)&localstack[localstack_used+pr_spushed];
|
OPC->_int = ENGINEPOINTER(&localstack[localstack_used+pr_spushed]);
|
||||||
pr_spushed += OPA->_int;
|
pr_spushed += OPA->_int;
|
||||||
if (pr_spushed + localstack_used >= LOCALSTACK_SIZE)
|
if (pr_spushed + localstack_used >= LOCALSTACK_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -1003,7 +1006,7 @@ reeval:
|
||||||
PR_RunError(progfuncs, "Progs poped more than it pushed");
|
PR_RunError(progfuncs, "Progs poped more than it pushed");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
if (st->op & 0x8000) //break point!
|
if (st->op & 0x8000) //break point!
|
||||||
{
|
{
|
||||||
|
@ -1041,3 +1044,7 @@ reeval:
|
||||||
#undef dstatement_t
|
#undef dstatement_t
|
||||||
#undef sofs
|
#undef sofs
|
||||||
#undef uofs
|
#undef uofs
|
||||||
|
|
||||||
|
#undef ENGINEPOINTER
|
||||||
|
#undef QCPOINTER
|
||||||
|
#undef QCPOINTERM
|
|
@ -35,6 +35,9 @@
|
||||||
#error Bad cont size
|
#error Bad cont size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ENGINEPOINTER(p) ((char*)(p) - progfuncs->stringtable)
|
||||||
|
#define QCPOINTER(p) (eval_t *)(p->_int+progfuncs->stringtable)
|
||||||
|
#define QCPOINTERM(p) (eval_t *)((p)+progfuncs->stringtable)
|
||||||
|
|
||||||
//rely upon just st
|
//rely upon just st
|
||||||
{
|
{
|
||||||
|
@ -286,15 +289,15 @@ reeval:
|
||||||
|
|
||||||
//store a value to a pointer
|
//store a value to a pointer
|
||||||
case OP_STOREP_IF:
|
case OP_STOREP_IF:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)OPA->_int;
|
ptr->_float = (float)OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_FI:
|
case OP_STOREP_FI:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = (int)OPA->_float;
|
ptr->_int = (int)OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_I:
|
case OP_STOREP_I:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_F:
|
case OP_STOREP_F:
|
||||||
|
@ -302,18 +305,18 @@ reeval:
|
||||||
case OP_STOREP_FLD: // integers
|
case OP_STOREP_FLD: // integers
|
||||||
case OP_STOREP_S:
|
case OP_STOREP_S:
|
||||||
case OP_STOREP_FNC: // pointers
|
case OP_STOREP_FNC: // pointers
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_V:
|
case OP_STOREP_V:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->vector[0] = OPA->vector[0];
|
ptr->vector[0] = OPA->vector[0];
|
||||||
ptr->vector[1] = OPA->vector[1];
|
ptr->vector[1] = OPA->vector[1];
|
||||||
ptr->vector[2] = OPA->vector[2];
|
ptr->vector[2] = OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_STOREP_C: //store character in a string
|
case OP_STOREP_C: //store character in a string
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
*(unsigned char *)ptr = (char)OPA->_float;
|
*(unsigned char *)ptr = (char)OPA->_float;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -326,11 +329,11 @@ reeval:
|
||||||
OPB->vector[2] *= OPA->_float;
|
OPB->vector[2] *= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_F: // e.f *= f
|
case OP_MULSTOREP_F: // e.f *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float *= OPA->_float);
|
OPC->_float = (ptr->_float *= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_V: // e.v *= f
|
case OP_MULSTOREP_V: // e.v *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
||||||
|
@ -340,7 +343,7 @@ reeval:
|
||||||
OPB->_float /= OPA->_float;
|
OPB->_float /= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_DIVSTOREP_F: // e.f /= f
|
case OP_DIVSTOREP_F: // e.f /= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float /= OPA->_float);
|
OPC->_float = (ptr->_float /= OPA->_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -353,11 +356,11 @@ reeval:
|
||||||
OPB->vector[2] += OPA->vector[2];
|
OPB->vector[2] += OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_F: // e.f += f
|
case OP_ADDSTOREP_F: // e.f += f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float += OPA->_float);
|
OPC->_float = (ptr->_float += OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_V: // e.v += v
|
case OP_ADDSTOREP_V: // e.v += v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
||||||
|
@ -372,11 +375,11 @@ reeval:
|
||||||
OPB->vector[2] -= OPA->vector[2];
|
OPB->vector[2] -= OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_F: // e.f -= f
|
case OP_SUBSTOREP_F: // e.f -= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float -= OPA->_float);
|
OPC->_float = (ptr->_float -= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_V: // e.v -= v
|
case OP_SUBSTOREP_V: // e.v -= v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
||||||
|
@ -394,7 +397,7 @@ reeval:
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
||||||
}
|
}
|
||||||
OPC->_int = (int)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
|
OPC->_int = ENGINEPOINTER((((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//load a field to a value
|
//load a field to a value
|
||||||
|
@ -533,9 +536,9 @@ reeval:
|
||||||
i -= externs->numglobalbuiltins;
|
i -= externs->numglobalbuiltins;
|
||||||
if (i >= current_progstate->numbuiltins)
|
if (i >= current_progstate->numbuiltins)
|
||||||
{
|
{
|
||||||
if (newf->first_statement == -0x7fffffff)
|
// if (newf->first_statement == -0x7fffffff)
|
||||||
((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
// ((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
||||||
else
|
// else
|
||||||
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -651,7 +654,7 @@ reeval:
|
||||||
|
|
||||||
//array/structure reading/riting.
|
//array/structure reading/riting.
|
||||||
case OP_GLOBALADDRESS:
|
case OP_GLOBALADDRESS:
|
||||||
OPC->_int = (int)(&OPA->_int) + OPB->_int;
|
OPC->_int = ENGINEPOINTER(&OPA->_int + OPB->_int/4);
|
||||||
break;
|
break;
|
||||||
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
||||||
OPC->_int = OPA->_int + OPB->_int*4;
|
OPC->_int = OPA->_int + OPB->_int*4;
|
||||||
|
@ -683,7 +686,7 @@ reeval:
|
||||||
OPC->_int = OPA->_int - OPB->_int;
|
OPC->_int = OPA->_int - OPB->_int;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_C: //load character from a string
|
case OP_LOADP_C: //load character from a string
|
||||||
ptr = (eval_t *)(OPA->_int + (int)OPB->_float);
|
ptr = QCPOINTERM(OPA->_int + (int)OPB->_float);
|
||||||
OPC->_float = *(unsigned char *)ptr;
|
OPC->_float = *(unsigned char *)ptr;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_I:
|
case OP_LOADP_I:
|
||||||
|
@ -692,12 +695,12 @@ reeval:
|
||||||
case OP_LOADP_ENT:
|
case OP_LOADP_ENT:
|
||||||
case OP_LOADP_S:
|
case OP_LOADP_S:
|
||||||
case OP_LOADP_FNC:
|
case OP_LOADP_FNC:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->_int = ptr->_int;
|
OPC->_int = ptr->_int;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_LOADP_V:
|
case OP_LOADP_V:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->vector[0] = ptr->vector[0];
|
OPC->vector[0] = ptr->vector[0];
|
||||||
OPC->vector[1] = ptr->vector[1];
|
OPC->vector[1] = ptr->vector[1];
|
||||||
OPC->vector[2] = ptr->vector[2];
|
OPC->vector[2] = ptr->vector[2];
|
||||||
|
@ -756,14 +759,14 @@ reeval:
|
||||||
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITSETP: // .b (+) a
|
case OP_BITSETP: // .b (+) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITCLR: // b (-) a
|
case OP_BITCLR: // b (-) a
|
||||||
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
case OP_BITCLRP: // .b (-) a
|
case OP_BITCLRP: // .b (-) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1041,3 +1044,7 @@ reeval:
|
||||||
#undef dstatement_t
|
#undef dstatement_t
|
||||||
#undef sofs
|
#undef sofs
|
||||||
#undef uofs
|
#undef uofs
|
||||||
|
|
||||||
|
#undef ENGINEPOINTER
|
||||||
|
#undef QCPOINTER
|
||||||
|
#undef QCPOINTERM
|
|
@ -35,6 +35,9 @@
|
||||||
#error Bad cont size
|
#error Bad cont size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ENGINEPOINTER(p) ((char*)(p) - progfuncs->stringtable)
|
||||||
|
#define QCPOINTER(p) (eval_t *)(p->_int+progfuncs->stringtable)
|
||||||
|
#define QCPOINTERM(p) (eval_t *)((p)+progfuncs->stringtable)
|
||||||
|
|
||||||
//rely upon just st
|
//rely upon just st
|
||||||
{
|
{
|
||||||
|
@ -286,15 +289,15 @@ reeval:
|
||||||
|
|
||||||
//store a value to a pointer
|
//store a value to a pointer
|
||||||
case OP_STOREP_IF:
|
case OP_STOREP_IF:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)OPA->_int;
|
ptr->_float = (float)OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_FI:
|
case OP_STOREP_FI:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = (int)OPA->_float;
|
ptr->_int = (int)OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_I:
|
case OP_STOREP_I:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_F:
|
case OP_STOREP_F:
|
||||||
|
@ -302,18 +305,18 @@ reeval:
|
||||||
case OP_STOREP_FLD: // integers
|
case OP_STOREP_FLD: // integers
|
||||||
case OP_STOREP_S:
|
case OP_STOREP_S:
|
||||||
case OP_STOREP_FNC: // pointers
|
case OP_STOREP_FNC: // pointers
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_V:
|
case OP_STOREP_V:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->vector[0] = OPA->vector[0];
|
ptr->vector[0] = OPA->vector[0];
|
||||||
ptr->vector[1] = OPA->vector[1];
|
ptr->vector[1] = OPA->vector[1];
|
||||||
ptr->vector[2] = OPA->vector[2];
|
ptr->vector[2] = OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_STOREP_C: //store character in a string
|
case OP_STOREP_C: //store character in a string
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
*(unsigned char *)ptr = (char)OPA->_float;
|
*(unsigned char *)ptr = (char)OPA->_float;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -326,11 +329,11 @@ reeval:
|
||||||
OPB->vector[2] *= OPA->_float;
|
OPB->vector[2] *= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_F: // e.f *= f
|
case OP_MULSTOREP_F: // e.f *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float *= OPA->_float);
|
OPC->_float = (ptr->_float *= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_V: // e.v *= f
|
case OP_MULSTOREP_V: // e.v *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
||||||
|
@ -340,7 +343,7 @@ reeval:
|
||||||
OPB->_float /= OPA->_float;
|
OPB->_float /= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_DIVSTOREP_F: // e.f /= f
|
case OP_DIVSTOREP_F: // e.f /= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float /= OPA->_float);
|
OPC->_float = (ptr->_float /= OPA->_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -353,11 +356,11 @@ reeval:
|
||||||
OPB->vector[2] += OPA->vector[2];
|
OPB->vector[2] += OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_F: // e.f += f
|
case OP_ADDSTOREP_F: // e.f += f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float += OPA->_float);
|
OPC->_float = (ptr->_float += OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_V: // e.v += v
|
case OP_ADDSTOREP_V: // e.v += v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
||||||
|
@ -372,11 +375,11 @@ reeval:
|
||||||
OPB->vector[2] -= OPA->vector[2];
|
OPB->vector[2] -= OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_F: // e.f -= f
|
case OP_SUBSTOREP_F: // e.f -= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float -= OPA->_float);
|
OPC->_float = (ptr->_float -= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_V: // e.v -= v
|
case OP_SUBSTOREP_V: // e.v -= v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
||||||
|
@ -394,7 +397,7 @@ reeval:
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
||||||
}
|
}
|
||||||
OPC->_int = (int)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
|
OPC->_int = ENGINEPOINTER((((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//load a field to a value
|
//load a field to a value
|
||||||
|
@ -533,9 +536,9 @@ reeval:
|
||||||
i -= externs->numglobalbuiltins;
|
i -= externs->numglobalbuiltins;
|
||||||
if (i >= current_progstate->numbuiltins)
|
if (i >= current_progstate->numbuiltins)
|
||||||
{
|
{
|
||||||
if (newf->first_statement == -0x7fffffff)
|
// if (newf->first_statement == -0x7fffffff)
|
||||||
((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
// ((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
||||||
else
|
// else
|
||||||
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -651,7 +654,7 @@ reeval:
|
||||||
|
|
||||||
//array/structure reading/riting.
|
//array/structure reading/riting.
|
||||||
case OP_GLOBALADDRESS:
|
case OP_GLOBALADDRESS:
|
||||||
OPC->_int = (int)(&OPA->_int) + OPB->_int;
|
OPC->_int = ENGINEPOINTER(&OPA->_int + OPB->_int/4);
|
||||||
break;
|
break;
|
||||||
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
||||||
OPC->_int = OPA->_int + OPB->_int*4;
|
OPC->_int = OPA->_int + OPB->_int*4;
|
||||||
|
@ -683,7 +686,7 @@ reeval:
|
||||||
OPC->_int = OPA->_int - OPB->_int;
|
OPC->_int = OPA->_int - OPB->_int;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_C: //load character from a string
|
case OP_LOADP_C: //load character from a string
|
||||||
ptr = (eval_t *)(OPA->_int + (int)OPB->_float);
|
ptr = QCPOINTERM(OPA->_int + (int)OPB->_float);
|
||||||
OPC->_float = *(unsigned char *)ptr;
|
OPC->_float = *(unsigned char *)ptr;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_I:
|
case OP_LOADP_I:
|
||||||
|
@ -692,12 +695,12 @@ reeval:
|
||||||
case OP_LOADP_ENT:
|
case OP_LOADP_ENT:
|
||||||
case OP_LOADP_S:
|
case OP_LOADP_S:
|
||||||
case OP_LOADP_FNC:
|
case OP_LOADP_FNC:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->_int = ptr->_int;
|
OPC->_int = ptr->_int;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_LOADP_V:
|
case OP_LOADP_V:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->vector[0] = ptr->vector[0];
|
OPC->vector[0] = ptr->vector[0];
|
||||||
OPC->vector[1] = ptr->vector[1];
|
OPC->vector[1] = ptr->vector[1];
|
||||||
OPC->vector[2] = ptr->vector[2];
|
OPC->vector[2] = ptr->vector[2];
|
||||||
|
@ -756,14 +759,14 @@ reeval:
|
||||||
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITSETP: // .b (+) a
|
case OP_BITSETP: // .b (+) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITCLR: // b (-) a
|
case OP_BITCLR: // b (-) a
|
||||||
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
case OP_BITCLRP: // .b (-) a
|
case OP_BITCLRP: // .b (-) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1041,3 +1044,7 @@ reeval:
|
||||||
#undef dstatement_t
|
#undef dstatement_t
|
||||||
#undef sofs
|
#undef sofs
|
||||||
#undef uofs
|
#undef uofs
|
||||||
|
|
||||||
|
#undef ENGINEPOINTER
|
||||||
|
#undef QCPOINTER
|
||||||
|
#undef QCPOINTERM
|
|
@ -35,6 +35,9 @@
|
||||||
#error Bad cont size
|
#error Bad cont size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ENGINEPOINTER(p) ((char*)(p) - progfuncs->stringtable)
|
||||||
|
#define QCPOINTER(p) (eval_t *)(p->_int+progfuncs->stringtable)
|
||||||
|
#define QCPOINTERM(p) (eval_t *)((p)+progfuncs->stringtable)
|
||||||
|
|
||||||
//rely upon just st
|
//rely upon just st
|
||||||
{
|
{
|
||||||
|
@ -286,15 +289,15 @@ reeval:
|
||||||
|
|
||||||
//store a value to a pointer
|
//store a value to a pointer
|
||||||
case OP_STOREP_IF:
|
case OP_STOREP_IF:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)OPA->_int;
|
ptr->_float = (float)OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_FI:
|
case OP_STOREP_FI:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = (int)OPA->_float;
|
ptr->_int = (int)OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_I:
|
case OP_STOREP_I:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_F:
|
case OP_STOREP_F:
|
||||||
|
@ -302,18 +305,18 @@ reeval:
|
||||||
case OP_STOREP_FLD: // integers
|
case OP_STOREP_FLD: // integers
|
||||||
case OP_STOREP_S:
|
case OP_STOREP_S:
|
||||||
case OP_STOREP_FNC: // pointers
|
case OP_STOREP_FNC: // pointers
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_V:
|
case OP_STOREP_V:
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->vector[0] = OPA->vector[0];
|
ptr->vector[0] = OPA->vector[0];
|
||||||
ptr->vector[1] = OPA->vector[1];
|
ptr->vector[1] = OPA->vector[1];
|
||||||
ptr->vector[2] = OPA->vector[2];
|
ptr->vector[2] = OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_STOREP_C: //store character in a string
|
case OP_STOREP_C: //store character in a string
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
*(unsigned char *)ptr = (char)OPA->_float;
|
*(unsigned char *)ptr = (char)OPA->_float;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -326,11 +329,11 @@ reeval:
|
||||||
OPB->vector[2] *= OPA->_float;
|
OPB->vector[2] *= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_F: // e.f *= f
|
case OP_MULSTOREP_F: // e.f *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float *= OPA->_float);
|
OPC->_float = (ptr->_float *= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_MULSTOREP_V: // e.v *= f
|
case OP_MULSTOREP_V: // e.v *= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[0] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[1] *= OPA->_float);
|
||||||
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
OPC->vector[0] = (ptr->vector[2] *= OPA->_float);
|
||||||
|
@ -340,7 +343,7 @@ reeval:
|
||||||
OPB->_float /= OPA->_float;
|
OPB->_float /= OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_DIVSTOREP_F: // e.f /= f
|
case OP_DIVSTOREP_F: // e.f /= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float /= OPA->_float);
|
OPC->_float = (ptr->_float /= OPA->_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -353,11 +356,11 @@ reeval:
|
||||||
OPB->vector[2] += OPA->vector[2];
|
OPB->vector[2] += OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_F: // e.f += f
|
case OP_ADDSTOREP_F: // e.f += f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float += OPA->_float);
|
OPC->_float = (ptr->_float += OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_ADDSTOREP_V: // e.v += v
|
case OP_ADDSTOREP_V: // e.v += v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] += OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] += OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] += OPA->vector[2]);
|
||||||
|
@ -372,11 +375,11 @@ reeval:
|
||||||
OPB->vector[2] -= OPA->vector[2];
|
OPB->vector[2] -= OPA->vector[2];
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_F: // e.f -= f
|
case OP_SUBSTOREP_F: // e.f -= f
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->_float = (ptr->_float -= OPA->_float);
|
OPC->_float = (ptr->_float -= OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_SUBSTOREP_V: // e.v -= v
|
case OP_SUBSTOREP_V: // e.v -= v
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
OPC->vector[0] = (ptr->vector[0] -= OPA->vector[0]);
|
||||||
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
OPC->vector[1] = (ptr->vector[1] -= OPA->vector[1]);
|
||||||
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
OPC->vector[2] = (ptr->vector[2] -= OPA->vector[2]);
|
||||||
|
@ -394,7 +397,7 @@ reeval:
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
PR_RunError (progfuncs, "assignment to read-only entity in %s", pr_xfunction->s_name);
|
||||||
}
|
}
|
||||||
OPC->_int = (int)(((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust);
|
OPC->_int = ENGINEPOINTER((((int *)edvars(ed)) + OPB->_int + progfuncs->fieldadjust));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//load a field to a value
|
//load a field to a value
|
||||||
|
@ -533,9 +536,9 @@ reeval:
|
||||||
i -= externs->numglobalbuiltins;
|
i -= externs->numglobalbuiltins;
|
||||||
if (i >= current_progstate->numbuiltins)
|
if (i >= current_progstate->numbuiltins)
|
||||||
{
|
{
|
||||||
if (newf->first_statement == -0x7fffffff)
|
// if (newf->first_statement == -0x7fffffff)
|
||||||
((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
// ((builtin_t)newf->profile) (progfuncs, (struct globalvars_s *)current_progstate->globals);
|
||||||
else
|
// else
|
||||||
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
PR_RunError (progfuncs, "Bad builtin call number - %i", -newf->first_statement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -651,7 +654,7 @@ reeval:
|
||||||
|
|
||||||
//array/structure reading/riting.
|
//array/structure reading/riting.
|
||||||
case OP_GLOBALADDRESS:
|
case OP_GLOBALADDRESS:
|
||||||
OPC->_int = (int)(&OPA->_int) + OPB->_int;
|
OPC->_int = ENGINEPOINTER(&OPA->_int + OPB->_int/4);
|
||||||
break;
|
break;
|
||||||
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
case OP_POINTER_ADD: //pointer to 32 bit (remember to *3 for vectors)
|
||||||
OPC->_int = OPA->_int + OPB->_int*4;
|
OPC->_int = OPA->_int + OPB->_int*4;
|
||||||
|
@ -683,7 +686,7 @@ reeval:
|
||||||
OPC->_int = OPA->_int - OPB->_int;
|
OPC->_int = OPA->_int - OPB->_int;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_C: //load character from a string
|
case OP_LOADP_C: //load character from a string
|
||||||
ptr = (eval_t *)(OPA->_int + (int)OPB->_float);
|
ptr = QCPOINTERM(OPA->_int + (int)OPB->_float);
|
||||||
OPC->_float = *(unsigned char *)ptr;
|
OPC->_float = *(unsigned char *)ptr;
|
||||||
break;
|
break;
|
||||||
case OP_LOADP_I:
|
case OP_LOADP_I:
|
||||||
|
@ -692,12 +695,12 @@ reeval:
|
||||||
case OP_LOADP_ENT:
|
case OP_LOADP_ENT:
|
||||||
case OP_LOADP_S:
|
case OP_LOADP_S:
|
||||||
case OP_LOADP_FNC:
|
case OP_LOADP_FNC:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->_int = ptr->_int;
|
OPC->_int = ptr->_int;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_LOADP_V:
|
case OP_LOADP_V:
|
||||||
ptr = (eval_t *)(OPA->_int + OPB->_int);
|
ptr = QCPOINTERM(OPA->_int + OPB->_int);
|
||||||
OPC->vector[0] = ptr->vector[0];
|
OPC->vector[0] = ptr->vector[0];
|
||||||
OPC->vector[1] = ptr->vector[1];
|
OPC->vector[1] = ptr->vector[1];
|
||||||
OPC->vector[2] = ptr->vector[2];
|
OPC->vector[2] = ptr->vector[2];
|
||||||
|
@ -756,14 +759,14 @@ reeval:
|
||||||
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
OPB->_float = (float)((int)OPB->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITSETP: // .b (+) a
|
case OP_BITSETP: // .b (+) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
ptr->_float = (float)((int)ptr->_float | (int)OPA->_float);
|
||||||
break;
|
break;
|
||||||
case OP_BITCLR: // b (-) a
|
case OP_BITCLR: // b (-) a
|
||||||
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
OPB->_float = (float)((int)OPB->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
case OP_BITCLRP: // .b (-) a
|
case OP_BITCLRP: // .b (-) a
|
||||||
ptr = (eval_t *)(OPB->_int);
|
ptr = QCPOINTER(OPB);
|
||||||
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
ptr->_float = (float)((int)ptr->_float & ~((int)OPA->_float));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1041,3 +1044,7 @@ reeval:
|
||||||
#undef dstatement_t
|
#undef dstatement_t
|
||||||
#undef sofs
|
#undef sofs
|
||||||
#undef uofs
|
#undef uofs
|
||||||
|
|
||||||
|
#undef ENGINEPOINTER
|
||||||
|
#undef QCPOINTER
|
||||||
|
#undef QCPOINTERM
|
|
@ -76,6 +76,7 @@ void PRAddressableFlush(progfuncs_t *progfuncs, int totalammount)
|
||||||
#else
|
#else
|
||||||
free(addressablehunk);
|
free(addressablehunk);
|
||||||
addressablehunk = malloc(totalammount); //linux will allocate-on-use anyway, which is handy.
|
addressablehunk = malloc(totalammount); //linux will allocate-on-use anyway, which is handy.
|
||||||
|
// memset(addressablehunk, 0xff, totalammount);
|
||||||
#endif
|
#endif
|
||||||
addressablesize = totalammount;
|
addressablesize = totalammount;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ int PR_InitEnts(progfuncs_t *progfuncs, int max_ents)
|
||||||
sv_edicts = PRHunkAlloc(progfuncs, externs->edictsize);
|
sv_edicts = PRHunkAlloc(progfuncs, externs->edictsize);
|
||||||
prinst->edicttable[0] = sv_edicts;
|
prinst->edicttable[0] = sv_edicts;
|
||||||
((edictrun_t*)prinst->edicttable[0])->fields = PRAddressableAlloc(progfuncs, max_fields_size);
|
((edictrun_t*)prinst->edicttable[0])->fields = PRAddressableAlloc(progfuncs, max_fields_size);
|
||||||
|
ED_ClearEdict(progfuncs, sv_edicts);
|
||||||
sv_num_edicts = 1;
|
sv_num_edicts = 1;
|
||||||
|
|
||||||
return max_fields_size;
|
return max_fields_size;
|
||||||
|
|
|
@ -950,13 +950,17 @@ void ED_Count (progfuncs_t *progfuncs)
|
||||||
ED_NewString
|
ED_NewString
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
char *ED_NewString (progfuncs_t *progfuncs, char *string)
|
char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength)
|
||||||
{
|
{
|
||||||
char *new, *new_p;
|
char *new, *new_p;
|
||||||
int i,l;
|
int i,l;
|
||||||
|
|
||||||
|
minlength++;
|
||||||
|
|
||||||
l = strlen(string) + 1;
|
l = strlen(string) + 1;
|
||||||
new = PRHunkAlloc (progfuncs, l);
|
if (l < minlength)
|
||||||
|
l = minlength;
|
||||||
|
new = PRAddressableAlloc (progfuncs, l);
|
||||||
new_p = new;
|
new_p = new;
|
||||||
|
|
||||||
for (i=0 ; i< l ; i++)
|
for (i=0 ; i< l ; i++)
|
||||||
|
@ -1023,7 +1027,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ev_string:
|
case ev_string:
|
||||||
st = ED_NewString (progfuncs, s)-progfuncs->stringtable;
|
st = ED_NewString (progfuncs, s, 0)-progfuncs->stringtable;
|
||||||
*(string_t *)d = st;
|
*(string_t *)d = st;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1687,6 +1691,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
Sys_Error("Edict was not allocated\n");
|
Sys_Error("Edict was not allocated\n");
|
||||||
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
||||||
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
||||||
|
ED_ClearEdict(progfuncs, ed);
|
||||||
ed->entnum = num;
|
ed->entnum = num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1780,6 +1785,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
{
|
{
|
||||||
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
||||||
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
||||||
|
ED_ClearEdict(progfuncs, ed);
|
||||||
ed->entnum = num;
|
ed->entnum = num;
|
||||||
ed->isfree = true;
|
ed->isfree = true;
|
||||||
}
|
}
|
||||||
|
@ -1938,6 +1944,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
{
|
{
|
||||||
prinst->edicttable[numents] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
prinst->edicttable[numents] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
||||||
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
||||||
|
ED_ClearEdict(progfuncs, ed);
|
||||||
ed->entnum = numents;
|
ed->entnum = numents;
|
||||||
ed->isfree = true;
|
ed->isfree = true;
|
||||||
}
|
}
|
||||||
|
@ -1963,6 +1970,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
{
|
{
|
||||||
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(externs->edictsize);
|
||||||
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
ed->fields = PRAddressableAlloc(progfuncs, fields_size);
|
||||||
|
ED_ClearEdict(progfuncs, ed);
|
||||||
ed->entnum = num;
|
ed->entnum = num;
|
||||||
ed->isfree = true;
|
ed->isfree = true;
|
||||||
}
|
}
|
||||||
|
@ -2173,6 +2181,40 @@ pbool PR_TestRecompile(progfuncs_t *progfuncs)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//this is for debugging.
|
||||||
|
//I'm using this to detect incorrect string types while converting 32bit string pointers with bias to bound indexes.
|
||||||
|
void PR_TestForWierdness(progfuncs_t *progfuncs)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
int e;
|
||||||
|
edictrun_t *ed;
|
||||||
|
for (i = 0; i < pr_progs->numglobaldefs; i++)
|
||||||
|
{
|
||||||
|
if ((pr_globaldefs16[i].type&~(DEF_SHARED|DEF_SAVEGLOBAL)) == ev_string)
|
||||||
|
{
|
||||||
|
if (G_INT(pr_globaldefs16[i].ofs) < 0 || G_INT(pr_globaldefs16[i].ofs) >= addressableused)
|
||||||
|
printf("String type irregularity on \"%s\" \"%s\"\n", pr_globaldefs16[i].s_name+progfuncs->stringtable, G_INT(pr_globaldefs16[i].ofs)+progfuncs->stringtable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < numfields; i++)
|
||||||
|
{
|
||||||
|
if ((field[i].type&~(DEF_SHARED|DEF_SAVEGLOBAL)) == ev_string)
|
||||||
|
{
|
||||||
|
for (e = 0; e < sv_num_edicts; e++)
|
||||||
|
{
|
||||||
|
ed = EDICT_NUM(progfuncs, e);
|
||||||
|
if (ed->isfree)
|
||||||
|
continue;
|
||||||
|
if (((int *)ed->fields)[field[i].ofs] < 0 || ((int *)ed->fields)[field[i].ofs] >= addressableused)
|
||||||
|
printf("String type irregularity \"%s\" \"%s\"\n", field[i].name, ((int *)ed->fields)[field[i].ofs]+progfuncs->stringtable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *decode(int complen, int len, int method, char *info, char *buffer);
|
char *decode(int complen, int len, int method, char *info, char *buffer);
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|
|
|
@ -446,7 +446,7 @@ char *EvaluateDebugString(progfuncs_t *progfuncs, char *key)
|
||||||
switch (def->type&~DEF_SAVEGLOBAL)
|
switch (def->type&~DEF_SAVEGLOBAL)
|
||||||
{
|
{
|
||||||
case ev_string:
|
case ev_string:
|
||||||
*(string_t *)val = ED_NewString (progfuncs, assignment)-progfuncs->stringtable;
|
*(string_t *)val = ED_NewString (progfuncs, assignment, 0)-progfuncs->stringtable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_float:
|
case ev_float:
|
||||||
|
@ -565,7 +565,7 @@ int PR_ToggleBreakpoint(progfuncs_t *progfuncs, char *filename, int linenum, int
|
||||||
|
|
||||||
for (f = pr_progstate[pn].functions, fl = 0; fl < pr_progstate[pn].progs->numfunctions; f++, fl++)
|
for (f = pr_progstate[pn].functions, fl = 0; fl < pr_progstate[pn].progs->numfunctions; f++, fl++)
|
||||||
{
|
{
|
||||||
if (!stricmp(f->s_file, filename))
|
if (!stricmp(f->s_file+progfuncs->stringtable, filename))
|
||||||
{
|
{
|
||||||
for (i = f->first_statement; ; i++)
|
for (i = f->first_statement; ; i++)
|
||||||
{
|
{
|
||||||
|
@ -713,7 +713,7 @@ int ShowStep(progfuncs_t *progfuncs, int statement)
|
||||||
// return statement;
|
// return statement;
|
||||||
// texture realcursortex;
|
// texture realcursortex;
|
||||||
static int lastline = 0;
|
static int lastline = 0;
|
||||||
static char *lastfile = NULL;
|
static char *lastfile = 0;
|
||||||
|
|
||||||
int pn = pr_typecurrent;
|
int pn = pr_typecurrent;
|
||||||
int i;
|
int i;
|
||||||
|
@ -721,11 +721,11 @@ static char *lastfile = NULL;
|
||||||
|
|
||||||
if (f && pr_progstate[pn].linenums && externs->useeditor)
|
if (f && pr_progstate[pn].linenums && externs->useeditor)
|
||||||
{
|
{
|
||||||
if (lastline == pr_progstate[pn].linenums[statement] && lastfile == f->s_file)
|
if (lastline == pr_progstate[pn].linenums[statement] && lastfile == f->s_file+progfuncs->stringtable)
|
||||||
return statement; //no info/same line as last time
|
return statement; //no info/same line as last time
|
||||||
|
|
||||||
lastline = pr_progstate[pn].linenums[statement];
|
lastline = pr_progstate[pn].linenums[statement];
|
||||||
lastfile = f->s_file;
|
lastfile = f->s_file+progfuncs->stringtable;
|
||||||
|
|
||||||
lastline = externs->useeditor(lastfile, lastline, 0, NULL);
|
lastline = externs->useeditor(lastfile, lastline, 0, NULL);
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ static char *lastfile = NULL;
|
||||||
else if (f) //annoying.
|
else if (f) //annoying.
|
||||||
{
|
{
|
||||||
if (externs->useeditor)
|
if (externs->useeditor)
|
||||||
externs->useeditor(f->s_file, -1, 0, &f->s_name);
|
externs->useeditor(f->s_file+progfuncs->stringtable, -1, 0, NULL);
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,10 +929,6 @@ void PR_ExecuteProgram (progfuncs_t *progfuncs, func_t fnum)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fnum;
|
int fnum;
|
||||||
int progsnum;
|
int progsnum;
|
||||||
|
|
|
@ -228,7 +228,7 @@ void PR_Profile_f (void);
|
||||||
struct edict_s *ED_Alloc (progfuncs_t *progfuncs);
|
struct edict_s *ED_Alloc (progfuncs_t *progfuncs);
|
||||||
void ED_Free (progfuncs_t *progfuncs, struct edict_s *ed);
|
void ED_Free (progfuncs_t *progfuncs, struct edict_s *ed);
|
||||||
|
|
||||||
char *ED_NewString (progfuncs_t *progfuncs, char *string);
|
char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength);
|
||||||
// returns a copy of the string allocated from the server's string heap
|
// returns a copy of the string allocated from the server's string heap
|
||||||
|
|
||||||
void ED_Print (progfuncs_t *progfuncs, struct edict_s *ed);
|
void ED_Print (progfuncs_t *progfuncs, struct edict_s *ed);
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct progfuncs_s {
|
||||||
struct edict_s *(*restoreent) (progfuncs_t *prinst, char *buf, int *size, struct edict_s *ed); //will restore the entity that had it's values saved (can use NULL for ed)
|
struct edict_s *(*restoreent) (progfuncs_t *prinst, char *buf, int *size, struct edict_s *ed); //will restore the entity that had it's values saved (can use NULL for ed)
|
||||||
|
|
||||||
union eval_s *(*FindGlobal) (progfuncs_t *prinst, char *name, progsnum_t num); //find a pointer to the globals value
|
union eval_s *(*FindGlobal) (progfuncs_t *prinst, char *name, progsnum_t num); //find a pointer to the globals value
|
||||||
char *(*AddString) (progfuncs_t *prinst, char *val); //dump a string into the progs memory (for setting globals and whatnot)
|
char *(*AddString) (progfuncs_t *prinst, char *val, int minlength); //dump a string into the progs memory (for setting globals and whatnot)
|
||||||
void *(*Tempmem) (progfuncs_t *prinst, int ammount, char *whatfor); //grab some mem for as long as the progs stays loaded (for strings)
|
void *(*Tempmem) (progfuncs_t *prinst, int ammount, char *whatfor); //grab some mem for as long as the progs stays loaded (for strings)
|
||||||
|
|
||||||
union eval_s *(*GetEdictFieldValue) (progfuncs_t *prinst, struct edict_s *ent, char *name, evalc_t *s); //get an entityvar (cache it) and return the possible values
|
union eval_s *(*GetEdictFieldValue) (progfuncs_t *prinst, struct edict_s *ent, char *name, evalc_t *s); //get an entityvar (cache it) and return the possible values
|
||||||
|
@ -234,7 +234,7 @@ typedef union eval_s
|
||||||
|
|
||||||
#define PR_FindFunction(pf, name, num) (*pf->FindFunction) (pf, name, num)
|
#define PR_FindFunction(pf, name, num) (*pf->FindFunction) (pf, name, num)
|
||||||
#define PR_FindGlobal(pf, name, progs) (*pf->FindGlobal) (pf, name, progs)
|
#define PR_FindGlobal(pf, name, progs) (*pf->FindGlobal) (pf, name, progs)
|
||||||
#define PR_AddString(pf, ed) (*pf->AddString) (pf, ed)
|
#define PR_AddString(pf, ed, len) (*pf->AddString) (pf, ed, len)
|
||||||
#define PR_Alloc(pf,size) (*pf->Tempmem) (pf, size)
|
#define PR_Alloc(pf,size) (*pf->Tempmem) (pf, size)
|
||||||
|
|
||||||
#define PROG_TO_EDICT(pf, ed) (*pf->ProgsToEdict) (pf, ed)
|
#define PROG_TO_EDICT(pf, ed) (*pf->ProgsToEdict) (pf, ed)
|
||||||
|
@ -259,7 +259,7 @@ typedef union eval_s
|
||||||
#define PR_GetString(p,s) (s?s + p->stringtable:"")
|
#define PR_GetString(p,s) (s?s + p->stringtable:"")
|
||||||
#define PR_GetStringOfs(p,o) (G_INT(o)?G_INT(o) + p->stringtable:"")
|
#define PR_GetStringOfs(p,o) (G_INT(o)?G_INT(o) + p->stringtable:"")
|
||||||
#define PR_SetString(p, s) ((s&&*s)?(s - p->stringtable):0)
|
#define PR_SetString(p, s) ((s&&*s)?(s - p->stringtable):0)
|
||||||
#define PR_NewString(p, s) (PR_AddString(p, s) - p->stringtable)
|
#define PR_NewString(p, s, l) (PR_AddString(p, s, l) - p->stringtable)
|
||||||
|
|
||||||
#define ev_prog ev_integer
|
#define ev_prog ev_integer
|
||||||
|
|
||||||
|
|
|
@ -806,6 +806,13 @@ void PR_BreakPoint_f(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void QCLibTest(void)
|
||||||
|
{
|
||||||
|
PR_TestForWierdness(svprogfuncs);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef char char32[32];
|
typedef char char32[32];
|
||||||
char32 sv_addonname[MAXADDONS];
|
char32 sv_addonname[MAXADDONS];
|
||||||
void PR_Init(void)
|
void PR_Init(void)
|
||||||
|
@ -815,7 +822,9 @@ void PR_Init(void)
|
||||||
Cmd_AddCommand ("decompile", PR_Decompile_f);
|
Cmd_AddCommand ("decompile", PR_Decompile_f);
|
||||||
Cmd_AddCommand ("compile", PR_Compile_f);
|
Cmd_AddCommand ("compile", PR_Compile_f);
|
||||||
Cmd_AddCommand ("applycompile", PR_ApplyCompilation_f);
|
Cmd_AddCommand ("applycompile", PR_ApplyCompilation_f);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
Cmd_AddCommand ("svtestprogs", QCLibTest);
|
||||||
|
#endif
|
||||||
Cvar_Register(&pr_maxedicts, cvargroup_progs);
|
Cvar_Register(&pr_maxedicts, cvargroup_progs);
|
||||||
Cvar_Register(&pr_imitatemvdsv, cvargroup_progs);
|
Cvar_Register(&pr_imitatemvdsv, cvargroup_progs);
|
||||||
Cvar_Register(&pr_fixbrokenqccarrays, cvargroup_progs);
|
Cvar_Register(&pr_fixbrokenqccarrays, cvargroup_progs);
|
||||||
|
@ -1393,7 +1402,7 @@ int PR_SizeOfFile(char *filename)
|
||||||
prnumforfile=svs.numprogs-1;
|
prnumforfile=svs.numprogs-1;
|
||||||
while(prnumforfile>=0)
|
while(prnumforfile>=0)
|
||||||
{
|
{
|
||||||
if ((qbyte *)svprogfuncs->filefromprogs(svprogfuncs, prnumforfile, filename, &com_filesize, NULL)==(qbyte *)0xffffffff)
|
if ((qbyte *)svprogfuncs->filefromprogs(svprogfuncs, prnumforfile, filename, &com_filesize, NULL)==(qbyte *)-1)
|
||||||
return com_filesize;
|
return com_filesize;
|
||||||
prnumforfile--;
|
prnumforfile--;
|
||||||
}
|
}
|
||||||
|
@ -1437,7 +1446,7 @@ char *PF_VarString (progfuncs_t *prinst, int first, globalvars_t *pr_globals)
|
||||||
#define RETURN_SSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
|
#define RETURN_SSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
|
||||||
#define RETURN_TSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //temp (static but cycle buffers?)
|
#define RETURN_TSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //temp (static but cycle buffers?)
|
||||||
#define RETURN_CSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //semi-permanant. (hash tables?)
|
#define RETURN_CSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //semi-permanant. (hash tables?)
|
||||||
#define RETURN_PSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_NewString(prinst, s)) //permanant
|
#define RETURN_PSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_NewString(prinst, s, 0)) //permanant
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
@ -1459,6 +1468,7 @@ void PF_externcall (progfuncs_t *prinst, globalvars_t *pr_globals) //this func c
|
||||||
int progsnum;
|
int progsnum;
|
||||||
char *funcname;
|
char *funcname;
|
||||||
int i;
|
int i;
|
||||||
|
string_t failedst = G_INT(OFS_PARM1);
|
||||||
func_t f;
|
func_t f;
|
||||||
|
|
||||||
progsnum = G_PROG(OFS_PARM0);
|
progsnum = G_PROG(OFS_PARM0);
|
||||||
|
@ -1484,7 +1494,7 @@ void PF_externcall (progfuncs_t *prinst, globalvars_t *pr_globals) //this func c
|
||||||
|
|
||||||
for (i = OFS_PARM0; i < OFS_PARM6; i+=3)
|
for (i = OFS_PARM0; i < OFS_PARM6; i+=3)
|
||||||
VectorCopy(G_VECTOR(i+(1*3)), G_VECTOR(i));
|
VectorCopy(G_VECTOR(i+(1*3)), G_VECTOR(i));
|
||||||
G_INT(OFS_PARM0) = (int)funcname;
|
G_INT(OFS_PARM0) = failedst;
|
||||||
|
|
||||||
(*prinst->pr_trace)++; //continue debugging
|
(*prinst->pr_trace)++; //continue debugging
|
||||||
PR_ExecuteProgram(prinst, f);
|
PR_ExecuteProgram(prinst, f);
|
||||||
|
@ -1768,11 +1778,11 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i==MAX_MODELS || !*sv.model_precache[i])
|
if (i==MAX_MODELS || !sv.model_precache[i])
|
||||||
{
|
{
|
||||||
if (i!=MAX_MODELS && sv.state == ss_loading)
|
if (i!=MAX_MODELS && sv.state == ss_loading)
|
||||||
{
|
{
|
||||||
Q_strncpyz(sv.model_precache[i], m, sizeof(sv.model_precache[i]));
|
sv.model_precache[i] = PR_AddString(prinst, m, 0);
|
||||||
if (!strcmp(m + strlen(m) - 4, ".bsp"))
|
if (!strcmp(m + strlen(m) - 4, ".bsp"))
|
||||||
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
||||||
Con_Printf("WARNING: SV_ModelIndex: model %s not precached", m);
|
Con_Printf("WARNING: SV_ModelIndex: model %s not precached", m);
|
||||||
|
@ -3422,14 +3432,14 @@ void PF_precache_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
|
|
||||||
for (i=1 ; i<MAX_MODELS ; i++)
|
for (i=1 ; i<MAX_MODELS ; i++)
|
||||||
{
|
{
|
||||||
if (!*sv.model_precache[i])
|
if (!sv.model_precache[i])
|
||||||
{
|
{
|
||||||
if (strlen(s)>=sizeof(sv.model_precache[i])-1)
|
if (strlen(s)>=MAX_QPATH-1) //probably safest to keep this.
|
||||||
{
|
{
|
||||||
PR_BIError (prinst, "Precache name too long");
|
PR_BIError (prinst, "Precache name too long");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy(sv.model_precache[i], s);
|
sv.model_precache[i] = PR_AddString(prinst, s, 0);
|
||||||
if (!strcmp(s + strlen(s) - 4, ".bsp"))
|
if (!strcmp(s + strlen(s) - 4, ".bsp"))
|
||||||
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
sv.models[i] = Mod_FindName(sv.model_precache[i]);
|
||||||
|
|
||||||
|
@ -5390,7 +5400,7 @@ void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
if (len >= MAXTEMPBUFFERLEN)
|
if (len >= MAXTEMPBUFFERLEN)
|
||||||
len = MAXTEMPBUFFERLEN-1;
|
len = MAXTEMPBUFFERLEN-1;
|
||||||
|
|
||||||
RETURN_SSTRING(result);
|
RETURN_SSTRING(((char*)result));
|
||||||
|
|
||||||
for (i = 0; i < len; i++, string++, result++) //do this backwards
|
for (i = 0; i < len; i++, string++, result++) //do this backwards
|
||||||
{
|
{
|
||||||
|
@ -8924,6 +8934,9 @@ void PR_RegisterFields(void) //it's just easier to do it this way.
|
||||||
fieldentity(viewmodelforclient);
|
fieldentity(viewmodelforclient);
|
||||||
fieldentity(exteriormodeltoclient);
|
fieldentity(exteriormodeltoclient);
|
||||||
|
|
||||||
|
fieldfloat(glowsize);
|
||||||
|
fieldfloat(glowcolor);
|
||||||
|
|
||||||
//UDC_EXTEFFECT... yuckie
|
//UDC_EXTEFFECT... yuckie
|
||||||
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldcolor", (int)&((entvars_t*)0)->seefcolour, -1);
|
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldcolor", (int)&((entvars_t*)0)->seefcolour, -1);
|
||||||
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldsizex", (int)&((entvars_t*)0)->seefsizex, -1);
|
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldsizex", (int)&((entvars_t*)0)->seefsizex, -1);
|
||||||
|
|
|
@ -201,6 +201,9 @@ typedef struct entvars_s
|
||||||
int viewmodelforclient;
|
int viewmodelforclient;
|
||||||
int exteriormodeltoclient;
|
int exteriormodeltoclient;
|
||||||
|
|
||||||
|
float glowsize;
|
||||||
|
float glowcolor;
|
||||||
|
|
||||||
//EXT_DIMENSION_VISIBLE
|
//EXT_DIMENSION_VISIBLE
|
||||||
float dimension_see;
|
float dimension_see;
|
||||||
float dimension_seen;
|
float dimension_seen;
|
||||||
|
@ -230,7 +233,6 @@ typedef struct entvars_s
|
||||||
float abslight; //hexen2's force a lightlevel
|
float abslight; //hexen2's force a lightlevel
|
||||||
float hasted; //hexen2 uses this AS WELL as maxspeed
|
float hasted; //hexen2 uses this AS WELL as maxspeed
|
||||||
|
|
||||||
|
|
||||||
//csqc stuph.
|
//csqc stuph.
|
||||||
func_t SendEntity;
|
func_t SendEntity;
|
||||||
float Version;
|
float Version;
|
||||||
|
|
|
@ -620,7 +620,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
||||||
if (!ignoreplayers)
|
if (!ignoreplayers)
|
||||||
{
|
{
|
||||||
eval = PR_FindGlobal(svprogfuncs, "startspot", 0);
|
eval = PR_FindGlobal(svprogfuncs, "startspot", 0);
|
||||||
if (eval) eval->_int = (int)PR_NewString(svprogfuncs, startspot);
|
if (eval) eval->_int = (int)PR_NewString(svprogfuncs, startspot, 0);
|
||||||
|
|
||||||
eval = PR_FindGlobal(svprogfuncs, "ClientReEnter", 0);
|
eval = PR_FindGlobal(svprogfuncs, "ClientReEnter", 0);
|
||||||
if (eval)
|
if (eval)
|
||||||
|
|
|
@ -129,7 +129,7 @@ typedef struct
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
char model_precache[MAX_MODELS][MAX_QPATH]; // NULL terminated
|
char *model_precache[MAX_MODELS]; // NULL terminated
|
||||||
char sound_precache[MAX_SOUNDS][MAX_QPATH]; // NULL terminated
|
char sound_precache[MAX_SOUNDS][MAX_QPATH]; // NULL terminated
|
||||||
char image_precache[Q2MAX_IMAGES][MAX_QPATH];
|
char image_precache[Q2MAX_IMAGES][MAX_QPATH];
|
||||||
char *lightstyles[MAX_LIGHTSTYLES];
|
char *lightstyles[MAX_LIGHTSTYLES];
|
||||||
|
@ -379,8 +379,10 @@ typedef struct client_s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int playerclass;
|
int playerclass;
|
||||||
char team[32];
|
char teambuf[32];
|
||||||
char name[32]; // for printing to other people
|
char *team;
|
||||||
|
char *name;
|
||||||
|
char namebuf[32]; // for printing to other people
|
||||||
// extracted from userinfo
|
// extracted from userinfo
|
||||||
int messagelevel; // for filtering printed messages
|
int messagelevel; // for filtering printed messages
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ float SV_ChatFunc(const char *func) //parse a condition/function
|
||||||
if (*com_token == ',')
|
if (*com_token == ',')
|
||||||
continue;
|
continue;
|
||||||
if (com_tokentype == TTP_STRING)
|
if (com_tokentype == TTP_STRING)
|
||||||
G_INT(parm) = (int)PR_NewString(svprogfuncs, com_token);
|
G_INT(parm) = PR_NewString(svprogfuncs, com_token, 0);
|
||||||
else if (!strcmp(com_token, "ent"))
|
else if (!strcmp(com_token, "ent"))
|
||||||
SetGlobalEdict(svprogfuncs, host_client->chat.edict, parm);
|
SetGlobalEdict(svprogfuncs, host_client->chat.edict, parm);
|
||||||
else
|
else
|
||||||
|
|
|
@ -524,6 +524,9 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
||||||
if ( to->abslight != from->abslight && protext & PEXT_HEXEN2)
|
if ( to->abslight != from->abslight && protext & PEXT_HEXEN2)
|
||||||
evenmorebits |= U_ABSLIGHT;
|
evenmorebits |= U_ABSLIGHT;
|
||||||
|
|
||||||
|
if (to->glowsize)
|
||||||
|
to->dpflags |= 4;
|
||||||
|
|
||||||
if (to->dpflags)
|
if (to->dpflags)
|
||||||
evenmorebits |= U_DPFLAGS;
|
evenmorebits |= U_DPFLAGS;
|
||||||
|
|
||||||
|
@ -1708,7 +1711,10 @@ int glowsize, glowcolor;
|
||||||
if (!(ent->baseline.trans == 1 && !ent->v->alpha))
|
if (!(ent->baseline.trans == 1 && !ent->v->alpha))
|
||||||
bits |= DPU_ALPHA;
|
bits |= DPU_ALPHA;
|
||||||
if (ent->baseline.scale != ent->v->scale)
|
if (ent->baseline.scale != ent->v->scale)
|
||||||
bits |= DPU_SCALE;
|
{
|
||||||
|
if (ent->v->scale != 0 || ent->baseline.scale != 1)
|
||||||
|
bits |= DPU_SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ent->baseline.effects&0xff00) != ((int)eff & 0xff00))
|
if ((ent->baseline.effects&0xff00) != ((int)eff & 0xff00))
|
||||||
bits |= DPU_EFFECTS2;
|
bits |= DPU_EFFECTS2;
|
||||||
|
@ -2336,10 +2342,9 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
||||||
|
|
||||||
if (state->effects & EF_FULLBRIGHT)
|
if (state->effects & EF_FULLBRIGHT)
|
||||||
{
|
{
|
||||||
state->abslight = 255;
|
state->hexen2flags |= MLS_FULLBRIGHT;
|
||||||
state->hexen2flags |= MLS_ABSLIGHT;
|
|
||||||
}
|
}
|
||||||
if (progstype != PROG_QW) //don't send extra nq effects to a qw client.
|
if (progstype != PROG_QW && state->effects) //don't send extra nq effects to a qw client.
|
||||||
{
|
{
|
||||||
//EF_NODRAW doesn't draw the model.
|
//EF_NODRAW doesn't draw the model.
|
||||||
//The client still needs to know about it though, as it might have other effects on it.
|
//The client still needs to know about it though, as it might have other effects on it.
|
||||||
|
@ -2354,7 +2359,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
||||||
state->modelindex = 0;
|
state->modelindex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->effects &= EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
state->effects &= EF_BRIGHTLIGHT | EF_DIMLIGHT | NQEF_ADDATIVE | EF_RED | EF_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PEXT_SCALE
|
#ifdef PEXT_SCALE
|
||||||
|
@ -2365,6 +2370,9 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
||||||
if (!ent->v->alpha)
|
if (!ent->v->alpha)
|
||||||
state->trans = 1;
|
state->trans = 1;
|
||||||
|
|
||||||
|
state->glowsize = ent->v->glowsize*0.25;
|
||||||
|
state->glowcolour = ent->v->glowcolor;
|
||||||
|
|
||||||
//QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha.
|
//QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha.
|
||||||
if (client->edict)
|
if (client->edict)
|
||||||
if (((int)client->edict->v->dimension_see & (int)ent->v->dimension_ghost))
|
if (((int)client->edict->v->dimension_see & (int)ent->v->dimension_ghost))
|
||||||
|
|
|
@ -242,8 +242,7 @@ void SVNQ_CreateBaseline (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
svent->baseline.colormap = 0;
|
svent->baseline.colormap = 0;
|
||||||
svent->baseline.modelindex =
|
svent->baseline.modelindex = svent->v->modelindex;
|
||||||
SV_ModelIndex(PR_GetString(svprogfuncs, svent->v->model));
|
|
||||||
}
|
}
|
||||||
svent->baseline.modelindex&=255;
|
svent->baseline.modelindex&=255;
|
||||||
}
|
}
|
||||||
|
@ -768,12 +767,12 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
if (svs.gametype == GT_PROGS)
|
if (svs.gametype == GT_PROGS)
|
||||||
{
|
{
|
||||||
strcpy(sv.sound_precache[0], "");
|
strcpy(sv.sound_precache[0], "");
|
||||||
strcpy(sv.model_precache[0], "");
|
sv.model_precache[0] = "";
|
||||||
|
|
||||||
strcpy(sv.model_precache[1], sv.modelname);
|
sv.model_precache[1] = PR_AddString(svprogfuncs, sv.modelname, 0);
|
||||||
for (i=1 ; i<sv.worldmodel->numsubmodels ; i++)
|
for (i=1 ; i<sv.worldmodel->numsubmodels ; i++)
|
||||||
{
|
{
|
||||||
strcpy(sv.model_precache[1+i], localmodels[i]);
|
sv.model_precache[1+i] = PR_AddString(svprogfuncs, localmodels[i], 0);
|
||||||
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,6 +798,12 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
SCR_BeginLoadingPlaque();
|
SCR_BeginLoadingPlaque();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (i=0 ; i<MAX_CLIENTS ; i++)
|
||||||
|
{
|
||||||
|
svs.clients[i].name = svs.clients[i].namebuf;
|
||||||
|
svs.clients[i].team = svs.clients[i].teambuf;
|
||||||
|
}
|
||||||
|
|
||||||
switch (svs.gametype)
|
switch (svs.gametype)
|
||||||
{
|
{
|
||||||
case GT_PROGS:
|
case GT_PROGS:
|
||||||
|
@ -820,6 +825,9 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
if (!svs.clients[i].state && svs.clients[i].name[0]) //this is a bot.
|
if (!svs.clients[i].state && svs.clients[i].name[0]) //this is a bot.
|
||||||
svs.clients[i].name[0] = '\0'; //make it go away
|
svs.clients[i].name[0] = '\0'; //make it go away
|
||||||
|
|
||||||
|
svs.clients[i].name = PR_AddString(svprogfuncs, svs.clients[i].namebuf, sizeof(svs.clients[i].namebuf));
|
||||||
|
svs.clients[i].team = PR_AddString(svprogfuncs, svs.clients[i].teambuf, sizeof(svs.clients[i].teambuf));
|
||||||
|
|
||||||
#ifdef PEXT_CSQC
|
#ifdef PEXT_CSQC
|
||||||
memset(svs.clients[i].csqcentsequence, 0, sizeof(svs.clients[i].csqcentsequence));
|
memset(svs.clients[i].csqcentsequence, 0, sizeof(svs.clients[i].csqcentsequence));
|
||||||
memset(svs.clients[i].csqcentversions, 0, sizeof(svs.clients[i].csqcentversions));
|
memset(svs.clients[i].csqcentversions, 0, sizeof(svs.clients[i].csqcentversions));
|
||||||
|
@ -846,6 +854,12 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i=0 ; i<MAX_CLIENTS ; i++)
|
||||||
|
{
|
||||||
|
Q_strncpyz(svs.clients[i].name, Info_ValueForKey(svs.clients[i].userinfo, "name"), sizeof(svs.clients[i].namebuf));
|
||||||
|
Q_strncpyz(svs.clients[i].team, Info_ValueForKey(svs.clients[i].userinfo, "team"), sizeof(svs.clients[i].teambuf));
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
current_loading_size+=10;
|
current_loading_size+=10;
|
||||||
SCR_BeginLoadingPlaque();
|
SCR_BeginLoadingPlaque();
|
||||||
|
@ -862,26 +876,24 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
if (svprogfuncs)
|
if (svprogfuncs)
|
||||||
{
|
{
|
||||||
extern cvar_t coop, pr_imitatemvdsv;
|
extern cvar_t coop, pr_imitatemvdsv;
|
||||||
char *s;
|
|
||||||
eval_t *eval;
|
eval_t *eval;
|
||||||
ent = EDICT_NUM(svprogfuncs, 0);
|
ent = EDICT_NUM(svprogfuncs, 0);
|
||||||
ent->isfree = false;
|
ent->isfree = false;
|
||||||
ent->v->model = PR_SetString(svprogfuncs, sv.worldmodel->name);
|
ent->v->model = PR_NewString(svprogfuncs, sv.worldmodel->name, 0);
|
||||||
ent->v->modelindex = 1; // world model
|
ent->v->modelindex = 1; // world model
|
||||||
ent->v->solid = SOLID_BSP;
|
ent->v->solid = SOLID_BSP;
|
||||||
ent->v->movetype = MOVETYPE_PUSH;
|
ent->v->movetype = MOVETYPE_PUSH;
|
||||||
|
|
||||||
if (progstype == PROG_QW && pr_imitatemvdsv.value>0)
|
if (progstype == PROG_QW && pr_imitatemvdsv.value>0)
|
||||||
{
|
{
|
||||||
ent->v->targetname = PR_SetString(svprogfuncs, "mvdsv");
|
ent->v->targetname = PR_NewString(svprogfuncs, "mvdsv", 0);
|
||||||
s = DISTRIBUTIONLONG;
|
ent->v->netname = PR_NewString(svprogfuncs, va("%s %f %s, build %d\nBuild date: " __DATE__ ", " __TIME__ "", DISTRIBUTIONLONG, VERSION, PLATFORM, build_number()), 0);
|
||||||
ent->v->netname = PR_NewString(svprogfuncs, va("%s %f %s, build %d\nBuild date: " __DATE__ ", " __TIME__ "", DISTRIBUTIONLONG, VERSION, PLATFORM, build_number()));
|
|
||||||
ent->v->impulse = 0;//QWE_VERNUM;
|
ent->v->impulse = 0;//QWE_VERNUM;
|
||||||
ent->v->items = 103;
|
ent->v->items = 103;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pr_global_struct->mapname = PR_SetString(svprogfuncs, sv.name);
|
pr_global_struct->mapname = PR_NewString(svprogfuncs, sv.name, 0);
|
||||||
// serverflags are for cross level information (sigils)
|
// serverflags are for cross level information (sigils)
|
||||||
pr_global_struct->serverflags = svs.serverflags;
|
pr_global_struct->serverflags = svs.serverflags;
|
||||||
pr_global_struct->time = 0.1; //HACK!!!! A few QuakeC mods expect time to be non-zero in spawn funcs - like prydon gate...
|
pr_global_struct->time = 0.1; //HACK!!!! A few QuakeC mods expect time to be non-zero in spawn funcs - like prydon gate...
|
||||||
|
@ -911,7 +923,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
else if (pr_nqglobal_struct->deathmatch)
|
else if (pr_nqglobal_struct->deathmatch)
|
||||||
pr_global_struct->deathmatch = deathmatch.value;
|
pr_global_struct->deathmatch = deathmatch.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progstype == PROG_QW)
|
if (progstype == PROG_QW)
|
||||||
// run the frame start qc function to let progs check cvars
|
// run the frame start qc function to let progs check cvars
|
||||||
SV_ProgStartFrame (); //prydon gate seems to fail because of this allowance
|
SV_ProgStartFrame (); //prydon gate seems to fail because of this allowance
|
||||||
|
@ -1077,7 +1089,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
{
|
{
|
||||||
eval_t *eval;
|
eval_t *eval;
|
||||||
eval = PR_FindGlobal(svprogfuncs, "startspot", 0);
|
eval = PR_FindGlobal(svprogfuncs, "startspot", 0);
|
||||||
if (eval) eval->string = PR_NewString(svprogfuncs, startspot);
|
if (eval) eval->string = PR_NewString(svprogfuncs, startspot, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cmd_AliasExist("f_svnewmap", RESTRICT_LOCAL))
|
if (Cmd_AliasExist("f_svnewmap", RESTRICT_LOCAL))
|
||||||
|
|
|
@ -1496,7 +1496,14 @@ void SVC_DirectConnect
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
*newcl = temp;
|
{
|
||||||
|
char *n, *t;
|
||||||
|
n = newcl->name;
|
||||||
|
t = newcl->team;
|
||||||
|
*newcl = temp;
|
||||||
|
newcl->name = n;
|
||||||
|
newcl->team = t;
|
||||||
|
}
|
||||||
|
|
||||||
newcl->zquake_extensions = atoi(Info_ValueForKey(newcl->userinfo, "*z_ext"));
|
newcl->zquake_extensions = atoi(Info_ValueForKey(newcl->userinfo, "*z_ext"));
|
||||||
|
|
||||||
|
@ -2918,6 +2925,7 @@ void SV_InitLocal (void)
|
||||||
extern cvar_t pm_slidefix;
|
extern cvar_t pm_slidefix;
|
||||||
extern cvar_t pm_airstep;
|
extern cvar_t pm_airstep;
|
||||||
extern cvar_t pm_walljump;
|
extern cvar_t pm_walljump;
|
||||||
|
extern cvar_t pm_slidyslopes;
|
||||||
|
|
||||||
SV_InitOperatorCommands ();
|
SV_InitOperatorCommands ();
|
||||||
SV_UserInit ();
|
SV_UserInit ();
|
||||||
|
@ -2980,6 +2988,7 @@ void SV_InitLocal (void)
|
||||||
Cvar_Register (&pm_bunnyspeedcap, cvargroup_serverphysics);
|
Cvar_Register (&pm_bunnyspeedcap, cvargroup_serverphysics);
|
||||||
Cvar_Register (&pm_ktjump, cvargroup_serverphysics);
|
Cvar_Register (&pm_ktjump, cvargroup_serverphysics);
|
||||||
Cvar_Register (&pm_slidefix, cvargroup_serverphysics);
|
Cvar_Register (&pm_slidefix, cvargroup_serverphysics);
|
||||||
|
Cvar_Register (&pm_slidyslopes, cvargroup_serverphysics);
|
||||||
Cvar_Register (&pm_airstep, cvargroup_serverphysics);
|
Cvar_Register (&pm_airstep, cvargroup_serverphysics);
|
||||||
Cvar_Register (&pm_walljump, cvargroup_serverphysics);
|
Cvar_Register (&pm_walljump, cvargroup_serverphysics);
|
||||||
|
|
||||||
|
@ -3327,7 +3336,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
|
|
||||||
val = Info_ValueForKey (cl->userinfo, "team");
|
val = Info_ValueForKey (cl->userinfo, "team");
|
||||||
val[40] = 0; //trim to smallish length now (to allow for adding more.
|
val[40] = 0; //trim to smallish length now (to allow for adding more.
|
||||||
Q_strncpyz (cl->team, val, sizeof(cl->team));
|
Q_strncpyz (cl->team, val, sizeof(cl->teambuf));
|
||||||
|
|
||||||
// name for C code
|
// name for C code
|
||||||
val = Info_ValueForKey (cl->userinfo, "name");
|
val = Info_ValueForKey (cl->userinfo, "name");
|
||||||
|
@ -3351,8 +3360,8 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i != MAX_CLIENTS) { // dup name
|
if (i != MAX_CLIENTS) { // dup name
|
||||||
if (strlen(newname) > sizeof(cl->name) - 1)
|
if (strlen(newname) > sizeof(cl->namebuf) - 1)
|
||||||
newname[sizeof(cl->name) - 4] = 0;
|
newname[sizeof(cl->namebuf) - 4] = 0;
|
||||||
p = newname;
|
p = newname;
|
||||||
|
|
||||||
if (newname[0] == '(')
|
if (newname[0] == '(')
|
||||||
|
@ -3370,7 +3379,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(newname, cl->name, sizeof(cl->name)-1))
|
if (strncmp(newname, cl->name, sizeof(cl->namebuf)-1))
|
||||||
{
|
{
|
||||||
if (cl->ismuted)
|
if (cl->ismuted)
|
||||||
SV_ClientTPrintf (cl, PRINT_HIGH, STL_NONAMEASMUTE);
|
SV_ClientTPrintf (cl, PRINT_HIGH, STL_NONAMEASMUTE);
|
||||||
|
@ -3394,7 +3403,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
{
|
{
|
||||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTNAMECHANGE, cl->name, val);
|
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTNAMECHANGE, cl->name, val);
|
||||||
}
|
}
|
||||||
Q_strncpyz (cl->name, newname, sizeof(cl->name));
|
Q_strncpyz (cl->name, newname, sizeof(cl->namebuf));
|
||||||
|
|
||||||
|
|
||||||
#ifdef SVRANKING
|
#ifdef SVRANKING
|
||||||
|
|
|
@ -56,6 +56,7 @@ cvar_t sv_waterfriction = { "sv_waterfriction", "4"};
|
||||||
cvar_t pm_ktjump = {"pm_ktjump", "", NULL, CVAR_SERVERINFO};
|
cvar_t pm_ktjump = {"pm_ktjump", "", NULL, CVAR_SERVERINFO};
|
||||||
cvar_t pm_bunnyspeedcap = {"pm_bunnyspeedcap", "", NULL, CVAR_SERVERINFO};
|
cvar_t pm_bunnyspeedcap = {"pm_bunnyspeedcap", "", NULL, CVAR_SERVERINFO};
|
||||||
cvar_t pm_slidefix = {"pm_slidefix", "", NULL, CVAR_SERVERINFO};
|
cvar_t pm_slidefix = {"pm_slidefix", "", NULL, CVAR_SERVERINFO};
|
||||||
|
cvar_t pm_slidyslopes = {"pm_slidyslopes", "", NULL, CVAR_SERVERINFO};
|
||||||
cvar_t pm_airstep = {"pm_airstep", "", NULL, CVAR_SERVERINFO};
|
cvar_t pm_airstep = {"pm_airstep", "", NULL, CVAR_SERVERINFO};
|
||||||
cvar_t pm_walljump = {"pm_walljump", "", NULL, CVAR_SERVERINFO};
|
cvar_t pm_walljump = {"pm_walljump", "", NULL, CVAR_SERVERINFO};
|
||||||
|
|
||||||
|
@ -1738,24 +1739,24 @@ void SV_Physics_Client (edict_t *ent, int num)
|
||||||
if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) )
|
if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) )
|
||||||
SV_AddGravity (ent, ent->v->gravity);
|
SV_AddGravity (ent, ent->v->gravity);
|
||||||
|
|
||||||
if (fabs(oldvel - ent->v->velocity[0])> 100)
|
// if (fabs(oldvel - ent->v->velocity[0])> 100)
|
||||||
Con_Printf("grav: %f -> %f\n", oldvel, ent->v->velocity[0]);
|
// Con_Printf("grav: %f -> %f\n", oldvel, ent->v->velocity[0]);
|
||||||
|
|
||||||
if (SV_TestEntityPosition(ent))
|
// if (SV_TestEntityPosition(ent))
|
||||||
Con_Printf("Player starts stuck\n");
|
// Con_Printf("Player starts stuck\n");
|
||||||
|
|
||||||
SV_CheckStuck (ent);
|
SV_CheckStuck (ent);
|
||||||
|
|
||||||
if (SV_TestEntityPosition(ent))
|
// if (SV_TestEntityPosition(ent))
|
||||||
Con_Printf("becomes stuck\n");
|
// Con_Printf("becomes stuck\n");
|
||||||
|
|
||||||
SV_WalkMove (ent);
|
SV_WalkMove (ent);
|
||||||
|
|
||||||
if (SV_TestEntityPosition(ent))
|
// if (SV_TestEntityPosition(ent))
|
||||||
Con_Printf("Player ends stuck\n");
|
// Con_Printf("Player ends stuck\n");
|
||||||
|
|
||||||
if (fabs(oldvel - ent->v->velocity[0])> 100)
|
// if (fabs(oldvel - ent->v->velocity[0])> 100)
|
||||||
Con_Printf("walk: %f -> %f\n", oldvel, ent->v->velocity[0]);
|
// Con_Printf("walk: %f -> %f\n", oldvel, ent->v->velocity[0]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1379,7 +1379,7 @@ void SV_UpdateToReliableMessages (void)
|
||||||
{
|
{
|
||||||
if (host_client->state != cs_spawned)
|
if (host_client->state != cs_spawned)
|
||||||
{
|
{
|
||||||
if (!host_client->state && host_client->name[0]) //if this is a bot
|
if (!host_client->state && host_client->name && host_client->name[0]) //if this is a bot
|
||||||
{
|
{
|
||||||
if (host_client->old_frags != (int)host_client->edict->v->frags)
|
if (host_client->old_frags != (int)host_client->edict->v->frags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ cvar_t pr_allowbutton1 = {"pr_allowbutton1", "1", NULL, CVAR_LATCH};
|
||||||
extern cvar_t pm_bunnyspeedcap;
|
extern cvar_t pm_bunnyspeedcap;
|
||||||
extern cvar_t pm_ktjump;
|
extern cvar_t pm_ktjump;
|
||||||
extern cvar_t pm_slidefix;
|
extern cvar_t pm_slidefix;
|
||||||
|
extern cvar_t pm_slidyslopes;
|
||||||
extern cvar_t pm_airstep;
|
extern cvar_t pm_airstep;
|
||||||
extern cvar_t pm_walljump;
|
extern cvar_t pm_walljump;
|
||||||
|
|
||||||
|
@ -778,11 +779,11 @@ void SV_Modellist_f (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 1+n;
|
for (i = 1+n;
|
||||||
*sv.model_precache[i] && (((n&255)==0)||(host_client->netchan.message.cursize < (MAX_QWMSGLEN/2))); //make sure we don't send a 0 next...
|
sv.model_precache[i] && (((n&255)==0)||(host_client->netchan.message.cursize < (MAX_QWMSGLEN/2))); //make sure we don't send a 0 next...
|
||||||
i++, n++)
|
i++, n++)
|
||||||
MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]);
|
MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]);
|
||||||
|
|
||||||
if (!*sv.model_precache[i])
|
if (!sv.model_precache[i])
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3038,7 +3039,7 @@ void SVNQ_Spawn_f (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset (&ent->v, 0, pr_edict_size-svprogparms.edictsize);
|
memset (ent->v, 0, pr_edict_size);
|
||||||
ED_Spawned(ent);
|
ED_Spawned(ent);
|
||||||
|
|
||||||
ent->v->colormap = NUM_FOR_EDICT(svprogfuncs, ent);
|
ent->v->colormap = NUM_FOR_EDICT(svprogfuncs, ent);
|
||||||
|
@ -3803,6 +3804,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
|
||||||
movevars.slidefix = (pm_slidefix.value != 0);
|
movevars.slidefix = (pm_slidefix.value != 0);
|
||||||
movevars.airstep = (pm_airstep.value != 0);
|
movevars.airstep = (pm_airstep.value != 0);
|
||||||
movevars.walljump = (pm_walljump.value);
|
movevars.walljump = (pm_walljump.value);
|
||||||
|
movevars.slidyslopes = (pm_slidyslopes.value!=0);
|
||||||
|
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
{
|
{
|
||||||
|
@ -3956,6 +3958,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
|
||||||
movevars.slidefix = (pm_slidefix.value != 0);
|
movevars.slidefix = (pm_slidefix.value != 0);
|
||||||
movevars.airstep = (pm_airstep.value != 0);
|
movevars.airstep = (pm_airstep.value != 0);
|
||||||
movevars.walljump = (pm_walljump.value);
|
movevars.walljump = (pm_walljump.value);
|
||||||
|
movevars.slidyslopes = (pm_slidyslopes.value!=0);
|
||||||
|
|
||||||
if (sv_player->v->hasted)
|
if (sv_player->v->hasted)
|
||||||
movevars.maxspeed*=sv_player->v->hasted;
|
movevars.maxspeed*=sv_player->v->hasted;
|
||||||
|
|
Loading…
Reference in a new issue