fix minor brick display bug

dev
Milang 3 years ago
parent 72d1ce0255
commit 5aeb14b1c6
  1. 4
      SuperCbr.dlw
  2. BIN
      SuperCbr.g1a
  3. 2
      include/constants.h
  4. 4
      src/box.c
  5. 10
      src/levelchanger.c
  6. 27
      src/mario.c

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

Binary file not shown.

@ -12,6 +12,4 @@
//extern bool dark_theme_enable;
//extern bool is_in_water;
extern int frame_id;
#endif // CONSTANTS_H

@ -31,7 +31,7 @@ static void move_x(box_t * b)
int coef=1;// move each frame
if (worldGetCellCategory(b->x, b->y)==CTG_WATER || worldGetCellCategory(b->x+b->w-1, b->y)==CTG_WATER) coef=2; //slow down in water
if (frame_id%coef) return; // move 1 frame of 2 when in water ~to be improved
if (time_id%coef) return; // move 1 frame of 2 when in water ~to be improved
if (sgn_vx)
{
@ -67,7 +67,7 @@ static void move_y(box_t * b)
int coef=1;//1;
if (worldGetCellCategory(b->x, b->y)==CTG_WATER || worldGetCellCategory(b->x+b->w-1, b->y)==CTG_WATER)
coef=2;// 0.5
if (frame_id%coef)
if (time_id%coef)
return;
if (sgn_vy)

@ -252,13 +252,9 @@ void launchUI() // Main Menu
}
}
int frame_id;
int PlayLevel(int w, int l)
{
time_id=0;
initRefreshTimer();
//int finish_status=0; // FAil
@ -278,7 +274,7 @@ int PlayLevel(int w, int l)
{
waitNextFrame();
frame_id++;
time_id++;
//marioMove();
worldMove();
@ -313,7 +309,7 @@ int PlayLevel(int w, int l)
{
quitRefreshTimer();
// TODO ajouter temps au score etc
if (finish_level==1) sleep_ms(3,3000); // win
if (finish_level==1) sleep_ms(3,3000); // win
return finish_level;
}

@ -58,14 +58,14 @@ void marioDraw()
const int my=mario.p.y-cameraY(mario.p.y);
if (mario.size==M_SMALL)
{
if (abs(mario.p.vx)>=3) tileDraw(mx, my, &mario_small, 2*last_vx_sign+(id_frame/4)%2, 0);
else if (abs(mario.p.vx)>=1) tileDraw(mx, my, &mario_small, 2*last_vx_sign+(id_frame/8)%2, 0);
if (abs(mario.p.vx)>=3) tileDraw(mx, my, &mario_small, 2*last_vx_sign+(time_id/4)%2, 0);
else if (abs(mario.p.vx)>=1) tileDraw(mx, my, &mario_small, 2*last_vx_sign+(time_id/8)%2, 0);
else tileDraw(mx, my, &mario_small, 2*last_vx_sign, 0);
}
else
{
if (abs(mario.p.vx)>=3) tileDraw(mx, my, &mario_big, 1+3*last_vx_sign+(id_frame/4)%2, mario_has_bullets);
else if (abs(mario.p.vx)>=1) tileDraw(mx, my, &mario_big, 1+3*last_vx_sign+(id_frame/8)%2, mario_has_bullets);
if (abs(mario.p.vx)>=3) tileDraw(mx, my, &mario_big, 1+3*last_vx_sign+(time_id/4)%2, mario_has_bullets);
else if (abs(mario.p.vx)>=1) tileDraw(mx, my, &mario_big, 1+3*last_vx_sign+(time_id/8)%2, mario_has_bullets);
else tileDraw(mx, my, &mario_big, 3*last_vx_sign, mario_has_bullets);
}
}
@ -200,19 +200,22 @@ void marioMove()
{
c->hidden=0;
mario.p.last_vy=0;
if (c->number) switch (c->content)
if (c->number)
{
case 0: c->time_hit_id=1; break;
c->time_hit_id=1;
switch (c->content)
{
case 1: c->number--; coinAdd(); break;
case 1: c->number--; coinAdd(); break;
case 2: c->number--; bonusSet(BONUS_CHAMPI,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
case 2: c->number--; bonusSet(BONUS_CHAMPI,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
case 3: c->number--; bonusSet(BONUS_1UP,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
case 3: c->number--; bonusSet(BONUS_1UP,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
case 4: c->number--; bonusSet(BONUS_STAR,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
case 4: c->number--; bonusSet(BONUS_STAR,((mario.p.x+mario.p.w/2)/8)*8,mario.p.y+mario.p.h+8); break;
}
}
else if (c->content==0 && mario.size==M_BIG && c->type==BRICK) c->state=1;
else if (c->content==0 && mario.size==M_BIG && c->type==BRICK) c->state=c->time_hit_id=1;
else if (c->content==0 && c->type==BRICK) c->time_hit_id=1;
}
}
}

Loading…
Cancel
Save