tweaks for ktx/nq clients.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4913 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-06-20 14:22:06 +00:00
parent 2f4f8d2878
commit 06e26d3808
8 changed files with 63 additions and 35 deletions

View file

@ -264,7 +264,7 @@ void CDAudio_Stop(void)
dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD_PTR)NULL);
if (dwReturn)
Con_DPrintf("MCI_STOP failed (%i)", (int)dwReturn);
Con_DPrintf("MCI_STOP failed (%i)\n", (int)dwReturn);
}
@ -279,7 +279,7 @@ void CDAudio_Pause(void)
mciGenericParms.dwCallback = (DWORD_PTR)mainwindow;
dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD_PTR)(LPVOID) &mciGenericParms);
if (dwReturn)
Con_DPrintf("MCI_PAUSE failed (%i)", (int)dwReturn);
Con_DPrintf("MCI_PAUSE failed (%i)\n", (int)dwReturn);
pollneeded = false;
}

View file

@ -1879,8 +1879,7 @@ qboolean PR_UserCmd(char *s)
{
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
Q1QVM_ClientCommand();
return true; //qvm can print something if it wants
return Q1QVM_ClientCommand();
}
#endif
@ -9973,8 +9972,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
// {"log", PF_Fixme, 0, 0, 0, 532, "float(string mname)", true},
{"getsoundtime", PF_Ignore, 0, 0, 0, 533, "float(entity e, float channel)"},
{"soundlength", PF_Ignore, 0, 0, 0, 534, "float(string sample)"},
{"buf_loadfile", PF_buf_loadfile, 0, 0, 0, 535, "float(string filename, strbuf bufhandle)"},
{"buf_writefile", PF_buf_writefile, 0, 0, 0, 536, "float(filestream filehandle, strbuf bufhandle, optional float startpos, optional float numstrings)"},
{"buf_loadfile", PF_buf_loadfile, 0, 0, 0, 535, D("float(string filename, strbuf bufhandle)", "Appends the named file into a string buffer (which must have been created in advance). The return value merely says whether the file was readable.")},
{"buf_writefile", PF_buf_writefile, 0, 0, 0, 536, D("float(filestream filehandle, strbuf bufhandle, optional float startpos, optional float numstrings)", "Writes the contents of a string buffer onto the end of the supplied filehandle (you must have already used fopen). Additional optional arguments permit you to constrain the writes to a subsection of the stringbuffer.")},
// {"bufstr_find", PF_Fixme, 0, 0, 0, 537, "float(float bufhandle, string match, float matchrule, float startpos)"},
// {"matchpattern", PF_Fixme, 0, 0, 0, 538, "float(string s, string pattern, float matchrule)"},
// {"undefined", PF_Fixme, 0, 0, 0, 539, ""},

View file

@ -395,7 +395,7 @@ static edict_t *QDECL Q1QVMPF_ProgsToEdict(pubprogfuncs_t *pf, int num)
return Q1QVMPF_EdictNum(pf, num);
}
void Q1QVMED_ClearEdict (edict_t *e, qboolean wipe)
static void Q1QVMED_ClearEdict (edict_t *e, qboolean wipe)
{
int num = e->entnum;
if (wipe)
@ -403,6 +403,10 @@ void Q1QVMED_ClearEdict (edict_t *e, qboolean wipe)
e->isfree = false;
e->entnum = num;
}
static void Q1QVMPF_ClearEdict(pubprogfuncs_t *pf, edict_t *e)
{
Q1QVMED_ClearEdict(e, true);
}
static void QDECL Q1QVMPF_EntRemove(pubprogfuncs_t *pf, edict_t *e)
{
@ -1211,10 +1215,18 @@ Con_DPrintf("PF_readcmd: %s\n%s", s, output);
{
char *dst = VM_POINTER(arg[0]);
char *src = VM_POINTER(arg[1]);
if (VM_OOB(arg[0], arg[2]))
if (VM_OOB(arg[0], arg[2]) || VM_LONG(arg[2]) < 1)
return -1;
Q_strncpyz(dst, src, VM_LONG(arg[2]));
//WARNING: no return value
else if (!src)
{
*dst = 0;
return 0;
}
else
{
Q_strncpyz(dst, src, VM_LONG(arg[2]));
return strlen(src);
}
}
break;
case G_strlcat:
@ -1404,6 +1416,7 @@ qboolean PR_LoadQ1QVM(void)
q1qvmprogfuncs.StringToProgs = Q1QVMPF_StringToProgs;
q1qvmprogfuncs.StringToNative = Q1QVMPF_StringToNative;
q1qvmprogfuncs.SetStringField = Q1QVMPF_SetStringField;
q1qvmprogfuncs.EntClear = Q1QVMPF_ClearEdict;
sv.world.Event_Touch = Q1QVM_Event_Touch;
sv.world.Event_Think = Q1QVM_Event_Think;
@ -1653,9 +1666,9 @@ void Q1QVM_SetChangeParms(void)
VM_Call(q1qvm, GAME_SETCHANGEPARMS, 0, 0, 0);
}
void Q1QVM_ClientCommand(void)
qboolean Q1QVM_ClientCommand(void)
{
VM_Call(q1qvm, GAME_CLIENT_COMMAND, 0, 0, 0);
return VM_Call(q1qvm, GAME_CLIENT_COMMAND, 0, 0, 0);
}
void Q1QVM_GameCodePausedTic(float pausedduration)

View file

