Removed a lot of warnings - but broke Frosted version

This commit is contained in:
Maxime Vincent 2016-05-17 23:24:21 +02:00
parent d9d80e4e18
commit 491cc4b0e1
17 changed files with 110 additions and 141 deletions

View File

@ -4,44 +4,54 @@
# #
# $Log:$ # $Log:$
# #
CROSS_COMPILE = arm-frosted-eabi-
CC= $(CROSS_COMPILE)gcc # gcc or g++
ifeq ($V,'1') ifeq ($(V),1)
V='' VB=''
else else
V=@ VB=@
endif endif
ifeq ($(ARM),1)
CROSS_COMPILE = arm-frosted-eabi-
OBJS+=$(O)/i_video_fbdev.o
CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections -fdata-sections -mcpu=cortex-m3 CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections -fdata-sections -mcpu=cortex-m3
CFLAGS+=-DCORE_M3 -D__frosted__ CFLAGS+=-DCORE_M3 -D__frosted__
# COMPILER FLAGS -- No gcc libraries # COMPILER FLAGS -- No gcc libraries
CFLAGS+=-nostartfiles CFLAGS+=-nostartfiles
# COMPILER FLAGS -- GOT/PIC # COMPILER FLAGS -- GOT/PIC
CFLAGS+=-fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text-relative -Wstack-usage=1024 CFLAGS+=-fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text-relative -Wstack-usage=1024
# LINKER FLAGS
LDFLAGS+=-fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss
else
CFLAGS+=-m32 -fsanitize=address -Wunused-const-variable=0
LIBS+=-lXext -lX11 -lnsl -lm -lSDL2
OBJS+=$(O)/i_video_SDL.o
endif
CC= $(CROSS_COMPILE)gcc # gcc or g++
# Debugging # Debugging
CFLAGS+=-ggdb3 CFLAGS+=-ggdb3
LDFLAGS+=-Wl,--gc-sections
# LINKER FLAGS
LDFLAGS+=-fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss -Wl,--gc-sections
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
CFLAGS+=-Icompat CFLAGS+=-Icompat
LIBS+=-lm -lc
#LDFLAGS=-L/usr/X11R6/lib #LDFLAGS=-L/usr/X11R6/lib
#LIBS=-lXext -lX11 -lnsl -lm #LIBS=-lXext -lX11 -lnsl -lm
LIBS=-lm -lc
# subdirectory for objects # subdirectory for objects
O=frosted O=frosted
# not too sophisticated dependency # not too sophisticated dependency
OBJS= \ OBJS+= \
$(O)/stubs.o \ $(O)/stubs.o \
$(O)/doomdef.o \ $(O)/doomdef.o \
$(O)/doomstat.o \ $(O)/doomstat.o \
$(O)/dstrings.o \ $(O)/dstrings.o \
$(O)/i_system.o \ $(O)/i_system.o \
$(O)/i_sound_dummy.o \ $(O)/i_sound_dummy.o \
$(O)/i_video_fbdev.o \
$(O)/i_net.o \ $(O)/i_net.o \
$(O)/tables.o \ $(O)/tables.o \
$(O)/f_finale.o \ $(O)/f_finale.o \
@ -102,11 +112,12 @@ all: $(O)/fdoom
clean: clean:
rm -f *.o *~ *.flc rm -f *.o *~ *.flc
rm -f frosted/* rm -f frosted/*.o
rm -f frosted/fdoom
$(O)/fdoom: $(OBJS) $(O)/i_main.o $(O)/fdoom: $(OBJS) $(O)/i_main.o
@echo [Linking $@] @echo [Linking $@]
$V$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ $(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \
-o $(O)/fdoom $(LIBS) -Wl,-Map,fdoom.map -o $(O)/fdoom $(LIBS) -Wl,-Map,fdoom.map
$(O): $(O):
@ -114,7 +125,7 @@ $(O):
$(O)/%.o: %.c $(O) $(O)/%.o: %.c $(O)
@echo [Compiling $<] @echo [Compiling $<]
$V$(CC) $(CFLAGS) -c $< -o $@ $(VB)$(CC) $(CFLAGS) -c $< -o $@
############################################################# #############################################################
# #

View File

@ -616,7 +616,7 @@ AM_Responder
{ {
int rc; int rc;
static int cheatstate=0; //static int cheatstate=0;
static int bigstate=0; static int bigstate=0;
static char buffer[20]; static char buffer[20];
@ -695,7 +695,7 @@ AM_Responder
plr->message = AMSTR_MARKSCLEARED; plr->message = AMSTR_MARKSCLEARED;
break; break;
default: default:
cheatstate=0; //cheatstate=0;
rc = false; rc = false;
} }
if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1)) if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1))
@ -783,7 +783,7 @@ void AM_doFollowPlayer(void)
// //
void AM_updateLightLev(void) void AM_updateLightLev(void)
{ {
static nexttic = 0; static int nexttic = 0;
//static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 }; //static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 }; static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
static int litelevelscnt = 0; static int litelevelscnt = 0;
@ -856,9 +856,9 @@ AM_clipMline
TOP =8 TOP =8
}; };
register outcode1 = 0; register int outcode1 = 0;
register outcode2 = 0; register int outcode2 = 0;
register outside; register int outside;
fpoint_t tmp; fpoint_t tmp;
int dx; int dx;
@ -989,7 +989,7 @@ AM_drawFline
register int ay; register int ay;
register int d; register int d;
static fuck = 0; //static fuck = 0;
// For debugging only // For debugging only
if ( fl->a.x < 0 || fl->a.x >= f_w if ( fl->a.x < 0 || fl->a.x >= f_w
@ -997,7 +997,7 @@ AM_drawFline
|| fl->b.x < 0 || fl->b.x >= f_w || fl->b.x < 0 || fl->b.x >= f_w
|| fl->b.y < 0 || fl->b.y >= f_h) || fl->b.y < 0 || fl->b.y >= f_h)
{ {
fprintf(stderr, "fuck %d \r", fuck++); //fprintf(stderr, "fuck %d \r", fuck++);
return; return;
} }

View File

@ -150,7 +150,7 @@ int eventtail;
void D_PostEvent (event_t* ev) void D_PostEvent (event_t* ev)
{ {
events[eventhead] = *ev; events[eventhead] = *ev;
eventhead = (++eventhead)&(MAXEVENTS-1); eventhead = (eventhead + 1) % MAXEVENTS;
} }
@ -576,9 +576,11 @@ void IdentifyVersion (void)
char *home; char *home;
char *doomwaddir; char *doomwaddir;
doomwaddir = getenv("DOOMWADDIR"); doomwaddir = getenv("DOOMWADDIR");
#ifdef __linux__
doomwaddir = ".";
#endif
if (!doomwaddir) if (!doomwaddir)
doomwaddir = "/mnt"; doomwaddir = "/mnt";
//XXX doomwaddir = ".";
// Commercial. // Commercial.
doom2wad = malloc(strlen(doomwaddir)+1+9+1); doom2wad = malloc(strlen(doomwaddir)+1+9+1);

View File

@ -760,10 +760,10 @@ void G_Ticker (void)
// //
void G_InitPlayer (int player) void G_InitPlayer (int player)
{ {
player_t* p; //player_t* p;
// set up the saved info // set up the saved info
p = &players[player]; //p = &players[player];
// clear everything else to defaults // clear everything else to defaults
G_PlayerReborn (player); G_PlayerReborn (player);
@ -1200,20 +1200,21 @@ void G_LoadGame (char* name)
void G_DoLoadGame (void) void G_DoLoadGame (void)
{ {
int length; //int length;
int i; int i;
int a,b,c; int a,b,c;
char vcheck[VERSIONSIZE]; char vcheck[VERSIONSIZE];
gameaction = ga_nothing; gameaction = ga_nothing;
length = M_ReadFile (savename, &savebuffer); //length = M_ReadFile (savename, &savebuffer);
M_ReadFile (savename, &savebuffer);
save_p = savebuffer + SAVESTRINGSIZE; save_p = savebuffer + SAVESTRINGSIZE;
// skip the description field // skip the description field
memset (vcheck,0,sizeof(vcheck)); memset (vcheck,0,sizeof(vcheck));
sprintf (vcheck,"version %i",VERSION); sprintf (vcheck,"version %i",VERSION);
if (strcmp (save_p, vcheck)) if (strcmp ((const char*)save_p, vcheck))
return; // bad version return; // bad version
save_p += VERSIONSIZE; save_p += VERSIONSIZE;

View File

@ -145,7 +145,7 @@ void HUlib_eraseTextLine(hu_textline_t* l)
int lh; int lh;
int y; int y;
int yoffset; int yoffset;
static boolean lastautomapactive = true; //static boolean lastautomapactive = true;
// Only erases when NOT in automap and the screen is reduced, // Only erases when NOT in automap and the screen is reduced,
// and the text must either need updating or refreshing // and the text must either need updating or refreshing
@ -168,7 +168,7 @@ void HUlib_eraseTextLine(hu_textline_t* l)
} }
} }
lastautomapactive = automapactive; //lastautomapactive = automapactive;
if (l->needsupdate) l->needsupdate--; if (l->needsupdate) l->needsupdate--;
} }

View File

@ -49,23 +49,6 @@ rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#include "i_net.h" #include "i_net.h"
// For some odd reason...
#define ntohl(x) \
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
(((unsigned long int)(x) & 0xff000000U) >> 24)))
#define ntohs(x) \
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
(((unsigned short int)(x) & 0xff00) >> 8))) \
#define htonl(x) ntohl(x)
#define htons(x) ntohs(x)
void NetSend (void); void NetSend (void);
boolean NetListen (void); boolean NetListen (void);
@ -164,7 +147,7 @@ void PacketGet (void)
int i; int i;
int c; int c;
struct sockaddr_in fromaddress; struct sockaddr_in fromaddress;
int fromlen; unsigned int fromlen;
doomdata_t sw; doomdata_t sw;
fromlen = sizeof(fromaddress); fromlen = sizeof(fromaddress);
@ -244,7 +227,7 @@ int GetLocalAddress (void)
// //
void I_InitNetwork (void) void I_InitNetwork (void)
{ {
boolean trueval = true; //boolean trueval = true;
int i; int i;
int p; int p;
struct hostent* hostentry; // host information entry struct hostent* hostentry; // host information entry

View File

@ -906,9 +906,6 @@ int I_QrySongPlaying(int handle)
// time independend timer happens to get lost due to heavy load. // time independend timer happens to get lost due to heavy load.
// SIGALRM and ITIMER_REAL doesn't really work well. // SIGALRM and ITIMER_REAL doesn't really work well.
// There are issues with profiling as well. // There are issues with profiling as well.
static int /*__itimer_which*/ itimer = ITIMER_REAL;
static int sig = SIGALRM;
// Interrupt handler. // Interrupt handler.
void I_HandleSoundTimer( int ignore ) void I_HandleSoundTimer( int ignore )
@ -937,39 +934,7 @@ void I_HandleSoundTimer( int ignore )
// Get the interrupt. Set duration in millisecs. // Get the interrupt. Set duration in millisecs.
int I_SoundSetTimer( int duration_of_tick ) int I_SoundSetTimer( int duration_of_tick )
{ {
// Needed for gametick clockwork. return -1;
struct itimerval value;
struct itimerval ovalue;
struct sigaction act;
struct sigaction oact;
int res;
// This sets to SA_ONESHOT and SA_NOMASK, thus we can not use it.
// signal( _sig, handle_SIG_TICK );
// Now we have to change this attribute for repeated calls.
act.sa_handler = I_HandleSoundTimer;
#ifndef sun
//ac t.sa_mask = _sig;
#endif
act.sa_flags = SA_RESTART;
sigaction( sig, &act, &oact );
value.it_interval.tv_sec = 0;
value.it_interval.tv_usec = duration_of_tick;
value.it_value.tv_sec = 0;
value.it_value.tv_usec = duration_of_tick;
// Error is -1.
res = -1; //setitimer( itimer, &value, &ovalue );
// Debug.
if ( res == -1 )
fprintf( stderr, "I_SoundSetTimer: interrupt n.a.\n");
return res;
} }

