fix coyote time bug and change a little hitboxes

This commit is contained in:
Milang 2020-02-16 13:32:16 +01:00
parent 99120d5299
commit 45a70614a0
7 changed files with 38 additions and 30 deletions

Binary file not shown.

View File

@ -2,7 +2,7 @@
[_1]
Type=5
Order=1
Order=0
Top=15
Left=2235
Height=4740
@ -13,7 +13,7 @@ OptionA=0
[_2]
Type=1
Order=0
Order=1
Top=15
Left=7800
Height=4740

Binary file not shown.

View File

@ -33,7 +33,7 @@ void mario_draw();
void mario_jump();
void mario_move();
void ResetMarioJump();
void mario_bigger();
void mario_smaller();
@ -49,4 +49,4 @@ extern int last_vx_sign;
extern int mario_star_mode;
#endif
#endif

View File

@ -91,7 +91,14 @@ int test_sol_le_plus_proche(int x, int y)
return distance;
}
static int jump_buffering=0;
static int coyote_time=5;
void ResetMarioJump()
{
jump_buffering=0;
coyote_time=5;
}
int global_quit=0;
void mario_move()
@ -112,8 +119,7 @@ void mario_move()
id_frame++;
if (mario_has_bullets==1 && mkb_getstate(MK_RUN)==2) bullet_throw();
static int jump_buffering=0;
static int coyote_time=0;
if (mkb_getstate(MK_JUMP)==2 || jump_buffering) //|| keys[MK_JUMP2]==2)
{

View File

@ -66,10 +66,10 @@ void teleport_active()
}
}
ResetMarioJump();
mario.p.x=t.tx*8+4; mario.p.y=t.ty*8;
mario.p.vx=0; mario.p.vy=0;
camera_adjust();
}
}
}
}

View File

@ -31,7 +31,7 @@ cell_t* world_get(int x, int y)
x/=8;
y/=8;
if (0<=x && x<map_current->w && 0<=y && y<map_current->h)
return &map_current->data[x*map_current->h+y];
return &map_current->data[x*map_current->h+y];
else
{
return &death;
@ -42,7 +42,7 @@ void display_cell(int cx, int cy, int sx, int sy, int plan)
{
const cell_t * cell=world_get(cx,cy);
if (cell==0)
return;
return;
if (plan==1)
{
if (cell->type==TUYAU)
@ -81,18 +81,18 @@ void display_cell(int cx, int cy, int sx, int sy, int plan)
i->time_hit_id++;
sy+=2+(i->time_hit_id-4)/4;
if (i->time_hit_id==8)
i->time_hit_id=0;
i->time_hit_id=0;
if (i->state==1 && i->time_hit_id==0)
i->type=0;
i->type=0;
}
if (i->hidden==0)
{
if (i->time_hit_id || i->content==0 || i->number>0)
draw_tile(sx, sy, &brick, 0, i->state);
draw_tile(sx, sy, &brick, 0, i->state);
else
draw_tile(sx, sy, &gift, 1, 0);
draw_tile(sx, sy, &gift, 1, 0);
if (i->content==1 && i->time_hit_id && i->time_hit_id<=4)
draw_tile(sx, sy+8, &coin, 0, 0);
draw_tile(sx, sy+8, &coin, 0, 0);
}
}
@ -104,16 +104,16 @@ void display_cell(int cx, int cy, int sx, int sy, int plan)
i->time_hit_id++;
sy+=2+(i->time_hit_id-4)/4;
if (i->time_hit_id==8)
i->time_hit_id=0;
i->time_hit_id=0;
}
if (i->hidden==0)
{
if (i->time_hit_id || i->number)
draw_tile(sx, sy, &gift, 0, 0);
draw_tile(sx, sy, &gift, 0, 0);
else
draw_tile(sx, sy, &gift, 1, 0);
draw_tile(sx, sy, &gift, 1, 0);
if (i->content==1 && i->time_hit_id && i->time_hit_id<=4)
draw_tile(sx, sy+8, &coin, 0, 0);
draw_tile(sx, sy+8, &coin, 0, 0);
}
}
}
@ -129,15 +129,15 @@ void display_cell(int cx, int cy, int sx, int sy, int plan)
{
deco_t* i=(deco_t*)cell;
if (i->type==BUISSON)
draw_tile(sx, sy, &buisson, i->x, i->y);
draw_tile(sx, sy, &buisson, i->x, i->y);
if (i->type==NUAGE)
draw_tile(sx, sy, &nuage, i->x, i->y);
draw_tile(sx, sy, &nuage, i->x, i->y);
if (i->type==COLLINE)
draw_tile(sx, sy, &colline, i->x, i->y);
draw_tile(sx, sy, &colline, i->x, i->y);
if (i->type==CASTLE)
draw_tile(sx, sy, &castle, i->x, i->y);
draw_tile(sx, sy, &castle, i->x, i->y);
if (i->type==END_LEVEL)
draw_tile(sx-8, sy, &end_level, 0, i->y);
draw_tile(sx-8, sy, &end_level, 0, i->y);
}
}
}
@ -150,12 +150,12 @@ int world_get_ctg(int x, int y)
return CTG_DEATH;
}
if (plateforme_check_collide(x,y))
return CTG_SOIL;
return CTG_SOIL;
if (c->type==ARBRE)
{
arbre_t* a=(arbre_t*)c;
if (a->x==1&&a->y==1)
return CTG_EMPTY;
return CTG_EMPTY;
}
switch (c->type)
{
@ -213,10 +213,12 @@ void world_draw()
}
//teleporteurs_display();
//dvline(teleporteurs[0].x-world_get_real_x0(),C_BLACK);
/*
if (mkb_getstate(MK_JUMP)) drect(1,60,6,63,C_BLACK);
if (mkb_getstate(MK_RUN)) drect(8,60,13,63,C_BLACK);
*/
// draw immunity remaining time
if (mario_immunity) drect(0,4+mario_immunity,2,64, C_BLACK);
}
void world_move()
@ -248,13 +250,13 @@ void world_set(int w, int h, int x, int y, cell_t const * a)
// If the new map size is null => invalid map, return
if (0==w*h)
return;
return;
// Calculates the new struct size
int size= 4*sizeof(int) + sizeof(cell_t)*w*h;
map_current=(map_t*)malloc_prof(size);
if (map_current==0)
malloc_error();
malloc_error();
// Copy the map to ram
map_current->w = w;