mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Fix some misc csqc issues.
This commit is contained in:
parent
ededc1a2eb
commit
66abf5a378
8 changed files with 76 additions and 12 deletions
|
@ -1166,7 +1166,10 @@ void SCR_UpdateScreen (void)
|
|||
G_FLOAT(OFS_PARM0) = glwidth/s;
|
||||
G_FLOAT(OFS_PARM1) = glheight/s;
|
||||
G_FLOAT(OFS_PARM2) = true;
|
||||
PR_ExecuteProgram(cl.qcvm.extfuncs.CSQC_UpdateView);
|
||||
if (cls.signon == SIGNONS||!cl.qcvm.extfuncs.CSQC_UpdateViewLoading)
|
||||
PR_ExecuteProgram(cl.qcvm.extfuncs.CSQC_UpdateView);
|
||||
else
|
||||
PR_ExecuteProgram(cl.qcvm.extfuncs.CSQC_UpdateViewLoading);
|
||||
PR_SwitchQCVM(NULL);
|
||||
|
||||
GL_Set2D ();
|
||||
|
|
|
@ -818,6 +818,7 @@ static void CL_LoadCSProgs(void)
|
|||
|
||||
//set a few worldspawn fields too
|
||||
qcvm->edicts->v.solid = SOLID_BSP;
|
||||
qcvm->edicts->v.movetype = MOVETYPE_PUSH;
|
||||
qcvm->edicts->v.modelindex = 1;
|
||||
qcvm->edicts->v.model = PR_SetEngineString(cl.worldmodel->name);
|
||||
VectorCopy(cl.worldmodel->mins, qcvm->edicts->v.mins);
|
||||
|
@ -836,6 +837,7 @@ static void CL_LoadCSProgs(void)
|
|||
G_FLOAT(OFS_PARM2) = 10000*maj + 100*(min) + QUAKESPASM_VER_PATCH;
|
||||
PR_ExecuteProgram(qcvm->extfuncs.CSQC_Init);
|
||||
}
|
||||
qcvm->worldlocked = true;
|
||||
|
||||
if (fullcsqc)
|
||||
{
|
||||
|
|
|
@ -1896,6 +1896,7 @@ static void PF_cl_sound (void)
|
|||
int volume;
|
||||
float attenuation;
|
||||
int entnum;
|
||||
vec3_t origin;
|
||||
|
||||
entity = G_EDICT(OFS_PARM0);
|
||||
channel = G_FLOAT(OFS_PARM1);
|
||||
|
@ -1907,7 +1908,11 @@ static void PF_cl_sound (void)
|
|||
//fullcsqc fixme: if (entity->v->entnum)
|
||||
entnum *= -1;
|
||||
|
||||
S_StartSound(entnum, channel, S_PrecacheSound(sample), entity->v.origin, volume, attenuation);
|
||||
//fix up origin like the ssqc's would.
|
||||
VectorAdd(entity->v.mins, entity->v.maxs, origin);
|
||||
VectorMA(entity->v.origin, 0.5,origin, origin);
|
||||
|
||||
S_StartSound(entnum, channel, S_PrecacheSound(sample), origin, volume, attenuation);
|
||||
}
|
||||
static void PF_cl_ambientsound (void)
|
||||
{
|
||||
|
|
|
@ -549,7 +549,7 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // Make sure it's in range
|
||||
#endif
|
||||
if (ed == (edict_t *)qcvm->edicts && sv.state == ss_active)
|
||||
if (ed == (edict_t *)qcvm->edicts && qcvm->worldlocked)
|
||||
{
|
||||
qcvm->xstatement = st - qcvm->statements;
|
||||
PR_RunError("assignment to world entity");
|
||||
|
|
|
@ -2386,6 +2386,26 @@ static void PF_sv_te_lightningblood(void)
|
|||
float count = 225;
|
||||
SV_StartParticle (org, dir, color, count);
|
||||
}
|
||||
static void PF_sv_te_muzzleflash(void)
|
||||
{
|
||||
edict_t *ent = G_EDICT(OFS_PARM0);
|
||||
ent->v.effects = (int)ent->v.effects|EF_MUZZLEFLASH;
|
||||
}
|
||||
static void PF_cl_te_muzzleflash(void)
|
||||
{
|
||||
edict_t *ent = G_EDICT(OFS_PARM0);
|
||||
vec3_t fv, rv, uv;
|
||||
|
||||
dlight_t *dl = CL_AllocDlight (-NUM_FOR_EDICT(ent));
|
||||
VectorCopy (ent->v.origin, dl->origin);
|
||||
dl->origin[2] += 16;
|
||||
AngleVectors (ent->v.angles, fv, rv, uv);
|
||||
|
||||
VectorMA (dl->origin, 18, fv, dl->origin);
|
||||
dl->radius = 200 + (rand()&31);
|
||||
dl->minlight = 32;
|
||||
dl->die = cl.time + 0.1;
|
||||
}
|
||||
static void PF_sv_te_spike(void)
|
||||
{
|
||||
float *org = G_VECTOR(OFS_PARM0);
|
||||
|
@ -4847,11 +4867,9 @@ static void PF_cl_pointparticles(void)
|
|||
float *vel = (qcvm->argc < 3)?vec3_origin:G_VECTOR(OFS_PARM2);
|
||||
int count = (qcvm->argc < 4)?1:G_FLOAT(OFS_PARM3);
|
||||
|
||||
if (efnum <= 0)
|
||||
return;
|
||||
if (count < 1)
|
||||
return;
|
||||
efnum = PF_CL_GetParticle(efnum);
|
||||
if (count <= 0)
|
||||
return;
|
||||
PScript_RunParticleEffectState (org, vel, count, efnum, NULL);
|
||||
}
|
||||
#else
|
||||
|
@ -5992,11 +6010,31 @@ static void PF_cs_getentitytoken(void)
|
|||
|
||||
if (csqcmapentitydata)
|
||||
{
|
||||
csqcmapentitydata = COM_Parse(csqcmapentitydata);
|
||||
csqcmapentitydata = COM_Parse(csqcmapentitydata);
|
||||
if (!csqcmapentitydata)
|
||||
G_INT(OFS_RETURN) = 0;
|
||||
else
|
||||
G_INT(OFS_RETURN) = PR_MakeTempString(com_token);
|
||||
{
|
||||
//Match the flawed logic inside ED_NewString... mostly, stoopid length limits.
|
||||
char *string = com_token, *tmp = PR_GetTempString(), *new_p = tmp;
|
||||
int i, l = strlen(com_token);
|
||||
|
||||
for (i = 0; i < l && new_p-tmp < STRINGTEMP_LENGTH-1; i++)
|
||||
{
|
||||
if (string[i] == '\\' && i < l-1)
|
||||
{
|
||||
i++;
|
||||
if (string[i] == 'n')
|
||||
*new_p++ = '\n';
|
||||
else
|
||||
*new_p++ = '\\';
|
||||
}
|
||||
else
|
||||
*new_p++ = string[i];
|
||||
}
|
||||
*new_p = 0;
|
||||
G_INT(OFS_RETURN) = PR_SetEngineString(tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
G_INT(OFS_RETURN) = 0;
|
||||
|
@ -6235,8 +6273,8 @@ static void PF_cs_addlight(void)
|
|||
VectorCopy (org, dl->origin);
|
||||
dl->radius = radius;
|
||||
dl->minlight = 32;
|
||||
dl->die = 0;
|
||||
dl->decay = 0;
|
||||
dl->die = cl.time+1;
|
||||
dl->decay = -1; //die at end of frame.
|
||||
}
|
||||
static struct
|
||||
{
|
||||
|
@ -6255,6 +6293,9 @@ static struct
|
|||
void V_CalcRefdef (void);
|
||||
static void PF_cl_clearscene(void)
|
||||
{
|
||||
int i;
|
||||
dlight_t *dl;
|
||||
|
||||
if (cl_numvisedicts + 64 > cl_maxvisedicts)
|
||||
{
|
||||
cl_maxvisedicts = cl_maxvisedicts+64;
|
||||
|
@ -6264,6 +6305,14 @@ static void PF_cl_clearscene(void)
|
|||
|
||||
num_temp_entities = 0;
|
||||
|
||||
//clear any temp dlights too.
|
||||
dl = cl_dlights;
|
||||
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
|
||||
{
|
||||
if (dl->decay == -1)
|
||||
dl->radius = 0;
|
||||
}
|
||||
|
||||
memset(&viewprops, 0, sizeof(viewprops));
|
||||
viewprops.rect_size[0] = vid.width;
|
||||
viewprops.rect_size[1] = vid.height;
|
||||
|
@ -7270,7 +7319,7 @@ static struct
|
|||
// {"skinforname", PF_skinforname, PF_skinforname, 237, "float(float mdlindex, string skinname)"}, // #237
|
||||
// {"shaderforname", PF_Fixme, PF_Fixme, 238, PF_NoMenu, D("float(string shadername, optional string defaultshader, ...)", "Caches the named shader and returns a handle to it.\nIf the shader could not be loaded from disk (missing file or ruleset_allow_shaders 0), it will be created from the 'defaultshader' string if specified, or a 'skin shader' default will be used.\ndefaultshader if not empty should include the outer {} that you would ordinarily find in a shader.")},
|
||||
{"te_bloodqw", PF_sv_te_bloodqw, NULL, 239, PF_NoMenu, "void(vector org, float count)"},
|
||||
// {"te_muzzleflash", PF_te_muzzleflash, PF_clte_muzzleflash,0, PF_NoMenu, "void(entity ent)"},
|
||||
{"te_muzzleflash", PF_sv_te_muzzleflash,PF_cl_te_muzzleflash,0, PF_NoMenu, "void(entity ent)"},
|
||||
{"checkpvs", PF_checkpvs, PF_checkpvs, 240, PF_NoMenu, "float(vector viewpos, entity entity)"},
|
||||
// {"matchclientname", PF_matchclient, PF_NoCSQC, 241, PF_NoMenu, "entity(string match, optional float matchnum)"},
|
||||
// {"sendpacket", PF_SendPacket, PF_SendPacket, 242, PF_NoMenu, "void(string destaddress, string content)"},// (FTE_QC_SENDPACKET)
|
||||
|
|
|
@ -185,6 +185,7 @@ struct pr_extfuncs_s
|
|||
QCEXTFUNC(CSQC_Parse_Event, "void()") \
|
||||
QCEXTFUNC(CSQC_Parse_Damage, "float(float save, float take, vector dir)") \
|
||||
QCEXTFUNC(CSQC_UpdateView, "void(float vwidth, float vheight, float notmenu)") /*full only: for the full csqc-draws-entire-screen interface*/ \
|
||||
QCEXTFUNC(CSQC_UpdateViewLoading, "void(float vwidth, float vheight, float notmenu)") /*full only: for the full csqc-draws-entire-screen interface*/ \
|
||||
QCEXTFUNC(CSQC_Input_Frame, "void()") /*full only: input angles stuff.*/ \
|
||||
QCEXTFUNC(CSQC_Parse_CenterPrint, "float(string msg)") \
|
||||
QCEXTFUNC(CSQC_Parse_Print, "void(string printmsg, float printlvl)") \
|
||||
|
@ -410,6 +411,7 @@ struct qcvm_s
|
|||
int reserved_edicts;
|
||||
int max_edicts;
|
||||
edict_t *edicts; // can NOT be array indexed, because edict_t is variable sized, but can be used to reference the world ent
|
||||
qboolean worldlocked;
|
||||
struct qmodel_s *worldmodel;
|
||||
struct qmodel_s *(*GetModel)(int modelindex); //returns the model for the given index, or null.
|
||||
|
||||
|
|
|
@ -3683,6 +3683,7 @@ void SV_SpawnServer (const char *server)
|
|||
|
||||
// all setup is completed, any further precache statements are errors
|
||||
sv.state = ss_active;
|
||||
qcvm->worldlocked = true;
|
||||
|
||||
// run two frames to allow everything to settle
|
||||
host_frametime = 0.1;
|
||||
|
|
|
@ -1545,6 +1545,8 @@ void SV_Physics (double frametime)
|
|||
else
|
||||
physics_mode = (qcvm==&cl.qcvm)?0:2; //csqc doesn't run thinks by default. it was meant to simplify implementations, but we just force fields to match ssqc so its not that large a burden.
|
||||
|
||||
if (frametime < 0)
|
||||
frametime = 0; //no, just no. stoopid float precision.
|
||||
pr_global_struct->time = qcvm->time;
|
||||
pr_global_struct->frametime = qcvm->frametime = frametime;
|
||||
|
||||
|
|
Loading…
Reference in a new issue