mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-02-15 00:10:54 +00:00
merge qw_client/model.c and uquake/model.c into common/model.c
common/gl_model.c uquake/Makefile.in: allow checksums in uquake
This commit is contained in:
parent
8668430a36
commit
19206928b4
4 changed files with 58 additions and 1935 deletions
|
@ -1187,7 +1187,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
|
||||
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
// checksum all of the map, except for entities
|
||||
mod->checksum = 0;
|
||||
mod->checksum2 = 0;
|
||||
|
@ -1203,7 +1202,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
|
||||
header->lumps[i].filelen));
|
||||
}
|
||||
#endif
|
||||
|
||||
// load into heap
|
||||
|
||||
|
|
|
@ -27,10 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
#include "r_local.h"
|
||||
#include <lib_replace.h>
|
||||
#include <sys.h>
|
||||
#include <mathlib.h>
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <crc.h>
|
||||
#include <quakefs.h>
|
||||
|
||||
model_t *loadmodel;
|
||||
char loadname[32]; // for hunk tags
|
||||
|
@ -58,7 +61,7 @@ void Mod_Init (void)
|
|||
|
||||
/*
|
||||
===============
|
||||
Mod_Init
|
||||
Mod_Extradata
|
||||
|
||||
Caches the data if needed
|
||||
===============
|
||||
|
@ -318,9 +321,9 @@ Loads in a model for the given name
|
|||
model_t *Mod_ForName (char *name, qboolean crash)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
||||
|
||||
return Mod_LoadModel (mod, crash);
|
||||
}
|
||||
|
||||
|
@ -335,6 +338,48 @@ model_t *Mod_ForName (char *name, qboolean crash)
|
|||
|
||||
byte *mod_base;
|
||||
|
||||
int Mod_LoadExternalTexture(int number, char *texturename)
|
||||
{
|
||||
int j, pixels;
|
||||
miptex_t *mt;
|
||||
texture_t *tx;
|
||||
char texturepathname[1024];
|
||||
if (texturename[0] == '\0')
|
||||
return (0);
|
||||
|
||||
sprintf(texturepathname, "/id1/gfx/%s", texturename);
|
||||
|
||||
mt = (miptex_t *)COM_LoadHunkFile(texturepathname);
|
||||
|
||||
if (!mt)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
mt->width = LittleLong (mt->width);
|
||||
mt->height = LittleLong (mt->height);
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
mt->offsets[j] = LittleLong (mt->offsets[j]);
|
||||
|
||||
if ( (mt->width & 15) || (mt->height & 15) )
|
||||
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
||||
pixels = mt->width*mt->height/64*85;
|
||||
tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname );
|
||||
loadmodel->textures[number] = tx;
|
||||
|
||||
memcpy (tx->name, mt->name, sizeof(tx->name));
|
||||
|
||||
tx->width = mt->width;
|
||||
tx->height = mt->height;
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t);
|
||||
// the pixels immediately follow the structures
|
||||
memcpy ( tx+1, mt+1, pixels);
|
||||
|
||||
if (!Q_strncmp(mt->name,"sky",3))
|
||||
R_InitSky (tx);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -370,6 +415,13 @@ void Mod_LoadTextures (lump_t *l)
|
|||
mt = (miptex_t *)((byte *)m + m->dataofs[i]);
|
||||
mt->width = LittleLong (mt->width);
|
||||
mt->height = LittleLong (mt->height);
|
||||
#ifdef UQUAKE
|
||||
if (mt->height == -1 && mt->width == -1)
|
||||
{
|
||||
if (Mod_LoadExternalTexture(i, mt->name));
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
mt->offsets[j] = LittleLong (mt->offsets[j]);
|
||||
|
||||
|
@ -1186,6 +1238,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
Mod_MakeHull0 ();
|
||||
|
||||
mod->numframes = 2; // regular and alternate animation
|
||||
mod->flags = 0;
|
||||
|
||||
//
|
||||
// set up the submodels (FIXME: this is confusing)
|
||||
|
@ -1646,7 +1699,6 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
frametype = LittleLong (pframetype->type);
|
||||
pheader->frames[i].type = frametype;
|
||||
|
||||
|
||||
if (frametype == ALIAS_SINGLE)
|
||||
{
|
||||
pframetype = (daliasframetype_t *)
|
||||
|
@ -1849,6 +1901,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
|||
Sys_Error ("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes);
|
||||
|
||||
mod->numframes = numframes;
|
||||
mod->flags = 0;
|
||||
|
||||
pframetype = (dspriteframetype_t *)(pin + 1);
|
||||
|
|
@ -152,7 +152,7 @@ else
|
|||
NET_SRC = net_dos.c net_bw.c net_ipx.c net_mp.c net_ser.c
|
||||
endif
|
||||
endif
|
||||
UQ_NET_SRC = net_dgrm.c net_loop.c net_main.c net_vcr.c $(NET_SRC)
|
||||
UQ_NET_SRC = net_com.c mdfour.c net_dgrm.c net_loop.c net_main.c net_vcr.c $(NET_SRC)
|
||||
|
||||
# Common source files
|
||||
|
||||
|
|
1928
uquake/model.c
1928
uquake/model.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue