Considerable memory improvements, send weapon modelindexes as shorts

This commit is contained in:
cypress 2024-07-08 23:30:20 -07:00
parent ea706d1aa9
commit 7ac4842949
8 changed files with 21 additions and 26 deletions

View file

@ -825,7 +825,7 @@ void CL_ParseClientdata (int bits)
if (bits & SU_WEAPON)
i = MSG_ReadByte ();
i = MSG_ReadShort ();
else
i = 0;
@ -908,7 +908,7 @@ void CL_ParseClientdata (int bits)
if (cl.progress_bar != i)
cl.progress_bar = i;
i = MSG_ReadByte ();
i = MSG_ReadShort ();
if (cl.stats[STAT_WEAPON2] != i)
cl.stats[STAT_WEAPON2] = i;

View file

@ -1679,7 +1679,7 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea
// naievil -- why do we have this twice lol
gltextures[glt->texnum].checksum = lhcsum;
//gltextures[glt->texnum].lhcsum = lhcsum;
gltextures[glt->texnum].lhcsum = lhcsum;
gltextures[glt->texnum].width = width;
gltextures[glt->texnum].height = height;

View file

@ -69,7 +69,7 @@ void *Mod_Extradata (model_t *mod)
Mod_LoadModel (mod, true);
if (!mod->cache.data)
Sys_Error ("Mod_Extradata: caching failed");
Sys_Error ("cache fail (%s)", mod->name);
return mod->cache.data;
}
@ -383,7 +383,7 @@ void Mod_LoadTextures (lump_t *l)
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 );
tx = Hunk_AllocName (sizeof(texture_t), loadname );
loadmodel->textures[i] = tx;
memcpy (tx->name, mt->name, sizeof(tx->name));
@ -391,13 +391,11 @@ void Mod_LoadTextures (lump_t *l)
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 (loadmodel->bspversion != HL_BSPVERSION && !strncmp(mt->name,"sky",3))
{
R_InitSky (tx);
R_InitSky (mt);
}
else
{
@ -1660,12 +1658,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
pheader->gl_texturenum[0][0] =
pheader->gl_texturenum[0][1] =
pheader->gl_texturenum[0][2] =
pheader->gl_texturenum[0][3] = loadtextureimage("models/weapons/m1911/v_biatch.mdl_0", 0, 0, qtrue, qtrue);
pheader->gl_texturenum[0][3] = loadtextureimage("models/weapons/m1911/v_biatch.mdl_0", 0, 0, qtrue, qfalse);
pheader->gl_texturenum[1][0] =
pheader->gl_texturenum[1][1] =
pheader->gl_texturenum[1][2] =
pheader->gl_texturenum[1][3] = loadtextureimage("models/weapons/m1911/v_biatch.mdl_0", 0, 0, qtrue, qtrue);
pheader->gl_texturenum[1][3] = loadtextureimage("models/weapons/m1911/v_biatch.mdl_0", 0, 0, qtrue, qfalse);
pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s);
return (void *)pskintype;
@ -1686,7 +1684,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
pheader->gl_texturenum[i][0] =
pheader->gl_texturenum[i][1] =
pheader->gl_texturenum[i][2] =
pheader->gl_texturenum[i][3] = loadtextureimage(model2, 0, 0, qtrue, qtrue);
pheader->gl_texturenum[i][3] = loadtextureimage(model2, 0, 0, qtrue, qfalse);
if (pheader->gl_texturenum[i][0] == 0) // did not find a matching TGA...
{
@ -1906,8 +1904,8 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
mod->type = mod_alias;
// FIXME: do this right
mod->mins[0] = mod->mins[1] = mod->mins[2] = -16;
mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 16;
mod->mins[0] = mod->mins[1] = mod->mins[2] = -32;
mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 32;
//
// build the draw lists
@ -1971,7 +1969,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
COM_StripExtension(loadmodel->name, sprite);
sprintf(sprite2, "%s.spr_%i", sprite, framenum);
pspriteframe->gl_texturenum = loadtextureimage(sprite2, 0, 0, qtrue, qtrue);
pspriteframe->gl_texturenum = loadtextureimage(sprite2, 0, 0, qtrue, qfalse);
if (pspriteframe->gl_texturenum == 0) // did not find a matching TGA...
{

View file

@ -43,10 +43,10 @@ void R_InitOtherTextures (void)
decal_glow = loadtextureimage ("textures/decals/glow2", 0, 0, qfalse, qtrue);
// external zombie skins
zombie_skins[0] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, qtrue);
zombie_skins[1] = loadtextureimage ("models/ai/zfull.mdl_1", 0, 0, qtrue, qtrue);
zombie_skins[2] = loadtextureimage ("models/ai/zfull.mdl_2", 0, 0, qtrue, qtrue);
zombie_skins[3] = loadtextureimage ("models/ai/zfull.mdl_3", 0, 0, qtrue, qtrue);
zombie_skins[0] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, qfalse);
zombie_skins[1] = loadtextureimage ("models/ai/zfull.mdl_1", 0, 0, qtrue, qfalse);
zombie_skins[2] = loadtextureimage ("models/ai/zfull.mdl_2", 0, 0, qtrue, qfalse);
zombie_skins[3] = loadtextureimage ("models/ai/zfull.mdl_3", 0, 0, qtrue, qfalse);
}
/*

View file

@ -724,7 +724,7 @@ R_InitSky
A sky texture is 256*128, with the right side being a masked overlay
==============
*/
void R_InitSky (texture_t *mt)
void R_InitSky (miptex_t *mt)
{
int i, j, p;
byte *src;

View file

@ -161,7 +161,7 @@ void R_InitEfrags (void);
void R_RenderView (void); // must set r_refdef first
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
// called whenever r_refdef or vid change
void R_InitSky (struct texture_s *mt); // called at level load
void R_InitSky (struct miptex_s *mt); // called at level load
void R_AddEfrags (entity_t *ent);
void R_RemoveEfrags (entity_t *ent);

View file

@ -759,7 +759,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
if (bits & SU_WEAPONSKIN)
MSG_WriteByte (msg, ent->v.weaponskin);
if (bits & SU_WEAPON)
MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel));
MSG_WriteShort (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel));
if (bits & SU_GRENADES)
MSG_WriteLong (msg, ent->v.grenades);
@ -777,7 +777,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteByte (msg, ent->v.x2_icon);
MSG_WriteByte (msg, ent->v.insta_icon);
MSG_WriteByte (msg, ent->v.progress_bar);
MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weapon2model));
MSG_WriteShort (msg, SV_ModelIndex(pr_strings+ent->v.weapon2model));
MSG_WriteByte (msg, ent->v.weapon2skin);
MSG_WriteByte (msg, ent->v.weapon2frame);
MSG_WriteByte (msg, ent->v.currentmag2);

View file

@ -309,10 +309,7 @@ int main (int argc, char **argv)
chdir("sdmc:/3ds/nzportable");
if (new3ds_flag == true)
parms.memsize = 64 * 1024 * 1024;
else
parms.memsize = 16 * 1024 * 1024;
parms.memsize = 64 * 1024 * 1024;
parms.membase = malloc (parms.memsize);
parms.basedir = ".";