View File

@ -37,7 +37,7 @@ rcsid[] = "$Id: info.c,v 1.3 1997/01/26 07:45:00 b1 Exp $";
#include "p_mobj.h" #include "p_mobj.h"
char *sprnames[NUMSPRITES] = { char *sprnames[] = {
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG", "TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
"MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2", "MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2",
"PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY","POSS", "PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY","POSS",
@ -51,7 +51,7 @@ char *sprnames[NUMSPRITES] = {
"POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2", "POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2",
"COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU", "COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU",
"COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3", "COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3",
"HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2" "HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2",NULL,"DUMM"
}; };

View File

@ -1156,7 +1156,7 @@ typedef struct
} state_t; } state_t;
extern state_t states[NUMSTATES]; extern state_t states[NUMSTATES];
extern char *sprnames[NUMSPRITES]; extern char *sprnames[];

View File

@ -356,7 +356,7 @@ EV_VerticalDoor
mobj_t* thing ) mobj_t* thing )
{ {
player_t* player; player_t* player;
int secnum; //int secnum;
sector_t* sec; sector_t* sec;
vldoor_t* door; vldoor_t* door;
int side; int side;
@ -411,7 +411,7 @@ EV_VerticalDoor
// if the sector has an active thinker, use it // if the sector has an active thinker, use it
sec = sides[ line->sidenum[side^1]] .sector; sec = sides[ line->sidenum[side^1]] .sector;
secnum = sec-sectors; //secnum = sec-sectors;
if (sec->specialdata) if (sec->specialdata)
{ {

View File

@ -503,11 +503,11 @@ P_LookForPlayers
int c; int c;
int stop; int stop;
player_t* player; player_t* player;
sector_t* sector; //sector_t* sector;
angle_t an; angle_t an;
fixed_t dist; fixed_t dist;
sector = actor->subsector->sector; //sector = actor->subsector->sector;
c = 0; c = 0;
stop = (actor->lastlook-1)&3; stop = (actor->lastlook-1)&3;

View File

@ -72,7 +72,7 @@ typedef struct
// //
typedef struct typedef struct
{ {
boolean istexture; // if false, it is a flat int istexture; // if false, it is a flat
char endname[9]; char endname[9];
char startname[9]; char startname[9];
int speed; int speed;
@ -128,7 +128,7 @@ animdef_t animdefs[] =
{true, "WFALL4", "WFALL1", 8}, {true, "WFALL4", "WFALL1", 8},
{true, "DBRAIN4", "DBRAIN1", 8}, {true, "DBRAIN4", "DBRAIN1", 8},
{false, "\0", "\0", 0} {-1, "", "", 0}
}; };
anim_t anims[MAXANIMS]; anim_t anims[MAXANIMS];
@ -149,11 +149,9 @@ void P_InitPicAnims (void)
{ {
int i; int i;
// Init animation // Init animation
lastanim = anims; lastanim = anims;
//for (i=0 ; animdefs[i].istexture != -1 ; i++) for (i=0 ; animdefs[i].istexture != -1 ; i++)
for (i=0 ; animdefs[i].startname[0] != NULL ; i++)
{ {
if (animdefs[i].istexture) if (animdefs[i].istexture)
{ {
@ -1185,7 +1183,7 @@ int EV_DoDonut(line_t* line)
s2 = getNextSector(s1->lines[0],s1); s2 = getNextSector(s1->lines[0],s1);
for (i = 0;i < s2->linecount;i++) for (i = 0;i < s2->linecount;i++)
{ {
if ((!s2->lines[i]->flags & ML_TWOSIDED) || if ((!(s2->lines[i]->flags & ML_TWOSIDED)) ||
(s2->lines[i]->backsector == s1)) (s2->lines[i]->backsector == s1))
continue; continue;
s3 = s2->lines[i]->backsector; s3 = s2->lines[i]->backsector;
@ -1241,11 +1239,11 @@ void P_SpawnSpecials (void)
{ {
sector_t* sector; sector_t* sector;
int i; int i;
int episode; //int episode;
episode = 1; //episode = 1;
if (W_CheckNumForName("texture2") >= 0) if (W_CheckNumForName("texture2") >= 0)
episode = 2; //episode = 2;
// See if -TIMER needs to be used. // See if -TIMER needs to be used.

View File

@ -44,6 +44,7 @@ rcsid[] = "$Id: r_data.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";
#ifdef LINUX #ifdef LINUX
#include <alloca.h> #include <alloca.h>
#endif #endif
#include <stdlib.h>
#include "r_data.h" #include "r_data.h"
@ -191,9 +192,9 @@ R_DrawColumnInCache
int count; int count;
int position; int position;
byte* source; byte* source;
byte* dest; //byte* dest;
//
dest = (byte *)cache + 3; //dest = (byte *)cache + 3;
while (patch->topdelta != 0xff) while (patch->topdelta != 0xff)
{ {
@ -297,6 +298,7 @@ void R_GenerateLookup (int texnum)
{ {
texture_t* texture; texture_t* texture;
byte* patchcount; // patchcount[texture->width] byte* patchcount; // patchcount[texture->width]
byte* patchcount_alloc;
texpatch_t* patch; texpatch_t* patch;
patch_t* realpatch; patch_t* realpatch;
int x; int x;
@ -321,6 +323,7 @@ void R_GenerateLookup (int texnum)
// with only a single patch are all done. // with only a single patch are all done.
//XXX patchcount = (byte *)alloca (texture->width); //XXX patchcount = (byte *)alloca (texture->width);
patchcount = (byte *)malloc (texture->width); patchcount = (byte *)malloc (texture->width);
patchcount_alloc = patchcount;
if (!patchcount) if (!patchcount)
return; return;
memset (patchcount, 0, texture->width); memset (patchcount, 0, texture->width);
@ -375,7 +378,7 @@ void R_GenerateLookup (int texnum)
} }
} }
free(patchcount); free(patchcount_alloc);
} }
@ -432,6 +435,7 @@ void R_InitTextures (void)
char* name_p; char* name_p;
int* patchlookup; int* patchlookup;
int* patchlookup_alloc;
int totalwidth; int totalwidth;
int nummappatches; int nummappatches;
@ -455,6 +459,7 @@ void R_InitTextures (void)
name_p = names+4; name_p = names+4;
//XXX patchlookup = alloca (nummappatches*sizeof(*patchlookup)); //XXX patchlookup = alloca (nummappatches*sizeof(*patchlookup));
patchlookup = malloc (nummappatches*sizeof(*patchlookup)); patchlookup = malloc (nummappatches*sizeof(*patchlookup));
patchlookup_alloc = patchlookup;
if (!patchlookup) if (!patchlookup)
return; return;
@ -580,7 +585,7 @@ void R_InitTextures (void)
for (i=0 ; i<numtextures ; i++) for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i; texturetranslation[i] = i;
free(patchlookup); free(patchlookup_alloc);
} }
@ -753,8 +758,11 @@ int spritememory;
void R_PrecacheLevel (void) void R_PrecacheLevel (void)
{ {
char* flatpresent; char* flatpresent;
char* flatpresent_alloc;
char* texturepresent; char* texturepresent;
char* texturepresent_alloc;
char* spritepresent; char* spritepresent;
char* spritepresent_alloc;
int i; int i;
int j; int j;
@ -771,6 +779,7 @@ void R_PrecacheLevel (void)
// Precache flats. // Precache flats.
//XXX flatpresent = alloca(numflats); //XXX flatpresent = alloca(numflats);
flatpresent = malloc(numflats); flatpresent = malloc(numflats);
flatpresent_alloc = flatpresent;
if (!flatpresent) if (!flatpresent)
return; return;
memset (flatpresent,0,numflats); memset (flatpresent,0,numflats);
@ -793,11 +802,12 @@ void R_PrecacheLevel (void)
} }
} }
free(flatpresent); free(flatpresent_alloc);
// Precache textures. // Precache textures.
//XXX texturepresent = alloca(numtextures); //XXX texturepresent = alloca(numtextures);
texturepresent = malloc(numtextures); texturepresent = malloc(numtextures);
texturepresent_alloc = texturepresent;
if (!texturepresent) if (!texturepresent)
return; return;
memset (texturepresent,0, numtextures); memset (texturepresent,0, numtextures);
@ -833,12 +843,13 @@ void R_PrecacheLevel (void)
} }
} }
free(texturepresent); free(texturepresent_alloc);
// Precache sprites. // Precache sprites.
//XXX spritepresent = alloca(numsprites); //XXX spritepresent = alloca(numsprites);
spritepresent = malloc(numsprites); spritepresent = malloc(numsprites);
if (!numsprites) spritepresent_alloc = spritepresent;
if (!spritepresent)
return; return;
memset (spritepresent,0, numsprites); memset (spritepresent,0, numsprites);
@ -866,7 +877,7 @@ void R_PrecacheLevel (void)
} }
} }
free(numsprites); free(spritepresent_alloc);
} }

