mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2025-02-17 00:51:11 +00:00
Actually use Q_malloc in some places
This commit is contained in:
parent
9c0d864012
commit
8ca8175096
6 changed files with 13 additions and 36 deletions
|
@ -780,12 +780,12 @@ void Host_InitVCR (quakeparms_t *parms)
|
||||||
Sys_Error("Invalid signature in vcr file\n");
|
Sys_Error("Invalid signature in vcr file\n");
|
||||||
|
|
||||||
Sys_FileRead (vcrFile, &com_argc, sizeof(int));
|
Sys_FileRead (vcrFile, &com_argc, sizeof(int));
|
||||||
com_argv = malloc(com_argc * sizeof(char *));
|
com_argv = Q_malloc(com_argc * sizeof(char *));
|
||||||
com_argv[0] = parms->argv[0];
|
com_argv[0] = parms->argv[0];
|
||||||
for (i = 0; i < com_argc; i++)
|
for (i = 0; i < com_argc; i++)
|
||||||
{
|
{
|
||||||
Sys_FileRead (vcrFile, &len, sizeof(int));
|
Sys_FileRead (vcrFile, &len, sizeof(int));
|
||||||
p = malloc(len);
|
p = Q_malloc(len);
|
||||||
Sys_FileRead (vcrFile, p, len);
|
Sys_FileRead (vcrFile, p, len);
|
||||||
com_argv[i+1] = p;
|
com_argv[i+1] = p;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <psputility.h>
|
#include <psputility.h>
|
||||||
#include <pspdebug.h>
|
#include <pspdebug.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -575,7 +574,7 @@ void SCR_ScreenShot_f (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = static_cast<byte*>(malloc(buffersize));
|
buffer = static_cast<byte*>(Q_malloc(buffersize));
|
||||||
memset(buffer, 0, buffersize);
|
memset(buffer, 0, buffersize);
|
||||||
|
|
||||||
GL_GetPixelsRGB(buffer, glwidth, glheight, 0);
|
GL_GetPixelsRGB(buffer, glwidth, glheight, 0);
|
||||||
|
|
|
@ -236,7 +236,7 @@ byte* LoadPCX (FILE *f, int matchwidth, int matchheight)
|
||||||
|
|
||||||
count = (pcx->xmax+1) * (pcx->ymax+1);
|
count = (pcx->xmax+1) * (pcx->ymax+1);
|
||||||
|
|
||||||
image_rgba = static_cast<byte*>(malloc( count ));
|
image_rgba = static_cast<byte*>(Q_malloc( count ));
|
||||||
|
|
||||||
for (y=0 ; y<=pcx->ymax ; y++)
|
for (y=0 ; y<=pcx->ymax ; y++)
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ byte *LoadWAL (char *name)
|
||||||
|
|
||||||
size = width * height;
|
size = width * height;
|
||||||
|
|
||||||
data = static_cast<byte*>(malloc(size));
|
data = static_cast<byte*>(Q_malloc(size));
|
||||||
memcpy_vfpu(data, (byte *)mt + ofs, size);
|
memcpy_vfpu(data, (byte *)mt + ofs, size);
|
||||||
|
|
||||||
image_palette_type = PAL_Q2;
|
image_palette_type = PAL_Q2;
|
||||||
|
@ -480,7 +480,7 @@ byte *LoadTGA (FILE *fin, int matchwidth, int matchheight)
|
||||||
fclose (fin);
|
fclose (fin);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ColorMap = static_cast<byte*>(malloc (TGA_MAXCOLORS * 4));
|
ColorMap = static_cast<byte*>(Q_malloc (TGA_MAXCOLORS * 4));
|
||||||
map_idx = 0;
|
map_idx = 0;
|
||||||
for (i = temp1 ; i < temp1 + temp2 ; ++i, map_idx += 4)
|
for (i = temp1 ; i < temp1 + temp2 ; ++i, map_idx += 4)
|
||||||
{
|
{
|
||||||
|
@ -936,7 +936,7 @@ byte *LoadBMP (FILE *fin, int matchwidth, int matchheight)
|
||||||
|
|
||||||
numPixels = columns * rows;
|
numPixels = columns * rows;
|
||||||
|
|
||||||
bmpRGBA = static_cast<byte*>(malloc(numPixels * 4));
|
bmpRGBA = static_cast<byte*>(Q_malloc(numPixels * 4));
|
||||||
|
|
||||||
for ( row = rows-1; row >= 0; row-- )
|
for ( row = rows-1; row >= 0; row-- )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2191,34 +2191,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
||||||
daliasskintype_t *pskintype;
|
daliasskintype_t *pskintype;
|
||||||
int start, end, total;
|
int start, end, total;
|
||||||
|
|
||||||
// some models are special
|
mod->modhint = MOD_NORMAL;
|
||||||
// NOTE: comparing not only with player.mdl, but with all models
|
|
||||||
// begin with "player" coz we need to support DME models as well!
|
|
||||||
if (!strncmp(mod->name, "progs/player", 12))
|
|
||||||
mod->modhint = MOD_PLAYER;
|
|
||||||
else if (!strcmp(mod->name, "progs/eyes.mdl"))
|
|
||||||
mod->modhint = MOD_EYES;
|
|
||||||
else if (!strcmp(mod->name, "progs/flame0.mdl") ||
|
|
||||||
!strcmp(mod->name, "progs/flame.mdl") ||
|
|
||||||
!strcmp(mod->name, "progs/flame2.mdl"))
|
|
||||||
mod->modhint = MOD_FLAME;
|
|
||||||
else if (!strcmp(mod->name, "progs/bolt.mdl") ||
|
|
||||||
!strcmp(mod->name, "models/misc/bolt2.mdl") ||
|
|
||||||
!strcmp(mod->name, "progs/bolt3.mdl"))
|
|
||||||
mod->modhint = MOD_THUNDERBOLT;
|
|
||||||
else if (!strcmp(mod->name, "progs/VModels/v_Colt.mdl") || //JUKKI Add nzp weapons here please plox
|
|
||||||
!strcmp(mod->name, "progs/VModels/v_kar.mdl") ||
|
|
||||||
!strcmp(mod->name, "progs/VModels/v_thomp.mdl"))
|
|
||||||
mod->modhint = MOD_WEAPON;
|
|
||||||
else if (!strcmp(mod->name, "progs/lavaball.mdl"))
|
|
||||||
mod->modhint = MOD_LAVABALL;
|
|
||||||
else if (!strcmp(mod->name, "progs/spike.mdl") ||
|
|
||||||
!strcmp(mod->name, "progs/s_spike.mdl"))
|
|
||||||
mod->modhint = MOD_SPIKE;
|
|
||||||
else if (!strcmp(mod->name, "progs/shambler.mdl"))
|
|
||||||
mod->modhint = MOD_SHAMBLER;
|
|
||||||
else
|
|
||||||
mod->modhint = MOD_NORMAL;
|
|
||||||
|
|
||||||
start = Hunk_LowMark ();
|
start = Hunk_LowMark ();
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,11 @@ Zone block
|
||||||
|
|
||||||
void Memory_Init (void *buf, int size);
|
void Memory_Init (void *buf, int size);
|
||||||
|
|
||||||
|
void *Q_malloc (size_t size); // joe
|
||||||
|
void *Q_calloc (size_t n, size_t size); //
|
||||||
|
void *Q_realloc (void *ptr, size_t size); //
|
||||||
|
void *Q_strdup (const char *str); //
|
||||||
|
|
||||||
void Z_Free (void *ptr);
|
void Z_Free (void *ptr);
|
||||||
void *Z_Malloc (int size); // returns 0 filled memory
|
void *Z_Malloc (int size); // returns 0 filled memory
|
||||||
void *Z_TagMalloc (int size, int tag);
|
void *Z_TagMalloc (int size, int tag);
|
||||||
|
|
Loading…
Reference in a new issue