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

View File

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

View File

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

View File

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

View File

@ -145,7 +145,7 @@ void HUlib_eraseTextLine(hu_textline_t* l)
int lh;
int y;
int yoffset;
static boolean lastautomapactive = true;
//static boolean lastautomapactive = true;
// Only erases when NOT in automap and the screen is reduced,
// 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--;
}

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"
// 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);
boolean NetListen (void);
@ -164,7 +147,7 @@ void PacketGet (void)
int i;
int c;
struct sockaddr_in fromaddress;
int fromlen;
unsigned int fromlen;
doomdata_t sw;
fromlen = sizeof(fromaddress);
@ -244,7 +227,7 @@ int GetLocalAddress (void)
//
void I_InitNetwork (void)
{
boolean trueval = true;
//boolean trueval = true;
int i;
int p;
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.
// SIGALRM and ITIMER_REAL doesn't really work well.
// There are issues with profiling as well.
static int /*__itimer_which*/ itimer = ITIMER_REAL;
static int sig = SIGALRM;
// Interrupt handler.
void I_HandleSoundTimer( int ignore )
@ -937,39 +934,7 @@ void I_HandleSoundTimer( int ignore )
// Get the interrupt. Set duration in millisecs.
int I_SoundSetTimer( int duration_of_tick )
{
// Needed for gametick clockwork.
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;
return -1;
}

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"
char *sprnames[NUMSPRITES] = {
char *sprnames[] = {
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
"MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2",
"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",
"COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU",
"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;
extern state_t states[NUMSTATES];
extern char *sprnames[NUMSPRITES];
extern char *sprnames[];

View File

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

View File

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

View File

@ -72,7 +72,7 @@ typedef struct
//
typedef struct
{
boolean istexture; // if false, it is a flat
int istexture; // if false, it is a flat
char endname[9];
char startname[9];
int speed;
@ -128,7 +128,7 @@ animdef_t animdefs[] =
{true, "WFALL4", "WFALL1", 8},
{true, "DBRAIN4", "DBRAIN1", 8},
{false, "\0", "\0", 0}
{-1, "", "", 0}
};
anim_t anims[MAXANIMS];
@ -149,11 +149,9 @@ void P_InitPicAnims (void)
{
int i;
// Init animation
lastanim = anims;
//for (i=0 ; animdefs[i].istexture != -1 ; i++)
for (i=0 ; animdefs[i].startname[0] != NULL ; i++)
for (i=0 ; animdefs[i].istexture != -1 ; i++)
{
if (animdefs[i].istexture)
{
@ -1185,7 +1183,7 @@ int EV_DoDonut(line_t* line)
s2 = getNextSector(s1->lines[0],s1);
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))
continue;
s3 = s2->lines[i]->backsector;
@ -1241,11 +1239,11 @@ void P_SpawnSpecials (void)
{
sector_t* sector;
int i;
int episode;
//int episode;
episode = 1;
//episode = 1;
if (W_CheckNumForName("texture2") >= 0)
episode = 2;
//episode = 2;
// 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
#include <alloca.h>
#endif
#include <stdlib.h>
#include "r_data.h"
@ -191,9 +192,9 @@ R_DrawColumnInCache
int count;
int position;
byte* source;
byte* dest;
dest = (byte *)cache + 3;
//byte* dest;
//
//dest = (byte *)cache + 3;
while (patch->topdelta != 0xff)
{
@ -297,6 +298,7 @@ void R_GenerateLookup (int texnum)
{
texture_t* texture;
byte* patchcount; // patchcount[texture->width]
byte* patchcount_alloc;
texpatch_t* patch;
patch_t* realpatch;
int x;
@ -321,6 +323,7 @@ void R_GenerateLookup (int texnum)
// with only a single patch are all done.
//XXX patchcount = (byte *)alloca (texture->width);
patchcount = (byte *)malloc (texture->width);
patchcount_alloc = patchcount;
if (!patchcount)
return;
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;
int* patchlookup;
int* patchlookup_alloc;
int totalwidth;
int nummappatches;
@ -455,6 +459,7 @@ void R_InitTextures (void)
name_p = names+4;
//XXX patchlookup = alloca (nummappatches*sizeof(*patchlookup));
patchlookup = malloc (nummappatches*sizeof(*patchlookup));
patchlookup_alloc = patchlookup;
if (!patchlookup)
return;
@ -580,7 +585,7 @@ void R_InitTextures (void)
for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i;
free(patchlookup);
free(patchlookup_alloc);
}
@ -753,8 +758,11 @@ int spritememory;
void R_PrecacheLevel (void)
{
char* flatpresent;
char* flatpresent_alloc;
char* texturepresent;
char* texturepresent_alloc;
char* spritepresent;
char* spritepresent_alloc;
int i;
int j;
@ -771,6 +779,7 @@ void R_PrecacheLevel (void)
// Precache flats.
//XXX flatpresent = alloca(numflats);
flatpresent = malloc(numflats);
flatpresent_alloc = flatpresent;
if (!flatpresent)
return;
memset (flatpresent,0,numflats);
@ -793,11 +802,12 @@ void R_PrecacheLevel (void)
}
}
free(flatpresent);
free(flatpresent_alloc);
// Precache textures.
//XXX texturepresent = alloca(numtextures);
texturepresent = malloc(numtextures);
texturepresent_alloc = texturepresent;
if (!texturepresent)
return;
memset (texturepresent,0, numtextures);
@ -833,12 +843,13 @@ void R_PrecacheLevel (void)
}
}
free(texturepresent);
free(texturepresent_alloc);
// Precache sprites.
//XXX spritepresent = alloca(numsprites);
spritepresent = malloc(numsprites);
if (!numsprites)
spritepresent_alloc = spritepresent;
if (!spritepresent)
return;
memset (spritepresent,0, numsprites);
@ -866,7 +877,7 @@ void R_PrecacheLevel (void)
}
}
free(numsprites);
free(spritepresent_alloc);
}

