Compare commits

..

No commits in common. "f5c5cafeb7abac3609d0f73e9d634a32dc188fea" and "162ea1bd3018e8301f3faf988b42df7842c79fbe" have entirely different histories.

22 changed files with 72 additions and 156 deletions

View File

@ -41,10 +41,7 @@ entities:
-> 0 (coin) -> damage equals the coin's value -> 0 (coin) -> damage equals the coin's value
-> 1 (non-moving explosive) -> 1 (non-moving explosive)
-> 2 (seeking explosive) -> 2 (seeking explosive)
-> 3 (shooting, maybe moving explosive) -> 3 (shooting non-moving explosive)
[.. proj_speed, shoot_speed, shot_freq, shot_ttl] with
{all} = double[>= 0.0]
-> 4 (moving platform) -> 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with *<- extra arguments at the end of []* [.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with *<- extra arguments at the end of []*
amplitude_{x,y,z} = double[>= 0.0] amplitude_{x,y,z} = double[>= 0.0]

BIN
bin/back

Binary file not shown.

View File

@ -1,11 +1,5 @@
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, -4.0, 8.0, 2.0, 8.0, 0.0, 0.0, 128, 128, 128]
[ -4.0, -6.5, -2.0, 2.0, 1.0, 2.0, 0.0, 0.3, 128, 128, 128]
[ -4.0, -6.5, 2.0, 2.0, 1.0, 2.0, 0.3, 0.0, 128, 128, 128]
[-18.0, 10.0, -16.0, 3.0, 1.0,32.0, 0.0, 0.4, 255, 255, 255]
[ -6.0, 10.0, 0.0, 6.0, 2.0, 2.0, 0.0, 0.0, 32, 192, 32] // cp1 [ -6.0, 10.0, 0.0, 6.0, 2.0, 2.0, 0.0, 0.0, 32, 192, 32] // cp1
[-25.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192] [-25.0, 21.0, 18.0, 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -398,8 +398,8 @@ void project_to_cube(double x0, double y0, double z0, double* rx, double* ry, do
// rotate (x) // rotate (x)
if(rx != NULL) {*rx = c->x + c->w/2.0 + xry;} if(rx != NULL) {*rx = c->x + c->w/2.0 + xry;}
if(ry != NULL) {*ry = c->y + c->h/2.0 + yry*cos(c->vt_angle) + zry*sin(c->vt_angle);} if(ry != NULL) {*ry = c->y + c->h/2.0 + yry*cos(c->vt_angle) - zry*sin(c->vt_angle);}
if(rz != NULL) {*rz = c->z + c->d/2.0 + zry*cos(c->vt_angle) - yry*sin(c->vt_angle);} if(rz != NULL) {*rz = c->z + c->d/2.0 + zry*cos(c->vt_angle) + yry*sin(c->vt_angle);}
} }
// ------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------ //

View File

@ -136,8 +136,8 @@ void gl_renderCube(cube_0* c, double offx, double offy, double offz) {
scale[1][1] = (float)(c->h); scale[1][1] = (float)(c->h);
scale[2][2] = (float)(c->d); scale[2][2] = (float)(c->d);
glm_translate(model, (vec3){(float)(c->x+c->w/2.0+offx), (float)(c->y+c->h/2.0+offy), (float)(c->z+c->d/2.0+offz)}); glm_translate(model, (vec3){(float)(c->x+c->w/2.0+offx), (float)(c->y+c->h/2.0+offy), (float)(c->z+c->d/2.0+offz)});
glm_rotate(model, (float)(-c->vt_angle), (vec3){1.0f, 0.0f, 0.0f}); glm_rotate(model, (float)(c->vt_angle), (vec3){1.0f, 0.0f, 0.0f});
glm_rotate(model, (float)(-c->hz_angle), (vec3){0.0f, 1.0f, 0.0f}); glm_rotate(model, (float)(c->hz_angle), (vec3){0.0f, 1.0f, 0.0f});
glm_mat2_identity(texShift); glm_mat2_identity(texShift);
texShift[0][0] = (float)(maxd(maxd(c->w, c->h), c->d)/mind(mind(c->w, c->h), c->d)); texShift[0][0] = (float)(maxd(maxd(c->w, c->h), c->d)/mind(mind(c->w, c->h), c->d));
@ -194,7 +194,6 @@ void gl_renderAll(room* rtd, double offx, double offy, double offz) {
for(int k = 0; k < rtd->map_size; k++) { for(int k = 0; k < rtd->map_size; k++) {
if(is_visible(rtd->map[k], offx, offy, offz)) { if(is_visible(rtd->map[k], offx, offy, offz)) {
gl_renderCube(rtd->map[k], offx, offy, offz); gl_renderCube(rtd->map[k], offx, offy, offz);
//debugMove(rtd->map[k]);
} }
} }
glBindTexture(GL_TEXTURE_2D, textures[6]); glBindTexture(GL_TEXTURE_2D, textures[6]);
@ -211,7 +210,6 @@ void gl_renderAll(room* rtd, double offx, double offy, double offz) {
glBindTexture(GL_TEXTURE_2D, textures[rtd->ents[k]->tex2]); glBindTexture(GL_TEXTURE_2D, textures[rtd->ents[k]->tex2]);
} }
gl_renderCube(rtd->ents[k]->pos, offx, offy, offz); gl_renderCube(rtd->ents[k]->pos, offx, offy, offz);
//debugMove(rtd->ents[k]->pos);
} }
} }
} }

