Compare commits
2 Commits
0ab04bb603
...
7bb62ba808
Author | SHA1 | Date |
---|---|---|
|
7bb62ba808 | |
|
b5e7357f66 |
|
@ -1,8 +1,11 @@
|
|||
# --| Syntax for level files |--
|
||||
|
||||
1) **General rule**
|
||||
each file must be named "room_k" where k is a positive integer
|
||||
if "room_k" exists then all "room_u" where 0 <= u < k exists
|
||||
1) **General rules**
|
||||
. each file must be named "room_k" where k is a positive integer
|
||||
if "room_k" exists then all "room_u" where 0 <= u < k exists
|
||||
|
||||
. you can add text at the end of each line as comments
|
||||
but *do not use caps*, *this might confuse the parser*
|
||||
|
||||
2) **Data structure**
|
||||
below is a detailled list for all block types ;
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
Blocks :
|
||||
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
|
||||
[-4.0, 10.0, 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]
|
||||
[-4.0, 10.0, 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192] // cp1
|
||||
[-4.0, 20.0, 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192] // cp2
|
||||
|
||||
Entities:
|
||||
[-2.0, 1.0 , -2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 128, 1, 0, 8, 100, 1, 128, 128, 128]
|
||||
[-1.5, 1.5 , -1.5, 1.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192, 1, 0, 7, levels/level_01/, 7, great, 192, 192, 192]
|
||||
[-8.0, 0.0, -8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 1]
|
||||
|
||||
[-3.5, 13.0, 0.5, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 10, 0, 0] // cp1 coin
|
||||
[-3.5, 23.0, 0.5, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 10, 0, 0] // cp2 coin
|
||||
|
||||
[-8.0, 0.0, -8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 1] // section 1 (beat)
|
||||
[-6.0, 2.0, -8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 1]
|
||||
[-4.0, 4.0, -8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 0]
|
||||
[-4.0, 6.0, -6.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 0]
|
||||
[-4.0, 8.0, -4.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 1]
|
||||
[-4.0, 10.0, -2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 2.0, 2.0, 1]
|
||||
[-4.0, 11.0, 7.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 0.0, 5.0, 0.0, 0.0, 5.0]
|
||||
|
||||
[-4.0, 11.0, 7.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 0.0, 5.0, 0.0, 0.0, 5.0] // section 2 (lines)
|
||||
[ 1.0, 11.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 5.0, 0.0, 0.0, -5.0, 0.0, 0.0]
|
||||
[ 8.0, 16.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 5.0, 0.0, 0.0, 5.0, 4.0]
|
||||
[-4.0, 21.0, 7.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 0.0, 5.0, 0.0, 0.0, -5.0]
|
||||
[ 1.0, 21.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 5.0, 0.0, 0.0, 5.0, 0.0, 0.0]
|
||||
|
||||
Weight :
|
||||
0
|
||||
|
|
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
47
src/main.c
47
src/main.c
|
@ -41,21 +41,16 @@ bool pPress = false;
|
|||
unsigned int textures[16];
|
||||
|
||||
bool paused = false;
|
||||
bool hardReset = true;
|
||||
|
||||
double oldx, oldy, oldz;
|
||||
int oldchx, oldchy;
|
||||
void reset_everything(GLFWwindow *window, int count, char* folder) {
|
||||
/*hashtbl_free(visited);
|
||||
free_proj();
|
||||
free_interf();
|
||||
free_pool();
|
||||
|
||||
init_csts();
|
||||
init_hashtbl();
|
||||
init_interf(window);
|
||||
build_all_menus();
|
||||
init_ent_generator(30);
|
||||
init_proj();
|
||||
parse_rooms(count, folder);
|
||||
interface_set(-1);*/
|
||||
oldx = camx;
|
||||
oldy = camy;
|
||||
oldz = camz;
|
||||
oldchx = player_chx;
|
||||
oldchy = player_chy;
|
||||
|
||||
camx = /*2*room_width*player_chx+*/0.0;
|
||||
camy = 5.0;
|
||||
|
@ -116,6 +111,19 @@ void reset_everything(GLFWwindow *window, int count, char* folder) {
|
|||
generate_nearby_chunks(1);
|
||||
|
||||
printf("-------------------------------- Done 5 --------------------------------\n");
|
||||
|
||||
if(!hardReset) {
|
||||
camx = oldx;
|
||||
camy = oldy;
|
||||
camz = oldz;
|
||||
player_chx = oldchx;
|
||||
player_chy = oldchy;
|
||||
generate_nearby_chunks(1);
|
||||
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
||||
if(current_room == NULL) {
|
||||
current_room = hashtbl_find_opt(visited, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void processInput(GLFWwindow *window, float dtime) {
|
||||
|
@ -250,6 +258,19 @@ void processInput(GLFWwindow *window, float dtime) {
|
|||
if(glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
|
||||
if(!isMenuOpen() && !rPress) {
|
||||
rPress = true;
|
||||
hardReset = true;
|
||||
//reset_everything(window, 4, "levels/level_00/");
|
||||
//reset_everything(window, 7, "levels/level_01/");
|
||||
reset_everything(window, 1, "levels/level_02/");
|
||||
}
|
||||
} else {
|
||||
rPress = false;
|
||||
}
|
||||
|
||||
if(glfwGetKey(window, GLFW_KEY_T) == GLFW_PRESS) {
|
||||
if(!isMenuOpen() && !rPress) {
|
||||
rPress = true;
|
||||
hardReset = false;
|
||||
//reset_everything(window, 4, "levels/level_00/");
|
||||
//reset_everything(window, 7, "levels/level_01/");
|
||||
reset_everything(window, 1, "levels/level_02/");
|
||||
|
|
Loading…
Reference in New Issue