added hard reset option (reset room bit not player coords)
This commit is contained in:
parent
0ab04bb603
commit
b5e7357f66
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
44
src/main.c
44
src/main.c
|
@ -41,21 +41,16 @@ bool pPress = false;
|
||||||
unsigned int textures[16];
|
unsigned int textures[16];
|
||||||
|
|
||||||
bool paused = false;
|
bool paused = false;
|
||||||
|
bool hardReset = true;
|
||||||
|
|
||||||
|
double oldx, oldy, oldz;
|
||||||
|
int oldchx, oldchy;
|
||||||
void reset_everything(GLFWwindow *window, int count, char* folder) {
|
void reset_everything(GLFWwindow *window, int count, char* folder) {
|
||||||
/*hashtbl_free(visited);
|
oldx = camx;
|
||||||
free_proj();
|
oldy = camy;
|
||||||
free_interf();
|
oldz = camz;
|
||||||
free_pool();
|
oldchx = player_chx;
|
||||||
|
oldchy = player_chy;
|
||||||
init_csts();
|
|
||||||
init_hashtbl();
|
|
||||||
init_interf(window);
|
|
||||||
build_all_menus();
|
|
||||||
init_ent_generator(30);
|
|
||||||
init_proj();
|
|
||||||
parse_rooms(count, folder);
|
|
||||||
interface_set(-1);*/
|
|
||||||
|
|
||||||
camx = /*2*room_width*player_chx+*/0.0;
|
camx = /*2*room_width*player_chx+*/0.0;
|
||||||
camy = 5.0;
|
camy = 5.0;
|
||||||
|
@ -116,6 +111,16 @@ void reset_everything(GLFWwindow *window, int count, char* folder) {
|
||||||
generate_nearby_chunks(1);
|
generate_nearby_chunks(1);
|
||||||
|
|
||||||
printf("-------------------------------- Done 5 --------------------------------\n");
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void processInput(GLFWwindow *window, float dtime) {
|
void processInput(GLFWwindow *window, float dtime) {
|
||||||
|
@ -250,6 +255,19 @@ void processInput(GLFWwindow *window, float dtime) {
|
||||||
if(glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
|
if(glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
|
||||||
if(!isMenuOpen() && !rPress) {
|
if(!isMenuOpen() && !rPress) {
|
||||||
rPress = true;
|
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, 4, "levels/level_00/");
|
||||||
//reset_everything(window, 7, "levels/level_01/");
|
//reset_everything(window, 7, "levels/level_01/");
|
||||||
reset_everything(window, 1, "levels/level_02/");
|
reset_everything(window, 1, "levels/level_02/");
|
||||||
|
|
Loading…
Reference in New Issue