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

306
maps.h
View File

@ -1,136 +1,204 @@
#ifdef RELEASE #ifdef RELEASE
int etage = 0; int etage = 0;
#else #else
int etage = 8; int etage = 9;
#endif #endif
#define MAP_SIZE_MAX 15 #define MAP_SIZE_MAX 50
typedef char Map[MAP_SIZE_MAX][MAP_SIZE_MAX]; 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] = { Vec2i map_sizes[NB_ETAGE_TOTAL] = {
[0] = {9, 9}, [0] = {9, 9},
[1] = {9, 9}, [1] = {9, 9},
[2] = {9, 9}, [2] = {9, 9},
[3] = {9, 9}, [3] = {11, 13},
[4] = {9, 9}, [4] = {9, 9},
[5] = {9, 9}, [5] = {9, 9},
[6] = {9, 9}, [6] = {9, 9},
[7] = {9, 9}, [7] = {9, 9},
[8] = {9, 9}, [8] = {9, 9},
[9] = {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] = { Map maps[NB_ETAGE_TOTAL] = {
[0] = { [0] = {
{' ','P',' ',' ','M',' ',' ','B',' '}, {" P M B "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" S "},
}, },
[1] = { [1] = {
{' ','P',' ',' ',' ',' ',' ','B',' '}, {" P M B "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" S "},
}, },
[2] = { [2] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" P M B "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" S "},
}, },
[3] = { [3] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" B "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" MM MM "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M M "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" M M "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" M "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" M "},
{" M M "},
{" M "},
{" M "},
{" S M M P "},
}, },
[4] = { [4] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" OOOOO "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" O O "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {"P O S O B"},
}, },
[5] = { [5] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" OOOOOOO "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" OSOOOBO "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" OOOOOOO "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" OOOOOOO "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" OOOOOOO "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" OOOOOPO "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {" OOOOOOO "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" "},
}, },
[6] = { [6] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" B "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" A"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A A "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" A A"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A "},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {" M P"},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {" AS "},
{' ',' ',' ',' ',' ',' ',' ',' ',' '}, {"A A A A "},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {" A A A"},
}, },
[7] = { [7] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {"A O O A"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A O O B"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A O O A"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A O O A"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {"A O O A"},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {"A O O A"},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {"A O S O A"},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {"A O O A"},
{' ',' ',' ',' ','S',' ',' ',' ',' '}, {"A O P O A"},
}, },
[8] = { [8] = {
{'M','P',' ',' ','M',' ',' ','B',' '}, {" B"},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','M',' ',' ',' ',' '}, {" "},
{'M',' ','G',' ','M',' ','A',' ',' '}, {" S "},
{'M','O','O','O','O','O','O','O','O'}, {" "},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ',' ',' ',' ',' ',' '}, {" "},
{'M',' ',' ',' ','S',' ',' ',' ',' '}, {"P "},
}, },
[9] = { [9] = {
{'M','P',' ',' ','O',' ',' ','B',' '}, {"MP M B "},
{'M','M',' ',' ','M',' ',' ',' ',' '}, {"M M "},
{'M','M',' ',' ','M',' ',' ',' ',' '}, {"M M "},
{'M','M',' ',' ','M',' ',' ',' ',' '}, {"M M "},
{'M','M',' ',' ','M',' ',' ',' ',' '}, {"M M A "},
{'M','M',' ',' ',' ',' ',' ',' ',' '}, {"MOOOOOOOO"},
{'M','M',' ',' ',' ',' ',' ',' ',' '}, {"M "},
{'M','M',' ',' ',' ',' ',' ',' ',' '}, {"M "},
{'M','M',' ',' ','S',' ',' ',' ',' '}, {"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; int dead;
} Guard; } Guard;
#define MAX_GUARD_ETAGE 15 #define MAX_GUARD_ETAGE 10
typedef Guard Guards[MAX_GUARD_ETAGE]; typedef Guard Guards[MAX_GUARD_ETAGE];
Guards guards[NB_ETAGE_TOTAL] = { Guards guards[NB_ETAGE_TOTAL] = {
[1] = { [1] = {
{.start = {1,1}, .end = {1,5}}, {.start = {2,1}, .end = {2,5}},
{.start = {7,2}, .end = {7,6}},
}, },
[2] = { [2] = {
{.start = {2,0}, .end = {2,5}}, {.start = {6,5}, .end = {2,5}},
{.start = {3,1}, .end = {3,6}}, {.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] = { [7] = {
{.start = {3,2}, .end = {3,7}}, {.start = {1,0}, .end = {1,8}},
{.start = {7,8}, .end = {7,0}},
}, },
[8] = { [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 = {1,1}, .end = {1,4}},
{.start = {7,2}, .end = {7,4}}, {.start = {7,2}, .end = {7,4}},
}, },
[9] = { [10] = {
{.start = {3,6}, .end = {7,6}}, {.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}},
}, },
}; };