added +HD, display used mods while in-game and adjusted HR damage multiplier

This commit is contained in:
Alexandre 2025-03-17 22:46:04 +01:00
parent 530d0e1283
commit 20ab6624ea
12 changed files with 67 additions and 35 deletions

BIN
bin/back

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -143,7 +143,8 @@ void gl_renderCube(cube_0* c, double offx, double offy, double offz) {
glUniformMatrix4fv(loc_view, 1, GL_FALSE, (float*)view); glUniformMatrix4fv(loc_view, 1, GL_FALSE, (float*)view);
glUniformMatrix4fv(loc_proj, 1, GL_FALSE, (float*)projection); glUniformMatrix4fv(loc_proj, 1, GL_FALSE, (float*)projection);
glUniform4f(loc_frag, c->red/255.0f, c->green/255.0f, c->blue/255.0f, 1.0f); glUniform4f(loc_frag, c->red/255.0f, c->green/255.0f, c->blue/255.0f, 1.0f*((float)HD_mult)+(is_HD==1)*0.05f*((float)sin(sim_time*2.0)));
//glUniform4f(loc_frag, c->red/255.0f, c->green/255.0f, c->blue/255.0f, 1.0f);
glUniformMatrix2fv(loc_tex_tr, 1, GL_FALSE, (float*)texShift); glUniformMatrix2fv(loc_tex_tr, 1, GL_FALSE, (float*)texShift);
glDrawArrays(GL_TRIANGLES, 0, 36); glDrawArrays(GL_TRIANGLES, 0, 36);

View File

@ -725,6 +725,7 @@ void parse_one_room(int id, char* filename) {
int freq = read_int(ptr); int freq = read_int(ptr);
pool[id].area->ents[k]->metai1 = freq; pool[id].area->ents[k]->metai1 = freq;
pool[id].area->ents[k]->metai2 = 0;
} else if(entry->id == 15) { } else if(entry->id == 15) {
// gun // gun
double vx = read_float(ptr); double vx = read_float(ptr);

View File

@ -720,33 +720,6 @@ int main_alt() {
gl_renderProj(); gl_renderProj();
//printf("4\n"); fflush(stdout); //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 // draw data
glUseProgram(shaderProgramR); glUseProgram(shaderProgramR);
glBindVertexArray(RVAO); glBindVertexArray(RVAO);
@ -754,6 +727,7 @@ int main_alt() {
gl_drawInteger(shaderProgramR, (int)(1.0f/(real_T)), 0.0f, -0.92f, 0.05, 32, 255, 32, 0.005, -1); gl_drawInteger(shaderProgramR, (int)(1.0f/(real_T)), 0.0f, -0.92f, 0.05, 32, 255, 32, 0.005, -1);
gl_drawInteger(shaderProgramR, triCount, 0.0f, 0.92f, 0.04f, 128, 128, 128, 0.005f, 1); gl_drawInteger(shaderProgramR, triCount, 0.0f, 0.92f, 0.04f, 128, 128, 128, 0.005f, 1);
gl_drawData(shaderProgramR); gl_drawData(shaderProgramR);
gl_drawString(shaderProgramR, modString, -0.9f, -0.9f, 0.04f, 255, 255, 255, 0.004f, 1);
//dpstst(shaderProgramR); //dpstst(shaderProgramR);

View File

@ -28,10 +28,16 @@ int is_DT = 0;
int is_HR = 0; int is_HR = 0;
int is_FL = 0; int is_FL = 0;
int is_SD = 0; int is_SD = 0;
int is_HD = 0;
int modCount = 0;
double time_dilation = 1.0; double time_dilation = 1.0;
double damage_scaling = 1.0; double damage_scaling = 1.0;
double bounding_mult = 1.0; double bounding_mult = 1.0;
double HD_mult = 1.0;
char* modString;
static mat4 scale, slide; static mat4 scale, slide;
void initMenus() { void initMenus() {
@ -44,6 +50,9 @@ void initMenus() {
rectDefault[15] = 0.5f; rectDefault[16] = -0.5f; rectDefault[17] = -0.99f; rectDefault[15] = 0.5f; rectDefault[16] = -0.5f; rectDefault[17] = -0.99f;
incr = 0.0f; incr = 0.0f;
modString = malloc(sizeof(char)*30);
modString[0] = '\0';
} }
void gl_drawRect(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b) { void gl_drawRect(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b) {
@ -407,6 +416,7 @@ void gl_drawString(unsigned int fragShader, char* str, float x, float y, float s
int i = len-1; int i = len-1;
while(i >= 0) { while(i >= 0) {
gl_drawChar(fragShader, c, curx, y, size, r, g, b, width); gl_drawChar(fragShader, c, curx, y, size, r, g, b, width);
gl_drawSymbol(fragShader, c, curx, y, size, r, g, b, width, NULL);
curx -= (size+4*width); curx -= (size+4*width);
i -= 1; i -= 1;
c = str[i]; c = str[i];
@ -924,24 +934,55 @@ double bounding_mult = 1.0;
void update_values(void* arg) { void update_values(void* arg) {
time_dilation = 1.0+0.5*(is_DT==1); time_dilation = 1.0+0.5*(is_DT==1);
damage_scaling = 1.0+8.0*(is_HR==1); damage_scaling = 1.0+5.0*(is_HR==1);
bounding_mult = 1.0-0.93*(is_FL==1); bounding_mult = 1.0-0.93*(is_FL==1);
HD_mult = 1.0-0.95*(is_HD==1);
if(is_SD) { if(is_SD) {
player_hp = 1; player_hp = 1;
} else { } else {
player_hp = 1000; player_hp = 1000;
} }
modCount = is_DT+is_HR+is_HD+is_SD+is_FL;
int i = 0;
if(modCount != 0) {
modString[i] = '+'; i += 1;
}
if(is_HD) {
modString[i] = 'H'; i += 1;
modString[i] = 'D'; i += 1;
}
if(is_DT) {
modString[i] = 'D'; i += 1;
modString[i] = 'T'; i += 1;
}
if(is_HR) {
modString[i] = 'H'; i += 1;
modString[i] = 'R'; i += 1;
}
if(is_SD) {
modString[i] = 'S'; i += 1;
modString[i] = 'D'; i += 1;
}
if(is_FL) {
modString[i] = 'F'; i += 1;
modString[i] = 'L'; i += 1;
}
modString[i] = '\0';
} }
int build_mod_menu() { int build_mod_menu() {
int modMenuId = interface_create("mods", 200, 200, 200, -1.0, 0.7, 2.0, 0.3); 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 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 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 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 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 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 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 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 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); 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 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);
interface_link_button(modMenuId, btnDT); interface_link_button(modMenuId, btnDT);
interface_link_button(modMenuId, btnHR); interface_link_button(modMenuId, btnHR);
interface_link_button(modMenuId, btnFL); interface_link_button(modMenuId, btnFL);

View File

@ -464,6 +464,8 @@ void movePlayerG(float dtime) {
camvy -= gravity_factor*dtime; camvy -= gravity_factor*dtime;
bool isfalling = camvy < 0.0; bool isfalling = camvy < 0.0;
double oldvy = camvy;
double delx = camvx*dtime; double delx = camvx*dtime;
double dely = camvy*dtime; double dely = camvy*dtime;
double delz = camvz*dtime; double delz = camvz*dtime;
@ -490,6 +492,10 @@ void movePlayerG(float dtime) {
//printf("%lf | %lf | %lf\n\n", camvx, camvy, camvz); //printf("%lf | %lf | %lf\n\n", camvx, camvy, camvz);
if(isfalling && camvy > 0.0) { if(isfalling && camvy > 0.0) {
njumps = 1; njumps = 1;
printf("%lf\n", absf(oldvy));
if(is_HR==1 && absf(oldvy) >= 15.0) {
player_hp -= (int)(0.75*absf(oldvy));
}
} }
camx += camvx*dtime; camx += camvx*dtime;
camy += camvy*dtime; camy += camvy*dtime;
@ -508,7 +514,11 @@ void movePlayerG(float dtime) {
camvz = 0.0; camvz = 0.0;
player_chx = 0; player_chx = 0;
player_chy = 0; player_chy = 0;
player_hp -= 250; if(is_HR==1) {
player_hp = 0;
} else {
player_hp -= 250;
}
current_room = hashtbl_find_opt(visited, player_chx, player_chy); current_room = hashtbl_find_opt(visited, player_chx, player_chy);
resetProj(); resetProj();
} }

View File

@ -210,6 +210,11 @@ extern int creativeIntID;
extern double time_dilation; extern int is_DT; extern double time_dilation; extern int is_DT;
extern double damage_scaling; extern int is_HR; extern double damage_scaling; extern int is_HR;
extern double bounding_mult; extern int is_FL; extern double bounding_mult; extern int is_FL;
extern double HD_mult; extern int is_HD;
extern int is_SD; extern int is_SD;
extern int modCount;
extern char* modString;
#endif #endif