View File

@ -189,7 +189,7 @@ void R_InitSpriteDefs (char** namelist)
// count the number of sprite names
check = namelist;
while (*check != NULL)
check++;
check++;
numsprites = check-namelist;

View File

@ -2,6 +2,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
//XXX FIXME
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;
}
// 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 startlump;
filelump_t* fileinfo;
filelump_t* fileinfo_alloc;
filelump_t singleinfo;
int storehandle;
@ -198,6 +199,7 @@ void W_AddFile (char *filename)
length = header.numlumps*sizeof(filelump_t);
//XXX fileinfo = alloca (length);
fileinfo = malloc (length);
fileinfo_alloc = fileinfo;
lseek (handle, header.infotableofs, SEEK_SET);
read (handle, fileinfo, length);
numlumps += header.numlumps;
@ -223,7 +225,7 @@ void W_AddFile (char *filename)
}
//XXX: Alloca replacement
free(fileinfo);
free(fileinfo_alloc);
if (reloadname)
close (handle);
@ -246,6 +248,7 @@ void W_Reload (void)
int handle;
int length;
filelump_t* fileinfo;
filelump_t* fileinfo_alloc;
if (!reloadname)
return;
@ -259,6 +262,7 @@ void W_Reload (void)
length = lumpcount*sizeof(filelump_t);
//XXX fileinfo = alloca (length);
fileinfo = malloc (length);
fileinfo_alloc = fileinfo;
if (!fileinfo)
return;
lseek (handle, header.infotableofs, SEEK_SET);
@ -278,7 +282,7 @@ void W_Reload (void)
lump_p->size = LONG(fileinfo->size);
}
free(fileinfo);
free(fileinfo_alloc);
close (handle);
}
@ -492,16 +496,20 @@ W_CacheLumpNum
if (!lumpcache[lump])
{
// read the lump in
//printf ("cache miss on lump %i\n",lump);
ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
W_ReadLump (lump, lumpcache[lump]);
// read the lump in
//printf ("cache miss on lump %i\n",lump);
ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
if (!ptr)
return NULL;
W_ReadLump (lump, lumpcache[lump]);
}
else
{
//printf ("cache hit on lump %i\n",lump);
Z_ChangeTag (lumpcache[lump],tag);
//printf ("cache hit on lump %i\n",lump);
//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];

View File

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