#include "world.h" #include "tile.h" #include "mario.h" #include "ennemi.h" #include #include "bonus.h" #include #include "constants.h" #include "ennemi.h" #include world_t * w_current=0; image_t * w_fond=0; int w_current_x=0; int w_current_y=0; int w_mario_startx=0; int w_mario_starty=0; int world_get_width() { return w_current_x*8; } world_t death={0,0}; world_t* world_get(int x, int y) { x/=8; y/=8; if (0<=x && xtype==TUYAU) { tuyau_t* i=(tuyau_t*)cell; draw_tile(sx, sy, &tuyau, i->x, i->y); } if (cell->type==EARTH) { earth_t* i=(earth_t*)cell; draw_tile(sx, sy, &earth, i->x, i->y); } if (cell->type==BLOC) { draw_tile(sx, sy, &bloc, 0, 0); } if (cell->type==BLOC) { draw_tile(sx, sy, &bloc, 0, 0); } if (cell->type==BRICK) { brick_t* i=(brick_t*)cell; if (i->time_hit_id) { i->time_hit_id++; sy+=2+(i->time_hit_id-4)/4; if (i->time_hit_id==8) i->time_hit_id=0; if (i->state==1 && i->time_hit_id==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); else 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); } } if (cell->type==GIFT) { gift_t* i=(gift_t*)cell; if (i->time_hit_id) { i->time_hit_id++; sy+=2+(i->time_hit_id-4)/4; if (i->time_hit_id==8) i->time_hit_id=0; } if (i->hidden==0) { if (i->time_hit_id || i->number) draw_tile(sx, sy, &gift, 0, 0); else 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); } } } else { if (cell->type==COIN) { coin_t* i=cell; draw_tile(sx, sy, &coin, i->taken, 0); } if (cell->type==BUISSON || cell->type==NUAGE || cell->type==COLLINE || cell->type==CASTLE || cell->type==END_LEVEL) { deco_t* i=(deco_t*)cell; if (i->type==BUISSON) draw_tile(sx, sy, &buisson, i->x, i->y); if (i->type==NUAGE) draw_tile(sx, sy, &nuage, i->x, i->y); if (i->type==COLLINE) draw_tile(sx, sy, &colline, i->x, i->y); if (i->type==CASTLE) draw_tile(sx, sy, &castle, i->x, i->y); if (i->type==END_LEVEL) draw_tile(sx-8, sy, &end_level, 0, i->y); } } } int world_get_ctg(int x, int y) { world_t *c=world_get(x,y); if (c==0) { return CTG_DEATH; } if (plateforme_check_collide(x,y)) return CTG_SOIL; switch (c->type) { case TUYAU: case GIFT: case BRICK: case EARTH: case BLOC: return CTG_SOIL; default: return CTG_EMPTY; } } static int max(const int x, const int y) { return (xy?y:x); } int world_get_real_x0() //mario delta en 0,0 { if (mario.p.x>mario_x_max) mario_x_max=mario.p.x; if (mario_x_max-40>mario.p.x) mario_x_max--; return min(max(mario_x_max-40,0),w_current_x*8-128); } int world_get_real_y0() //mario delta en 0,0 { //static int y=mario.p.y; static int y=0; if (y>mario.p.y) y--; else if (y Moved ennemies"); bonus_move(); ll_sendp(LEVEL_INFO,"\n > Moved bonus"); bullet_move(); ll_sendp(LEVEL_INFO,"\n > Moved bullets"); move_plateformes(); mario_move(); ll_sendp(LEVEL_INFO,"\n > Moved mario !\n"); }