2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

Use defines ID of the models, refactoring

This commit is contained in:
s1lentq 2016-11-22 06:42:32 +07:00
parent 5c1be6a61d
commit 4bd4ab6724
20 changed files with 2788 additions and 2765 deletions

View File

@ -33,7 +33,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
Bugfixed version of rehlds contains an additional cvars:
<ul>
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
<li>syserror_logfile <filename> // File for the system error log. Default: rehlds_error.log
<li>syserror_logfile <filename> // File for the system error log. Default: sys_error.log
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an uncknown command. Default: 0

View File

@ -2280,7 +2280,7 @@ qboolean COM_SetupDirectories(void)
void COM_CheckPrintMap(dheader_t *header, const char *mapname, qboolean bShowOutdated)
{
if (header->version == BSPVERSION)
if (header->version == HLBSP_VERSION)
{
if (!bShowOutdated)
{

View File

@ -226,9 +226,9 @@ int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName)
return 0;
}
i = LittleLong(header.version);
if (i != BSPVERSION)
if (i != HLBSP_VERSION)
{
Con_Printf("Map [%s] has incorrect BSP version (%i should be %i).\n", pszFileName, i, BSPVERSION);
Con_Printf("Map [%s] has incorrect BSP version (%i should be %i).\n", pszFileName, i, HLBSP_VERSION);
FS_Close(fp);
return 0;
}

View File

@ -37,16 +37,7 @@
#include "wad.h"
#define MAX_DECALS 512
/*
* extradata size to has difference between swds.dll and hw.dll
* offset to how difference size between them (24 ~ 32) | (64 ~ 72)
*/
#ifdef SWDS
#define OFFSET_DATAEXTRA_SIZE 0
#else
#define OFFSET_DATAEXTRA_SIZE 8
#endif
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
typedef struct decalname_s
{

View File

@ -179,7 +179,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
u_short nSize;
byte *pal;
if (wad->cacheExtra != 24 + OFFSET_DATAEXTRA_SIZE)
if (wad->cacheExtra != DECAL_EXTRASIZE)
Sys_Error("Draw_MiptexTexture: Bad cached wad %s\n", wad->name);
tex = (texture_t *)data;
@ -545,7 +545,7 @@ void Decal_Init(void)
Q_memset(decal_wad_temp, 0, sizeof(cachewad_t));
Draw_CacheWadInitFromFile(hfile, filesize, "decals.wad", MAX_DECALS, decal_wad_temp);
Draw_CacheWadHandler(decal_wad_temp, Draw_MiptexTexture, 24 + OFFSET_DATAEXTRA_SIZE);
Draw_CacheWadHandler(decal_wad_temp, Draw_MiptexTexture, DECAL_EXTRASIZE);
Decal_MergeInDecals(decal_wad_temp, pszPathID[i]);
FS_Close(hfile);
}
@ -584,7 +584,7 @@ qboolean CustomDecal_Init(struct cachewad_s *wad, void *raw, int nFileSize, int
qboolean bret = Draw_CustomCacheWadInit(16, wad, raw, nFileSize);
if (bret)
{
Draw_CacheWadHandler(wad, Draw_MiptexTexture, 24 + OFFSET_DATAEXTRA_SIZE);
Draw_CacheWadHandler(wad, Draw_MiptexTexture, DECAL_EXTRASIZE);
for (int i = 0; i < wad->lumpCount; i++)
Draw_CacheByIndex(wad, i, playernum);
}
@ -707,9 +707,10 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
int pixoffset;
int paloffset;
int palettesize;
int nPalleteCount;
int nSize;
if (wad->cacheExtra != 24 + OFFSET_DATAEXTRA_SIZE)
if (wad->cacheExtra != DECAL_EXTRASIZE)
{
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
return FALSE;
@ -734,7 +735,7 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6);
paloffset = (pix>>2) + tmp.offsets[0] + pix;
palettesize = (pix>>4) + paloffset;
nSize = *(u_short *)&data[pixoffset + 64 + OFFSET_DATAEXTRA_SIZE];
nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t));
if (!tex.width || tex.width > 256 || tex.height > 256
|| (tmp.offsets[0] + pix != tmp.offsets[1])
@ -743,17 +744,20 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
return FALSE;
}
if (nSize > 256)
if (nPalleteCount > 256)
{
Con_Printf(__FUNCTION__ ": Bad cached wad palette size %i on %s\n", nSize, wad->name);
Con_Printf(__FUNCTION__ ": Bad cached wad palette size %i on %s\n", nPalleteCount, wad->name);
return FALSE;
}
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nSize + 2;
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2;
if (nSize > lump->disksize)
{
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
return FALSE;
}
return TRUE;
}

View File

@ -866,8 +866,6 @@ void Host_CheckConnectionFailure(void)
void _Host_Frame(float time)
{
static double host_times[6];
if (setjmp(host_enddemo))
return;

View File

@ -34,8 +34,12 @@
#include "maintypes.h"
#include "studio_rehlds.h"
#include "commonmacros.h"
#define STUDIO_VERSION 10
// header
#define STUDIO_VERSION 10
#define IDSTUDIOHEADER MAKEID('I', 'D', 'S', 'T') // little-endian "IDST"
#define IDSEQGRPHEADER MAKEID('I', 'D', 'S', 'Q') // little-endian "IDSQ"
#ifdef HOOK_ENGINE
//#define giTextureSize (*pgiTextureSize)

View File

@ -552,9 +552,9 @@ NOBODY void InterpolateAngles(float *start, float *end, float *output, float fra
// float ang1; // 429
// float ang2; // 429
// float d; // 430
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 432
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 433
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 453
// NormalizeAngles(float *angles); // 432
// NormalizeAngles(float *angles); // 433
// NormalizeAngles(float *angles); // 453
//}
void VectorTransform(const vec_t *in1, float *in2, vec_t *out)

View File

@ -40,7 +40,7 @@ cachewad_t ad_wad;
mod_known_info_t mod_known_info[MAX_KNOWN_MODELS];
// values for model_t's needload
#define NL_PRESENT 0
#define NL_PRESENT 0
#define NL_NEEDS_LOADED 1
#define NL_UNREFERENCED 2
@ -83,9 +83,9 @@ void* EXT_FUNC Mod_Extradata(model_t *mod)
mleaf_t *Mod_PointInLeaf(vec_t *p, model_t *model)
{
mnode_t *node; // 192
float d; // 193
mplane_t *plane; // 194
mnode_t *node;
float d;
mplane_t *plane;
if (!model || !model->nodes)
Sys_Error(__FUNCTION__ ": bad model");
@ -279,6 +279,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
mod->name[sizeof(mod->name) - 1] = '\0';
}
// load the file
buf = COM_LoadFileForMe(mod->name, &length);
if (!buf)
{
@ -322,23 +323,27 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
if (developer.value > 1.0)
Con_DPrintf("loading %s\n", mod->name);
// allocate a new model
COM_FileBase(mod->name, loadname);
loadmodel = mod;
mod->needload = NL_PRESENT;
// call the apropriate loader
switch (LittleLong(*(uint32 *)buf))
{
case 'OPDI':
Sys_Error(__FUNCTION__ "Alias models are not supported");
case IDPOLYHEADER:
// old-format of the model from the quake1
Mod_LoadAliasModel(mod, buf);
break;
case 'PSDI':
Mod_LoadSpriteModel(mod, (dsprite_t *)buf);
case IDSPRITEHEADER:
Mod_LoadSpriteModel(mod, buf);
break;
case 'TSDI':
Mod_LoadStudioModel(mod, (studiohdr_t *)buf);
case IDSTUDIOHEADER:
Mod_LoadStudioModel(mod, buf);
break;
default:
Mod_LoadBrushModel(mod, (dheader_t *)buf);
Mod_LoadBrushModel(mod, buf);
break;
}
@ -346,7 +351,6 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
g_modfuncs.m_pfnModelLoad(mod, buf);
Mem_Free(buf);
return mod;
}
@ -382,12 +386,9 @@ void Mod_AdInit(void)
Q_snprintf(filename, MAX_PATH, "%s", s);
if (FS_FileSize(filename) > 0)
{
Sys_Error("Mod_Init(): reverse me");
/*
Draw_CacheWadInit(filename, 16, &ad_wad);
sub_1D34290(&ad_wad, (void(__cdecl *)(cachewad_t *, unsigned __int8 *))sub_1D3A830, 24);
Draw_CacheWadHandler(&ad_wad, Draw_MiptexTexture, DECAL_EXTRASIZE);
ad_enabled = 1;
*/
}
else
{
@ -399,11 +400,33 @@ void Mod_AdInit(void)
void Mod_AdSwap(texture_t *src, int pixels, int entries)
{
// int j; // 623
// unsigned char *mippal; // 624
// short unsigned int *texpal; // 625
// texture_t *tex; // 626
Sys_Error(__FUNCTION__ ": Reverse me");
if (!tested)
return;
int j;
uint8 *mippal;
uint16 *texpal;
texture_t *tex;
tex = (texture_t *)Draw_CacheGet(&ad_wad, Draw_CacheIndex(&ad_wad, "img"));
if (!tex)
return;
Q_memcpy(src + 1, tex + 1, pixels);
mippal = (uint8 *)&tex[1] + pixels + 2;
texpal = (uint16 *)((char *)&src[1] + pixels + 2);
for (int j = 0; j < entries; j++)
{
texpal[0] = mippal[2];
texpal[1] = mippal[1];
texpal[2] = mippal[0];
texpal[3] = 0;
texpal++;
mippal++;
}
}
void Mod_LoadTextures(lump_t *l)
@ -1222,38 +1245,42 @@ void Mod_LoadBrushModel(model_t *mod, void *buffer)
void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
{
dmodel_t *bm;
model_t *submodel;
char name[10];
dheader_t *header = (dheader_t *)buffer;
dheader_t *header;
int i;
loadmodel->type = mod_brush;
i = LittleLong(header->version);
header = (dheader_t *)buffer;
if (i != 29 && i != 30)
Sys_Error("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod, i, 30);
mod_base = (unsigned char*) buffer;
i = LittleLong(header->version);
if (i != Q1BSP_VERSION && i != HLBSP_VERSION)
Sys_Error("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod, i, HLBSP_VERSION);
// swap all the lumps
mod_base = (byte *)header;
for (i = 0; i < sizeof(dheader_t) / 4; i++)
((int *)header)[i] = LittleLong(((int *)header)[i]);
Mod_LoadVertexes(&header->lumps[3]);
Mod_LoadEdges(&header->lumps[12]);
Mod_LoadSurfedges(&header->lumps[13]);
if (Q_stricmp(com_gamedir, "bshift"))
// load into heap
Mod_LoadVertexes(&header->lumps[LUMP_VERTEXES]);
Mod_LoadEdges(&header->lumps[LUMP_EDGES]);
Mod_LoadSurfedges(&header->lumps[LUMP_SURFEDGES]);
if (Q_stricmp(com_gamedir, "bshift") == 0)
{
Mod_LoadEntities(&header->lumps[LUMP_ENTITIES + 1]);
Mod_LoadTextures(&header->lumps[LUMP_TEXTURES]);
Mod_LoadLighting(&header->lumps[LUMP_LIGHTING]);
Mod_LoadPlanes(&header->lumps[LUMP_PLANES - 1]);
}
else
{
Mod_LoadEntities(&header->lumps[LUMP_ENTITIES]);
Mod_LoadTextures(&header->lumps[LUMP_TEXTURES]);
Mod_LoadLighting(&header->lumps[LUMP_LIGHTING]);
Mod_LoadPlanes(&header->lumps[LUMP_PLANES]);
}
else
{
Mod_LoadEntities(&header->lumps[LUMP_PLANES]);
Mod_LoadTextures(&header->lumps[LUMP_TEXTURES]);
Mod_LoadLighting(&header->lumps[LUMP_LIGHTING]);
Mod_LoadPlanes(&header->lumps[LUMP_ENTITIES]);
}
Mod_LoadTexinfo(&header->lumps[LUMP_TEXINFO]);
Mod_LoadFaces(&header->lumps[LUMP_FACES]);
Mod_LoadMarksurfaces(&header->lumps[LUMP_MARKSURFACES]);
@ -1263,13 +1290,16 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
Mod_LoadClipnodes(&header->lumps[LUMP_CLIPNODES]);
Mod_LoadSubmodels(&header->lumps[LUMP_MODELS]);
Mod_MakeHull0();
// regular and alternate animation
mod->numframes = 2;
mod->flags = 0;
i = 0;
// set up the submodels (FIXME: this is confusing)
for (i = 0; i < mod->numsubmodels; i++)
{
bm = &mod->submodels[i];
mod->hulls[0].firstclipnode = bm->headnode[0];
for (int j = 1; j < MAX_MAP_HULLS; j++)
{
@ -1283,6 +1313,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
mod->maxs[0] = bm->maxs[0];
mod->maxs[2] = bm->maxs[2];
mod->maxs[1] = bm->maxs[1];
mod->mins[0] = bm->mins[0];
mod->mins[1] = bm->mins[1];
mod->mins[2] = bm->mins[2];
@ -1292,18 +1323,20 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
if (i < mod->numsubmodels - 1)
{
Q_snprintf(name, 10, "*%i", i + 1);
submodel = Mod_FindName(0, name);
*submodel = *mod;
loadmodel = submodel;
Q_strncpy(submodel->name, name, 0x3Fu);
char name[10];
Q_snprintf(name, ARRAYSIZE(name), "*%i", i + 1);
loadmodel = Mod_FindName(0, name);
*loadmodel = *mod;
Q_strncpy(loadmodel->name, name, sizeof(loadmodel->name) - 1);
loadmodel->name[sizeof(loadmodel->name) - 1] = 0;
mod = loadmodel;
loadmodel->name[63] = 0;
}
}
}
NOXREF void *Mod_LoadAliasFrame(void *pin, int *pframeindex, int numv, trivertx_t *pbboxmin, trivertx_t *pbboxmax, aliashdr_t *pheader, char *name)
void *Mod_LoadAliasFrame(void *pin, int *pframeindex, int numv, trivertx_t *pbboxmin, trivertx_t *pbboxmax, aliashdr_t *pheader, char *name)
{
trivertx_t *pframe;
trivertx_t *pinframe;
@ -1333,10 +1366,11 @@ NOXREF void *Mod_LoadAliasFrame(void *pin, int *pframeindex, int numv, trivertx_
for (int k = 0; k < 3; k++)
pframe[j].v[k] = pinframe[j].v[k];
}
return (void *)&pinframe[numv];
}
NOXREF void *Mod_LoadAliasGroup(void *pin, int *pframeindex, int numv, trivertx_t *pbboxmin, trivertx_t *pbboxmax, aliashdr_t *pheader, char *name)
void *Mod_LoadAliasGroup(void *pin, int *pframeindex, int numv, trivertx_t *pbboxmin, trivertx_t *pbboxmax, aliashdr_t *pheader, char *name)
{
daliasgroup_t *pingroup;
maliasgroup_t *paliasgroup;
@ -1352,7 +1386,7 @@ NOXREF void *Mod_LoadAliasGroup(void *pin, int *pframeindex, int numv, trivertx_
paliasgroup = (maliasgroup_t *)Hunk_AllocName(sizeof(paliasgroup->frames[0]) * (numframes - 1) + sizeof(maliasgroup_t), loadname);
paliasgroup->numframes = numframes;
for(i = 0; i < 3; i++)
for (i = 0; i < 3; i++)
{
pbboxmin->v[i] = pingroup->bboxmin.v[i];
pbboxmax->v[i] = pingroup->bboxmax.v[i];
@ -1376,17 +1410,16 @@ NOXREF void *Mod_LoadAliasGroup(void *pin, int *pframeindex, int numv, trivertx_
}
ptemp = (void *)pin_intervals;
for(i = 0; i < numframes; i++)
for (i = 0; i < numframes; i++)
ptemp = Mod_LoadAliasFrame(ptemp, &paliasgroup->frames[i].frame, numv, &paliasgroup->frames[i].bboxmin, &paliasgroup->frames[i].bboxmax, pheader, name);
return ptemp;
}
NOXREF void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashdr_t *pheader)
void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashdr_t *pheader)
{
unsigned char *pskin;
unsigned char *pinskin;
//unsigned short *pusskin;
pskin = (unsigned char *)Hunk_AllocName(skinsize * r_pixbytes, loadname);
pinskin = (unsigned char *)pin;
@ -1401,7 +1434,7 @@ NOXREF void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashd
return (void *)&pinskin[skinsize];
}
NOXREF void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, aliashdr_t *pheader)
void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, aliashdr_t *pheader)
{
daliasskingroup_t *pinskingroup;
maliasskingroup_t *paliasskingroup;
@ -1421,11 +1454,11 @@ NOXREF void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, al
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
for(i = 0; i < numskins; i++)
for (i = 0; i < numskins; i++)
{
*poutskinintervals = LittleFloat(pinskinintervals->interval);
if(*poutskinintervals <= 0.0f)
if (*poutskinintervals <= 0.0f)
Sys_Error(__FUNCTION__ ": interval<=0");
poutskinintervals++;
@ -1434,13 +1467,13 @@ NOXREF void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, al
ptemp = (void *)pinskinintervals;
for(i = 0; i < numskins; i++)
for (i = 0; i < numskins; i++)
ptemp = Mod_LoadAliasSkin(ptemp, &paliasskingroup->skindescs[i].skin, skinsize, pheader);
return ptemp;
}
NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
void Mod_LoadAliasModel(model_t *mod, void *buffer)
{
int i;
mdl_t *pmodel;
@ -1469,34 +1502,37 @@ NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
if (version != ALIAS_MODEL_VERSION)
Sys_Error("%s has wrong version number (%i should be %i)", mod->name, version, ALIAS_MODEL_VERSION);
// allocate space for a working header, plus all the data except the frames,
// skin and group info
size = sizeof(mtriangle_t) * LittleLong(pinmodel->numtris) +
sizeof(stvert_t) * LittleLong(pinmodel->numverts) +
sizeof(mdl_t) + sizeof(aliashdr_t) +
sizeof(pheader->frames[0]) * (LittleLong(pinmodel->numframes) - 1);
pheader = (aliashdr_t *)Hunk_AllocName(size, loadname);
pmodel = (mdl_t *)&pheader->frames[LittleLong(pinmodel->numframes)];
pmodel = (mdl_t *)(pheader->frames + LittleLong(pinmodel->numframes));
mod->flags = LittleLong(pinmodel->flags);
// endian-adjust and copy the data, starting with the alias model header
pmodel->boundingradius = LittleFloat(pinmodel->boundingradius);
pmodel->numskins = LittleLong(pinmodel->numskins);
pmodel->skinwidth = LittleLong(pinmodel->skinwidth);
pmodel->skinheight = LittleLong(pinmodel->skinheight);
if (pmodel->skinheight > 480)
Sys_Error("model %s has a skin taller than %d", mod->name, 480);
if (pmodel->skinheight > MAX_LBM_HEIGHT)
Sys_Error("model %s has a skin taller than %d", mod->name, MAX_LBM_HEIGHT);
pmodel->numverts = LittleLong(pinmodel->numverts);
if (pmodel->numverts < 1)
if (pmodel->numverts <= 0)
Sys_Error("model %s has no vertices", mod->name);
if (pmodel->numverts > 2000)
if (pmodel->numverts > MAX_ALIAS_MODEL_VERTS)
Sys_Error("model %s has too many vertices", mod->name);
pmodel->numtris = LittleLong(pinmodel->numtris);
if (pmodel->numtris < 1)
if (pmodel->numtris <= 0)
Sys_Error("model %s has no triangles", mod->name);
pmodel->numframes = LittleLong(pinmodel->numframes);
@ -1515,83 +1551,84 @@ NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
numskins = pmodel->numskins;
numframes = pmodel->numframes;
if (pmodel->skinwidth & 3)
if ((pmodel->skinwidth % 4) != 0)
Sys_Error(__FUNCTION__ ": skinwidth not multiple of 4");
pheader->model = (byte *)pmodel - (byte *)pheader;
// load the skins
skinsize = pmodel->skinwidth * pmodel->skinheight;
if (numskins < 1)
Sys_Error(__FUNCTION__ ": Invalid # of skins: %d\n", numskins);
pskintype = (daliasskintype_t *)&pinmodel[1];
pskintype = (daliasskintype_t *)(pinmodel + 1);
pskindesc = (maliasskindesc_t *)Hunk_AllocName(sizeof(maliasskindesc_t) * numskins, loadname);
pheader->skindesc = (byte *)pskintype - (byte *)pheader;
for(i = 0; i < numskins; i++)
for (i = 0; i < numskins; i++)
{
aliasskintype_t skintype = (aliasskintype_t)LittleLong(pskintype->type);
pskindesc[i].type = skintype;
if(skintype == ALIAS_SKIN_SINGLE)
pskintype = (daliasskintype_t *)Mod_LoadAliasSkin(&pskintype[1], &pskindesc[i].skin, skinsize, pheader);
if (skintype == ALIAS_SKIN_SINGLE)
pskintype = (daliasskintype_t *)Mod_LoadAliasSkin(pskintype + 1, &pskindesc[i].skin, skinsize, pheader);
else
pskintype = (daliasskintype_t *)Mod_LoadAliasSkinGroup(&pskintype[1], &pskindesc[i].skin, skinsize, pheader);
pskintype = (daliasskintype_t *)Mod_LoadAliasSkinGroup(pskintype + 1, &pskindesc[i].skin, skinsize, pheader);
}
pstverts = (stvert_t *)&pmodel[1];
// set base s and t vertices
pstverts = (stvert_t *)(pmodel + 1);
pinstverts = (stvert_t *)pskintype;
pheader->stverts = (byte *)pstverts - (byte *)pheader;
for(i = 0; i < pmodel->numverts; i++)
for (i = 0; i < pmodel->numverts; i++)
{
pstverts[i].onseam = LittleLong(pinstverts[i].onseam);
// put s and t in 16.16 format
pstverts[i].s = (LittleLong(pinstverts[i].s) << 16);
pstverts[i].t = (LittleLong(pinstverts[i].t) << 16);
}
ptri = (mtriangle_t *)&pstverts[pmodel->numverts];
pintriangles = (dtriangle_t *)&pinstverts[pmodel->numverts];
// set up the triangles
ptri = (mtriangle_t *)(pstverts + pmodel->numverts);
pintriangles = (dtriangle_t *)(pinstverts + pmodel->numverts);
pheader->triangles = (byte *)ptri - (byte *)pheader;
for(i = 0; i < pmodel->numtris; i++)
for (i = 0; i < pmodel->numtris; i++)
{
ptri[i].facesfront = LittleLong(pintriangles[i].facesfront);
for(int j = 0; j < 3; j++)
for (int j = 0; j < 3; j++)
ptri[i].vertindex[j] = LittleLong(pintriangles[i].vertindex[j]);
}
if(numframes < 1)
// load the frames
if (numframes < 1)
Sys_Error(__FUNCTION__ ": Invalid # of frames: %d\n", numframes);
pframetype = (daliasframetype_t *)&pintriangles[pmodel->numtris];
for(i = 0; i < numframes; i++)
pframetype = (daliasframetype_t *)(pintriangles + pmodel->numtris);
for (i = 0; i < numframes; i++)
{
aliasframetype_t frametype = (aliasframetype_t)LittleLong(pframetype->type);
pheader->frames[i].type = frametype;
if(frametype == ALIAS_SINGLE)
pframetype = (daliasframetype_t *)Mod_LoadAliasFrame(&pframetype[1], &pheader->frames[i].frame, pmodel->numverts, &pheader->frames[i].bboxmin, &pheader->frames[i].bboxmax, pheader, pheader->frames[i].name);
if (frametype == ALIAS_SINGLE)
pframetype = (daliasframetype_t *)Mod_LoadAliasFrame(pframetype + 1, &pheader->frames[i].frame, pmodel->numverts, &pheader->frames[i].bboxmin, &pheader->frames[i].bboxmax, pheader, pheader->frames[i].name);
else
pframetype = (daliasframetype_t *)Mod_LoadAliasGroup(&pframetype[1], &pheader->frames[i].frame, pmodel->numverts, &pheader->frames[i].bboxmin, &pheader->frames[i].bboxmax, pheader, pheader->frames[i].name);
pframetype = (daliasframetype_t *)Mod_LoadAliasGroup(pframetype + 1, &pheader->frames[i].frame, pmodel->numverts, &pheader->frames[i].bboxmin, &pheader->frames[i].bboxmax, pheader, pheader->frames[i].name);
}
mod->type = mod_alias;
mod->mins[0] = -16.0f;
mod->mins[1] = -16.0f;
mod->mins[2] = -16.0f;
mod->maxs[0] = 16.0f;
mod->maxs[1] = 16.0f;
mod->maxs[2] = 16.0f;
const int dada = sizeof(color24);
// FIXME: do this right
mod->mins[0] = mod->mins[1] = mod->mins[2] = -16.0f;
mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 16.0f;
PackedColorVec *pPal = (PackedColorVec *)Hunk_AllocName(sizeof(PackedColorVec) * 256, loadname);
color24 *pPalSrc = (color24 *)&pframetype[0];
color24 *pPalSrc = (color24 *)pframetype;
for (i = 0; i < 256; i++)
{
@ -1604,11 +1641,13 @@ NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
}
pheader->palette = (byte *)pPal - (byte *)pheader;
// move the complete, relocatable alias model to the cache
end = Hunk_LowMark();
total = end - start;
Cache_Alloc(&mod->cache, total, loadname);
if(mod->cache.data)
if (mod->cache.data)
{
Q_memcpy(mod->cache.data, pheader, total);
Hunk_FreeToLowMark(start);

View File

@ -28,7 +28,6 @@
#include "precompiled.h"
// TODO: Implement security module
cl_enginefunc_dst_t *pg_engdstAddrs;

View File

@ -28,9 +28,7 @@
#include "precompiled.h"
int net_drop;
char gDownloadFile[256];
/*
@ -692,41 +690,6 @@ qboolean Netchan_Validate(netchan_t *chan, qboolean *frag_message, unsigned int
qboolean Netchan_Process(netchan_t *chan)
{
// int i; // 874
// unsigned int sequence; // 875
// unsigned int sequence_ack; // 875
// unsigned int reliable_ack; // 876
// unsigned int reliable_message; // 876
// unsigned int fragid; // 877
// qboolean frag_message; // 878
// int frag_offset; // 879
// int frag_length; // 880
// qboolean message_contains_fragments; // 881
// Netchan_Validate(netchan_t *chan,
// qboolean *frag_message,
// unsigned int *fragid,
// int *frag_offset,
// int *frag_length); /* size=0, low_pc=0 */ // 933
// {
// char c; // 946
// int mask; // 947
// }
// {
// int j; // 1038
// unsigned char *src; // 1039
// unsigned char *dst; // 1039
// int len; // 1040
// fragbuf_t *pbuf; // 1041
// int inbufferid; // 1042
// int intotalbuffers; // 1043
// Netchan_FindBufferById(fragbuf_t **pplist,
// int id,
// qboolean allocate); /* size=0, low_pc=0 */ // 1053
// {
// int nbytes; // 1056
// }
// }
int i;
unsigned int sequence, sequence_ack;
unsigned int reliable_ack, reliable_message;
@ -1449,7 +1412,7 @@ void Netchan_FlushIncoming(netchan_t *chan, int stream)
n = p->next;
Mem_Free(p);
p = n;
};
}
chan->incomingbufs[stream] = nullptr;
chan->incomingready[stream] = FALSE;
@ -1626,7 +1589,7 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
if (p == chan->incomingbufs[FRAG_FILE_STREAM])
nsize -= msg_readcount;
p = p->next;
};
}
buffer = (unsigned char*)Mem_ZeroMalloc(nsize + 1);
if (!buffer)
@ -1737,7 +1700,7 @@ NOXREF qboolean Netchan_IsSending(netchan_t *chan)
int i;
for (i = 0; i < MAX_STREAMS; i++)
{
if(chan->fragbufs[i])
if (chan->fragbufs[i])
return TRUE;
}
return FALSE;
@ -1748,7 +1711,7 @@ NOXREF qboolean Netchan_IsReceiving(netchan_t *chan)
int i;
for (i = 0; i < MAX_STREAMS; i++)
{
if(chan->incomingbufs[i])
if (chan->incomingbufs[i])
return TRUE;
}
return FALSE;

View File

@ -981,7 +981,6 @@ int EXT_FUNC iGetIndex(const char *pszField)
IGETINDEX_CHECK_FIELD(globalname);
return -1;
}
edict_t* EXT_FUNC FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
@ -1064,7 +1063,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
for (i = 0; i < HL_SOUND_MAX; i++)
{
if (g_psv.sound_precache[i] && !Q_stricmp(g_psv.sound_precache[i], s))
return i;
return i;
}
Host_Error("PF_precache_sound_I: '%s' Precache can only be done in spawn functions", s);

View File

@ -672,7 +672,7 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an
// const unsigned char *pblending,
// model_t *pModel,
// hull_t *pHulls,
// int numhulls); /* size=0, low_pc=0 */ // 917
// int numhulls);
}
return &studio_hull[0];
@ -1129,10 +1129,10 @@ int R_GetStudioBounds(const char *filename, float *mins, float *maxs)
if (pBuffer)
{
if (LittleLong(*(unsigned int *)pBuffer) == 'TSDI')
if (LittleLong(*(unsigned int *)pBuffer) == IDSTUDIOHEADER)
iret = R_StudioComputeBounds((unsigned char*)pBuffer, mins, maxs);
#ifndef REHLDS_FIXES
//wrong release memory code
// wrong release memory code
else
COM_FreeFile(pBuffer);
#endif

View File

@ -303,7 +303,7 @@ cvar_t sv_auto_precache_sounds_in_models = { "sv_auto_precache_sounds_in_models"
cvar_t sv_delayed_spray_upload = { "sv_delayed_spray_upload", "0", 0, 0.0f, nullptr };
cvar_t sv_rehlds_force_dlmax = { "sv_rehlds_force_dlmax", "0", 0, 0.0f, nullptr };
cvar_t listipcfgfile = { "listipcfgfile", "listip.cfg", 0, 0.0f, nullptr };
cvar_t syserror_logfile = { "syserror_logfile", "rehlds_error.log", 0, 0.0f, nullptr };
cvar_t syserror_logfile = { "syserror_logfile", "sys_error.log", 0, 0.0f, nullptr };
cvar_t sv_rehlds_hull_centering = { "sv_rehlds_hull_centering", "0", 0, 0.0f, nullptr };
cvar_t sv_rcon_condebug = { "sv_rcon_condebug", "1", 0, 1.0f, nullptr };
cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted_fields", "", 0, 0.0f, nullptr };
@ -5695,6 +5695,7 @@ void SV_ServerShutdown(void)
gEntityInterface.pfnServerDeactivate();
}
}
int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
{
client_t *cl;

View File

@ -386,7 +386,7 @@ NOBODY int glob_match(char *pattern, char *text);
// }
// }
// glob_match_after_star(char *pattern,
// char *text); /* size=0, low_pc=0 */ // 343
// char *text); // 343
//}
NOXREF void Sys_MakeCodeWriteable(uint32 startaddr, uint32 length)
@ -742,11 +742,11 @@ NOBODY const char *ConvertNameToLocalPlatform(const char *pchInName);
// char *pchClassName; // 1465
// char *pchFunctionName; // 1466
// FindNameInTable(extensiondll_t *pDll,
// const char *pName); /* size=0, low_pc=0 */ // 1483
// const char *pName); / // 1483
// FindNameInTable(extensiondll_t *pDll,
// const char *pName); /* size=0, low_pc=0 */ // 1487
// const char *pName); // 1487
// FindNameInTable(extensiondll_t *pDll,
// const char *pName); /* size=0, low_pc=0 */ // 1491
// const char *pName); // 1491
// }
//}

File diff suppressed because it is too large Load Diff

View File

@ -27,39 +27,42 @@
*/
#pragma once
#define BSPVERSION 30
// header
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
#define HLBSP_VERSION 30 // half-life regular version
#define MAX_MAP_HULLS 4
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define LUMP_ENTITIES 0
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14
#define HEADER_LUMPS 15
#define HEADER_LUMPS 15
typedef struct lump_s
typedef struct lump_s
{
int fileofs;
int filelen;

View File

@ -33,14 +33,21 @@
#include "bspfile.h"
#include "crc.h"
#include "com_model.h"
#include "commonmacros.h"
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
// header
#define ALIAS_MODEL_VERSION 0x006
#define IDPOLYHEADER MAKEID('I', 'D', 'P', 'O') // little-endian "IDPO"
#define MAX_LBM_HEIGHT 480
#define MAX_ALIAS_MODEL_VERTS 2000
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
#define ALIAS_MODEL_VERSION 0x006
#define SURF_DRAWBACKGROUND 0x40
#define MAX_MODEL_NAME 64
#define MIPLEVELS 4
@ -66,12 +73,24 @@ typedef struct texture_s
{
char name[16];
unsigned width, height;
#ifndef SWDS
int gl_texturenum;
struct msurface_s * texturechain;
#endif
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
#ifdef SWDS
unsigned paloffset;
#else
byte *pPal;
#endif
} texture_t;
typedef struct medge_s
@ -82,7 +101,7 @@ typedef struct medge_s
typedef struct mtexinfo_s
{
float vecs[2][4]; // [s/t] unit vectors in world space.
float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin.
// s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
float mipadjust; // ?? mipmap limits for very small surfaces
@ -284,7 +303,7 @@ typedef struct model_s
char name[MAX_MODEL_NAME];
int needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;

View File

@ -33,9 +33,10 @@
#endif
#include "modelgen.h"
#include "commonmacros.h"
#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I')
#define SPRITE_VERSION 2
#define SPRITE_VERSION 2 // Half-Life sprites
#define IDSPRITEHEADER MAKEID('I', 'D', 'S', 'P') // little-endian "IDSP"
typedef enum spriteframetype_e
{

View File

@ -11,6 +11,8 @@
#pragma once
#endif
#include "commonmacros.h"
#define SAVEFILE_HEADER MAKEID('V','A','L','V') // little-endian "VALV"
#define SAVEGAME_HEADER MAKEID('J','S','A','V') // little-endian "JSAV"
#define SAVEGAME_VERSION 0x0071 // Version 0.71