Skip to content

Commit

Permalink
fix hole bugs on basemap set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
whitedragon0000 committed Dec 31, 2017
1 parent 3eb5624 commit 1967957
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -18520,7 +18520,7 @@ int checkhole_in(float x, float z, float a)

if(level == NULL)
{
return -1;
return 0;
}

maxa = -1;
Expand Down Expand Up @@ -20185,7 +20185,7 @@ int check_basemap_index(int x, int z)

if(!level)
{
return 0;
return -1;
}

for(i = 0; i < level->numbasemaps; i++)
Expand Down Expand Up @@ -20278,13 +20278,15 @@ void adjust_base(entity *e, entity **pla)
//printf("stb:%d\n",self->modeldata.subject_to_basemap);
if(self->modeldata.subject_to_basemap > 0) maxbase = check_basemap(self->position.x, self->position.z);

if(maxbase == T_MIN_BASEMAP && self->modeldata.subject_to_hole > 0)
if(self->modeldata.subject_to_hole > 0 &&
( (self->modeldata.subject_to_basemap > 0 && maxbase == T_MIN_BASEMAP) || (self->modeldata.subject_to_basemap <= 0) )
)
{
hole = (wall < 0 && !other) ? checkhole_in(self->position.x, self->position.z, self->position.y) : 0;
if ( hole )
{
int holeind = checkholeindex_in(self->position.x, self->position.z, self->position.y);
execute_inhole_script(self, 0, (double)level->holes[holeind].height, holeind);
if (holeind >= 0) execute_inhole_script(self, 0, (double)level->holes[holeind].height, holeind);
}

if(seta < 0 && hole)
Expand Down Expand Up @@ -24457,7 +24459,6 @@ int common_trymove(float xdir, float zdir)
{

needcheckhole = 1;
// checkhole or checkhole_in() ???
if(zdir && checkhole(self->position.x, z) && checkwall(self->position.x, z) < 0 && !check_platform_below(self->position.x, z, self->position.y, self))
{
//int holeind = checkholeindex_in(self->position.x, z, self->position.y);
Expand Down

0 comments on commit 1967957

Please sign in to comment.