@ -141,11 +141,10 @@ void Q1QVM_StartFrame(void);
void Q1QVM_Blocked(void);
void Q1QVM_SetNewParms(void);
void Q1QVM_SetChangeParms(void);
void Q1QVM_ClientCommand(void);
qboolean Q1QVM_ClientCommand(void);
void Q1QVM_GameCodePausedTic(float pausedduration);
void Q1QVM_DropClient(struct client_s *cl);
void Q1QVM_ChainMoved(void);
void Q1QVM_EndFrame(void);
void Q1QVMED_ClearEdict (edict_t *e, qboolean wipe);
#endif

View file

@ -3349,10 +3349,13 @@ qboolean SVNQ_ConnectionlessPacket(void)
sb.data = buffer;
/*ack it, so dumb proquake clones can actually send the proper packet*/
SZ_Clear(&sb);
MSG_WriteLong(&sb, BigLong(NETFLAG_ACK | 8));
MSG_WriteLong(&sb, sequence);
NET_SendPacket(NS_SERVER, sb.cursize, sb.data, &net_from);
if (!sequence)
{
SZ_Clear(&sb);
MSG_WriteLong(&sb, BigLong(NETFLAG_ACK | 8));
MSG_WriteLong(&sb, sequence);
NET_SendPacket(NS_SERVER, sb.cursize, sb.data, &net_from);
}
/*resend the cmd request, cos if they didn't send it then it must have gotten dropped.
@ -3360,8 +3363,8 @@ qboolean SVNQ_ConnectionlessPacket(void)
a vanilla client will not start spamming nops until it has received the server info, so its only the proquake clients+clones that will send a nop before a challengeconnect
unfortunatly we don't know the modver+flags+password any more. I hope its not needed. if it does, server admins will be forced to use sv_listen_nq 1 instead of 2*/
SZ_Clear(&sb);
MSG_WriteLong(&sb, 0);
MSG_WriteLong(&sb, 0);
MSG_WriteLong(&sb, BigLong(0));
MSG_WriteLong(&sb, BigLong(1)); //sequence 1, because 0 matches the old sequence, and thus might get dropped. hopefully the client will cope with dupes properly and ignore any regular (but unreliable) stuff.
MSG_WriteByte(&sb, svc_stufftext);
MSG_WriteString(&sb, va("cmd challengeconnect %i %i\n", SV_NewChallenge(), 1/*MOD_PROQUAKE*/));
@ -3445,8 +3448,8 @@ qboolean SVNQ_ConnectionlessPacket(void)
SZ_Clear(&sb);
MSG_WriteLong(&sb, 0);
MSG_WriteLong(&sb, 0);
MSG_WriteLong(&sb, BigLong(0));
MSG_WriteLong(&sb, BigLong(1)); //sequence 1, because 0 matches the old sequence, and thus might get dropped. hopefully the client will cope with dupes properly and ignore any regular (but unreliable) stuff.
MSG_WriteByte(&sb, svc_stufftext);
MSG_WriteString(&sb, va("cmd challengeconnect %i %i %i %i %i\n", SV_NewChallenge(), mod, modver, flags, passwd));

View file

@ -1777,8 +1777,8 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest)
demo.recorder.prespawn_stage++;//client won't reply, so don't wait.
demo.recorder.prespawn_idx = 0;
}
if (demo.recorder.prespawn_stage == PRESPAWN_SOUNDLIST || demo.recorder.prespawn_stage == PRESPAWN_MODELLIST)
demo.recorder.prespawn_idx &= ~0x80000000; //normally set for the server to wait for ack. we don't want to wait.
demo.recorder.prespawn_allow_soundlist = true; //normally set for the server to wait for ack. we don't want to wait.
demo.recorder.prespawn_allow_modellist = true; //normally set for the server to wait for ack. we don't want to wait.
SV_SendClientPrespawnInfo(&demo.recorder);
SV_WriteRecordMVDMessage (&demo.recorder.netchan.message);

View file

@ -4457,7 +4457,8 @@ void SV_SetUpClientEdict (client_t *cl, edict_t *ent)
{
string_t preserve;
preserve = ent->v->netname;
Q1QVMED_ClearEdict(ent, true);
if (progstype != PROG_NQ) //allow frikbots to work in NQ mods (but not qw!)
ED_Clear(svprogfuncs, ent);
ent->v->netname = preserve;
}
else
@ -5002,17 +5003,24 @@ void SVNQ_Begin_f (void)
*pr_global_ptrs->spawnparamglobals[i] = host_client->spawn_parms[i];
}
// call the spawn function
sv.skipbprintclient = host_client;
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->ClientConnect);
sv.skipbprintclient = NULL;
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
Q1QVM_ClientConnect(host_client);
else
#endif
{
// call the spawn function
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->ClientConnect);
sv.skipbprintclient = NULL;
// actually spawn the player
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PutClientInServer);
// actually spawn the player
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PutClientInServer);
}
}
}
@ -5066,6 +5074,12 @@ void SVNQ_Begin_f (void)
host_client->send_message = true;
SV_PreRunCmd();
host_client->lastcmd.msec = 0;
SV_RunCmd (&host_client->lastcmd, false);
SV_PostRunCmd();
}
void SVNQ_PreSpawn_f (void)
{

View file

@ -25,7 +25,7 @@ void main ()
nst = (1.0 + nst) / 2.0;
vec4 l = texture2D(s_t0, nst)*5.0;
vec4 c = texture2D(s_t1, tc);
vec3 lmsamp = texture2D(s_t2, lm).rgb*e_lmscale;
vec3 lmsamp = texture2D(s_t2, lm).rgb*e_lmscale.rgb;
vec3 diff = l.rgb;
vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11)));
vec3 spec = chrom * l.a;