This commit is contained in:
nemo 2025-06-07 13:17:02 +02:00
parent bca7827e1e
commit 3854821657
2 changed files with 207 additions and 105 deletions

6
main.c
View File

@ -22,7 +22,7 @@ typedef struct Shot {
#ifdef RELEASE
Vector2 window = {1920, 1080};
#else
Vector2 window = {600, 600};
Vector2 window = {900, 800};
#endif
#ifdef RELEASE
int in_menu = 1;
@ -453,14 +453,14 @@ int main(void)
continue;
}
if (alarme_sonne > 0) {
if (alarme_sonne > 0 && etage < NB_ETAGE_TOTAL) {
alarme_sonne -= GetFrameTime();
load_map(&map, &map_size, etage); // NOTE: memcpy pendant 1.2s mais flemme
draw_alarme_lose();
continue;
}
if (player_dead > 0) {
if (player_dead > 0 && etage < NB_ETAGE_TOTAL) {
player_dead -= GetFrameTime();
load_map(&map, &map_size, etage); // NOTE: memcpy pendant 1.2s mais flemme
draw_lose();

306
maps.h
View File

@ -1,136 +1,204 @@
#ifdef RELEASE
int etage = 0;
#else
int etage = 8;
int etage = 9;
#endif
#define MAP_SIZE_MAX 15
#define MAP_SIZE_MAX 50
typedef char Map[MAP_SIZE_MAX][MAP_SIZE_MAX];
#define NB_ETAGE_TOTAL 10
#define NB_ETAGE_TOTAL 15
Vec2i map_sizes[NB_ETAGE_TOTAL] = {
[0] = {9, 9},
[1] = {9, 9},
[2] = {9, 9},
[3] = {9, 9},
[3] = {11, 13},
[4] = {9, 9},
[5] = {9, 9},
[6] = {9, 9},
[7] = {9, 9},
[8] = {9, 9},
[9] = {9, 9},
[10] = {15, 9},
[11] = {8, 9},
[12] = {9, 10},
[13] = {13, 9},
[14] = {9, 12},
};
Map maps[NB_ETAGE_TOTAL] = {
[0] = {
{' ','P',' ',' ','M',' ',' ','B',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" P M B "},
{" M "},
{" M "},
{" M "},
{" M "},
{" "},
{" "},
{" "},
{" S "},
},
[1] = {
{' ','P',' ',' ',' ',' ',' ','B',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" P M B "},
{" M "},
{" M "},
{" "},
{" "},
{" "},
{" "},
{" "},
{" S "},
},
[2] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" P M B "},
{" M "},
{" M "},
{" "},
{" "},
{" "},
{" "},
{" "},
{" S "},
},
[3] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" B "},
{" "},
{" MM MM "},
{" M M "},
{" M "},
{" M "},
{" M M "},
{" M "},
{" M "},
{" M M "},
{" M "},
{" M "},
{" S M M P "},
},
[4] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" "},
{" "},
{" "},
{" "},
{" "},
{" "},
{" OOOOO "},
{" O O "},
{"P O S O B"},
},
[5] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" "},
{" OOOOOOO "},
{" OSOOOBO "},
{" OOOOOOO "},
{" OOOOOOO "},
{" OOOOOOO "},
{" OOOOOPO "},
{" OOOOOOO "},
{" "},
},
[6] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{" B "},
{" A"},
{"A A "},
{" A A"},
{"A "},
{" M P"},
{" AS "},
{"A A A A "},
{" A A A"},
},
[7] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ','S',' ',' ',' ',' '},
{"A O O A"},
{"A O O B"},
{"A O O A"},
{"A O O A"},
{"A O O A"},
{"A O O A"},
{"A O S O A"},
{"A O O A"},
{"A O P O A"},
},
[8] = {
{'M','P',' ',' ','M',' ',' ','B',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ',' ',' ','M',' ',' ',' ',' '},
{'M',' ','G',' ','M',' ','A',' ',' '},
{'M','O','O','O','O','O','O','O','O'},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{'M',' ',' ',' ',' ',' ',' ',' ',' '},
{'M',' ',' ',' ','S',' ',' ',' ',' '},
{" B"},
{" "},
{" "},
{" "},
{" S "},
{" "},
{" "},
{" "},
{"P "},
},
[9] = {
{'M','P',' ',' ','O',' ',' ','B',' '},
{'M','M',' ',' ','M',' ',' ',' ',' '},
{'M','M',' ',' ','M',' ',' ',' ',' '},
{'M','M',' ',' ','M',' ',' ',' ',' '},
{'M','M',' ',' ','M',' ',' ',' ',' '},
{'M','M',' ',' ',' ',' ',' ',' ',' '},
{'M','M',' ',' ',' ',' ',' ',' ',' '},
{'M','M',' ',' ',' ',' ',' ',' ',' '},
{'M','M',' ',' ','S',' ',' ',' ',' '},
{"MP M B "},
{"M M "},
{"M M "},
{"M M "},
{"M M A "},
{"MOOOOOOOO"},
{"M "},
{"M "},
{"M S "},
},
[10] = {
{"P B O O A"},
{" O O O O "},
{"MMMMMMMMMMMMM "},
{" O O "},
{" O O O "},
{" MMMMMMMMMMMOM"},
{"A O "},
{" O O O "},
{"MMMMMMMMMMMMM S"},
},
[11] = {
{" OO "},
{" OP O "},
{" O O "},
{" O O "},
{" O O "},
{" OO OO "},
{"O O"},
{"OB OO SO"},
{" OO OO "},
},
[12] = {
{" OO OO "},
{" OP O BO "},
{"O O O"},
{"O O"},
{"O O"},
{" O O "},
{" O O "},
{" O O "},
{" OSO "},
{" O "},
},
[13] = {
{" O P"},
{" O "},
{" O "},
{" O "},
{" O "},
{" O "},
{" O "},
{" O "},
{"B O S"},
},
[14] = {
{" GG GGB"},
{"G G "},
{"G GG G GG"},
{"G G G G"},
{" GG GG "},
{" "},
{" S "},
{" GG GG "},
{"G G "},
{"G GG G GG"},
{"G G G G"},
{"PGG GG "},
},
};
@ -154,26 +222,60 @@ typedef struct Guard {
int dead;
} Guard;
#define MAX_GUARD_ETAGE 15
#define MAX_GUARD_ETAGE 10
typedef Guard Guards[MAX_GUARD_ETAGE];
Guards guards[NB_ETAGE_TOTAL] = {
[1] = {
{.start = {1,1}, .end = {1,5}},
{.start = {7,2}, .end = {7,6}},
{.start = {2,1}, .end = {2,5}},
},
[2] = {
{.start = {2,0}, .end = {2,5}},
{.start = {3,1}, .end = {3,6}},
{.start = {6,5}, .end = {2,5}},
{.start = {6,7}, .end = {2,7}},
},
[3] = {
{.start = {5,3}, .end = {5,5}},
{.start = {5,6}, .end = {5,8}},
{.start = {5,9}, .end = {5,11}},
},
[4] = {
{.start = {2,4}, .end = {6,4}},
},
[5] = {
{.start = {0,0}, .end = {7,0}},
{.start = {8,0}, .end = {8,7}},
{.start = {8,8}, .end = {1,8}},
{.start = {0,8}, .end = {0,1}},
},
[7] = {
{.start = {3,2}, .end = {3,7}},
{.start = {1,0}, .end = {1,8}},
{.start = {7,8}, .end = {7,0}},
},
[8] = {
{.start = {1,1}, .end = {5,1}},
{.start = {7,1}, .end = {7,5}},
{.start = {7,7}, .end = {3,7}},
{.start = {1,7}, .end = {1,3}},
},
[9] = {
{.start = {1,1}, .end = {1,4}},
{.start = {7,2}, .end = {7,4}},
},
[9] = {
{.start = {3,6}, .end = {7,6}},
[10] = {
{.start = {12,6}, .end = {14,6}},
{.start = {1,3}, .end = {1,7}},
{.start = {13,0}, .end = {13,4}},
},
[13] = {
{.start = {0,0}, .end = {9,0}},
{.start = {1,1}, .end = {9,1}},
{.start = {2,2}, .end = {9,2}},
{.start = {3,3}, .end = {9,3}},
{.start = {4,4}, .end = {9,4}},
{.start = {5,5}, .end = {9,5}},
{.start = {6,6}, .end = {9,6}},
{.start = {7,7}, .end = {9,7}},
{.start = {8,8}, .end = {9,8}},
{.start = {9,9}, .end = {9,9}},
},
};