From d2afcc6c96498b70e4235bfb6315d306b3284503 Mon Sep 17 00:00:00 2001 From: whitedragon0000 <000whitedragon000@gmail.com> Date: Sun, 31 Dec 2017 22:26:14 +0100 Subject: [PATCH] some code adjust --- engine/Makefile | 35 +---------------------------------- engine/openbor.c | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 49 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index f15a83636..433adde8f 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -10,7 +10,7 @@ # # OpenBOR Makefile for ALL TARGET_PLATFORMs # -# PSP, PS3, Wii, Dreamcast, GP2X, WIZ, Pandora, OpenDingux, Windows, Darwin & Linux +# PSP, PS3, Wii, Pandora, Windows, Darwin & Linux # #---------------------------------------------------------------------------------------------------- @@ -154,25 +154,6 @@ BUILD_DEBUG = 1 endif endif -ifdef BUILD_OPENDINGUX -TARGET = $(VERSION_NAME).elf -TARGET_FINAL = $(VERSION_NAME).dge -TARGET_PLATFORM = OPENDINGUX -BUILD_SDL = 1 -BUILD_GFX = 1 -BUILD_PTHREAD = 1 -BUILD_SDL_IO = 1 -BUILD_TREMOR = 1 -BUILDING = 1 -CC = $(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/mipsel-linux-gcc -INCLUDES = $(OPENDINGUX_TOOLCHAIN_PREFIX)/include \ - $(OPENDINGUX_TOOLCHAIN_PREFIX)/include/SDL -LIBRARIES = $(OPENDINGUX_TOOLCHAIN_PREFIX)/lib -ifeq ($(BUILD_OPENDINGUX), 0) -BUILD_DEBUG = 1 -endif -endif - ifdef BUILD_WII TARGET = $(VERSION_NAME).elf TARGET_MAP = $(TARGET).map @@ -220,9 +201,6 @@ endif ifdef BUILD_PANDORA STRIP = $(PNDDEV)/bin/arm-none-linux-gnueabi-strip $(TARGET) -o $(TARGET_FINAL) endif -ifdef BUILD_OPENDINGUX -STRIP = $(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/mipsel-linux-strip $(TARGET) -o $(TARGET_FINAL) -endif ifdef BUILD_WII STRIP = elf2dol $< $@ endif @@ -259,11 +237,6 @@ INCS += 'libpng-config --prefix'/include/libpng endif -ifdef BUILD_OPENDINGUX -INCS += '$(OPENDINGUX_TOOLCHAIN_PREFIX)/bin/libpng-config --prefix'/include/libpng -endif - - INCS += . \ source \ source/adpcmlib \ @@ -521,11 +494,6 @@ CFLAGS += -DCACHE_BACKGROUNDS -Wl,-q endif -ifdef BUILD_OPENDINGUX -CFLAGS += -D_REENTRANT -DOPENDINGUX -O2 -fomit-frame-pointer -ffunction-sections -ffast-math -fsingle-precision-constant -G0 -mbranch-likely -endif - - ifdef BUILD_MMX CFLAGS += -DMMX endif @@ -764,7 +732,6 @@ all: @echo make BUILD_WIN=1 @echo make BUILD_PANDORA=1 @echo make BUILD_LINUX=1 - @echo make BUILD_OPENDINGUX=1 @echo @echo Cleanup Intermediate Files: @echo diff --git a/engine/openbor.c b/engine/openbor.c index 5b88065ee..17c514ee8 100644 --- a/engine/openbor.c +++ b/engine/openbor.c @@ -14196,8 +14196,14 @@ void load_level(char *filename) strcpy(level->name, filename); // Allocate memory for player spawn - only as much as we need. - //player_max = levelsets[current_set].maxplayers; - level->spawn = malloc( (sizeof(*level->spawn) * player_max) ); + player_max = levelsets[current_set].maxplayers; + level->spawn = malloc( (sizeof(*level->spawn) * MAX_PLAYERS) ); + + // Default player spawn Y position just above the screen top. + for(i = 0; i < player_max && level->spawn; i++) + { + level->spawn[i].y = videomodes.vRes + 60; + } if(buffer_pakfile(filename, &buf, &size) != 1) { @@ -14229,13 +14235,7 @@ void load_level(char *filename) noscreenshot = 0; panel_width = panel_height = frontpanels_loaded = 0; - //reset_playable_list(1); - - // Default player spawn Y position just above the screen top. - for(i = 0; i < player_max; i++) - { - level->spawn[i].y = videomodes.vRes + 60; - } + //reset_playable_list(1); // Now interpret the contents of buf line by line pos = 0; @@ -14645,7 +14645,7 @@ void load_level(char *filename) // Verify specified player index exists, // then set values. - if(i < player_max) + if(level->spawn && i < player_max) { level->spawn[i].x = GET_INT_ARG(1); level->spawn[i].z = GET_INT_ARG(2); @@ -17049,9 +17049,8 @@ void ent_default_init(entity *e) else if(!e->animation) { int player_index = (int)e->playerindex; - //int max_players = levelsets[current_set].maxplayers; - if(time && level->spawn[player_index].y > e->position.y)//player_index < max_players && + if(player_index < levelsets[current_set].maxplayers && level->spawn && time && level->spawn[player_index].y > e->position.y) { e->takeaction = common_drop; e->position.y = (float)level->spawn[player_index].y; @@ -30482,7 +30481,7 @@ void spawnplayer(int index) if(level->scrolldir & SCROLL_LEFT) { - if(level->spawn[index].x) + if(level->spawn && level->spawn[index].x) { p.position.x = (float)(videomodes.hRes - level->spawn[index].x); } @@ -30493,7 +30492,7 @@ void spawnplayer(int index) } else { - if(level->spawn[index].x) + if(level->spawn && level->spawn[index].x) { p.position.x = (float)(level->spawn[index].x); } @@ -30504,7 +30503,7 @@ void spawnplayer(int index) p.flip = 1; } - if(level->spawn[index].z) + if(level->spawn && level->spawn[index].z) { if(level->scrolldir & (SCROLL_INWARD | SCROLL_OUTWARD)) {