misc cleanup, computed goto for interpreter when available
parent
49b23bd290
commit
6eb2ea7586
|
@ -5,6 +5,8 @@ cmake_policy(SET CMP0071 NEW)
|
||||||
|
|
||||||
project(agw-quake C)
|
project(agw-quake C)
|
||||||
|
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
@ -19,6 +21,18 @@ pkg_check_modules(Opus IMPORTED_TARGET opus>=1.3.1
|
||||||
ogg>=1.3.4)
|
ogg>=1.3.4)
|
||||||
pkg_check_modules(MikMod IMPORTED_TARGET libmikmod>=3.3.11)
|
pkg_check_modules(MikMod IMPORTED_TARGET libmikmod>=3.3.11)
|
||||||
|
|
||||||
|
check_c_source_compiles(
|
||||||
|
"int main(int argc, char *argv[]) {
|
||||||
|
static void *const ar[] = {&&c0, &&c1, &&c2, &&c3};
|
||||||
|
goto *ar[argc];
|
||||||
|
c0: return 1;
|
||||||
|
c1: return 2;
|
||||||
|
c2: return 3;
|
||||||
|
c3: return 4;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_COMPUTED_GOTO)
|
||||||
|
|
||||||
set(srcs
|
set(srcs
|
||||||
source/anorm_dots.h
|
source/anorm_dots.h
|
||||||
source/anorms.h
|
source/anorms.h
|
||||||
|
@ -199,6 +213,10 @@ agw_checked_library(USE_CODEC_VORBIS Vorbis)
|
||||||
agw_checked_library(USE_CODEC_OPUS Opus)
|
agw_checked_library(USE_CODEC_OPUS Opus)
|
||||||
agw_checked_library(USE_CODEC_MikMod MikMod)
|
agw_checked_library(USE_CODEC_MikMod MikMod)
|
||||||
|
|
||||||
|
if(HAVE_COMPUTED_GOTO)
|
||||||
|
target_compile_definitions(quake PUBLIC -DHAVE_COMPUTED_GOTO=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_options(quake PUBLIC
|
target_compile_options(quake PUBLIC
|
||||||
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:
|
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:
|
||||||
-Wall -Wextra -Werror -Wno-missing-field-initializers>
|
-Wall -Wextra -Werror -Wno-missing-field-initializers>
|
||||||
|
|
|
@ -177,7 +177,7 @@ void CL_ParseStartSoundPacket(void)
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
if(ent > cl_max_edicts) //johnfitz -- no more MAX_EDICTS
|
if(ent > cl_max_edicts) //johnfitz -- no more MAX_EDICTS
|
||||||
Host_Error("CL_ParseStartSoundPacket: ent = %" PRIi32 "", ent);
|
Host_Error("CL_ParseStartSoundPacket: ent = %" PRIi32, ent);
|
||||||
|
|
||||||
for(i = 0; i < 3; i++)
|
for(i = 0; i < 3; i++)
|
||||||
pos[i] = MSG_ReadCoord(cl.protocolflags);
|
pos[i] = MSG_ReadCoord(cl.protocolflags);
|
||||||
|
@ -280,7 +280,7 @@ void CL_ParseServerInfo(void)
|
||||||
if(i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
if(i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||||
{
|
{
|
||||||
Con_Printf("\n"); //because there's no newline after serverinfo print
|
Con_Printf("\n"); //because there's no newline after serverinfo print
|
||||||
Host_Error("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32 "", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
Host_Error("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32, i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||||
}
|
}
|
||||||
cl.protocol = i;
|
cl.protocol = i;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
@ -1009,7 +1009,7 @@ void CL_ParseServerMessage(void)
|
||||||
i = MSG_ReadLong();
|
i = MSG_ReadLong();
|
||||||
//johnfitz -- support multiple protocols
|
//johnfitz -- support multiple protocols
|
||||||
if(i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
if(i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||||
Host_Error("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32 "", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
Host_Error("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32, i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||||
cl.protocol = i;
|
cl.protocol = i;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
break;
|
break;
|
||||||
|
@ -1137,7 +1137,7 @@ void CL_ParseServerMessage(void)
|
||||||
case svc_signonnum:
|
case svc_signonnum:
|
||||||
i = MSG_ReadByte();
|
i = MSG_ReadByte();
|
||||||
if(i <= cls.signon)
|
if(i <= cls.signon)
|
||||||
Host_Error("Received signon %" PRIi32 " when at %" PRIi32 "", i, cls.signon);
|
Host_Error("Received signon %" PRIi32 " when at %" PRIi32, i, cls.signon);
|
||||||
cls.signon = i;
|
cls.signon = i;
|
||||||
//johnfitz -- if signonnum==2, signon packet has been fully parsed, so check for excessive static ents and efrags
|
//johnfitz -- if signonnum==2, signon packet has been fully parsed, so check for excessive static ents and efrags
|
||||||
if(i == 2)
|
if(i == 2)
|
||||||
|
|
|
@ -433,7 +433,7 @@ void Cvar_SetValueQuick(cvar_t *var, const float value)
|
||||||
char val[32], *ptr = val;
|
char val[32], *ptr = val;
|
||||||
|
|
||||||
if(value == (float)((int32_t)value))
|
if(value == (float)((int32_t)value))
|
||||||
q_snprintf(val, sizeof(val), "%" PRIi32 "", (int32_t)value);
|
q_snprintf(val, sizeof(val), "%" PRIi32, (int32_t)value);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q_snprintf(val, sizeof(val), "%f", value);
|
q_snprintf(val, sizeof(val), "%f", value);
|
||||||
|
@ -477,7 +477,7 @@ void Cvar_SetValue(const char *var_name, const float value)
|
||||||
char val[32], *ptr = val;
|
char val[32], *ptr = val;
|
||||||
|
|
||||||
if(value == (float)((int32_t)value))
|
if(value == (float)((int32_t)value))
|
||||||
q_snprintf(val, sizeof(val), "%" PRIi32 "", (int32_t)value);
|
q_snprintf(val, sizeof(val), "%" PRIi32, (int32_t)value);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q_snprintf(val, sizeof(val), "%f", value);
|
q_snprintf(val, sizeof(val), "%f", value);
|
||||||
|
|
|
@ -201,9 +201,8 @@ void Scrap_Upload(void)
|
||||||
|
|
||||||
for(i = 0; i < MAX_SCRAPS; i++)
|
for(i = 0; i < MAX_SCRAPS; i++)
|
||||||
{
|
{
|
||||||
sprintf(name, "scrap%" PRIi32 "", i);
|
sprintf(name, "scrap%" PRIi32, i);
|
||||||
scrap_textures[i] = TexMgr_LoadImage(NULL, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_INDEXED, scrap_texels[i],
|
scrap_textures[i] = TexMgr_LoadImage(NULL, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_INDEXED, scrap_texels[i], "", (src_offset_t)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
|
||||||
"", (src_offset_t)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scrap_dirty = false;
|
scrap_dirty = false;
|
||||||
|
|
|
@ -2093,7 +2093,7 @@ void Mod_LoadBrushModel(qmodel_t *mod, void *buffer)
|
||||||
// duplicate the basic information
|
// duplicate the basic information
|
||||||
char name[10];
|
char name[10];
|
||||||
|
|
||||||
sprintf(name, "*%" PRIi32 "", i + 1);
|
sprintf(name, "*%" PRIi32, i + 1);
|
||||||
loadmodel = Mod_FindName(name);
|
loadmodel = Mod_FindName(name);
|
||||||
*loadmodel = *mod;
|
*loadmodel = *mod;
|
||||||
strcpy(loadmodel->name, name);
|
strcpy(loadmodel->name, name);
|
||||||
|
@ -2321,7 +2321,7 @@ void *Mod_LoadAllSkins(int32_t numskins, daliasskintype_t *pskintype)
|
||||||
memcpy(texels, (byte *)(pskintype + 1), size);
|
memcpy(texels, (byte *)(pskintype + 1), size);
|
||||||
|
|
||||||
//johnfitz -- rewritten
|
//johnfitz -- rewritten
|
||||||
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32 "", loadmodel->name, i);
|
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32, loadmodel->name, i);
|
||||||
offset = (src_offset_t)(pskintype + 1) - (src_offset_t)mod_base;
|
offset = (src_offset_t)(pskintype + 1) - (src_offset_t)mod_base;
|
||||||
if(Mod_CheckFullbrights((byte *)(pskintype + 1), size))
|
if(Mod_CheckFullbrights((byte *)(pskintype + 1), size))
|
||||||
{
|
{
|
||||||
|
@ -2365,7 +2365,7 @@ void *Mod_LoadAllSkins(int32_t numskins, daliasskintype_t *pskintype)
|
||||||
}
|
}
|
||||||
|
|
||||||
//johnfitz -- rewritten
|
//johnfitz -- rewritten
|
||||||
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32 "_%" PRIi32 "", loadmodel->name, i, j);
|
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32 "_%" PRIi32, loadmodel->name, i, j);
|
||||||
offset = (src_offset_t)(pskintype) - (src_offset_t)mod_base; //johnfitz
|
offset = (src_offset_t)(pskintype) - (src_offset_t)mod_base; //johnfitz
|
||||||
if(Mod_CheckFullbrights((byte *)(pskintype), size))
|
if(Mod_CheckFullbrights((byte *)(pskintype), size))
|
||||||
{
|
{
|
||||||
|
@ -2555,7 +2555,7 @@ void Mod_LoadAliasModel(qmodel_t *mod, void *buffer)
|
||||||
pheader->skinheight = LittleLong(pinmodel->skinheight);
|
pheader->skinheight = LittleLong(pinmodel->skinheight);
|
||||||
|
|
||||||
if(pheader->skinheight > MAX_LBM_HEIGHT)
|
if(pheader->skinheight > MAX_LBM_HEIGHT)
|
||||||
Sys_Error("model %s has a skin taller than %" PRIi32 "", mod->name,
|
Sys_Error("model %s has a skin taller than %" PRIi32, mod->name,
|
||||||
MAX_LBM_HEIGHT);
|
MAX_LBM_HEIGHT);
|
||||||
|
|
||||||
pheader->numverts = LittleLong(pinmodel->numverts);
|
pheader->numverts = LittleLong(pinmodel->numverts);
|
||||||
|
@ -2704,7 +2704,7 @@ void * Mod_LoadSpriteFrame(void * pin, mspriteframe_t **ppframe, int32_t framenu
|
||||||
pspriteframe->tmax = (float)height / (float)TexMgr_PadConditional(height);
|
pspriteframe->tmax = (float)height / (float)TexMgr_PadConditional(height);
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32 "", loadmodel->name, framenum);
|
q_snprintf(name, sizeof(name), "%s:frame%" PRIi32, loadmodel->name, framenum);
|
||||||
offset = (src_offset_t)(pinframe + 1) - (src_offset_t)mod_base; //johnfitz
|
offset = (src_offset_t)(pinframe + 1) - (src_offset_t)mod_base; //johnfitz
|
||||||
pspriteframe->gltexture =
|
pspriteframe->gltexture =
|
||||||
TexMgr_LoadImage(loadmodel, name, width, height, SRC_INDEXED,
|
TexMgr_LoadImage(loadmodel, name, width, height, SRC_INDEXED,
|
||||||
|
|
|
@ -744,7 +744,7 @@ void R_ShowBoundingBoxes(void)
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
for(i = 0, ed = NEXT_EDICT(sv.edicts) ; i < sv.num_edicts ; i++, ed = NEXT_EDICT(ed))
|
for(i = 0, ed = NextEdict(sv.edicts) ; i < sv.num_edicts ; i++, ed = NextEdict(ed))
|
||||||
{
|
{
|
||||||
if(ed == sv_player)
|
if(ed == sv_player)
|
||||||
continue; //don't draw player's own bbox
|
continue; //don't draw player's own bbox
|
||||||
|
@ -753,16 +753,16 @@ void R_ShowBoundingBoxes(void)
|
||||||
// if (!SV_VisibleToClient (sv_player, ed, sv.worldmodel))
|
// if (!SV_VisibleToClient (sv_player, ed, sv.worldmodel))
|
||||||
// continue; //don't draw if not in pvs
|
// continue; //don't draw if not in pvs
|
||||||
|
|
||||||
if(ED_VECTOR(ed, ED_mins)[0] == ED_VECTOR(ed, ED_maxs)[0] && ED_VECTOR(ed, ED_mins)[1] == ED_VECTOR(ed, ED_maxs)[1] && ED_VECTOR(ed, ED_mins)[2] == ED_VECTOR(ed, ED_maxs)[2])
|
if(ED_Vector(ed, ED_mins)[0] == ED_Vector(ed, ED_maxs)[0] && ED_Vector(ed, ED_mins)[1] == ED_Vector(ed, ED_maxs)[1] && ED_Vector(ed, ED_mins)[2] == ED_Vector(ed, ED_maxs)[2])
|
||||||
{
|
{
|
||||||
//point entity
|
//point entity
|
||||||
R_EmitWirePoint(ED_VECTOR(ed, ED_origin));
|
R_EmitWirePoint(ED_Vector(ed, ED_origin));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//box entity
|
//box entity
|
||||||
VectorAdd(ED_VECTOR(ed, ED_mins), ED_VECTOR(ed, ED_origin), mins);
|
VectorAdd(ED_Vector(ed, ED_mins), ED_Vector(ed, ED_origin), mins);
|
||||||
VectorAdd(ED_VECTOR(ed, ED_maxs), ED_VECTOR(ed, ED_origin), maxs);
|
VectorAdd(ED_Vector(ed, ED_maxs), ED_Vector(ed, ED_origin), maxs);
|
||||||
R_EmitWireBox(mins, maxs);
|
R_EmitWireBox(mins, maxs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ void R_TranslateNewPlayerSkin(int32_t playernum)
|
||||||
pixels = (byte *)paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
|
pixels = (byte *)paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
|
||||||
|
|
||||||
//upload new image
|
//upload new image
|
||||||
q_snprintf(name, sizeof(name), "player_%" PRIi32 "", playernum);
|
q_snprintf(name, sizeof(name), "player_%" PRIi32, playernum);
|
||||||
playertextures[playernum] = TexMgr_LoadImage(currententity->model, name, paliashdr->skinwidth, paliashdr->skinheight,
|
playertextures[playernum] = TexMgr_LoadImage(currententity->model, name, paliashdr->skinwidth, paliashdr->skinheight,
|
||||||
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file, paliashdr->gltextures[skinnum][0]->source_offset, TEXPREF_PAD | TEXPREF_OVERWRITE);
|
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file, paliashdr->gltextures[skinnum][0]->source_offset, TEXPREF_PAD | TEXPREF_OVERWRITE);
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ void GL_BindBuffer(GLenum target, GLuint buffer)
|
||||||
cache = ¤t_element_array_buffer;
|
cache = ¤t_element_array_buffer;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error("GL_BindBuffer: unsupported target %" PRIi32 "", (int32_t)target);
|
Host_Error("GL_BindBuffer: unsupported target %" PRIi32, (int32_t)target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ void SCR_DrawClock(void)
|
||||||
minutes = cl.time / 60;
|
minutes = cl.time / 60;
|
||||||
seconds = ((int32_t)cl.time) % 60;
|
seconds = ((int32_t)cl.time) % 60;
|
||||||
|
|
||||||
sprintf(str, "%" PRIi32 ":%" PRIi32 "%" PRIi32 "", minutes, seconds / 10, seconds % 10);
|
sprintf(str, "%" PRIi32 ":%" PRIi32 "%" PRIi32, minutes, seconds / 10, seconds % 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
@ -532,25 +532,25 @@ void SCR_DrawDevStats(void)
|
||||||
sprintf(str, "---------+---------");
|
sprintf(str, "---------+---------");
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Edicts |%4" PRIi32 " %4" PRIi32 "", dev_stats.edicts, dev_peakstats.edicts);
|
sprintf(str, "Edicts |%4" PRIi32 " %4" PRIi32, dev_stats.edicts, dev_peakstats.edicts);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Packet |%4" PRIi32 " %4" PRIi32 "", dev_stats.packetsize, dev_peakstats.packetsize);
|
sprintf(str, "Packet |%4" PRIi32 " %4" PRIi32, dev_stats.packetsize, dev_peakstats.packetsize);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Visedicts|%4" PRIi32 " %4" PRIi32 "", dev_stats.visedicts, dev_peakstats.visedicts);
|
sprintf(str, "Visedicts|%4" PRIi32 " %4" PRIi32, dev_stats.visedicts, dev_peakstats.visedicts);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Efrags |%4" PRIi32 " %4" PRIi32 "", dev_stats.efrags, dev_peakstats.efrags);
|
sprintf(str, "Efrags |%4" PRIi32 " %4" PRIi32, dev_stats.efrags, dev_peakstats.efrags);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Dlights |%4" PRIi32 " %4" PRIi32 "", dev_stats.dlights, dev_peakstats.dlights);
|
sprintf(str, "Dlights |%4" PRIi32 " %4" PRIi32, dev_stats.dlights, dev_peakstats.dlights);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Beams |%4" PRIi32 " %4" PRIi32 "", dev_stats.beams, dev_peakstats.beams);
|
sprintf(str, "Beams |%4" PRIi32 " %4" PRIi32, dev_stats.beams, dev_peakstats.beams);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
|
|
||||||
sprintf(str, "Tempents |%4" PRIi32 " %4" PRIi32 "", dev_stats.tempents, dev_peakstats.tempents);
|
sprintf(str, "Tempents |%4" PRIi32 " %4" PRIi32, dev_stats.tempents, dev_peakstats.tempents);
|
||||||
Draw_String(x, (y++) * 8 - x, str);
|
Draw_String(x, (y++) * 8 - x, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ void SubdividePolygon(int32_t numverts, float *verts)
|
||||||
float s, t;
|
float s, t;
|
||||||
|
|
||||||
if(numverts > 60)
|
if(numverts > 60)
|
||||||
Sys_Error("numverts = %" PRIi32 "", numverts);
|
Sys_Error("numverts = %" PRIi32, numverts);
|
||||||
|
|
||||||
BoundPoly(numverts, verts, mins, maxs);
|
BoundPoly(numverts, verts, mins, maxs);
|
||||||
|
|
||||||
|
|
|
@ -420,10 +420,10 @@ void SV_DropClient(bool crash)
|
||||||
{
|
{
|
||||||
// call the prog function for removing a client
|
// call the prog function for removing a client
|
||||||
// this will set the body to a dead frame, among other things
|
// this will set the body to a dead frame, among other things
|
||||||
saveSelf = G_PEDICT(GBL_self);
|
saveSelf = G_PEdict(GBL_self);
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(host_client->edict);
|
G_PEdict(GBL_self) = EdictProg(host_client->edict);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_ClientDisconnect));
|
PR_ExecuteProgram(G_Func(GBL_ClientDisconnect));
|
||||||
G_PEDICT(GBL_self) = saveSelf;
|
G_PEdict(GBL_self) = saveSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys_Printf("Client %s removed\n", host_client->name);
|
Sys_Printf("Client %s removed\n", host_client->name);
|
||||||
|
@ -623,7 +623,7 @@ void Host_ServerFrame(void)
|
||||||
edict_t *ent; //johnfitz
|
edict_t *ent; //johnfitz
|
||||||
|
|
||||||
// run the world state
|
// run the world state
|
||||||
G_FLOAT(GBL_frametime) = host_frametime;
|
G_Float(GBL_frametime) = host_frametime;
|
||||||
|
|
||||||
// set the time and clear the general datagram
|
// set the time and clear the general datagram
|
||||||
SV_ClearDatagram();
|
SV_ClearDatagram();
|
||||||
|
@ -644,7 +644,7 @@ void Host_ServerFrame(void)
|
||||||
{
|
{
|
||||||
for(i = 0, active = 0; i < sv.num_edicts; i++)
|
for(i = 0, active = 0; i < sv.num_edicts; i++)
|
||||||
{
|
{
|
||||||
ent = EDICT_NUM(i);
|
ent = EdictNum(i);
|
||||||
if(!ent->free)
|
if(!ent->free)
|
||||||
active++;
|
active++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,7 @@ void Host_Status_f(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hours = 0;
|
hours = 0;
|
||||||
print_fn("#%-2" PRIu32 " %-16.16s %3" PRIi32 " %2" PRIi32 ":%02" PRIi32 ":%02" PRIi32 "n", j + 1, client->name, (int32_t)ED_FLOAT(client->edict, ED_frags), hours, minutes, seconds);
|
print_fn("#%-2" PRIu32 " %-16.16s %3" PRIi32 " %2" PRIi32 ":%02" PRIi32 ":%02" PRIi32 "n", j + 1, client->name, (int32_t)ED_Float(client->edict, ED_frags), hours, minutes, seconds);
|
||||||
print_fn(" %s\n", NET_QSocketGetAddressString(client->netconnection));
|
print_fn(" %s\n", NET_QSocketGetAddressString(client->netconnection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,15 +490,15 @@ void Host_God_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//johnfitz -- allow user to explicitly set god mode to on or off
|
//johnfitz -- allow user to explicitly set god mode to on or off
|
||||||
switch(Cmd_Argc())
|
switch(Cmd_Argc())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) ^ FL_GODMODE;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) ^ FL_GODMODE;
|
||||||
if(!((int32_t)ED_FLOAT(sv_player, ED_flags) & FL_GODMODE))
|
if(!((int32_t)ED_Float(sv_player, ED_flags) & FL_GODMODE))
|
||||||
SV_ClientPrintf("godmode OFF\n");
|
SV_ClientPrintf("godmode OFF\n");
|
||||||
else
|
else
|
||||||
SV_ClientPrintf("godmode ON\n");
|
SV_ClientPrintf("godmode ON\n");
|
||||||
|
@ -506,12 +506,12 @@ void Host_God_f(void)
|
||||||
case 2:
|
case 2:
|
||||||
if(atof(Cmd_Argv(1)))
|
if(atof(Cmd_Argv(1)))
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) | FL_GODMODE;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) | FL_GODMODE;
|
||||||
SV_ClientPrintf("godmode ON\n");
|
SV_ClientPrintf("godmode ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) & ~FL_GODMODE;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) & ~FL_GODMODE;
|
||||||
SV_ClientPrintf("godmode OFF\n");
|
SV_ClientPrintf("godmode OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -535,15 +535,15 @@ void Host_Notarget_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//johnfitz -- allow user to explicitly set notarget to on or off
|
//johnfitz -- allow user to explicitly set notarget to on or off
|
||||||
switch(Cmd_Argc())
|
switch(Cmd_Argc())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) ^ FL_NOTARGET;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) ^ FL_NOTARGET;
|
||||||
if(!((int32_t)ED_FLOAT(sv_player, ED_flags) & FL_NOTARGET))
|
if(!((int32_t)ED_Float(sv_player, ED_flags) & FL_NOTARGET))
|
||||||
SV_ClientPrintf("notarget OFF\n");
|
SV_ClientPrintf("notarget OFF\n");
|
||||||
else
|
else
|
||||||
SV_ClientPrintf("notarget ON\n");
|
SV_ClientPrintf("notarget ON\n");
|
||||||
|
@ -551,12 +551,12 @@ void Host_Notarget_f(void)
|
||||||
case 2:
|
case 2:
|
||||||
if(atof(Cmd_Argv(1)))
|
if(atof(Cmd_Argv(1)))
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) | FL_NOTARGET;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) | FL_NOTARGET;
|
||||||
SV_ClientPrintf("notarget ON\n");
|
SV_ClientPrintf("notarget ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) & ~FL_NOTARGET;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) & ~FL_NOTARGET;
|
||||||
SV_ClientPrintf("notarget OFF\n");
|
SV_ClientPrintf("notarget OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -582,23 +582,23 @@ void Host_Noclip_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//johnfitz -- allow user to explicitly set noclip to on or off
|
//johnfitz -- allow user to explicitly set noclip to on or off
|
||||||
switch(Cmd_Argc())
|
switch(Cmd_Argc())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
if(ED_Float(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
||||||
{
|
{
|
||||||
noclip_anglehack = true;
|
noclip_anglehack = true;
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
||||||
SV_ClientPrintf("noclip ON\n");
|
SV_ClientPrintf("noclip ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
noclip_anglehack = false;
|
noclip_anglehack = false;
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_WALK;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_WALK;
|
||||||
SV_ClientPrintf("noclip OFF\n");
|
SV_ClientPrintf("noclip OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -606,13 +606,13 @@ void Host_Noclip_f(void)
|
||||||
if(atof(Cmd_Argv(1)))
|
if(atof(Cmd_Argv(1)))
|
||||||
{
|
{
|
||||||
noclip_anglehack = true;
|
noclip_anglehack = true;
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
||||||
SV_ClientPrintf("noclip ON\n");
|
SV_ClientPrintf("noclip ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
noclip_anglehack = false;
|
noclip_anglehack = false;
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_WALK;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_WALK;
|
||||||
SV_ClientPrintf("noclip OFF\n");
|
SV_ClientPrintf("noclip OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -638,7 +638,7 @@ void Host_SetPos_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(Cmd_Argc() != 7 && Cmd_Argc() != 4)
|
if(Cmd_Argc() != 7 && Cmd_Argc() != 4)
|
||||||
|
@ -648,37 +648,37 @@ void Host_SetPos_f(void)
|
||||||
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
|
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
|
||||||
SV_ClientPrintf("current values:\n");
|
SV_ClientPrintf("current values:\n");
|
||||||
SV_ClientPrintf(" %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 "\n",
|
SV_ClientPrintf(" %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 "\n",
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_origin)[0],
|
(int32_t)ED_Vector(sv_player, ED_origin)[0],
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_origin)[1],
|
(int32_t)ED_Vector(sv_player, ED_origin)[1],
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_origin)[2],
|
(int32_t)ED_Vector(sv_player, ED_origin)[2],
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_v_angle)[0],
|
(int32_t)ED_Vector(sv_player, ED_v_angle)[0],
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_v_angle)[1],
|
(int32_t)ED_Vector(sv_player, ED_v_angle)[1],
|
||||||
(int32_t)ED_VECTOR(sv_player, ED_v_angle)[2]);
|
(int32_t)ED_Vector(sv_player, ED_v_angle)[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
if(ED_Float(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
||||||
{
|
{
|
||||||
noclip_anglehack = true;
|
noclip_anglehack = true;
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_NOCLIP;
|
||||||
SV_ClientPrintf("noclip ON\n");
|
SV_ClientPrintf("noclip ON\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//make sure they're not going to whizz away from it
|
//make sure they're not going to whizz away from it
|
||||||
ED_VECTOR(sv_player, ED_velocity)[0] = 0;
|
ED_Vector(sv_player, ED_velocity)[0] = 0;
|
||||||
ED_VECTOR(sv_player, ED_velocity)[1] = 0;
|
ED_Vector(sv_player, ED_velocity)[1] = 0;
|
||||||
ED_VECTOR(sv_player, ED_velocity)[2] = 0;
|
ED_Vector(sv_player, ED_velocity)[2] = 0;
|
||||||
|
|
||||||
ED_VECTOR(sv_player, ED_origin)[0] = atof(Cmd_Argv(1));
|
ED_Vector(sv_player, ED_origin)[0] = atof(Cmd_Argv(1));
|
||||||
ED_VECTOR(sv_player, ED_origin)[1] = atof(Cmd_Argv(2));
|
ED_Vector(sv_player, ED_origin)[1] = atof(Cmd_Argv(2));
|
||||||
ED_VECTOR(sv_player, ED_origin)[2] = atof(Cmd_Argv(3));
|
ED_Vector(sv_player, ED_origin)[2] = atof(Cmd_Argv(3));
|
||||||
|
|
||||||
if(Cmd_Argc() == 7)
|
if(Cmd_Argc() == 7)
|
||||||
{
|
{
|
||||||
ED_VECTOR(sv_player, ED_angles)[0] = atof(Cmd_Argv(4));
|
ED_Vector(sv_player, ED_angles)[0] = atof(Cmd_Argv(4));
|
||||||
ED_VECTOR(sv_player, ED_angles)[1] = atof(Cmd_Argv(5));
|
ED_Vector(sv_player, ED_angles)[1] = atof(Cmd_Argv(5));
|
||||||
ED_VECTOR(sv_player, ED_angles)[2] = atof(Cmd_Argv(6));
|
ED_Vector(sv_player, ED_angles)[2] = atof(Cmd_Argv(6));
|
||||||
ED_FLOAT(sv_player, ED_fixangle) = 1;
|
ED_Float(sv_player, ED_fixangle) = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SV_LinkEdict(sv_player, false);
|
SV_LinkEdict(sv_player, false);
|
||||||
|
@ -699,33 +699,33 @@ void Host_Fly_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//johnfitz -- allow user to explicitly set noclip to on or off
|
//johnfitz -- allow user to explicitly set noclip to on or off
|
||||||
switch(Cmd_Argc())
|
switch(Cmd_Argc())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) != MOVETYPE_FLY)
|
if(ED_Float(sv_player, ED_movetype) != MOVETYPE_FLY)
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_FLY;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_FLY;
|
||||||
SV_ClientPrintf("flymode ON\n");
|
SV_ClientPrintf("flymode ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_WALK;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_WALK;
|
||||||
SV_ClientPrintf("flymode OFF\n");
|
SV_ClientPrintf("flymode OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(atof(Cmd_Argv(1)))
|
if(atof(Cmd_Argv(1)))
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_FLY;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_FLY;
|
||||||
SV_ClientPrintf("flymode ON\n");
|
SV_ClientPrintf("flymode ON\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_movetype) = MOVETYPE_WALK;
|
ED_Float(sv_player, ED_movetype) = MOVETYPE_WALK;
|
||||||
SV_ClientPrintf("flymode OFF\n");
|
SV_ClientPrintf("flymode OFF\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1010,7 +1010,7 @@ void Host_SavegameComment(char *text)
|
||||||
for(i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
for(i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||||
text[i] = ' ';
|
text[i] = ' ';
|
||||||
memcpy(text, cl.levelname, q_min(strlen(cl.levelname), 22)); //johnfitz -- only copy 22 chars.
|
memcpy(text, cl.levelname, q_min(strlen(cl.levelname), 22)); //johnfitz -- only copy 22 chars.
|
||||||
sprintf(kills, "kills:%3" PRIi32 "/%3" PRIi32 "", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
sprintf(kills, "kills:%3" PRIi32 "/%3" PRIi32, cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||||
memcpy(text + 22, kills, strlen(kills));
|
memcpy(text + 22, kills, strlen(kills));
|
||||||
// convert space to _ to make stdio happy
|
// convert space to _ to make stdio happy
|
||||||
for(i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
for(i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||||
|
@ -1069,7 +1069,7 @@ void Host_Savegame_f(void)
|
||||||
|
|
||||||
for(i = 0 ; i < svs.maxclients ; i++)
|
for(i = 0 ; i < svs.maxclients ; i++)
|
||||||
{
|
{
|
||||||
if(svs.clients[i].active && ED_FLOAT(svs.clients[i].edict, ED_health) <= 0)
|
if(svs.clients[i].active && ED_Float(svs.clients[i].edict, ED_health) <= 0)
|
||||||
{
|
{
|
||||||
Con_Printf("Can't savegame with a dead player\n");
|
Con_Printf("Can't savegame with a dead player\n");
|
||||||
return;
|
return;
|
||||||
|
@ -1110,7 +1110,7 @@ void Host_Savegame_f(void)
|
||||||
ED_WriteGlobals(f);
|
ED_WriteGlobals(f);
|
||||||
for(i = 0; i < sv.num_edicts; i++)
|
for(i = 0; i < sv.num_edicts; i++)
|
||||||
{
|
{
|
||||||
ED_Write(f, EDICT_NUM(i));
|
ED_Write(f, EdictNum(i));
|
||||||
fflush(f);
|
fflush(f);
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -1237,7 +1237,7 @@ void Host_Loadgame_f(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// parse an edict
|
// parse an edict
|
||||||
ent = EDICT_NUM(entnum);
|
ent = EdictNum(entnum);
|
||||||
if(entnum < sv.num_edicts)
|
if(entnum < sv.num_edicts)
|
||||||
{
|
{
|
||||||
ent->free = false;
|
ent->free = false;
|
||||||
|
@ -1311,7 +1311,7 @@ void Host_Name_f(void)
|
||||||
Con_Printf("%s renamed to %s\n", host_client->name, newName);
|
Con_Printf("%s renamed to %s\n", host_client->name, newName);
|
||||||
}
|
}
|
||||||
strcpy(host_client->name, newName);
|
strcpy(host_client->name, newName);
|
||||||
ED_RSTRING(host_client->edict, ED_netname) = PR_SetEngineString(host_client->name);
|
ED_RString(host_client->edict, ED_netname) = PR_SetEngineString(host_client->name);
|
||||||
|
|
||||||
// send notification to all clients
|
// send notification to all clients
|
||||||
|
|
||||||
|
@ -1386,7 +1386,7 @@ void Host_Say(bool teamonly)
|
||||||
{
|
{
|
||||||
if(!client || !client->active || !client->spawned)
|
if(!client || !client->active || !client->spawned)
|
||||||
continue;
|
continue;
|
||||||
if(teamplay.value && teamonly && ED_FLOAT(client->edict, ED_team) != ED_FLOAT(save->edict, ED_team))
|
if(teamplay.value && teamonly && ED_Float(client->edict, ED_team) != ED_Float(save->edict, ED_team))
|
||||||
continue;
|
continue;
|
||||||
host_client = client;
|
host_client = client;
|
||||||
SV_ClientPrintf("%s", text);
|
SV_ClientPrintf("%s", text);
|
||||||
|
@ -1518,7 +1518,7 @@ void Host_Color_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
host_client->colors = playercolor;
|
host_client->colors = playercolor;
|
||||||
ED_FLOAT(host_client->edict, ED_team) = bottom + 1;
|
ED_Float(host_client->edict, ED_team) = bottom + 1;
|
||||||
|
|
||||||
// send notification to all clients
|
// send notification to all clients
|
||||||
MSG_WriteByte(&sv.reliable_datagram, svc_updatecolors);
|
MSG_WriteByte(&sv.reliable_datagram, svc_updatecolors);
|
||||||
|
@ -1539,15 +1539,15 @@ void Host_Kill_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_FLOAT(sv_player, ED_health) <= 0)
|
if(ED_Float(sv_player, ED_health) <= 0)
|
||||||
{
|
{
|
||||||
SV_ClientPrintf("Can't suicide -- allready dead!\n");
|
SV_ClientPrintf("Can't suicide -- allready dead!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(sv_player);
|
G_PEdict(GBL_self) = EdictProg(sv_player);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_ClientKill));
|
PR_ExecuteProgram(G_Func(GBL_ClientKill));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1579,11 +1579,11 @@ void Host_Pause_f(void)
|
||||||
|
|
||||||
if(sv.paused)
|
if(sv.paused)
|
||||||
{
|
{
|
||||||
SV_BroadcastPrintf("%s paused the game\n", ED_STRING(sv_player, ED_netname));
|
SV_BroadcastPrintf("%s paused the game\n", ED_String(sv_player, ED_netname));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SV_BroadcastPrintf("%s unpaused the game\n", ED_STRING(sv_player, ED_netname));
|
SV_BroadcastPrintf("%s unpaused the game\n", ED_String(sv_player, ED_netname));
|
||||||
}
|
}
|
||||||
|
|
||||||
// send notification to all clients
|
// send notification to all clients
|
||||||
|
@ -1656,22 +1656,22 @@ void Host_Spawn_f(void)
|
||||||
ent = host_client->edict;
|
ent = host_client->edict;
|
||||||
|
|
||||||
memset(ent->fields, 0, progs.entityfields * 4);
|
memset(ent->fields, 0, progs.entityfields * 4);
|
||||||
ED_FLOAT(ent, ED_colormap) = NUM_FOR_EDICT(ent);
|
ED_Float(ent, ED_colormap) = NumForEdict(ent);
|
||||||
ED_FLOAT(ent, ED_team) = (host_client->colors & 15) + 1;
|
ED_Float(ent, ED_team) = (host_client->colors & 15) + 1;
|
||||||
ED_RSTRING(ent, ED_netname) = PR_SetEngineString(host_client->name);
|
ED_RString(ent, ED_netname) = PR_SetEngineString(host_client->name);
|
||||||
|
|
||||||
// copy spawn parms out of the client_t
|
// copy spawn parms out of the client_t
|
||||||
for(i = 0 ; i < NUM_SPAWN_PARMS ; i++)
|
for(i = 0 ; i < NUM_SPAWN_PARMS ; i++)
|
||||||
(&G_FLOAT(GBL_parm1))[i] = host_client->spawn_parms[i];
|
(&G_Float(GBL_parm1))[i] = host_client->spawn_parms[i];
|
||||||
// call the spawn function
|
// call the spawn function
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(sv_player);
|
G_PEdict(GBL_self) = EdictProg(sv_player);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_ClientConnect));
|
PR_ExecuteProgram(G_Func(GBL_ClientConnect));
|
||||||
|
|
||||||
if((Sys_DoubleTime() - NET_QSocketGetTime(host_client->netconnection)) <= sv.time)
|
if((Sys_DoubleTime() - NET_QSocketGetTime(host_client->netconnection)) <= sv.time)
|
||||||
Sys_Printf("%s entered the game\n", host_client->name);
|
Sys_Printf("%s entered the game\n", host_client->name);
|
||||||
|
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_PutClientInServer));
|
PR_ExecuteProgram(G_Func(GBL_PutClientInServer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1708,19 +1708,19 @@ void Host_Spawn_f(void)
|
||||||
//
|
//
|
||||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||||
MSG_WriteByte(&host_client->message, STAT_TOTALSECRETS);
|
MSG_WriteByte(&host_client->message, STAT_TOTALSECRETS);
|
||||||
MSG_WriteLong(&host_client->message, G_FLOAT(GBL_total_secrets));
|
MSG_WriteLong(&host_client->message, G_Float(GBL_total_secrets));
|
||||||
|
|
||||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||||
MSG_WriteByte(&host_client->message, STAT_TOTALMONSTERS);
|
MSG_WriteByte(&host_client->message, STAT_TOTALMONSTERS);
|
||||||
MSG_WriteLong(&host_client->message, G_FLOAT(GBL_total_monsters));
|
MSG_WriteLong(&host_client->message, G_Float(GBL_total_monsters));
|
||||||
|
|
||||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||||
MSG_WriteByte(&host_client->message, STAT_SECRETS);
|
MSG_WriteByte(&host_client->message, STAT_SECRETS);
|
||||||
MSG_WriteLong(&host_client->message, G_FLOAT(GBL_found_secrets));
|
MSG_WriteLong(&host_client->message, G_Float(GBL_found_secrets));
|
||||||
|
|
||||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||||
MSG_WriteByte(&host_client->message, STAT_MONSTERS);
|
MSG_WriteByte(&host_client->message, STAT_MONSTERS);
|
||||||
MSG_WriteLong(&host_client->message, G_FLOAT(GBL_killed_monsters));
|
MSG_WriteLong(&host_client->message, G_Float(GBL_killed_monsters));
|
||||||
|
|
||||||
//
|
//
|
||||||
// send a fixangle
|
// send a fixangle
|
||||||
|
@ -1728,10 +1728,10 @@ void Host_Spawn_f(void)
|
||||||
// in a state where it is expecting the client to correct the angle
|
// in a state where it is expecting the client to correct the angle
|
||||||
// and it won't happen if the game was just loaded, so you wind up
|
// and it won't happen if the game was just loaded, so you wind up
|
||||||
// with a permanent head tilt
|
// with a permanent head tilt
|
||||||
ent = EDICT_NUM(1 + (host_client - svs.clients));
|
ent = EdictNum(1 + (host_client - svs.clients));
|
||||||
MSG_WriteByte(&host_client->message, svc_setangle);
|
MSG_WriteByte(&host_client->message, svc_setangle);
|
||||||
for(i = 0; i < 2; i++)
|
for(i = 0; i < 2; i++)
|
||||||
MSG_WriteAngle(&host_client->message, ED_VECTOR(ent, ED_angles)[i], sv.protocolflags);
|
MSG_WriteAngle(&host_client->message, ED_Vector(ent, ED_angles)[i], sv.protocolflags);
|
||||||
MSG_WriteAngle(&host_client->message, 0, sv.protocolflags);
|
MSG_WriteAngle(&host_client->message, 0, sv.protocolflags);
|
||||||
|
|
||||||
SV_WriteClientdataToMessage(sv_player, &host_client->message);
|
SV_WriteClientdataToMessage(sv_player, &host_client->message);
|
||||||
|
@ -1783,7 +1783,7 @@ void Host_Kick_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(G_FLOAT(GBL_deathmatch))
|
else if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
save = host_client;
|
save = host_client;
|
||||||
|
@ -1871,7 +1871,7 @@ void Host_Give_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t = Cmd_Argv(1);
|
t = Cmd_Argv(1);
|
||||||
|
@ -1895,21 +1895,21 @@ void Host_Give_f(void)
|
||||||
if(t[0] == '6')
|
if(t[0] == '6')
|
||||||
{
|
{
|
||||||
if(t[1] == 'a')
|
if(t[1] == 'a')
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | HIT_PROXIMITY_GUN;
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | HIT_PROXIMITY_GUN;
|
||||||
else
|
else
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | IT_GRENADE_LAUNCHER;
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | IT_GRENADE_LAUNCHER;
|
||||||
}
|
}
|
||||||
else if(t[0] == '9')
|
else if(t[0] == '9')
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | HIT_LASER_CANNON;
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | HIT_LASER_CANNON;
|
||||||
else if(t[0] == '0')
|
else if(t[0] == '0')
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | HIT_MJOLNIR;
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | HIT_MJOLNIR;
|
||||||
else if(t[0] >= '2')
|
else if(t[0] >= '2')
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | (IT_SHOTGUN << (t[0] - '2'));
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | (IT_SHOTGUN << (t[0] - '2'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(t[0] >= '2')
|
if(t[0] >= '2')
|
||||||
ED_FLOAT(sv_player, ED_items) = (int32_t)ED_FLOAT(sv_player, ED_items) | (IT_SHOTGUN << (t[0] - '2'));
|
ED_Float(sv_player, ED_items) = (int32_t)ED_Float(sv_player, ED_items) | (IT_SHOTGUN << (t[0] - '2'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1920,7 +1920,7 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
}
|
}
|
||||||
ED_FLOAT(sv_player, ED_ammo_shells) = v;
|
ED_Float(sv_player, ED_ammo_shells) = v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -1930,13 +1930,13 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) <= IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) <= IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_nails) = v;
|
ED_Float(sv_player, ED_ammo_nails) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_ammo_nails) = v;
|
ED_Float(sv_player, ED_ammo_nails) = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1947,8 +1947,8 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) > IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) > IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_nails) = v;
|
ED_Float(sv_player, ED_ammo_nails) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1960,13 +1960,13 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) <= IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) <= IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_rockets) = v;
|
ED_Float(sv_player, ED_ammo_rockets) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_ammo_rockets) = v;
|
ED_Float(sv_player, ED_ammo_rockets) = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1977,14 +1977,14 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) > IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) > IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_rockets) = v;
|
ED_Float(sv_player, ED_ammo_rockets) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
ED_FLOAT(sv_player, ED_health) = v;
|
ED_Float(sv_player, ED_health) = v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -1994,13 +1994,13 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) <= IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) <= IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_cells) = v;
|
ED_Float(sv_player, ED_ammo_cells) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_ammo_cells) = v;
|
ED_Float(sv_player, ED_ammo_cells) = v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2011,8 +2011,8 @@ void Host_Give_f(void)
|
||||||
if(val)
|
if(val)
|
||||||
{
|
{
|
||||||
val->flt = v;
|
val->flt = v;
|
||||||
if(ED_FLOAT(sv_player, ED_weapon) > IT_LIGHTNING)
|
if(ED_Float(sv_player, ED_weapon) > IT_LIGHTNING)
|
||||||
ED_FLOAT(sv_player, ED_ammo_cells) = v;
|
ED_Float(sv_player, ED_ammo_cells) = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2021,26 +2021,26 @@ void Host_Give_f(void)
|
||||||
case 'a':
|
case 'a':
|
||||||
if(v > 150)
|
if(v > 150)
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_armortype) = 0.8;
|
ED_Float(sv_player, ED_armortype) = 0.8;
|
||||||
ED_FLOAT(sv_player, ED_armorvalue) = v;
|
ED_Float(sv_player, ED_armorvalue) = v;
|
||||||
ED_FLOAT(sv_player, ED_items) = ED_FLOAT(sv_player, ED_items) -
|
ED_Float(sv_player, ED_items) = ED_Float(sv_player, ED_items) -
|
||||||
((int32_t)(ED_FLOAT(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
((int32_t)(ED_Float(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||||
IT_ARMOR3;
|
IT_ARMOR3;
|
||||||
}
|
}
|
||||||
else if(v > 100)
|
else if(v > 100)
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_armortype) = 0.6;
|
ED_Float(sv_player, ED_armortype) = 0.6;
|
||||||
ED_FLOAT(sv_player, ED_armorvalue) = v;
|
ED_Float(sv_player, ED_armorvalue) = v;
|
||||||
ED_FLOAT(sv_player, ED_items) = ED_FLOAT(sv_player, ED_items) -
|
ED_Float(sv_player, ED_items) = ED_Float(sv_player, ED_items) -
|
||||||
((int32_t)(ED_FLOAT(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
((int32_t)(ED_Float(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||||
IT_ARMOR2;
|
IT_ARMOR2;
|
||||||
}
|
}
|
||||||
else if(v >= 0)
|
else if(v >= 0)
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_armortype) = 0.3;
|
ED_Float(sv_player, ED_armortype) = 0.3;
|
||||||
ED_FLOAT(sv_player, ED_armorvalue) = v;
|
ED_Float(sv_player, ED_armorvalue) = v;
|
||||||
ED_FLOAT(sv_player, ED_items) = ED_FLOAT(sv_player, ED_items) -
|
ED_Float(sv_player, ED_items) = ED_Float(sv_player, ED_items) -
|
||||||
((int32_t)(ED_FLOAT(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
((int32_t)(ED_Float(sv_player, ED_items)) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||||
IT_ARMOR1;
|
IT_ARMOR1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2048,37 +2048,37 @@ void Host_Give_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//johnfitz -- update currentammo to match new ammo (so statusbar updates correctly)
|
//johnfitz -- update currentammo to match new ammo (so statusbar updates correctly)
|
||||||
switch((int32_t)(ED_FLOAT(sv_player, ED_weapon)))
|
switch((int32_t)(ED_Float(sv_player, ED_weapon)))
|
||||||
{
|
{
|
||||||
case IT_SHOTGUN:
|
case IT_SHOTGUN:
|
||||||
case IT_SUPER_SHOTGUN:
|
case IT_SUPER_SHOTGUN:
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_shells);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_shells);
|
||||||
break;
|
break;
|
||||||
case IT_NAILGUN:
|
case IT_NAILGUN:
|
||||||
case IT_SUPER_NAILGUN:
|
case IT_SUPER_NAILGUN:
|
||||||
case RIT_LAVA_SUPER_NAILGUN:
|
case RIT_LAVA_SUPER_NAILGUN:
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_nails);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_nails);
|
||||||
break;
|
break;
|
||||||
case IT_GRENADE_LAUNCHER:
|
case IT_GRENADE_LAUNCHER:
|
||||||
case IT_ROCKET_LAUNCHER:
|
case IT_ROCKET_LAUNCHER:
|
||||||
case RIT_MULTI_GRENADE:
|
case RIT_MULTI_GRENADE:
|
||||||
case RIT_MULTI_ROCKET:
|
case RIT_MULTI_ROCKET:
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_rockets);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_rockets);
|
||||||
break;
|
break;
|
||||||
case IT_LIGHTNING:
|
case IT_LIGHTNING:
|
||||||
case HIT_LASER_CANNON:
|
case HIT_LASER_CANNON:
|
||||||
case HIT_MJOLNIR:
|
case HIT_MJOLNIR:
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_cells);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_cells);
|
||||||
break;
|
break;
|
||||||
case RIT_LAVA_NAILGUN: //same as IT_AXE
|
case RIT_LAVA_NAILGUN: //same as IT_AXE
|
||||||
if(rogue)
|
if(rogue)
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_nails);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_nails);
|
||||||
break;
|
break;
|
||||||
case RIT_PLASMA_GUN: //same as HIT_PROXIMITY_GUN
|
case RIT_PLASMA_GUN: //same as HIT_PROXIMITY_GUN
|
||||||
if(rogue)
|
if(rogue)
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_cells);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_cells);
|
||||||
if(hipnotic)
|
if(hipnotic)
|
||||||
ED_FLOAT(sv_player, ED_currentammo) = ED_FLOAT(sv_player, ED_ammo_rockets);
|
ED_Float(sv_player, ED_currentammo) = ED_Float(sv_player, ED_ammo_rockets);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
@ -2091,8 +2091,8 @@ edict_t *FindViewthing(void)
|
||||||
|
|
||||||
for(i = 0 ; i < sv.num_edicts ; i++)
|
for(i = 0 ; i < sv.num_edicts ; i++)
|
||||||
{
|
{
|
||||||
e = EDICT_NUM(i);
|
e = EdictNum(i);
|
||||||
if(!strcmp(ED_STRING(e, ED_classname), "viewthing"))
|
if(!strcmp(ED_String(e, ED_classname), "viewthing"))
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
Con_Printf("No viewthing on map\n");
|
Con_Printf("No viewthing on map\n");
|
||||||
|
@ -2120,8 +2120,8 @@ void Host_Viewmodel_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ED_FLOAT(e, ED_frame) = 0;
|
ED_Float(e, ED_frame) = 0;
|
||||||
cl.model_precache[(int32_t)ED_FLOAT(e, ED_modelindex)] = m;
|
cl.model_precache[(int32_t)ED_Float(e, ED_modelindex)] = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2138,13 +2138,13 @@ void Host_Viewframe_f(void)
|
||||||
e = FindViewthing();
|
e = FindViewthing();
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
m = cl.model_precache[(int32_t)ED_FLOAT(e, ED_modelindex)];
|
m = cl.model_precache[(int32_t)ED_Float(e, ED_modelindex)];
|
||||||
|
|
||||||
f = atoi(Cmd_Argv(1));
|
f = atoi(Cmd_Argv(1));
|
||||||
if(f >= m->numframes)
|
if(f >= m->numframes)
|
||||||
f = m->numframes - 1;
|
f = m->numframes - 1;
|
||||||
|
|
||||||
ED_FLOAT(e, ED_frame) = f;
|
ED_Float(e, ED_frame) = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2174,13 +2174,13 @@ void Host_Viewnext_f(void)
|
||||||
e = FindViewthing();
|
e = FindViewthing();
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
m = cl.model_precache[(int32_t)ED_FLOAT(e, ED_modelindex)];
|
m = cl.model_precache[(int32_t)ED_Float(e, ED_modelindex)];
|
||||||
|
|
||||||
ED_FLOAT(e, ED_frame) = ED_FLOAT(e, ED_frame) + 1;
|
ED_Float(e, ED_frame) = ED_Float(e, ED_frame) + 1;
|
||||||
if(ED_FLOAT(e, ED_frame) >= m->numframes)
|
if(ED_Float(e, ED_frame) >= m->numframes)
|
||||||
ED_FLOAT(e, ED_frame) = m->numframes - 1;
|
ED_Float(e, ED_frame) = m->numframes - 1;
|
||||||
|
|
||||||
PrintFrameName(m, ED_FLOAT(e, ED_frame));
|
PrintFrameName(m, ED_Float(e, ED_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2197,13 +2197,13 @@ void Host_Viewprev_f(void)
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m = cl.model_precache[(int32_t)ED_FLOAT(e, ED_modelindex)];
|
m = cl.model_precache[(int32_t)ED_Float(e, ED_modelindex)];
|
||||||
|
|
||||||
ED_FLOAT(e, ED_frame) = ED_FLOAT(e, ED_frame) - 1;
|
ED_Float(e, ED_frame) = ED_Float(e, ED_frame) - 1;
|
||||||
if(ED_FLOAT(e, ED_frame) < 0)
|
if(ED_Float(e, ED_frame) < 0)
|
||||||
ED_FLOAT(e, ED_frame) = 0;
|
ED_Float(e, ED_frame) = 0;
|
||||||
|
|
||||||
PrintFrameName(m, ED_FLOAT(e, ED_frame));
|
PrintFrameName(m, ED_Float(e, ED_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1723,7 +1723,7 @@ void M_Menu_LanConfig_f(void)
|
||||||
if(StartingGame && lanConfig_cursor == 2)
|
if(StartingGame && lanConfig_cursor == 2)
|
||||||
lanConfig_cursor = 1;
|
lanConfig_cursor = 1;
|
||||||
lanConfig_port = DEFAULTnet_hostport;
|
lanConfig_port = DEFAULTnet_hostport;
|
||||||
sprintf(lanConfig_portname, "%" PRIu32 "", lanConfig_port);
|
sprintf(lanConfig_portname, "%" PRIu32, lanConfig_port);
|
||||||
|
|
||||||
m_return_onerror = false;
|
m_return_onerror = false;
|
||||||
m_return_reason[0] = 0;
|
m_return_reason[0] = 0;
|
||||||
|
@ -1876,7 +1876,7 @@ void M_LanConfig_Key(int32_t key)
|
||||||
l = lanConfig_port;
|
l = lanConfig_port;
|
||||||
else
|
else
|
||||||
lanConfig_port = l;
|
lanConfig_port = l;
|
||||||
sprintf(lanConfig_portname, "%" PRIu32 "", lanConfig_port);
|
sprintf(lanConfig_portname, "%" PRIu32, lanConfig_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2096,7 +2096,7 @@ void M_GameOptions_Draw(void)
|
||||||
M_Print(160, 40, "begin game");
|
M_Print(160, 40, "begin game");
|
||||||
|
|
||||||
M_Print(0, 56, " Max players");
|
M_Print(0, 56, " Max players");
|
||||||
M_Print(160, 56, va("%" PRIi32 "", maxplayers));
|
M_Print(160, 56, va("%" PRIi32, maxplayers));
|
||||||
|
|
||||||
M_Print(0, 64, " Game Type");
|
M_Print(0, 64, " Game Type");
|
||||||
if(coop.value)
|
if(coop.value)
|
||||||
|
|
|
@ -89,7 +89,7 @@ static void NET_Ban_f(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(G_FLOAT(GBL_deathmatch))
|
if(G_Float(GBL_deathmatch))
|
||||||
return;
|
return;
|
||||||
print_fn = SV_ClientPrintf;
|
print_fn = SV_ClientPrintf;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ static qsocket_t *Datagram_CheckNewConnections_(void)
|
||||||
MSG_WriteByte(&net_message, playerNumber);
|
MSG_WriteByte(&net_message, playerNumber);
|
||||||
MSG_WriteString(&net_message, client->name);
|
MSG_WriteString(&net_message, client->name);
|
||||||
MSG_WriteLong(&net_message, client->colors);
|
MSG_WriteLong(&net_message, client->colors);
|
||||||
MSG_WriteLong(&net_message, (int32_t)ED_FLOAT(client->edict, ED_frags));
|
MSG_WriteLong(&net_message, (int32_t)ED_Float(client->edict, ED_frags));
|
||||||
MSG_WriteLong(&net_message, (int32_t)(net_time - client->netconnection->connecttime));
|
MSG_WriteLong(&net_message, (int32_t)(net_time - client->netconnection->connecttime));
|
||||||
MSG_WriteString(&net_message, client->netconnection->address);
|
MSG_WriteString(&net_message, client->netconnection->address);
|
||||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||||
|
|
364
source/pr_cmds.c
364
source/pr_cmds.c
|
@ -32,7 +32,7 @@ static char *PR_GetTempString(void)
|
||||||
return pr_string_temp[(STRINGTEMP_BUFFERS - 1) & ++pr_string_tempindex];
|
return pr_string_temp[(STRINGTEMP_BUFFERS - 1) & ++pr_string_tempindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RETURN_EDICT(e) (G_PEDICT(GBL_RETURN) = EDICT_TO_PROG(e))
|
#define RETURN_EDICT(e) (G_PEdict(GBL_RETURN) = EdictProg(e))
|
||||||
|
|
||||||
#define MSG_BROADCAST 0 // unreliable to all
|
#define MSG_BROADCAST 0 // unreliable to all
|
||||||
#define MSG_ONE 1 // reliable to one (msg_entity)
|
#define MSG_ONE 1 // reliable to one (msg_entity)
|
||||||
|
@ -57,7 +57,7 @@ static char *PF_VarString(int32_t first)
|
||||||
s = 0;
|
s = 0;
|
||||||
for(i = first; i < pr_argc; i++)
|
for(i = first; i < pr_argc; i++)
|
||||||
{
|
{
|
||||||
s = q_strlcat(out, G_STRING((GBL_PARM0 + i * 3)), sizeof(out));
|
s = q_strlcat(out, G_String((GBL_PARM0 + i * 3)), sizeof(out));
|
||||||
if(s >= sizeof(out))
|
if(s >= sizeof(out))
|
||||||
{
|
{
|
||||||
Con_Warning("PF_VarString: overflow (string truncated)\n");
|
Con_Warning("PF_VarString: overflow (string truncated)\n");
|
||||||
|
@ -94,7 +94,7 @@ static void PF_error(void)
|
||||||
s = PF_VarString(0);
|
s = PF_VarString(0);
|
||||||
Con_Printf("======SERVER ERROR in %s:\n%s\n",
|
Con_Printf("======SERVER ERROR in %s:\n%s\n",
|
||||||
PR_GetString(pr_xfunction->s_name), s);
|
PR_GetString(pr_xfunction->s_name), s);
|
||||||
ed = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ed = ProgEdict(G_PEdict(GBL_self));
|
||||||
ED_Print(ed);
|
ED_Print(ed);
|
||||||
|
|
||||||
Host_Error("Program error");
|
Host_Error("Program error");
|
||||||
|
@ -118,7 +118,7 @@ static void PF_objerror(void)
|
||||||
s = PF_VarString(0);
|
s = PF_VarString(0);
|
||||||
Con_Printf("======OBJECT ERROR in %s:\n%s\n",
|
Con_Printf("======OBJECT ERROR in %s:\n%s\n",
|
||||||
PR_GetString(pr_xfunction->s_name), s);
|
PR_GetString(pr_xfunction->s_name), s);
|
||||||
ed = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ed = ProgEdict(G_PEdict(GBL_self));
|
||||||
ED_Print(ed);
|
ED_Print(ed);
|
||||||
ED_Free(ed);
|
ED_Free(ed);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ makevectors(vector)
|
||||||
*/
|
*/
|
||||||
static void PF_makevectors(void)
|
static void PF_makevectors(void)
|
||||||
{
|
{
|
||||||
AngleVectors(G_VECTOR(GBL_PARM0), G_VECTOR(GBL_v_forward), G_VECTOR(GBL_v_right), G_VECTOR(GBL_v_up));
|
AngleVectors(G_Vector(GBL_PARM0), G_Vector(GBL_v_forward), G_Vector(GBL_v_right), G_Vector(GBL_v_up));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -159,9 +159,9 @@ static void PF_setorigin(void)
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
float *org;
|
float *org;
|
||||||
|
|
||||||
e = G_EDICT(GBL_PARM0);
|
e = G_Edict(GBL_PARM0);
|
||||||
org = G_VECTOR(GBL_PARM1);
|
org = G_Vector(GBL_PARM1);
|
||||||
VectorCopy(org, ED_VECTOR(e, ED_origin));
|
VectorCopy(org, ED_Vector(e, ED_origin));
|
||||||
SV_LinkEdict(e, false);
|
SV_LinkEdict(e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ static void SetMinMaxSize(edict_t *e, float *minvec, float *maxvec, bool rotate)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// find min / max for rotations
|
// find min / max for rotations
|
||||||
angles = ED_VECTOR(e, ED_angles);
|
angles = ED_Vector(e, ED_angles);
|
||||||
|
|
||||||
a = angles[1] / 180 * PI;
|
a = angles[1] / 180 * PI;
|
||||||
|
|
||||||
|
@ -233,9 +233,9 @@ static void SetMinMaxSize(edict_t *e, float *minvec, float *maxvec, bool rotate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set derived values
|
// set derived values
|
||||||
VectorCopy(rmin, ED_VECTOR(e, ED_mins));
|
VectorCopy(rmin, ED_Vector(e, ED_mins));
|
||||||
VectorCopy(rmax, ED_VECTOR(e, ED_maxs));
|
VectorCopy(rmax, ED_Vector(e, ED_maxs));
|
||||||
VectorSubtract(maxvec, minvec, ED_VECTOR(e, ED_size));
|
VectorSubtract(maxvec, minvec, ED_Vector(e, ED_size));
|
||||||
|
|
||||||
SV_LinkEdict(e, false);
|
SV_LinkEdict(e, false);
|
||||||
}
|
}
|
||||||
|
@ -254,9 +254,9 @@ static void PF_setsize(void)
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
float *minvec, *maxvec;
|
float *minvec, *maxvec;
|
||||||
|
|
||||||
e = G_EDICT(GBL_PARM0);
|
e = G_Edict(GBL_PARM0);
|
||||||
minvec = G_VECTOR(GBL_PARM1);
|
minvec = G_Vector(GBL_PARM1);
|
||||||
maxvec = G_VECTOR(GBL_PARM2);
|
maxvec = G_Vector(GBL_PARM2);
|
||||||
SetMinMaxSize(e, minvec, maxvec, false);
|
SetMinMaxSize(e, minvec, maxvec, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ static void PF_setmodel(void)
|
||||||
qmodel_t *mod;
|
qmodel_t *mod;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
e = G_EDICT(GBL_PARM0);
|
e = G_Edict(GBL_PARM0);
|
||||||
m = G_STRING(GBL_PARM1);
|
m = G_String(GBL_PARM1);
|
||||||
|
|
||||||
// check to see if model was properly precached
|
// check to see if model was properly precached
|
||||||
for(i = 0, check = sv.model_precache; *check; i++, check++)
|
for(i = 0, check = sv.model_precache; *check; i++, check++)
|
||||||
|
@ -289,10 +289,10 @@ static void PF_setmodel(void)
|
||||||
{
|
{
|
||||||
PR_RunError("no precache: %s", m);
|
PR_RunError("no precache: %s", m);
|
||||||
}
|
}
|
||||||
ED_RSTRING(e, ED_model) = PR_SetEngineString(*check);
|
ED_RString(e, ED_model) = PR_SetEngineString(*check);
|
||||||
ED_FLOAT(e, ED_modelindex) = i; //SV_ModelIndex (m);
|
ED_Float(e, ED_modelindex) = i; //SV_ModelIndex (m);
|
||||||
|
|
||||||
mod = sv.models[(int32_t)ED_FLOAT(e, ED_modelindex)]; // Mod_ForName (m, true);
|
mod = sv.models[(int32_t)ED_Float(e, ED_modelindex)]; // Mod_ForName (m, true);
|
||||||
|
|
||||||
if(mod)
|
if(mod)
|
||||||
//johnfitz -- correct physics cullboxes for bmodels
|
//johnfitz -- correct physics cullboxes for bmodels
|
||||||
|
@ -339,7 +339,7 @@ static void PF_sprint(void)
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int32_t entnum;
|
int32_t entnum;
|
||||||
|
|
||||||
entnum = G_EDICTNUM(GBL_PARM0);
|
entnum = G_EdictNum(GBL_PARM0);
|
||||||
s = PF_VarString(1);
|
s = PF_VarString(1);
|
||||||
|
|
||||||
if(entnum < 1 || entnum > svs.maxclients)
|
if(entnum < 1 || entnum > svs.maxclients)
|
||||||
|
@ -370,7 +370,7 @@ static void PF_centerprint(void)
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int32_t entnum;
|
int32_t entnum;
|
||||||
|
|
||||||
entnum = G_EDICTNUM(GBL_PARM0);
|
entnum = G_EdictNum(GBL_PARM0);
|
||||||
s = PF_VarString(1);
|
s = PF_VarString(1);
|
||||||
|
|
||||||
if(entnum < 1 || entnum > svs.maxclients)
|
if(entnum < 1 || entnum > svs.maxclients)
|
||||||
|
@ -399,7 +399,7 @@ static void PF_normalize(void)
|
||||||
vec3_t newvalue;
|
vec3_t newvalue;
|
||||||
double new_temp;
|
double new_temp;
|
||||||
|
|
||||||
value1 = G_VECTOR(GBL_PARM0);
|
value1 = G_Vector(GBL_PARM0);
|
||||||
|
|
||||||
new_temp = (double)value1[0] * value1[0] + (double)value1[1] * value1[1] + (double)value1[2] * value1[2];
|
new_temp = (double)value1[0] * value1[0] + (double)value1[1] * value1[1] + (double)value1[2] * value1[2];
|
||||||
new_temp = sqrt(new_temp);
|
new_temp = sqrt(new_temp);
|
||||||
|
@ -414,7 +414,7 @@ static void PF_normalize(void)
|
||||||
newvalue[2] = value1[2] * new_temp;
|
newvalue[2] = value1[2] * new_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(newvalue, G_VECTOR(GBL_RETURN));
|
VectorCopy(newvalue, G_Vector(GBL_RETURN));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -429,12 +429,12 @@ static void PF_vlen(void)
|
||||||
float *value1;
|
float *value1;
|
||||||
double new_temp;
|
double new_temp;
|
||||||
|
|
||||||
value1 = G_VECTOR(GBL_PARM0);
|
value1 = G_Vector(GBL_PARM0);
|
||||||
|
|
||||||
new_temp = (double)value1[0] * value1[0] + (double)value1[1] * value1[1] + (double)value1[2] * value1[2];
|
new_temp = (double)value1[0] * value1[0] + (double)value1[1] * value1[1] + (double)value1[2] * value1[2];
|
||||||
new_temp = sqrt(new_temp);
|
new_temp = sqrt(new_temp);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = new_temp;
|
G_Float(GBL_RETURN) = new_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -449,7 +449,7 @@ static void PF_vectoyaw(void)
|
||||||
float *value1;
|
float *value1;
|
||||||
float yaw;
|
float yaw;
|
||||||
|
|
||||||
value1 = G_VECTOR(GBL_PARM0);
|
value1 = G_Vector(GBL_PARM0);
|
||||||
|
|
||||||
if(value1[1] == 0 && value1[0] == 0)
|
if(value1[1] == 0 && value1[0] == 0)
|
||||||
yaw = 0;
|
yaw = 0;
|
||||||
|
@ -460,7 +460,7 @@ static void PF_vectoyaw(void)
|
||||||
yaw += 360;
|
yaw += 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = yaw;
|
G_Float(GBL_RETURN) = yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ static void PF_vectoangles(void)
|
||||||
float forward;
|
float forward;
|
||||||
float yaw, pitch;
|
float yaw, pitch;
|
||||||
|
|
||||||
value1 = G_VECTOR(GBL_PARM0);
|
value1 = G_Vector(GBL_PARM0);
|
||||||
|
|
||||||
if(value1[1] == 0 && value1[0] == 0)
|
if(value1[1] == 0 && value1[0] == 0)
|
||||||
{
|
{
|
||||||
|
@ -499,9 +499,9 @@ static void PF_vectoangles(void)
|
||||||
pitch += 360;
|
pitch += 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN + 0) = pitch;
|
G_Float(GBL_RETURN + 0) = pitch;
|
||||||
G_FLOAT(GBL_RETURN + 1) = yaw;
|
G_Float(GBL_RETURN + 1) = yaw;
|
||||||
G_FLOAT(GBL_RETURN + 2) = 0;
|
G_Float(GBL_RETURN + 2) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -519,7 +519,7 @@ static void PF_random(void)
|
||||||
|
|
||||||
num = (rand() & 0x7fff) / ((float)0x7fff);
|
num = (rand() & 0x7fff) / ((float)0x7fff);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = num;
|
G_Float(GBL_RETURN) = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -535,10 +535,10 @@ static void PF_particle(void)
|
||||||
float color;
|
float color;
|
||||||
float count;
|
float count;
|
||||||
|
|
||||||
org = G_VECTOR(GBL_PARM0);
|
org = G_Vector(GBL_PARM0);
|
||||||
dir = G_VECTOR(GBL_PARM1);
|
dir = G_Vector(GBL_PARM1);
|
||||||
color = G_FLOAT(GBL_PARM2);
|
color = G_Float(GBL_PARM2);
|
||||||
count = G_FLOAT(GBL_PARM3);
|
count = G_Float(GBL_PARM3);
|
||||||
SV_StartParticle(org, dir, color, count);
|
SV_StartParticle(org, dir, color, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,10 +557,10 @@ static void PF_ambientsound(void)
|
||||||
int32_t i, soundnum;
|
int32_t i, soundnum;
|
||||||
int32_t large = false; //johnfitz -- PROTOCOL_FITZQUAKE
|
int32_t large = false; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
|
|
||||||
pos = G_VECTOR(GBL_PARM0);
|
pos = G_Vector(GBL_PARM0);
|
||||||
samp = G_STRING(GBL_PARM1);
|
samp = G_String(GBL_PARM1);
|
||||||
vol = G_FLOAT(GBL_PARM2);
|
vol = G_Float(GBL_PARM2);
|
||||||
attenuation = G_FLOAT(GBL_PARM3);
|
attenuation = G_Float(GBL_PARM3);
|
||||||
|
|
||||||
// check to see if samp was properly precached
|
// check to see if samp was properly precached
|
||||||
for(soundnum = 0, check = sv.sound_precache; *check; check++, soundnum++)
|
for(soundnum = 0, check = sv.sound_precache; *check; check++, soundnum++)
|
||||||
|
@ -632,20 +632,20 @@ static void PF_sound(void)
|
||||||
int32_t volume;
|
int32_t volume;
|
||||||
float attenuation;
|
float attenuation;
|
||||||
|
|
||||||
entity = G_EDICT(GBL_PARM0);
|
entity = G_Edict(GBL_PARM0);
|
||||||
channel = G_FLOAT(GBL_PARM1);
|
channel = G_Float(GBL_PARM1);
|
||||||
sample = G_STRING(GBL_PARM2);
|
sample = G_String(GBL_PARM2);
|
||||||
volume = G_FLOAT(GBL_PARM3) * 255;
|
volume = G_Float(GBL_PARM3) * 255;
|
||||||
attenuation = G_FLOAT(GBL_PARM4);
|
attenuation = G_Float(GBL_PARM4);
|
||||||
|
|
||||||
if(volume < 0 || volume > 255)
|
if(volume < 0 || volume > 255)
|
||||||
Host_Error("SV_StartSound: volume = %" PRIi32 "", volume);
|
Host_Error("SV_StartSound: volume = %" PRIi32, volume);
|
||||||
|
|
||||||
if(attenuation < 0 || attenuation > 4)
|
if(attenuation < 0 || attenuation > 4)
|
||||||
Host_Error("SV_StartSound: attenuation = %f", attenuation);
|
Host_Error("SV_StartSound: attenuation = %f", attenuation);
|
||||||
|
|
||||||
if(channel < 0 || channel > 7)
|
if(channel < 0 || channel > 7)
|
||||||
Host_Error("SV_StartSound: channel = %" PRIi32 "", channel);
|
Host_Error("SV_StartSound: channel = %" PRIi32, channel);
|
||||||
|
|
||||||
SV_StartSound(entity, channel, sample, volume, attenuation);
|
SV_StartSound(entity, channel, sample, volume, attenuation);
|
||||||
}
|
}
|
||||||
|
@ -682,10 +682,10 @@ static void PF_traceline(void)
|
||||||
int32_t nomonsters;
|
int32_t nomonsters;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
v1 = G_VECTOR(GBL_PARM0);
|
v1 = G_Vector(GBL_PARM0);
|
||||||
v2 = G_VECTOR(GBL_PARM1);
|
v2 = G_Vector(GBL_PARM1);
|
||||||
nomonsters = G_FLOAT(GBL_PARM2);
|
nomonsters = G_Float(GBL_PARM2);
|
||||||
ent = G_EDICT(GBL_PARM3);
|
ent = G_Edict(GBL_PARM3);
|
||||||
|
|
||||||
/* FIXME FIXME FIXME: Why do we hit this?? */
|
/* FIXME FIXME FIXME: Why do we hit this?? */
|
||||||
if(developer.value)
|
if(developer.value)
|
||||||
|
@ -694,7 +694,7 @@ static void PF_traceline(void)
|
||||||
isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
|
isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
|
||||||
{
|
{
|
||||||
Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
|
Con_Warning("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
|
||||||
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent));
|
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NumForEdict(ent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,18 +705,18 @@ static void PF_traceline(void)
|
||||||
|
|
||||||
trace = SV_Move(v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
|
trace = SV_Move(v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
|
||||||
|
|
||||||
G_FLOAT(GBL_trace_allsolid) = trace.allsolid;
|
G_Float(GBL_trace_allsolid) = trace.allsolid;
|
||||||
G_FLOAT(GBL_trace_startsolid) = trace.startsolid;
|
G_Float(GBL_trace_startsolid) = trace.startsolid;
|
||||||
G_FLOAT(GBL_trace_fraction) = trace.fraction;
|
G_Float(GBL_trace_fraction) = trace.fraction;
|
||||||
G_FLOAT(GBL_trace_inwater) = trace.inwater;
|
G_Float(GBL_trace_inwater) = trace.inwater;
|
||||||
G_FLOAT(GBL_trace_inopen) = trace.inopen;
|
G_Float(GBL_trace_inopen) = trace.inopen;
|
||||||
VectorCopy(trace.endpos, G_VECTOR(GBL_trace_endpos));
|
VectorCopy(trace.endpos, G_Vector(GBL_trace_endpos));
|
||||||
VectorCopy(trace.plane.normal, G_VECTOR(GBL_trace_plane_normal));
|
VectorCopy(trace.plane.normal, G_Vector(GBL_trace_plane_normal));
|
||||||
G_FLOAT(GBL_trace_plane_dist) = trace.plane.dist;
|
G_Float(GBL_trace_plane_dist) = trace.plane.dist;
|
||||||
if(trace.ent)
|
if(trace.ent)
|
||||||
G_PEDICT(GBL_trace_ent) = EDICT_TO_PROG(trace.ent);
|
G_PEdict(GBL_trace_ent) = EdictProg(trace.ent);
|
||||||
else
|
else
|
||||||
G_PEDICT(GBL_trace_ent) = EDICT_TO_PROG(sv.edicts);
|
G_PEdict(GBL_trace_ent) = EdictProg(sv.edicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -750,16 +750,16 @@ static int32_t PF_newcheckclient(int32_t check)
|
||||||
if(i == svs.maxclients + 1)
|
if(i == svs.maxclients + 1)
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
ent = EDICT_NUM(i);
|
ent = EdictNum(i);
|
||||||
|
|
||||||
if(i == check)
|
if(i == check)
|
||||||
break; // didn't find anything else
|
break; // didn't find anything else
|
||||||
|
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(ent, ED_health) <= 0)
|
if(ED_Float(ent, ED_health) <= 0)
|
||||||
continue;
|
continue;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_NOTARGET)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_NOTARGET)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// anything that is a client, or has a client as an enemy
|
// anything that is a client, or has a client as an enemy
|
||||||
|
@ -767,7 +767,7 @@ static int32_t PF_newcheckclient(int32_t check)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the PVS for the entity
|
// get the PVS for the entity
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_view_ofs), org);
|
VectorAdd(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_view_ofs), org);
|
||||||
leaf = Mod_PointInLeaf(org, sv.worldmodel);
|
leaf = Mod_PointInLeaf(org, sv.worldmodel);
|
||||||
pvs = Mod_LeafPVS(leaf, sv.worldmodel);
|
pvs = Mod_LeafPVS(leaf, sv.worldmodel);
|
||||||
|
|
||||||
|
@ -816,16 +816,16 @@ static void PF_checkclient(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// return check if it might be visible
|
// return check if it might be visible
|
||||||
ent = EDICT_NUM(sv.lastcheck);
|
ent = EdictNum(sv.lastcheck);
|
||||||
if(ent->free || ED_FLOAT(ent, ED_health) <= 0)
|
if(ent->free || ED_Float(ent, ED_health) <= 0)
|
||||||
{
|
{
|
||||||
RETURN_EDICT(sv.edicts);
|
RETURN_EDICT(sv.edicts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if current entity can't possibly see the check entity, return 0
|
// if current entity can't possibly see the check entity, return 0
|
||||||
self = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
self = ProgEdict(G_PEdict(GBL_self));
|
||||||
VectorAdd(ED_VECTOR(self, ED_origin), ED_VECTOR(self, ED_view_ofs), view);
|
VectorAdd(ED_Vector(self, ED_origin), ED_Vector(self, ED_view_ofs), view);
|
||||||
leaf = Mod_PointInLeaf(view, sv.worldmodel);
|
leaf = Mod_PointInLeaf(view, sv.worldmodel);
|
||||||
l = (leaf - sv.worldmodel->leafs) - 1;
|
l = (leaf - sv.worldmodel->leafs) - 1;
|
||||||
if((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7))))
|
if((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7))))
|
||||||
|
@ -858,10 +858,10 @@ static void PF_stuffcmd(void)
|
||||||
const char *str;
|
const char *str;
|
||||||
client_t *old;
|
client_t *old;
|
||||||
|
|
||||||
entnum = G_EDICTNUM(GBL_PARM0);
|
entnum = G_EdictNum(GBL_PARM0);
|
||||||
if(entnum < 1 || entnum > svs.maxclients)
|
if(entnum < 1 || entnum > svs.maxclients)
|
||||||
PR_RunError("Parm 0 not a client");
|
PR_RunError("Parm 0 not a client");
|
||||||
str = G_STRING(GBL_PARM1);
|
str = G_String(GBL_PARM1);
|
||||||
|
|
||||||
old = host_client;
|
old = host_client;
|
||||||
host_client = &svs.clients[entnum - 1];
|
host_client = &svs.clients[entnum - 1];
|
||||||
|
@ -882,7 +882,7 @@ static void PF_localcmd(void)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
str = G_STRING(GBL_PARM0);
|
str = G_String(GBL_PARM0);
|
||||||
Cbuf_AddText(str);
|
Cbuf_AddText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,9 +897,9 @@ static void PF_cvar(void)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
str = G_STRING(GBL_PARM0);
|
str = G_String(GBL_PARM0);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = Cvar_VariableValue(str);
|
G_Float(GBL_RETURN) = Cvar_VariableValue(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -913,8 +913,8 @@ static void PF_cvar_set(void)
|
||||||
{
|
{
|
||||||
const char *var, *val;
|
const char *var, *val;
|
||||||
|
|
||||||
var = G_STRING(GBL_PARM0);
|
var = G_String(GBL_PARM0);
|
||||||
val = G_STRING(GBL_PARM1);
|
val = G_String(GBL_PARM1);
|
||||||
|
|
||||||
Cvar_Set(var, val);
|
Cvar_Set(var, val);
|
||||||
}
|
}
|
||||||
|
@ -938,22 +938,22 @@ static void PF_findradius(void)
|
||||||
|
|
||||||
chain = (edict_t *)sv.edicts;
|
chain = (edict_t *)sv.edicts;
|
||||||
|
|
||||||
org = G_VECTOR(GBL_PARM0);
|
org = G_Vector(GBL_PARM0);
|
||||||
rad = G_FLOAT(GBL_PARM1);
|
rad = G_Float(GBL_PARM1);
|
||||||
|
|
||||||
ent = NEXT_EDICT(sv.edicts);
|
ent = NextEdict(sv.edicts);
|
||||||
for(i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT(ent))
|
for(i = 1; i < sv.num_edicts; i++, ent = NextEdict(ent))
|
||||||
{
|
{
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(ent, ED_solid) == SOLID_NOT)
|
if(ED_Float(ent, ED_solid) == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
for(j = 0; j < 3; j++)
|
for(j = 0; j < 3; j++)
|
||||||
eorg[j] = org[j] - (ED_VECTOR(ent, ED_origin)[j] + (ED_VECTOR(ent, ED_mins)[j] + ED_VECTOR(ent, ED_maxs)[j]) * 0.5);
|
eorg[j] = org[j] - (ED_Vector(ent, ED_origin)[j] + (ED_Vector(ent, ED_mins)[j] + ED_Vector(ent, ED_maxs)[j]) * 0.5);
|
||||||
if(VectorLength(eorg) > rad)
|
if(VectorLength(eorg) > rad)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ED_PEDICT(ent, ED_chain) = EDICT_TO_PROG(chain);
|
ED_PEdict(ent, ED_chain) = EdictProg(chain);
|
||||||
chain = ent;
|
chain = ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,20 +975,20 @@ static void PF_ftos(void)
|
||||||
float v;
|
float v;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
v = G_FLOAT(GBL_PARM0);
|
v = G_Float(GBL_PARM0);
|
||||||
s = PR_GetTempString();
|
s = PR_GetTempString();
|
||||||
if(v == (int32_t)v)
|
if(v == (int32_t)v)
|
||||||
sprintf(s, "%" PRIi32 "", (int32_t)v);
|
sprintf(s, "%" PRIi32, (int32_t)v);
|
||||||
else
|
else
|
||||||
sprintf(s, "%5.1f", v);
|
sprintf(s, "%5.1f", v);
|
||||||
G_RSTRING(GBL_RETURN) = PR_SetEngineString(s);
|
G_RString(GBL_RETURN) = PR_SetEngineString(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_fabs(void)
|
static void PF_fabs(void)
|
||||||
{
|
{
|
||||||
float v;
|
float v;
|
||||||
v = G_FLOAT(GBL_PARM0);
|
v = G_Float(GBL_PARM0);
|
||||||
G_FLOAT(GBL_RETURN) = fabs(v);
|
G_Float(GBL_RETURN) = fabs(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_vtos(void)
|
static void PF_vtos(void)
|
||||||
|
@ -996,8 +996,8 @@ static void PF_vtos(void)
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = PR_GetTempString();
|
s = PR_GetTempString();
|
||||||
sprintf(s, "'%5.1f %5.1f %5.1f'", G_VECTOR(GBL_PARM0)[0], G_VECTOR(GBL_PARM0)[1], G_VECTOR(GBL_PARM0)[2]);
|
sprintf(s, "'%5.1f %5.1f %5.1f'", G_Vector(GBL_PARM0)[0], G_Vector(GBL_PARM0)[1], G_Vector(GBL_PARM0)[2]);
|
||||||
G_RSTRING(GBL_RETURN) = PR_SetEngineString(s);
|
G_RString(GBL_RETURN) = PR_SetEngineString(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_spawn(void)
|
static void PF_spawn(void)
|
||||||
|
@ -1013,7 +1013,7 @@ static void PF_remove(void)
|
||||||
{
|
{
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
|
||||||
ed = G_EDICT(GBL_PARM0);
|
ed = G_Edict(GBL_PARM0);
|
||||||
ED_Free(ed);
|
ED_Free(ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,18 +1026,18 @@ static void PF_find(void)
|
||||||
const char *s, *t;
|
const char *s, *t;
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
|
||||||
e = G_EDICTNUM(GBL_PARM0);
|
e = G_EdictNum(GBL_PARM0);
|
||||||
f = G_PFIELD(GBL_PARM1);
|
f = G_PField(GBL_PARM1);
|
||||||
s = G_STRING(GBL_PARM2);
|
s = G_String(GBL_PARM2);
|
||||||
if(!s)
|
if(!s)
|
||||||
PR_RunError("PF_find: bad search string");
|
PR_RunError("PF_find: bad search string");
|
||||||
|
|
||||||
for(e++ ; e < sv.num_edicts ; e++)
|
for(e++ ; e < sv.num_edicts ; e++)
|
||||||
{
|
{
|
||||||
ed = EDICT_NUM(e);
|
ed = EdictNum(e);
|
||||||
if(ed->free)
|
if(ed->free)
|
||||||
continue;
|
continue;
|
||||||
t = ED_STRING(ed, f);
|
t = ED_String(ed, f);
|
||||||
if(!t)
|
if(!t)
|
||||||
continue;
|
continue;
|
||||||
if(!strcmp(t, s))
|
if(!strcmp(t, s))
|
||||||
|
@ -1059,7 +1059,7 @@ static void PR_CheckEmptyString(const char *s)
|
||||||
static void PF_precache_file(void)
|
static void PF_precache_file(void)
|
||||||
{
|
{
|
||||||
// precache_file is only used to copy files with qcc, it does nothing
|
// precache_file is only used to copy files with qcc, it does nothing
|
||||||
G_RSTRING(GBL_RETURN) = G_RSTRING(GBL_PARM0);
|
G_RString(GBL_RETURN) = G_RString(GBL_PARM0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_precache_sound(void)
|
static void PF_precache_sound(void)
|
||||||
|
@ -1070,8 +1070,8 @@ static void PF_precache_sound(void)
|
||||||
if(sv.state != ss_loading)
|
if(sv.state != ss_loading)
|
||||||
PR_RunError("PF_Precache_*: Precache can only be done in spawn functions");
|
PR_RunError("PF_Precache_*: Precache can only be done in spawn functions");
|
||||||
|
|
||||||
s = G_STRING(GBL_PARM0);
|
s = G_String(GBL_PARM0);
|
||||||
G_RSTRING(GBL_RETURN) = G_RSTRING(GBL_PARM0);
|
G_RString(GBL_RETURN) = G_RString(GBL_PARM0);
|
||||||
PR_CheckEmptyString(s);
|
PR_CheckEmptyString(s);
|
||||||
|
|
||||||
for(i = 0; i < MAX_SOUNDS; i++)
|
for(i = 0; i < MAX_SOUNDS; i++)
|
||||||
|
@ -1095,8 +1095,8 @@ static void PF_precache_model(void)
|
||||||
if(sv.state != ss_loading)
|
if(sv.state != ss_loading)
|
||||||
PR_RunError("PF_Precache_*: Precache can only be done in spawn functions");
|
PR_RunError("PF_Precache_*: Precache can only be done in spawn functions");
|
||||||
|
|
||||||
s = G_STRING(GBL_PARM0);
|
s = G_String(GBL_PARM0);
|
||||||
G_RSTRING(GBL_RETURN) = G_RSTRING(GBL_PARM0);
|
G_RString(GBL_RETURN) = G_RString(GBL_PARM0);
|
||||||
PR_CheckEmptyString(s);
|
PR_CheckEmptyString(s);
|
||||||
|
|
||||||
for(i = 0; i < MAX_MODELS; i++)
|
for(i = 0; i < MAX_MODELS; i++)
|
||||||
|
@ -1131,7 +1131,7 @@ static void PF_traceoff(void)
|
||||||
|
|
||||||
static void PF_eprint(void)
|
static void PF_eprint(void)
|
||||||
{
|
{
|
||||||
ED_PrintNum(G_EDICTNUM(GBL_PARM0));
|
ED_PrintNum(G_EdictNum(GBL_PARM0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1149,13 +1149,13 @@ static void PF_walkmove(void)
|
||||||
dfunction_t *oldf;
|
dfunction_t *oldf;
|
||||||
int32_t oldself;
|
int32_t oldself;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ent = ProgEdict(G_PEdict(GBL_self));
|
||||||
yaw = G_FLOAT(GBL_PARM0);
|
yaw = G_Float(GBL_PARM0);
|
||||||
dist = G_FLOAT(GBL_PARM1);
|
dist = G_Float(GBL_PARM1);
|
||||||
|
|
||||||
if(!((int32_t)ED_FLOAT(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
if(!((int32_t)ED_Float(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
||||||
{
|
{
|
||||||
G_FLOAT(GBL_RETURN) = 0;
|
G_Float(GBL_RETURN) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1167,14 +1167,14 @@ static void PF_walkmove(void)
|
||||||
|
|
||||||
// save program state, because SV_movestep may call other functions
|
// save program state, because SV_movestep may call other functions
|
||||||
oldf = pr_xfunction;
|
oldf = pr_xfunction;
|
||||||
oldself = G_PEDICT(GBL_self);
|
oldself = G_PEdict(GBL_self);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = SV_movestep(ent, move, true);
|
G_Float(GBL_RETURN) = SV_movestep(ent, move, true);
|
||||||
|
|
||||||
|
|
||||||
// restore program state
|
// restore program state
|
||||||
pr_xfunction = oldf;
|
pr_xfunction = oldf;
|
||||||
G_PEDICT(GBL_self) = oldself;
|
G_PEdict(GBL_self) = oldself;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1190,22 +1190,22 @@ static void PF_droptofloor(void)
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ent = ProgEdict(G_PEdict(GBL_self));
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), end);
|
VectorCopy(ED_Vector(ent, ED_origin), end);
|
||||||
end[2] -= 256;
|
end[2] -= 256;
|
||||||
|
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, false, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, false, ent);
|
||||||
|
|
||||||
if(trace.fraction == 1 || trace.allsolid)
|
if(trace.fraction == 1 || trace.allsolid)
|
||||||
G_FLOAT(GBL_RETURN) = 0;
|
G_Float(GBL_RETURN) = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VectorCopy(trace.endpos, ED_VECTOR(ent, ED_origin));
|
VectorCopy(trace.endpos, ED_Vector(ent, ED_origin));
|
||||||
SV_LinkEdict(ent, false);
|
SV_LinkEdict(ent, false);
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) | FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) | FL_ONGROUND;
|
||||||
ED_PEDICT(ent, ED_groundentity) = EDICT_TO_PROG(trace.ent);
|
ED_PEdict(ent, ED_groundentity) = EdictProg(trace.ent);
|
||||||
G_FLOAT(GBL_RETURN) = 1;
|
G_Float(GBL_RETURN) = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,8 +1223,8 @@ static void PF_lightstyle(void)
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
style = G_FLOAT(GBL_PARM0);
|
style = G_Float(GBL_PARM0);
|
||||||
val = G_STRING(GBL_PARM1);
|
val = G_String(GBL_PARM1);
|
||||||
|
|
||||||
// bounds check to avoid clobbering sv struct
|
// bounds check to avoid clobbering sv struct
|
||||||
if(style < 0 || style >= MAX_LIGHTSTYLES)
|
if(style < 0 || style >= MAX_LIGHTSTYLES)
|
||||||
|
@ -1254,21 +1254,21 @@ static void PF_lightstyle(void)
|
||||||
static void PF_rint(void)
|
static void PF_rint(void)
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
f = G_FLOAT(GBL_PARM0);
|
f = G_Float(GBL_PARM0);
|
||||||
if(f > 0)
|
if(f > 0)
|
||||||
G_FLOAT(GBL_RETURN) = (int32_t)(f + 0.5);
|
G_Float(GBL_RETURN) = (int32_t)(f + 0.5);
|
||||||
else
|
else
|
||||||
G_FLOAT(GBL_RETURN) = (int32_t)(f - 0.5);
|
G_Float(GBL_RETURN) = (int32_t)(f - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_floor(void)
|
static void PF_floor(void)
|
||||||
{
|
{
|
||||||
G_FLOAT(GBL_RETURN) = floor(G_FLOAT(GBL_PARM0));
|
G_Float(GBL_RETURN) = floor(G_Float(GBL_PARM0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_ceil(void)
|
static void PF_ceil(void)
|
||||||
{
|
{
|
||||||
G_FLOAT(GBL_RETURN) = ceil(G_FLOAT(GBL_PARM0));
|
G_Float(GBL_RETURN) = ceil(G_Float(GBL_PARM0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1281,9 +1281,9 @@ static void PF_checkbottom(void)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
ent = G_EDICT(GBL_PARM0);
|
ent = G_Edict(GBL_PARM0);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = SV_CheckBottom(ent);
|
G_Float(GBL_RETURN) = SV_CheckBottom(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1295,9 +1295,9 @@ static void PF_pointcontents(void)
|
||||||
{
|
{
|
||||||
float *v;
|
float *v;
|
||||||
|
|
||||||
v = G_VECTOR(GBL_PARM0);
|
v = G_Vector(GBL_PARM0);
|
||||||
|
|
||||||
G_FLOAT(GBL_RETURN) = SV_PointContents(v);
|
G_Float(GBL_RETURN) = SV_PointContents(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1312,7 +1312,7 @@ static void PF_nextent(void)
|
||||||
int32_t i;
|
int32_t i;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
i = G_EDICTNUM(GBL_PARM0);
|
i = G_EdictNum(GBL_PARM0);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
@ -1321,7 +1321,7 @@ static void PF_nextent(void)
|
||||||
RETURN_EDICT(sv.edicts);
|
RETURN_EDICT(sv.edicts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ent = EDICT_NUM(i);
|
ent = EdictNum(i);
|
||||||
if(!ent->free)
|
if(!ent->free)
|
||||||
{
|
{
|
||||||
RETURN_EDICT(ent);
|
RETURN_EDICT(ent);
|
||||||
|
@ -1348,20 +1348,20 @@ static void PF_aim(void)
|
||||||
float dist, bestdist;
|
float dist, bestdist;
|
||||||
float speed;
|
float speed;
|
||||||
|
|
||||||
ent = G_EDICT(GBL_PARM0);
|
ent = G_Edict(GBL_PARM0);
|
||||||
speed = G_FLOAT(GBL_PARM1);
|
speed = G_Float(GBL_PARM1);
|
||||||
(void) speed; /* variable set but not used */
|
(void) speed; /* variable set but not used */
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), start);
|
VectorCopy(ED_Vector(ent, ED_origin), start);
|
||||||
start[2] += 20;
|
start[2] += 20;
|
||||||
|
|
||||||
// try sending a trace straight
|
// try sending a trace straight
|
||||||
VectorCopy(G_VECTOR(GBL_v_forward), dir);
|
VectorCopy(G_Vector(GBL_v_forward), dir);
|
||||||
VectorMA(start, 2048, dir, end);
|
VectorMA(start, 2048, dir, end);
|
||||||
tr = SV_Move(start, vec3_origin, vec3_origin, end, false, ent);
|
tr = SV_Move(start, vec3_origin, vec3_origin, end, false, ent);
|
||||||
if(tr.ent && ED_FLOAT(tr.ent, ED_takedamage) == DAMAGE_AIM && (!teamplay.value || ED_FLOAT(ent, ED_team) <= 0 || ED_FLOAT(ent, ED_team) != ED_FLOAT(tr.ent, ED_team)))
|
if(tr.ent && ED_Float(tr.ent, ED_takedamage) == DAMAGE_AIM && (!teamplay.value || ED_Float(ent, ED_team) <= 0 || ED_Float(ent, ED_team) != ED_Float(tr.ent, ED_team)))
|
||||||
{
|
{
|
||||||
VectorCopy(G_VECTOR(GBL_v_forward), G_VECTOR(GBL_RETURN));
|
VectorCopy(G_Vector(GBL_v_forward), G_Vector(GBL_RETURN));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,20 +1370,20 @@ static void PF_aim(void)
|
||||||
bestdist = sv_aim.value;
|
bestdist = sv_aim.value;
|
||||||
bestent = NULL;
|
bestent = NULL;
|
||||||
|
|
||||||
check = NEXT_EDICT(sv.edicts);
|
check = NextEdict(sv.edicts);
|
||||||
for(i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT(check))
|
for(i = 1; i < sv.num_edicts; i++, check = NextEdict(check))
|
||||||
{
|
{
|
||||||
if(ED_FLOAT(check, ED_takedamage) != DAMAGE_AIM)
|
if(ED_Float(check, ED_takedamage) != DAMAGE_AIM)
|
||||||
continue;
|
continue;
|
||||||
if(check == ent)
|
if(check == ent)
|
||||||
continue;
|
continue;
|
||||||
if(teamplay.value && ED_FLOAT(ent, ED_team) > 0 && ED_FLOAT(ent, ED_team) == ED_FLOAT(check, ED_team))
|
if(teamplay.value && ED_Float(ent, ED_team) > 0 && ED_Float(ent, ED_team) == ED_Float(check, ED_team))
|
||||||
continue; // don't aim at teammate
|
continue; // don't aim at teammate
|
||||||
for(j = 0; j < 3; j++)
|
for(j = 0; j < 3; j++)
|
||||||
end[j] = ED_VECTOR(check, ED_origin)[j] + 0.5 * (ED_VECTOR(check, ED_mins)[j] + ED_VECTOR(check, ED_maxs)[j]);
|
end[j] = ED_Vector(check, ED_origin)[j] + 0.5 * (ED_Vector(check, ED_mins)[j] + ED_Vector(check, ED_maxs)[j]);
|
||||||
VectorSubtract(end, start, dir);
|
VectorSubtract(end, start, dir);
|
||||||
VectorNormalize(dir);
|
VectorNormalize(dir);
|
||||||
dist = DotProduct(dir, G_VECTOR(GBL_v_forward));
|
dist = DotProduct(dir, G_Vector(GBL_v_forward));
|
||||||
if(dist < bestdist)
|
if(dist < bestdist)
|
||||||
continue; // to far to turn
|
continue; // to far to turn
|
||||||
tr = SV_Move(start, vec3_origin, vec3_origin, end, false, ent);
|
tr = SV_Move(start, vec3_origin, vec3_origin, end, false, ent);
|
||||||
|
@ -1397,16 +1397,16 @@ static void PF_aim(void)
|
||||||
|
|
||||||
if(bestent)
|
if(bestent)
|
||||||
{
|
{
|
||||||
VectorSubtract(ED_VECTOR(bestent, ED_origin), ED_VECTOR(ent, ED_origin), dir);
|
VectorSubtract(ED_Vector(bestent, ED_origin), ED_Vector(ent, ED_origin), dir);
|
||||||
dist = DotProduct(dir, G_VECTOR(GBL_v_forward));
|
dist = DotProduct(dir, G_Vector(GBL_v_forward));
|
||||||
VectorScale(G_VECTOR(GBL_v_forward), dist, end);
|
VectorScale(G_Vector(GBL_v_forward), dist, end);
|
||||||
end[2] = dir[2];
|
end[2] = dir[2];
|
||||||
VectorNormalize(end);
|
VectorNormalize(end);
|
||||||
VectorCopy(end, G_VECTOR(GBL_RETURN));
|
VectorCopy(end, G_Vector(GBL_RETURN));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VectorCopy(bestdir, G_VECTOR(GBL_RETURN));
|
VectorCopy(bestdir, G_Vector(GBL_RETURN));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,10 +1422,10 @@ void PF_changeyaw(void)
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
float ideal, current, move, speed;
|
float ideal, current, move, speed;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ent = ProgEdict(G_PEdict(GBL_self));
|
||||||
current = anglemod(ED_VECTOR(ent, ED_angles)[1]);
|
current = anglemod(ED_Vector(ent, ED_angles)[1]);
|
||||||
ideal = ED_FLOAT(ent, ED_ideal_yaw);
|
ideal = ED_Float(ent, ED_ideal_yaw);
|
||||||
speed = ED_FLOAT(ent, ED_yaw_speed);
|
speed = ED_Float(ent, ED_yaw_speed);
|
||||||
|
|
||||||
if(current == ideal)
|
if(current == ideal)
|
||||||
return;
|
return;
|
||||||
|
@ -1451,7 +1451,7 @@ void PF_changeyaw(void)
|
||||||
move = -speed;
|
move = -speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
ED_VECTOR(ent, ED_angles)[1] = anglemod(current + move);
|
ED_Vector(ent, ED_angles)[1] = anglemod(current + move);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1468,15 +1468,15 @@ static sizebuf_t *WriteDest(void)
|
||||||
int32_t dest;
|
int32_t dest;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
dest = G_FLOAT(GBL_PARM0);
|
dest = G_Float(GBL_PARM0);
|
||||||
switch(dest)
|
switch(dest)
|
||||||
{
|
{
|
||||||
case MSG_BROADCAST:
|
case MSG_BROADCAST:
|
||||||
return &sv.datagram;
|
return &sv.datagram;
|
||||||
|
|
||||||
case MSG_ONE:
|
case MSG_ONE:
|
||||||
ent = PROG_TO_EDICT(G_PEDICT(GBL_msg_entity));
|
ent = ProgEdict(G_PEdict(GBL_msg_entity));
|
||||||
entnum = NUM_FOR_EDICT(ent);
|
entnum = NumForEdict(ent);
|
||||||
if(entnum < 1 || entnum > svs.maxclients)
|
if(entnum < 1 || entnum > svs.maxclients)
|
||||||
PR_RunError("WriteDest: not a client");
|
PR_RunError("WriteDest: not a client");
|
||||||
return &svs.clients[entnum - 1].message;
|
return &svs.clients[entnum - 1].message;
|
||||||
|
@ -1497,42 +1497,42 @@ static sizebuf_t *WriteDest(void)
|
||||||
|
|
||||||
static void PF_WriteByte(void)
|
static void PF_WriteByte(void)
|
||||||
{
|
{
|
||||||
MSG_WriteByte(WriteDest(), G_FLOAT(GBL_PARM1));
|
MSG_WriteByte(WriteDest(), G_Float(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteChar(void)
|
static void PF_WriteChar(void)
|
||||||
{
|
{
|
||||||
MSG_WriteChar(WriteDest(), G_FLOAT(GBL_PARM1));
|
MSG_WriteChar(WriteDest(), G_Float(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteShort(void)
|
static void PF_WriteShort(void)
|
||||||
{
|
{
|
||||||
MSG_WriteShort(WriteDest(), G_FLOAT(GBL_PARM1));
|
MSG_WriteShort(WriteDest(), G_Float(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteLong(void)
|
static void PF_WriteLong(void)
|
||||||
{
|
{
|
||||||
MSG_WriteLong(WriteDest(), G_FLOAT(GBL_PARM1));
|
MSG_WriteLong(WriteDest(), G_Float(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteAngle(void)
|
static void PF_WriteAngle(void)
|
||||||
{
|
{
|
||||||
MSG_WriteAngle(WriteDest(), G_FLOAT(GBL_PARM1), sv.protocolflags);
|
MSG_WriteAngle(WriteDest(), G_Float(GBL_PARM1), sv.protocolflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteCoord(void)
|
static void PF_WriteCoord(void)
|
||||||
{
|
{
|
||||||
MSG_WriteCoord(WriteDest(), G_FLOAT(GBL_PARM1), sv.protocolflags);
|
MSG_WriteCoord(WriteDest(), G_Float(GBL_PARM1), sv.protocolflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteString(void)
|
static void PF_WriteString(void)
|
||||||
{
|
{
|
||||||
MSG_WriteString(WriteDest(), G_STRING(GBL_PARM1));
|
MSG_WriteString(WriteDest(), G_String(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PF_WriteEntity(void)
|
static void PF_WriteEntity(void)
|
||||||
{
|
{
|
||||||
MSG_WriteShort(WriteDest(), G_EDICTNUM(GBL_PARM1));
|
MSG_WriteShort(WriteDest(), G_EdictNum(GBL_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -1543,7 +1543,7 @@ static void PF_makestatic(void)
|
||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE
|
int32_t bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
|
|
||||||
ent = G_EDICT(GBL_PARM0);
|
ent = G_Edict(GBL_PARM0);
|
||||||
|
|
||||||
//johnfitz -- don't send invisible static entities
|
//johnfitz -- don't send invisible static entities
|
||||||
if(ent->alpha == ENTALPHA_ZERO)
|
if(ent->alpha == ENTALPHA_ZERO)
|
||||||
|
@ -1556,7 +1556,7 @@ static void PF_makestatic(void)
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
if(sv.protocol == PROTOCOL_NETQUAKE)
|
if(sv.protocol == PROTOCOL_NETQUAKE)
|
||||||
{
|
{
|
||||||
if(SV_ModelIndex(ED_STRING(ent, ED_model)) & 0xFF00 || (int32_t)(ED_FLOAT(ent, ED_frame)) & 0xFF00)
|
if(SV_ModelIndex(ED_String(ent, ED_model)) & 0xFF00 || (int32_t)(ED_Float(ent, ED_frame)) & 0xFF00)
|
||||||
{
|
{
|
||||||
ED_Free(ent);
|
ED_Free(ent);
|
||||||
return; //can't display the correct model & frame, so don't show it at all
|
return; //can't display the correct model & frame, so don't show it at all
|
||||||
|
@ -1564,9 +1564,9 @@ static void PF_makestatic(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(SV_ModelIndex(ED_STRING(ent, ED_model)) & 0xFF00)
|
if(SV_ModelIndex(ED_String(ent, ED_model)) & 0xFF00)
|
||||||
bits |= B_LARGEMODEL;
|
bits |= B_LARGEMODEL;
|
||||||
if((int32_t)(ED_FLOAT(ent, ED_frame)) & 0xFF00)
|
if((int32_t)(ED_Float(ent, ED_frame)) & 0xFF00)
|
||||||
bits |= B_LARGEFRAME;
|
bits |= B_LARGEFRAME;
|
||||||
if(ent->alpha != ENTALPHA_DEFAULT)
|
if(ent->alpha != ENTALPHA_DEFAULT)
|
||||||
bits |= B_ALPHA;
|
bits |= B_ALPHA;
|
||||||
|
@ -1581,22 +1581,22 @@ static void PF_makestatic(void)
|
||||||
MSG_WriteByte(&sv.signon, svc_spawnstatic);
|
MSG_WriteByte(&sv.signon, svc_spawnstatic);
|
||||||
|
|
||||||
if(bits & B_LARGEMODEL)
|
if(bits & B_LARGEMODEL)
|
||||||
MSG_WriteShort(&sv.signon, SV_ModelIndex(ED_STRING(ent, ED_model)));
|
MSG_WriteShort(&sv.signon, SV_ModelIndex(ED_String(ent, ED_model)));
|
||||||
else
|
else
|
||||||
MSG_WriteByte(&sv.signon, SV_ModelIndex(ED_STRING(ent, ED_model)));
|
MSG_WriteByte(&sv.signon, SV_ModelIndex(ED_String(ent, ED_model)));
|
||||||
|
|
||||||
if(bits & B_LARGEFRAME)
|
if(bits & B_LARGEFRAME)
|
||||||
MSG_WriteShort(&sv.signon, ED_FLOAT(ent, ED_frame));
|
MSG_WriteShort(&sv.signon, ED_Float(ent, ED_frame));
|
||||||
else
|
else
|
||||||
MSG_WriteByte(&sv.signon, ED_FLOAT(ent, ED_frame));
|
MSG_WriteByte(&sv.signon, ED_Float(ent, ED_frame));
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
MSG_WriteByte(&sv.signon, ED_FLOAT(ent, ED_colormap));
|
MSG_WriteByte(&sv.signon, ED_Float(ent, ED_colormap));
|
||||||
MSG_WriteByte(&sv.signon, ED_FLOAT(ent, ED_skin));
|
MSG_WriteByte(&sv.signon, ED_Float(ent, ED_skin));
|
||||||
for(i = 0; i < 3; i++)
|
for(i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
MSG_WriteCoord(&sv.signon, ED_VECTOR(ent, ED_origin)[i], sv.protocolflags);
|
MSG_WriteCoord(&sv.signon, ED_Vector(ent, ED_origin)[i], sv.protocolflags);
|
||||||
MSG_WriteAngle(&sv.signon, ED_VECTOR(ent, ED_angles)[i], sv.protocolflags);
|
MSG_WriteAngle(&sv.signon, ED_Vector(ent, ED_angles)[i], sv.protocolflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
|
@ -1621,8 +1621,8 @@ static void PF_setspawnparms(void)
|
||||||
int32_t i;
|
int32_t i;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
|
||||||
ent = G_EDICT(GBL_PARM0);
|
ent = G_Edict(GBL_PARM0);
|
||||||
i = NUM_FOR_EDICT(ent);
|
i = NumForEdict(ent);
|
||||||
if(i < 1 || i > svs.maxclients)
|
if(i < 1 || i > svs.maxclients)
|
||||||
PR_RunError("Entity is not a client");
|
PR_RunError("Entity is not a client");
|
||||||
|
|
||||||
|
@ -1630,7 +1630,7 @@ static void PF_setspawnparms(void)
|
||||||
client = svs.clients + (i - 1);
|
client = svs.clients + (i - 1);
|
||||||
|
|
||||||
for(i = 0; i < NUM_SPAWN_PARMS; i++)
|
for(i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
(&G_FLOAT(GBL_parm1))[i] = client->spawn_parms[i];
|
(&G_Float(GBL_parm1))[i] = client->spawn_parms[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1647,7 +1647,7 @@ static void PF_changelevel(void)
|
||||||
return;
|
return;
|
||||||
svs.changelevel_issued = true;
|
svs.changelevel_issued = true;
|
||||||
|
|
||||||
s = G_STRING(GBL_PARM0);
|
s = G_String(GBL_PARM0);
|
||||||
Cbuf_AddText(va("changelevel %s\n", s));
|
Cbuf_AddText(va("changelevel %s\n", s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ edict_t *ED_Alloc(void)
|
||||||
|
|
||||||
for(i = svs.maxclients + 1; i < sv.num_edicts; i++)
|
for(i = svs.maxclients + 1; i < sv.num_edicts; i++)
|
||||||
{
|
{
|
||||||
e = EDICT_NUM(i);
|
e = EdictNum(i);
|
||||||
// the first couple seconds of server time can involve a lot of
|
// the first couple seconds of server time can involve a lot of
|
||||||
// freeing and allocating, so relax the replacement policy
|
// freeing and allocating, so relax the replacement policy
|
||||||
if(e->free && (e->freetime < 2 || sv.time - e->freetime > 0.5))
|
if(e->free && (e->freetime < 2 || sv.time - e->freetime > 0.5))
|
||||||
|
@ -107,7 +107,7 @@ edict_t *ED_Alloc(void)
|
||||||
Host_Error("ED_Alloc: no free edicts (max_edicts is %" PRIi32 ")", sv.max_edicts);
|
Host_Error("ED_Alloc: no free edicts (max_edicts is %" PRIi32 ")", sv.max_edicts);
|
||||||
|
|
||||||
sv.num_edicts++;
|
sv.num_edicts++;
|
||||||
e = EDICT_NUM(i);
|
e = EdictNum(i);
|
||||||
memset(e, 0, pr_edict_size); // ericw -- switched sv.edicts to malloc(), so we are accessing uninitialized memory and must fully zero it, not just ED_ClearEdict
|
memset(e, 0, pr_edict_size); // ericw -- switched sv.edicts to malloc(), so we are accessing uninitialized memory and must fully zero it, not just ED_ClearEdict
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
|
@ -126,16 +126,16 @@ void ED_Free(edict_t *ed)
|
||||||
SV_UnlinkEdict(ed); // unlink from world bsp
|
SV_UnlinkEdict(ed); // unlink from world bsp
|
||||||
|
|
||||||
ed->free = true;
|
ed->free = true;
|
||||||
ED_RSTRING(ed, ED_model) = 0;
|
ED_RString(ed, ED_model) = 0;
|
||||||
ED_FLOAT(ed, ED_takedamage) = 0;
|
ED_Float(ed, ED_takedamage) = 0;
|
||||||
ED_FLOAT(ed, ED_modelindex) = 0;
|
ED_Float(ed, ED_modelindex) = 0;
|
||||||
ED_FLOAT(ed, ED_colormap) = 0;
|
ED_Float(ed, ED_colormap) = 0;
|
||||||
ED_FLOAT(ed, ED_skin) = 0;
|
ED_Float(ed, ED_skin) = 0;
|
||||||
ED_FLOAT(ed, ED_frame) = 0;
|
ED_Float(ed, ED_frame) = 0;
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ed, ED_origin));
|
VectorCopy(vec3_origin, ED_Vector(ed, ED_origin));
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ed, ED_angles));
|
VectorCopy(vec3_origin, ED_Vector(ed, ED_angles));
|
||||||
ED_FLOAT(ed, ED_nextthink) = -1;
|
ED_Float(ed, ED_nextthink) = -1;
|
||||||
ED_FLOAT(ed, ED_solid) = 0;
|
ED_Float(ed, ED_solid) = 0;
|
||||||
ed->alpha = ENTALPHA_DEFAULT; //johnfitz -- reset alpha for next entity
|
ed->alpha = ENTALPHA_DEFAULT; //johnfitz -- reset alpha for next entity
|
||||||
|
|
||||||
ed->freetime = sv.time;
|
ed->freetime = sv.time;
|
||||||
|
@ -273,7 +273,7 @@ done:
|
||||||
if(!def)
|
if(!def)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ED_EVAL(ed, def->ofs);
|
return ED_Eval(ed, def->ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void ED_Print(edict_t *ed)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_SafePrintf("\nEDICT %" PRIi32 ":\n", NUM_FOR_EDICT(ed)); //johnfitz -- was Con_Printf
|
Con_SafePrintf("\nEDICT %" PRIi32 ":\n", NumForEdict(ed)); //johnfitz -- was Con_Printf
|
||||||
for(i = 1; i < progs.numfielddefs; i++)
|
for(i = 1; i < progs.numfielddefs; i++)
|
||||||
{
|
{
|
||||||
d = &pr_fielddefs[i];
|
d = &pr_fielddefs[i];
|
||||||
|
@ -307,7 +307,7 @@ void ED_Print(edict_t *ed)
|
||||||
if(l > 1 && name[l - 2] == '_')
|
if(l > 1 && name[l - 2] == '_')
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = &ED_INT(ed, d->ofs);
|
v = &ED_Int(ed, d->ofs);
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
type = d->type & ~DEF_SAVEGLOBAL;
|
type = d->type & ~DEF_SAVEGLOBAL;
|
||||||
|
@ -358,7 +358,7 @@ void ED_Write(FILE *f, edict_t *ed)
|
||||||
if(j > 1 && name[j - 2] == '_')
|
if(j > 1 && name[j - 2] == '_')
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = &ED_INT(ed, d->ofs);
|
v = &ED_Int(ed, d->ofs);
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
type = d->type & ~DEF_SAVEGLOBAL;
|
type = d->type & ~DEF_SAVEGLOBAL;
|
||||||
|
@ -384,7 +384,7 @@ void ED_Write(FILE *f, edict_t *ed)
|
||||||
|
|
||||||
void ED_PrintNum(int32_t ent)
|
void ED_PrintNum(int32_t ent)
|
||||||
{
|
{
|
||||||
ED_Print(EDICT_NUM(ent));
|
ED_Print(EdictNum(ent));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -447,15 +447,15 @@ static void ED_Count(void)
|
||||||
active = models = solid = step = 0;
|
active = models = solid = step = 0;
|
||||||
for(i = 0; i < sv.num_edicts; i++)
|
for(i = 0; i < sv.num_edicts; i++)
|
||||||
{
|
{
|
||||||
ent = EDICT_NUM(i);
|
ent = EdictNum(i);
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
continue;
|
continue;
|
||||||
active++;
|
active++;
|
||||||
if(ED_FLOAT(ent, ED_solid))
|
if(ED_Float(ent, ED_solid))
|
||||||
solid++;
|
solid++;
|
||||||
if(ED_RSTRING(ent, ED_model))
|
if(ED_RString(ent, ED_model))
|
||||||
models++;
|
models++;
|
||||||
if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_STEP)
|
if(ED_Float(ent, ED_movetype) == MOVETYPE_STEP)
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ void ED_WriteGlobals(FILE *f)
|
||||||
|
|
||||||
name = PR_GetString(def->s_name);
|
name = PR_GetString(def->s_name);
|
||||||
fprintf(f, "\"%s\" ", name);
|
fprintf(f, "\"%s\" ", name);
|
||||||
fprintf(f, "\"%s\"\n", PR_UglyValueString(type, G_EVAL(def->ofs)));
|
fprintf(f, "\"%s\"\n", PR_UglyValueString(type, G_Eval(def->ofs)));
|
||||||
}
|
}
|
||||||
fprintf(f, "}\n");
|
fprintf(f, "}\n");
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ bool ED_ParseEpair(void *base, ddef_t *key, const char *s)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
*(int32_t *)d = EDICT_TO_PROG(EDICT_NUM(atoi(s)));
|
*(int32_t *)d = EdictProg(EdictNum(atoi(s)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_field:
|
case ev_field:
|
||||||
|
@ -649,7 +649,7 @@ bool ED_ParseEpair(void *base, ddef_t *key, const char *s)
|
||||||
Con_DPrintf("Can't find field %s\n", s);
|
Con_DPrintf("Can't find field %s\n", s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*(int32_t *)d = G_INT(def->ofs);
|
*(int32_t *)d = G_Int(def->ofs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_function:
|
case ev_function:
|
||||||
|
@ -792,7 +792,7 @@ void ED_LoadFromFile(const char *data)
|
||||||
edict_t *ent = NULL;
|
edict_t *ent = NULL;
|
||||||
int32_t inhibit = 0;
|
int32_t inhibit = 0;
|
||||||
|
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
|
|
||||||
// parse ents
|
// parse ents
|
||||||
while(1)
|
while(1)
|
||||||
|
@ -805,7 +805,7 @@ void ED_LoadFromFile(const char *data)
|
||||||
Host_Error("ED_LoadFromFile: found %s when expecting {", com_token);
|
Host_Error("ED_LoadFromFile: found %s when expecting {", com_token);
|
||||||
|
|
||||||
if(!ent)
|
if(!ent)
|
||||||
ent = EDICT_NUM(0);
|
ent = EdictNum(0);
|
||||||
else
|
else
|
||||||
ent = ED_Alloc();
|
ent = ED_Alloc();
|
||||||
data = ED_ParseEdict(data, ent);
|
data = ED_ParseEdict(data, ent);
|
||||||
|
@ -813,16 +813,16 @@ void ED_LoadFromFile(const char *data)
|
||||||
// remove things from different skill levels or deathmatch
|
// remove things from different skill levels or deathmatch
|
||||||
if(deathmatch.value)
|
if(deathmatch.value)
|
||||||
{
|
{
|
||||||
if(((int32_t)ED_FLOAT(ent, ED_spawnflags) & SPAWNFLAG_NOT_DEATHMATCH))
|
if(((int32_t)ED_Float(ent, ED_spawnflags) & SPAWNFLAG_NOT_DEATHMATCH))
|
||||||
{
|
{
|
||||||
ED_Free(ent);
|
ED_Free(ent);
|
||||||
inhibit++;
|
inhibit++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((current_skill == 0 && ((int32_t)ED_FLOAT(ent, ED_spawnflags) & SPAWNFLAG_NOT_EASY))
|
else if((current_skill == 0 && ((int32_t)ED_Float(ent, ED_spawnflags) & SPAWNFLAG_NOT_EASY))
|
||||||
|| (current_skill == 1 && ((int32_t)ED_FLOAT(ent, ED_spawnflags) & SPAWNFLAG_NOT_MEDIUM))
|
|| (current_skill == 1 && ((int32_t)ED_Float(ent, ED_spawnflags) & SPAWNFLAG_NOT_MEDIUM))
|
||||||
|| (current_skill >= 2 && ((int32_t)ED_FLOAT(ent, ED_spawnflags) & SPAWNFLAG_NOT_HARD)))
|
|| (current_skill >= 2 && ((int32_t)ED_Float(ent, ED_spawnflags) & SPAWNFLAG_NOT_HARD)))
|
||||||
{
|
{
|
||||||
ED_Free(ent);
|
ED_Free(ent);
|
||||||
inhibit++;
|
inhibit++;
|
||||||
|
@ -832,7 +832,7 @@ void ED_LoadFromFile(const char *data)
|
||||||
//
|
//
|
||||||
// immediately call spawn function
|
// immediately call spawn function
|
||||||
//
|
//
|
||||||
if(!ED_RSTRING(ent, ED_classname))
|
if(!ED_RString(ent, ED_classname))
|
||||||
{
|
{
|
||||||
Con_SafePrintf("No classname for:\n"); //johnfitz -- was Con_Printf
|
Con_SafePrintf("No classname for:\n"); //johnfitz -- was Con_Printf
|
||||||
ED_Print(ent);
|
ED_Print(ent);
|
||||||
|
@ -841,7 +841,7 @@ void ED_LoadFromFile(const char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for the spawn function
|
// look for the spawn function
|
||||||
func = ED_FindFunction(ED_STRING(ent, ED_classname));
|
func = ED_FindFunction(ED_String(ent, ED_classname));
|
||||||
|
|
||||||
if(!func)
|
if(!func)
|
||||||
{
|
{
|
||||||
|
@ -851,7 +851,7 @@ void ED_LoadFromFile(const char *data)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_self) = EdictProg(ent);
|
||||||
PR_ExecuteProgram(func - pr_functions);
|
PR_ExecuteProgram(func - pr_functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,31 +874,31 @@ void ED_Init(void)
|
||||||
Cmd_AddCommand("edictcount", ED_Count);
|
Cmd_AddCommand("edictcount", ED_Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *EDICT_NUM(int32_t n)
|
edict_t *EdictNum(int32_t n)
|
||||||
{
|
{
|
||||||
if(n < 0 || n >= sv.max_edicts)
|
if(n < 0 || n >= sv.max_edicts)
|
||||||
Host_Error("EDICT_NUM: bad number %" PRIi32 "", n);
|
Host_Error("EdictNum: bad number %" PRIi32, n);
|
||||||
return PROG_TO_EDICT(n * pr_edict_size);
|
return ProgEdict(n * pr_edict_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t NUM_FOR_EDICT(edict_t *e)
|
int32_t NumForEdict(edict_t *e)
|
||||||
{
|
{
|
||||||
int32_t b;
|
int32_t b;
|
||||||
|
|
||||||
b = EDICT_TO_PROG(e);
|
b = EdictProg(e);
|
||||||
b = b / pr_edict_size;
|
b = b / pr_edict_size;
|
||||||
|
|
||||||
if(b < 0 || b >= sv.num_edicts)
|
if(b < 0 || b >= sv.num_edicts)
|
||||||
Host_Error("NUM_FOR_EDICT: bad pointer");
|
Host_Error("NumForEdict: bad pointer");
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
pedict_t EDICT_TO_PROG(void *e)
|
pedict_t EdictProg(void *e)
|
||||||
{
|
{
|
||||||
return (byte *)e - (byte *)sv.edicts;
|
return (byte *)e - (byte *)sv.edicts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *PROG_TO_EDICT(pedict_t e)
|
void *ProgEdict(pedict_t e)
|
||||||
{
|
{
|
||||||
return (byte *)sv.edicts + e;
|
return (byte *)sv.edicts + e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,18 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)(l) - offsetof(edict_t, area))
|
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)(l) - offsetof(edict_t, area))
|
||||||
|
|
||||||
#define ED_FLOAT(e, o) (((float *)((edict_t *)e)->fields)[o])
|
#define ED_Float(e, o) (((float *)((edict_t *)e)->fields)[o])
|
||||||
#define ED_INT(e, o) (((int32_t *)((edict_t *)e)->fields)[o])
|
#define ED_Int(e, o) (((int32_t *)((edict_t *)e)->fields)[o])
|
||||||
#define ED_EDICT(e, o) PROG_TO_EDICT(ED_INT(e, o))
|
#define ED_Edict(e, o) ProgEdict(ED_Int(e, o))
|
||||||
#define ED_EDICTNUM(e, o) NUM_FOR_EDICT(ED_EDICT(e, o))
|
#define ED_EdictNum(e, o) NumForEdict(ED_Edict(e, o))
|
||||||
#define ED_VECTOR(e, o) (&ED_FLOAT(e, o))
|
#define ED_Vector(e, o) (&ED_Float(e, o))
|
||||||
#define ED_STRING(e, o) PR_GetString(ED_RSTRING(e, o))
|
#define ED_String(e, o) PR_GetString(ED_RString(e, o))
|
||||||
#define ED_RSTRING(e, o) (*(string_t *)&ED_INT(e, o))
|
#define ED_RString(e, o) (*(string_t *)&ED_Int(e, o))
|
||||||
#define ED_FUNC(e, o) (*(func_t *)&ED_INT(e, o))
|
#define ED_Func(e, o) (*(func_t *)&ED_Int(e, o))
|
||||||
#define ED_PEDICT(e, o) (*(pedict_t *)&ED_INT(e, o))
|
#define ED_PEdict(e, o) (*(pedict_t *)&ED_Int(e, o))
|
||||||
#define ED_PFIELD(e, o) (*(pfield_t *)&ED_INT(e, o))
|
#define ED_PField(e, o) (*(pfield_t *)&ED_Int(e, o))
|
||||||
#define ED_EVAL(e, o) ((eval_t *)&ED_INT(e, o))
|
#define ED_Eval(e, o) ((eval_t *)&ED_Int(e, o))
|
||||||
#define ED_VOID(e, o) ((void *)&ED_INT(o))
|
#define ED_Void(e, o) ((void *)&ED_Int(o))
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -170,14 +170,14 @@ void ED_PrintNum(int32_t ent);
|
||||||
|
|
||||||
eval_t *GetEdictFieldValue(edict_t *ed, const char *field);
|
eval_t *GetEdictFieldValue(edict_t *ed, const char *field);
|
||||||
|
|
||||||
static inline edict_t *NEXT_EDICT(edict_t *e)
|
static inline edict_t *NextEdict(edict_t *e)
|
||||||
{
|
{
|
||||||
return (edict_t *)((byte *)e + pr_edict_size);
|
return (edict_t *)((byte *)e + pr_edict_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
pedict_t EDICT_TO_PROG(void *e);
|
pedict_t EdictProg(void *e);
|
||||||
void *PROG_TO_EDICT(pedict_t e);
|
void *ProgEdict(pedict_t e);
|
||||||
edict_t *EDICT_NUM(int32_t n);
|
edict_t *EdictNum(int32_t n);
|
||||||
int32_t NUM_FOR_EDICT(edict_t *e);
|
int32_t NumForEdict(edict_t *e);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
344
source/pr_exec.c
344
source/pr_exec.c
|
@ -42,91 +42,8 @@ int32_t pr_argc;
|
||||||
|
|
||||||
static const char *pr_opnames[] =
|
static const char *pr_opnames[] =
|
||||||
{
|
{
|
||||||
"DONE",
|
#define pr_ops__xmac(x) #x,
|
||||||
|
#include "pr_ops.h"
|
||||||
"MUL_F",
|
|
||||||
"MUL_V",
|
|
||||||
"MUL_FV",
|
|
||||||
"MUL_VF",
|
|
||||||
|
|
||||||
"DIV",
|
|
||||||
|
|
||||||
"ADD_F",
|
|
||||||
"ADD_V",
|
|
||||||
|
|
||||||
"SUB_F",
|
|
||||||
"SUB_V",
|
|
||||||
|
|
||||||
"EQ_F",
|
|
||||||
"EQ_V",
|
|
||||||
"EQ_S",
|
|
||||||
"EQ_E",
|
|
||||||
"EQ_FNC",
|
|
||||||
|
|
||||||
"NE_F",
|
|
||||||
"NE_V",
|
|
||||||
"NE_S",
|
|
||||||
"NE_E",
|
|
||||||
"NE_FNC",
|
|
||||||
|
|
||||||
"LE",
|
|
||||||
"GE",
|
|
||||||
"LT",
|
|
||||||
"GT",
|
|
||||||
|
|
||||||
"INDIRECT",
|
|
||||||
"INDIRECT",
|
|
||||||
"INDIRECT",
|
|
||||||
"INDIRECT",
|
|
||||||
"INDIRECT",
|
|
||||||
"INDIRECT",
|
|
||||||
|
|
||||||
"ADDRESS",
|
|
||||||
|
|
||||||
"STORE_F",
|
|
||||||
"STORE_V",
|
|
||||||
"STORE_S",
|
|
||||||
"STORE_ENT",
|
|
||||||
"STORE_FLD",
|
|
||||||
"STORE_FNC",
|
|
||||||
|
|
||||||
"STOREP_F",
|
|
||||||
"STOREP_V",
|
|
||||||
"STOREP_S",
|
|
||||||
"STOREP_ENT",
|
|
||||||
"STOREP_FLD",
|
|
||||||
"STOREP_FNC",
|
|
||||||
|
|
||||||
"RETURN",
|
|
||||||
|
|
||||||
"NOT_F",
|
|
||||||
"NOT_V",
|
|
||||||
"NOT_S",
|
|
||||||
"NOT_ENT",
|
|
||||||
"NOT_FNC",
|
|
||||||
|
|
||||||
"IF",
|
|
||||||
"IFNOT",
|
|
||||||
|
|
||||||
"CALL0",
|
|
||||||
"CALL1",
|
|
||||||
"CALL2",
|
|
||||||
"CALL3",
|
|
||||||
"CALL4",
|
|
||||||
"CALL5",
|
|
||||||
"CALL6",
|
|
||||||
"CALL7",
|
|
||||||
"CALL8",
|
|
||||||
|
|
||||||
"STATE",
|
|
||||||
|
|
||||||
"GOTO",
|
|
||||||
|
|
||||||
"AND",
|
|
||||||
"OR",
|
|
||||||
|
|
||||||
"BITAND",
|
|
||||||
"BITOR"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *PR_GlobalString(int32_t ofs);
|
const char *PR_GlobalString(int32_t ofs);
|
||||||
|
@ -153,10 +70,10 @@ static void PR_PrintStatement(dstatement_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s->op == OP_IF || s->op == OP_IFNOT)
|
if(s->op == OP_IF || s->op == OP_IFNOT)
|
||||||
Con_Printf("%sbranch %" PRIi32 "", PR_GlobalString(s->a), s->b);
|
Con_Printf("%sbranch %" PRIi32, PR_GlobalString(s->a), s->b);
|
||||||
else if(s->op == OP_GOTO)
|
else if(s->op == OP_GOTO)
|
||||||
{
|
{
|
||||||
Con_Printf("branch %" PRIi32 "", s->a);
|
Con_Printf("branch %" PRIi32, s->a);
|
||||||
}
|
}
|
||||||
else if((uint32_t)(s->op - OP_STORE_F) < 6)
|
else if((uint32_t)(s->op - OP_STORE_F) < 6)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +214,7 @@ static int32_t PR_EnterFunction(dfunction_t *f)
|
||||||
PR_RunError("PR_ExecuteProgram: locals stack overflow\n");
|
PR_RunError("PR_ExecuteProgram: locals stack overflow\n");
|
||||||
|
|
||||||
for(i = 0; i < c ; i++)
|
for(i = 0; i < c ; i++)
|
||||||
localstack[localstack_used + i] = G_INT(f->parm_start + i);
|
localstack[localstack_used + i] = G_Int(f->parm_start + i);
|
||||||
localstack_used += c;
|
localstack_used += c;
|
||||||
|
|
||||||
// copy parameters
|
// copy parameters
|
||||||
|
@ -306,7 +223,7 @@ static int32_t PR_EnterFunction(dfunction_t *f)
|
||||||
{
|
{
|
||||||
for(j = 0; j < f->parm_size[i]; j++)
|
for(j = 0; j < f->parm_size[i]; j++)
|
||||||
{
|
{
|
||||||
G_INT(o) = G_INT(GBL_PARM0 + i * 3 + j);
|
G_Int(o) = G_Int(GBL_PARM0 + i * 3 + j);
|
||||||
o++;
|
o++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,7 +251,7 @@ static int32_t PR_LeaveFunction(void)
|
||||||
PR_RunError("PR_ExecuteProgram: locals stack underflow");
|
PR_RunError("PR_ExecuteProgram: locals stack underflow");
|
||||||
|
|
||||||
for(i = 0; i < c; i++)
|
for(i = 0; i < c; i++)
|
||||||
G_INT(pr_xfunction->parm_start + i) = localstack[localstack_used + i];
|
G_Int(pr_xfunction->parm_start + i) = localstack[localstack_used + i];
|
||||||
|
|
||||||
// up stack
|
// up stack
|
||||||
pr_depth--;
|
pr_depth--;
|
||||||
|
@ -352,6 +269,48 @@ The interpretation main loop
|
||||||
*/
|
*/
|
||||||
void PR_ExecuteProgram(func_t fnum)
|
void PR_ExecuteProgram(func_t fnum)
|
||||||
{
|
{
|
||||||
|
#if HAVE_COMPUTED_GOTO
|
||||||
|
#define CASE(op) oper_##op:
|
||||||
|
#define BREAK goto oper_end;
|
||||||
|
#define GOTO_OP(op) goto *oper_list[op];
|
||||||
|
#define END_GOTO_OP oper_end:;
|
||||||
|
#else
|
||||||
|
#define CASE(op) case op:
|
||||||
|
#define BREAK break;
|
||||||
|
#define GOTO_OP(op) switch(op) {
|
||||||
|
#define END_GOTO_OP }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPA G_Eval((uint16_t)st->a)
|
||||||
|
#define OPB G_Eval((uint16_t)st->b)
|
||||||
|
#define OPC G_Eval((uint16_t)st->c)
|
||||||
|
#define PTR ((eval_t *)ProgEdict(OPB->edict))
|
||||||
|
#define EDI ProgEdict(OPA->edict)
|
||||||
|
|
||||||
|
#define MakeOpArithF(op, exp) \
|
||||||
|
CASE(op) \
|
||||||
|
OPC->flt = OPA->flt exp OPB->flt; \
|
||||||
|
BREAK
|
||||||
|
|
||||||
|
#define MakeOpArithV(op, exp) \
|
||||||
|
CASE(op) \
|
||||||
|
OPC->vec[0] = OPA->vec[0] exp OPB->vec[0]; \
|
||||||
|
OPC->vec[1] = OPA->vec[1] exp OPB->vec[1]; \
|
||||||
|
OPC->vec[2] = OPA->vec[2] exp OPB->vec[2]; \
|
||||||
|
BREAK
|
||||||
|
|
||||||
|
#define MakeOpArithB(op, exp) \
|
||||||
|
CASE(op) \
|
||||||
|
OPC->flt = (int32_t)OPA->flt exp (int32_t)OPB->flt; \
|
||||||
|
BREAK
|
||||||
|
|
||||||
|
#if HAVE_COMPUTED_GOTO
|
||||||
|
static void const *const oper_list[] = {
|
||||||
|
#define pr_ops__xmac(x) &&oper_OP_##x,
|
||||||
|
#include "pr_ops.h"
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
dstatement_t *st;
|
dstatement_t *st;
|
||||||
dfunction_t *f, *newf;
|
dfunction_t *f, *newf;
|
||||||
int32_t profile, startprofile;
|
int32_t profile, startprofile;
|
||||||
|
@ -360,8 +319,8 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
|
|
||||||
if(!fnum || fnum >= progs.numfunctions)
|
if(!fnum || fnum >= progs.numfunctions)
|
||||||
{
|
{
|
||||||
if(G_PEDICT(GBL_self))
|
if(G_PEdict(GBL_self))
|
||||||
ED_Print(PROG_TO_EDICT(G_PEDICT(GBL_self)));
|
ED_Print(ProgEdict(G_PEdict(GBL_self)));
|
||||||
Host_Error("PR_ExecuteProgram: NULL function");
|
Host_Error("PR_ExecuteProgram: NULL function");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +334,7 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
st = &pr_statements[PR_EnterFunction(f)];
|
st = &pr_statements[PR_EnterFunction(f)];
|
||||||
startprofile = profile = 0;
|
startprofile = profile = 0;
|
||||||
|
|
||||||
while(1)
|
for(;;)
|
||||||
{
|
{
|
||||||
/* next statement */
|
/* next statement */
|
||||||
st++;
|
st++;
|
||||||
|
@ -389,30 +348,7 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
if(pr_trace)
|
if(pr_trace)
|
||||||
PR_PrintStatement(st);
|
PR_PrintStatement(st);
|
||||||
|
|
||||||
switch(st->op)
|
GOTO_OP(st->op)
|
||||||
{
|
|
||||||
#define OPA G_EVAL((uint16_t)st->a)
|
|
||||||
#define OPB G_EVAL((uint16_t)st->b)
|
|
||||||
#define OPC G_EVAL((uint16_t)st->c)
|
|
||||||
#define PTR ((eval_t *)PROG_TO_EDICT(OPB->edict))
|
|
||||||
|
|
||||||
#define MakeOpArithF(op, exp) \
|
|
||||||
case op: \
|
|
||||||
OPC->flt = OPA->flt exp OPB->flt; \
|
|
||||||
break;
|
|
||||||
|
|
||||||
#define MakeOpArithV(op, exp) \
|
|
||||||
case op: \
|
|
||||||
OPC->vec[0] = OPA->vec[0] exp OPB->vec[0]; \
|
|
||||||
OPC->vec[1] = OPA->vec[1] exp OPB->vec[1]; \
|
|
||||||
OPC->vec[2] = OPA->vec[2] exp OPB->vec[2]; \
|
|
||||||
break;
|
|
||||||
|
|
||||||
#define MakeOpArithB(op, exp) \
|
|
||||||
case op: \
|
|
||||||
OPC->flt = (int32_t)OPA->flt exp (int32_t)OPB->flt; \
|
|
||||||
break;
|
|
||||||
|
|
||||||
MakeOpArithF(OP_ADD_F, +)
|
MakeOpArithF(OP_ADD_F, +)
|
||||||
MakeOpArithF(OP_SUB_F, -)
|
MakeOpArithF(OP_SUB_F, -)
|
||||||
MakeOpArithF(OP_MUL_F, *)
|
MakeOpArithF(OP_MUL_F, *)
|
||||||
|
@ -424,9 +360,9 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
MakeOpArithB(OP_BITAND, &)
|
MakeOpArithB(OP_BITAND, &)
|
||||||
MakeOpArithB(OP_BITOR, |)
|
MakeOpArithB(OP_BITOR, |)
|
||||||
|
|
||||||
case OP_MUL_V: OPC->flt = DotProduct(OPA->vec, OPB->vec); break;
|
CASE(OP_MUL_V) OPC->flt = DotProduct(OPA->vec, OPB->vec); BREAK
|
||||||
case OP_MUL_FV: VectorScale(OPB->vec, OPA->flt, OPC->vec); break;
|
CASE(OP_MUL_FV) VectorScale(OPB->vec, OPA->flt, OPC->vec); BREAK
|
||||||
case OP_MUL_VF: VectorScale(OPA->vec, OPB->flt, OPC->vec); break;
|
CASE(OP_MUL_VF) VectorScale(OPA->vec, OPB->flt, OPC->vec); BREAK
|
||||||
|
|
||||||
MakeOpArithF(OP_GE, >=)
|
MakeOpArithF(OP_GE, >=)
|
||||||
MakeOpArithF(OP_LE, <=)
|
MakeOpArithF(OP_LE, <=)
|
||||||
|
@ -437,107 +373,91 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
MakeOpArithF(OP_EQ_F, ==)
|
MakeOpArithF(OP_EQ_F, ==)
|
||||||
MakeOpArithF(OP_NE_F, !=)
|
MakeOpArithF(OP_NE_F, !=)
|
||||||
|
|
||||||
case OP_NOT_F:
|
CASE(OP_NOT_F)
|
||||||
OPC->flt = !OPA->flt;
|
OPC->flt = !OPA->flt;
|
||||||
break;
|
BREAK
|
||||||
case OP_NOT_V:
|
CASE(OP_NOT_V)
|
||||||
OPC->flt = !OPA->vec[0] && !OPA->vec[1] && !OPA->vec[2];
|
OPC->flt = !OPA->vec[0] && !OPA->vec[1] && !OPA->vec[2];
|
||||||
break;
|
BREAK
|
||||||
case OP_NOT_S:
|
CASE(OP_NOT_S)
|
||||||
OPC->flt = !OPA->string || !*PR_GetString(OPA->string);
|
OPC->flt = !OPA->string || !*PR_GetString(OPA->string);
|
||||||
break;
|
BREAK
|
||||||
case OP_NOT_FNC:
|
CASE(OP_NOT_FNC)
|
||||||
OPC->flt = !OPA->func;
|
OPC->flt = !OPA->func;
|
||||||
break;
|
BREAK
|
||||||
case OP_NOT_ENT:
|
CASE(OP_NOT_ENT)
|
||||||
OPC->flt = PROG_TO_EDICT(OPA->edict) == sv.edicts;
|
OPC->flt = EDI == sv.edicts;
|
||||||
break;
|
BREAK
|
||||||
|
|
||||||
case OP_EQ_V:
|
CASE(OP_EQ_V)
|
||||||
OPC->flt = OPA->vec[0] == OPB->vec[0] &&
|
OPC->flt = OPA->vec[0] == OPB->vec[0] &&
|
||||||
OPA->vec[1] == OPB->vec[1] &&
|
OPA->vec[1] == OPB->vec[1] &&
|
||||||
OPA->vec[2] == OPB->vec[2];
|
OPA->vec[2] == OPB->vec[2];
|
||||||
break;
|
BREAK
|
||||||
case OP_EQ_S:
|
CASE(OP_EQ_S)
|
||||||
OPC->flt = !strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
OPC->flt = !strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
||||||
break;
|
BREAK
|
||||||
case OP_EQ_E: OPC->flt = OPA->edict == OPB->edict; break;
|
CASE(OP_EQ_E) OPC->flt = OPA->edict == OPB->edict; BREAK
|
||||||
case OP_EQ_FNC: OPC->flt = OPA->func == OPB->func; break;
|
CASE(OP_EQ_FNC) OPC->flt = OPA->func == OPB->func; BREAK
|
||||||
|
|
||||||
case OP_NE_V:
|
CASE(OP_NE_V)
|
||||||
OPC->flt = OPA->vec[0] != OPB->vec[0] ||
|
OPC->flt = OPA->vec[0] != OPB->vec[0] ||
|
||||||
OPA->vec[1] != OPB->vec[1] ||
|
OPA->vec[1] != OPB->vec[1] ||
|
||||||
OPA->vec[2] != OPB->vec[2];
|
OPA->vec[2] != OPB->vec[2];
|
||||||
break;
|
BREAK
|
||||||
case OP_NE_S:
|
CASE(OP_NE_S)
|
||||||
OPC->flt = strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
OPC->flt = strcmp(PR_GetString(OPA->string), PR_GetString(OPB->string));
|
||||||
break;
|
BREAK
|
||||||
case OP_NE_E: OPC->flt = OPA->edict != OPB->edict; break;
|
CASE(OP_NE_E) OPC->flt = OPA->edict != OPB->edict; BREAK
|
||||||
case OP_NE_FNC: OPC->flt = OPA->func != OPB->func; break;
|
CASE(OP_NE_FNC) OPC->flt = OPA->func != OPB->func; BREAK
|
||||||
|
|
||||||
case OP_STORE_F: OPB->flt = OPA->flt; break;
|
CASE(OP_STORE_F) OPB->flt = OPA->flt; BREAK
|
||||||
case OP_STORE_ENT: OPB->edict = OPA->edict; break;
|
CASE(OP_STORE_ENT) OPB->edict = OPA->edict; BREAK
|
||||||
case OP_STORE_FLD: OPB->field = OPA->field; break;
|
CASE(OP_STORE_FLD) OPB->field = OPA->field; BREAK
|
||||||
case OP_STORE_S: OPB->string = OPA->string; break;
|
CASE(OP_STORE_S) OPB->string = OPA->string; BREAK
|
||||||
case OP_STORE_FNC: OPB->func = OPA->func; break;
|
CASE(OP_STORE_FNC) OPB->func = OPA->func; BREAK
|
||||||
case OP_STORE_V: VectorCopy(OPA->vec, OPB->vec); break;
|
CASE(OP_STORE_V) VectorCopy(OPA->vec, OPB->vec); BREAK
|
||||||
|
|
||||||
case OP_STOREP_F: PTR->flt = OPA->flt; break;
|
CASE(OP_STOREP_F) PTR->flt = OPA->flt; BREAK
|
||||||
case OP_STOREP_ENT: PTR->edict = OPA->edict; break;
|
CASE(OP_STOREP_ENT) PTR->edict = OPA->edict; BREAK
|
||||||
case OP_STOREP_FLD: PTR->field = OPA->field; break;
|
CASE(OP_STOREP_FLD) PTR->field = OPA->field; BREAK
|
||||||
case OP_STOREP_S: PTR->string = OPA->string; break;
|
CASE(OP_STOREP_S) PTR->string = OPA->string; BREAK
|
||||||
case OP_STOREP_FNC: PTR->func = OPA->func; break;
|
CASE(OP_STOREP_FNC) PTR->func = OPA->func; BREAK
|
||||||
case OP_STOREP_V: VectorCopy(OPA->vec, PTR->vec); break;
|
CASE(OP_STOREP_V) VectorCopy(OPA->vec, PTR->vec); BREAK
|
||||||
|
|
||||||
case OP_ADDRESS:
|
CASE(OP_ADDRESS)
|
||||||
ed = PROG_TO_EDICT(OPA->edict);
|
ed = EDI;
|
||||||
#if defined(PARANOID)
|
#if defined(PARANOID)
|
||||||
NUM_FOR_EDICT(ed); // Make sure it's in range
|
NumForEdict(ed); // Make sure it's in range
|
||||||
#endif
|
#endif
|
||||||
if(ed == (edict_t *)sv.edicts && sv.state == ss_active)
|
if(ed == (edict_t *)sv.edicts && sv.state == ss_active)
|
||||||
{
|
{
|
||||||
pr_xstatement = st - pr_statements;
|
pr_xstatement = st - pr_statements;
|
||||||
PR_RunError("assignment to world entity");
|
PR_RunError("assignment to world entity");
|
||||||
}
|
}
|
||||||
OPC->field = EDICT_TO_PROG(&ED_PFIELD(ed, OPB->field));
|
OPC->field = EdictProg(&ED_PField(ed, OPB->field));
|
||||||
break;
|
BREAK
|
||||||
|
|
||||||
case OP_LOAD_F:
|
CASE(OP_LOAD_F) OPC->flt = ED_Float(EDI, OPB->field); BREAK
|
||||||
case OP_LOAD_FLD:
|
CASE(OP_LOAD_FLD) OPC->field = ED_PField(EDI, OPB->field); BREAK
|
||||||
case OP_LOAD_ENT:
|
CASE(OP_LOAD_ENT) OPC->edict = ED_PEdict(EDI, OPB->field); BREAK
|
||||||
case OP_LOAD_S:
|
CASE(OP_LOAD_S) OPC->string = ED_RString(EDI, OPB->field); BREAK
|
||||||
case OP_LOAD_FNC:
|
CASE(OP_LOAD_FNC) OPC->func = ED_Func(EDI, OPB->field); BREAK
|
||||||
case OP_LOAD_V:
|
CASE(OP_LOAD_V) VectorCopy(ED_Vector(EDI, OPB->field), OPC->vec); BREAK
|
||||||
ed = PROG_TO_EDICT(OPA->edict);
|
|
||||||
#if defined(PARANOID)
|
|
||||||
NUM_FOR_EDICT(ed); // Make sure it's in range
|
|
||||||
#endif
|
|
||||||
switch(st->op)
|
|
||||||
{
|
|
||||||
case OP_LOAD_F: OPC->flt = ED_FLOAT(ed, OPB->field); break;
|
|
||||||
case OP_LOAD_FLD: OPC->field = ED_PFIELD(ed, OPB->field); break;
|
|
||||||
case OP_LOAD_ENT: OPC->edict = ED_PEDICT(ed, OPB->field); break;
|
|
||||||
case OP_LOAD_S: OPC->string = ED_RSTRING(ed, OPB->field); break;
|
|
||||||
case OP_LOAD_FNC: OPC->func = ED_FUNC(ed, OPB->field); break;
|
|
||||||
case OP_LOAD_V:
|
|
||||||
VectorCopy(ED_VECTOR(ed, OPB->field), OPC->vec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OP_IFNOT: if(!OPA->_int) st += st->b - 1; break;
|
CASE(OP_IFNOT) if(!OPA->_int) st += st->b - 1; BREAK
|
||||||
case OP_IF: if(OPA->_int) st += st->b - 1; break;
|
CASE(OP_IF) if(OPA->_int) st += st->b - 1; BREAK
|
||||||
case OP_GOTO: st += st->a - 1; break;
|
CASE(OP_GOTO) st += st->a - 1; BREAK
|
||||||
|
|
||||||
case OP_CALL0:
|
CASE(OP_CALL0)
|
||||||
case OP_CALL1:
|
CASE(OP_CALL1)
|
||||||
case OP_CALL2:
|
CASE(OP_CALL2)
|
||||||
case OP_CALL3:
|
CASE(OP_CALL3)
|
||||||
case OP_CALL4:
|
CASE(OP_CALL4)
|
||||||
case OP_CALL5:
|
CASE(OP_CALL5)
|
||||||
case OP_CALL6:
|
CASE(OP_CALL6)
|
||||||
case OP_CALL7:
|
CASE(OP_CALL7)
|
||||||
case OP_CALL8:
|
CASE(OP_CALL8)
|
||||||
pr_xfunction->profile += profile - startprofile;
|
pr_xfunction->profile += profile - startprofile;
|
||||||
startprofile = profile;
|
startprofile = profile;
|
||||||
pr_xstatement = st - pr_statements;
|
pr_xstatement = st - pr_statements;
|
||||||
|
@ -550,38 +470,34 @@ void PR_ExecuteProgram(func_t fnum)
|
||||||
// Built-in function
|
// Built-in function
|
||||||
int32_t i = -newf->first_statement;
|
int32_t i = -newf->first_statement;
|
||||||
if(i >= pr_numbuiltins)
|
if(i >= pr_numbuiltins)
|
||||||
PR_RunError("Bad builtin call number %" PRIi32 "", i);
|
PR_RunError("Bad builtin call number %" PRIi32, i);
|
||||||
pr_builtins[i]();
|
pr_builtins[i]();
|
||||||
break;
|
BREAK
|
||||||
}
|
}
|
||||||
// Normal function
|
// Normal function
|
||||||
st = &pr_statements[PR_EnterFunction(newf)];
|
st = &pr_statements[PR_EnterFunction(newf)];
|
||||||
break;
|
BREAK
|
||||||
|
|
||||||
case OP_DONE:
|
CASE(OP_DONE)
|
||||||
case OP_RETURN:
|
CASE(OP_RETURN)
|
||||||
pr_xfunction->profile += profile - startprofile;
|
pr_xfunction->profile += profile - startprofile;
|
||||||
startprofile = profile;
|
startprofile = profile;
|
||||||
pr_xstatement = st - pr_statements;
|
pr_xstatement = st - pr_statements;
|
||||||
G_FLOAT(GBL_RETURN + 0) = G_FLOAT((uint16_t)st->a + 0);
|
G_Float(GBL_RETURN + 0) = G_Float((uint16_t)st->a + 0);
|
||||||
G_FLOAT(GBL_RETURN + 1) = G_FLOAT((uint16_t)st->a + 1);
|
G_Float(GBL_RETURN + 1) = G_Float((uint16_t)st->a + 1);
|
||||||
G_FLOAT(GBL_RETURN + 2) = G_FLOAT((uint16_t)st->a + 2);
|
G_Float(GBL_RETURN + 2) = G_Float((uint16_t)st->a + 2);
|
||||||
st = &pr_statements[PR_LeaveFunction()];
|
st = &pr_statements[PR_LeaveFunction()];
|
||||||
if(pr_depth == exitdepth)
|
if(pr_depth == exitdepth)
|
||||||
return;
|
return;
|
||||||
break;
|
BREAK
|
||||||
|
|
||||||
case OP_STATE:
|
CASE(OP_STATE)
|
||||||
ed = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ed = ProgEdict(G_PEdict(GBL_self));
|
||||||
ED_FLOAT(ed, ED_nextthink) = G_FLOAT(GBL_time) + 0.1;
|
ED_Float(ed, ED_nextthink) = G_Float(GBL_time) + 0.1;
|
||||||
ED_FLOAT(ed, ED_frame) = OPA->flt;
|
ED_Float(ed, ED_frame) = OPA->flt;
|
||||||
ED_FUNC(ed, ED_think) = OPB->func;
|
ED_Func(ed, ED_think) = OPB->func;
|
||||||
break;
|
BREAK
|
||||||
|
END_GOTO_OP
|
||||||
default:
|
|
||||||
pr_xstatement = st - pr_statements;
|
|
||||||
PR_RunError("Bad opcode %" PRIi32 "", st->op);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef spingle__pr_global_h
|
#ifndef spingle__pr_global_h
|
||||||
#define spingle__pr_global_h
|
#define spingle__pr_global_h
|
||||||
|
|
||||||
#define G_FLOAT(o) (((float *)pr_global_data)[o])
|
#define G_Float(o) (((float *)pr_global_data)[o])
|
||||||
#define G_INT(o) (((int32_t *)pr_global_data)[o])
|
#define G_Int(o) (((int32_t *)pr_global_data)[o])
|
||||||
#define G_EDICT(o) PROG_TO_EDICT(G_INT(o))
|
#define G_Edict(o) ProgEdict(G_Int(o))
|
||||||
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
|
#define G_EdictNum(o) NumForEdict(G_Edict(o))
|
||||||
#define G_VECTOR(o) (&G_FLOAT(o))
|
#define G_Vector(o) (&G_Float(o))
|
||||||
#define G_STRING(o) PR_GetString(G_RSTRING(o))
|
#define G_String(o) PR_GetString(G_RString(o))
|
||||||
#define G_RSTRING(o) (*(string_t *)&G_INT(o))
|
#define G_RString(o) (*(string_t *)&G_Int(o))
|
||||||
#define G_FUNC(o) (*(func_t *)&G_INT(o))
|
#define G_Func(o) (*(func_t *)&G_Int(o))
|
||||||
#define G_PEDICT(o) (*(pedict_t *)&G_INT(o))
|
#define G_PEdict(o) (*(pedict_t *)&G_Int(o))
|
||||||
#define G_PFIELD(o) (*(pfield_t *)&G_INT(o))
|
#define G_PField(o) (*(pfield_t *)&G_Int(o))
|
||||||
#define G_EVAL(o) ((eval_t *)&G_INT(o))
|
#define G_Eval(o) ((eval_t *)&G_Int(o))
|
||||||
#define G_VOID(o) ((void *)&G_INT(o))
|
#define G_Void(o) ((void *)&G_Int(o))
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,14 +94,17 @@ static void PR_LoadFunctions(byte const *data)
|
||||||
|
|
||||||
for(i = 0; i < progs.numfunctions; i++)
|
for(i = 0; i < progs.numfunctions; i++)
|
||||||
{
|
{
|
||||||
pr_functions[i].first_statement = ReadLittleLong(&data);
|
dfunction_t *fn = &pr_functions[i];
|
||||||
pr_functions[i].parm_start = ReadLittleLong(&data);
|
|
||||||
pr_functions[i].locals = ReadLittleLong(&data);
|
fn->first_statement = ReadLittleLong(&data);
|
||||||
pr_functions[i].profile = 0; ReadSkip(&data, 4);
|
fn->parm_start = ReadLittleLong(&data);
|
||||||
pr_functions[i].s_name = ReadLittleLong(&data);
|
fn->locals = ReadLittleLong(&data);
|
||||||
pr_functions[i].s_file = ReadLittleLong(&data);
|
fn->profile = 0; ReadSkip(&data, 4);
|
||||||
pr_functions[i].numparms = ReadLittleLong(&data);
|
fn->s_name = ReadLittleLong(&data);
|
||||||
ReadCopy(pr_functions[i].parm_size, &data, 8);
|
fn->s_file = ReadLittleLong(&data);
|
||||||
|
fn->numparms = ReadLittleLong(&data);
|
||||||
|
|
||||||
|
ReadCopy(fn->parm_size, &data, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,13 +152,15 @@ static void PR_LoadFieldDefs(byte const *data)
|
||||||
|
|
||||||
for(i = 0; i < progs.numfielddefs; i++)
|
for(i = 0; i < progs.numfielddefs; i++)
|
||||||
{
|
{
|
||||||
PR_LoadDef(&pr_fielddefs[i], &data);
|
ddef_t *def = &pr_fielddefs[i];
|
||||||
|
|
||||||
if(pr_fielddefs[i].type & DEF_SAVEGLOBAL)
|
PR_LoadDef(def, &data);
|
||||||
|
|
||||||
|
if(def->type & DEF_SAVEGLOBAL)
|
||||||
Host_Error("PR_LoadProgs: field defs cannot have DEF_SAVEGLOBAL");
|
Host_Error("PR_LoadProgs: field defs cannot have DEF_SAVEGLOBAL");
|
||||||
|
|
||||||
//johnfitz -- detect alpha support
|
//johnfitz -- detect alpha support
|
||||||
if(!strcmp(&pr_strings[pr_fielddefs[i].s_name], "alpha"))
|
if(!strcmp(&pr_strings[def->s_name], "alpha"))
|
||||||
pr_alpha_supported = true;
|
pr_alpha_supported = true;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
}
|
}
|
||||||
|
@ -170,10 +175,15 @@ static void PR_LoadStatements(byte const *data)
|
||||||
|
|
||||||
for(i = 0; i < progs.numstatements; i++)
|
for(i = 0; i < progs.numstatements; i++)
|
||||||
{
|
{
|
||||||
pr_statements[i].op = ReadLittleShort(&data);
|
dstatement_t *st = &pr_statements[i];
|
||||||
pr_statements[i].a = ReadLittleShort(&data);
|
|
||||||
pr_statements[i].b = ReadLittleShort(&data);
|
st->op = ReadLittleShort(&data);
|
||||||
pr_statements[i].c = ReadLittleShort(&data);
|
st->a = ReadLittleShort(&data);
|
||||||
|
st->b = ReadLittleShort(&data);
|
||||||
|
st->c = ReadLittleShort(&data);
|
||||||
|
|
||||||
|
if(st->op >= OP_MAX)
|
||||||
|
Host_Error("PR_LoadStatements: bad opcode %" PRIi32, st->op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +194,7 @@ static void PR_LoadGlobals(byte const *data)
|
||||||
pr_global_data = Hunk_Memdup(data, progs.numglobals * 4, "pr_global_data");
|
pr_global_data = Hunk_Memdup(data, progs.numglobals * 4, "pr_global_data");
|
||||||
|
|
||||||
for(i = 0; i < progs.numglobals; i++)
|
for(i = 0; i < progs.numglobals; i++)
|
||||||
G_INT(i) = LittleLong(G_INT(i));
|
G_Int(i) = LittleLong(G_Int(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
160
source/pr_ops.h
160
source/pr_ops.h
|
@ -21,86 +21,94 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef spingle__pr_ops_h
|
#if defined(pr_ops__xmac)
|
||||||
|
|
||||||
|
pr_ops__xmac(DONE)
|
||||||
|
pr_ops__xmac(MUL_F)
|
||||||
|
pr_ops__xmac(MUL_V)
|
||||||
|
pr_ops__xmac(MUL_FV)
|
||||||
|
pr_ops__xmac(MUL_VF)
|
||||||
|
pr_ops__xmac(DIV_F)
|
||||||
|
pr_ops__xmac(ADD_F)
|
||||||
|
pr_ops__xmac(ADD_V)
|
||||||
|
pr_ops__xmac(SUB_F)
|
||||||
|
pr_ops__xmac(SUB_V)
|
||||||
|
|
||||||
|
pr_ops__xmac(EQ_F)
|
||||||
|
pr_ops__xmac(EQ_V)
|
||||||
|
pr_ops__xmac(EQ_S)
|
||||||
|
pr_ops__xmac(EQ_E)
|
||||||
|
pr_ops__xmac(EQ_FNC)
|
||||||
|
|
||||||
|
pr_ops__xmac(NE_F)
|
||||||
|
pr_ops__xmac(NE_V)
|
||||||
|
pr_ops__xmac(NE_S)
|
||||||
|
pr_ops__xmac(NE_E)
|
||||||
|
pr_ops__xmac(NE_FNC)
|
||||||
|
|
||||||
|
pr_ops__xmac(LE)
|
||||||
|
pr_ops__xmac(GE)
|
||||||
|
pr_ops__xmac(LT)
|
||||||
|
pr_ops__xmac(GT)
|
||||||
|
|
||||||
|
pr_ops__xmac(LOAD_F)
|
||||||
|
pr_ops__xmac(LOAD_V)
|
||||||
|
pr_ops__xmac(LOAD_S)
|
||||||
|
pr_ops__xmac(LOAD_ENT)
|
||||||
|
pr_ops__xmac(LOAD_FLD)
|
||||||
|
pr_ops__xmac(LOAD_FNC)
|
||||||
|
|
||||||
|
pr_ops__xmac(ADDRESS)
|
||||||
|
|
||||||
|
pr_ops__xmac(STORE_F)
|
||||||
|
pr_ops__xmac(STORE_V)
|
||||||
|
pr_ops__xmac(STORE_S)
|
||||||
|
pr_ops__xmac(STORE_ENT)
|
||||||
|
pr_ops__xmac(STORE_FLD)
|
||||||
|
pr_ops__xmac(STORE_FNC)
|
||||||
|
|
||||||
|
pr_ops__xmac(STOREP_F)
|
||||||
|
pr_ops__xmac(STOREP_V)
|
||||||
|
pr_ops__xmac(STOREP_S)
|
||||||
|
pr_ops__xmac(STOREP_ENT)
|
||||||
|
pr_ops__xmac(STOREP_FLD)
|
||||||
|
pr_ops__xmac(STOREP_FNC)
|
||||||
|
|
||||||
|
pr_ops__xmac(RETURN)
|
||||||
|
pr_ops__xmac(NOT_F)
|
||||||
|
pr_ops__xmac(NOT_V)
|
||||||
|
pr_ops__xmac(NOT_S)
|
||||||
|
pr_ops__xmac(NOT_ENT)
|
||||||
|
pr_ops__xmac(NOT_FNC)
|
||||||
|
pr_ops__xmac(IF)
|
||||||
|
pr_ops__xmac(IFNOT)
|
||||||
|
pr_ops__xmac(CALL0)
|
||||||
|
pr_ops__xmac(CALL1)
|
||||||
|
pr_ops__xmac(CALL2)
|
||||||
|
pr_ops__xmac(CALL3)
|
||||||
|
pr_ops__xmac(CALL4)
|
||||||
|
pr_ops__xmac(CALL5)
|
||||||
|
pr_ops__xmac(CALL6)
|
||||||
|
pr_ops__xmac(CALL7)
|
||||||
|
pr_ops__xmac(CALL8)
|
||||||
|
pr_ops__xmac(STATE)
|
||||||
|
pr_ops__xmac(GOTO)
|
||||||
|
pr_ops__xmac(AND)
|
||||||
|
pr_ops__xmac(OR)
|
||||||
|
|
||||||
|
pr_ops__xmac(BITAND)
|
||||||
|
pr_ops__xmac(BITOR)
|
||||||
|
|
||||||
|
#undef pr_ops__xmac
|
||||||
|
|
||||||
|
#elif !defined(spingle__pr_ops_h)
|
||||||
#define spingle__pr_ops_h
|
#define spingle__pr_ops_h
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
OP_DONE,
|
#define pr_ops__xmac(x) OP_##x,
|
||||||
OP_MUL_F,
|
#include "pr_ops.h"
|
||||||
OP_MUL_V,
|
OP_MAX,
|
||||||
OP_MUL_FV,
|
|
||||||
OP_MUL_VF,
|
|
||||||
OP_DIV_F,
|
|
||||||
OP_ADD_F,
|
|
||||||
OP_ADD_V,
|
|
||||||
OP_SUB_F,
|
|
||||||
OP_SUB_V,
|
|
||||||
|
|
||||||
OP_EQ_F,
|
|
||||||
OP_EQ_V,
|
|
||||||
OP_EQ_S,
|
|
||||||
OP_EQ_E,
|
|
||||||
OP_EQ_FNC,
|
|
||||||
|
|
||||||
OP_NE_F,
|
|
||||||
OP_NE_V,
|
|
||||||
OP_NE_S,
|
|
||||||
OP_NE_E,
|
|
||||||
OP_NE_FNC,
|
|
||||||
|
|
||||||
OP_LE,
|
|
||||||
OP_GE,
|
|
||||||
OP_LT,
|
|
||||||
OP_GT,
|
|
||||||
|
|
||||||
OP_LOAD_F,
|
|
||||||
OP_LOAD_V,
|
|
||||||
OP_LOAD_S,
|
|
||||||
OP_LOAD_ENT,
|
|
||||||
OP_LOAD_FLD,
|
|
||||||
OP_LOAD_FNC,
|
|
||||||
|
|
||||||
OP_ADDRESS,
|
|
||||||
|
|
||||||
OP_STORE_F,
|
|
||||||
OP_STORE_V,
|
|
||||||
OP_STORE_S,
|
|
||||||
OP_STORE_ENT,
|
|
||||||
OP_STORE_FLD,
|
|
||||||
OP_STORE_FNC,
|
|
||||||
|
|
||||||
OP_STOREP_F,
|
|
||||||
OP_STOREP_V,
|
|
||||||
OP_STOREP_S,
|
|
||||||
OP_STOREP_ENT,
|
|
||||||
OP_STOREP_FLD,
|
|
||||||
OP_STOREP_FNC,
|
|
||||||
|
|
||||||
OP_RETURN,
|
|
||||||
OP_NOT_F,
|
|
||||||
OP_NOT_V,
|
|
||||||
OP_NOT_S,
|
|
||||||
OP_NOT_ENT,
|
|
||||||
OP_NOT_FNC,
|
|
||||||
OP_IF,
|
|
||||||
OP_IFNOT,
|
|
||||||
OP_CALL0,
|
|
||||||
OP_CALL1,
|
|
||||||
OP_CALL2,
|
|
||||||
OP_CALL3,
|
|
||||||
OP_CALL4,
|
|
||||||
OP_CALL5,
|
|
||||||
OP_CALL6,
|
|
||||||
OP_CALL7,
|
|
||||||
OP_CALL8,
|
|
||||||
OP_STATE,
|
|
||||||
OP_GOTO,
|
|
||||||
OP_AND,
|
|
||||||
OP_OR,
|
|
||||||
|
|
||||||
OP_BITAND,
|
|
||||||
OP_BITOR
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -50,7 +50,7 @@ const char *PR_ValueString(int32_t type, eval_t *val)
|
||||||
sprintf(line, "%s", PR_GetString(val->string));
|
sprintf(line, "%s", PR_GetString(val->string));
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
sprintf(line, "entity %" PRIi32 "", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
sprintf(line, "entity %" PRIi32, NumForEdict(ProgEdict(val->edict)));
|
||||||
break;
|
break;
|
||||||
case ev_function:
|
case ev_function:
|
||||||
f = pr_functions + val->func;
|
f = pr_functions + val->func;
|
||||||
|
@ -73,7 +73,7 @@ const char *PR_ValueString(int32_t type, eval_t *val)
|
||||||
sprintf(line, "pointer");
|
sprintf(line, "pointer");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(line, "bad type %" PRIi32 "", type);
|
sprintf(line, "bad type %" PRIi32, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ const char *PR_UglyValueString(int32_t type, eval_t *val)
|
||||||
sprintf(line, "%s", PR_GetString(val->string));
|
sprintf(line, "%s", PR_GetString(val->string));
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
sprintf(line, "%" PRIi32 "", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
sprintf(line, "%" PRIi32, NumForEdict(ProgEdict(val->edict)));
|
||||||
break;
|
break;
|
||||||
case ev_function:
|
case ev_function:
|
||||||
f = pr_functions + val->func;
|
f = pr_functions + val->func;
|
||||||
|
@ -123,7 +123,7 @@ const char *PR_UglyValueString(int32_t type, eval_t *val)
|
||||||
sprintf(line, "%f %f %f", val->vec[0], val->vec[1], val->vec[2]);
|
sprintf(line, "%f %f %f", val->vec[0], val->vec[1], val->vec[2]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(line, "bad type %" PRIi32 "", type);
|
sprintf(line, "bad type %" PRIi32, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ const char *PR_GlobalString(int32_t ofs)
|
||||||
ddef_t *def;
|
ddef_t *def;
|
||||||
void *val;
|
void *val;
|
||||||
|
|
||||||
val = G_VOID(ofs);
|
val = G_Void(ofs);
|
||||||
def = ED_GlobalAtOfs(ofs);
|
def = ED_GlobalAtOfs(ofs);
|
||||||
if(!def)
|
if(!def)
|
||||||
sprintf(line, "%" PRIi32 "(?)", ofs);
|
sprintf(line, "%" PRIi32 "(?)", ofs);
|
||||||
|
|
|
@ -60,7 +60,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define U_ALPHA (1<<16) // 1 byte, uses ENTALPHA_ENCODE, not sent if equal to baseline
|
#define U_ALPHA (1<<16) // 1 byte, uses ENTALPHA_ENCODE, not sent if equal to baseline
|
||||||
#define U_FRAME2 (1<<17) // 1 byte, this is .frame & 0xFF00 (second byte)
|
#define U_FRAME2 (1<<17) // 1 byte, this is .frame & 0xFF00 (second byte)
|
||||||
#define U_MODEL2 (1<<18) // 1 byte, this is .modelindex & 0xFF00 (second byte)
|
#define U_MODEL2 (1<<18) // 1 byte, this is .modelindex & 0xFF00 (second byte)
|
||||||
#define U_LERPFINISH (1<<19) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 0.1, this is ED_FLOAT(ent, ED_nextthink) - sv.time, used for lerping
|
#define U_LERPFINISH (1<<19) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 0.1, this is ED_Float(ent, ED_nextthink) - sv.time, used for lerping
|
||||||
#define U_SCALE (1<<20) // 1 byte, for PROTOCOL_RMQ PRFL_EDICTSCALE, currently read but ignored
|
#define U_SCALE (1<<20) // 1 byte, for PROTOCOL_RMQ PRFL_EDICTSCALE, currently read but ignored
|
||||||
#define U_UNUSED21 (1<<21)
|
#define U_UNUSED21 (1<<21)
|
||||||
#define U_UNUSED22 (1<<22)
|
#define U_UNUSED22 (1<<22)
|
||||||
|
|
|
@ -570,10 +570,9 @@ void GL_BuildLightmaps(void)
|
||||||
lightmap_rectchange[i].h = 0;
|
lightmap_rectchange[i].h = 0;
|
||||||
|
|
||||||
//johnfitz -- use texture manager
|
//johnfitz -- use texture manager
|
||||||
sprintf(name, "lightmap%03" PRIi32 "", i);
|
sprintf(name, "lightmap%03" PRIi32, i);
|
||||||
data = lightmaps + i * BLOCK_WIDTH * BLOCK_HEIGHT * lightmap_bytes;
|
data = lightmaps + i * BLOCK_WIDTH * BLOCK_HEIGHT * lightmap_bytes;
|
||||||
lightmap_textures[i] = TexMgr_LoadImage(cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT,
|
lightmap_textures[i] = TexMgr_LoadImage(cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
||||||
SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
|
||||||
//johnfitz
|
//johnfitz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,8 @@ void Sbar_LoadPics(void)
|
||||||
|
|
||||||
for(i = 0; i < 10; i++)
|
for(i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
sb_nums[0][i] = Draw_PicFromWad(va("num_%" PRIi32 "", i));
|
sb_nums[0][i] = Draw_PicFromWad(va("num_%" PRIi32, i));
|
||||||
sb_nums[1][i] = Draw_PicFromWad(va("anum_%" PRIi32 "", i));
|
sb_nums[1][i] = Draw_PicFromWad(va("anum_%" PRIi32, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
sb_nums[0][10] = Draw_PicFromWad("num_minus");
|
sb_nums[0][10] = Draw_PicFromWad("num_minus");
|
||||||
|
@ -500,17 +500,17 @@ void Sbar_SoloScoreboard(void)
|
||||||
int32_t minutes, seconds, tens, units;
|
int32_t minutes, seconds, tens, units;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
sprintf(str, "Kills: %" PRIi32 "/%" PRIi32 "", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
sprintf(str, "Kills: %" PRIi32 "/%" PRIi32, cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||||
Sbar_DrawString(8, 12, str);
|
Sbar_DrawString(8, 12, str);
|
||||||
|
|
||||||
sprintf(str, "Secrets: %" PRIi32 "/%" PRIi32 "", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
|
sprintf(str, "Secrets: %" PRIi32 "/%" PRIi32, cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
|
||||||
Sbar_DrawString(312 - strlen(str) * 8, 12, str);
|
Sbar_DrawString(312 - strlen(str) * 8, 12, str);
|
||||||
|
|
||||||
minutes = cl.time / 60;
|
minutes = cl.time / 60;
|
||||||
seconds = cl.time - 60 * minutes;
|
seconds = cl.time - 60 * minutes;
|
||||||
tens = seconds / 10;
|
tens = seconds / 10;
|
||||||
units = seconds - 10 * tens;
|
units = seconds - 10 * tens;
|
||||||
sprintf(str, "%" PRIi32 ":%" PRIi32 "%" PRIi32 "", minutes, tens, units);
|
sprintf(str, "%" PRIi32 ":%" PRIi32 "%" PRIi32, minutes, tens, units);
|
||||||
Sbar_DrawString(160 - strlen(str) * 4, 12, str);
|
Sbar_DrawString(160 - strlen(str) * 4, 12, str);
|
||||||
|
|
||||||
len = strlen(cl.levelname);
|
len = strlen(cl.levelname);
|
||||||
|
@ -660,7 +660,7 @@ void Sbar_DrawInventory(void)
|
||||||
{
|
{
|
||||||
val = cl.stats[STAT_SHELLS + i];
|
val = cl.stats[STAT_SHELLS + i];
|
||||||
val = (val < 0) ? 0 : q_min(999, val); //johnfitz -- cap displayed value to 999
|
val = (val < 0) ? 0 : q_min(999, val); //johnfitz -- cap displayed value to 999
|
||||||
sprintf(num, "%3" PRIi32 "", val);
|
sprintf(num, "%3" PRIi32, val);
|
||||||
if(num[0] != ' ')
|
if(num[0] != ' ')
|
||||||
Sbar_DrawCharacter((6 * i + 1) * 8 + 2, -24, 18 + num[0] - '0');
|
Sbar_DrawCharacter((6 * i + 1) * 8 + 2, -24, 18 + num[0] - '0');
|
||||||
if(num[1] != ' ')
|
if(num[1] != ' ')
|
||||||
|
@ -796,7 +796,7 @@ void Sbar_DrawFrags(void)
|
||||||
Draw_Fill(x + 10, 5, 28, 3, color, 1);
|
Draw_Fill(x + 10, 5, 28, 3, color, 1);
|
||||||
|
|
||||||
// number
|
// number
|
||||||
sprintf(num, "%3" PRIi32 "", s->frags);
|
sprintf(num, "%3" PRIi32, s->frags);
|
||||||
Sbar_DrawCharacter(x + 12, -24, num[0]);
|
Sbar_DrawCharacter(x + 12, -24, num[0]);
|
||||||
Sbar_DrawCharacter(x + 20, -24, num[1]);
|
Sbar_DrawCharacter(x + 20, -24, num[1]);
|
||||||
Sbar_DrawCharacter(x + 28, -24, num[2]);
|
Sbar_DrawCharacter(x + 28, -24, num[2]);
|
||||||
|
@ -849,7 +849,7 @@ void Sbar_DrawFace(void)
|
||||||
|
|
||||||
// draw number
|
// draw number
|
||||||
f = s->frags;
|
f = s->frags;
|
||||||
sprintf(num, "%3" PRIi32 "", f);
|
sprintf(num, "%3" PRIi32, f);
|
||||||
|
|
||||||
if(top == 8)
|
if(top == 8)
|
||||||
{
|
{
|
||||||
|
@ -1135,7 +1135,7 @@ void Sbar_DeathmatchOverlay(void)
|
||||||
|
|
||||||
// draw number
|
// draw number
|
||||||
f = s->frags;
|
f = s->frags;
|
||||||
sprintf(num, "%3" PRIi32 "", f);
|
sprintf(num, "%3" PRIi32, f);
|
||||||
|
|
||||||
Draw_Character(x + 8, y, num[0]); //johnfitz -- stretched overlays
|
Draw_Character(x + 8, y, num[0]); //johnfitz -- stretched overlays
|
||||||
Draw_Character(x + 16, y, num[1]); //johnfitz -- stretched overlays
|
Draw_Character(x + 16, y, num[1]); //johnfitz -- stretched overlays
|
||||||
|
@ -1210,7 +1210,7 @@ void Sbar_MiniDeathmatchOverlay(void)
|
||||||
|
|
||||||
// number
|
// number
|
||||||
f = s->frags;
|
f = s->frags;
|
||||||
sprintf(num, "%3" PRIi32 "", f);
|
sprintf(num, "%3" PRIi32, f);
|
||||||
Draw_Character(x + 8, y, num[0]);
|
Draw_Character(x + 8, y, num[0]);
|
||||||
Draw_Character(x + 16, y, num[1]);
|
Draw_Character(x + 16, y, num[1]);
|
||||||
Draw_Character(x + 24, y, num[2]);
|
Draw_Character(x + 24, y, num[2]);
|
||||||
|
|
|
@ -1199,7 +1199,7 @@ static void GL_Init(void)
|
||||||
gl_version = (const char *) glGetString(GL_VERSION);
|
gl_version = (const char *) glGetString(GL_VERSION);
|
||||||
gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
|
gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
|
||||||
|
|
||||||
if(gl_version == NULL || sscanf(gl_version, "%" PRIi32 ".%" PRIi32 "", &gl_version_major, &gl_version_minor) < 2)
|
if(gl_version == NULL || sscanf(gl_version, "%" PRIi32 ".%" PRIi32, &gl_version_major, &gl_version_minor) < 2)
|
||||||
{
|
{
|
||||||
gl_version_major = 0;
|
gl_version_major = 0;
|
||||||
gl_version_minor = 0;
|
gl_version_minor = 0;
|
||||||
|
@ -1334,7 +1334,7 @@ static void VID_DescribeModes_f(void)
|
||||||
{
|
{
|
||||||
if(count > 0)
|
if(count > 0)
|
||||||
Con_SafePrintf("\n");
|
Con_SafePrintf("\n");
|
||||||
Con_SafePrintf(" %4" PRIi32 " x %4" PRIi32 " x %" PRIi32 " : %" PRIi32 "", modelist[i].width, modelist[i].height, modelist[i].bpp, modelist[i].refreshrate);
|
Con_SafePrintf(" %4" PRIi32 " x %4" PRIi32 " x %" PRIi32 " : %" PRIi32, modelist[i].width, modelist[i].height, modelist[i].bpp, modelist[i].refreshrate);
|
||||||
lastwidth = modelist[i].width;
|
lastwidth = modelist[i].width;
|
||||||
lastheight = modelist[i].height;
|
lastheight = modelist[i].height;
|
||||||
lastbpp = modelist[i].bpp;
|
lastbpp = modelist[i].bpp;
|
||||||
|
@ -2087,15 +2087,15 @@ static void VID_MenuDraw(void)
|
||||||
{
|
{
|
||||||
case VID_OPT_MODE:
|
case VID_OPT_MODE:
|
||||||
M_Print(16, y, " Video mode");
|
M_Print(16, y, " Video mode");
|
||||||
M_Print(184, y, va("%" PRIi32 "x%" PRIi32 "", (int32_t)vid_width.value, (int32_t)vid_height.value));
|
M_Print(184, y, va("%" PRIi32 "x%" PRIi32, (int32_t)vid_width.value, (int32_t)vid_height.value));
|
||||||
break;
|
break;
|
||||||
case VID_OPT_BPP:
|
case VID_OPT_BPP:
|
||||||
M_Print(16, y, " Color depth");
|
M_Print(16, y, " Color depth");
|
||||||
M_Print(184, y, va("%" PRIi32 "", (int32_t)vid_bpp.value));
|
M_Print(184, y, va("%" PRIi32, (int32_t)vid_bpp.value));
|
||||||
break;
|
break;
|
||||||
case VID_OPT_REFRESHRATE:
|
case VID_OPT_REFRESHRATE:
|
||||||
M_Print(16, y, " Refresh rate");
|
M_Print(16, y, " Refresh rate");
|
||||||
M_Print(184, y, va("%" PRIi32 "", (int32_t)vid_refreshrate.value));
|
M_Print(184, y, va("%" PRIi32, (int32_t)vid_refreshrate.value));
|
||||||
break;
|
break;
|
||||||
case VID_OPT_FULLSCREEN:
|
case VID_OPT_FULLSCREEN:
|
||||||
M_Print(16, y, " Fullscreen");
|
M_Print(16, y, " Fullscreen");
|
||||||
|
|
|
@ -99,7 +99,7 @@ typedef struct client_s
|
||||||
sizebuf_t message; // can be added to at any time,
|
sizebuf_t message; // can be added to at any time,
|
||||||
// copied and clear once per frame
|
// copied and clear once per frame
|
||||||
byte msgbuf[MAX_MSGLEN];
|
byte msgbuf[MAX_MSGLEN];
|
||||||
edict_t *edict; // EDICT_NUM(clientnum+1)
|
edict_t *edict; // EdictNum(clientnum+1)
|
||||||
char name[32]; // for printing to other people
|
char name[32]; // for printing to other people
|
||||||
int32_t colors;
|
int32_t colors;
|
||||||
|
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ static void S_SoundList(void)
|
||||||
Con_SafePrintf(" "); //johnfitz -- was Con_Printf
|
Con_SafePrintf(" "); //johnfitz -- was Con_Printf
|
||||||
Con_SafePrintf("(%2" PRIi32 "b) %6" PRIi32 " : %s\n", sc->width * 8, size, sfx->name); //johnfitz -- was Con_Printf
|
Con_SafePrintf("(%2" PRIi32 "b) %6" PRIi32 " : %s\n", sc->width * 8, size, sfx->name); //johnfitz -- was Con_Printf
|
||||||
}
|
}
|
||||||
Con_Printf("%" PRIi32" PRIi32 "" sou" PRIi32 "ds, %" PRIi32 " bytes\n", num_sfx, total); //johnfitz -- added count
|
Con_Printf("%" PRIi32 " sounds, %" PRIi32 " bytes\n", num_sfx, total); //johnfitz -- added count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
248
source/sv_main.c
248
source/sv_main.c
|
@ -106,7 +106,7 @@ void SV_Init(void)
|
||||||
Cmd_AddCommand("sv_protocol", &SV_Protocol_f); //johnfitz
|
Cmd_AddCommand("sv_protocol", &SV_Protocol_f); //johnfitz
|
||||||
|
|
||||||
for(i = 0 ; i < MAX_MODELS ; i++)
|
for(i = 0 ; i < MAX_MODELS ; i++)
|
||||||
sprintf(localmodels[i], "*%" PRIi32 "", i);
|
sprintf(localmodels[i], "*%" PRIi32, i);
|
||||||
|
|
||||||
i = COM_CheckParm("-protocol");
|
i = COM_CheckParm("-protocol");
|
||||||
if(i && i < com_argc - 1)
|
if(i && i < com_argc - 1)
|
||||||
|
@ -189,13 +189,13 @@ void SV_StartSound(edict_t *entity, int32_t channel, const char *sample, int32_t
|
||||||
int32_t i, field_mask;
|
int32_t i, field_mask;
|
||||||
|
|
||||||
if(volume < 0 || volume > 255)
|
if(volume < 0 || volume > 255)
|
||||||
Host_Error("SV_StartSound: volume = %" PRIi32 "", volume);
|
Host_Error("SV_StartSound: volume = %" PRIi32, volume);
|
||||||
|
|
||||||
if(attenuation < 0 || attenuation > 4)
|
if(attenuation < 0 || attenuation > 4)
|
||||||
Host_Error("SV_StartSound: attenuation = %f", attenuation);
|
Host_Error("SV_StartSound: attenuation = %f", attenuation);
|
||||||
|
|
||||||
if(channel < 0 || channel > 7)
|
if(channel < 0 || channel > 7)
|
||||||
Host_Error("SV_StartSound: channel = %" PRIi32 "", channel);
|
Host_Error("SV_StartSound: channel = %" PRIi32, channel);
|
||||||
|
|
||||||
if(sv.datagram.cursize > MAX_DATAGRAM - 16)
|
if(sv.datagram.cursize > MAX_DATAGRAM - 16)
|
||||||
return;
|
return;
|
||||||
|
@ -213,7 +213,7 @@ void SV_StartSound(edict_t *entity, int32_t channel, const char *sample, int32_t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent = NUM_FOR_EDICT(entity);
|
ent = NumForEdict(entity);
|
||||||
|
|
||||||
field_mask = 0;
|
field_mask = 0;
|
||||||
if(volume != DEFAULT_SOUND_PACKET_VOLUME)
|
if(volume != DEFAULT_SOUND_PACKET_VOLUME)
|
||||||
|
@ -261,7 +261,7 @@ void SV_StartSound(edict_t *entity, int32_t channel, const char *sample, int32_t
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
for(i = 0; i < 3; i++)
|
for(i = 0; i < 3; i++)
|
||||||
MSG_WriteCoord(&sv.datagram, ED_VECTOR(entity, ED_origin)[i] + 0.5 * (ED_VECTOR(entity, ED_mins)[i] + ED_VECTOR(entity, ED_maxs)[i]), sv.protocolflags);
|
MSG_WriteCoord(&sv.datagram, ED_Vector(entity, ED_origin)[i] + 0.5 * (ED_Vector(entity, ED_mins)[i] + ED_Vector(entity, ED_maxs)[i]), sv.protocolflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -306,7 +306,7 @@ void SV_SendServerinfo(client_t *client)
|
||||||
else
|
else
|
||||||
MSG_WriteByte(&client->message, GAME_COOP);
|
MSG_WriteByte(&client->message, GAME_COOP);
|
||||||
|
|
||||||
MSG_WriteString(&client->message, ED_STRING(sv.edicts, ED_message));
|
MSG_WriteString(&client->message, ED_String(sv.edicts, ED_message));
|
||||||
|
|
||||||
//johnfitz -- only send the first 256 model and sound precaches if protocol is 15
|
//johnfitz -- only send the first 256 model and sound precaches if protocol is 15
|
||||||
for(i = 0, s = sv.model_precache + 1 ; *s; s++, i++)
|
for(i = 0, s = sv.model_precache + 1 ; *s; s++, i++)
|
||||||
|
@ -322,12 +322,12 @@ void SV_SendServerinfo(client_t *client)
|
||||||
|
|
||||||
// send music
|
// send music
|
||||||
MSG_WriteByte(&client->message, svc_cdtrack);
|
MSG_WriteByte(&client->message, svc_cdtrack);
|
||||||
MSG_WriteByte(&client->message, ED_FLOAT(sv.edicts, ED_sounds));
|
MSG_WriteByte(&client->message, ED_Float(sv.edicts, ED_sounds));
|
||||||
MSG_WriteByte(&client->message, ED_FLOAT(sv.edicts, ED_sounds));
|
MSG_WriteByte(&client->message, ED_Float(sv.edicts, ED_sounds));
|
||||||
|
|
||||||
// set view
|
// set view
|
||||||
MSG_WriteByte(&client->message, svc_setview);
|
MSG_WriteByte(&client->message, svc_setview);
|
||||||
MSG_WriteShort(&client->message, NUM_FOR_EDICT(client->edict));
|
MSG_WriteShort(&client->message, NumForEdict(client->edict));
|
||||||
|
|
||||||
MSG_WriteByte(&client->message, svc_signonnum);
|
MSG_WriteByte(&client->message, svc_signonnum);
|
||||||
MSG_WriteByte(&client->message, 1);
|
MSG_WriteByte(&client->message, 1);
|
||||||
|
@ -359,7 +359,7 @@ void SV_ConnectClient(int32_t clientnum)
|
||||||
|
|
||||||
edictnum = clientnum + 1;
|
edictnum = clientnum + 1;
|
||||||
|
|
||||||
ent = EDICT_NUM(edictnum);
|
ent = EdictNum(edictnum);
|
||||||
|
|
||||||
// set up the client_t
|
// set up the client_t
|
||||||
netconnection = client->netconnection;
|
netconnection = client->netconnection;
|
||||||
|
@ -382,9 +382,9 @@ void SV_ConnectClient(int32_t clientnum)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// call the progs to get default spawn parms for the new client
|
// call the progs to get default spawn parms for the new client
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_SetNewParms));
|
PR_ExecuteProgram(G_Func(GBL_SetNewParms));
|
||||||
for(i = 0 ; i < NUM_SPAWN_PARMS ; i++)
|
for(i = 0 ; i < NUM_SPAWN_PARMS ; i++)
|
||||||
client->spawn_parms[i] = (&G_FLOAT(GBL_parm1))[i];
|
client->spawn_parms[i] = (&G_Float(GBL_parm1))[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
SV_SendServerinfo(client);
|
SV_SendServerinfo(client);
|
||||||
|
@ -535,7 +535,7 @@ bool SV_VisibleToClient(edict_t *client, edict_t *test, qmodel_t *worldmodel)
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
VectorAdd(ED_VECTOR(client, ED_origin), ED_VECTOR(client, ED_view_ofs), org);
|
VectorAdd(ED_Vector(client, ED_origin), ED_Vector(client, ED_view_ofs), org);
|
||||||
pvs = SV_FatPVS(org, worldmodel);
|
pvs = SV_FatPVS(org, worldmodel);
|
||||||
|
|
||||||
for(i = 0 ; i < test->num_leafs ; i++)
|
for(i = 0 ; i < test->num_leafs ; i++)
|
||||||
|
@ -563,22 +563,22 @@ void SV_WriteEntitiesToClient(edict_t *clent, sizebuf_t *msg)
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
// find the client's PVS
|
// find the client's PVS
|
||||||
VectorAdd(ED_VECTOR(clent, ED_origin), ED_VECTOR(clent, ED_view_ofs), org);
|
VectorAdd(ED_Vector(clent, ED_origin), ED_Vector(clent, ED_view_ofs), org);
|
||||||
pvs = SV_FatPVS(org, sv.worldmodel);
|
pvs = SV_FatPVS(org, sv.worldmodel);
|
||||||
|
|
||||||
// send over all entities (excpet the client) that touch the pvs
|
// send over all entities (excpet the client) that touch the pvs
|
||||||
ent = NEXT_EDICT(sv.edicts);
|
ent = NextEdict(sv.edicts);
|
||||||
for(e = 1 ; e < sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
|
for(e = 1 ; e < sv.num_edicts ; e++, ent = NextEdict(ent))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ent != clent) // clent is ALLWAYS sent
|
if(ent != clent) // clent is ALLWAYS sent
|
||||||
{
|
{
|
||||||
// ignore ents without visible models
|
// ignore ents without visible models
|
||||||
if(!ED_FLOAT(ent, ED_modelindex) || !ED_STRING(ent, ED_model)[0])
|
if(!ED_Float(ent, ED_modelindex) || !ED_String(ent, ED_model)[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//johnfitz -- don't send model>255 entities if protocol is 15
|
//johnfitz -- don't send model>255 entities if protocol is 15
|
||||||
if(sv.protocol == PROTOCOL_NETQUAKE && (int32_t)ED_FLOAT(ent, ED_modelindex) & 0xFF00)
|
if(sv.protocol == PROTOCOL_NETQUAKE && (int32_t)ED_Float(ent, ED_modelindex) & 0xFF00)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ignore if not touching a PV leaf
|
// ignore if not touching a PV leaf
|
||||||
|
@ -615,36 +615,36 @@ void SV_WriteEntitiesToClient(edict_t *clent, sizebuf_t *msg)
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
miss = ED_VECTOR(ent, ED_origin)[i] - ent->baseline.origin[i];
|
miss = ED_Vector(ent, ED_origin)[i] - ent->baseline.origin[i];
|
||||||
if(miss < -0.1 || miss > 0.1)
|
if(miss < -0.1 || miss > 0.1)
|
||||||
bits |= U_ORIGIN1 << i;
|
bits |= U_ORIGIN1 << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_VECTOR(ent, ED_angles)[0] != ent->baseline.angles[0])
|
if(ED_Vector(ent, ED_angles)[0] != ent->baseline.angles[0])
|
||||||
bits |= U_ANGLE1;
|
bits |= U_ANGLE1;
|
||||||
|
|
||||||
if(ED_VECTOR(ent, ED_angles)[1] != ent->baseline.angles[1])
|
if(ED_Vector(ent, ED_angles)[1] != ent->baseline.angles[1])
|
||||||
bits |= U_ANGLE2;
|
bits |= U_ANGLE2;
|
||||||
|
|
||||||
if(ED_VECTOR(ent, ED_angles)[2] != ent->baseline.angles[2])
|
if(ED_Vector(ent, ED_angles)[2] != ent->baseline.angles[2])
|
||||||
bits |= U_ANGLE3;
|
bits |= U_ANGLE3;
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_STEP)
|
if(ED_Float(ent, ED_movetype) == MOVETYPE_STEP)
|
||||||
bits |= U_STEP; // don't mess up the step animation
|
bits |= U_STEP; // don't mess up the step animation
|
||||||
|
|
||||||
if(ent->baseline.colormap != ED_FLOAT(ent, ED_colormap))
|
if(ent->baseline.colormap != ED_Float(ent, ED_colormap))
|
||||||
bits |= U_COLORMAP;
|
bits |= U_COLORMAP;
|
||||||
|
|
||||||
if(ent->baseline.skin != ED_FLOAT(ent, ED_skin))
|
if(ent->baseline.skin != ED_Float(ent, ED_skin))
|
||||||
bits |= U_SKIN;
|
bits |= U_SKIN;
|
||||||
|
|
||||||
if(ent->baseline.frame != ED_FLOAT(ent, ED_frame))
|
if(ent->baseline.frame != ED_Float(ent, ED_frame))
|
||||||
bits |= U_FRAME;
|
bits |= U_FRAME;
|
||||||
|
|
||||||
if(ent->baseline.effects != ED_FLOAT(ent, ED_effects))
|
if(ent->baseline.effects != ED_Float(ent, ED_effects))
|
||||||
bits |= U_EFFECTS;
|
bits |= U_EFFECTS;
|
||||||
|
|
||||||
if(ent->baseline.modelindex != ED_FLOAT(ent, ED_modelindex))
|
if(ent->baseline.modelindex != ED_Float(ent, ED_modelindex))
|
||||||
bits |= U_MODEL;
|
bits |= U_MODEL;
|
||||||
|
|
||||||
//johnfitz -- alpha
|
//johnfitz -- alpha
|
||||||
|
@ -658,7 +658,7 @@ void SV_WriteEntitiesToClient(edict_t *clent, sizebuf_t *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't send invisible entities unless they have effects
|
//don't send invisible entities unless they have effects
|
||||||
if(ent->alpha == ENTALPHA_ZERO && !ED_FLOAT(ent, ED_effects))
|
if(ent->alpha == ENTALPHA_ZERO && !ED_Float(ent, ED_effects))
|
||||||
continue;
|
continue;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
|
@ -667,8 +667,8 @@ void SV_WriteEntitiesToClient(edict_t *clent, sizebuf_t *msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ent->baseline.alpha != ent->alpha) bits |= U_ALPHA;
|
if(ent->baseline.alpha != ent->alpha) bits |= U_ALPHA;
|
||||||
if(bits & U_FRAME && (int32_t)ED_FLOAT(ent, ED_frame) & 0xFF00) bits |= U_FRAME2;
|
if(bits & U_FRAME && (int32_t)ED_Float(ent, ED_frame) & 0xFF00) bits |= U_FRAME2;
|
||||||
if(bits & U_MODEL && (int32_t)ED_FLOAT(ent, ED_modelindex) & 0xFF00) bits |= U_MODEL2;
|
if(bits & U_MODEL && (int32_t)ED_Float(ent, ED_modelindex) & 0xFF00) bits |= U_MODEL2;
|
||||||
if(ent->sendinterval) bits |= U_LERPFINISH;
|
if(ent->sendinterval) bits |= U_LERPFINISH;
|
||||||
if(bits >= 65536) bits |= U_EXTEND1;
|
if(bits >= 65536) bits |= U_EXTEND1;
|
||||||
if(bits >= 16777216) bits |= U_EXTEND2;
|
if(bits >= 16777216) bits |= U_EXTEND2;
|
||||||
|
@ -702,37 +702,37 @@ void SV_WriteEntitiesToClient(edict_t *clent, sizebuf_t *msg)
|
||||||
MSG_WriteByte(msg, e);
|
MSG_WriteByte(msg, e);
|
||||||
|
|
||||||
if(bits & U_MODEL)
|
if(bits & U_MODEL)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_modelindex));
|
MSG_WriteByte(msg, ED_Float(ent, ED_modelindex));
|
||||||
if(bits & U_FRAME)
|
if(bits & U_FRAME)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_frame));
|
MSG_WriteByte(msg, ED_Float(ent, ED_frame));
|
||||||
if(bits & U_COLORMAP)
|
if(bits & U_COLORMAP)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_colormap));
|
MSG_WriteByte(msg, ED_Float(ent, ED_colormap));
|
||||||
if(bits & U_SKIN)
|
if(bits & U_SKIN)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_skin));
|
MSG_WriteByte(msg, ED_Float(ent, ED_skin));
|
||||||
if(bits & U_EFFECTS)
|
if(bits & U_EFFECTS)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_effects));
|
MSG_WriteByte(msg, ED_Float(ent, ED_effects));
|
||||||
if(bits & U_ORIGIN1)
|
if(bits & U_ORIGIN1)
|
||||||
MSG_WriteCoord(msg, ED_VECTOR(ent, ED_origin)[0], sv.protocolflags);
|
MSG_WriteCoord(msg, ED_Vector(ent, ED_origin)[0], sv.protocolflags);
|
||||||
if(bits & U_ANGLE1)
|
if(bits & U_ANGLE1)
|
||||||
MSG_WriteAngle(msg, ED_VECTOR(ent, ED_angles)[0], sv.protocolflags);
|
MSG_WriteAngle(msg, ED_Vector(ent, ED_angles)[0], sv.protocolflags);
|
||||||
if(bits & U_ORIGIN2)
|
if(bits & U_ORIGIN2)
|
||||||
MSG_WriteCoord(msg, ED_VECTOR(ent, ED_origin)[1], sv.protocolflags);
|
MSG_WriteCoord(msg, ED_Vector(ent, ED_origin)[1], sv.protocolflags);
|
||||||
if(bits & U_ANGLE2)
|
if(bits & U_ANGLE2)
|
||||||
MSG_WriteAngle(msg, ED_VECTOR(ent, ED_angles)[1], sv.protocolflags);
|
MSG_WriteAngle(msg, ED_Vector(ent, ED_angles)[1], sv.protocolflags);
|
||||||
if(bits & U_ORIGIN3)
|
if(bits & U_ORIGIN3)
|
||||||
MSG_WriteCoord(msg, ED_VECTOR(ent, ED_origin)[2], sv.protocolflags);
|
MSG_WriteCoord(msg, ED_Vector(ent, ED_origin)[2], sv.protocolflags);
|
||||||
if(bits & U_ANGLE3)
|
if(bits & U_ANGLE3)
|
||||||
MSG_WriteAngle(msg, ED_VECTOR(ent, ED_angles)[2], sv.protocolflags);
|
MSG_WriteAngle(msg, ED_Vector(ent, ED_angles)[2], sv.protocolflags);
|
||||||
|
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
if(bits & U_ALPHA)
|
if(bits & U_ALPHA)
|
||||||
MSG_WriteByte(msg, ent->alpha);
|
MSG_WriteByte(msg, ent->alpha);
|
||||||
if(bits & U_FRAME2)
|
if(bits & U_FRAME2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_frame) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_frame) >> 8);
|
||||||
if(bits & U_MODEL2)
|
if(bits & U_MODEL2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_modelindex) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_modelindex) >> 8);
|
||||||
if(bits & U_LERPFINISH)
|
if(bits & U_LERPFINISH)
|
||||||
MSG_WriteByte(msg, (byte)(Q_rint((ED_FLOAT(ent, ED_nextthink) - sv.time) * 255)));
|
MSG_WriteByte(msg, (byte)(Q_rint((ED_Float(ent, ED_nextthink) - sv.time) * 255)));
|
||||||
//johnfitz
|
//johnfitz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,10 +756,10 @@ void SV_CleanupEnts(void)
|
||||||
int32_t e;
|
int32_t e;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
ent = NEXT_EDICT(sv.edicts);
|
ent = NextEdict(sv.edicts);
|
||||||
for(e = 1 ; e < sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
|
for(e = 1 ; e < sv.num_edicts ; e++, ent = NextEdict(ent))
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_effects) = (int32_t)ED_FLOAT(ent, ED_effects) & ~EF_MUZZLEFLASH;
|
ED_Float(ent, ED_effects) = (int32_t)ED_Float(ent, ED_effects) & ~EF_MUZZLEFLASH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,17 +780,17 @@ void SV_WriteClientdataToMessage(edict_t *ent, sizebuf_t *msg)
|
||||||
//
|
//
|
||||||
// send a damage message
|
// send a damage message
|
||||||
//
|
//
|
||||||
if(ED_FLOAT(ent, ED_dmg_take) || ED_FLOAT(ent, ED_dmg_save))
|
if(ED_Float(ent, ED_dmg_take) || ED_Float(ent, ED_dmg_save))
|
||||||
{
|
{
|
||||||
other = PROG_TO_EDICT(ED_PEDICT(ent, ED_dmg_inflictor));
|
other = ProgEdict(ED_PEdict(ent, ED_dmg_inflictor));
|
||||||
MSG_WriteByte(msg, svc_damage);
|
MSG_WriteByte(msg, svc_damage);
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_dmg_save));
|
MSG_WriteByte(msg, ED_Float(ent, ED_dmg_save));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_dmg_take));
|
MSG_WriteByte(msg, ED_Float(ent, ED_dmg_take));
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
MSG_WriteCoord(msg, ED_VECTOR(other, ED_origin)[i] + 0.5 * (ED_VECTOR(other, ED_mins)[i] + ED_VECTOR(other, ED_maxs)[i]), sv.protocolflags);
|
MSG_WriteCoord(msg, ED_Vector(other, ED_origin)[i] + 0.5 * (ED_Vector(other, ED_mins)[i] + ED_Vector(other, ED_maxs)[i]), sv.protocolflags);
|
||||||
|
|
||||||
ED_FLOAT(ent, ED_dmg_take) = 0;
|
ED_Float(ent, ED_dmg_take) = 0;
|
||||||
ED_FLOAT(ent, ED_dmg_save) = 0;
|
ED_Float(ent, ED_dmg_save) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -799,20 +799,20 @@ void SV_WriteClientdataToMessage(edict_t *ent, sizebuf_t *msg)
|
||||||
SV_SetIdealPitch(); // how much to look up / down ideally
|
SV_SetIdealPitch(); // how much to look up / down ideally
|
||||||
|
|
||||||
// a fixangle might get lost in a dropped packet. Oh well.
|
// a fixangle might get lost in a dropped packet. Oh well.
|
||||||
if(ED_FLOAT(ent, ED_fixangle))
|
if(ED_Float(ent, ED_fixangle))
|
||||||
{
|
{
|
||||||
MSG_WriteByte(msg, svc_setangle);
|
MSG_WriteByte(msg, svc_setangle);
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
MSG_WriteAngle(msg, ED_VECTOR(ent, ED_angles)[i], sv.protocolflags);
|
MSG_WriteAngle(msg, ED_Vector(ent, ED_angles)[i], sv.protocolflags);
|
||||||
ED_FLOAT(ent, ED_fixangle) = 0;
|
ED_Float(ent, ED_fixangle) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bits = 0;
|
bits = 0;
|
||||||
|
|
||||||
if(ED_VECTOR(ent, ED_view_ofs)[2] != DEFAULT_VIEWHEIGHT)
|
if(ED_Vector(ent, ED_view_ofs)[2] != DEFAULT_VIEWHEIGHT)
|
||||||
bits |= SU_VIEWHEIGHT;
|
bits |= SU_VIEWHEIGHT;
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_idealpitch))
|
if(ED_Float(ent, ED_idealpitch))
|
||||||
bits |= SU_IDEALPITCH;
|
bits |= SU_IDEALPITCH;
|
||||||
|
|
||||||
// stuff the sigil bits into the high bits of items for sbar, or else
|
// stuff the sigil bits into the high bits of items for sbar, or else
|
||||||
|
@ -820,46 +820,46 @@ void SV_WriteClientdataToMessage(edict_t *ent, sizebuf_t *msg)
|
||||||
val = GetEdictFieldValue(ent, "items2");
|
val = GetEdictFieldValue(ent, "items2");
|
||||||
|
|
||||||
if(val)
|
if(val)
|
||||||
items = (int32_t)ED_FLOAT(ent, ED_items) | ((int32_t)val->flt << 23);
|
items = (int32_t)ED_Float(ent, ED_items) | ((int32_t)val->flt << 23);
|
||||||
else
|
else
|
||||||
items = (int32_t)ED_FLOAT(ent, ED_items) | ((int32_t)G_FLOAT(GBL_serverflags) << 28);
|
items = (int32_t)ED_Float(ent, ED_items) | ((int32_t)G_Float(GBL_serverflags) << 28);
|
||||||
|
|
||||||
bits |= SU_ITEMS;
|
bits |= SU_ITEMS;
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_ONGROUND)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_ONGROUND)
|
||||||
bits |= SU_ONGROUND;
|
bits |= SU_ONGROUND;
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_waterlevel) >= 2)
|
if(ED_Float(ent, ED_waterlevel) >= 2)
|
||||||
bits |= SU_INWATER;
|
bits |= SU_INWATER;
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if(ED_VECTOR(ent, ED_punchangle)[i])
|
if(ED_Vector(ent, ED_punchangle)[i])
|
||||||
bits |= (SU_PUNCH1 << i);
|
bits |= (SU_PUNCH1 << i);
|
||||||
if(ED_VECTOR(ent, ED_velocity)[i])
|
if(ED_Vector(ent, ED_velocity)[i])
|
||||||
bits |= (SU_VELOCITY1 << i);
|
bits |= (SU_VELOCITY1 << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_weaponframe))
|
if(ED_Float(ent, ED_weaponframe))
|
||||||
bits |= SU_WEAPONFRAME;
|
bits |= SU_WEAPONFRAME;
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_armorvalue))
|
if(ED_Float(ent, ED_armorvalue))
|
||||||
bits |= SU_ARMOR;
|
bits |= SU_ARMOR;
|
||||||
|
|
||||||
// if (ED_FLOAT(ent, ED_weapon))
|
// if (ED_Float(ent, ED_weapon))
|
||||||
bits |= SU_WEAPON;
|
bits |= SU_WEAPON;
|
||||||
|
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
if(sv.protocol != PROTOCOL_NETQUAKE)
|
if(sv.protocol != PROTOCOL_NETQUAKE)
|
||||||
{
|
{
|
||||||
if(bits & SU_WEAPON && SV_ModelIndex(ED_STRING(ent, ED_weaponmodel)) & 0xFF00) bits |= SU_WEAPON2;
|
if(bits & SU_WEAPON && SV_ModelIndex(ED_String(ent, ED_weaponmodel)) & 0xFF00) bits |= SU_WEAPON2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_armorvalue) & 0xFF00) bits |= SU_ARMOR2;
|
if((int32_t)ED_Float(ent, ED_armorvalue) & 0xFF00) bits |= SU_ARMOR2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_currentammo) & 0xFF00) bits |= SU_AMMO2;
|
if((int32_t)ED_Float(ent, ED_currentammo) & 0xFF00) bits |= SU_AMMO2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_ammo_shells) & 0xFF00) bits |= SU_SHELLS2;
|
if((int32_t)ED_Float(ent, ED_ammo_shells) & 0xFF00) bits |= SU_SHELLS2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_ammo_nails) & 0xFF00) bits |= SU_NAILS2;
|
if((int32_t)ED_Float(ent, ED_ammo_nails) & 0xFF00) bits |= SU_NAILS2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_ammo_rockets) & 0xFF00) bits |= SU_ROCKETS2;
|
if((int32_t)ED_Float(ent, ED_ammo_rockets) & 0xFF00) bits |= SU_ROCKETS2;
|
||||||
if((int32_t)ED_FLOAT(ent, ED_ammo_cells) & 0xFF00) bits |= SU_CELLS2;
|
if((int32_t)ED_Float(ent, ED_ammo_cells) & 0xFF00) bits |= SU_CELLS2;
|
||||||
if(bits & SU_WEAPONFRAME && (int32_t)ED_FLOAT(ent, ED_weaponframe) & 0xFF00) bits |= SU_WEAPONFRAME2;
|
if(bits & SU_WEAPONFRAME && (int32_t)ED_Float(ent, ED_weaponframe) & 0xFF00) bits |= SU_WEAPONFRAME2;
|
||||||
if(bits & SU_WEAPON && ent->alpha != ENTALPHA_DEFAULT) bits |= SU_WEAPONALPHA; //for now, weaponalpha = client entity alpha
|
if(bits & SU_WEAPON && ent->alpha != ENTALPHA_DEFAULT) bits |= SU_WEAPONALPHA; //for now, weaponalpha = client entity alpha
|
||||||
if(bits >= 65536) bits |= SU_EXTEND1;
|
if(bits >= 65536) bits |= SU_EXTEND1;
|
||||||
if(bits >= 16777216) bits |= SU_EXTEND2;
|
if(bits >= 16777216) bits |= SU_EXTEND2;
|
||||||
|
@ -877,45 +877,45 @@ void SV_WriteClientdataToMessage(edict_t *ent, sizebuf_t *msg)
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
if(bits & SU_VIEWHEIGHT)
|
if(bits & SU_VIEWHEIGHT)
|
||||||
MSG_WriteChar(msg, ED_VECTOR(ent, ED_view_ofs)[2]);
|
MSG_WriteChar(msg, ED_Vector(ent, ED_view_ofs)[2]);
|
||||||
|
|
||||||
if(bits & SU_IDEALPITCH)
|
if(bits & SU_IDEALPITCH)
|
||||||
MSG_WriteChar(msg, ED_FLOAT(ent, ED_idealpitch));
|
MSG_WriteChar(msg, ED_Float(ent, ED_idealpitch));
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if(bits & (SU_PUNCH1 << i))
|
if(bits & (SU_PUNCH1 << i))
|
||||||
MSG_WriteChar(msg, ED_VECTOR(ent, ED_punchangle)[i]);
|
MSG_WriteChar(msg, ED_Vector(ent, ED_punchangle)[i]);
|
||||||
if(bits & (SU_VELOCITY1 << i))
|
if(bits & (SU_VELOCITY1 << i))
|
||||||
MSG_WriteChar(msg, ED_VECTOR(ent, ED_velocity)[i] / 16);
|
MSG_WriteChar(msg, ED_Vector(ent, ED_velocity)[i] / 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// [always sent] if (bits & SU_ITEMS)
|
// [always sent] if (bits & SU_ITEMS)
|
||||||
MSG_WriteLong(msg, items);
|
MSG_WriteLong(msg, items);
|
||||||
|
|
||||||
if(bits & SU_WEAPONFRAME)
|
if(bits & SU_WEAPONFRAME)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_weaponframe));
|
MSG_WriteByte(msg, ED_Float(ent, ED_weaponframe));
|
||||||
if(bits & SU_ARMOR)
|
if(bits & SU_ARMOR)
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_armorvalue));
|
MSG_WriteByte(msg, ED_Float(ent, ED_armorvalue));
|
||||||
if(bits & SU_WEAPON)
|
if(bits & SU_WEAPON)
|
||||||
MSG_WriteByte(msg, SV_ModelIndex(ED_STRING(ent, ED_weaponmodel)));
|
MSG_WriteByte(msg, SV_ModelIndex(ED_String(ent, ED_weaponmodel)));
|
||||||
|
|
||||||
MSG_WriteShort(msg, ED_FLOAT(ent, ED_health));
|
MSG_WriteShort(msg, ED_Float(ent, ED_health));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_currentammo));
|
MSG_WriteByte(msg, ED_Float(ent, ED_currentammo));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_ammo_shells));
|
MSG_WriteByte(msg, ED_Float(ent, ED_ammo_shells));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_ammo_nails));
|
MSG_WriteByte(msg, ED_Float(ent, ED_ammo_nails));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_ammo_rockets));
|
MSG_WriteByte(msg, ED_Float(ent, ED_ammo_rockets));
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_ammo_cells));
|
MSG_WriteByte(msg, ED_Float(ent, ED_ammo_cells));
|
||||||
|
|
||||||
if(standard_quake)
|
if(standard_quake)
|
||||||
{
|
{
|
||||||
MSG_WriteByte(msg, ED_FLOAT(ent, ED_weapon));
|
MSG_WriteByte(msg, ED_Float(ent, ED_weapon));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(i = 0; i < 32; i++)
|
for(i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
if(((int32_t)ED_FLOAT(ent, ED_weapon)) & (1 << i))
|
if(((int32_t)ED_Float(ent, ED_weapon)) & (1 << i))
|
||||||
{
|
{
|
||||||
MSG_WriteByte(msg, i);
|
MSG_WriteByte(msg, i);
|
||||||
break;
|
break;
|
||||||
|
@ -925,21 +925,21 @@ void SV_WriteClientdataToMessage(edict_t *ent, sizebuf_t *msg)
|
||||||
|
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
if(bits & SU_WEAPON2)
|
if(bits & SU_WEAPON2)
|
||||||
MSG_WriteByte(msg, SV_ModelIndex(ED_STRING(ent, ED_weaponmodel)) >> 8);
|
MSG_WriteByte(msg, SV_ModelIndex(ED_String(ent, ED_weaponmodel)) >> 8);
|
||||||
if(bits & SU_ARMOR2)
|
if(bits & SU_ARMOR2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_armorvalue) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_armorvalue) >> 8);
|
||||||
if(bits & SU_AMMO2)
|
if(bits & SU_AMMO2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_currentammo) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_currentammo) >> 8);
|
||||||
if(bits & SU_SHELLS2)
|
if(bits & SU_SHELLS2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_ammo_shells) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_ammo_shells) >> 8);
|
||||||
if(bits & SU_NAILS2)
|
if(bits & SU_NAILS2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_ammo_nails) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_ammo_nails) >> 8);
|
||||||
if(bits & SU_ROCKETS2)
|
if(bits & SU_ROCKETS2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_ammo_rockets) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_ammo_rockets) >> 8);
|
||||||
if(bits & SU_CELLS2)
|
if(bits & SU_CELLS2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_ammo_cells) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_ammo_cells) >> 8);
|
||||||
if(bits & SU_WEAPONFRAME2)
|
if(bits & SU_WEAPONFRAME2)
|
||||||
MSG_WriteByte(msg, (int32_t)ED_FLOAT(ent, ED_weaponframe) >> 8);
|
MSG_WriteByte(msg, (int32_t)ED_Float(ent, ED_weaponframe) >> 8);
|
||||||
if(bits & SU_WEAPONALPHA)
|
if(bits & SU_WEAPONALPHA)
|
||||||
MSG_WriteByte(msg, ent->alpha); //for now, weaponalpha = client entity alpha
|
MSG_WriteByte(msg, ent->alpha); //for now, weaponalpha = client entity alpha
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
@ -999,7 +999,7 @@ void SV_UpdateToReliableMessages(void)
|
||||||
// check for changes to be sent over the reliable streams
|
// check for changes to be sent over the reliable streams
|
||||||
for(i = 0, host_client = svs.clients ; i < svs.maxclients ; i++, host_client++)
|
for(i = 0, host_client = svs.clients ; i < svs.maxclients ; i++, host_client++)
|
||||||
{
|
{
|
||||||
if(host_client->old_frags != ED_FLOAT(host_client->edict, ED_frags))
|
if(host_client->old_frags != ED_Float(host_client->edict, ED_frags))
|
||||||
{
|
{
|
||||||
for(j = 0, client = svs.clients ; j < svs.maxclients ; j++, client++)
|
for(j = 0, client = svs.clients ; j < svs.maxclients ; j++, client++)
|
||||||
{
|
{
|
||||||
|
@ -1007,10 +1007,10 @@ void SV_UpdateToReliableMessages(void)
|
||||||
continue;
|
continue;
|
||||||
MSG_WriteByte(&client->message, svc_updatefrags);
|
MSG_WriteByte(&client->message, svc_updatefrags);
|
||||||
MSG_WriteByte(&client->message, i);
|
MSG_WriteByte(&client->message, i);
|
||||||
MSG_WriteShort(&client->message, ED_FLOAT(host_client->edict, ED_frags));
|
MSG_WriteShort(&client->message, ED_Float(host_client->edict, ED_frags));
|
||||||
}
|
}
|
||||||
|
|
||||||
host_client->old_frags = ED_FLOAT(host_client->edict, ED_frags);
|
host_client->old_frags = ED_Float(host_client->edict, ED_frags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,19 +1169,19 @@ void SV_CreateBaseline(void)
|
||||||
for(entnum = 0; entnum < sv.num_edicts ; entnum++)
|
for(entnum = 0; entnum < sv.num_edicts ; entnum++)
|
||||||
{
|
{
|
||||||
// get the current server version
|
// get the current server version
|
||||||
svent = EDICT_NUM(entnum);
|
svent = EdictNum(entnum);
|
||||||
if(svent->free)
|
if(svent->free)
|
||||||
continue;
|
continue;
|
||||||
if(entnum > svs.maxclients && !ED_FLOAT(svent, ED_modelindex))
|
if(entnum > svs.maxclients && !ED_Float(svent, ED_modelindex))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//
|
//
|
||||||
// create entity baseline
|
// create entity baseline
|
||||||
//
|
//
|
||||||
VectorCopy(ED_VECTOR(svent, ED_origin), svent->baseline.origin);
|
VectorCopy(ED_Vector(svent, ED_origin), svent->baseline.origin);
|
||||||
VectorCopy(ED_VECTOR(svent, ED_angles), svent->baseline.angles);
|
VectorCopy(ED_Vector(svent, ED_angles), svent->baseline.angles);
|
||||||
svent->baseline.frame = ED_FLOAT(svent, ED_frame);
|
svent->baseline.frame = ED_Float(svent, ED_frame);
|
||||||
svent->baseline.skin = ED_FLOAT(svent, ED_skin);
|
svent->baseline.skin = ED_Float(svent, ED_skin);
|
||||||
if(entnum > 0 && entnum <= svs.maxclients)
|
if(entnum > 0 && entnum <= svs.maxclients)
|
||||||
{
|
{
|
||||||
svent->baseline.colormap = entnum;
|
svent->baseline.colormap = entnum;
|
||||||
|
@ -1191,7 +1191,7 @@ void SV_CreateBaseline(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
svent->baseline.colormap = 0;
|
svent->baseline.colormap = 0;
|
||||||
svent->baseline.modelindex = SV_ModelIndex(ED_STRING(svent, ED_model));
|
svent->baseline.modelindex = SV_ModelIndex(ED_String(svent, ED_model));
|
||||||
svent->baseline.alpha = svent->alpha; //johnfitz -- alpha support
|
svent->baseline.alpha = svent->alpha; //johnfitz -- alpha support
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1296,7 +1296,7 @@ void SV_SaveSpawnparms(void)
|
||||||
{
|
{
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
|
|
||||||
svs.serverflags = G_FLOAT(GBL_serverflags);
|
svs.serverflags = G_Float(GBL_serverflags);
|
||||||
|
|
||||||
for(i = 0, host_client = svs.clients ; i < svs.maxclients ; i++, host_client++)
|
for(i = 0, host_client = svs.clients ; i < svs.maxclients ; i++, host_client++)
|
||||||
{
|
{
|
||||||
|
@ -1304,10 +1304,10 @@ void SV_SaveSpawnparms(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// call the progs to get default spawn parms for the new client
|
// call the progs to get default spawn parms for the new client
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(host_client->edict);
|
G_PEdict(GBL_self) = EdictProg(host_client->edict);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_SetChangeParms));
|
PR_ExecuteProgram(G_Func(GBL_SetChangeParms));
|
||||||
for(j = 0 ; j < NUM_SPAWN_PARMS ; j++)
|
for(j = 0 ; j < NUM_SPAWN_PARMS ; j++)
|
||||||
host_client->spawn_parms[j] = (&G_FLOAT(GBL_parm1))[j];
|
host_client->spawn_parms[j] = (&G_Float(GBL_parm1))[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1398,7 +1398,7 @@ void SV_SpawnServer(const char *server)
|
||||||
memset(sv.edicts, 0, sv.num_edicts * pr_edict_size); // ericw -- sv.edicts switched to use malloc()
|
memset(sv.edicts, 0, sv.num_edicts * pr_edict_size); // ericw -- sv.edicts switched to use malloc()
|
||||||
for(i = 0 ; i < svs.maxclients ; i++)
|
for(i = 0 ; i < svs.maxclients ; i++)
|
||||||
{
|
{
|
||||||
ent = EDICT_NUM(i + 1);
|
ent = EdictNum(i + 1);
|
||||||
svs.clients[i].edict = ent;
|
svs.clients[i].edict = ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1435,23 +1435,23 @@ void SV_SpawnServer(const char *server)
|
||||||
//
|
//
|
||||||
// load the rest of the entities
|
// load the rest of the entities
|
||||||
//
|
//
|
||||||
ent = EDICT_NUM(0);
|
ent = EdictNum(0);
|
||||||
memset(ent->fields, 0, progs.entityfields * 4);
|
memset(ent->fields, 0, progs.entityfields * 4);
|
||||||
ent->free = false;
|
ent->free = false;
|
||||||
ED_RSTRING(ent, ED_model) = PR_SetEngineString(sv.worldmodel->name);
|
ED_RString(ent, ED_model) = PR_SetEngineString(sv.worldmodel->name);
|
||||||
ED_FLOAT(ent, ED_modelindex) = 1; // world model
|
ED_Float(ent, ED_modelindex) = 1; // world model
|
||||||
ED_FLOAT(ent, ED_solid) = SOLID_BSP;
|
ED_Float(ent, ED_solid) = SOLID_BSP;
|
||||||
ED_FLOAT(ent, ED_movetype) = MOVETYPE_PUSH;
|
ED_Float(ent, ED_movetype) = MOVETYPE_PUSH;
|
||||||
|
|
||||||
if(coop.value)
|
if(coop.value)
|
||||||
G_FLOAT(GBL_coop) = coop.value;
|
G_Float(GBL_coop) = coop.value;
|
||||||
else
|
else
|
||||||
G_FLOAT(GBL_deathmatch) = deathmatch.value;
|
G_Float(GBL_deathmatch) = deathmatch.value;
|
||||||
|
|
||||||
G_RSTRING(GBL_mapname) = PR_SetEngineString(sv.name);
|
G_RString(GBL_mapname) = PR_SetEngineString(sv.name);
|
||||||
|
|
||||||
// serverflags are for cross level information (sigils)
|
// serverflags are for cross level information (sigils)
|
||||||
G_FLOAT(GBL_serverflags) = svs.serverflags;
|
G_Float(GBL_serverflags) = svs.serverflags;
|
||||||
|
|
||||||
ED_LoadFromFile(sv.worldmodel->entities);
|
ED_LoadFromFile(sv.worldmodel->entities);
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ bool SV_CheckBottom(edict_t *ent)
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
float mid, bottom;
|
float mid, bottom;
|
||||||
|
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), mins);
|
VectorAdd(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), mins);
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_maxs), maxs);
|
VectorAdd(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_maxs), maxs);
|
||||||
|
|
||||||
// if all of the points under the corners are solid world, don't bother
|
// if all of the points under the corners are solid world, don't bother
|
||||||
// with the tougher checks
|
// with the tougher checks
|
||||||
|
@ -118,33 +118,33 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
|
||||||
edict_t *enemy;
|
edict_t *enemy;
|
||||||
|
|
||||||
// try the move
|
// try the move
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), oldorg);
|
VectorCopy(ED_Vector(ent, ED_origin), oldorg);
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), move, neworg);
|
VectorAdd(ED_Vector(ent, ED_origin), move, neworg);
|
||||||
|
|
||||||
// flying monsters don't step up
|
// flying monsters don't step up
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & (FL_SWIM | FL_FLY))
|
if((int32_t)ED_Float(ent, ED_flags) & (FL_SWIM | FL_FLY))
|
||||||
{
|
{
|
||||||
// try one move with vertical motion, then one without
|
// try one move with vertical motion, then one without
|
||||||
for(i = 0 ; i < 2 ; i++)
|
for(i = 0 ; i < 2 ; i++)
|
||||||
{
|
{
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), move, neworg);
|
VectorAdd(ED_Vector(ent, ED_origin), move, neworg);
|
||||||
enemy = PROG_TO_EDICT(ED_PEDICT(ent, ED_enemy));
|
enemy = ProgEdict(ED_PEdict(ent, ED_enemy));
|
||||||
if(i == 0 && enemy != sv.edicts)
|
if(i == 0 && enemy != sv.edicts)
|
||||||
{
|
{
|
||||||
dz = ED_VECTOR(ent, ED_origin)[2] - ED_VECTOR(PROG_TO_EDICT(ED_PEDICT(ent, ED_enemy)), ED_origin)[2];
|
dz = ED_Vector(ent, ED_origin)[2] - ED_Vector(ProgEdict(ED_PEdict(ent, ED_enemy)), ED_origin)[2];
|
||||||
if(dz > 40)
|
if(dz > 40)
|
||||||
neworg[2] -= 8;
|
neworg[2] -= 8;
|
||||||
if(dz < 30)
|
if(dz < 30)
|
||||||
neworg[2] += 8;
|
neworg[2] += 8;
|
||||||
}
|
}
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), neworg, false, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), neworg, false, ent);
|
||||||
|
|
||||||
if(trace.fraction == 1)
|
if(trace.fraction == 1)
|
||||||
{
|
{
|
||||||
if(((int32_t)ED_FLOAT(ent, ED_flags) & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY)
|
if(((int32_t)ED_Float(ent, ED_flags) & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY)
|
||||||
return false; // swim monster left water
|
return false; // swim monster left water
|
||||||
|
|
||||||
VectorCopy(trace.endpos, ED_VECTOR(ent, ED_origin));
|
VectorCopy(trace.endpos, ED_Vector(ent, ED_origin));
|
||||||
if(relink)
|
if(relink)
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -162,7 +162,7 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
|
||||||
VectorCopy(neworg, end);
|
VectorCopy(neworg, end);
|
||||||
end[2] -= STEPSIZE * 2;
|
end[2] -= STEPSIZE * 2;
|
||||||
|
|
||||||
trace = SV_Move(neworg, ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, false, ent);
|
trace = SV_Move(neworg, ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, false, ent);
|
||||||
|
|
||||||
if(trace.allsolid)
|
if(trace.allsolid)
|
||||||
return false;
|
return false;
|
||||||
|
@ -170,19 +170,19 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
|
||||||
if(trace.startsolid)
|
if(trace.startsolid)
|
||||||
{
|
{
|
||||||
neworg[2] -= STEPSIZE;
|
neworg[2] -= STEPSIZE;
|
||||||
trace = SV_Move(neworg, ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, false, ent);
|
trace = SV_Move(neworg, ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, false, ent);
|
||||||
if(trace.allsolid || trace.startsolid)
|
if(trace.allsolid || trace.startsolid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(trace.fraction == 1)
|
if(trace.fraction == 1)
|
||||||
{
|
{
|
||||||
// if monster had the ground pulled out, go ahead and fall
|
// if monster had the ground pulled out, go ahead and fall
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_PARTIALGROUND)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_PARTIALGROUND)
|
||||||
{
|
{
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), move, ED_VECTOR(ent, ED_origin));
|
VectorAdd(ED_Vector(ent, ED_origin), move, ED_Vector(ent, ED_origin));
|
||||||
if(relink)
|
if(relink)
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) & ~FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) & ~FL_ONGROUND;
|
||||||
// Con_Printf ("fall down\n");
|
// Con_Printf ("fall down\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -191,11 +191,11 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check point traces down for dangling corners
|
// check point traces down for dangling corners
|
||||||
VectorCopy(trace.endpos, ED_VECTOR(ent, ED_origin));
|
VectorCopy(trace.endpos, ED_Vector(ent, ED_origin));
|
||||||
|
|
||||||
if(!SV_CheckBottom(ent))
|
if(!SV_CheckBottom(ent))
|
||||||
{
|
{
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_PARTIALGROUND)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_PARTIALGROUND)
|
||||||
{
|
{
|
||||||
// entity had floor mostly pulled out from underneath it
|
// entity had floor mostly pulled out from underneath it
|
||||||
// and is trying to correct
|
// and is trying to correct
|
||||||
|
@ -203,16 +203,16 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
VectorCopy(oldorg, ED_VECTOR(ent, ED_origin));
|
VectorCopy(oldorg, ED_Vector(ent, ED_origin));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_PARTIALGROUND)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_PARTIALGROUND)
|
||||||
{
|
{
|
||||||
// Con_Printf ("back on ground\n");
|
// Con_Printf ("back on ground\n");
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) & ~FL_PARTIALGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) & ~FL_PARTIALGROUND;
|
||||||
}
|
}
|
||||||
ED_PEDICT(ent, ED_groundentity) = EDICT_TO_PROG(trace.ent);
|
ED_PEdict(ent, ED_groundentity) = EdictProg(trace.ent);
|
||||||
|
|
||||||
// the move is ok
|
// the move is ok
|
||||||
if(relink)
|
if(relink)
|
||||||
|
@ -238,7 +238,7 @@ bool SV_StepDirection(edict_t *ent, float yaw, float dist)
|
||||||
vec3_t move, oldorigin;
|
vec3_t move, oldorigin;
|
||||||
float delta;
|
float delta;
|
||||||
|
|
||||||
ED_FLOAT(ent, ED_ideal_yaw) = yaw;
|
ED_Float(ent, ED_ideal_yaw) = yaw;
|
||||||
PF_changeyaw();
|
PF_changeyaw();
|
||||||
|
|
||||||
yaw = yaw * PI * 2 / 360;
|
yaw = yaw * PI * 2 / 360;
|
||||||
|
@ -246,14 +246,14 @@ bool SV_StepDirection(edict_t *ent, float yaw, float dist)
|
||||||
move[1] = sin(yaw) * dist;
|
move[1] = sin(yaw) * dist;
|
||||||
move[2] = 0;
|
move[2] = 0;
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), oldorigin);
|
VectorCopy(ED_Vector(ent, ED_origin), oldorigin);
|
||||||
if(SV_movestep(ent, move, false))
|
if(SV_movestep(ent, move, false))
|
||||||
{
|
{
|
||||||
delta = ED_VECTOR(ent, ED_angles)[YAW] - ED_FLOAT(ent, ED_ideal_yaw);
|
delta = ED_Vector(ent, ED_angles)[YAW] - ED_Float(ent, ED_ideal_yaw);
|
||||||
if(delta > 45 && delta < 315)
|
if(delta > 45 && delta < 315)
|
||||||
{
|
{
|
||||||
// not turned far enough, so don't take the step
|
// not turned far enough, so don't take the step
|
||||||
VectorCopy(oldorigin, ED_VECTOR(ent, ED_origin));
|
VectorCopy(oldorigin, ED_Vector(ent, ED_origin));
|
||||||
}
|
}
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -273,7 +273,7 @@ void SV_FixCheckBottom(edict_t *ent)
|
||||||
{
|
{
|
||||||
// Con_Printf ("SV_FixCheckBottom\n");
|
// Con_Printf ("SV_FixCheckBottom\n");
|
||||||
|
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) | FL_PARTIALGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) | FL_PARTIALGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,11 +291,11 @@ void SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist)
|
||||||
float d[3];
|
float d[3];
|
||||||
float tdir, olddir, turnaround;
|
float tdir, olddir, turnaround;
|
||||||
|
|
||||||
olddir = anglemod((int32_t)(ED_FLOAT(actor, ED_ideal_yaw) / 45) * 45);
|
olddir = anglemod((int32_t)(ED_Float(actor, ED_ideal_yaw) / 45) * 45);
|
||||||
turnaround = anglemod(olddir - 180);
|
turnaround = anglemod(olddir - 180);
|
||||||
|
|
||||||
deltax = ED_VECTOR(enemy, ED_origin)[0] - ED_VECTOR(actor, ED_origin)[0];
|
deltax = ED_Vector(enemy, ED_origin)[0] - ED_Vector(actor, ED_origin)[0];
|
||||||
deltay = ED_VECTOR(enemy, ED_origin)[1] - ED_VECTOR(actor, ED_origin)[1];
|
deltay = ED_Vector(enemy, ED_origin)[1] - ED_Vector(actor, ED_origin)[1];
|
||||||
if(deltax > 10)
|
if(deltax > 10)
|
||||||
d[1] = 0;
|
d[1] = 0;
|
||||||
else if(deltax < -10)
|
else if(deltax < -10)
|
||||||
|
@ -358,7 +358,7 @@ void SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist)
|
||||||
if(turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist))
|
if(turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ED_FLOAT(actor, ED_ideal_yaw) = olddir; // can't move
|
ED_Float(actor, ED_ideal_yaw) = olddir; // can't move
|
||||||
|
|
||||||
// if a bridge was pulled out from underneath a monster, it may not have
|
// if a bridge was pulled out from underneath a monster, it may not have
|
||||||
// a valid standing position at all
|
// a valid standing position at all
|
||||||
|
@ -380,9 +380,9 @@ bool SV_CloseEnough(edict_t *ent, edict_t *goal, float dist)
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if(ED_VECTOR(goal, ED_absmin)[i] > ED_VECTOR(ent, ED_absmax)[i] + dist)
|
if(ED_Vector(goal, ED_absmin)[i] > ED_Vector(ent, ED_absmax)[i] + dist)
|
||||||
return false;
|
return false;
|
||||||
if(ED_VECTOR(goal, ED_absmax)[i] < ED_VECTOR(ent, ED_absmin)[i] - dist)
|
if(ED_Vector(goal, ED_absmax)[i] < ED_Vector(ent, ED_absmin)[i] - dist)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -399,23 +399,23 @@ void SV_MoveToGoal(void)
|
||||||
edict_t *ent, *goal;
|
edict_t *ent, *goal;
|
||||||
float dist;
|
float dist;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT(G_PEDICT(GBL_self));
|
ent = ProgEdict(G_PEdict(GBL_self));
|
||||||
goal = PROG_TO_EDICT(ED_PEDICT(ent, ED_goalentity));
|
goal = ProgEdict(ED_PEdict(ent, ED_goalentity));
|
||||||
dist = G_FLOAT(GBL_PARM0);
|
dist = G_Float(GBL_PARM0);
|
||||||
|
|
||||||
if(!((int32_t)ED_FLOAT(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
if(!((int32_t)ED_Float(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
||||||
{
|
{
|
||||||
G_FLOAT(GBL_RETURN) = 0;
|
G_Float(GBL_RETURN) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the next step hits the enemy, return immediately
|
// if the next step hits the enemy, return immediately
|
||||||
if(PROG_TO_EDICT(ED_PEDICT(ent, ED_enemy)) != sv.edicts && SV_CloseEnough(ent, goal, dist))
|
if(ProgEdict(ED_PEdict(ent, ED_enemy)) != sv.edicts && SV_CloseEnough(ent, goal, dist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// bump around...
|
// bump around...
|
||||||
if((rand() & 3) == 1 ||
|
if((rand() & 3) == 1 ||
|
||||||
!SV_StepDirection(ent, ED_FLOAT(ent, ED_ideal_yaw), dist))
|
!SV_StepDirection(ent, ED_Float(ent, ED_ideal_yaw), dist))
|
||||||
{
|
{
|
||||||
SV_NewChaseDir(ent, goal, dist);
|
SV_NewChaseDir(ent, goal, dist);
|
||||||
}
|
}
|
||||||
|
|
440
source/sv_phys.c
440
source/sv_phys.c
|
@ -64,14 +64,14 @@ void SV_CheckAllEnts(void)
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
|
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
check = NEXT_EDICT(sv.edicts);
|
check = NextEdict(sv.edicts);
|
||||||
for(e = 1 ; e < sv.num_edicts ; e++, check = NEXT_EDICT(check))
|
for(e = 1 ; e < sv.num_edicts ; e++, check = NextEdict(check))
|
||||||
{
|
{
|
||||||
if(check->free)
|
if(check->free)
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(check, ED_movetype) == MOVETYPE_PUSH
|
if(ED_Float(check, ED_movetype) == MOVETYPE_PUSH
|
||||||
|| ED_FLOAT(check, ED_movetype) == MOVETYPE_NONE
|
|| ED_Float(check, ED_movetype) == MOVETYPE_NONE
|
||||||
|| ED_FLOAT(check, ED_movetype) == MOVETYPE_NOCLIP)
|
|| ED_Float(check, ED_movetype) == MOVETYPE_NOCLIP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(SV_TestEntityPosition(check))
|
if(SV_TestEntityPosition(check))
|
||||||
|
@ -93,20 +93,20 @@ void SV_CheckVelocity(edict_t *ent)
|
||||||
//
|
//
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
if(isnan(ED_VECTOR(ent, ED_velocity)[i]))
|
if(isnan(ED_Vector(ent, ED_velocity)[i]))
|
||||||
{
|
{
|
||||||
Con_Printf("Got a NaN velocity on %s\n", ED_STRING(ent, ED_classname));
|
Con_Printf("Got a NaN velocity on %s\n", ED_String(ent, ED_classname));
|
||||||
ED_VECTOR(ent, ED_velocity)[i] = 0;
|
ED_Vector(ent, ED_velocity)[i] = 0;
|
||||||
}
|
}
|
||||||
if(isnan(ED_VECTOR(ent, ED_origin)[i]))
|
if(isnan(ED_Vector(ent, ED_origin)[i]))
|
||||||
{
|
{
|
||||||
Con_Printf("Got a NaN origin on %s\n", ED_STRING(ent, ED_classname));
|
Con_Printf("Got a NaN origin on %s\n", ED_String(ent, ED_classname));
|
||||||
ED_VECTOR(ent, ED_origin)[i] = 0;
|
ED_Vector(ent, ED_origin)[i] = 0;
|
||||||
}
|
}
|
||||||
if(ED_VECTOR(ent, ED_velocity)[i] > sv_maxvelocity.value)
|
if(ED_Vector(ent, ED_velocity)[i] > sv_maxvelocity.value)
|
||||||
ED_VECTOR(ent, ED_velocity)[i] = sv_maxvelocity.value;
|
ED_Vector(ent, ED_velocity)[i] = sv_maxvelocity.value;
|
||||||
else if(ED_VECTOR(ent, ED_velocity)[i] < -sv_maxvelocity.value)
|
else if(ED_Vector(ent, ED_velocity)[i] < -sv_maxvelocity.value)
|
||||||
ED_VECTOR(ent, ED_velocity)[i] = -sv_maxvelocity.value;
|
ED_Vector(ent, ED_velocity)[i] = -sv_maxvelocity.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ bool SV_RunThink(edict_t *ent)
|
||||||
float oldframe; //johnfitz
|
float oldframe; //johnfitz
|
||||||
int32_t i; //johnfitz
|
int32_t i; //johnfitz
|
||||||
|
|
||||||
thinktime = ED_FLOAT(ent, ED_nextthink);
|
thinktime = ED_Float(ent, ED_nextthink);
|
||||||
if(thinktime <= 0 || thinktime > sv.time + host_frametime)
|
if(thinktime <= 0 || thinktime > sv.time + host_frametime)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -135,21 +135,21 @@ bool SV_RunThink(edict_t *ent)
|
||||||
// it is possible to start that way
|
// it is possible to start that way
|
||||||
// by a trigger with a local time.
|
// by a trigger with a local time.
|
||||||
|
|
||||||
oldframe = ED_FLOAT(ent, ED_frame); //johnfitz
|
oldframe = ED_Float(ent, ED_frame); //johnfitz
|
||||||
|
|
||||||
ED_FLOAT(ent, ED_nextthink) = 0;
|
ED_Float(ent, ED_nextthink) = 0;
|
||||||
G_FLOAT(GBL_time) = thinktime;
|
G_Float(GBL_time) = thinktime;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_self) = EdictProg(ent);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(sv.edicts);
|
G_PEdict(GBL_other) = EdictProg(sv.edicts);
|
||||||
PR_ExecuteProgram(ED_FUNC(ent, ED_think));
|
PR_ExecuteProgram(ED_Func(ent, ED_think));
|
||||||
|
|
||||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||||
//capture interval to nextthink here and send it to client for better
|
//capture interval to nextthink here and send it to client for better
|
||||||
//lerp timing, but only if interval is not 0.1 (which client assumes)
|
//lerp timing, but only if interval is not 0.1 (which client assumes)
|
||||||
ent->sendinterval = false;
|
ent->sendinterval = false;
|
||||||
if(!ent->free && ED_FLOAT(ent, ED_nextthink) && (ED_FLOAT(ent, ED_movetype) == MOVETYPE_STEP || ED_FLOAT(ent, ED_frame) != oldframe))
|
if(!ent->free && ED_Float(ent, ED_nextthink) && (ED_Float(ent, ED_movetype) == MOVETYPE_STEP || ED_Float(ent, ED_frame) != oldframe))
|
||||||
{
|
{
|
||||||
i = Q_rint((ED_FLOAT(ent, ED_nextthink) - thinktime) * 255);
|
i = Q_rint((ED_Float(ent, ED_nextthink) - thinktime) * 255);
|
||||||
if(i >= 0 && i < 256 && i != 25 && i != 26) //25 and 26 are close enough to 0.1 to not send
|
if(i >= 0 && i < 256 && i != 25 && i != 26) //25 and 26 are close enough to 0.1 to not send
|
||||||
ent->sendinterval = true;
|
ent->sendinterval = true;
|
||||||
}
|
}
|
||||||
|
@ -169,26 +169,26 @@ void SV_Impact(edict_t *e1, edict_t *e2)
|
||||||
{
|
{
|
||||||
pedict_t old_self, old_other;
|
pedict_t old_self, old_other;
|
||||||
|
|
||||||
old_self = G_PEDICT(GBL_self);
|
old_self = G_PEdict(GBL_self);
|
||||||
old_other = G_PEDICT(GBL_other);
|
old_other = G_PEdict(GBL_other);
|
||||||
|
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
if(ED_FUNC(e1, ED_touch) && ED_FLOAT(e1, ED_solid) != SOLID_NOT)
|
if(ED_Func(e1, ED_touch) && ED_Float(e1, ED_solid) != SOLID_NOT)
|
||||||
{
|
{
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(e1);
|
G_PEdict(GBL_self) = EdictProg(e1);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(e2);
|
G_PEdict(GBL_other) = EdictProg(e2);
|
||||||
PR_ExecuteProgram(ED_FUNC(e1, ED_touch));
|
PR_ExecuteProgram(ED_Func(e1, ED_touch));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_FUNC(e2, ED_touch) && ED_FLOAT(e2, ED_solid) != SOLID_NOT)
|
if(ED_Func(e2, ED_touch) && ED_Float(e2, ED_solid) != SOLID_NOT)
|
||||||
{
|
{
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(e2);
|
G_PEdict(GBL_self) = EdictProg(e2);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(e1);
|
G_PEdict(GBL_other) = EdictProg(e1);
|
||||||
PR_ExecuteProgram(ED_FUNC(e2, ED_touch));
|
PR_ExecuteProgram(ED_Func(e2, ED_touch));
|
||||||
}
|
}
|
||||||
|
|
||||||
G_PEDICT(GBL_self) = old_self;
|
G_PEdict(GBL_self) = old_self;
|
||||||
G_PEDICT(GBL_other) = old_other;
|
G_PEdict(GBL_other) = old_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,34 +258,34 @@ int32_t SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
||||||
numbumps = 4;
|
numbumps = 4;
|
||||||
|
|
||||||
blocked = 0;
|
blocked = 0;
|
||||||
VectorCopy(ED_VECTOR(ent, ED_velocity), original_velocity);
|
VectorCopy(ED_Vector(ent, ED_velocity), original_velocity);
|
||||||
VectorCopy(ED_VECTOR(ent, ED_velocity), primal_velocity);
|
VectorCopy(ED_Vector(ent, ED_velocity), primal_velocity);
|
||||||
numplanes = 0;
|
numplanes = 0;
|
||||||
|
|
||||||
time_left = time;
|
time_left = time;
|
||||||
|
|
||||||
for(bumpcount = 0 ; bumpcount < numbumps ; bumpcount++)
|
for(bumpcount = 0 ; bumpcount < numbumps ; bumpcount++)
|
||||||
{
|
{
|
||||||
if(!ED_VECTOR(ent, ED_velocity)[0] && !ED_VECTOR(ent, ED_velocity)[1] && !ED_VECTOR(ent, ED_velocity)[2])
|
if(!ED_Vector(ent, ED_velocity)[0] && !ED_Vector(ent, ED_velocity)[1] && !ED_Vector(ent, ED_velocity)[2])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
end[i] = ED_VECTOR(ent, ED_origin)[i] + time_left * ED_VECTOR(ent, ED_velocity)[i];
|
end[i] = ED_Vector(ent, ED_origin)[i] + time_left * ED_Vector(ent, ED_velocity)[i];
|
||||||
|
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, false, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, false, ent);
|
||||||
|
|
||||||
if(trace.allsolid)
|
if(trace.allsolid)
|
||||||
{
|
{
|
||||||
// entity is trapped in another solid
|
// entity is trapped in another solid
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trace.fraction > 0)
|
if(trace.fraction > 0)
|
||||||
{
|
{
|
||||||
// actually covered some distance
|
// actually covered some distance
|
||||||
VectorCopy(trace.endpos, ED_VECTOR(ent, ED_origin));
|
VectorCopy(trace.endpos, ED_Vector(ent, ED_origin));
|
||||||
VectorCopy(ED_VECTOR(ent, ED_velocity), original_velocity);
|
VectorCopy(ED_Vector(ent, ED_velocity), original_velocity);
|
||||||
numplanes = 0;
|
numplanes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,10 +298,10 @@ int32_t SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
||||||
if(trace.plane.normal[2] > 0.7)
|
if(trace.plane.normal[2] > 0.7)
|
||||||
{
|
{
|
||||||
blocked |= 1; // floor
|
blocked |= 1; // floor
|
||||||
if(ED_FLOAT(trace.ent, ED_solid) == SOLID_BSP)
|
if(ED_Float(trace.ent, ED_solid) == SOLID_BSP)
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) | FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) | FL_ONGROUND;
|
||||||
ED_PEDICT(ent, ED_groundentity) = EDICT_TO_PROG(trace.ent);
|
ED_PEdict(ent, ED_groundentity) = EdictProg(trace.ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!trace.plane.normal[2])
|
if(!trace.plane.normal[2])
|
||||||
|
@ -325,7 +325,7 @@ int32_t SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
||||||
if(numplanes >= MAX_CLIP_PLANES)
|
if(numplanes >= MAX_CLIP_PLANES)
|
||||||
{
|
{
|
||||||
// this shouldn't really happen
|
// this shouldn't really happen
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ int32_t SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
||||||
if(i != numplanes)
|
if(i != numplanes)
|
||||||
{
|
{
|
||||||
// go along this plane
|
// go along this plane
|
||||||
VectorCopy(new_velocity, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(new_velocity, ED_Vector(ent, ED_velocity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -359,21 +359,21 @@ int32_t SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
||||||
if(numplanes != 2)
|
if(numplanes != 2)
|
||||||
{
|
{
|
||||||
// Con_Printf ("clip velocity, numplanes == %" PRIi32 "\n",numplanes);
|
// Con_Printf ("clip velocity, numplanes == %" PRIi32 "\n",numplanes);
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
CrossProduct(planes[0], planes[1], dir);
|
CrossProduct(planes[0], planes[1], dir);
|
||||||
d = DotProduct(dir, ED_VECTOR(ent, ED_velocity));
|
d = DotProduct(dir, ED_Vector(ent, ED_velocity));
|
||||||
VectorScale(dir, d, ED_VECTOR(ent, ED_velocity));
|
VectorScale(dir, d, ED_Vector(ent, ED_velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if original velocity is against the original velocity, stop dead
|
// if original velocity is against the original velocity, stop dead
|
||||||
// to avoid tiny occilations in sloping corners
|
// to avoid tiny occilations in sloping corners
|
||||||
//
|
//
|
||||||
if(DotProduct(ED_VECTOR(ent, ED_velocity), primal_velocity) <= 0)
|
if(DotProduct(ED_Vector(ent, ED_velocity), primal_velocity) <= 0)
|
||||||
{
|
{
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
return blocked;
|
return blocked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ void SV_AddGravity(edict_t *ent)
|
||||||
else
|
else
|
||||||
ent_gravity = 1.0;
|
ent_gravity = 1.0;
|
||||||
|
|
||||||
ED_VECTOR(ent, ED_velocity)[2] -= ent_gravity * sv_gravity.value * host_frametime;
|
ED_Vector(ent, ED_velocity)[2] -= ent_gravity * sv_gravity.value * host_frametime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,17 +423,17 @@ trace_t SV_PushEntity(edict_t *ent, vec3_t push)
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
|
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), push, end);
|
VectorAdd(ED_Vector(ent, ED_origin), push, end);
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_FLYMISSILE)
|
if(ED_Float(ent, ED_movetype) == MOVETYPE_FLYMISSILE)
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, MOVE_MISSILE, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, MOVE_MISSILE, ent);
|
||||||
else if(ED_FLOAT(ent, ED_solid) == SOLID_TRIGGER || ED_FLOAT(ent, ED_solid) == SOLID_NOT)
|
else if(ED_Float(ent, ED_solid) == SOLID_TRIGGER || ED_Float(ent, ED_solid) == SOLID_NOT)
|
||||||
// only clip against bmodels
|
// only clip against bmodels
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, MOVE_NOMONSTERS, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, MOVE_NOMONSTERS, ent);
|
||||||
else
|
else
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), end, MOVE_NORMAL, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), end, MOVE_NORMAL, ent);
|
||||||
|
|
||||||
VectorCopy(trace.endpos, ED_VECTOR(ent, ED_origin));
|
VectorCopy(trace.endpos, ED_Vector(ent, ED_origin));
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
|
|
||||||
if(trace.ent)
|
if(trace.ent)
|
||||||
|
@ -459,25 +459,25 @@ void SV_PushMove(edict_t *pusher, float movetime)
|
||||||
vec3_t *moved_from; //johnfitz -- dynamically allocate
|
vec3_t *moved_from; //johnfitz -- dynamically allocate
|
||||||
int32_t mark; //johnfitz
|
int32_t mark; //johnfitz
|
||||||
|
|
||||||
if(!ED_VECTOR(pusher, ED_velocity)[0] && !ED_VECTOR(pusher, ED_velocity)[1] && !ED_VECTOR(pusher, ED_velocity)[2])
|
if(!ED_Vector(pusher, ED_velocity)[0] && !ED_Vector(pusher, ED_velocity)[1] && !ED_Vector(pusher, ED_velocity)[2])
|
||||||
{
|
{
|
||||||
ED_FLOAT(pusher, ED_ltime) += movetime;
|
ED_Float(pusher, ED_ltime) += movetime;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
move[i] = ED_VECTOR(pusher, ED_velocity)[i] * movetime;
|
move[i] = ED_Vector(pusher, ED_velocity)[i] * movetime;
|
||||||
mins[i] = ED_VECTOR(pusher, ED_absmin)[i] + move[i];
|
mins[i] = ED_Vector(pusher, ED_absmin)[i] + move[i];
|
||||||
maxs[i] = ED_VECTOR(pusher, ED_absmax)[i] + move[i];
|
maxs[i] = ED_Vector(pusher, ED_absmax)[i] + move[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(pusher, ED_origin), pushorig);
|
VectorCopy(ED_Vector(pusher, ED_origin), pushorig);
|
||||||
|
|
||||||
// move the pusher to it's final position
|
// move the pusher to it's final position
|
||||||
|
|
||||||
VectorAdd(ED_VECTOR(pusher, ED_origin), move, ED_VECTOR(pusher, ED_origin));
|
VectorAdd(ED_Vector(pusher, ED_origin), move, ED_Vector(pusher, ED_origin));
|
||||||
ED_FLOAT(pusher, ED_ltime) += movetime;
|
ED_Float(pusher, ED_ltime) += movetime;
|
||||||
SV_LinkEdict(pusher, false);
|
SV_LinkEdict(pusher, false);
|
||||||
|
|
||||||
//johnfitz -- dynamically allocate
|
//johnfitz -- dynamically allocate
|
||||||
|
@ -488,26 +488,26 @@ void SV_PushMove(edict_t *pusher, float movetime)
|
||||||
|
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
num_moved = 0;
|
num_moved = 0;
|
||||||
check = NEXT_EDICT(sv.edicts);
|
check = NextEdict(sv.edicts);
|
||||||
for(e = 1 ; e < sv.num_edicts ; e++, check = NEXT_EDICT(check))
|
for(e = 1 ; e < sv.num_edicts ; e++, check = NextEdict(check))
|
||||||
{
|
{
|
||||||
if(check->free)
|
if(check->free)
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(check, ED_movetype) == MOVETYPE_PUSH
|
if(ED_Float(check, ED_movetype) == MOVETYPE_PUSH
|
||||||
|| ED_FLOAT(check, ED_movetype) == MOVETYPE_NONE
|
|| ED_Float(check, ED_movetype) == MOVETYPE_NONE
|
||||||
|| ED_FLOAT(check, ED_movetype) == MOVETYPE_NOCLIP)
|
|| ED_Float(check, ED_movetype) == MOVETYPE_NOCLIP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if the entity is standing on the pusher, it will definately be moved
|
// if the entity is standing on the pusher, it will definately be moved
|
||||||
if(!(((int32_t)ED_FLOAT(check, ED_flags) & FL_ONGROUND)
|
if(!(((int32_t)ED_Float(check, ED_flags) & FL_ONGROUND)
|
||||||
&& PROG_TO_EDICT(ED_PEDICT(check, ED_groundentity)) == pusher))
|
&& ProgEdict(ED_PEdict(check, ED_groundentity)) == pusher))
|
||||||
{
|
{
|
||||||
if(ED_VECTOR(check, ED_absmin)[0] >= maxs[0]
|
if(ED_Vector(check, ED_absmin)[0] >= maxs[0]
|
||||||
|| ED_VECTOR(check, ED_absmin)[1] >= maxs[1]
|
|| ED_Vector(check, ED_absmin)[1] >= maxs[1]
|
||||||
|| ED_VECTOR(check, ED_absmin)[2] >= maxs[2]
|
|| ED_Vector(check, ED_absmin)[2] >= maxs[2]
|
||||||
|| ED_VECTOR(check, ED_absmax)[0] <= mins[0]
|
|| ED_Vector(check, ED_absmax)[0] <= mins[0]
|
||||||
|| ED_VECTOR(check, ED_absmax)[1] <= mins[1]
|
|| ED_Vector(check, ED_absmax)[1] <= mins[1]
|
||||||
|| ED_VECTOR(check, ED_absmax)[2] <= mins[2])
|
|| ED_Vector(check, ED_absmax)[2] <= mins[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// see if the ent's bbox is inside the pusher's final position
|
// see if the ent's bbox is inside the pusher's final position
|
||||||
|
@ -516,54 +516,54 @@ void SV_PushMove(edict_t *pusher, float movetime)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the onground flag for non-players
|
// remove the onground flag for non-players
|
||||||
if(ED_FLOAT(check, ED_movetype) != MOVETYPE_WALK)
|
if(ED_Float(check, ED_movetype) != MOVETYPE_WALK)
|
||||||
ED_FLOAT(check, ED_flags) = (int32_t)ED_FLOAT(check, ED_flags) & ~FL_ONGROUND;
|
ED_Float(check, ED_flags) = (int32_t)ED_Float(check, ED_flags) & ~FL_ONGROUND;
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(check, ED_origin), entorig);
|
VectorCopy(ED_Vector(check, ED_origin), entorig);
|
||||||
VectorCopy(ED_VECTOR(check, ED_origin), moved_from[num_moved]);
|
VectorCopy(ED_Vector(check, ED_origin), moved_from[num_moved]);
|
||||||
moved_edict[num_moved] = check;
|
moved_edict[num_moved] = check;
|
||||||
num_moved++;
|
num_moved++;
|
||||||
|
|
||||||
// try moving the contacted entity
|
// try moving the contacted entity
|
||||||
ED_FLOAT(pusher, ED_solid) = SOLID_NOT;
|
ED_Float(pusher, ED_solid) = SOLID_NOT;
|
||||||
SV_PushEntity(check, move);
|
SV_PushEntity(check, move);
|
||||||
ED_FLOAT(pusher, ED_solid) = SOLID_BSP;
|
ED_Float(pusher, ED_solid) = SOLID_BSP;
|
||||||
|
|
||||||
// if it is still inside the pusher, block
|
// if it is still inside the pusher, block
|
||||||
block = SV_TestEntityPosition(check);
|
block = SV_TestEntityPosition(check);
|
||||||
if(block)
|
if(block)
|
||||||
{
|
{
|
||||||
// fail the move
|
// fail the move
|
||||||
if(ED_VECTOR(check, ED_mins)[0] == ED_VECTOR(check, ED_maxs)[0])
|
if(ED_Vector(check, ED_mins)[0] == ED_Vector(check, ED_maxs)[0])
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(check, ED_solid) == SOLID_NOT || ED_FLOAT(check, ED_solid) == SOLID_TRIGGER)
|
if(ED_Float(check, ED_solid) == SOLID_NOT || ED_Float(check, ED_solid) == SOLID_TRIGGER)
|
||||||
{
|
{
|
||||||
// corpse
|
// corpse
|
||||||
ED_VECTOR(check, ED_mins)[0] = ED_VECTOR(check, ED_mins)[1] = 0;
|
ED_Vector(check, ED_mins)[0] = ED_Vector(check, ED_mins)[1] = 0;
|
||||||
VectorCopy(ED_VECTOR(check, ED_mins), ED_VECTOR(check, ED_maxs));
|
VectorCopy(ED_Vector(check, ED_mins), ED_Vector(check, ED_maxs));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(entorig, ED_VECTOR(check, ED_origin));
|
VectorCopy(entorig, ED_Vector(check, ED_origin));
|
||||||
SV_LinkEdict(check, true);
|
SV_LinkEdict(check, true);
|
||||||
|
|
||||||
VectorCopy(pushorig, ED_VECTOR(pusher, ED_origin));
|
VectorCopy(pushorig, ED_Vector(pusher, ED_origin));
|
||||||
SV_LinkEdict(pusher, false);
|
SV_LinkEdict(pusher, false);
|
||||||
ED_FLOAT(pusher, ED_ltime) -= movetime;
|
ED_Float(pusher, ED_ltime) -= movetime;
|
||||||
|
|
||||||
// if the pusher has a "blocked" function, call it
|
// if the pusher has a "blocked" function, call it
|
||||||
// otherwise, just stay in place until the obstacle is gone
|
// otherwise, just stay in place until the obstacle is gone
|
||||||
if(ED_FUNC(pusher, ED_blocked))
|
if(ED_Func(pusher, ED_blocked))
|
||||||
{
|
{
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(pusher);
|
G_PEdict(GBL_self) = EdictProg(pusher);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(check);
|
G_PEdict(GBL_other) = EdictProg(check);
|
||||||
PR_ExecuteProgram(ED_FUNC(pusher, ED_blocked));
|
PR_ExecuteProgram(ED_Func(pusher, ED_blocked));
|
||||||
}
|
}
|
||||||
|
|
||||||
// move back any entities we already moved
|
// move back any entities we already moved
|
||||||
for(i = 0 ; i < num_moved ; i++)
|
for(i = 0 ; i < num_moved ; i++)
|
||||||
{
|
{
|
||||||
VectorCopy(moved_from[i], ED_VECTOR(moved_edict[i], ED_origin));
|
VectorCopy(moved_from[i], ED_Vector(moved_edict[i], ED_origin));
|
||||||
SV_LinkEdict(moved_edict[i], false);
|
SV_LinkEdict(moved_edict[i], false);
|
||||||
}
|
}
|
||||||
Hunk_FreeToLowMark(mark); //johnfitz
|
Hunk_FreeToLowMark(mark); //johnfitz
|
||||||
|
@ -587,12 +587,12 @@ void SV_Physics_Pusher(edict_t *ent)
|
||||||
float oldltime;
|
float oldltime;
|
||||||
float movetime;
|
float movetime;
|
||||||
|
|
||||||
oldltime = ED_FLOAT(ent, ED_ltime);
|
oldltime = ED_Float(ent, ED_ltime);
|
||||||
|
|
||||||
thinktime = ED_FLOAT(ent, ED_nextthink);
|
thinktime = ED_Float(ent, ED_nextthink);
|
||||||
if(thinktime < ED_FLOAT(ent, ED_ltime) + host_frametime)
|
if(thinktime < ED_Float(ent, ED_ltime) + host_frametime)
|
||||||
{
|
{
|
||||||
movetime = thinktime - ED_FLOAT(ent, ED_ltime);
|
movetime = thinktime - ED_Float(ent, ED_ltime);
|
||||||
if(movetime < 0)
|
if(movetime < 0)
|
||||||
movetime = 0;
|
movetime = 0;
|
||||||
}
|
}
|
||||||
|
@ -601,16 +601,16 @@ void SV_Physics_Pusher(edict_t *ent)
|
||||||
|
|
||||||
if(movetime)
|
if(movetime)
|
||||||
{
|
{
|
||||||
SV_PushMove(ent, movetime); // advances ED_FLOAT(ent, ED_ltime) if not blocked
|
SV_PushMove(ent, movetime); // advances ED_Float(ent, ED_ltime) if not blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thinktime > oldltime && thinktime <= ED_FLOAT(ent, ED_ltime))
|
if(thinktime > oldltime && thinktime <= ED_Float(ent, ED_ltime))
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_nextthink) = 0;
|
ED_Float(ent, ED_nextthink) = 0;
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_self) = EdictProg(ent);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(sv.edicts);
|
G_PEdict(GBL_other) = EdictProg(sv.edicts);
|
||||||
PR_ExecuteProgram(ED_FUNC(ent, ED_think));
|
PR_ExecuteProgram(ED_Func(ent, ED_think));
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -642,12 +642,12 @@ void SV_CheckStuck(edict_t *ent)
|
||||||
|
|
||||||
if(!SV_TestEntityPosition(ent))
|
if(!SV_TestEntityPosition(ent))
|
||||||
{
|
{
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_oldorigin));
|
VectorCopy(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_oldorigin));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), org);
|
VectorCopy(ED_Vector(ent, ED_origin), org);
|
||||||
VectorCopy(ED_VECTOR(ent, ED_oldorigin), ED_VECTOR(ent, ED_origin));
|
VectorCopy(ED_Vector(ent, ED_oldorigin), ED_Vector(ent, ED_origin));
|
||||||
if(!SV_TestEntityPosition(ent))
|
if(!SV_TestEntityPosition(ent))
|
||||||
{
|
{
|
||||||
Con_DPrintf("Unstuck.\n");
|
Con_DPrintf("Unstuck.\n");
|
||||||
|
@ -659,9 +659,9 @@ void SV_CheckStuck(edict_t *ent)
|
||||||
for(i = -1 ; i <= 1 ; i++)
|
for(i = -1 ; i <= 1 ; i++)
|
||||||
for(j = -1 ; j <= 1 ; j++)
|
for(j = -1 ; j <= 1 ; j++)
|
||||||
{
|
{
|
||||||
ED_VECTOR(ent, ED_origin)[0] = org[0] + i;
|
ED_Vector(ent, ED_origin)[0] = org[0] + i;
|
||||||
ED_VECTOR(ent, ED_origin)[1] = org[1] + j;
|
ED_Vector(ent, ED_origin)[1] = org[1] + j;
|
||||||
ED_VECTOR(ent, ED_origin)[2] = org[2] + z;
|
ED_Vector(ent, ED_origin)[2] = org[2] + z;
|
||||||
if(!SV_TestEntityPosition(ent))
|
if(!SV_TestEntityPosition(ent))
|
||||||
{
|
{
|
||||||
Con_DPrintf("Unstuck.\n");
|
Con_DPrintf("Unstuck.\n");
|
||||||
|
@ -670,7 +670,7 @@ void SV_CheckStuck(edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(org, ED_VECTOR(ent, ED_origin));
|
VectorCopy(org, ED_Vector(ent, ED_origin));
|
||||||
Con_DPrintf("player is stuck.\n");
|
Con_DPrintf("player is stuck.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,30 +685,30 @@ bool SV_CheckWater(edict_t *ent)
|
||||||
vec3_t point;
|
vec3_t point;
|
||||||
int32_t cont;
|
int32_t cont;
|
||||||
|
|
||||||
point[0] = ED_VECTOR(ent, ED_origin)[0];
|
point[0] = ED_Vector(ent, ED_origin)[0];
|
||||||
point[1] = ED_VECTOR(ent, ED_origin)[1];
|
point[1] = ED_Vector(ent, ED_origin)[1];
|
||||||
point[2] = ED_VECTOR(ent, ED_origin)[2] + ED_VECTOR(ent, ED_mins)[2] + 1;
|
point[2] = ED_Vector(ent, ED_origin)[2] + ED_Vector(ent, ED_mins)[2] + 1;
|
||||||
|
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 0;
|
ED_Float(ent, ED_waterlevel) = 0;
|
||||||
ED_FLOAT(ent, ED_watertype) = CONTENTS_EMPTY;
|
ED_Float(ent, ED_watertype) = CONTENTS_EMPTY;
|
||||||
cont = SV_PointContents(point);
|
cont = SV_PointContents(point);
|
||||||
if(cont <= CONTENTS_WATER)
|
if(cont <= CONTENTS_WATER)
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_watertype) = cont;
|
ED_Float(ent, ED_watertype) = cont;
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 1;
|
ED_Float(ent, ED_waterlevel) = 1;
|
||||||
point[2] = ED_VECTOR(ent, ED_origin)[2] + (ED_VECTOR(ent, ED_mins)[2] + ED_VECTOR(ent, ED_maxs)[2]) * 0.5;
|
point[2] = ED_Vector(ent, ED_origin)[2] + (ED_Vector(ent, ED_mins)[2] + ED_Vector(ent, ED_maxs)[2]) * 0.5;
|
||||||
cont = SV_PointContents(point);
|
cont = SV_PointContents(point);
|
||||||
if(cont <= CONTENTS_WATER)
|
if(cont <= CONTENTS_WATER)
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 2;
|
ED_Float(ent, ED_waterlevel) = 2;
|
||||||
point[2] = ED_VECTOR(ent, ED_origin)[2] + ED_VECTOR(ent, ED_view_ofs)[2];
|
point[2] = ED_Vector(ent, ED_origin)[2] + ED_Vector(ent, ED_view_ofs)[2];
|
||||||
cont = SV_PointContents(point);
|
cont = SV_PointContents(point);
|
||||||
if(cont <= CONTENTS_WATER)
|
if(cont <= CONTENTS_WATER)
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 3;
|
ED_Float(ent, ED_waterlevel) = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ED_FLOAT(ent, ED_waterlevel) > 1;
|
return ED_Float(ent, ED_waterlevel) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -723,7 +723,7 @@ void SV_WallFriction(edict_t *ent, trace_t *trace)
|
||||||
float d, i;
|
float d, i;
|
||||||
vec3_t into, side;
|
vec3_t into, side;
|
||||||
|
|
||||||
AngleVectors(ED_VECTOR(ent, ED_v_angle), forward, right, up);
|
AngleVectors(ED_Vector(ent, ED_v_angle), forward, right, up);
|
||||||
d = DotProduct(trace->plane.normal, forward);
|
d = DotProduct(trace->plane.normal, forward);
|
||||||
|
|
||||||
d += 0.5;
|
d += 0.5;
|
||||||
|
@ -731,12 +731,12 @@ void SV_WallFriction(edict_t *ent, trace_t *trace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// cut the tangential velocity
|
// cut the tangential velocity
|
||||||
i = DotProduct(trace->plane.normal, ED_VECTOR(ent, ED_velocity));
|
i = DotProduct(trace->plane.normal, ED_Vector(ent, ED_velocity));
|
||||||
VectorScale(trace->plane.normal, i, into);
|
VectorScale(trace->plane.normal, i, into);
|
||||||
VectorSubtract(ED_VECTOR(ent, ED_velocity), into, side);
|
VectorSubtract(ED_Vector(ent, ED_velocity), into, side);
|
||||||
|
|
||||||
ED_VECTOR(ent, ED_velocity)[0] = side[0] * (1 + d);
|
ED_Vector(ent, ED_velocity)[0] = side[0] * (1 + d);
|
||||||
ED_VECTOR(ent, ED_velocity)[1] = side[1] * (1 + d);
|
ED_Vector(ent, ED_velocity)[1] = side[1] * (1 + d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -759,7 +759,7 @@ int32_t SV_TryUnstick(edict_t *ent, vec3_t oldvel)
|
||||||
int32_t clip;
|
int32_t clip;
|
||||||
trace_t steptrace;
|
trace_t steptrace;
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), oldorg);
|
VectorCopy(ED_Vector(ent, ED_origin), oldorg);
|
||||||
VectorCopy(vec3_origin, dir);
|
VectorCopy(vec3_origin, dir);
|
||||||
|
|
||||||
for(i = 0 ; i < 8 ; i++)
|
for(i = 0 ; i < 8 ; i++)
|
||||||
|
@ -804,23 +804,23 @@ int32_t SV_TryUnstick(edict_t *ent, vec3_t oldvel)
|
||||||
SV_PushEntity(ent, dir);
|
SV_PushEntity(ent, dir);
|
||||||
|
|
||||||
// retry the original move
|
// retry the original move
|
||||||
ED_VECTOR(ent, ED_velocity)[0] = oldvel[0];
|
ED_Vector(ent, ED_velocity)[0] = oldvel[0];
|
||||||
ED_VECTOR(ent, ED_velocity)[1] = oldvel[1];
|
ED_Vector(ent, ED_velocity)[1] = oldvel[1];
|
||||||
ED_VECTOR(ent, ED_velocity)[2] = 0;
|
ED_Vector(ent, ED_velocity)[2] = 0;
|
||||||
clip = SV_FlyMove(ent, 0.1, &steptrace);
|
clip = SV_FlyMove(ent, 0.1, &steptrace);
|
||||||
|
|
||||||
if(fabs(oldorg[1] - ED_VECTOR(ent, ED_origin)[1]) > 4
|
if(fabs(oldorg[1] - ED_Vector(ent, ED_origin)[1]) > 4
|
||||||
|| fabs(oldorg[0] - ED_VECTOR(ent, ED_origin)[0]) > 4)
|
|| fabs(oldorg[0] - ED_Vector(ent, ED_origin)[0]) > 4)
|
||||||
{
|
{
|
||||||
//Con_DPrintf ("unstuck!\n");
|
//Con_DPrintf ("unstuck!\n");
|
||||||
return clip;
|
return clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back to the original pos and try again
|
// go back to the original pos and try again
|
||||||
VectorCopy(oldorg, ED_VECTOR(ent, ED_origin));
|
VectorCopy(oldorg, ED_Vector(ent, ED_origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
return 7; // still not moving
|
return 7; // still not moving
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,36 +844,36 @@ void SV_WalkMove(edict_t *ent)
|
||||||
//
|
//
|
||||||
// do a regular slide move unless it looks like you ran into a step
|
// do a regular slide move unless it looks like you ran into a step
|
||||||
//
|
//
|
||||||
oldonground = (int32_t)ED_FLOAT(ent, ED_flags) & FL_ONGROUND;
|
oldonground = (int32_t)ED_Float(ent, ED_flags) & FL_ONGROUND;
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) & ~FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) & ~FL_ONGROUND;
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), oldorg);
|
VectorCopy(ED_Vector(ent, ED_origin), oldorg);
|
||||||
VectorCopy(ED_VECTOR(ent, ED_velocity), oldvel);
|
VectorCopy(ED_Vector(ent, ED_velocity), oldvel);
|
||||||
|
|
||||||
clip = SV_FlyMove(ent, host_frametime, &steptrace);
|
clip = SV_FlyMove(ent, host_frametime, &steptrace);
|
||||||
|
|
||||||
if(!(clip & 2))
|
if(!(clip & 2))
|
||||||
return; // move didn't block on a step
|
return; // move didn't block on a step
|
||||||
|
|
||||||
if(!oldonground && ED_FLOAT(ent, ED_waterlevel) == 0)
|
if(!oldonground && ED_Float(ent, ED_waterlevel) == 0)
|
||||||
return; // don't stair up while jumping
|
return; // don't stair up while jumping
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_movetype) != MOVETYPE_WALK)
|
if(ED_Float(ent, ED_movetype) != MOVETYPE_WALK)
|
||||||
return; // gibbed by a trigger
|
return; // gibbed by a trigger
|
||||||
|
|
||||||
if(sv_nostep.value)
|
if(sv_nostep.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(sv_player, ED_flags) & FL_WATERJUMP)
|
if((int32_t)ED_Float(sv_player, ED_flags) & FL_WATERJUMP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), nosteporg);
|
VectorCopy(ED_Vector(ent, ED_origin), nosteporg);
|
||||||
VectorCopy(ED_VECTOR(ent, ED_velocity), nostepvel);
|
VectorCopy(ED_Vector(ent, ED_velocity), nostepvel);
|
||||||
|
|
||||||
//
|
//
|
||||||
// try moving up and forward to go up a step
|
// try moving up and forward to go up a step
|
||||||
//
|
//
|
||||||
VectorCopy(oldorg, ED_VECTOR(ent, ED_origin)); // back to start pos
|
VectorCopy(oldorg, ED_Vector(ent, ED_origin)); // back to start pos
|
||||||
|
|
||||||
VectorCopy(vec3_origin, upmove);
|
VectorCopy(vec3_origin, upmove);
|
||||||
VectorCopy(vec3_origin, downmove);
|
VectorCopy(vec3_origin, downmove);
|
||||||
|
@ -884,17 +884,17 @@ void SV_WalkMove(edict_t *ent)
|
||||||
SV_PushEntity(ent, upmove); // FIXME: don't link?
|
SV_PushEntity(ent, upmove); // FIXME: don't link?
|
||||||
|
|
||||||
// move forward
|
// move forward
|
||||||
ED_VECTOR(ent, ED_velocity)[0] = oldvel[0];
|
ED_Vector(ent, ED_velocity)[0] = oldvel[0];
|
||||||
ED_VECTOR(ent, ED_velocity)[1] = oldvel[1];
|
ED_Vector(ent, ED_velocity)[1] = oldvel[1];
|
||||||
ED_VECTOR(ent, ED_velocity)[2] = 0;
|
ED_Vector(ent, ED_velocity)[2] = 0;
|
||||||
clip = SV_FlyMove(ent, host_frametime, &steptrace);
|
clip = SV_FlyMove(ent, host_frametime, &steptrace);
|
||||||
|
|
||||||
// check for stuckness, possibly due to the limited precision of floats
|
// check for stuckness, possibly due to the limited precision of floats
|
||||||
// in the clipping hulls
|
// in the clipping hulls
|
||||||
if(clip)
|
if(clip)
|
||||||
{
|
{
|
||||||
if(fabs(oldorg[1] - ED_VECTOR(ent, ED_origin)[1]) < 0.03125
|
if(fabs(oldorg[1] - ED_Vector(ent, ED_origin)[1]) < 0.03125
|
||||||
&& fabs(oldorg[0] - ED_VECTOR(ent, ED_origin)[0]) < 0.03125)
|
&& fabs(oldorg[0] - ED_Vector(ent, ED_origin)[0]) < 0.03125)
|
||||||
{
|
{
|
||||||
// stepping up didn't make any progress
|
// stepping up didn't make any progress
|
||||||
clip = SV_TryUnstick(ent, oldvel);
|
clip = SV_TryUnstick(ent, oldvel);
|
||||||
|
@ -910,10 +910,10 @@ void SV_WalkMove(edict_t *ent)
|
||||||
|
|
||||||
if(downtrace.plane.normal[2] > 0.7)
|
if(downtrace.plane.normal[2] > 0.7)
|
||||||
{
|
{
|
||||||
if(ED_FLOAT(ent, ED_solid) == SOLID_BSP)
|
if(ED_Float(ent, ED_solid) == SOLID_BSP)
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) | FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) | FL_ONGROUND;
|
||||||
ED_PEDICT(ent, ED_groundentity) = EDICT_TO_PROG(downtrace.ent);
|
ED_PEdict(ent, ED_groundentity) = EdictProg(downtrace.ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -921,8 +921,8 @@ void SV_WalkMove(edict_t *ent)
|
||||||
// if the push down didn't end up on good ground, use the move without
|
// if the push down didn't end up on good ground, use the move without
|
||||||
// the step up. This happens near wall / slope combinations, and can
|
// the step up. This happens near wall / slope combinations, and can
|
||||||
// cause the player to hop up higher on a slope too steep to climb
|
// cause the player to hop up higher on a slope too steep to climb
|
||||||
VectorCopy(nosteporg, ED_VECTOR(ent, ED_origin));
|
VectorCopy(nosteporg, ED_Vector(ent, ED_origin));
|
||||||
VectorCopy(nostepvel, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(nostepvel, ED_Vector(ent, ED_velocity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,9 +942,9 @@ void SV_Physics_Client(edict_t *ent, int32_t num)
|
||||||
//
|
//
|
||||||
// call standard client pre-think
|
// call standard client pre-think
|
||||||
//
|
//
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_self) = EdictProg(ent);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_PlayerPreThink));
|
PR_ExecuteProgram(G_Func(GBL_PlayerPreThink));
|
||||||
|
|
||||||
//
|
//
|
||||||
// do a move
|
// do a move
|
||||||
|
@ -954,7 +954,7 @@ void SV_Physics_Client(edict_t *ent, int32_t num)
|
||||||
//
|
//
|
||||||
// decide which move function to call
|
// decide which move function to call
|
||||||
//
|
//
|
||||||
switch((int32_t)ED_FLOAT(ent, ED_movetype))
|
switch((int32_t)ED_Float(ent, ED_movetype))
|
||||||
{
|
{
|
||||||
case MOVETYPE_NONE:
|
case MOVETYPE_NONE:
|
||||||
if(!SV_RunThink(ent))
|
if(!SV_RunThink(ent))
|
||||||
|
@ -964,7 +964,7 @@ void SV_Physics_Client(edict_t *ent, int32_t num)
|
||||||
case MOVETYPE_WALK:
|
case MOVETYPE_WALK:
|
||||||
if(!SV_RunThink(ent))
|
if(!SV_RunThink(ent))
|
||||||
return;
|
return;
|
||||||
if(!SV_CheckWater(ent) && !((int32_t)ED_FLOAT(ent, ED_flags) & FL_WATERJUMP))
|
if(!SV_CheckWater(ent) && !((int32_t)ED_Float(ent, ED_flags) & FL_WATERJUMP))
|
||||||
SV_AddGravity(ent);
|
SV_AddGravity(ent);
|
||||||
SV_CheckStuck(ent);
|
SV_CheckStuck(ent);
|
||||||
SV_WalkMove(ent);
|
SV_WalkMove(ent);
|
||||||
|
@ -984,11 +984,11 @@ void SV_Physics_Client(edict_t *ent, int32_t num)
|
||||||
case MOVETYPE_NOCLIP:
|
case MOVETYPE_NOCLIP:
|
||||||
if(!SV_RunThink(ent))
|
if(!SV_RunThink(ent))
|
||||||
return;
|
return;
|
||||||
VectorMA(ED_VECTOR(ent, ED_origin), host_frametime, ED_VECTOR(ent, ED_velocity), ED_VECTOR(ent, ED_origin));
|
VectorMA(ED_Vector(ent, ED_origin), host_frametime, ED_Vector(ent, ED_velocity), ED_Vector(ent, ED_origin));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Sys_Error("SV_Physics_client: bad movetype %" PRIi32 "", (int32_t)ED_FLOAT(ent, ED_movetype));
|
Sys_Error("SV_Physics_client: bad movetype %" PRIi32, (int32_t)ED_Float(ent, ED_movetype));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -996,9 +996,9 @@ void SV_Physics_Client(edict_t *ent, int32_t num)
|
||||||
//
|
//
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
|
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_self) = EdictProg(ent);
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_PlayerPostThink));
|
PR_ExecuteProgram(G_Func(GBL_PlayerPostThink));
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -1029,8 +1029,8 @@ void SV_Physics_Noclip(edict_t *ent)
|
||||||
if(!SV_RunThink(ent))
|
if(!SV_RunThink(ent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VectorMA(ED_VECTOR(ent, ED_angles), host_frametime, ED_VECTOR(ent, ED_avelocity), ED_VECTOR(ent, ED_angles));
|
VectorMA(ED_Vector(ent, ED_angles), host_frametime, ED_Vector(ent, ED_avelocity), ED_Vector(ent, ED_angles));
|
||||||
VectorMA(ED_VECTOR(ent, ED_origin), host_frametime, ED_VECTOR(ent, ED_velocity), ED_VECTOR(ent, ED_origin));
|
VectorMA(ED_Vector(ent, ED_origin), host_frametime, ED_Vector(ent, ED_velocity), ED_Vector(ent, ED_origin));
|
||||||
|
|
||||||
SV_LinkEdict(ent, false);
|
SV_LinkEdict(ent, false);
|
||||||
}
|
}
|
||||||
|
@ -1053,35 +1053,35 @@ void SV_CheckWaterTransition(edict_t *ent)
|
||||||
{
|
{
|
||||||
int32_t cont;
|
int32_t cont;
|
||||||
|
|
||||||
cont = SV_PointContents(ED_VECTOR(ent, ED_origin));
|
cont = SV_PointContents(ED_Vector(ent, ED_origin));
|
||||||
|
|
||||||
if(!ED_FLOAT(ent, ED_watertype))
|
if(!ED_Float(ent, ED_watertype))
|
||||||
{
|
{
|
||||||
// just spawned here
|
// just spawned here
|
||||||
ED_FLOAT(ent, ED_watertype) = cont;
|
ED_Float(ent, ED_watertype) = cont;
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 1;
|
ED_Float(ent, ED_waterlevel) = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cont <= CONTENTS_WATER)
|
if(cont <= CONTENTS_WATER)
|
||||||
{
|
{
|
||||||
if(ED_FLOAT(ent, ED_watertype) == CONTENTS_EMPTY)
|
if(ED_Float(ent, ED_watertype) == CONTENTS_EMPTY)
|
||||||
{
|
{
|
||||||
// just crossed into water
|
// just crossed into water
|
||||||
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||||
}
|
}
|
||||||
ED_FLOAT(ent, ED_watertype) = cont;
|
ED_Float(ent, ED_watertype) = cont;
|
||||||
ED_FLOAT(ent, ED_waterlevel) = 1;
|
ED_Float(ent, ED_waterlevel) = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(ED_FLOAT(ent, ED_watertype) != CONTENTS_EMPTY)
|
if(ED_Float(ent, ED_watertype) != CONTENTS_EMPTY)
|
||||||
{
|
{
|
||||||
// just crossed into water
|
// just crossed into water
|
||||||
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
SV_StartSound(ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||||
}
|
}
|
||||||
ED_FLOAT(ent, ED_watertype) = CONTENTS_EMPTY;
|
ED_Float(ent, ED_watertype) = CONTENTS_EMPTY;
|
||||||
ED_FLOAT(ent, ED_waterlevel) = cont;
|
ED_Float(ent, ED_waterlevel) = cont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,43 +1103,43 @@ void SV_Physics_Toss(edict_t *ent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if onground, return without moving
|
// if onground, return without moving
|
||||||
if(((int32_t)ED_FLOAT(ent, ED_flags) & FL_ONGROUND))
|
if(((int32_t)ED_Float(ent, ED_flags) & FL_ONGROUND))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SV_CheckVelocity(ent);
|
SV_CheckVelocity(ent);
|
||||||
|
|
||||||
// add gravity
|
// add gravity
|
||||||
if(ED_FLOAT(ent, ED_movetype) != MOVETYPE_FLY
|
if(ED_Float(ent, ED_movetype) != MOVETYPE_FLY
|
||||||
&& ED_FLOAT(ent, ED_movetype) != MOVETYPE_FLYMISSILE)
|
&& ED_Float(ent, ED_movetype) != MOVETYPE_FLYMISSILE)
|
||||||
SV_AddGravity(ent);
|
SV_AddGravity(ent);
|
||||||
|
|
||||||
// move angles
|
// move angles
|
||||||
VectorMA(ED_VECTOR(ent, ED_angles), host_frametime, ED_VECTOR(ent, ED_avelocity), ED_VECTOR(ent, ED_angles));
|
VectorMA(ED_Vector(ent, ED_angles), host_frametime, ED_Vector(ent, ED_avelocity), ED_Vector(ent, ED_angles));
|
||||||
|
|
||||||
// move origin
|
// move origin
|
||||||
VectorScale(ED_VECTOR(ent, ED_velocity), host_frametime, move);
|
VectorScale(ED_Vector(ent, ED_velocity), host_frametime, move);
|
||||||
trace = SV_PushEntity(ent, move);
|
trace = SV_PushEntity(ent, move);
|
||||||
if(trace.fraction == 1)
|
if(trace.fraction == 1)
|
||||||
return;
|
return;
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_BOUNCE)
|
if(ED_Float(ent, ED_movetype) == MOVETYPE_BOUNCE)
|
||||||
backoff = 1.5;
|
backoff = 1.5;
|
||||||
else
|
else
|
||||||
backoff = 1;
|
backoff = 1;
|
||||||
|
|
||||||
ClipVelocity(ED_VECTOR(ent, ED_velocity), trace.plane.normal, ED_VECTOR(ent, ED_velocity), backoff);
|
ClipVelocity(ED_Vector(ent, ED_velocity), trace.plane.normal, ED_Vector(ent, ED_velocity), backoff);
|
||||||
|
|
||||||
// stop if on ground
|
// stop if on ground
|
||||||
if(trace.plane.normal[2] > 0.7)
|
if(trace.plane.normal[2] > 0.7)
|
||||||
{
|
{
|
||||||
if(ED_VECTOR(ent, ED_velocity)[2] < 60 || ED_FLOAT(ent, ED_movetype) != MOVETYPE_BOUNCE)
|
if(ED_Vector(ent, ED_velocity)[2] < 60 || ED_Float(ent, ED_movetype) != MOVETYPE_BOUNCE)
|
||||||
{
|
{
|
||||||
ED_FLOAT(ent, ED_flags) = (int32_t)ED_FLOAT(ent, ED_flags) | FL_ONGROUND;
|
ED_Float(ent, ED_flags) = (int32_t)ED_Float(ent, ED_flags) | FL_ONGROUND;
|
||||||
ED_PEDICT(ent, ED_groundentity) = EDICT_TO_PROG(trace.ent);
|
ED_PEdict(ent, ED_groundentity) = EdictProg(trace.ent);
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_velocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_velocity));
|
||||||
VectorCopy(vec3_origin, ED_VECTOR(ent, ED_avelocity));
|
VectorCopy(vec3_origin, ED_Vector(ent, ED_avelocity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,9 +1171,9 @@ void SV_Physics_Step(edict_t *ent)
|
||||||
bool hitsound;
|
bool hitsound;
|
||||||
|
|
||||||
// freefall if not onground
|
// freefall if not onground
|
||||||
if(!((int32_t)ED_FLOAT(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
if(!((int32_t)ED_Float(ent, ED_flags) & (FL_ONGROUND | FL_FLY | FL_SWIM)))
|
||||||
{
|
{
|
||||||
if(ED_VECTOR(ent, ED_velocity)[2] < sv_gravity.value * -0.1)
|
if(ED_Vector(ent, ED_velocity)[2] < sv_gravity.value * -0.1)
|
||||||
hitsound = true;
|
hitsound = true;
|
||||||
else
|
else
|
||||||
hitsound = false;
|
hitsound = false;
|
||||||
|
@ -1183,7 +1183,7 @@ void SV_Physics_Step(edict_t *ent)
|
||||||
SV_FlyMove(ent, host_frametime, NULL);
|
SV_FlyMove(ent, host_frametime, NULL);
|
||||||
SV_LinkEdict(ent, true);
|
SV_LinkEdict(ent, true);
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_ONGROUND) // just hit ground
|
if((int32_t)ED_Float(ent, ED_flags) & FL_ONGROUND) // just hit ground
|
||||||
{
|
{
|
||||||
if(hitsound)
|
if(hitsound)
|
||||||
SV_StartSound(ent, 0, "demon/dland2.wav", 255, 1);
|
SV_StartSound(ent, 0, "demon/dland2.wav", 255, 1);
|
||||||
|
@ -1212,10 +1212,10 @@ void SV_Physics(void)
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
// let the progs know that a new frame has started
|
// let the progs know that a new frame has started
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(sv.edicts);
|
G_PEdict(GBL_self) = EdictProg(sv.edicts);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(sv.edicts);
|
G_PEdict(GBL_other) = EdictProg(sv.edicts);
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
PR_ExecuteProgram(G_FUNC(GBL_StartFrame));
|
PR_ExecuteProgram(G_Func(GBL_StartFrame));
|
||||||
|
|
||||||
//SV_CheckAllEnts ();
|
//SV_CheckAllEnts ();
|
||||||
|
|
||||||
|
@ -1229,38 +1229,38 @@ void SV_Physics(void)
|
||||||
else
|
else
|
||||||
entity_cap = sv.num_edicts;
|
entity_cap = sv.num_edicts;
|
||||||
|
|
||||||
//for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
|
//for (i=0 ; i<sv.num_edicts ; i++, ent = NextEdict(ent))
|
||||||
for(i = 0 ; i < entity_cap ; i++, ent = NEXT_EDICT(ent))
|
for(i = 0 ; i < entity_cap ; i++, ent = NextEdict(ent))
|
||||||
{
|
{
|
||||||
if(ent->free)
|
if(ent->free)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(G_FLOAT(GBL_force_retouch))
|
if(G_Float(GBL_force_retouch))
|
||||||
{
|
{
|
||||||
SV_LinkEdict(ent, true); // force retouch even for stationary
|
SV_LinkEdict(ent, true); // force retouch even for stationary
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i > 0 && i <= svs.maxclients)
|
if(i > 0 && i <= svs.maxclients)
|
||||||
SV_Physics_Client(ent, i);
|
SV_Physics_Client(ent, i);
|
||||||
else if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_PUSH)
|
else if(ED_Float(ent, ED_movetype) == MOVETYPE_PUSH)
|
||||||
SV_Physics_Pusher(ent);
|
SV_Physics_Pusher(ent);
|
||||||
else if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_NONE)
|
else if(ED_Float(ent, ED_movetype) == MOVETYPE_NONE)
|
||||||
SV_Physics_None(ent);
|
SV_Physics_None(ent);
|
||||||
else if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_NOCLIP)
|
else if(ED_Float(ent, ED_movetype) == MOVETYPE_NOCLIP)
|
||||||
SV_Physics_Noclip(ent);
|
SV_Physics_Noclip(ent);
|
||||||
else if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_STEP)
|
else if(ED_Float(ent, ED_movetype) == MOVETYPE_STEP)
|
||||||
SV_Physics_Step(ent);
|
SV_Physics_Step(ent);
|
||||||
else if(ED_FLOAT(ent, ED_movetype) == MOVETYPE_TOSS
|
else if(ED_Float(ent, ED_movetype) == MOVETYPE_TOSS
|
||||||
|| ED_FLOAT(ent, ED_movetype) == MOVETYPE_BOUNCE
|
|| ED_Float(ent, ED_movetype) == MOVETYPE_BOUNCE
|
||||||
|| ED_FLOAT(ent, ED_movetype) == MOVETYPE_FLY
|
|| ED_Float(ent, ED_movetype) == MOVETYPE_FLY
|
||||||
|| ED_FLOAT(ent, ED_movetype) == MOVETYPE_FLYMISSILE)
|
|| ED_Float(ent, ED_movetype) == MOVETYPE_FLYMISSILE)
|
||||||
SV_Physics_Toss(ent);
|
SV_Physics_Toss(ent);
|
||||||
else
|
else
|
||||||
Sys_Error("SV_Physics: bad movetype %" PRIi32 "", (int32_t)ED_FLOAT(ent, ED_movetype));
|
Sys_Error("SV_Physics: bad movetype %" PRIi32, (int32_t)ED_Float(ent, ED_movetype));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(G_FLOAT(GBL_force_retouch))
|
if(G_Float(GBL_force_retouch))
|
||||||
G_FLOAT(GBL_force_retouch)--;
|
G_Float(GBL_force_retouch)--;
|
||||||
|
|
||||||
if(!sv_freezenonclients.value)
|
if(!sv_freezenonclients.value)
|
||||||
sv.time += host_frametime;
|
sv.time += host_frametime;
|
||||||
|
|
|
@ -58,18 +58,18 @@ void SV_SetIdealPitch(void)
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
int32_t step, dir, steps;
|
int32_t step, dir, steps;
|
||||||
|
|
||||||
if(!((int32_t)ED_FLOAT(sv_player, ED_flags) & FL_ONGROUND))
|
if(!((int32_t)ED_Float(sv_player, ED_flags) & FL_ONGROUND))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
angleval = ED_VECTOR(sv_player, ED_angles)[YAW] * PI * 2 / 360;
|
angleval = ED_Vector(sv_player, ED_angles)[YAW] * PI * 2 / 360;
|
||||||
sinval = sin(angleval);
|
sinval = sin(angleval);
|
||||||
cosval = cos(angleval);
|
cosval = cos(angleval);
|
||||||
|
|
||||||
for(i = 0 ; i < MAX_FORWARD ; i++)
|
for(i = 0 ; i < MAX_FORWARD ; i++)
|
||||||
{
|
{
|
||||||
top[0] = ED_VECTOR(sv_player, ED_origin)[0] + cosval * (i + 3) * 12;
|
top[0] = ED_Vector(sv_player, ED_origin)[0] + cosval * (i + 3) * 12;
|
||||||
top[1] = ED_VECTOR(sv_player, ED_origin)[1] + sinval * (i + 3) * 12;
|
top[1] = ED_Vector(sv_player, ED_origin)[1] + sinval * (i + 3) * 12;
|
||||||
top[2] = ED_VECTOR(sv_player, ED_origin)[2] + ED_VECTOR(sv_player, ED_view_ofs)[2];
|
top[2] = ED_Vector(sv_player, ED_origin)[2] + ED_Vector(sv_player, ED_view_ofs)[2];
|
||||||
|
|
||||||
bottom[0] = top[0];
|
bottom[0] = top[0];
|
||||||
bottom[1] = top[1];
|
bottom[1] = top[1];
|
||||||
|
@ -102,13 +102,13 @@ void SV_SetIdealPitch(void)
|
||||||
|
|
||||||
if(!dir)
|
if(!dir)
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_idealpitch) = 0;
|
ED_Float(sv_player, ED_idealpitch) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(steps < 2)
|
if(steps < 2)
|
||||||
return;
|
return;
|
||||||
ED_FLOAT(sv_player, ED_idealpitch) = -dir * sv_idealpitchscale.value;
|
ED_Float(sv_player, ED_idealpitch) = -dir * sv_idealpitchscale.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void SV_UserFriction(void)
|
||||||
// if the leading edge is over a dropoff, increase friction
|
// if the leading edge is over a dropoff, increase friction
|
||||||
start[0] = stop[0] = origin[0] + vel[0] / speed * 16;
|
start[0] = stop[0] = origin[0] + vel[0] / speed * 16;
|
||||||
start[1] = stop[1] = origin[1] + vel[1] / speed * 16;
|
start[1] = stop[1] = origin[1] + vel[1] / speed * 16;
|
||||||
start[2] = origin[2] + ED_VECTOR(sv_player, ED_mins)[2];
|
start[2] = origin[2] + ED_Vector(sv_player, ED_mins)[2];
|
||||||
stop[2] = start[2] - 34;
|
stop[2] = start[2] - 34;
|
||||||
|
|
||||||
trace = SV_Move(start, vec3_origin, vec3_origin, stop, true, sv_player);
|
trace = SV_Move(start, vec3_origin, vec3_origin, stop, true, sv_player);
|
||||||
|
@ -208,12 +208,12 @@ void DropPunchAngle(void)
|
||||||
{
|
{
|
||||||
float len;
|
float len;
|
||||||
|
|
||||||
len = VectorNormalize(ED_VECTOR(sv_player, ED_punchangle));
|
len = VectorNormalize(ED_Vector(sv_player, ED_punchangle));
|
||||||
|
|
||||||
len -= 10 * host_frametime;
|
len -= 10 * host_frametime;
|
||||||
if(len < 0)
|
if(len < 0)
|
||||||
len = 0;
|
len = 0;
|
||||||
VectorScale(ED_VECTOR(sv_player, ED_punchangle), len, ED_VECTOR(sv_player, ED_punchangle));
|
VectorScale(ED_Vector(sv_player, ED_punchangle), len, ED_Vector(sv_player, ED_punchangle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -231,7 +231,7 @@ void SV_WaterMove(void)
|
||||||
//
|
//
|
||||||
// user intentions
|
// user intentions
|
||||||
//
|
//
|
||||||
AngleVectors(ED_VECTOR(sv_player, ED_v_angle), forward, right, up);
|
AngleVectors(ED_Vector(sv_player, ED_v_angle), forward, right, up);
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
wishvel[i] = forward[i] * cmd.forwardmove + right[i] * cmd.sidemove;
|
wishvel[i] = forward[i] * cmd.forwardmove + right[i] * cmd.sidemove;
|
||||||
|
@ -284,14 +284,14 @@ void SV_WaterMove(void)
|
||||||
|
|
||||||
void SV_WaterJump(void)
|
void SV_WaterJump(void)
|
||||||
{
|
{
|
||||||
if(sv.time > ED_FLOAT(sv_player, ED_teleport_time)
|
if(sv.time > ED_Float(sv_player, ED_teleport_time)
|
||||||
|| !ED_FLOAT(sv_player, ED_waterlevel))
|
|| !ED_Float(sv_player, ED_waterlevel))
|
||||||
{
|
{
|
||||||
ED_FLOAT(sv_player, ED_flags) = (int32_t)ED_FLOAT(sv_player, ED_flags) & ~FL_WATERJUMP;
|
ED_Float(sv_player, ED_flags) = (int32_t)ED_Float(sv_player, ED_flags) & ~FL_WATERJUMP;
|
||||||
ED_FLOAT(sv_player, ED_teleport_time) = 0;
|
ED_Float(sv_player, ED_teleport_time) = 0;
|
||||||
}
|
}
|
||||||
ED_VECTOR(sv_player, ED_velocity)[0] = ED_VECTOR(sv_player, ED_movedir)[0];
|
ED_Vector(sv_player, ED_velocity)[0] = ED_Vector(sv_player, ED_movedir)[0];
|
||||||
ED_VECTOR(sv_player, ED_velocity)[1] = ED_VECTOR(sv_player, ED_movedir)[1];
|
ED_Vector(sv_player, ED_velocity)[1] = ED_Vector(sv_player, ED_movedir)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -303,7 +303,7 @@ new, alternate noclip. old noclip is still handled in SV_AirMove
|
||||||
*/
|
*/
|
||||||
void SV_NoclipMove(void)
|
void SV_NoclipMove(void)
|
||||||
{
|
{
|
||||||
AngleVectors(ED_VECTOR(sv_player, ED_v_angle), forward, right, up);
|
AngleVectors(ED_Vector(sv_player, ED_v_angle), forward, right, up);
|
||||||
|
|
||||||
velocity[0] = forward[0] * cmd.forwardmove + right[0] * cmd.sidemove;
|
velocity[0] = forward[0] * cmd.forwardmove + right[0] * cmd.sidemove;
|
||||||
velocity[1] = forward[1] * cmd.forwardmove + right[1] * cmd.sidemove;
|
velocity[1] = forward[1] * cmd.forwardmove + right[1] * cmd.sidemove;
|
||||||
|
@ -329,19 +329,19 @@ void SV_AirMove(void)
|
||||||
float wishspeed;
|
float wishspeed;
|
||||||
float fmove, smove;
|
float fmove, smove;
|
||||||
|
|
||||||
AngleVectors(ED_VECTOR(sv_player, ED_angles), forward, right, up);
|
AngleVectors(ED_Vector(sv_player, ED_angles), forward, right, up);
|
||||||
|
|
||||||
fmove = cmd.forwardmove;
|
fmove = cmd.forwardmove;
|
||||||
smove = cmd.sidemove;
|
smove = cmd.sidemove;
|
||||||
|
|
||||||
// hack to not let you back into teleporter
|
// hack to not let you back into teleporter
|
||||||
if(sv.time < ED_FLOAT(sv_player, ED_teleport_time) && fmove < 0)
|
if(sv.time < ED_Float(sv_player, ED_teleport_time) && fmove < 0)
|
||||||
fmove = 0;
|
fmove = 0;
|
||||||
|
|
||||||
for(i = 0 ; i < 3 ; i++)
|
for(i = 0 ; i < 3 ; i++)
|
||||||
wishvel[i] = forward[i] * fmove + right[i] * smove;
|
wishvel[i] = forward[i] * fmove + right[i] * smove;
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(sv_player, ED_movetype) != MOVETYPE_WALK)
|
if((int32_t)ED_Float(sv_player, ED_movetype) != MOVETYPE_WALK)
|
||||||
wishvel[2] = cmd.upmove;
|
wishvel[2] = cmd.upmove;
|
||||||
else
|
else
|
||||||
wishvel[2] = 0;
|
wishvel[2] = 0;
|
||||||
|
@ -354,7 +354,7 @@ void SV_AirMove(void)
|
||||||
wishspeed = sv_maxspeed.value;
|
wishspeed = sv_maxspeed.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) == MOVETYPE_NOCLIP)
|
if(ED_Float(sv_player, ED_movetype) == MOVETYPE_NOCLIP)
|
||||||
{
|
{
|
||||||
// noclip
|
// noclip
|
||||||
VectorCopy(wishvel, velocity);
|
VectorCopy(wishvel, velocity);
|
||||||
|
@ -383,37 +383,37 @@ void SV_ClientThink(void)
|
||||||
{
|
{
|
||||||
vec3_t v_angle;
|
vec3_t v_angle;
|
||||||
|
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) == MOVETYPE_NONE)
|
if(ED_Float(sv_player, ED_movetype) == MOVETYPE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
onground = (int32_t)ED_FLOAT(sv_player, ED_flags) & FL_ONGROUND;
|
onground = (int32_t)ED_Float(sv_player, ED_flags) & FL_ONGROUND;
|
||||||
|
|
||||||
origin = ED_VECTOR(sv_player, ED_origin);
|
origin = ED_Vector(sv_player, ED_origin);
|
||||||
velocity = ED_VECTOR(sv_player, ED_velocity);
|
velocity = ED_Vector(sv_player, ED_velocity);
|
||||||
|
|
||||||
DropPunchAngle();
|
DropPunchAngle();
|
||||||
|
|
||||||
//
|
//
|
||||||
// if dead, behave differently
|
// if dead, behave differently
|
||||||
//
|
//
|
||||||
if(ED_FLOAT(sv_player, ED_health) <= 0)
|
if(ED_Float(sv_player, ED_health) <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//
|
//
|
||||||
// angles
|
// angles
|
||||||
// show 1/3 the pitch angle and all the roll angle
|
// show 1/3 the pitch angle and all the roll angle
|
||||||
cmd = host_client->cmd;
|
cmd = host_client->cmd;
|
||||||
angles = ED_VECTOR(sv_player, ED_angles);
|
angles = ED_Vector(sv_player, ED_angles);
|
||||||
|
|
||||||
VectorAdd(ED_VECTOR(sv_player, ED_v_angle), ED_VECTOR(sv_player, ED_punchangle), v_angle);
|
VectorAdd(ED_Vector(sv_player, ED_v_angle), ED_Vector(sv_player, ED_punchangle), v_angle);
|
||||||
angles[ROLL] = V_CalcRoll(ED_VECTOR(sv_player, ED_angles), ED_VECTOR(sv_player, ED_velocity)) * 4;
|
angles[ROLL] = V_CalcRoll(ED_Vector(sv_player, ED_angles), ED_Vector(sv_player, ED_velocity)) * 4;
|
||||||
if(!ED_FLOAT(sv_player, ED_fixangle))
|
if(!ED_Float(sv_player, ED_fixangle))
|
||||||
{
|
{
|
||||||
angles[PITCH] = -v_angle[PITCH] / 3;
|
angles[PITCH] = -v_angle[PITCH] / 3;
|
||||||
angles[YAW] = v_angle[YAW];
|
angles[YAW] = v_angle[YAW];
|
||||||
}
|
}
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(sv_player, ED_flags) & FL_WATERJUMP)
|
if((int32_t)ED_Float(sv_player, ED_flags) & FL_WATERJUMP)
|
||||||
{
|
{
|
||||||
SV_WaterJump();
|
SV_WaterJump();
|
||||||
return;
|
return;
|
||||||
|
@ -422,9 +422,9 @@ void SV_ClientThink(void)
|
||||||
// walk
|
// walk
|
||||||
//
|
//
|
||||||
//johnfitz -- alternate noclip
|
//johnfitz -- alternate noclip
|
||||||
if(ED_FLOAT(sv_player, ED_movetype) == MOVETYPE_NOCLIP && sv_altnoclip.value)
|
if(ED_Float(sv_player, ED_movetype) == MOVETYPE_NOCLIP && sv_altnoclip.value)
|
||||||
SV_NoclipMove();
|
SV_NoclipMove();
|
||||||
else if(ED_FLOAT(sv_player, ED_waterlevel) >= 2 && ED_FLOAT(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
else if(ED_Float(sv_player, ED_waterlevel) >= 2 && ED_Float(sv_player, ED_movetype) != MOVETYPE_NOCLIP)
|
||||||
SV_WaterMove();
|
SV_WaterMove();
|
||||||
else
|
else
|
||||||
SV_AirMove();
|
SV_AirMove();
|
||||||
|
@ -457,7 +457,7 @@ void SV_ReadClientMove(usercmd_t *move)
|
||||||
angle[i] = MSG_ReadAngle16(sv.protocolflags);
|
angle[i] = MSG_ReadAngle16(sv.protocolflags);
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
VectorCopy(angle, ED_VECTOR(host_client->edict, ED_v_angle));
|
VectorCopy(angle, ED_Vector(host_client->edict, ED_v_angle));
|
||||||
|
|
||||||
// read movement
|
// read movement
|
||||||
move->forwardmove = MSG_ReadShort();
|
move->forwardmove = MSG_ReadShort();
|
||||||
|
@ -466,12 +466,12 @@ void SV_ReadClientMove(usercmd_t *move)
|
||||||
|
|
||||||
// read buttons
|
// read buttons
|
||||||
bits = MSG_ReadByte();
|
bits = MSG_ReadByte();
|
||||||
ED_FLOAT(host_client->edict, ED_button0) = bits & 1;
|
ED_Float(host_client->edict, ED_button0) = bits & 1;
|
||||||
ED_FLOAT(host_client->edict, ED_button2) = (bits & 2) >> 1;
|
ED_Float(host_client->edict, ED_button2) = (bits & 2) >> 1;
|
||||||
|
|
||||||
i = MSG_ReadByte();
|
i = MSG_ReadByte();
|
||||||
if(i)
|
if(i)
|
||||||
ED_FLOAT(host_client->edict, ED_impulse) = i;
|
ED_Float(host_client->edict, ED_impulse) = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -348,7 +348,7 @@ const char *UDP_AddrToString(struct qsockaddr *addr)
|
||||||
int32_t haddr;
|
int32_t haddr;
|
||||||
|
|
||||||
haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
||||||
q_snprintf(buffer, sizeof(buffer), "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32 "", (haddr >> 24) & 0xff,
|
q_snprintf(buffer, sizeof(buffer), "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32, (haddr >> 24) & 0xff,
|
||||||
(haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff,
|
(haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff,
|
||||||
ntohs(((struct sockaddr_in *)addr)->sin_port));
|
ntohs(((struct sockaddr_in *)addr)->sin_port));
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -360,7 +360,7 @@ int32_t UDP_StringToAddr(const char *string, struct qsockaddr *addr)
|
||||||
{
|
{
|
||||||
int32_t ha1, ha2, ha3, ha4, hp, ipaddr;
|
int32_t ha1, ha2, ha3, ha4, hp, ipaddr;
|
||||||
|
|
||||||
sscanf(string, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32 "", &ha1, &ha2, &ha3, &ha4, &hp);
|
sscanf(string, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32, &ha1, &ha2, &ha3, &ha4, &hp);
|
||||||
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
||||||
|
|
||||||
addr->qsa_family = AF_INET;
|
addr->qsa_family = AF_INET;
|
||||||
|
|
|
@ -145,7 +145,7 @@ void *W_GetLumpNum(int32_t num)
|
||||||
lumpinfo_t *lump;
|
lumpinfo_t *lump;
|
||||||
|
|
||||||
if(num < 0 || num > wad_numlumps)
|
if(num < 0 || num > wad_numlumps)
|
||||||
Sys_Error("W_GetLumpNum: bad number: %" PRIi32 "", num);
|
Sys_Error("W_GetLumpNum: bad number: %" PRIi32, num);
|
||||||
|
|
||||||
lump = wad_lumps + num;
|
lump = wad_lumps + num;
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ static void WINS_GetLocalAddress(void)
|
||||||
myAddr = *(in_addr_t *)local->h_addr_list[0];
|
myAddr = *(in_addr_t *)local->h_addr_list[0];
|
||||||
|
|
||||||
addr = ntohl(myAddr);
|
addr = ntohl(myAddr);
|
||||||
sprintf(my_tcpip_address, "%" PRIi64 ".%" PRIi64 ".%" PRIi64 ".%" PRIi64 "", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
|
sprintf(my_tcpip_address, "%" PRIi64 ".%" PRIi64 ".%" PRIi64 ".%" PRIi64, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ const char *WINS_AddrToString(struct qsockaddr *addr)
|
||||||
int32_t haddr;
|
int32_t haddr;
|
||||||
|
|
||||||
haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
||||||
sprintf(buffer, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32 "", (haddr >> 24) & 0xff,
|
sprintf(buffer, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32, (haddr >> 24) & 0xff,
|
||||||
(haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff,
|
(haddr >> 16) & 0xff, (haddr >> 8) & 0xff, haddr & 0xff,
|
||||||
ntohs(((struct sockaddr_in *)addr)->sin_port));
|
ntohs(((struct sockaddr_in *)addr)->sin_port));
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -442,7 +442,7 @@ int32_t WINS_StringToAddr(const char *string, struct qsockaddr *addr)
|
||||||
{
|
{
|
||||||
int32_t ha1, ha2, ha3, ha4, hp, ipaddr;
|
int32_t ha1, ha2, ha3, ha4, hp, ipaddr;
|
||||||
|
|
||||||
sscanf(string, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32 "", &ha1, &ha2, &ha3, &ha4, &hp);
|
sscanf(string, "%" PRIi32 ".%" PRIi32 ".%" PRIi32 ".%" PRIi32 ":%" PRIi32, &ha1, &ha2, &ha3, &ha4, &hp);
|
||||||
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
||||||
|
|
||||||
addr->qsa_family = AF_INET;
|
addr->qsa_family = AF_INET;
|
||||||
|
|
|
@ -303,7 +303,7 @@ const char *WIPX_AddrToString(struct qsockaddr *addr)
|
||||||
{
|
{
|
||||||
static char buf[28];
|
static char buf[28];
|
||||||
|
|
||||||
sprintf(buf, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%" PRIu32 "",
|
sprintf(buf, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%" PRIu32,
|
||||||
((struct sockaddr_ipx *)addr)->sa_netnum[0] & 0xff,
|
((struct sockaddr_ipx *)addr)->sa_netnum[0] & 0xff,
|
||||||
((struct sockaddr_ipx *)addr)->sa_netnum[1] & 0xff,
|
((struct sockaddr_ipx *)addr)->sa_netnum[1] & 0xff,
|
||||||
((struct sockaddr_ipx *)addr)->sa_netnum[2] & 0xff,
|
((struct sockaddr_ipx *)addr)->sa_netnum[2] & 0xff,
|
||||||
|
@ -350,7 +350,7 @@ int32_t WIPX_StringToAddr(const char *string, struct qsockaddr *addr)
|
||||||
DO(19, sa_nodenum[5]);
|
DO(19, sa_nodenum[5]);
|
||||||
#undef DO
|
#undef DO
|
||||||
|
|
||||||
sscanf(&string[22], "%" PRIu32 "", &val);
|
sscanf(&string[22], "%" PRIu32, &val);
|
||||||
((struct sockaddr_ipx *)addr)->sa_socket = htons((uint16_t)val);
|
((struct sockaddr_ipx *)addr)->sa_socket = htons((uint16_t)val);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -393,12 +393,12 @@ int32_t WIPX_GetAddrFromName(const char *name, struct qsockaddr *addr)
|
||||||
|
|
||||||
if(n == 12)
|
if(n == 12)
|
||||||
{
|
{
|
||||||
sprintf(buf, "00000000:%s:%" PRIu32 "", name, net_hostport);
|
sprintf(buf, "00000000:%s:%" PRIu32, name, net_hostport);
|
||||||
return WIPX_StringToAddr(buf, addr);
|
return WIPX_StringToAddr(buf, addr);
|
||||||
}
|
}
|
||||||
if(n == 21)
|
if(n == 21)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%s:%" PRIu32 "", name, net_hostport);
|
sprintf(buf, "%s:%" PRIu32, name, net_hostport);
|
||||||
return WIPX_StringToAddr(buf, addr);
|
return WIPX_StringToAddr(buf, addr);
|
||||||
}
|
}
|
||||||
if(n > 21 && n <= 27)
|
if(n > 21 && n <= 27)
|
||||||
|
|
132
source/world.c
132
source/world.c
|
@ -137,18 +137,18 @@ hull_t *SV_HullForEntity(edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
|
|
||||||
// decide which clipping hull to use, based on the size
|
// decide which clipping hull to use, based on the size
|
||||||
if(ED_FLOAT(ent, ED_solid) == SOLID_BSP)
|
if(ED_Float(ent, ED_solid) == SOLID_BSP)
|
||||||
{
|
{
|
||||||
// explicit hulls in the BSP model
|
// explicit hulls in the BSP model
|
||||||
if(ED_FLOAT(ent, ED_movetype) != MOVETYPE_PUSH)
|
if(ED_Float(ent, ED_movetype) != MOVETYPE_PUSH)
|
||||||
Host_Error("SOLID_BSP without MOVETYPE_PUSH (%s at %f %f %f)",
|
Host_Error("SOLID_BSP without MOVETYPE_PUSH (%s at %f %f %f)",
|
||||||
ED_STRING(ent, ED_classname), ED_VECTOR(ent, ED_origin)[0], ED_VECTOR(ent, ED_origin)[1], ED_VECTOR(ent, ED_origin)[2]);
|
ED_String(ent, ED_classname), ED_Vector(ent, ED_origin)[0], ED_Vector(ent, ED_origin)[1], ED_Vector(ent, ED_origin)[2]);
|
||||||
|
|
||||||
model = sv.models[(int32_t)ED_FLOAT(ent, ED_modelindex) ];
|
model = sv.models[(int32_t)ED_Float(ent, ED_modelindex) ];
|
||||||
|
|
||||||
if(!model || model->type != mod_brush)
|
if(!model || model->type != mod_brush)
|
||||||
Host_Error("SOLID_BSP with a non bsp model (%s at %f %f %f)",
|
Host_Error("SOLID_BSP with a non bsp model (%s at %f %f %f)",
|
||||||
ED_STRING(ent, ED_classname), ED_VECTOR(ent, ED_origin)[0], ED_VECTOR(ent, ED_origin)[1], ED_VECTOR(ent, ED_origin)[2]);
|
ED_String(ent, ED_classname), ED_Vector(ent, ED_origin)[0], ED_Vector(ent, ED_origin)[1], ED_Vector(ent, ED_origin)[2]);
|
||||||
|
|
||||||
VectorSubtract(maxs, mins, size);
|
VectorSubtract(maxs, mins, size);
|
||||||
if(size[0] < 3)
|
if(size[0] < 3)
|
||||||
|
@ -160,17 +160,17 @@ hull_t *SV_HullForEntity(edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
||||||
|
|
||||||
// calculate an offset value to center the origin
|
// calculate an offset value to center the origin
|
||||||
VectorSubtract(hull->clip_mins, mins, offset);
|
VectorSubtract(hull->clip_mins, mins, offset);
|
||||||
VectorAdd(offset, ED_VECTOR(ent, ED_origin), offset);
|
VectorAdd(offset, ED_Vector(ent, ED_origin), offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// create a temp hull from bounding box sizes
|
// create a temp hull from bounding box sizes
|
||||||
|
|
||||||
VectorSubtract(ED_VECTOR(ent, ED_mins), maxs, hullmins);
|
VectorSubtract(ED_Vector(ent, ED_mins), maxs, hullmins);
|
||||||
VectorSubtract(ED_VECTOR(ent, ED_maxs), mins, hullmaxs);
|
VectorSubtract(ED_Vector(ent, ED_maxs), mins, hullmaxs);
|
||||||
hull = SV_HullForBox(hullmins, hullmaxs);
|
hull = SV_HullForBox(hullmins, hullmaxs);
|
||||||
|
|
||||||
VectorCopy(ED_VECTOR(ent, ED_origin), offset);
|
VectorCopy(ED_Vector(ent, ED_origin), offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,14 +297,14 @@ SV_AreaTriggerEdicts(edict_t *ent, areanode_t *node, edict_t **list, int32_t *li
|
||||||
touch = EDICT_FROM_AREA(l);
|
touch = EDICT_FROM_AREA(l);
|
||||||
if(touch == ent)
|
if(touch == ent)
|
||||||
continue;
|
continue;
|
||||||
if(!ED_FUNC(touch, ED_touch) || ED_FLOAT(touch, ED_solid) != SOLID_TRIGGER)
|
if(!ED_Func(touch, ED_touch) || ED_Float(touch, ED_solid) != SOLID_TRIGGER)
|
||||||
continue;
|
continue;
|
||||||
if(ED_VECTOR(ent, ED_absmin)[0] > ED_VECTOR(touch, ED_absmax)[0]
|
if(ED_Vector(ent, ED_absmin)[0] > ED_Vector(touch, ED_absmax)[0]
|
||||||
|| ED_VECTOR(ent, ED_absmin)[1] > ED_VECTOR(touch, ED_absmax)[1]
|
|| ED_Vector(ent, ED_absmin)[1] > ED_Vector(touch, ED_absmax)[1]
|
||||||
|| ED_VECTOR(ent, ED_absmin)[2] > ED_VECTOR(touch, ED_absmax)[2]
|
|| ED_Vector(ent, ED_absmin)[2] > ED_Vector(touch, ED_absmax)[2]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[0] < ED_VECTOR(touch, ED_absmin)[0]
|
|| ED_Vector(ent, ED_absmax)[0] < ED_Vector(touch, ED_absmin)[0]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[1] < ED_VECTOR(touch, ED_absmin)[1]
|
|| ED_Vector(ent, ED_absmax)[1] < ED_Vector(touch, ED_absmin)[1]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[2] < ED_VECTOR(touch, ED_absmin)[2])
|
|| ED_Vector(ent, ED_absmax)[2] < ED_Vector(touch, ED_absmin)[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(*listcount == listspace)
|
if(*listcount == listspace)
|
||||||
|
@ -318,9 +318,9 @@ SV_AreaTriggerEdicts(edict_t *ent, areanode_t *node, edict_t **list, int32_t *li
|
||||||
if(node->axis == -1)
|
if(node->axis == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(ED_VECTOR(ent, ED_absmax)[node->axis] > node->dist)
|
if(ED_Vector(ent, ED_absmax)[node->axis] > node->dist)
|
||||||
SV_AreaTriggerEdicts(ent, node->children[0], list, listcount, listspace);
|
SV_AreaTriggerEdicts(ent, node->children[0], list, listcount, listspace);
|
||||||
if(ED_VECTOR(ent, ED_absmin)[node->axis] < node->dist)
|
if(ED_Vector(ent, ED_absmin)[node->axis] < node->dist)
|
||||||
SV_AreaTriggerEdicts(ent, node->children[1], list, listcount, listspace);
|
SV_AreaTriggerEdicts(ent, node->children[1], list, listcount, listspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,25 +355,25 @@ void SV_TouchLinks(edict_t *ent)
|
||||||
// edicts later in the list no longer touch
|
// edicts later in the list no longer touch
|
||||||
if(touch == ent)
|
if(touch == ent)
|
||||||
continue;
|
continue;
|
||||||
if(!ED_FUNC(touch, ED_touch) || ED_FLOAT(touch, ED_solid) != SOLID_TRIGGER)
|
if(!ED_Func(touch, ED_touch) || ED_Float(touch, ED_solid) != SOLID_TRIGGER)
|
||||||
continue;
|
continue;
|
||||||
if(ED_VECTOR(ent, ED_absmin)[0] > ED_VECTOR(touch, ED_absmax)[0]
|
if(ED_Vector(ent, ED_absmin)[0] > ED_Vector(touch, ED_absmax)[0]
|
||||||
|| ED_VECTOR(ent, ED_absmin)[1] > ED_VECTOR(touch, ED_absmax)[1]
|
|| ED_Vector(ent, ED_absmin)[1] > ED_Vector(touch, ED_absmax)[1]
|
||||||
|| ED_VECTOR(ent, ED_absmin)[2] > ED_VECTOR(touch, ED_absmax)[2]
|
|| ED_Vector(ent, ED_absmin)[2] > ED_Vector(touch, ED_absmax)[2]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[0] < ED_VECTOR(touch, ED_absmin)[0]
|
|| ED_Vector(ent, ED_absmax)[0] < ED_Vector(touch, ED_absmin)[0]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[1] < ED_VECTOR(touch, ED_absmin)[1]
|
|| ED_Vector(ent, ED_absmax)[1] < ED_Vector(touch, ED_absmin)[1]
|
||||||
|| ED_VECTOR(ent, ED_absmax)[2] < ED_VECTOR(touch, ED_absmin)[2])
|
|| ED_Vector(ent, ED_absmax)[2] < ED_Vector(touch, ED_absmin)[2])
|
||||||
continue;
|
continue;
|
||||||
old_self = G_PEDICT(GBL_self);
|
old_self = G_PEdict(GBL_self);
|
||||||
old_other = G_PEDICT(GBL_other);
|
old_other = G_PEdict(GBL_other);
|
||||||
|
|
||||||
G_PEDICT(GBL_self) = EDICT_TO_PROG(touch);
|
G_PEdict(GBL_self) = EdictProg(touch);
|
||||||
G_PEDICT(GBL_other) = EDICT_TO_PROG(ent);
|
G_PEdict(GBL_other) = EdictProg(ent);
|
||||||
G_FLOAT(GBL_time) = sv.time;
|
G_Float(GBL_time) = sv.time;
|
||||||
PR_ExecuteProgram(ED_FUNC(touch, ED_touch));
|
PR_ExecuteProgram(ED_Func(touch, ED_touch));
|
||||||
|
|
||||||
G_PEDICT(GBL_self) = old_self;
|
G_PEdict(GBL_self) = old_self;
|
||||||
G_PEDICT(GBL_other) = old_other;
|
G_PEdict(GBL_other) = old_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
// free hunk-allocated edicts array
|
// free hunk-allocated edicts array
|
||||||
|
@ -415,7 +415,7 @@ void SV_FindTouchedLeafs(edict_t *ent, mnode_t *node)
|
||||||
// NODE_MIXED
|
// NODE_MIXED
|
||||||
|
|
||||||
splitplane = node->plane;
|
splitplane = node->plane;
|
||||||
sides = BOX_ON_PLANE_SIDE(ED_VECTOR(ent, ED_absmin), ED_VECTOR(ent, ED_absmax), splitplane);
|
sides = BOX_ON_PLANE_SIDE(ED_Vector(ent, ED_absmin), ED_Vector(ent, ED_absmax), splitplane);
|
||||||
|
|
||||||
// recurse down the contacted sides
|
// recurse down the contacted sides
|
||||||
if(sides & 1)
|
if(sides & 1)
|
||||||
|
@ -445,38 +445,38 @@ void SV_LinkEdict(edict_t *ent, bool touch_triggers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// set the abs box
|
// set the abs box
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_absmin));
|
VectorAdd(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_absmin));
|
||||||
VectorAdd(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_maxs), ED_VECTOR(ent, ED_absmax));
|
VectorAdd(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_maxs), ED_Vector(ent, ED_absmax));
|
||||||
|
|
||||||
//
|
//
|
||||||
// to make items easier to pick up and allow them to be grabbed off
|
// to make items easier to pick up and allow them to be grabbed off
|
||||||
// of shelves, the abs sizes are expanded
|
// of shelves, the abs sizes are expanded
|
||||||
//
|
//
|
||||||
if((int32_t)ED_FLOAT(ent, ED_flags) & FL_ITEM)
|
if((int32_t)ED_Float(ent, ED_flags) & FL_ITEM)
|
||||||
{
|
{
|
||||||
ED_VECTOR(ent, ED_absmin)[0] -= 15;
|
ED_Vector(ent, ED_absmin)[0] -= 15;
|
||||||
ED_VECTOR(ent, ED_absmin)[1] -= 15;
|
ED_Vector(ent, ED_absmin)[1] -= 15;
|
||||||
ED_VECTOR(ent, ED_absmax)[0] += 15;
|
ED_Vector(ent, ED_absmax)[0] += 15;
|
||||||
ED_VECTOR(ent, ED_absmax)[1] += 15;
|
ED_Vector(ent, ED_absmax)[1] += 15;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// because movement is clipped an epsilon away from an actual edge,
|
// because movement is clipped an epsilon away from an actual edge,
|
||||||
// we must fully check even when bounding boxes don't quite touch
|
// we must fully check even when bounding boxes don't quite touch
|
||||||
ED_VECTOR(ent, ED_absmin)[0] -= 1;
|
ED_Vector(ent, ED_absmin)[0] -= 1;
|
||||||
ED_VECTOR(ent, ED_absmin)[1] -= 1;
|
ED_Vector(ent, ED_absmin)[1] -= 1;
|
||||||
ED_VECTOR(ent, ED_absmin)[2] -= 1;
|
ED_Vector(ent, ED_absmin)[2] -= 1;
|
||||||
ED_VECTOR(ent, ED_absmax)[0] += 1;
|
ED_Vector(ent, ED_absmax)[0] += 1;
|
||||||
ED_VECTOR(ent, ED_absmax)[1] += 1;
|
ED_Vector(ent, ED_absmax)[1] += 1;
|
||||||
ED_VECTOR(ent, ED_absmax)[2] += 1;
|
ED_Vector(ent, ED_absmax)[2] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// link to PVS leafs
|
// link to PVS leafs
|
||||||
ent->num_leafs = 0;
|
ent->num_leafs = 0;
|
||||||
if(ED_FLOAT(ent, ED_modelindex))
|
if(ED_Float(ent, ED_modelindex))
|
||||||
SV_FindTouchedLeafs(ent, sv.worldmodel->nodes);
|
SV_FindTouchedLeafs(ent, sv.worldmodel->nodes);
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_solid) == SOLID_NOT)
|
if(ED_Float(ent, ED_solid) == SOLID_NOT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// find the first node that the ent's box crosses
|
// find the first node that the ent's box crosses
|
||||||
|
@ -485,9 +485,9 @@ void SV_LinkEdict(edict_t *ent, bool touch_triggers)
|
||||||
{
|
{
|
||||||
if(node->axis == -1)
|
if(node->axis == -1)
|
||||||
break;
|
break;
|
||||||
if(ED_VECTOR(ent, ED_absmin)[node->axis] > node->dist)
|
if(ED_Vector(ent, ED_absmin)[node->axis] > node->dist)
|
||||||
node = node->children[0];
|
node = node->children[0];
|
||||||
else if(ED_VECTOR(ent, ED_absmax)[node->axis] < node->dist)
|
else if(ED_Vector(ent, ED_absmax)[node->axis] < node->dist)
|
||||||
node = node->children[1];
|
node = node->children[1];
|
||||||
else
|
else
|
||||||
break; // crosses the node
|
break; // crosses the node
|
||||||
|
@ -495,7 +495,7 @@ void SV_LinkEdict(edict_t *ent, bool touch_triggers)
|
||||||
|
|
||||||
// link it in
|
// link it in
|
||||||
|
|
||||||
if(ED_FLOAT(ent, ED_solid) == SOLID_TRIGGER)
|
if(ED_Float(ent, ED_solid) == SOLID_TRIGGER)
|
||||||
InsertLinkBefore(&ent->area, &node->trigger_edicts);
|
InsertLinkBefore(&ent->area, &node->trigger_edicts);
|
||||||
else
|
else
|
||||||
InsertLinkBefore(&ent->area, &node->solid_edicts);
|
InsertLinkBefore(&ent->area, &node->solid_edicts);
|
||||||
|
@ -583,7 +583,7 @@ edict_t *SV_TestEntityPosition(edict_t *ent)
|
||||||
{
|
{
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
trace = SV_Move(ED_VECTOR(ent, ED_origin), ED_VECTOR(ent, ED_mins), ED_VECTOR(ent, ED_maxs), ED_VECTOR(ent, ED_origin), 0, ent);
|
trace = SV_Move(ED_Vector(ent, ED_origin), ED_Vector(ent, ED_mins), ED_Vector(ent, ED_maxs), ED_Vector(ent, ED_origin), 0, ent);
|
||||||
|
|
||||||
if(trace.startsolid)
|
if(trace.startsolid)
|
||||||
return sv.edicts;
|
return sv.edicts;
|
||||||
|
@ -794,25 +794,25 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
|
||||||
{
|
{
|
||||||
next = l->next;
|
next = l->next;
|
||||||
touch = EDICT_FROM_AREA(l);
|
touch = EDICT_FROM_AREA(l);
|
||||||
if(ED_FLOAT(touch, ED_solid) == SOLID_NOT)
|
if(ED_Float(touch, ED_solid) == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
if(touch == clip->passedict)
|
if(touch == clip->passedict)
|
||||||
continue;
|
continue;
|
||||||
if(ED_FLOAT(touch, ED_solid) == SOLID_TRIGGER)
|
if(ED_Float(touch, ED_solid) == SOLID_TRIGGER)
|
||||||
Sys_Error("Trigger in clipping list");
|
Sys_Error("Trigger in clipping list");
|
||||||
|
|
||||||
if(clip->type == MOVE_NOMONSTERS && ED_FLOAT(touch, ED_solid) != SOLID_BSP)
|
if(clip->type == MOVE_NOMONSTERS && ED_Float(touch, ED_solid) != SOLID_BSP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(clip->boxmins[0] > ED_VECTOR(touch, ED_absmax)[0]
|
if(clip->boxmins[0] > ED_Vector(touch, ED_absmax)[0]
|
||||||
|| clip->boxmins[1] > ED_VECTOR(touch, ED_absmax)[1]
|
|| clip->boxmins[1] > ED_Vector(touch, ED_absmax)[1]
|
||||||
|| clip->boxmins[2] > ED_VECTOR(touch, ED_absmax)[2]
|
|| clip->boxmins[2] > ED_Vector(touch, ED_absmax)[2]
|
||||||
|| clip->boxmaxs[0] < ED_VECTOR(touch, ED_absmin)[0]
|
|| clip->boxmaxs[0] < ED_Vector(touch, ED_absmin)[0]
|
||||||
|| clip->boxmaxs[1] < ED_VECTOR(touch, ED_absmin)[1]
|
|| clip->boxmaxs[1] < ED_Vector(touch, ED_absmin)[1]
|
||||||
|| clip->boxmaxs[2] < ED_VECTOR(touch, ED_absmin)[2])
|
|| clip->boxmaxs[2] < ED_Vector(touch, ED_absmin)[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(clip->passedict && ED_VECTOR(clip->passedict, ED_size)[0] && !ED_VECTOR(touch, ED_size)[0])
|
if(clip->passedict && ED_Vector(clip->passedict, ED_size)[0] && !ED_Vector(touch, ED_size)[0])
|
||||||
continue; // points never interact
|
continue; // points never interact
|
||||||
|
|
||||||
// might intersect, so do an exact clip
|
// might intersect, so do an exact clip
|
||||||
|
@ -820,13 +820,13 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
|
||||||
return;
|
return;
|
||||||
if(clip->passedict)
|
if(clip->passedict)
|
||||||
{
|
{
|
||||||
if(PROG_TO_EDICT(ED_PEDICT(touch, ED_owner)) == clip->passedict)
|
if(ProgEdict(ED_PEdict(touch, ED_owner)) == clip->passedict)
|
||||||
continue; // don't clip against own missiles
|
continue; // don't clip against own missiles
|
||||||
if(PROG_TO_EDICT(ED_PEDICT(clip->passedict, ED_owner)) == touch)
|
if(ProgEdict(ED_PEdict(clip->passedict, ED_owner)) == touch)
|
||||||
continue; // don't clip against owner
|
continue; // don't clip against owner
|
||||||
}
|
}
|
||||||
|
|
||||||
if((int32_t)ED_FLOAT(touch, ED_flags) & FL_MONSTER)
|
if((int32_t)ED_Float(touch, ED_flags) & FL_MONSTER)
|
||||||
trace = SV_ClipMoveToEntity(touch, clip->start, clip->mins2, clip->maxs2, clip->end);
|
trace = SV_ClipMoveToEntity(touch, clip->start, clip->mins2, clip->maxs2, clip->end);
|
||||||
else
|
else
|
||||||
trace = SV_ClipMoveToEntity(touch, clip->start, clip->mins, clip->maxs, clip->end);
|
trace = SV_ClipMoveToEntity(touch, clip->start, clip->mins, clip->maxs, clip->end);
|
||||||
|
|
|
@ -57,7 +57,7 @@ void SV_UnlinkEdict(edict_t *ent);
|
||||||
void SV_LinkEdict(edict_t *ent, bool touch_triggers);
|
void SV_LinkEdict(edict_t *ent, bool touch_triggers);
|
||||||
// Needs to be called any time an entity changes origin, mins, maxs, or solid
|
// Needs to be called any time an entity changes origin, mins, maxs, or solid
|
||||||
// flags ent->v.modified
|
// flags ent->v.modified
|
||||||
// sets ED_VECTOR(ent, ED_absmin) and ED_VECTOR(ent, ED_absmax)
|
// sets ED_Vector(ent, ED_absmin) and ED_Vector(ent, ED_absmax)
|
||||||
// if touchtriggers, calls prog functions for the intersected triggers
|
// if touchtriggers, calls prog functions for the intersected triggers
|
||||||
|
|
||||||
int32_t SV_PointContents(vec3_t p);
|
int32_t SV_PointContents(vec3_t p);
|
||||||
|
|
|
@ -438,7 +438,7 @@ void *Hunk_AllocName(int32_t size, const char *name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(size < 0)
|
if(size < 0)
|
||||||
Sys_Error("Hunk_AllocName: bad size: %" PRIi32 "", size);
|
Sys_Error("Hunk_AllocName: bad size: %" PRIi32, size);
|
||||||
|
|
||||||
size = sizeof(hunk_t) + ((size + 15) & ~15);
|
size = sizeof(hunk_t) + ((size + 15) & ~15);
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ int32_t Hunk_LowMark(void)
|
||||||
void Hunk_FreeToLowMark(int32_t mark)
|
void Hunk_FreeToLowMark(int32_t mark)
|
||||||
{
|
{
|
||||||
if(mark < 0 || mark > hunk_low_used)
|
if(mark < 0 || mark > hunk_low_used)
|
||||||
Sys_Error("Hunk_FreeToLowMark: bad mark %" PRIi32 "", mark);
|
Sys_Error("Hunk_FreeToLowMark: bad mark %" PRIi32, mark);
|
||||||
memset(hunk_base + mark, 0, hunk_low_used - mark);
|
memset(hunk_base + mark, 0, hunk_low_used - mark);
|
||||||
hunk_low_used = mark;
|
hunk_low_used = mark;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ void Hunk_FreeToHighMark(int32_t mark)
|
||||||
Hunk_FreeToHighMark(hunk_tempmark);
|
Hunk_FreeToHighMark(hunk_tempmark);
|
||||||
}
|
}
|
||||||
if(mark < 0 || mark > hunk_high_used)
|
if(mark < 0 || mark > hunk_high_used)
|
||||||
Sys_Error("Hunk_FreeToHighMark: bad mark %" PRIi32 "", mark);
|
Sys_Error("Hunk_FreeToHighMark: bad mark %" PRIi32, mark);
|
||||||
memset(hunk_base + hunk_size - hunk_high_used, 0, hunk_high_used - mark);
|
memset(hunk_base + hunk_size - hunk_high_used, 0, hunk_high_used - mark);
|
||||||
hunk_high_used = mark;
|
hunk_high_used = mark;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ void *Hunk_HighAllocName(int32_t size, const char *name)
|
||||||
hunk_t *h;
|
hunk_t *h;
|
||||||
|
|
||||||
if(size < 0)
|
if(size < 0)
|
||||||
Sys_Error("Hunk_HighAllocName: bad size: %" PRIi32 "", size);
|
Sys_Error("Hunk_HighAllocName: bad size: %" PRIi32, size);
|
||||||
|
|
||||||
if(hunk_tempactive)
|
if(hunk_tempactive)
|
||||||
{
|
{
|
||||||
|
@ -909,7 +909,7 @@ void *Cache_Alloc(cache_user_t *c, int32_t size, const char *name)
|
||||||
Sys_Error("Cache_Alloc: allready allocated");
|
Sys_Error("Cache_Alloc: allready allocated");
|
||||||
|
|
||||||
if(size <= 0)
|
if(size <= 0)
|
||||||
Sys_Error("Cache_Alloc: size %" PRIi32 "", size);
|
Sys_Error("Cache_Alloc: size %" PRIi32, size);
|
||||||
|
|
||||||
size = (size + sizeof(cache_system_t) + 15) & ~15;
|
size = (size + sizeof(cache_system_t) + 15) & ~15;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue