mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Use defines ID of the models, refactoring
This commit is contained in:
parent
5c1be6a61d
commit
4bd4ab6724
@ -33,7 +33,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
|||||||
Bugfixed version of rehlds contains an additional cvars:
|
Bugfixed version of rehlds contains an additional cvars:
|
||||||
<ul>
|
<ul>
|
||||||
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
|
<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_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_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
|
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an uncknown command. Default: 0
|
||||||
|
@ -2280,7 +2280,7 @@ qboolean COM_SetupDirectories(void)
|
|||||||
|
|
||||||
void COM_CheckPrintMap(dheader_t *header, const char *mapname, qboolean bShowOutdated)
|
void COM_CheckPrintMap(dheader_t *header, const char *mapname, qboolean bShowOutdated)
|
||||||
{
|
{
|
||||||
if (header->version == BSPVERSION)
|
if (header->version == HLBSP_VERSION)
|
||||||
{
|
{
|
||||||
if (!bShowOutdated)
|
if (!bShowOutdated)
|
||||||
{
|
{
|
||||||
|
@ -226,9 +226,9 @@ int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
i = LittleLong(header.version);
|
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);
|
FS_Close(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,7 @@
|
|||||||
#include "wad.h"
|
#include "wad.h"
|
||||||
|
|
||||||
#define MAX_DECALS 512
|
#define MAX_DECALS 512
|
||||||
|
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
typedef struct decalname_s
|
typedef struct decalname_s
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
|
|||||||
u_short nSize;
|
u_short nSize;
|
||||||
byte *pal;
|
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);
|
Sys_Error("Draw_MiptexTexture: Bad cached wad %s\n", wad->name);
|
||||||
|
|
||||||
tex = (texture_t *)data;
|
tex = (texture_t *)data;
|
||||||
@ -545,7 +545,7 @@ void Decal_Init(void)
|
|||||||
Q_memset(decal_wad_temp, 0, sizeof(cachewad_t));
|
Q_memset(decal_wad_temp, 0, sizeof(cachewad_t));
|
||||||
|
|
||||||
Draw_CacheWadInitFromFile(hfile, filesize, "decals.wad", MAX_DECALS, decal_wad_temp);
|
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]);
|
Decal_MergeInDecals(decal_wad_temp, pszPathID[i]);
|
||||||
FS_Close(hfile);
|
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);
|
qboolean bret = Draw_CustomCacheWadInit(16, wad, raw, nFileSize);
|
||||||
if (bret)
|
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++)
|
for (int i = 0; i < wad->lumpCount; i++)
|
||||||
Draw_CacheByIndex(wad, i, playernum);
|
Draw_CacheByIndex(wad, i, playernum);
|
||||||
}
|
}
|
||||||
@ -707,9 +707,10 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
|
|||||||
int pixoffset;
|
int pixoffset;
|
||||||
int paloffset;
|
int paloffset;
|
||||||
int palettesize;
|
int palettesize;
|
||||||
|
int nPalleteCount;
|
||||||
int nSize;
|
int nSize;
|
||||||
|
|
||||||
if (wad->cacheExtra != 24 + OFFSET_DATAEXTRA_SIZE)
|
if (wad->cacheExtra != DECAL_EXTRASIZE)
|
||||||
{
|
{
|
||||||
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
|
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -734,7 +735,7 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
|
|||||||
pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6);
|
pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6);
|
||||||
paloffset = (pix>>2) + tmp.offsets[0] + pix;
|
paloffset = (pix>>2) + tmp.offsets[0] + pix;
|
||||||
palettesize = (pix>>4) + paloffset;
|
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
|
if (!tex.width || tex.width > 256 || tex.height > 256
|
||||||
|| (tmp.offsets[0] + pix != tmp.offsets[1])
|
|| (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);
|
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
|
||||||
return FALSE;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nSize + 2;
|
|
||||||
|
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2;
|
||||||
if (nSize > lump->disksize)
|
if (nSize > lump->disksize)
|
||||||
{
|
{
|
||||||
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
|
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,8 +866,6 @@ void Host_CheckConnectionFailure(void)
|
|||||||
|
|
||||||
void _Host_Frame(float time)
|
void _Host_Frame(float time)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
static double host_times[6];
|
static double host_times[6];
|
||||||
if (setjmp(host_enddemo))
|
if (setjmp(host_enddemo))
|
||||||
return;
|
return;
|
||||||
|
@ -34,8 +34,12 @@
|
|||||||
|
|
||||||
#include "maintypes.h"
|
#include "maintypes.h"
|
||||||
#include "studio_rehlds.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
|
#ifdef HOOK_ENGINE
|
||||||
//#define giTextureSize (*pgiTextureSize)
|
//#define giTextureSize (*pgiTextureSize)
|
||||||
|
@ -552,9 +552,9 @@ NOBODY void InterpolateAngles(float *start, float *end, float *output, float fra
|
|||||||
// float ang1; // 429
|
// float ang1; // 429
|
||||||
// float ang2; // 429
|
// float ang2; // 429
|
||||||
// float d; // 430
|
// float d; // 430
|
||||||
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 432
|
// NormalizeAngles(float *angles); // 432
|
||||||
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 433
|
// NormalizeAngles(float *angles); // 433
|
||||||
// NormalizeAngles(float *angles); /* size=0, low_pc=0 */ // 453
|
// NormalizeAngles(float *angles); // 453
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void VectorTransform(const vec_t *in1, float *in2, vec_t *out)
|
void VectorTransform(const vec_t *in1, float *in2, vec_t *out)
|
||||||
|
@ -40,7 +40,7 @@ cachewad_t ad_wad;
|
|||||||
mod_known_info_t mod_known_info[MAX_KNOWN_MODELS];
|
mod_known_info_t mod_known_info[MAX_KNOWN_MODELS];
|
||||||
|
|
||||||
// values for model_t's needload
|
// values for model_t's needload
|
||||||
#define NL_PRESENT 0
|
#define NL_PRESENT 0
|
||||||
#define NL_NEEDS_LOADED 1
|
#define NL_NEEDS_LOADED 1
|
||||||
#define NL_UNREFERENCED 2
|
#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)
|
mleaf_t *Mod_PointInLeaf(vec_t *p, model_t *model)
|
||||||
{
|
{
|
||||||
mnode_t *node; // 192
|
mnode_t *node;
|
||||||
float d; // 193
|
float d;
|
||||||
mplane_t *plane; // 194
|
mplane_t *plane;
|
||||||
|
|
||||||
if (!model || !model->nodes)
|
if (!model || !model->nodes)
|
||||||
Sys_Error(__FUNCTION__ ": bad model");
|
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';
|
mod->name[sizeof(mod->name) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load the file
|
||||||
buf = COM_LoadFileForMe(mod->name, &length);
|
buf = COM_LoadFileForMe(mod->name, &length);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
@ -322,23 +323,27 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
|||||||
if (developer.value > 1.0)
|
if (developer.value > 1.0)
|
||||||
Con_DPrintf("loading %s\n", mod->name);
|
Con_DPrintf("loading %s\n", mod->name);
|
||||||
|
|
||||||
|
// allocate a new model
|
||||||
COM_FileBase(mod->name, loadname);
|
COM_FileBase(mod->name, loadname);
|
||||||
loadmodel = mod;
|
loadmodel = mod;
|
||||||
|
|
||||||
mod->needload = NL_PRESENT;
|
mod->needload = NL_PRESENT;
|
||||||
|
|
||||||
|
// call the apropriate loader
|
||||||
switch (LittleLong(*(uint32 *)buf))
|
switch (LittleLong(*(uint32 *)buf))
|
||||||
{
|
{
|
||||||
case 'OPDI':
|
case IDPOLYHEADER:
|
||||||
Sys_Error(__FUNCTION__ "Alias models are not supported");
|
// old-format of the model from the quake1
|
||||||
|
Mod_LoadAliasModel(mod, buf);
|
||||||
break;
|
break;
|
||||||
case 'PSDI':
|
case IDSPRITEHEADER:
|
||||||
Mod_LoadSpriteModel(mod, (dsprite_t *)buf);
|
Mod_LoadSpriteModel(mod, buf);
|
||||||
break;
|
break;
|
||||||
case 'TSDI':
|
case IDSTUDIOHEADER:
|
||||||
Mod_LoadStudioModel(mod, (studiohdr_t *)buf);
|
Mod_LoadStudioModel(mod, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Mod_LoadBrushModel(mod, (dheader_t *)buf);
|
Mod_LoadBrushModel(mod, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +351,6 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
|||||||
g_modfuncs.m_pfnModelLoad(mod, buf);
|
g_modfuncs.m_pfnModelLoad(mod, buf);
|
||||||
|
|
||||||
Mem_Free(buf);
|
Mem_Free(buf);
|
||||||
|
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,12 +386,9 @@ void Mod_AdInit(void)
|
|||||||
Q_snprintf(filename, MAX_PATH, "%s", s);
|
Q_snprintf(filename, MAX_PATH, "%s", s);
|
||||||
if (FS_FileSize(filename) > 0)
|
if (FS_FileSize(filename) > 0)
|
||||||
{
|
{
|
||||||
Sys_Error("Mod_Init(): reverse me");
|
|
||||||
/*
|
|
||||||
Draw_CacheWadInit(filename, 16, &ad_wad);
|
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;
|
ad_enabled = 1;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -399,11 +400,33 @@ void Mod_AdInit(void)
|
|||||||
|
|
||||||
void Mod_AdSwap(texture_t *src, int pixels, int entries)
|
void Mod_AdSwap(texture_t *src, int pixels, int entries)
|
||||||
{
|
{
|
||||||
// int j; // 623
|
if (!tested)
|
||||||
// unsigned char *mippal; // 624
|
return;
|
||||||
// short unsigned int *texpal; // 625
|
|
||||||
// texture_t *tex; // 626
|
int j;
|
||||||
Sys_Error(__FUNCTION__ ": Reverse me");
|
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)
|
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)
|
void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
|
||||||
{
|
{
|
||||||
dmodel_t *bm;
|
dmodel_t *bm;
|
||||||
model_t *submodel;
|
dheader_t *header;
|
||||||
char name[10];
|
|
||||||
dheader_t *header = (dheader_t *)buffer;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
loadmodel->type = mod_brush;
|
loadmodel->type = mod_brush;
|
||||||
i = LittleLong(header->version);
|
header = (dheader_t *)buffer;
|
||||||
|
|
||||||
if (i != 29 && i != 30)
|
i = LittleLong(header->version);
|
||||||
Sys_Error("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod, i, 30);
|
if (i != Q1BSP_VERSION && i != HLBSP_VERSION)
|
||||||
mod_base = (unsigned char*) buffer;
|
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++)
|
for (i = 0; i < sizeof(dheader_t) / 4; i++)
|
||||||
((int *)header)[i] = LittleLong(((int *)header)[i]);
|
((int *)header)[i] = LittleLong(((int *)header)[i]);
|
||||||
|
|
||||||
Mod_LoadVertexes(&header->lumps[3]);
|
// load into heap
|
||||||
Mod_LoadEdges(&header->lumps[12]);
|
Mod_LoadVertexes(&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadSurfedges(&header->lumps[13]);
|
Mod_LoadEdges(&header->lumps[LUMP_EDGES]);
|
||||||
if (Q_stricmp(com_gamedir, "bshift"))
|
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_LoadEntities(&header->lumps[LUMP_ENTITIES]);
|
||||||
Mod_LoadTextures(&header->lumps[LUMP_TEXTURES]);
|
Mod_LoadTextures(&header->lumps[LUMP_TEXTURES]);
|
||||||
Mod_LoadLighting(&header->lumps[LUMP_LIGHTING]);
|
Mod_LoadLighting(&header->lumps[LUMP_LIGHTING]);
|
||||||
Mod_LoadPlanes(&header->lumps[LUMP_PLANES]);
|
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_LoadTexinfo(&header->lumps[LUMP_TEXINFO]);
|
||||||
Mod_LoadFaces(&header->lumps[LUMP_FACES]);
|
Mod_LoadFaces(&header->lumps[LUMP_FACES]);
|
||||||
Mod_LoadMarksurfaces(&header->lumps[LUMP_MARKSURFACES]);
|
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_LoadClipnodes(&header->lumps[LUMP_CLIPNODES]);
|
||||||
Mod_LoadSubmodels(&header->lumps[LUMP_MODELS]);
|
Mod_LoadSubmodels(&header->lumps[LUMP_MODELS]);
|
||||||
Mod_MakeHull0();
|
Mod_MakeHull0();
|
||||||
|
|
||||||
|
// regular and alternate animation
|
||||||
mod->numframes = 2;
|
mod->numframes = 2;
|
||||||
mod->flags = 0;
|
mod->flags = 0;
|
||||||
i = 0;
|
|
||||||
|
// set up the submodels (FIXME: this is confusing)
|
||||||
for (i = 0; i < mod->numsubmodels; i++)
|
for (i = 0; i < mod->numsubmodels; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
bm = &mod->submodels[i];
|
bm = &mod->submodels[i];
|
||||||
|
|
||||||
mod->hulls[0].firstclipnode = bm->headnode[0];
|
mod->hulls[0].firstclipnode = bm->headnode[0];
|
||||||
for (int j = 1; j < MAX_MAP_HULLS; j++)
|
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[0] = bm->maxs[0];
|
||||||
mod->maxs[2] = bm->maxs[2];
|
mod->maxs[2] = bm->maxs[2];
|
||||||
mod->maxs[1] = bm->maxs[1];
|
mod->maxs[1] = bm->maxs[1];
|
||||||
|
|
||||||
mod->mins[0] = bm->mins[0];
|
mod->mins[0] = bm->mins[0];
|
||||||
mod->mins[1] = bm->mins[1];
|
mod->mins[1] = bm->mins[1];
|
||||||
mod->mins[2] = bm->mins[2];
|
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)
|
if (i < mod->numsubmodels - 1)
|
||||||
{
|
{
|
||||||
Q_snprintf(name, 10, "*%i", i + 1);
|
char name[10];
|
||||||
submodel = Mod_FindName(0, name);
|
Q_snprintf(name, ARRAYSIZE(name), "*%i", i + 1);
|
||||||
*submodel = *mod;
|
|
||||||
loadmodel = submodel;
|
loadmodel = Mod_FindName(0, name);
|
||||||
Q_strncpy(submodel->name, name, 0x3Fu);
|
*loadmodel = *mod;
|
||||||
|
|
||||||
|
Q_strncpy(loadmodel->name, name, sizeof(loadmodel->name) - 1);
|
||||||
|
loadmodel->name[sizeof(loadmodel->name) - 1] = 0;
|
||||||
mod = loadmodel;
|
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 *pframe;
|
||||||
trivertx_t *pinframe;
|
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++)
|
for (int k = 0; k < 3; k++)
|
||||||
pframe[j].v[k] = pinframe[j].v[k];
|
pframe[j].v[k] = pinframe[j].v[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)&pinframe[numv];
|
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;
|
daliasgroup_t *pingroup;
|
||||||
maliasgroup_t *paliasgroup;
|
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 = (maliasgroup_t *)Hunk_AllocName(sizeof(paliasgroup->frames[0]) * (numframes - 1) + sizeof(maliasgroup_t), loadname);
|
||||||
paliasgroup->numframes = numframes;
|
paliasgroup->numframes = numframes;
|
||||||
|
|
||||||
for(i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
pbboxmin->v[i] = pingroup->bboxmin.v[i];
|
pbboxmin->v[i] = pingroup->bboxmin.v[i];
|
||||||
pbboxmax->v[i] = pingroup->bboxmax.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;
|
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);
|
ptemp = Mod_LoadAliasFrame(ptemp, &paliasgroup->frames[i].frame, numv, &paliasgroup->frames[i].bboxmin, &paliasgroup->frames[i].bboxmax, pheader, name);
|
||||||
|
|
||||||
return ptemp;
|
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 *pskin;
|
||||||
unsigned char *pinskin;
|
unsigned char *pinskin;
|
||||||
//unsigned short *pusskin;
|
|
||||||
|
|
||||||
pskin = (unsigned char *)Hunk_AllocName(skinsize * r_pixbytes, loadname);
|
pskin = (unsigned char *)Hunk_AllocName(skinsize * r_pixbytes, loadname);
|
||||||
pinskin = (unsigned char *)pin;
|
pinskin = (unsigned char *)pin;
|
||||||
@ -1401,7 +1434,7 @@ NOXREF void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashd
|
|||||||
return (void *)&pinskin[skinsize];
|
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;
|
daliasskingroup_t *pinskingroup;
|
||||||
maliasskingroup_t *paliasskingroup;
|
maliasskingroup_t *paliasskingroup;
|
||||||
@ -1421,11 +1454,11 @@ NOXREF void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, al
|
|||||||
|
|
||||||
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
|
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
|
||||||
|
|
||||||
for(i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
*poutskinintervals = LittleFloat(pinskinintervals->interval);
|
*poutskinintervals = LittleFloat(pinskinintervals->interval);
|
||||||
|
|
||||||
if(*poutskinintervals <= 0.0f)
|
if (*poutskinintervals <= 0.0f)
|
||||||
Sys_Error(__FUNCTION__ ": interval<=0");
|
Sys_Error(__FUNCTION__ ": interval<=0");
|
||||||
|
|
||||||
poutskinintervals++;
|
poutskinintervals++;
|
||||||
@ -1434,13 +1467,13 @@ NOXREF void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, al
|
|||||||
|
|
||||||
ptemp = (void *)pinskinintervals;
|
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);
|
ptemp = Mod_LoadAliasSkin(ptemp, &paliasskingroup->skindescs[i].skin, skinsize, pheader);
|
||||||
|
|
||||||
return ptemp;
|
return ptemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
|
void Mod_LoadAliasModel(model_t *mod, void *buffer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
mdl_t *pmodel;
|
mdl_t *pmodel;
|
||||||
@ -1469,34 +1502,37 @@ NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
|
|||||||
if (version != ALIAS_MODEL_VERSION)
|
if (version != ALIAS_MODEL_VERSION)
|
||||||
Sys_Error("%s has wrong version number (%i should be %i)", mod->name, 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) +
|
size = sizeof(mtriangle_t) * LittleLong(pinmodel->numtris) +
|
||||||
sizeof(stvert_t) * LittleLong(pinmodel->numverts) +
|
sizeof(stvert_t) * LittleLong(pinmodel->numverts) +
|
||||||
sizeof(mdl_t) + sizeof(aliashdr_t) +
|
sizeof(mdl_t) + sizeof(aliashdr_t) +
|
||||||
sizeof(pheader->frames[0]) * (LittleLong(pinmodel->numframes) - 1);
|
sizeof(pheader->frames[0]) * (LittleLong(pinmodel->numframes) - 1);
|
||||||
|
|
||||||
pheader = (aliashdr_t *)Hunk_AllocName(size, loadname);
|
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);
|
mod->flags = LittleLong(pinmodel->flags);
|
||||||
|
|
||||||
|
// endian-adjust and copy the data, starting with the alias model header
|
||||||
pmodel->boundingradius = LittleFloat(pinmodel->boundingradius);
|
pmodel->boundingradius = LittleFloat(pinmodel->boundingradius);
|
||||||
pmodel->numskins = LittleLong(pinmodel->numskins);
|
pmodel->numskins = LittleLong(pinmodel->numskins);
|
||||||
pmodel->skinwidth = LittleLong(pinmodel->skinwidth);
|
pmodel->skinwidth = LittleLong(pinmodel->skinwidth);
|
||||||
pmodel->skinheight = LittleLong(pinmodel->skinheight);
|
pmodel->skinheight = LittleLong(pinmodel->skinheight);
|
||||||
|
|
||||||
if (pmodel->skinheight > 480)
|
if (pmodel->skinheight > MAX_LBM_HEIGHT)
|
||||||
Sys_Error("model %s has a skin taller than %d", mod->name, 480);
|
Sys_Error("model %s has a skin taller than %d", mod->name, MAX_LBM_HEIGHT);
|
||||||
|
|
||||||
pmodel->numverts = LittleLong(pinmodel->numverts);
|
pmodel->numverts = LittleLong(pinmodel->numverts);
|
||||||
|
|
||||||
if (pmodel->numverts < 1)
|
if (pmodel->numverts <= 0)
|
||||||
Sys_Error("model %s has no vertices", mod->name);
|
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);
|
Sys_Error("model %s has too many vertices", mod->name);
|
||||||
|
|
||||||
pmodel->numtris = LittleLong(pinmodel->numtris);
|
pmodel->numtris = LittleLong(pinmodel->numtris);
|
||||||
|
|
||||||
if (pmodel->numtris < 1)
|
if (pmodel->numtris <= 0)
|
||||||
Sys_Error("model %s has no triangles", mod->name);
|
Sys_Error("model %s has no triangles", mod->name);
|
||||||
|
|
||||||
pmodel->numframes = LittleLong(pinmodel->numframes);
|
pmodel->numframes = LittleLong(pinmodel->numframes);
|
||||||
@ -1515,83 +1551,84 @@ NOXREF void Mod_LoadAliasModel(model_t *mod, void *buffer)
|
|||||||
numskins = pmodel->numskins;
|
numskins = pmodel->numskins;
|
||||||
numframes = pmodel->numframes;
|
numframes = pmodel->numframes;
|
||||||
|
|
||||||
if (pmodel->skinwidth & 3)
|
if ((pmodel->skinwidth % 4) != 0)
|
||||||
Sys_Error(__FUNCTION__ ": skinwidth not multiple of 4");
|
Sys_Error(__FUNCTION__ ": skinwidth not multiple of 4");
|
||||||
|
|
||||||
pheader->model = (byte *)pmodel - (byte *)pheader;
|
pheader->model = (byte *)pmodel - (byte *)pheader;
|
||||||
|
|
||||||
|
// load the skins
|
||||||
skinsize = pmodel->skinwidth * pmodel->skinheight;
|
skinsize = pmodel->skinwidth * pmodel->skinheight;
|
||||||
|
|
||||||
if (numskins < 1)
|
if (numskins < 1)
|
||||||
Sys_Error(__FUNCTION__ ": Invalid # of skins: %d\n", numskins);
|
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);
|
pskindesc = (maliasskindesc_t *)Hunk_AllocName(sizeof(maliasskindesc_t) * numskins, loadname);
|
||||||
pheader->skindesc = (byte *)pskintype - (byte *)pheader;
|
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);
|
aliasskintype_t skintype = (aliasskintype_t)LittleLong(pskintype->type);
|
||||||
|
|
||||||
pskindesc[i].type = skintype;
|
pskindesc[i].type = skintype;
|
||||||
|
|
||||||
if(skintype == ALIAS_SKIN_SINGLE)
|
if (skintype == ALIAS_SKIN_SINGLE)
|
||||||
pskintype = (daliasskintype_t *)Mod_LoadAliasSkin(&pskintype[1], &pskindesc[i].skin, skinsize, pheader);
|
pskintype = (daliasskintype_t *)Mod_LoadAliasSkin(pskintype + 1, &pskindesc[i].skin, skinsize, pheader);
|
||||||
else
|
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;
|
pinstverts = (stvert_t *)pskintype;
|
||||||
|
|
||||||
pheader->stverts = (byte *)pstverts - (byte *)pheader;
|
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);
|
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].s = (LittleLong(pinstverts[i].s) << 16);
|
||||||
pstverts[i].t = (LittleLong(pinstverts[i].t) << 16);
|
pstverts[i].t = (LittleLong(pinstverts[i].t) << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptri = (mtriangle_t *)&pstverts[pmodel->numverts];
|
// set up the triangles
|
||||||
pintriangles = (dtriangle_t *)&pinstverts[pmodel->numverts];
|
ptri = (mtriangle_t *)(pstverts + pmodel->numverts);
|
||||||
|
pintriangles = (dtriangle_t *)(pinstverts + pmodel->numverts);
|
||||||
|
|
||||||
pheader->triangles = (byte *)ptri - (byte *)pheader;
|
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);
|
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]);
|
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);
|
Sys_Error(__FUNCTION__ ": Invalid # of frames: %d\n", numframes);
|
||||||
|
|
||||||
pframetype = (daliasframetype_t *)&pintriangles[pmodel->numtris];
|
pframetype = (daliasframetype_t *)(pintriangles + pmodel->numtris);
|
||||||
for(i = 0; i < numframes; i++)
|
for (i = 0; i < numframes; i++)
|
||||||
{
|
{
|
||||||
aliasframetype_t frametype = (aliasframetype_t)LittleLong(pframetype->type);
|
aliasframetype_t frametype = (aliasframetype_t)LittleLong(pframetype->type);
|
||||||
pheader->frames[i].type = frametype;
|
pheader->frames[i].type = frametype;
|
||||||
|
|
||||||
if(frametype == ALIAS_SINGLE)
|
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);
|
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
|
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->type = mod_alias;
|
||||||
|
|
||||||
mod->mins[0] = -16.0f;
|
// FIXME: do this right
|
||||||
mod->mins[1] = -16.0f;
|
mod->mins[0] = mod->mins[1] = mod->mins[2] = -16.0f;
|
||||||
mod->mins[2] = -16.0f;
|
mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 16.0f;
|
||||||
|
|
||||||
mod->maxs[0] = 16.0f;
|
|
||||||
mod->maxs[1] = 16.0f;
|
|
||||||
mod->maxs[2] = 16.0f;
|
|
||||||
|
|
||||||
const int dada = sizeof(color24);
|
|
||||||
|
|
||||||
PackedColorVec *pPal = (PackedColorVec *)Hunk_AllocName(sizeof(PackedColorVec) * 256, loadname);
|
PackedColorVec *pPal = (PackedColorVec *)Hunk_AllocName(sizeof(PackedColorVec) * 256, loadname);
|
||||||
color24 *pPalSrc = (color24 *)&pframetype[0];
|
color24 *pPalSrc = (color24 *)pframetype;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
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;
|
pheader->palette = (byte *)pPal - (byte *)pheader;
|
||||||
|
|
||||||
|
// move the complete, relocatable alias model to the cache
|
||||||
end = Hunk_LowMark();
|
end = Hunk_LowMark();
|
||||||
total = end - start;
|
total = end - start;
|
||||||
Cache_Alloc(&mod->cache, total, loadname);
|
Cache_Alloc(&mod->cache, total, loadname);
|
||||||
|
|
||||||
if(mod->cache.data)
|
if (mod->cache.data)
|
||||||
{
|
{
|
||||||
Q_memcpy(mod->cache.data, pheader, total);
|
Q_memcpy(mod->cache.data, pheader, total);
|
||||||
Hunk_FreeToLowMark(start);
|
Hunk_FreeToLowMark(start);
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: Implement security module
|
// TODO: Implement security module
|
||||||
cl_enginefunc_dst_t *pg_engdstAddrs;
|
cl_enginefunc_dst_t *pg_engdstAddrs;
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
|
|
||||||
int net_drop;
|
int net_drop;
|
||||||
|
|
||||||
char gDownloadFile[256];
|
char gDownloadFile[256];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -692,41 +690,6 @@ qboolean Netchan_Validate(netchan_t *chan, qboolean *frag_message, unsigned int
|
|||||||
|
|
||||||
qboolean Netchan_Process(netchan_t *chan)
|
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;
|
int i;
|
||||||
unsigned int sequence, sequence_ack;
|
unsigned int sequence, sequence_ack;
|
||||||
unsigned int reliable_ack, reliable_message;
|
unsigned int reliable_ack, reliable_message;
|
||||||
@ -1449,7 +1412,7 @@ void Netchan_FlushIncoming(netchan_t *chan, int stream)
|
|||||||
n = p->next;
|
n = p->next;
|
||||||
Mem_Free(p);
|
Mem_Free(p);
|
||||||
p = n;
|
p = n;
|
||||||
};
|
}
|
||||||
|
|
||||||
chan->incomingbufs[stream] = nullptr;
|
chan->incomingbufs[stream] = nullptr;
|
||||||
chan->incomingready[stream] = FALSE;
|
chan->incomingready[stream] = FALSE;
|
||||||
@ -1626,7 +1589,7 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
|
|||||||
if (p == chan->incomingbufs[FRAG_FILE_STREAM])
|
if (p == chan->incomingbufs[FRAG_FILE_STREAM])
|
||||||
nsize -= msg_readcount;
|
nsize -= msg_readcount;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
};
|
}
|
||||||
|
|
||||||
buffer = (unsigned char*)Mem_ZeroMalloc(nsize + 1);
|
buffer = (unsigned char*)Mem_ZeroMalloc(nsize + 1);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
@ -1737,7 +1700,7 @@ NOXREF qboolean Netchan_IsSending(netchan_t *chan)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_STREAMS; i++)
|
for (i = 0; i < MAX_STREAMS; i++)
|
||||||
{
|
{
|
||||||
if(chan->fragbufs[i])
|
if (chan->fragbufs[i])
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1748,7 +1711,7 @@ NOXREF qboolean Netchan_IsReceiving(netchan_t *chan)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_STREAMS; i++)
|
for (i = 0; i < MAX_STREAMS; i++)
|
||||||
{
|
{
|
||||||
if(chan->incomingbufs[i])
|
if (chan->incomingbufs[i])
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -981,7 +981,6 @@ int EXT_FUNC iGetIndex(const char *pszField)
|
|||||||
IGETINDEX_CHECK_FIELD(globalname);
|
IGETINDEX_CHECK_FIELD(globalname);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t* EXT_FUNC FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
|
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++)
|
for (i = 0; i < HL_SOUND_MAX; i++)
|
||||||
{
|
{
|
||||||
if (g_psv.sound_precache[i] && !Q_stricmp(g_psv.sound_precache[i], s))
|
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);
|
Host_Error("PF_precache_sound_I: '%s' Precache can only be done in spawn functions", s);
|
||||||
|
@ -672,7 +672,7 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an
|
|||||||
// const unsigned char *pblending,
|
// const unsigned char *pblending,
|
||||||
// model_t *pModel,
|
// model_t *pModel,
|
||||||
// hull_t *pHulls,
|
// hull_t *pHulls,
|
||||||
// int numhulls); /* size=0, low_pc=0 */ // 917
|
// int numhulls);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &studio_hull[0];
|
return &studio_hull[0];
|
||||||
@ -1129,10 +1129,10 @@ int R_GetStudioBounds(const char *filename, float *mins, float *maxs)
|
|||||||
|
|
||||||
if (pBuffer)
|
if (pBuffer)
|
||||||
{
|
{
|
||||||
if (LittleLong(*(unsigned int *)pBuffer) == 'TSDI')
|
if (LittleLong(*(unsigned int *)pBuffer) == IDSTUDIOHEADER)
|
||||||
iret = R_StudioComputeBounds((unsigned char*)pBuffer, mins, maxs);
|
iret = R_StudioComputeBounds((unsigned char*)pBuffer, mins, maxs);
|
||||||
#ifndef REHLDS_FIXES
|
#ifndef REHLDS_FIXES
|
||||||
//wrong release memory code
|
// wrong release memory code
|
||||||
else
|
else
|
||||||
COM_FreeFile(pBuffer);
|
COM_FreeFile(pBuffer);
|
||||||
#endif
|
#endif
|
||||||
|
@ -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_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 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 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_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_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 };
|
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();
|
gEntityInterface.pfnServerDeactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
|
int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
|
||||||
{
|
{
|
||||||
client_t *cl;
|
client_t *cl;
|
||||||
|
@ -386,7 +386,7 @@ NOBODY int glob_match(char *pattern, char *text);
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// glob_match_after_star(char *pattern,
|
// 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)
|
NOXREF void Sys_MakeCodeWriteable(uint32 startaddr, uint32 length)
|
||||||
@ -742,11 +742,11 @@ NOBODY const char *ConvertNameToLocalPlatform(const char *pchInName);
|
|||||||
// char *pchClassName; // 1465
|
// char *pchClassName; // 1465
|
||||||
// char *pchFunctionName; // 1466
|
// char *pchFunctionName; // 1466
|
||||||
// FindNameInTable(extensiondll_t *pDll,
|
// FindNameInTable(extensiondll_t *pDll,
|
||||||
// const char *pName); /* size=0, low_pc=0 */ // 1483
|
// const char *pName); / // 1483
|
||||||
// FindNameInTable(extensiondll_t *pDll,
|
// FindNameInTable(extensiondll_t *pDll,
|
||||||
// const char *pName); /* size=0, low_pc=0 */ // 1487
|
// const char *pName); // 1487
|
||||||
// FindNameInTable(extensiondll_t *pDll,
|
// FindNameInTable(extensiondll_t *pDll,
|
||||||
// const char *pName); /* size=0, low_pc=0 */ // 1491
|
// const char *pName); // 1491
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -27,39 +27,42 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#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 MAX_MAP_HULLS 4
|
||||||
|
|
||||||
#define CONTENTS_ORIGIN -7 // removed at csg time
|
#define CONTENTS_ORIGIN -7 // removed at csg time
|
||||||
#define CONTENTS_CLIP -8 // changed to contents_solid
|
#define CONTENTS_CLIP -8 // changed to contents_solid
|
||||||
#define CONTENTS_CURRENT_0 -9
|
#define CONTENTS_CURRENT_0 -9
|
||||||
#define CONTENTS_CURRENT_90 -10
|
#define CONTENTS_CURRENT_90 -10
|
||||||
#define CONTENTS_CURRENT_180 -11
|
#define CONTENTS_CURRENT_180 -11
|
||||||
#define CONTENTS_CURRENT_270 -12
|
#define CONTENTS_CURRENT_270 -12
|
||||||
#define CONTENTS_CURRENT_UP -13
|
#define CONTENTS_CURRENT_UP -13
|
||||||
#define CONTENTS_CURRENT_DOWN -14
|
#define CONTENTS_CURRENT_DOWN -14
|
||||||
|
|
||||||
#define CONTENTS_TRANSLUCENT -15
|
#define CONTENTS_TRANSLUCENT -15
|
||||||
|
|
||||||
#define LUMP_ENTITIES 0
|
#define LUMP_ENTITIES 0
|
||||||
#define LUMP_PLANES 1
|
#define LUMP_PLANES 1
|
||||||
#define LUMP_TEXTURES 2
|
#define LUMP_TEXTURES 2
|
||||||
#define LUMP_VERTEXES 3
|
#define LUMP_VERTEXES 3
|
||||||
#define LUMP_VISIBILITY 4
|
#define LUMP_VISIBILITY 4
|
||||||
#define LUMP_NODES 5
|
#define LUMP_NODES 5
|
||||||
#define LUMP_TEXINFO 6
|
#define LUMP_TEXINFO 6
|
||||||
#define LUMP_FACES 7
|
#define LUMP_FACES 7
|
||||||
#define LUMP_LIGHTING 8
|
#define LUMP_LIGHTING 8
|
||||||
#define LUMP_CLIPNODES 9
|
#define LUMP_CLIPNODES 9
|
||||||
#define LUMP_LEAFS 10
|
#define LUMP_LEAFS 10
|
||||||
#define LUMP_MARKSURFACES 11
|
#define LUMP_MARKSURFACES 11
|
||||||
#define LUMP_EDGES 12
|
#define LUMP_EDGES 12
|
||||||
#define LUMP_SURFEDGES 13
|
#define LUMP_SURFEDGES 13
|
||||||
#define LUMP_MODELS 14
|
#define LUMP_MODELS 14
|
||||||
|
|
||||||
#define HEADER_LUMPS 15
|
#define HEADER_LUMPS 15
|
||||||
|
|
||||||
typedef struct lump_s
|
typedef struct lump_s
|
||||||
{
|
{
|
||||||
int fileofs;
|
int fileofs;
|
||||||
int filelen;
|
int filelen;
|
||||||
|
@ -33,14 +33,21 @@
|
|||||||
#include "bspfile.h"
|
#include "bspfile.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "com_model.h"
|
#include "com_model.h"
|
||||||
|
#include "commonmacros.h"
|
||||||
|
|
||||||
#define SURF_PLANEBACK 2
|
// header
|
||||||
#define SURF_DRAWSKY 4
|
#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_DRAWSPRITE 8
|
||||||
#define SURF_DRAWTURB 0x10
|
#define SURF_DRAWTURB 0x10
|
||||||
#define SURF_DRAWTILED 0x20
|
#define SURF_DRAWTILED 0x20
|
||||||
#define SURF_DRAWBACKGROUND 0x40
|
#define SURF_DRAWBACKGROUND 0x40
|
||||||
#define ALIAS_MODEL_VERSION 0x006
|
|
||||||
|
|
||||||
#define MAX_MODEL_NAME 64
|
#define MAX_MODEL_NAME 64
|
||||||
#define MIPLEVELS 4
|
#define MIPLEVELS 4
|
||||||
@ -66,12 +73,24 @@ typedef struct texture_s
|
|||||||
{
|
{
|
||||||
char name[16];
|
char name[16];
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
|
|
||||||
|
#ifndef SWDS
|
||||||
|
int gl_texturenum;
|
||||||
|
struct msurface_s * texturechain;
|
||||||
|
#endif
|
||||||
|
|
||||||
int anim_total; // total tenths in sequence ( 0 = no)
|
int anim_total; // total tenths in sequence ( 0 = no)
|
||||||
int anim_min, anim_max; // time for this frame min <=time< max
|
int anim_min, anim_max; // time for this frame min <=time< max
|
||||||
struct texture_s *anim_next; // in the animation sequence
|
struct texture_s *anim_next; // in the animation sequence
|
||||||
struct texture_s *alternate_anims; // bmodels in frame 1 use these
|
struct texture_s *alternate_anims; // bmodels in frame 1 use these
|
||||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||||
|
|
||||||
|
#ifdef SWDS
|
||||||
unsigned paloffset;
|
unsigned paloffset;
|
||||||
|
#else
|
||||||
|
byte *pPal;
|
||||||
|
#endif
|
||||||
|
|
||||||
} texture_t;
|
} texture_t;
|
||||||
|
|
||||||
typedef struct medge_s
|
typedef struct medge_s
|
||||||
|
@ -33,9 +33,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modelgen.h"
|
#include "modelgen.h"
|
||||||
|
#include "commonmacros.h"
|
||||||
|
|
||||||
#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I')
|
#define SPRITE_VERSION 2 // Half-Life sprites
|
||||||
#define SPRITE_VERSION 2
|
#define IDSPRITEHEADER MAKEID('I', 'D', 'S', 'P') // little-endian "IDSP"
|
||||||
|
|
||||||
typedef enum spriteframetype_e
|
typedef enum spriteframetype_e
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "commonmacros.h"
|
||||||
|
|
||||||
#define SAVEFILE_HEADER MAKEID('V','A','L','V') // little-endian "VALV"
|
#define SAVEFILE_HEADER MAKEID('V','A','L','V') // little-endian "VALV"
|
||||||
#define SAVEGAME_HEADER MAKEID('J','S','A','V') // little-endian "JSAV"
|
#define SAVEGAME_HEADER MAKEID('J','S','A','V') // little-endian "JSAV"
|
||||||
#define SAVEGAME_VERSION 0x0071 // Version 0.71
|
#define SAVEGAME_VERSION 0x0071 // Version 0.71
|
||||||
|
Loading…
Reference in New Issue
Block a user