From d9d80e4e18e1ce4d9417efe68c52758d932c41ef Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Tue, 17 May 2016 10:20:28 +0200 Subject: [PATCH] Reduce stack usage --- frosted-doom/Makefile | 13 ++++++++++--- frosted-doom/doomdef.h | 4 ++++ frosted-doom/g_game.c | 6 +++--- frosted-doom/r_things.c | 5 +++-- frosted-doom/stubs.c | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/frosted-doom/Makefile b/frosted-doom/Makefile index 4f87d56..690f54e 100644 --- a/frosted-doom/Makefile +++ b/frosted-doom/Makefile @@ -7,6 +7,11 @@ CROSS_COMPILE = arm-frosted-eabi- CC= $(CROSS_COMPILE)gcc # gcc or g++ +ifeq ($V,'1') + V='' +else + V=@ +endif CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections -fdata-sections -mcpu=cortex-m3 CFLAGS+=-DCORE_M3 -D__frosted__ @@ -36,7 +41,7 @@ OBJS= \ $(O)/dstrings.o \ $(O)/i_system.o \ $(O)/i_sound_dummy.o \ - $(O)/i_video_dummy.o \ + $(O)/i_video_fbdev.o \ $(O)/i_net.o \ $(O)/tables.o \ $(O)/f_finale.o \ @@ -100,14 +105,16 @@ clean: rm -f frosted/* $(O)/fdoom: $(OBJS) $(O)/i_main.o - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ + @echo [Linking $@] + $V$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ -o $(O)/fdoom $(LIBS) -Wl,-Map,fdoom.map $(O): mkdir -p $(O) $(O)/%.o: %.c $(O) - $(CC) $(CFLAGS) -c $< -o $@ + @echo [Compiling $<] + $V$(CC) $(CFLAGS) -c $< -o $@ ############################################################# # diff --git a/frosted-doom/doomdef.h b/frosted-doom/doomdef.h index 1850477..a5a4ffa 100644 --- a/frosted-doom/doomdef.h +++ b/frosted-doom/doomdef.h @@ -96,6 +96,7 @@ typedef enum // It will not work dynamically, see visplanes. // #define BASE_WIDTH 320 +//#define BASE_WIDTH 480 // It is educational but futile to change this // scaling e.g. to 2. Drawing of status bar, @@ -103,13 +104,16 @@ typedef enum // by the graphics. #define SCREEN_MUL 1 #define INV_ASPECT_RATIO 0.625 // 0.75, ideally +//#define INV_ASPECT_RATIO 0.567// 0.75, ideally // Defines suck. C sucks. // C++ might sucks for OOP, but it sure is a better C. // So there. #define SCREENWIDTH 320 +//#define SCREENWIDTH 480 //SCREEN_MUL*BASE_WIDTH //320 #define SCREENHEIGHT 200 +//#define SCREENHEIGHT 272 //(int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) //200 diff --git a/frosted-doom/g_game.c b/frosted-doom/g_game.c index 30ac33c..1da2353 100644 --- a/frosted-doom/g_game.c +++ b/frosted-doom/g_game.c @@ -1588,9 +1588,9 @@ void G_DoPlayDemo (void) demobuffer = demo_p = W_CacheLumpName (defdemoname, PU_STATIC); if ( *demo_p++ != VERSION) { - fprintf( stderr, "Demo is from a different game version!\n"); - gameaction = ga_nothing; - return; + fprintf( stderr, "Demo is from a different game version! - Trying anyway...\n"); + //gameaction = ga_nothing; + //return; } skill = *demo_p++; diff --git a/frosted-doom/r_things.c b/frosted-doom/r_things.c index c201fff..b91016f 100644 --- a/frosted-doom/r_things.c +++ b/frosted-doom/r_things.c @@ -839,11 +839,12 @@ void R_SortVisSprites (void) // // R_DrawSprite // +// +short clipbot[SCREENWIDTH]; +short cliptop[SCREENWIDTH]; void R_DrawSprite (vissprite_t* spr) { drawseg_t* ds; - short clipbot[SCREENWIDTH]; - short cliptop[SCREENWIDTH]; int x; int r1; int r2; diff --git a/frosted-doom/stubs.c b/frosted-doom/stubs.c index 77a5358..fc4152c 100644 --- a/frosted-doom/stubs.c +++ b/frosted-doom/stubs.c @@ -6,7 +6,7 @@ //XXX FIXME in_addr_t inet_addr(const char *cp) { - return NULL; + return (in_addr_t)NULL; } // XXX FIXME