added display for buttons + significant tweaks to level_02
This commit is contained in:
parent
9031dc18ea
commit
41ab6efde4
|
@ -69,7 +69,7 @@ entities:
|
||||||
-> 11 (button trigger)
|
-> 11 (button trigger)
|
||||||
[.. freq, dtime] with
|
[.. freq, dtime] with
|
||||||
freq = int[0 - 15]
|
freq = int[0 - 15]
|
||||||
dtime = double[>0.0]
|
dtime = double([>0.0] for time-limited press, or use -1.0 if no deactivation)
|
||||||
|
|
||||||
-> 12 (button block)
|
-> 12 (button block)
|
||||||
[.. freq, defaultState] with
|
[.. freq, defaultState] with
|
||||||
|
|
|
@ -1,27 +1,52 @@
|
||||||
Blocks :
|
Blocks :
|
||||||
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
|
[-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] // cp1
|
[ -6.0, 10.0, 0.0, 6.0, 2.0, 2.0, 0.0, 0.0, 32, 192, 32] // cp1
|
||||||
[-4.0, 20.0, 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192] // cp2
|
[-25.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
[-27.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
[-29.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
[-31.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
[ -6.0, 20.0, -16.0, 6.0, 2.0, 2.0, 0.0, 0.0, 32, 192, 32] // cp2
|
||||||
|
|
||||||
Entities:
|
Entities:
|
||||||
[8.0, 1.0 , 8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 128, 1, 0, 8, 100, 1, 128, 128, 128]
|
[8.0, 1.0 , 8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 128, 1, 0, 8, 100, 1, 128, 128, 128]
|
||||||
[8.5, 1.5 , 8.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.5, 1.5 , 8.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]
|
||||||
|
|
||||||
[-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, 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
|
[-3.5, 23.0,-15.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)
|
[-4.0, 0.0, -13.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 0] // 1-1
|
||||||
[-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]
|
[-2.0, 1.0, -13.2, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 0]
|
||||||
[-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]
|
[ 0.0, 2.0, -13.4, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 1]
|
||||||
[-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]
|
[ 2.0, 3.0, -13.6, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 1]
|
||||||
[-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, 4.0, -13.8, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 0]
|
||||||
[-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]
|
[ 6.0, 5.0, -14.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.4, 1.4, 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]
|
[ 6.0, 5.0, -18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 1] // 1-2
|
||||||
[ 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]
|
[ 4.0, 6.0, -18.2, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 1]
|
||||||
[ 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, 0.0]
|
[ 2.0, 7.0, -18.4, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 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]
|
[ 0.0, 8.0, -18.6, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 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]
|
[-2.0, 9.0, -18.8, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 1]
|
||||||
|
[-4.0, 10.0, -19.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.2, 1.2, 1]
|
||||||
|
|
||||||
|
[-4.0, 10.0, -14.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 1] // 1-3
|
||||||
|
[-4.3, 10.0, -12.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 0]
|
||||||
|
[-4.0, 10.0, -10.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 1]
|
||||||
|
[-3.7, 10.0, -8.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 0]
|
||||||
|
[-4.0, 10.0, -6.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 1]
|
||||||
|
[-4.3, 10.0, -4.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 0]
|
||||||
|
[-4.0, 10.0, -2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 0.4, 0.8, 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, 6.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, -8.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, 10.0, 0.0]
|
||||||
|
[ -1.0, 21.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 7.0, 0.0, 0.0, 9.0, 0.0, 0.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, -7.0]
|
||||||
|
|
||||||
|
[-14.0, 21.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 5.0, 0.0, 4.0, 3, 4, 0] // button part
|
||||||
|
[-18.0, 22.0, 14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 5.0, 0.0, -4.0, 3, 4, 90]
|
||||||
|
[ -4.0, 20.0,-14.0, 2.0, 2.0, 14.0, 0.0, 0.0, 192, 192, 192, 1, 0, 12, 1, 0]
|
||||||
|
[-33.0, 24.0, 18.0, 2.0, 2.0, 2.0, 0.71, 0.0, 92, 92, 92, 1, 0, 11, 1, 10.0]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
0
|
0
|
||||||
|
|
BIN
obj/display.o
BIN
obj/display.o
Binary file not shown.
BIN
obj/entities.o
BIN
obj/entities.o
Binary file not shown.
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
BIN
obj/move.o
BIN
obj/move.o
Binary file not shown.
|
@ -271,4 +271,26 @@ void gl_drawDamageFadeout(unsigned int shaderProg) {
|
||||||
gl_drawRectAlpha(shaderProg, -1.0f , -1.0f+fadeSideWidth, fadeSideWidth, 2.0f*(1.0-fadeSideWidth), 255, 32, 32, (int)(dmgCD*510.0f));
|
gl_drawRectAlpha(shaderProg, -1.0f , -1.0f+fadeSideWidth, fadeSideWidth, 2.0f*(1.0-fadeSideWidth), 255, 32, 32, (int)(dmgCD*510.0f));
|
||||||
gl_drawRectAlpha(shaderProg, 1.0f-fadeSideWidth, -1.0f+fadeSideWidth, fadeSideWidth, 2.0f*(1.0-fadeSideWidth), 255, 32, 32, (int)(dmgCD*510.0f));
|
gl_drawRectAlpha(shaderProg, 1.0f-fadeSideWidth, -1.0f+fadeSideWidth, fadeSideWidth, 2.0f*(1.0-fadeSideWidth), 255, 32, 32, (int)(dmgCD*510.0f));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float barWidth = 0.05f;
|
||||||
|
float barInnerOffset = 0.01f;
|
||||||
|
float barHeight = 1.0f;
|
||||||
|
void gl_drawButtonTimers(unsigned int shaderProg) {
|
||||||
|
double curx = -0.95f;
|
||||||
|
for(int k = 0; k < 16; k++) {
|
||||||
|
if(buttonSwitch[k] && buttonMaxT[k] > 0.0f) {
|
||||||
|
gl_drawRect(shaderProg, curx, -barHeight/2.0f, barWidth, barHeight, 64, 64, 64);
|
||||||
|
gl_drawRect(shaderProg,
|
||||||
|
curx+barInnerOffset, -barHeight/2.0f+barInnerOffset,
|
||||||
|
barWidth-2.0f*barInnerOffset, barHeight-2.0f*barInnerOffset,
|
||||||
|
0, 0, 0);
|
||||||
|
gl_drawRect(shaderProg,
|
||||||
|
curx+barInnerOffset, -barHeight/2.0f+barInnerOffset,
|
||||||
|
barWidth-2.0f*barInnerOffset, barHeight*(buttonTimes[k]/buttonMaxT[k])-2.0f*barInnerOffset,
|
||||||
|
128, 128, 128);
|
||||||
|
gl_drawInteger(shaderProg, k, curx+barWidth/2.0f, -barHeight/2.0f-barWidth/0.7f, barWidth/1.5f, 192, 192, 192, barWidth/12.0f, 0);
|
||||||
|
curx += barWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,5 +12,6 @@ void gl_drawData(unsigned int shaderProg);
|
||||||
void gl_resetTexture();
|
void gl_resetTexture();
|
||||||
|
|
||||||
void gl_drawDamageFadeout(unsigned int shaderProg);
|
void gl_drawDamageFadeout(unsigned int shaderProg);
|
||||||
|
void gl_drawButtonTimers(unsigned int shaderProg);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -185,6 +185,7 @@ void update_button(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
||||||
if(!buttonSwitch[ent->metai1]) {
|
if(!buttonSwitch[ent->metai1]) {
|
||||||
buttonSwitch[ent->metai1] = true;
|
buttonSwitch[ent->metai1] = true;
|
||||||
buttonTimes[ent->metai1] = ent->metad1;
|
buttonTimes[ent->metai1] = ent->metad1;
|
||||||
|
buttonMaxT[ent->metai1] = ent->metad1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ int main_alt() {
|
||||||
while(!glfwWindowShouldClose(window) && player_hp > 0) {
|
while(!glfwWindowShouldClose(window) && player_hp > 0) {
|
||||||
// input
|
// input
|
||||||
// -----
|
// -----
|
||||||
glClearColor(0.2f, 0.3f, 0.3f, 0.5f);
|
glClearColor(0.05f, 0.05f, 0.05f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
triCount = 0;
|
triCount = 0;
|
||||||
|
|
||||||
|
@ -637,6 +637,7 @@ int main_alt() {
|
||||||
gl_drawData(shaderProgramR);
|
gl_drawData(shaderProgramR);
|
||||||
|
|
||||||
gl_drawDamageFadeout(shaderProgramR);
|
gl_drawDamageFadeout(shaderProgramR);
|
||||||
|
gl_drawButtonTimers(shaderProgramR);
|
||||||
|
|
||||||
if(!isInMenu(window, shaderProgramR)) {
|
if(!isInMenu(window, shaderProgramR)) {
|
||||||
processInput(window, delta);
|
processInput(window, delta);
|
||||||
|
|
20
src/move.c
20
src/move.c
|
@ -66,6 +66,7 @@ int lastDmg;
|
||||||
|
|
||||||
bool buttonSwitch[16];
|
bool buttonSwitch[16];
|
||||||
float buttonTimes[16];
|
float buttonTimes[16];
|
||||||
|
float buttonMaxT[16];
|
||||||
|
|
||||||
void init_csts() {
|
void init_csts() {
|
||||||
camx = 2.0;
|
camx = 2.0;
|
||||||
|
@ -92,6 +93,7 @@ void init_csts() {
|
||||||
for(int k = 0; k < 16; k++) {
|
for(int k = 0; k < 16; k++) {
|
||||||
buttonTimes[k] = 0.0f;
|
buttonTimes[k] = 0.0f;
|
||||||
buttonSwitch[k] = false;
|
buttonSwitch[k] = false;
|
||||||
|
buttonMaxT[k] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
dmgCD = 0.0f;
|
dmgCD = 0.0f;
|
||||||
|
@ -105,7 +107,7 @@ void init_csts() {
|
||||||
void update_buttons(float dtime) {
|
void update_buttons(float dtime) {
|
||||||
for(int k = 0; k < 16; k++) {
|
for(int k = 0; k < 16; k++) {
|
||||||
if(buttonSwitch[k]) {
|
if(buttonSwitch[k]) {
|
||||||
if(buttonTimes[k] <= dtime) {
|
if(buttonTimes[k] <= dtime && buttonMaxT[k] > 0.0) {
|
||||||
buttonTimes[k] = 0.0f;
|
buttonTimes[k] = 0.0f;
|
||||||
buttonSwitch[k] = false;
|
buttonSwitch[k] = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -372,10 +374,6 @@ void teleport_on_edge() {
|
||||||
player_chx += 1;
|
player_chx += 1;
|
||||||
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
||||||
resetProj();
|
resetProj();
|
||||||
for(int k = 0; k < 16; k++) {
|
|
||||||
buttonSwitch[k] = false;
|
|
||||||
buttonTimes[k] = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if(camx <= -room_width) {
|
} else if(camx <= -room_width) {
|
||||||
if(!is_one_room) {
|
if(!is_one_room) {
|
||||||
|
@ -383,10 +381,6 @@ void teleport_on_edge() {
|
||||||
player_chx -= 1;
|
player_chx -= 1;
|
||||||
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
||||||
resetProj();
|
resetProj();
|
||||||
for(int k = 0; k < 16; k++) {
|
|
||||||
buttonSwitch[k] = false;
|
|
||||||
buttonTimes[k] = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if(camz >= room_depth) {
|
} else if(camz >= room_depth) {
|
||||||
if(!is_one_room) {
|
if(!is_one_room) {
|
||||||
|
@ -394,10 +388,6 @@ void teleport_on_edge() {
|
||||||
player_chy += 1;
|
player_chy += 1;
|
||||||
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
||||||
resetProj();
|
resetProj();
|
||||||
for(int k = 0; k < 16; k++) {
|
|
||||||
buttonSwitch[k] = false;
|
|
||||||
buttonTimes[k] = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if(camz <= -room_depth) {
|
} else if(camz <= -room_depth) {
|
||||||
if(!is_one_room) {
|
if(!is_one_room) {
|
||||||
|
@ -405,10 +395,6 @@ void teleport_on_edge() {
|
||||||
player_chy -= 1;
|
player_chy -= 1;
|
||||||
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
|
||||||
resetProj();
|
resetProj();
|
||||||
for(int k = 0; k < 16; k++) {
|
|
||||||
buttonSwitch[k] = false;
|
|
||||||
buttonTimes[k] = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -192,5 +192,6 @@ extern int lastDmg;
|
||||||
|
|
||||||
extern bool buttonSwitch[16];
|
extern bool buttonSwitch[16];
|
||||||
extern float buttonTimes[16];
|
extern float buttonTimes[16];
|
||||||
|
extern float buttonMaxT[16];
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue