parent
c467ff19b0
commit
ea8499c1f2
BIN
SuperCbr.g1a
BIN
SuperCbr.g1a
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 670 B |
Binary file not shown.
Before Width: | Height: | Size: 756 B After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
991
build-fx/map
991
build-fx/map
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
build-fx/src/bonus.c.o: src/bonus.c src/bonus.h src/box.h src/mario.h \
|
||||
src/world.h src/tile.h src/score.h src/ennemi.h
|
||||
src/world.h src/tile.h src/score.h src/ennemi.h src/constants.h
|
||||
|
||||
src/bonus.h:
|
||||
|
||||
|
@ -14,3 +14,5 @@ src/tile.h:
|
|||
src/score.h:
|
||||
|
||||
src/ennemi.h:
|
||||
|
||||
src/constants.h:
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,10 @@
|
|||
build-fx/src/box.c.o: src/box.c src/box.h src/world.h src/ennemi.h
|
||||
build-fx/src/box.c.o: src/box.c src/box.h src/world.h src/ennemi.h \
|
||||
src/score.h
|
||||
|
||||
src/box.h:
|
||||
|
||||
src/world.h:
|
||||
|
||||
src/ennemi.h:
|
||||
|
||||
src/score.h:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,5 @@
|
|||
build-fx/src/tile.c.o: src/tile.c src/tile.h
|
||||
build-fx/src/tile.c.o: src/tile.c src/tile.h src/constants.h
|
||||
|
||||
src/tile.h:
|
||||
|
||||
src/constants.h:
|
||||
|
|
Binary file not shown.
Binary file not shown.
12
src/bonus.c
12
src/bonus.c
|
@ -5,6 +5,7 @@
|
|||
#include "tile.h"
|
||||
#include "score.h"
|
||||
#include "ennemi.h"
|
||||
#include "constants.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define BONUS_FLEUR 4 // interne, généré depuis champi
|
||||
|
@ -27,9 +28,13 @@ static int sgn(int x)
|
|||
}
|
||||
|
||||
|
||||
static bonus_t bonus ={BONUS_NONE, {0,0,8,8,0,0,0,1}, 0};
|
||||
static bonus_t bonus ={BONUS_NONE, {0,0,TILE_W,TILE_H,0,0,0,1}, 0};
|
||||
/* Les balles ont les memes propriétés que les boulets et sont donc gérées ici */
|
||||
static bonus_t bullets[2] ={{0, {0,0,4,4,0,0,0,1}, 0},{0, {0,0,4,4,0,0,0,1}, 0}};
|
||||
static bonus_t bullets[2] =
|
||||
{
|
||||
{0, {0,0,TILE_W/2,TILE_H/2,0,0,0,1}, 0},
|
||||
{0, {0,0,TILE_W/2,TILE_H/2,0,0,0,1}, 0}
|
||||
};
|
||||
|
||||
void lance_bullet()
|
||||
{
|
||||
|
@ -83,9 +88,10 @@ void bullet_move()
|
|||
bool y_collide= (bullets[i].b.y<=t->b.y && t->b.y<bullets[i].b.y+bullets[i].b.h) || (bullets[i].b.y<=t->b.y+t->b.h-1 && t->b.y+t->b.h<bullets[i].b.y+bullets[i].b.h);
|
||||
if (x_collide&& y_collide)
|
||||
{
|
||||
t->type=NONE;
|
||||
t->life=DEAD;
|
||||
bullets[i].type=0;
|
||||
score_add(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "box.h"
|
||||
#include "world.h"
|
||||
#include "ennemi.h"
|
||||
#include "score.h"
|
||||
|
||||
int sgn(int x)
|
||||
{
|
||||
|
@ -33,9 +34,13 @@ int check_collision(box_t *b)
|
|||
static void move_x(box_t * b)
|
||||
{
|
||||
int sgn_vx=sgn(b->vx);
|
||||
|
||||
int t_vx=((sgn_vx*b->vx+time_id%2)/2)*sgn_vx;
|
||||
sgn_vx=sgn(t_vx);
|
||||
|
||||
if (sgn_vx)
|
||||
{
|
||||
for (int i=sgn_vx; i<=sgn_vx*b->vx; i++)
|
||||
for (int i=sgn_vx; i<=sgn_vx*t_vx; i++)
|
||||
{
|
||||
int previous_tested_y=-545;
|
||||
int type=CTG_EMPTY;
|
||||
|
@ -60,7 +65,7 @@ static void move_x(box_t * b)
|
|||
}
|
||||
}
|
||||
}
|
||||
b->x+=b->vx;
|
||||
b->x+=t_vx;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
src/box.h
16
src/box.h
|
@ -3,16 +3,16 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int x :16;
|
||||
int y :16;
|
||||
|
||||
int w;
|
||||
int h;
|
||||
unsigned w :8;
|
||||
unsigned h :8;
|
||||
|
||||
int vx;
|
||||
int vy;
|
||||
int last_vy;
|
||||
int gravity;
|
||||
int vx :8;
|
||||
int vy :8;
|
||||
int last_vy :8;
|
||||
int gravity :2;
|
||||
//int is_mario;
|
||||
} box_t;
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#define TILE_W 8
|
||||
#define TILE_H 8
|
||||
|
||||
#define SCREEN_W 128
|
||||
#define SCREEN_H 64
|
||||
|
||||
#include <stdbool.h>
|
||||
extern bool dark_theme_enable;
|
||||
extern bool is_in_water;
|
286
src/ennemi.c
286
src/ennemi.c
|
@ -7,16 +7,33 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
const int ennemi_widths [NOMBRE_ENNEMIS] = {0, 8, 8, 8, 8 , 8};
|
||||
const int ennemi_heights[NOMBRE_ENNEMIS] = {0, 8, 12, 9, 12, 9};
|
||||
|
||||
void display_ennemi(ennemi_t * e)
|
||||
{
|
||||
if (e->life==DEAD)
|
||||
if (e->life==0)
|
||||
{
|
||||
if (e->p1==0)
|
||||
{
|
||||
e->b.vx*=-1;
|
||||
e->b.vy=5;
|
||||
}
|
||||
e->p1++;
|
||||
e->b.vy--;
|
||||
e->b.y+=e->b.vy;
|
||||
e->b.x+=e->b.vx;
|
||||
if (e->p1==30)
|
||||
e->type=NONE;
|
||||
}
|
||||
if (e->type==NONE)
|
||||
return;
|
||||
if (e->b.x<=world_get_real_x0(0)-e->b.w || e->b.x>=world_get_real_x0(0)+127)
|
||||
return;
|
||||
else
|
||||
e->discovered=1;
|
||||
|
||||
if (e->type==GOOMBA)
|
||||
if (e->type==GOOMBA_ID)
|
||||
{
|
||||
extern image_t img_goomba;
|
||||
tileset_t goomba={&img_goomba, GOOMBA_X, GOOMBA_Y, 1};
|
||||
|
@ -25,7 +42,7 @@ void display_ennemi(ennemi_t * e)
|
|||
if (e->life==0)
|
||||
draw_tile(e->b.x-world_get_real_x0(0), e->b.y-world_get_real_y0(mario.p.y), &goomba, 0, 0);
|
||||
}
|
||||
if (e->type==KOOPA_VERTE)
|
||||
if (e->type==KOOPA_V_ID)
|
||||
{
|
||||
extern image_t img_koopa_verte;
|
||||
tileset_t koopa_verte={&img_koopa_verte, KOOPA_X, KOOPA_Y, 1};
|
||||
|
@ -42,24 +59,16 @@ void display_ennemi(ennemi_t * e)
|
|||
}
|
||||
|
||||
bool ennemi_check_collision(ennemi_t *e)
|
||||
{
|
||||
bool x_collide= (mario.p.x<=e->b.x && e->b.x<mario.p.x+mario.p.w-1) || (mario.p.x<=e->b.x+e->b.w-1 && e->b.x+e->b.w<mario.p.x+mario.p.w-1);
|
||||
bool y_collide= (mario.p.y<=e->b.y && e->b.y<mario.p.y+mario.p.h-1) || (mario.p.y<=e->b.y+e->b.h-1 && e->b.y+e->b.h<mario.p.y+mario.p.h-1);
|
||||
{ bool x_collide= (mario.p.x<=e->b.x && e->b.x<=mario.p.x+mario.p.w-1) || (mario.p.x<=e->b.x+e->b.w-1 && e->b.x+e->b.w-1<=mario.p.x+mario.p.w-1);
|
||||
bool y_collide= (mario.p.y<=e->b.y && e->b.y<=mario.p.y+mario.p.h-1) || (mario.p.y<=e->b.y+e->b.h-1 && e->b.y+e->b.h-1<=mario.p.y+mario.p.h-1);
|
||||
return (x_collide&&y_collide);
|
||||
|
||||
}
|
||||
|
||||
void hurt_mario()
|
||||
{
|
||||
if (mario.size==M_SMALL && mario_immunity==0)
|
||||
{
|
||||
mario_dead=1;
|
||||
end_level=0;
|
||||
}
|
||||
{ if (mario.size==M_SMALL && mario_immunity==0)
|
||||
{mario_dead=1;end_level=0;}
|
||||
else
|
||||
{
|
||||
mario_smaller();
|
||||
}
|
||||
}
|
||||
|
||||
void move_ennemi(ennemi_t *e)
|
||||
|
@ -72,10 +81,19 @@ void move_ennemi(ennemi_t *e)
|
|||
if (e->discovered==0)
|
||||
return;
|
||||
if (e->life==DEAD)
|
||||
e->type=NONE;
|
||||
return;
|
||||
// e->type=NONE;
|
||||
if (e->type==NONE)
|
||||
return;
|
||||
|
||||
|
||||
bool e_hit_mario=ennemi_check_collision(e);
|
||||
if (e_hit_mario&&mario_star_mode)
|
||||
{
|
||||
e->life=DEAD;
|
||||
e->p1=0;
|
||||
score_add(200);
|
||||
}
|
||||
|
||||
for (int i=0; i<ennemis_global_size; i++)
|
||||
{
|
||||
ennemi_t* t=&ennemis_global[i];
|
||||
|
@ -84,7 +102,7 @@ void move_ennemi(ennemi_t *e)
|
|||
|
||||
bool x_collide= (t->b.x<=e->b.x+e->b.vx && e->b.x+e->b.vx<t->b.x+t->b.w) || (t->b.x<=e->b.x+e->b.w-1+e->b.vx && e->b.x+e->b.w+e->b.vx<t->b.x+t->b.w);
|
||||
bool y_collide= (t->b.y<=e->b.y+e->b.vy && e->b.y+e->b.vy<t->b.y+t->b.h) || (t->b.y<=e->b.y+e->b.h-1+e->b.vy && e->b.y+e->b.h+e->b.vy<t->b.y+t->b.h);
|
||||
if (x_collide&&y_collide)
|
||||
if (x_collide&&y_collide && t->life!=DEAD)
|
||||
{
|
||||
if (e->type!=CARAPACE_VERTE && e->type!=CARAPACE_ROUGE)
|
||||
{
|
||||
|
@ -96,12 +114,12 @@ void move_ennemi(ennemi_t *e)
|
|||
if (t->type==CARAPACE_VERTE || t->type==CARAPACE_ROUGE)
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=3*e->p1;
|
||||
e->b.vx=6*e->p1;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->life=DEAD;
|
||||
t->p1=time_id;
|
||||
t->p1=0;
|
||||
score_add(200);
|
||||
}
|
||||
|
||||
|
@ -117,99 +135,135 @@ void move_ennemi(ennemi_t *e)
|
|||
if ((c->type==GIFT || c->type==BRICK) && (c->time_hit_id || c->state))
|
||||
{
|
||||
e->life=DEAD;
|
||||
//e->p1=time_id;
|
||||
e->p1=0;
|
||||
score_add(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e->type==GOOMBA)
|
||||
if (e->type==GOOMBA_ID)
|
||||
{
|
||||
if (e->life==1)
|
||||
box_move(&e->b);
|
||||
|
||||
if (e->b.vx==0)
|
||||
{
|
||||
int old_vx=e->b.vx;
|
||||
if (time_id%2)
|
||||
e->b.vx=0;
|
||||
|
||||
box_move(&e->b);
|
||||
|
||||
if (time_id%2)
|
||||
e->b.vx=old_vx;
|
||||
|
||||
if (e->b.vx==0)
|
||||
if (e->p1==0)
|
||||
{
|
||||
if (e->p1==0)
|
||||
{
|
||||
e->b.vx=-1;
|
||||
e->p1=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=e->p1;
|
||||
}
|
||||
e->b.vx=-1;
|
||||
e->p1=-1;
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
if (ennemi_check_collision(e))
|
||||
else
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=e->p1;
|
||||
}
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
if (e_hit_mario)
|
||||
{
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
e->life=DEAD;
|
||||
e->p1=0;
|
||||
score_add(200);
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y;
|
||||
}
|
||||
else
|
||||
hurt_mario();
|
||||
}
|
||||
}
|
||||
|
||||
if (e->type==KOOPA_V_ID)
|
||||
{
|
||||
box_move(&e->b);
|
||||
if (e->b.vx==0)
|
||||
{
|
||||
if (e->p1==0)
|
||||
{
|
||||
e->b.vx=-1;
|
||||
e->p1=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=e->p1;
|
||||
}
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
if (e_hit_mario)
|
||||
{
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
e->type=CARAPACE_VERTE;
|
||||
e->b.h=CARAPACE_Y;
|
||||
e->p1=2;
|
||||
e->b.vx=0;
|
||||
score_add(200);
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y+1;
|
||||
}
|
||||
else
|
||||
hurt_mario();
|
||||
}
|
||||
}
|
||||
if (e->type==CARAPACE_VERTE)
|
||||
{
|
||||
box_move(&e->b);
|
||||
|
||||
if (e->b.vx==0)
|
||||
{
|
||||
if (e->p1<2)
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=6*e->p1;
|
||||
}
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
if (e->p1>=2)
|
||||
{
|
||||
e->p1++;
|
||||
if (e->p1==80)
|
||||
{
|
||||
e->type=KOOPA_V_ID;
|
||||
e->b.h=KOOPA_Y;
|
||||
e->p1=0;
|
||||
e->b.vx=0;
|
||||
}
|
||||
}
|
||||
|
||||
if (e_hit_mario)
|
||||
{
|
||||
if (e->p1==0 || e->p1>=2)
|
||||
{
|
||||
if (mario.p.x>=e->b.x)
|
||||
e->p1=-1;
|
||||
if (mario.p.x<=e->b.x)
|
||||
e->p1=1;
|
||||
e->b.vx=6*e->p1;
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
e->life=DEAD;
|
||||
e->p1=time_id;
|
||||
score_add(200);
|
||||
{
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y;
|
||||
}
|
||||
else
|
||||
hurt_mario();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e->p1>=time_id+10 || e->p1<time_id)
|
||||
e->life=DEAD;
|
||||
}
|
||||
}
|
||||
|
||||
if (e->type==KOOPA_VERTE)
|
||||
{
|
||||
if (e->life==1)
|
||||
{
|
||||
int old_vx=e->b.vx;
|
||||
if (time_id%2)
|
||||
e->b.vx=0;
|
||||
|
||||
box_move(&e->b);
|
||||
|
||||
if (time_id%2)
|
||||
e->b.vx=old_vx;
|
||||
|
||||
if (e->b.vx==0)
|
||||
{
|
||||
if (e->p1==0)
|
||||
{
|
||||
e->b.vx=-1;
|
||||
e->p1=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=e->p1;
|
||||
if (mario.p.x>=e->b.x)
|
||||
mario.p.x=e->b.x+e->b.w;
|
||||
if (mario.p.x<=e->b.x)
|
||||
mario.p.x=e->b.x-mario.p.w;
|
||||
}
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
if (ennemi_check_collision(e))
|
||||
else
|
||||
{
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
e->type=CARAPACE_VERTE;
|
||||
e->b.h=CARAPACE_Y;
|
||||
e->p1=0;
|
||||
e->b.vx=0;
|
||||
score_add(200);
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y+1;
|
||||
}
|
||||
|
@ -217,61 +271,8 @@ void move_ennemi(ennemi_t *e)
|
|||
hurt_mario();
|
||||
}
|
||||
}
|
||||
else
|
||||
e->life=DEAD;
|
||||
}
|
||||
if (e->type==CARAPACE_VERTE)
|
||||
{
|
||||
if (e->life==1)
|
||||
{
|
||||
box_move(&e->b);
|
||||
|
||||
if (e->b.vx==0)
|
||||
{
|
||||
e->p1*=-1;
|
||||
e->b.vx=3*e->p1;
|
||||
}
|
||||
if (e->b.y<0)
|
||||
e->type=NONE;
|
||||
|
||||
if (ennemi_check_collision(e))
|
||||
{
|
||||
if (e->p1==0)
|
||||
{
|
||||
if (mario.p.x>=e->b.x)
|
||||
e->p1=-1;
|
||||
if (mario.p.x<=e->b.x)
|
||||
e->p1=1;
|
||||
e->b.vx=3*e->p1;
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mario.p.x>=e->b.x)
|
||||
mario.p.x=e->b.x+e->b.w;
|
||||
if (mario.p.x<=e->b.x)
|
||||
mario.p.x=e->b.x-mario.p.w;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mario.p.last_vy<=-2)
|
||||
{
|
||||
e->p1=0;
|
||||
e->b.vx=0;
|
||||
mario.p.vy=4;
|
||||
mario.p.y=e->b.y+CARAPACE_Y+1;
|
||||
}
|
||||
else
|
||||
hurt_mario();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
display_ennemi(e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -284,5 +285,6 @@ void display_ennemi_table()
|
|||
for (int i=0; i<ennemis_global_size; i++)
|
||||
{
|
||||
move_ennemi(&ennemis_global[i]);
|
||||
display_ennemi(&ennemis_global[i]);
|
||||
}
|
||||
}
|
30
src/ennemi.h
30
src/ennemi.h
|
@ -1,20 +1,28 @@
|
|||
#ifndef ENNEMI_H
|
||||
#define ENNEMI_H
|
||||
|
||||
|
||||
|
||||
|
||||
#include "box.h"
|
||||
#define NOMBRE_ENNEMIS 6
|
||||
extern const int ennemi_widths[NOMBRE_ENNEMIS];
|
||||
extern const int ennemi_heights[NOMBRE_ENNEMIS];
|
||||
|
||||
#define NONE 0
|
||||
#define GOOMBA 1
|
||||
#define KOOPA_VERTE 2
|
||||
|
||||
|
||||
#define GOOMBA_ID 1
|
||||
#define KOOPA_V_ID 2
|
||||
|
||||
#define GOOMBA(x,y,dir) {GOOMBA_ID,{x,y,ennemi_widths[GOOMBA_ID],ennemi_heights[GOOMBA_ID],dir,0,0,1},1,0,dir}
|
||||
#define KOOPA_V(x,y,dir) {KOOPA_V_ID,{x,y,ennemi_widths[KOOPA_V_ID],ennemi_heights[KOOPA_V_ID],dir,0,0,1},1,0,dir}
|
||||
|
||||
#define CARAPACE_VERTE 3
|
||||
#define KOOPA_ROUGE 4
|
||||
#define CARAPACE_ROUGE 5
|
||||
|
||||
|
||||
#define DEAD -1
|
||||
#define STATE1 0
|
||||
#define STATE2 1
|
||||
#define STATE3 2
|
||||
#define DEAD 0
|
||||
|
||||
// Dimensions pr les boites
|
||||
|
||||
|
@ -30,11 +38,11 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
int type :8;
|
||||
box_t b;
|
||||
int p1;
|
||||
int discovered;
|
||||
int life;
|
||||
unsigned life :1;
|
||||
unsigned discovered :1;
|
||||
int p1 :14;
|
||||
} ennemi_t;
|
||||
|
||||
void display_ennemi(ennemi_t * e);
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
mkey_t keys[6]={0};
|
||||
|
||||
extern image_t img_menu_pause;
|
||||
extern image_t img_select_arrow;
|
||||
|
||||
|
||||
static int konami[]={KEY_UP,KEY_UP,KEY_DOWN,KEY_DOWN,KEY_LEFT,KEY_RIGHT,KEY_LEFT,KEY_RIGHT,KEY_SHIFT,KEY_ALPHA};
|
||||
static int konami[]={KEY_UP,KEY_UP,KEY_DOWN,KEY_DOWN,KEY_LEFT,KEY_RIGHT,KEY_LEFT,KEY_RIGHT,KEY_ALPHA,KEY_SHIFT};
|
||||
|
||||
int menu_pause() // 1 exit, 0 continue
|
||||
{
|
||||
extern image_t img_menu_pause;
|
||||
extern image_t img_select_arrow;
|
||||
key_event_t e;
|
||||
e=pollevent();
|
||||
while(e.type!=KEYEV_NONE)
|
||||
|
@ -37,10 +38,10 @@ int menu_pause() // 1 exit, 0 continue
|
|||
choice=0;
|
||||
if (keydown(KEY_DOWN))
|
||||
choice=1;
|
||||
if (keydown(KEY_EXIT))
|
||||
return 0;
|
||||
if (keydown(KEY_MENU))
|
||||
return 1;
|
||||
if (keydown(KEY_EXIT))
|
||||
return 0;
|
||||
if (keydown(KEY_F1))
|
||||
{
|
||||
e=pollevent();
|
||||
|
@ -56,7 +57,7 @@ int menu_pause() // 1 exit, 0 continue
|
|||
}
|
||||
if (keydown(KEY_EXIT))
|
||||
break;
|
||||
if (a==10)
|
||||
if (a==10) // CHEAT MENU
|
||||
{
|
||||
mario_bigger();
|
||||
mario_has_bullets=1;
|
||||
|
@ -74,8 +75,10 @@ int menu_pause() // 1 exit, 0 continue
|
|||
e=pollevent();
|
||||
}
|
||||
|
||||
|
||||
dimage(x,y,&img_menu_pause);
|
||||
dimage(x+2, y+2+7*choice, &img_select_arrow);
|
||||
|
||||
dupdate();
|
||||
sleep_ms(3,1);
|
||||
}
|
||||
|
|
26
src/level.c
26
src/level.c
|
@ -194,9 +194,9 @@ void set_level(int n)
|
|||
{EARTH,0x11}, {EARTH,0x10}, {BLOC,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {NUAGE,0x11}, {NUAGE,0x10},
|
||||
{EARTH,0x11}, {EARTH,0x10}, {BLOC,0}, {BLOC,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {NUAGE,0x21}, {NUAGE,0x20},
|
||||
{EARTH,0x11}, {EARTH,0x10}, {BLOC,0}, {BLOC,0}, {BLOC,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
|
||||
{EARTH,0x11}, {EARTH,0x10}, {BLOC,0}, {BLOC,0}, {BLOC,0}, {BLOC,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
|
||||
{EARTH,0x11}, {EARTH,0x10}, {BLOC,0}, {BLOC,0}, {BLOC,0}, {BLOC,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}
|
||||
};
|
||||
lvl=&level_0;
|
||||
lvl=(world_t*)&level_0;
|
||||
extern image_t img_lvl0;
|
||||
w_fond=&img_lvl0;
|
||||
w_current_x=137;
|
||||
|
@ -209,17 +209,17 @@ void set_level(int n)
|
|||
ennemis_global_size=10;
|
||||
ennemi_t ennemies0[]=
|
||||
{
|
||||
{GOOMBA,{176,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{321,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{409,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{421,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{640,80,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{656,80,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{776,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{788,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{KOOPA_VERTE,{856,16,KOOPA_X,KOOPA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{912,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1},
|
||||
{GOOMBA,{924,16,GOOMBA_X,GOOMBA_Y,-1,0,0,1},-1,0,1}
|
||||
GOOMBA(176,16,-1),
|
||||
GOOMBA(321,16,-1),
|
||||
GOOMBA(409,16,-1),
|
||||
GOOMBA(421,16,-1),
|
||||
GOOMBA(640,80,-1),
|
||||
GOOMBA(656,80,-1),
|
||||
GOOMBA(776,16,-1),
|
||||
GOOMBA(788,16,-1),
|
||||
KOOPA_V(856,16,-1),
|
||||
GOOMBA(912,16,-1),
|
||||
GOOMBA(924,16,-1)
|
||||
};
|
||||
init_ennemies(ennemies0);
|
||||
|
||||
|
|
26
src/mario.c
26
src/mario.c
|
@ -18,12 +18,7 @@ static int sgn(int x)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern image_t img_mariosmall;
|
||||
int id_frame=0;
|
||||
tileset_t mario_small={&img_mariosmall, 8,8, 1};
|
||||
|
||||
extern image_t img_mariobig;
|
||||
tileset_t mario_big={&img_mariobig, 8,16, 1};
|
||||
|
||||
pnj mario=
|
||||
{
|
||||
|
@ -40,7 +35,9 @@ int mario_coins=0;
|
|||
int last_vx_sign=1;
|
||||
int last_bonus=0;
|
||||
int mario_accel=0;
|
||||
|
||||
int mario_immunity=0;
|
||||
int mario_star_mode=0;
|
||||
|
||||
void mario_bigger()
|
||||
{
|
||||
|
@ -75,11 +72,11 @@ void mario_draw()
|
|||
else
|
||||
{
|
||||
if (mario.p.vx*sgn(mario.p.vx)>=3)
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 2*last_vx_sign+(id_frame/4)%2, mario_has_bullets);
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 4*last_vx_sign+(id_frame/4)%2, mario_has_bullets);
|
||||
else if (mario.p.vx*sgn(mario.p.vx)>=1)
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 2*last_vx_sign+(id_frame/8)%2, mario_has_bullets);
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 4*last_vx_sign+(id_frame/8)%2, mario_has_bullets);
|
||||
else
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 2*last_vx_sign, mario_has_bullets);
|
||||
draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y), &mario_big, 3*last_vx_sign, mario_has_bullets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,13 +149,19 @@ void mario_move()
|
|||
{
|
||||
if (keys[MK_RUN] && (c1==CTG_SOIL || c2==CTG_SOIL))
|
||||
{
|
||||
if(mario.p.vx*sgn(mario.p.vx)<=4)
|
||||
if(mario.p.vx*sgn(mario.p.vx)<=8)
|
||||
mario.p.vx+=vx;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mario.p.vx*vx<2)
|
||||
if (mario.p.vx*vx<4)
|
||||
mario.p.vx+=vx;
|
||||
|
||||
}
|
||||
if (keys[MK_RUN]==0)
|
||||
{
|
||||
if (mario.p.vx*vx>4)
|
||||
mario.p.vx-=vx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +196,10 @@ void mario_move()
|
|||
last_vx_sign=0;
|
||||
|
||||
if (mario.p.x+mario.p.vx<world_get_real_x0(mario.p.x))
|
||||
{
|
||||
mario.p.vx=0;
|
||||
mario.p.x=world_get_real_x0(mario.p.x);
|
||||
}
|
||||
|
||||
box_move(&mario.p); // <-> + gravity
|
||||
|
||||
|
|
|
@ -46,4 +46,7 @@ extern int id_frame;
|
|||
extern int mario_immunity;
|
||||
extern int mario_has_bullets;
|
||||
extern int last_vx_sign;
|
||||
|
||||
extern int mario_star_mode;
|
||||
|
||||
#endif
|
|
@ -33,7 +33,7 @@ void new_game()
|
|||
void new_level()
|
||||
{
|
||||
end_level=-1;
|
||||
time_left=300;
|
||||
time_left=400;
|
||||
time_id=0;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void score_display()
|
|||
dtext(50,0,str, C_BLACK, C_WHITE);
|
||||
|
||||
time_id++;
|
||||
if (time_id%10==0)
|
||||
if (time_id%8==0)
|
||||
time_left--;
|
||||
|
||||
sprintf(str, "TIME : %d", time_left);
|
||||
|
|
53
src/tile.c
53
src/tile.c
|
@ -1,50 +1,67 @@
|
|||
#include "tile.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
|
||||
int dark_theme=0;
|
||||
|
||||
extern image_t img_tuyau;
|
||||
tileset_t tuyau={&img_tuyau, 8, 8, 1};
|
||||
const tileset_t tuyau={&img_tuyau, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_brick;
|
||||
tileset_t brick={&img_brick, 8, 8, 1};
|
||||
const tileset_t brick={&img_brick, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_stone;
|
||||
tileset_t earth={&img_stone, 8, 8, 1};
|
||||
const tileset_t earth={&img_stone, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_gift;
|
||||
tileset_t gift={&img_gift, 8, 8, 1};
|
||||
const tileset_t gift={&img_gift, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_coin;
|
||||
tileset_t coin={&img_coin, 8, 8, 1};
|
||||
const tileset_t coin={&img_coin, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_nuage;
|
||||
tileset_t nuage={&img_nuage, 8, 8, 0};
|
||||
const tileset_t nuage={&img_nuage, TILE_W, TILE_H, 0};
|
||||
extern image_t img_buisson;
|
||||
tileset_t buisson={&img_buisson, 8, 8, 0};
|
||||
const tileset_t buisson={&img_buisson, TILE_W, TILE_H, 0};
|
||||
extern image_t img_colline;
|
||||
tileset_t colline={&img_colline, 8, 8, 0};
|
||||
const tileset_t colline={&img_colline, TILE_W, TILE_H, 0};
|
||||
|
||||
extern image_t img_bloc;
|
||||
tileset_t bloc={&img_bloc, 8, 8, 0};
|
||||
const tileset_t bloc={&img_bloc, TILE_W, TILE_H, 0};
|
||||
|
||||
extern image_t img_champi;
|
||||
tileset_t champi={&img_champi, 8, 8, 0};
|
||||
const tileset_t champi={&img_champi, TILE_W, TILE_H, 0};
|
||||
extern image_t img_1up;
|
||||
tileset_t life_1up={&img_1up, 8, 8, 0};
|
||||
const tileset_t life_1up={&img_1up, TILE_W, TILE_H, 0};
|
||||
|
||||
extern image_t img_fleur;
|
||||
tileset_t fleur={&img_fleur, 8, 8, 0};
|
||||
const tileset_t fleur={&img_fleur, TILE_W, TILE_H, 0};
|
||||
|
||||
extern image_t img_bullet;
|
||||
tileset_t bullet={&img_bullet, 4, 4, 1};
|
||||
const tileset_t bullet={&img_bullet, TILE_W/2, TILE_H/2, 1};
|
||||
|
||||
|
||||
extern image_t img_mariosmall;
|
||||
const tileset_t mario_small={&img_mariosmall, TILE_W, TILE_H, 1};
|
||||
|
||||
extern image_t img_mariobig;
|
||||
const tileset_t mario_big={&img_mariobig, TILE_W, 2*TILE_H, 1};
|
||||
|
||||
|
||||
void draw_tile(int sx, int sy, tileset_t const * const set, int x, int y)
|
||||
{
|
||||
dsubimage(sx, 64-sy-set->height,
|
||||
set->sheet,
|
||||
x*(set->width+set->padding), y*(set->height+set->padding),
|
||||
set->width,set->height,
|
||||
DIMAGE_NONE);
|
||||
// if (dark_theme==0)
|
||||
dsubimage(sx, 64-sy-set->height,
|
||||
set->sheet,
|
||||
x*(set->width+set->padding), y*(set->height+set->padding),
|
||||
set->width,set->height,
|
||||
DIMAGE_NONE);
|
||||
/* else
|
||||
dsubimage(sx, 64-sy-set->height,
|
||||
set->sheet_dark,
|
||||
x*(set->width+set->padding), y*(set->height+set->padding),
|
||||
set->width,set->height,
|
||||
DIMAGE_NONE);
|
||||
*/
|
||||
}
|
36
src/tile.h
36
src/tile.h
|
@ -1,8 +1,10 @@
|
|||
#ifndef TILE_H
|
||||
#define TILE_H
|
||||
#ifndef _TILE_H
|
||||
#define _TILE_H
|
||||
|
||||
#include <gint/display.h>
|
||||
|
||||
extern int dark_theme;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
image_t * sheet;
|
||||
|
@ -11,24 +13,26 @@ typedef struct
|
|||
int padding;
|
||||
} tileset_t;
|
||||
|
||||
extern tileset_t tuyau;
|
||||
extern tileset_t brick;
|
||||
extern tileset_t earth;
|
||||
extern tileset_t gift;
|
||||
extern tileset_t coin;
|
||||
extern tileset_t bloc;
|
||||
extern const tileset_t tuyau;
|
||||
extern const tileset_t brick;
|
||||
extern const tileset_t earth;
|
||||
extern const tileset_t gift;
|
||||
extern const tileset_t coin;
|
||||
extern const tileset_t bloc;
|
||||
extern const tileset_t nuage;
|
||||
extern const tileset_t buisson;
|
||||
extern const tileset_t colline;
|
||||
|
||||
extern tileset_t nuage;
|
||||
extern tileset_t buisson;
|
||||
extern tileset_t colline;
|
||||
extern const tileset_t champi;
|
||||
extern const tileset_t fleur;
|
||||
extern const tileset_t life_1up;
|
||||
|
||||
extern tileset_t champi;
|
||||
extern tileset_t fleur;
|
||||
extern tileset_t life_1up;
|
||||
extern const tileset_t bullet;
|
||||
|
||||
extern tileset_t bullet;
|
||||
extern const tileset_t bloc;
|
||||
|
||||
extern tileset_t bloc;
|
||||
extern const tileset_t mario_small;
|
||||
extern const tileset_t mario_big;
|
||||
|
||||
void draw_tile(int sx, int sy, tileset_t const * const set, int x, int y);
|
||||
|
||||
|
|
Loading…
Reference in New Issue