View File

@ -77,40 +77,17 @@ void speen(double x, double y, double z, double w, double h, double d, double hz
ret->hz_angle += ((double)dtime)*1.5; ret->hz_angle += ((double)dtime)*1.5;
} }
// metad1 = main proj speed
// metad2 = shot proj speed
// metad2 = shot proj freq
// metad2 = shot proj time to live
void speen2(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret) { void speen2(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret) {
ret->hz_angle += ((double)dtime)*ent->metad3; ret->hz_angle += ((double)dtime)*2.5;
if((int)(5.0*ret->hz_angle) != (int)(5.0*(ret->hz_angle - ((double)dtime)*22.5))) { if((int)(5.0*ret->hz_angle) != (int)(5.0*(ret->hz_angle - ((double)dtime)*22.5))) {
double dx = (x+w/2 - (camx-choffx)); double dx = (x+w/2 - (camx-choffx));
double dy = (y+h/2 - (camy)); double dy = (y+h/2 - (camy));
double dz = (z+d/2 - (camz-choffz)); double dz = (z+d/2 - (camz-choffz));
double total = sqrt(dx*dx + dy*dy + dz*dz); double total = sqrt(dx*dx + dy*dy + dz*dz);
dx = ent->metad2*dx/total; dx = 110.0*dx/total;
dy = ent->metad2*dy/total; dy = 110.0*dy/total;
dz = ent->metad2*dz/total; dz = 110.0*dz/total;
appendProj(x+w/2+choffx, y+h/2, z+d/2+choffz, 0.1, 0.1, 0.1, -dx, -dy, -dz, 0.0, 0.0, 0.0, 255, 0, 0, 10, ent->metad4); appendProj(x+w/2+choffx, y+h/2, z+d/2+choffz, 0.1, 0.1, 0.1, -dx, -dy, -dz, 0.0, 0.0, 0.0, 255, 0, 0, 10, 3.0);
}
double dx = (x+w/2 - (camx-choffx));
double dy = (y+h/2 - (camy));
double dz = (z+d/2 - (camz-choffz));
double total = sqrt(dx*dx + dy*dy + dz*dz);
dx = ent->metad1*dx/total;
dy = ent->metad1*dy/total;
dz = ent->metad1*dz/total;
ret->x -= dtime*dx;
if(is_colliding_with_map(ret) || is_colliding_with_tp(ret)) {
ret->x += dtime*dx;
}
ret->y -= dtime*dy;
if(is_colliding_with_map(ret) || is_colliding_with_tp(ret)) {
ret->y += dtime*dy;
}
ret->z -= dtime*dz;
if(is_colliding_with_map(ret) || is_colliding_with_tp(ret)) {
ret->z += dtime*dz;
} }
} }
@ -300,9 +277,9 @@ void go_to_player(double x, double y, double z, double w, double h, double d, do
if(is_colliding_with_map(ret) || is_colliding_with_tp(ret)) { if(is_colliding_with_map(ret) || is_colliding_with_tp(ret)) {
ret->z += dtime*dz; ret->z += dtime*dz;
} }
//if((int)(ret->x+ret->y+ret->z) != (int)(ret->x+ret->y+ret->z-dx-dy-dz)) { if((int)(ret->x+ret->y+ret->z) != (int)(ret->x+ret->y+ret->z-dx-dy-dz)) {
//} }
} }
void explodeOnHit(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) { void explodeOnHit(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {

View File

@ -51,26 +51,26 @@ void init_ent_generator(int n) {
hashtbl_entities[0].onDeath = NULL; hashtbl_entities[0].onDeath = NULL;
hashtbl_entities[1].id = 1; hashtbl_entities[1].id = 1;
hashtbl_entities[1].tex = 13; hashtbl_entities[1].tex = 0;
hashtbl_entities[1].tex2 = 13; hashtbl_entities[1].tex2 = 0;
hashtbl_entities[1].name = "ExplosiveStill"; hashtbl_entities[1].name = "ExplosiveStill";
hashtbl_entities[1].updatePos = NULL; hashtbl_entities[1].updatePos = &speen2;
hashtbl_entities[1].onHit = &explodeOnHit; hashtbl_entities[1].onHit = &explodeOnHit;
hashtbl_entities[1].onDeath = NULL; hashtbl_entities[1].onDeath = NULL;
hashtbl_entities[2].id = 2; hashtbl_entities[2].id = 2;
hashtbl_entities[2].tex = 13; hashtbl_entities[2].tex = 0;
hashtbl_entities[2].tex2 = 13; hashtbl_entities[2].tex2 = 0;
hashtbl_entities[2].name = "ExplosiveSeek"; hashtbl_entities[2].name = "ExplosiveSeek";
hashtbl_entities[2].updatePos = &go_to_player; hashtbl_entities[2].updatePos = &go_to_player;
hashtbl_entities[2].onHit = &explodeOnHit; hashtbl_entities[2].onHit = &explodeOnHit;
hashtbl_entities[2].onDeath = NULL; hashtbl_entities[2].onDeath = NULL;
hashtbl_entities[3].id = 3; hashtbl_entities[3].id = 3;
hashtbl_entities[3].tex = 13; hashtbl_entities[3].tex = 0;
hashtbl_entities[3].tex2 = 13; hashtbl_entities[3].tex2 = 0;
hashtbl_entities[3].name = "ExplosiveShoot"; hashtbl_entities[3].name = "ExplosiveShoot";
hashtbl_entities[3].updatePos = &speen2; hashtbl_entities[3].updatePos = &speen3;
hashtbl_entities[3].onHit = &explodeOnHit; hashtbl_entities[3].onHit = &explodeOnHit;
hashtbl_entities[3].onDeath = NULL; hashtbl_entities[3].onDeath = NULL;
@ -452,16 +452,7 @@ void parse_one_room(int id, char* filename) {
pool[id].area->ents[k]->metad7 = entry->metad7; pool[id].area->ents[k]->metad7 = entry->metad7;
pool[id].area->ents[k]->metad8 = entry->metad8; pool[id].area->ents[k]->metad8 = entry->metad8;
pool[id].area->ents[k]->metad9 = entry->metad9; pool[id].area->ents[k]->metad9 = entry->metad9;
if(entry->id == 3) { if(entry->id == 4) {
double pspd = read_float(ptr);
double bspd = read_float(ptr);
double bfreq = read_float(ptr);
double bttl = read_float(ptr);
pool[id].area->ents[k]->metad1 = pspd;
pool[id].area->ents[k]->metad2 = bspd;
pool[id].area->ents[k]->metad3 = bfreq;
pool[id].area->ents[k]->metad4 = bttl;
} else if(entry->id == 4) {
// sine platform // sine platform
double ccw = read_float(ptr); double ccw = read_float(ptr);
double cch = read_float(ptr); double cch = read_float(ptr);

View File

@ -40,9 +40,8 @@ bool jPress = false;
bool gPress = false; bool gPress = false;
bool rPress = false; bool rPress = false;
bool pPress = false; bool pPress = false;
bool kPress = false;
unsigned int textures[32]; unsigned int textures[16];
bool paused = false; bool paused = false;
bool hardReset = true; bool hardReset = true;
@ -50,10 +49,6 @@ bool hardReset = true;
double oldx, oldy, oldz; double oldx, oldy, oldz;
int oldchx, oldchy; int oldchx, oldchy;
int kodami[10] = {GLFW_KEY_UP, GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_DOWN, GLFW_KEY_LEFT, GLFW_KEY_RIGHT, GLFW_KEY_LEFT, GLFW_KEY_RIGHT, GLFW_KEY_B, GLFW_KEY_A};
int kodid = 0;
bool kodhit = false;
void reset_everything(GLFWwindow *window, int count, char* folder) { void reset_everything(GLFWwindow *window, int count, char* folder) {
oldx = camx; oldx = camx;
oldy = camy; oldy = camy;
@ -141,23 +136,6 @@ void processInput(GLFWwindow *window, float dtime) {
glfwSetWindowShouldClose(window, true); glfwSetWindowShouldClose(window, true);
} }
// kodami
if(!kodhit) {
if(kodid == 10) {
kodhit = true;
player_hp += 1500;
} else if(glfwGetKey(window, kodami[kodid]) == GLFW_PRESS) {
if(!kPress) {
kPress = true;
kodid += 1;
//printf("%d\n", kodid);
}
} else {
kPress = false;
//kodid = 0;
}
}
// horizontal movement // horizontal movement
bool pressed = false; bool pressed = false;
if(!paused) { if(!paused) {
@ -547,7 +525,6 @@ int main_alt() {
generate_texture_2D(10, "res/button_on.png", PNG); generate_texture_2D(10, "res/button_on.png", PNG);
generate_texture_2D(11, "res/button_off.jpg", JPG); generate_texture_2D(11, "res/button_off.jpg", JPG);
generate_texture_2D(12, "res/pi.png", PNG); generate_texture_2D(12, "res/pi.png", PNG);
generate_texture_2D(13, "res/tnt.png", PNG);
printf("-----------------------------------------------------------------------------------------------\n"); fflush(stdout); printf("-----------------------------------------------------------------------------------------------\n"); fflush(stdout);
@ -713,12 +690,14 @@ int main_alt() {
usleep(max(0, interval-(int)(1000000*calc_T))); usleep(max(0, interval-(int)(1000000*calc_T)));
sim_time += interval_s + maxd(0.0, (double)(interval_s-(calc_T))); sim_time += interval_s + maxd(0.0, (double)(interval_s-(calc_T)));
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
glfwSwapBuffers(window);
glfwPollEvents();
dmgCD = maxf(dmgCD - delta, 0.0f); dmgCD = maxf(dmgCD - delta, 0.0f);
if(lastDmg != player_hp) { if(lastDmg != player_hp) {
if(lastDmg > player_hp) {
dmgCD = 0.5f;
}
lastDmg = player_hp; lastDmg = player_hp;
dmgCD = 0.5f;
} }
delta = (float)(interval_s + maxf(0.0f, interval_s-(calc_T))); delta = (float)(interval_s + maxf(0.0f, interval_s-(calc_T)));
deltad = (double)delta; deltad = (double)delta;
@ -727,10 +706,6 @@ int main_alt() {
} }
incr = 0.0f; incr = 0.0f;
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
glfwSwapBuffers(window);
glfwPollEvents();
count++; count++;
} }

View File

@ -7,16 +7,12 @@
#include <termios.h> #include <termios.h>
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <cglm/cglm.h>
#include "hash.h" #include "hash.h"
#include "base.h" #include "base.h"
#include "entities.h" #include "entities.h"
#include "proj.h" #include "proj.h"
#include "move.h" #include "move.h"
#include "display.h"
#include "music.h" #include "music.h"
// ---------------------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------------------- //
@ -153,28 +149,22 @@ void getSF(cube_0* cb, int sf) {
if(sf == 0 || sf == 1) { if(sf == 0 || sf == 1) {
project_to_cube(cb->x + (sf==0)*(cb->w), cb->y , cb->z , &p1, &p2, &p3, cb); project_to_cube(cb->x + (sf==0)*(cb->w), cb->y , cb->z , &p1, &p2, &p3, cb);
surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x + (sf==0)*(cb->w), cb->y + cb->h, cb->z , &p1, &p2, &p3, cb); project_to_cube(cb->x + (sf==0)*(cb->w), cb->y + cb->h, cb->z , &p1, &p2, &p3, cb);
surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x + (sf==0)*(cb->w), cb->y , cb->z + cb->d, &p1, &p2, &p3, cb); project_to_cube(cb->x + (sf==0)*(cb->w), cb->y , cb->z + cb->d, &p1, &p2, &p3, cb);
surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3};
} else if(sf == 2 || sf == 3) { } else if(sf == 2 || sf == 3) {
project_to_cube(cb->x , cb->y + (sf==2)*(cb->h), cb->z , &p1, &p2, &p3, cb); project_to_cube(cb->x , cb->y + (sf==2)*(cb->h), cb->z , &p1, &p2, &p3, cb);
surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x + cb->w, cb->y + (sf==2)*(cb->h), cb->z , &p1, &p2, &p3, cb); project_to_cube(cb->x + cb->w, cb->y + (sf==2)*(cb->h), cb->z , &p1, &p2, &p3, cb);
surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x , cb->y + (sf==2)*(cb->h), cb->z + cb->d, &p1, &p2, &p3, cb); project_to_cube(cb->x , cb->y + (sf==2)*(cb->h), cb->z + cb->d, &p1, &p2, &p3, cb);
surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3};
} else { } else {
project_to_cube(cb->x , cb->y , cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb); project_to_cube(cb->x , cb->y , cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb);
surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[0] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x + cb->w, cb->y , cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb); project_to_cube(cb->x + cb->w, cb->y , cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb);
surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[1] = (pt_2d){.x = p1, .y = p2, .z = p3};
project_to_cube(cb->x , cb->y + cb->h, cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb); project_to_cube(cb->x , cb->y + cb->h, cb->z + (sf==4)*(cb->d), &p1, &p2, &p3, cb);
surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3}; surface[2] = (pt_2d){.x = p1, .y = p2, .z = p3};
} }
@ -187,7 +177,7 @@ void getDirectors() {
void getNormal() { void getNormal() {
normal.x = directors[0].y*directors[1].z - directors[1].y*directors[0].z; normal.x = directors[0].y*directors[1].z - directors[1].y*directors[0].z;
normal.y = directors[0].z*directors[1].x - directors[1].z*directors[0].x; normal.y = -directors[0].z*directors[1].x + directors[1].z*directors[0].x;
normal.z = directors[0].x*directors[1].y - directors[1].x*directors[0].y; normal.z = directors[0].x*directors[1].y - directors[1].x*directors[0].y;
double norm = sqrt(normal.x*normal.x + normal.y*normal.y + normal.z*normal.z); double norm = sqrt(normal.x*normal.x + normal.y*normal.y + normal.z*normal.z);
normal.x /= norm; normal.x /= norm;
@ -202,31 +192,6 @@ void normalize(pt_2d* p) {
p->z /= norm; p->z /= norm;
} }
void debugMove(cube_0* cb) {
for(int d = 0; d < 6; d++) {
cb->x -= min_dist;
cb->y -= min_dist;
cb->z -= min_dist;
cb->w += 2*min_dist;
cb->h += 2*min_dist;
cb->d += 2*min_dist;
getSF(cb, d);
cb->x += min_dist;
cb->y += min_dist;
cb->z += min_dist;
cb->w -= 2*min_dist;
cb->h -= 2*min_dist;
cb->d -= 2*min_dist;
for(int k = 0; k < 3; k++) {
cube_0* cb2 = create_cube_0(surface[k].x-0.1, surface[k].y-0.1, surface[k].z-0.1, 0.2, 0.2, 0.2, 0.0, 0.0, 255, 255, 255);
gl_renderCube(cb2, 0.0, 0.0, 0.0);
free(cb2);
}
}
}
void updateF(cube_0* cb, double dtime) { void updateF(cube_0* cb, double dtime) {
for(int d = 0; d < 6; d++) { for(int d = 0; d < 6; d++) {
cb->x -= min_dist; cb->x -= min_dist;
@ -244,12 +209,11 @@ void updateF(cube_0* cb, double dtime) {
cb->d -= 2*min_dist; cb->d -= 2*min_dist;
getDirectors(); getDirectors();
getNormal(); getNormal();
if(d==2 || d==5 || d==1) { if(d%2==1) {
normal.x *= -1.0; normal.x *= -1.0;
normal.y *= -1.0; normal.y *= -1.0;
normal.z *= -1.0; normal.z *= -1.0;
} }
//printf("%lf %lf\n", dot3D(normal, directors[0]), dot3D(normal, directors[1]));
pt_2d vt = (pt_2d){.x = camx-camvx*dtime - surface[0].x, .y = camy-camvy*dtime - surface[0].y, .z = camz-camvz*dtime - surface[0].z}; pt_2d vt = (pt_2d){.x = camx-camvx*dtime - surface[0].x, .y = camy-camvy*dtime - surface[0].y, .z = camz-camvz*dtime - surface[0].z};
pt_2d vtdt = (pt_2d){.x = camx - surface[0].x, .y = camy - surface[0].y, .z = camz - surface[0].z}; pt_2d vtdt = (pt_2d){.x = camx - surface[0].x, .y = camy - surface[0].y, .z = camz - surface[0].z};
normalize(&vtdt); normalize(&vtdt);
@ -288,9 +252,6 @@ bool is_colliding(float dtime) {
if(vstd != NULL) { if(vstd != NULL) {
for(int k = 0; k < vstd->map_size; k++) { for(int k = 0; k < vstd->map_size; k++) {
double dist = distance_pt_cube_0_3d_infinite(camx-2*room_width*w, camy, camz-2*room_depth*h, vstd->map[k]); double dist = distance_pt_cube_0_3d_infinite(camx-2*room_width*w, camy, camz-2*room_depth*h, vstd->map[k]);
//if(vstd->map[k]->vt_angle != 0.0) {
// printf("(%lf)\n", dist);
//}
if(dist <= min_dist) { if(dist <= min_dist) {
if(updateForces) { if(updateForces) {
updateF(vstd->map[k], (double)dtime); updateF(vstd->map[k], (double)dtime);
@ -381,7 +342,7 @@ void movePlayerG(float dtime) {
is_clipping = true; is_clipping = true;
if(is_colliding(dtime)) { if(is_colliding(dtime)) {
if(is_clipping) { if(is_clipping) {
//player_hp -= (dtime)*clip_dps; player_hp -= (dtime)*clip_dps;
} }
//printf("HIT\n"); //printf("HIT\n");
//printf("[%lf, %lf, %lf]\n{%lf, %lf, %lf}\n\n", fx, fy, fz, camvx, camvy, camvz); //printf("[%lf, %lf, %lf]\n{%lf, %lf, %lf}\n\n", fx, fy, fz, camvx, camvy, camvz);

View File

@ -6,8 +6,6 @@ bool is_colliding(float dtime);
void update_buttons(float dtime); void update_buttons(float dtime);
void debugMove(cube_0* cb);
void teleport_on_edge(); void teleport_on_edge();
void movePlayerG(float dtime); void movePlayerG(float dtime);

View File

@ -94,7 +94,7 @@ void move_cube(cube_0* cb, double dx, double dy, double dz) {
void updateProj(float dtime) { void updateProj(float dtime) {
//printf("%d\n", bullets_id); //printf("%d\n", bullets_id);
for(int k = 0; k < bullets_id; k++) { for(int k = 0; k < bullets_id; k++) {
*(bullets[k].ttl) -= (double)dtime; *(bullets[k].ttl) -= 50.0*(double)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;

View File

@ -187,7 +187,7 @@ extern int loc_tex;
extern bool is_one_room; extern bool is_one_room;
extern unsigned int textures[32]; extern unsigned int textures[16];
extern float dmgCD; extern float dmgCD;
extern int lastDmg; extern int lastDmg;

View File

@ -13,8 +13,6 @@ Teleporters :
[9.0, 1.0, 4.0, 1.0, 4.0, 2.0, 0.0, 0.0, 0, 0, 255; 0, 1] [9.0, 1.0, 4.0, 1.0, 4.0, 2.0, 0.0, 0.0, 0, 0, 255; 0, 1]
Entities : Entities :
[1.0, -6.0, 3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 32, 1]
[1.0, -3.0, 3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 32, 3, 0.0, 4.0, 1.0, 1.0]
[-1.0, 13.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.5, 1.5, 0] [-1.0, 13.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.5, 1.5, 0]
[-1.0, 16.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 11, 4, 1.75] [-1.0, 16.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 11, 4, 1.75]
[-1.0, 19.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 12, 4, 1] [-1.0, 19.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 12, 4, 1]
@ -24,3 +22,28 @@ Weight :
50 50
$ $
entities:
[x, y, z, w, h, d, rhz, rvt, red, green, blue, hp, damage, entityType ..]
if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
else if entityType = 6 (text box)
[.. text] with
text = {char*}
else if entityType = 7 (warp text box)
[.. dest_folder, room_count, text, r, g, b] with
{dest_folder,text} = {char*} (length <= 50)
{r,g,b} = int[0-256]
else
[..]

View File

@ -14,8 +14,10 @@ Teleporters :
[-5.0, 1.0, 9.0, 10.0, 2.0, 1.0, 0.0, 0.0, 0, 0, 255; 0, 1] [-5.0, 1.0, 9.0, 10.0, 2.0, 1.0, 0.0, 0.0, 0, 0, 255; 0, 1]
Entities : Entities :
[3.0, 3.0, 3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 255, 192, 0, 1, 0, 3]
[-3.0, 3.0, 3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0] [-3.0, 3.0, 3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[3.0, 3.0, -3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0] [3.0, 3.0, -3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[-3.0, 3.0, -3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 255, 192, 0, 1, 0, 3]
Weight : Weight :
50 50