diff --git a/README.md b/README.md index 049c379..1f1d507 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,16 @@ - while in menus: when editing a value : **A** (add), **S** (subtract), **M** (multiply), **D** (divide), **ENTER/SPACE** (proceed) +# --| Mods (in case you find it easy) |-- + +*Hidden* (HD) : makes the terrain blink to be totally invisible sometimes +*HardRock* (HR) : multiplies damage taken, enables fall damage and kills you upon falling in the void +*DoubleTime* (DT) : makes everything faster +*SuddenDeath* (SD) : sets your HP at 1 and disables healing +*Flashlight* (FL) : drastically lowers your view distance +*Speedy* (SP) : makes you lose HP over time +*Flip* (FP) : flips the screen over the Y axis, inverting some directions + # --| Syntax for level files |-- 1) **General rules** diff --git a/bin/back b/bin/back index e925c87..1169b55 100755 Binary files a/bin/back and b/bin/back differ diff --git a/levels/level_03/room_0 b/levels/level_03/room_0 index 375512f..98c1bd2 100644 --- a/levels/level_03/room_0 +++ b/levels/level_03/room_0 @@ -19,7 +19,7 @@ Blocks: Entities: -[-4.0, 4.0, -0.5, 4.0, 1.0, 5.0, 0.0, 0.0, 255, 255, 255, 1, 0, 2, 0.0, 30.0, 0.0, 0.0, 2.0, 1] +[-4.0, 4.0, -0.5, 4.0, 1.0, 5.0, 0.0, 0.0, 255, 255, 255, 1, 0, 2, 0.0, 25.0, 0.0, 0.0, 2.0, 0] [-16.0, 0.0, -16.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 192, 1, 0, 6, yeet, 255, 255, 255] [12.0, 0.0, 12.0, 4.0, 4.0, 4.0, 0.0, 0.0, 255, 255, 255, 1, 0, 8, 200, 1, 64, 64, 64] diff --git a/obj/display.o b/obj/display.o index 1e30822..aeb7ba7 100644 Binary files a/obj/display.o and b/obj/display.o differ diff --git a/obj/main.o b/obj/main.o index 09401d0..d22b9a3 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/obj/menus.o b/obj/menus.o index 1ccf337..3d9da77 100644 Binary files a/obj/menus.o and b/obj/menus.o differ diff --git a/obj/move.o b/obj/move.o index ec193d9..42171a9 100644 Binary files a/obj/move.o and b/obj/move.o differ diff --git a/src/display.c b/src/display.c index f75d47f..0f844ab 100644 --- a/src/display.c +++ b/src/display.c @@ -238,7 +238,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*((float)bounding_mult), projection); + glm_perspective((1.0f - 2.0f*(is_FP==1))*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 11dc22f..7c64d8f 100644 --- a/src/main.c +++ b/src/main.c @@ -670,6 +670,8 @@ int main_alt() { // ---------------------------------------------------------------------------------------------------------------------------------------------- // fffff = shaderProgram; + double oldtime = 0.0; + int fps = 60; int interval = 1000000/fps; float interval_s = 1.0f/fps; @@ -767,7 +769,8 @@ int main_alt() { gettimeofday(&fnn, NULL); calc_T = (float)((fnn.tv_sec-ogn.tv_sec + (fnn.tv_usec-ogn.tv_usec)/1000000.0f)); usleep(max(0, interval-(int)(1000000*calc_T))); - sim_time += interval_s + maxd(0.0, (double)(-interval_s+(calc_T))); + oldtime = sim_time; + sim_time += (interval_s + maxd(0.0, (double)(-interval_s+(calc_T))))*time_dilation; dmgCD = maxf(dmgCD - delta*time_dilation, 0.0f); if(lastDmg != player_hp) { @@ -775,9 +778,15 @@ int main_alt() { dmgCD = 0.5f; int taken = lastDmg - player_hp; player_hp -= taken*((int)(damage_scaling-1.0)); + } else if(is_SD) { + player_hp = lastDmg; } lastDmg = player_hp; } + if(!isinmenu && (int)(sim_time*SP_decay) != (int)(oldtime*SP_decay)) { + player_hp -= 1; + } + lastDmg = player_hp; delta = (float)(interval_s + maxf(0.0f, -interval_s+(calc_T))); if(count%(fps/10)==0) { real_T = (float)((fnn.tv_sec-ogn.tv_sec + (fnn.tv_usec-ogn.tv_usec)/1000000.0f)); diff --git a/src/menus.c b/src/menus.c index eb16ea5..3c5e33e 100644 --- a/src/menus.c +++ b/src/menus.c @@ -29,6 +29,8 @@ int is_HR = 0; int is_FL = 0; int is_SD = 0; int is_HD = 0; +int is_SP = 0; +int is_FP = 0; int modCount = 0; @@ -36,6 +38,7 @@ double time_dilation = 1.0; double damage_scaling = 1.0; double bounding_mult = 1.0; double HD_mult = 1.0; +double SP_decay = 0.0; char* modString; @@ -935,14 +938,15 @@ double bounding_mult = 1.0; void update_values(void* arg) { time_dilation = 1.0+0.5*(is_DT==1); damage_scaling = 1.0+5.0*(is_HR==1); - bounding_mult = 1.0-0.93*(is_FL==1); + bounding_mult = 1.0-0.945*(is_FL==1); HD_mult = 1.0-0.95*(is_HD==1); + SP_decay = 0.0 + 1.8*(is_SP==1); if(is_SD) { player_hp = 1; } else { player_hp = 1000; } - modCount = is_DT+is_HR+is_HD+is_SD+is_FL; + modCount = is_DT+is_HR+is_HD+is_SD+is_FL+is_SP+is_FP; int i = 0; if(modCount != 0) { @@ -969,17 +973,27 @@ void update_values(void* arg) { modString[i] = 'F'; i += 1; modString[i] = 'L'; i += 1; } + if(is_SP) { + modString[i] = 'S'; i += 1; + modString[i] = 'P'; i += 1; + } + if(is_FP) { + modString[i] = 'F'; i += 1; + modString[i] = 'P'; i += 1; + } modString[i] = '\0'; } int build_mod_menu() { int modMenuId = interface_create("mods", 200, 200, 200, -1.0, 0.7, 2.0, 0.3); - int btnHD = button_create_onoff("hidden", 255,255,0, -0.2f, 0.3f , 0.4f, 0.2f, SET_VAR, &is_HD, 0, 1, INT, NULL, NULL); - int btnDT = button_create_onoff("double time", 96,210,210, -0.2f, 0.05f, 0.4f, 0.2f, SET_VAR, &is_DT, 0, 1, INT, NULL, NULL); - int btnHR = button_create_onoff("hard rock", 210, 96, 96, -0.2f, -0.2f , 0.4f, 0.2f, SET_VAR, &is_HR, 0, 1, INT, NULL, NULL); - int btnFL = button_create_onoff("flashlight", 32, 32, 32, -0.2f, -0.45f, 0.4f, 0.2f, SET_VAR, &is_FL, 0, 1, INT, NULL, NULL); - int btnSD = button_create_onoff("sudden death",210,210,32, -0.2f, -0.7f , 0.4f, 0.2f, SET_VAR, &is_SD, 0, 1, INT, NULL, NULL); + int btnHD = button_create_onoff("hidden", 255,255,0, -0.5f, 0.3f , 0.4f, 0.2f, SET_VAR, &is_HD, 0, 1, INT, NULL, NULL); + int btnDT = button_create_onoff("double time", 96,210,210, -0.5f, 0.0f , 0.4f, 0.2f, SET_VAR, &is_DT, 0, 1, INT, NULL, NULL); + int btnHR = button_create_onoff("hard rock", 210, 96, 96, -0.5f, -0.3f , 0.4f, 0.2f, SET_VAR, &is_HR, 0, 1, INT, NULL, NULL); + int btnFL = button_create_onoff("flashlight", 32, 32, 32, 0.1f, 0.3f , 0.4f, 0.2f, SET_VAR, &is_FL, 0, 1, INT, NULL, NULL); + int btnSD = button_create_onoff("sudden death",210,210,32, 0.1f, 0.0f , 0.4f, 0.2f, SET_VAR, &is_SD, 0, 1, INT, NULL, NULL); + int btnSP = button_create_onoff("speedrun" ,255,128,32, 0.1f, -0.3f , 0.4f, 0.2f, SET_VAR, &is_SP, 0, 1, INT, NULL, NULL); + int btnFP = button_create_onoff("flip" ,32,128,255, 0.1f, -0.6f , 0.4f, 0.2f, SET_VAR, &is_FP, 0, 1, INT, NULL, NULL); int exit = button_create_onoff("exit", 128, 128, 128, -0.2f, -0.95f, 0.4f, 0.2f, WARP, &welcome_start_i, 0, 1, INT, update_values, NULL); interface_link_button(modMenuId, btnHD); @@ -987,6 +1001,8 @@ int build_mod_menu() { interface_link_button(modMenuId, btnHR); interface_link_button(modMenuId, btnFL); interface_link_button(modMenuId, btnSD); + interface_link_button(modMenuId, btnSP); + interface_link_button(modMenuId, btnFP); interface_link_button(modMenuId, exit); return modMenuId; diff --git a/src/move.c b/src/move.c index f5bbe34..79a5d39 100644 --- a/src/move.c +++ b/src/move.c @@ -492,7 +492,7 @@ void movePlayerG(float dtime) { //printf("%lf | %lf | %lf\n\n", camvx, camvy, camvz); if(isfalling && camvy > 0.0) { njumps = 1; - printf("%lf\n", absf(oldvy)); + //printf("%lf\n", absf(oldvy)); if(is_HR==1 && absf(oldvy) >= 15.0) { player_hp -= (int)(0.75*absf(oldvy)); } diff --git a/src/structure.h b/src/structure.h index f113977..befa908 100644 --- a/src/structure.h +++ b/src/structure.h @@ -211,6 +211,8 @@ 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 double HD_mult; extern int is_HD; +extern double SP_decay; extern int is_SP; +extern int is_FP; extern int is_SD; extern int modCount;