View File

@ -2,6 +2,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <string.h>
//XXX FIXME //XXX FIXME
in_addr_t inet_addr(const char *cp) in_addr_t inet_addr(const char *cp)
@ -9,14 +10,3 @@ in_addr_t inet_addr(const char *cp)
return (in_addr_t)NULL; return (in_addr_t)NULL;
} }
// XXX FIXME
//int usleep(useconds_t us)
//{
// return 0;
//}
//
//
//struct hostent *gethostbyname(const char *name)
//{
// return NULL;
//}

View File

@ -147,6 +147,7 @@ void W_AddFile (char *filename)
int length; int length;
int startlump; int startlump;
filelump_t* fileinfo; filelump_t* fileinfo;
filelump_t* fileinfo_alloc;
filelump_t singleinfo; filelump_t singleinfo;
int storehandle; int storehandle;
@ -198,6 +199,7 @@ void W_AddFile (char *filename)
length = header.numlumps*sizeof(filelump_t); length = header.numlumps*sizeof(filelump_t);
//XXX fileinfo = alloca (length); //XXX fileinfo = alloca (length);
fileinfo = malloc (length); fileinfo = malloc (length);
fileinfo_alloc = fileinfo;
lseek (handle, header.infotableofs, SEEK_SET); lseek (handle, header.infotableofs, SEEK_SET);
read (handle, fileinfo, length); read (handle, fileinfo, length);
numlumps += header.numlumps; numlumps += header.numlumps;
@ -223,7 +225,7 @@ void W_AddFile (char *filename)
} }
//XXX: Alloca replacement //XXX: Alloca replacement
free(fileinfo); free(fileinfo_alloc);
if (reloadname) if (reloadname)
close (handle); close (handle);
@ -246,6 +248,7 @@ void W_Reload (void)
int handle; int handle;
int length; int length;
filelump_t* fileinfo; filelump_t* fileinfo;
filelump_t* fileinfo_alloc;
if (!reloadname) if (!reloadname)
return; return;
@ -259,6 +262,7 @@ void W_Reload (void)
length = lumpcount*sizeof(filelump_t); length = lumpcount*sizeof(filelump_t);
//XXX fileinfo = alloca (length); //XXX fileinfo = alloca (length);
fileinfo = malloc (length); fileinfo = malloc (length);
fileinfo_alloc = fileinfo;
if (!fileinfo) if (!fileinfo)
return; return;
lseek (handle, header.infotableofs, SEEK_SET); lseek (handle, header.infotableofs, SEEK_SET);
@ -278,7 +282,7 @@ void W_Reload (void)
lump_p->size = LONG(fileinfo->size); lump_p->size = LONG(fileinfo->size);
} }
free(fileinfo); free(fileinfo_alloc);
close (handle); close (handle);
} }
@ -493,15 +497,19 @@ W_CacheLumpNum
if (!lumpcache[lump]) if (!lumpcache[lump])
{ {
// read the lump in // read the lump in
//printf ("cache miss on lump %i\n",lump); //printf ("cache miss on lump %i\n",lump);
ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]); ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
if (!ptr)
return NULL;
W_ReadLump (lump, lumpcache[lump]); W_ReadLump (lump, lumpcache[lump]);
} }
else else
{ {
//printf ("cache hit on lump %i\n",lump); //printf ("cache hit on lump %i\n",lump);
Z_ChangeTag (lumpcache[lump],tag); //Z_ChangeTag (lumpcache[lump],tag);
if (( (memblock_t *)( (byte *)(lumpcache[lump]) - sizeof(memblock_t)))->id!=0x1d4a11)
I_Error("Z_CT at "__FILE__":%i",__LINE__);
Z_ChangeTag2(lumpcache[lump],tag);
} }
return lumpcache[lump]; return lumpcache[lump];

View File

@ -987,9 +987,9 @@ void WI_drawDeathmatchStats(void)
int y; int y;
int w; int w;
int lh; // line height //int lh; // line height
lh = WI_SPACINGY; //lh = WI_SPACINGY;
WI_slamBackground(); WI_slamBackground();