fixed lock box damagind players upon death
This commit is contained in:
parent
4944772ad2
commit
ee270cdbed
|
@ -13,10 +13,10 @@ Entities :
|
||||||
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.5]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.5]
|
||||||
[-14.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
[-13.0, 7.5, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
||||||
[ 12.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
[ 11.0, 7.5, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
50
|
50
|
||||||
|
|
|
@ -13,10 +13,10 @@ Entities :
|
||||||
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.0, 0.0, 0.0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.0, 0.0, 0.0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.5, 0.0, 0.0]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.5, 0.0, 0.0]
|
||||||
[-1.0, 7.5, -14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
[-2.0, 7.5, -13.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
||||||
[-1.0, 7.5, 12.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
[-2.0, 7.5, 11.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
50
|
50
|
||||||
|
|
|
@ -13,10 +13,10 @@ Entities :
|
||||||
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
|
||||||
[-14.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
|
[-13.0, 7.5, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
|
||||||
[ 12.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
|
[ 11.0, 7.5, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
50
|
50
|
||||||
|
|
|
@ -13,10 +13,10 @@ Entities :
|
||||||
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 2, 0, 0]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
|
||||||
[-1.0, 7.5, -14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
|
[-2.0, 7.5, -13.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
|
||||||
[-1.0, 7.5, 12.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
|
[-2.0, 7.5, 11.0, 4.0, 1.0, 4.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
50
|
50
|
||||||
|
|
|
@ -9,10 +9,10 @@ Blocks :
|
||||||
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
|
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
|
||||||
Entities :
|
Entities :
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 6.0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 6.0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 8.0]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 8.0]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 6.0, 0.0, 0.0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 6.0, 0.0, 0.0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 8.0, 0.0, 0.0]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 8.0, 0.0, 0.0]
|
||||||
|
|
||||||
Weight :
|
Weight :
|
||||||
75
|
75
|
||||||
|
|
|
@ -9,10 +9,10 @@ Blocks :
|
||||||
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
|
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
|
||||||
|
|
||||||
Entities :
|
Entities :
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
|
||||||
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
|
[-2.0, 1.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
|
||||||
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
|
[-2.0, 15.0, -2.0, 4.0, 1.0, 4.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
|
||||||
[-3.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 0]
|
[-3.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 0]
|
||||||
[-3.0, 7.5, 2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 90]
|
[-3.0, 7.5, 2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 90]
|
||||||
[ 2.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 180]
|
[ 2.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 180]
|
||||||
|
|
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/move.o
BIN
obj/move.o
Binary file not shown.
BIN
obj/proj.o
BIN
obj/proj.o
Binary file not shown.
|
@ -161,6 +161,10 @@ bool is_visible(cube_0* cb, double offx, double offy, double offz) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gl_resetTexture() {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
||||||
|
}
|
||||||
|
|
||||||
void gl_renderAll(unsigned int shaderProgram, unsigned int fragmentShader, unsigned int VAO, unsigned int VBO, room* rtd, double offx, double offy, double offz) {
|
void gl_renderAll(unsigned int shaderProgram, unsigned int fragmentShader, unsigned int VAO, unsigned int VBO, room* rtd, double offx, double offy, double offz) {
|
||||||
if(rtd != NULL) {
|
if(rtd != NULL) {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
|
@ -10,4 +10,6 @@ void init_vertices();
|
||||||
|
|
||||||
void gl_drawData(unsigned int shaderProg);
|
void gl_drawData(unsigned int shaderProg);
|
||||||
|
|
||||||
|
void gl_resetTexture();
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -70,9 +70,9 @@ void speen2(double x, double y, double z, double w, double h, double d, double h
|
||||||
double dy = (y+h/2 - camy);
|
double dy = (y+h/2 - camy);
|
||||||
double dz = (z+d/2 - camz);
|
double dz = (z+d/2 - camz);
|
||||||
double total = sqrt(dx*dx + dy*dy + dz*dz);
|
double total = sqrt(dx*dx + dy*dy + dz*dz);
|
||||||
dx = 17.0*dx/total;
|
dx = 110.0*dx/total;
|
||||||
dy = 17.0*dy/total;
|
dy = 110.0*dy/total;
|
||||||
dz = 17.0*dz/total;
|
dz = 110.0*dz/total;
|
||||||
appendProj(x+w/2, y+h/2, z+d/2, 0.1, 0.1, 0.1, -dx, -dy, -dz, 0.0, 0.0, 0.0, 255, 0, 0, 10, 3.0);
|
appendProj(x+w/2, y+h/2, z+d/2, 0.1, 0.1, 0.1, -dx, -dy, -dz, 0.0, 0.0, 0.0, 255, 0, 0, 10, 3.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,19 +256,24 @@ bool is_colliding(float dtime) {
|
||||||
double dist = distance_pt_cube_0_3d_infinite(camx, camy, camz, current_room->ents[k]->pos);
|
double dist = distance_pt_cube_0_3d_infinite(camx, camy, camz, current_room->ents[k]->pos);
|
||||||
//printf("%lf vs %lf\n", dist, min_dist);
|
//printf("%lf vs %lf\n", dist, min_dist);
|
||||||
if(dist <= min_dist) {
|
if(dist <= min_dist) {
|
||||||
|
bool exists = true;
|
||||||
if(current_room->ents[k]->onHit != NULL) {
|
if(current_room->ents[k]->onHit != NULL) {
|
||||||
(*current_room->ents[k]->onHit)(dtime, current_room->ents[k]->hitpoints, ¤t_room->ents[k]->damage, current_room->ents[k], &(*(current_room->ents[k]->pos)));
|
(*current_room->ents[k]->onHit)(dtime, current_room->ents[k]->hitpoints, ¤t_room->ents[k]->damage, current_room->ents[k], &(*(current_room->ents[k]->pos)));
|
||||||
if(*(current_room->ents[k]->hitpoints) <= 0) {
|
if(*(current_room->ents[k]->hitpoints) <= 0) {
|
||||||
if(current_room->ents[k]->onDeath != NULL) {
|
if(current_room->ents[k]->onDeath != NULL) {
|
||||||
(*current_room->ents[k]->onDeath)(dtime);
|
(*current_room->ents[k]->onDeath)(dtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove_entity(current_room->ents, ¤t_room->ent_memlen, ¤t_room->ent_len, k);
|
remove_entity(current_room->ents, ¤t_room->ent_memlen, ¤t_room->ent_len, k);
|
||||||
|
is_clipping = false;
|
||||||
|
exists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(updateForces && current_room->ents[k]->entity_type != 0) {
|
if(exists && updateForces && current_room->ents[k]->entity_type != 0) {
|
||||||
updateF(current_room->ents[k]->pos, (double)dtime);
|
updateF(current_room->ents[k]->pos, (double)dtime);
|
||||||
}
|
}
|
||||||
if(current_room->ents[k]->entity_type == 9) {
|
if(exists && current_room->ents[k]->entity_type == 9) {
|
||||||
is_clipping = false;
|
is_clipping = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -79,6 +79,7 @@ void removeProj(int k) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void gl_renderProj(unsigned int shaderProgram, unsigned int fragmentShader, unsigned int VAO, unsigned int VBO) {
|
void gl_renderProj(unsigned int shaderProgram, unsigned int fragmentShader, unsigned int VAO, unsigned int VBO) {
|
||||||
|
gl_resetTexture();
|
||||||
for(int k = 0; k < bullets_id; k++) {
|
for(int k = 0; k < bullets_id; k++) {
|
||||||
gl_renderCube(shaderProgram, fragmentShader, VAO, VBO, bullets[k].pos, 0.0, 0.0, 0.0);
|
gl_renderCube(shaderProgram, fragmentShader, VAO, VBO, bullets[k].pos, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +98,7 @@ void updateProj(float dtime) {
|
||||||
if(*(bullets[k].ttl) <= 0.0 || is_colliding_with_map(bullets[k].pos) || is_colliding_with_tp(bullets[k].pos)) {
|
if(*(bullets[k].ttl) <= 0.0 || is_colliding_with_map(bullets[k].pos) || is_colliding_with_tp(bullets[k].pos)) {
|
||||||
removeProj(k);
|
removeProj(k);
|
||||||
k -= 1;
|
k -= 1;
|
||||||
} else if(distance_pt_cube_0_3d(camx, camy, camz, bullets[k].pos) <= 0.1) {
|
} else if(distance_pt_cube_0_3d(camx, camy, camz, bullets[k].pos) <= min_dist) {
|
||||||
player_hp -= bullets[k].damage;
|
player_hp -= bullets[k].damage;
|
||||||
removeProj(k);
|
removeProj(k);
|
||||||
k -= 1;
|
k -= 1;
|
||||||
|
|
Loading…
Reference in New Issue