diff --git a/bin/back b/bin/back index 15ddbba..771d208 100755 Binary files a/bin/back and b/bin/back differ diff --git a/obj/display.o b/obj/display.o index ea7a77c..83d2b20 100644 Binary files a/obj/display.o and b/obj/display.o differ diff --git a/obj/main.o b/obj/main.o index fa655d6..2db11d0 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/obj/menus.o b/obj/menus.o index 16ddb7c..5b5e92d 100644 Binary files a/obj/menus.o and b/obj/menus.o differ diff --git a/res/selection-mod-doubletime.png b/res/selection-mod-doubletime.png new file mode 100644 index 0000000..5f23c09 Binary files /dev/null and b/res/selection-mod-doubletime.png differ diff --git a/res/selection-mod-flashlight.png b/res/selection-mod-flashlight.png new file mode 100644 index 0000000..a7c0ac0 Binary files /dev/null and b/res/selection-mod-flashlight.png differ diff --git a/res/selection-mod-hardrock.png b/res/selection-mod-hardrock.png new file mode 100644 index 0000000..e226aeb Binary files /dev/null and b/res/selection-mod-hardrock.png differ diff --git a/res/selection-mod-suddendeath.png b/res/selection-mod-suddendeath.png new file mode 100644 index 0000000..88c5572 Binary files /dev/null and b/res/selection-mod-suddendeath.png differ diff --git a/src/display.c b/src/display.c index 6aa6508..81d19ef 100644 --- a/src/display.c +++ b/src/display.c @@ -74,11 +74,6 @@ void gl_renderTriangle(unsigned int shaderProgram, unsigned int VAO, unsigned in double near = 0.0 ; double far = 10.0 ; -double top = 1.0 ; -double bottom = -1.0 ; -double left = -1.0 ; -double right = 1.0 ; - mat4 model, view, projection; mat4 scale; mat2 texShift; @@ -242,7 +237,7 @@ void gl_initRender(unsigned int shaderProgram, unsigned int fragmentShader, unsi glm_mat4_identity(view); glm_lookat((vec3){(float)camx, (float)camy, (float)camz}, direction, (vec3){0.0f, 1.0f, 0.0f}, view); - glm_perspective(glm_rad((float)fov), 1500.0f / 1000.0f, 0.1f, 100.0f, projection); + glm_perspective(glm_rad((float)fov), 1500.0f / 1000.0f, 0.1f, 100.0f*((float)bounding_mult), projection); loc_scale = glGetUniformLocation(shaderProgram, "scale"); loc_model = glGetUniformLocation(shaderProgram, "model"); diff --git a/src/main.c b/src/main.c index d1feffa..f3e0a09 100644 --- a/src/main.c +++ b/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #ifndef STB_IMAGE_IMPLEMENTATION @@ -34,8 +35,6 @@ int gamemode; int creativeWarpTarget; -static double time_dilation = 1.0; - char* newRoomName; int newRoomCount; bool switchRoom; @@ -59,6 +58,8 @@ int kodami[10] = {GLFW_KEY_UP, GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_DOWN, GLFW_K int kodid = 0; bool kodhit = false; +cube_0* modCube; + void reset_everything(GLFWwindow *window, int count, char* folder) { oldx = camx; oldy = camy; @@ -151,7 +152,7 @@ void processInput(GLFWwindow *window, float dtime) { } // kodami - if(!kodhit) { + if(!kodhit && is_SD == 0) { // no cheating with SD ! if(kodid == 10) { kodhit = true; player_hp += 1500; @@ -595,6 +596,11 @@ int main_alt() { generate_texture_2D(13, "res/tnt.png", PNG); generate_texture_2D(14, "res/minecraft_lava.jpg", JPG); + //generate_texture_2D(15, "res/selection-mod-doubletime.png", PNG); + //generate_texture_2D(16, "res/selection-mod-hardrock.png", PNG); + //generate_texture_2D(17, "res/selection-mod-flashlight.png", PNG); + //generate_texture_2D(18, "res/selection-mod-suddendeath.png", PNG); + printf("-----------------------------------------------------------------------------------------------\n"); fflush(stdout); // ---------------------------------------------------------------------------------------------------------------------------------------------- // @@ -686,6 +692,9 @@ int main_alt() { mathSignal = true; float calc_T = 0.0f; + vec3 md_dir0; + vec3 md_direction; + while(!glfwWindowShouldClose(window) && player_hp > 0) { gettimeofday(&ogn, NULL); // input @@ -711,6 +720,33 @@ int main_alt() { gl_renderProj(); //printf("4\n"); fflush(stdout); + /*if(is_DT + is_HR + is_FL >= 1) { + md_dir0[0] = sinf((float)(rot_hz)) * cosf((float)(rot_vt)); + md_dir0[1] = -sinf((float)(rot_vt)); + md_dir0[2] = cosf((float)(rot_hz)) * cosf((float)(rot_vt)); + + glm_vec3_normalize(md_dir0); // Normalize to unit length + glm_vec3_add((vec3){(float)camx, (float)camy, (float)camz}, md_dir0, md_direction); + + fill_cube_0(modCube, md_direction[0], md_direction[1], md_direction[2], 0.2f, 0.2f, 0.2f, -rot_hz, 0.0, 255, 255, 255); + + if(is_DT == 1) { + glBindTexture(GL_TEXTURE_2D, textures[15]); + gl_renderCube(modCube, 0.0, 0.0, 0.0); + modCube->y += 0.2; + } + if(is_HR == 1) { + glBindTexture(GL_TEXTURE_2D, textures[16]); + gl_renderCube(modCube, 0.0, 0.0, 0.0); + modCube->y += 0.2; + } + if(is_FL == 1) { + glBindTexture(GL_TEXTURE_2D, textures[17]); + gl_renderCube(modCube, 0.0, 0.0, 0.0); + modCube->y += 0.2; + } + }*/ + // draw data glUseProgram(shaderProgramR); glBindVertexArray(RVAO); @@ -763,6 +799,8 @@ int main_alt() { if(lastDmg != player_hp) { if(lastDmg > player_hp) { dmgCD = 0.5f; + int taken = lastDmg - player_hp; + player_hp -= taken*((int)(damage_scaling-1.0)); } lastDmg = player_hp; } @@ -820,6 +858,7 @@ int main(int argc, char** argv) { switchRoom = false; newRoomName = "templates/"; creativeWarpTarget = 0; + modCube = malloc(sizeof(cube_0)); //play_sound("sound/audio/tetris_2.wav"); //tstst(); return main_alt(); diff --git a/src/menus.c b/src/menus.c index 93fb3c3..5a60d5c 100644 --- a/src/menus.c +++ b/src/menus.c @@ -24,6 +24,15 @@ float incr; int creativeIntID; +int is_DT = 0; +int is_HR = 0; +int is_FL = 0; +int is_SD = 0; + +double time_dilation = 1.0; +double damage_scaling = 1.0; +double bounding_mult = 1.0; + static mat4 scale, slide; void initMenus() { rectDefault[0] = -0.5f; rectDefault[1] = -0.5f; rectDefault[2] = -0.99f; @@ -837,19 +846,23 @@ int button_ok; int button_pay; int welcome_start_i, settings_i; +int modMenu_i; void build_all_menus() { init_math_interfaces(); creativeIntID = build_creative_warp(); + modMenu_i = build_mod_menu(); welcome_start_i = interface_create("Welcome", 255, 255, 255, -0.4f, 0.7f, 0.8f, 0.25f); settings_i = interface_create("Settings", 128, 128, 128, -0.4f, 0.7f, 0.8f, 0.25f); - int welcome_start_go = button_create_onoff("start", 0, 255, 255, -0.25f, 0.05f, 0.5f, 0.3f, EXIT, NULL, 0.0, 0.0, INT, NULL, NULL); - int welcome_start_settings = button_create_onoff("config", 96, 96, 96 , -0.25f, -0.35f, 0.5f, 0.3f, WARP, &settings_i, 0.0, 0.0, INT, NULL, NULL); - int welcome_start_math = button_create_onoff("math config", 64, 64, 255, -0.25f, -0.75f, 0.5f, 0.3f, WARP, &mthInterface, 0.0, 0.0, INT, NULL, NULL); + int welcome_start_go = button_create_onoff("start", 0, 255, 255, -0.25f, 0.25f, 0.5f, 0.22f, EXIT, NULL, 0.0, 0.0, INT, NULL, NULL); + int welcome_start_settings = button_create_onoff("config", 96, 96, 96 , -0.25f, -0.05f, 0.5f, 0.22f, WARP, &settings_i, 0.0, 0.0, INT, NULL, NULL); + int welcome_start_mods = button_create_onoff("mods", 255, 96, 96, -0.25f, -0.35f, 0.5f, 0.22f, WARP, &modMenu_i, 0.0, 0.0, INT, NULL, NULL); + int welcome_start_math = button_create_onoff("math config", 64, 64, 255, -0.25f, -0.65f, 0.5f, 0.22f, WARP, &mthInterface, 0.0, 0.0, INT, NULL, NULL); interface_link_button(welcome_start_i, welcome_start_go); interface_link_button(welcome_start_i, welcome_start_settings); + interface_link_button(welcome_start_i, welcome_start_mods); interface_link_button(welcome_start_i, welcome_start_math); int settings_speed = button_create_onoff("speed", 0, 192, 192, -0.25f, 0.2f, 0.5f, 0.3f, SET_VAR, &speed, 0.1, 20.0, DOUBLE, NULL, NULL); @@ -897,4 +910,43 @@ int build_creative_warp() { interface_link_button(intid, warpGTFO); return intid; +} + +/* +int is_DT = 0; +int is_HR = 0; +int is_FL = 0; + +double time_dilation = 1.0; +double damage_scaling = 1.0; +double bounding_mult = 1.0; +*/ + +void update_values(void* arg) { + time_dilation = 1.0+0.5*(is_DT==1); + damage_scaling = 1.0+8.0*(is_HR==1); + bounding_mult = 1.0-0.93*(is_FL==1); + if(is_SD) { + player_hp = 1; + } else { + player_hp = 1000; + } +} + +int build_mod_menu() { + int modMenuId = interface_create("mods", 200, 200, 200, -1.0, 0.7, 2.0, 0.3); + + int btnDT = button_create_onoff("double time", 96,210,210, -0.25f, 0.25f, 0.5f, 0.2f, SET_VAR, &is_DT, 0, 1, INT, NULL, NULL); + int btnHR = button_create_onoff("hard rock", 210, 96, 96, -0.25f, -0.05f, 0.5f, 0.2f, SET_VAR, &is_HR, 0, 1, INT, NULL, NULL); + int btnFL = button_create_onoff("flashlight", 32, 32, 32, -0.25f, -0.35f, 0.5f, 0.2f, SET_VAR, &is_FL, 0, 1, INT, NULL, NULL); + int btnSD = button_create_onoff("sudden death",210,210,32, -0.25f, -0.65f, 0.5f, 0.2f, SET_VAR, &is_SD, 0, 1, INT, NULL, NULL); + int exit = button_create_onoff("exit", 128, 128, 128, -0.25f, -0.95f, 0.5f, 0.2f, WARP, &welcome_start_i, 0, 1, INT, update_values, NULL); + + interface_link_button(modMenuId, btnDT); + interface_link_button(modMenuId, btnHR); + interface_link_button(modMenuId, btnFL); + interface_link_button(modMenuId, btnSD); + interface_link_button(modMenuId, exit); + + return modMenuId; } \ No newline at end of file diff --git a/src/menus.h b/src/menus.h index ee9c423..52c3310 100644 --- a/src/menus.h +++ b/src/menus.h @@ -70,5 +70,6 @@ int build_text_box(char* msg, int red, int green, int blue); int build_lock_box(char* msg, int red, int green, int blue); int build_creative_warp(); +int build_mod_menu(); #endif \ No newline at end of file diff --git a/src/structure.h b/src/structure.h index 3c43872..a45d87b 100644 --- a/src/structure.h +++ b/src/structure.h @@ -207,4 +207,9 @@ extern mathRes mathResult; extern int creativeWarpTarget; extern int creativeIntID; +extern double time_dilation; extern int is_DT; +extern double damage_scaling; extern int is_HR; +extern double bounding_mult; extern int is_FL; +extern int is_SD; + #endif \ No newline at end of file