Skip to content

Commit

Permalink
some code adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
whitedragon0000 committed Dec 31, 2017
1 parent a0177b6 commit d2afcc6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 49 deletions.
35 changes: 1 addition & 34 deletions engine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
#----------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
29 changes: 14 additions & 15 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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))
{
Expand Down

0 comments on commit d2afcc6

Please sign in to comment.