* Removed some useless memset calls onto newly hunk allocated memory.

Hunk_Alloc() already clears the memory before returning it.
* Some minor cleanups.

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@465 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-07-05 06:28:42 +00:00
parent b6913f5348
commit 55cc159297
2 changed files with 33 additions and 39 deletions

View file

@ -1782,14 +1782,12 @@ typedef struct
short x, y; short x, y;
} floodfill_t; } floodfill_t;
extern unsigned d_8to24table[];
// must be a power of 2 // must be a power of 2
#define FLOODFILL_FIFO_SIZE 0x1000 #define FLOODFILL_FIFO_SIZE 0x1000
#define FLOODFILL_FIFO_MASK (FLOODFILL_FIFO_SIZE - 1) #define FLOODFILL_FIFO_MASK (FLOODFILL_FIFO_SIZE - 1)
#define FLOODFILL_STEP( off, dx, dy ) \ #define FLOODFILL_STEP( off, dx, dy ) \
{ \ do { \
if (pos[off] == fillcolor) \ if (pos[off] == fillcolor) \
{ \ { \
pos[off] = 255; \ pos[off] = 255; \
@ -1797,7 +1795,7 @@ extern unsigned d_8to24table[];
inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; \ inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; \
} \ } \
else if (pos[off] != 255) fdc = pos[off]; \ else if (pos[off] != 255) fdc = pos[off]; \
} } while (0)
void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
{ {
@ -2231,9 +2229,6 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
size = width * height; size = width * height;
pspriteframe = (mspriteframe_t *) Hunk_AllocName (sizeof (mspriteframe_t),loadname); pspriteframe = (mspriteframe_t *) Hunk_AllocName (sizeof (mspriteframe_t),loadname);
Q_memset (pspriteframe, 0, sizeof (mspriteframe_t));
*ppframe = pspriteframe; *ppframe = pspriteframe;
pspriteframe->width = width; pspriteframe->width = width;
@ -2254,8 +2249,9 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
sprintf (name, "%s:frame%i", loadmodel->name, framenum); sprintf (name, "%s:frame%i", loadmodel->name, framenum);
offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz
pspriteframe->gltexture = pspriteframe->gltexture =
TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED, (byte *)(pinframe + 1), TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED,
loadmodel->name, offset, TEXPREF_PAD | TEXPREF_ALPHA | TEXPREF_NOPICMIP); //johnfitz -- TexMgr (byte *)(pinframe + 1), loadmodel->name, offset,
TEXPREF_PAD | TEXPREF_ALPHA | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size); return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size);
} }
@ -2376,14 +2372,12 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
if (frametype == SPR_SINGLE) if (frametype == SPR_SINGLE)
{ {
pframetype = (dspriteframetype_t *) pframetype = (dspriteframetype_t *)
Mod_LoadSpriteFrame (pframetype + 1, Mod_LoadSpriteFrame (pframetype + 1, &psprite->frames[i].frameptr, i);
&psprite->frames[i].frameptr, i);
} }
else else
{ {
pframetype = (dspriteframetype_t *) pframetype = (dspriteframetype_t *)
Mod_LoadSpriteGroup (pframetype + 1, Mod_LoadSpriteGroup (pframetype + 1, &psprite->frames[i].frameptr, i);
&psprite->frames[i].frameptr, i);
} }
} }

View file

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
server_t sv; server_t sv;
server_static_t svs; server_static_t svs;
char localmodels[MAX_MODELS][8]; // inline model names for precache static char localmodels[MAX_MODELS][8]; // inline model names for precache
int sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz int sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz
@ -1315,10 +1315,9 @@ void SV_SpawnServer (const char *server)
// //
// set up the new server // set up the new server
// //
//memset (&sv, 0, sizeof(sv));
Host_ClearMemory (); Host_ClearMemory ();
memset (&sv, 0, sizeof(sv));
strcpy (sv.name, server); strcpy (sv.name, server);
sv.protocol = sv_protocol; // johnfitz sv.protocol = sv_protocol; // johnfitz
@ -1327,6 +1326,7 @@ void SV_SpawnServer (const char *server)
PR_LoadProgs (); PR_LoadProgs ();
// allocate server memory // allocate server memory
/* Host_ClearMemory() called above already cleared the whole sv structure */
sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar
sv.edicts = (edict_t *) Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts"); sv.edicts = (edict_t *) Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts");