diff --git a/Makefile b/Makefile index 795a959..48343b4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC = gcc -FLAGS = -Wall -Wextra -Wpedantic -g +FLAGS = -O2 -Wall -Wextra -Wpedantic -g LFLAGS = -lSDL2 -lSDL2_image -lm -lncurses all: bin/back diff --git a/bin/back b/bin/back index d1548fa..c7b79b5 100755 Binary files a/bin/back and b/bin/back differ diff --git a/obj/base.o b/obj/base.o index 35e4d3b..e32cba1 100644 Binary files a/obj/base.o and b/obj/base.o differ diff --git a/obj/display.o b/obj/display.o index 16a0367..8e57dc0 100644 Binary files a/obj/display.o and b/obj/display.o differ diff --git a/obj/generation.o b/obj/generation.o index 7075368..6282568 100644 Binary files a/obj/generation.o and b/obj/generation.o differ diff --git a/obj/hash.o b/obj/hash.o index bc343c1..0808bd8 100644 Binary files a/obj/hash.o and b/obj/hash.o differ diff --git a/obj/main.o b/obj/main.o index 02196ab..7701bf7 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/obj/move.o b/obj/move.o index 0adae66..3b8c85f 100644 Binary files a/obj/move.o and b/obj/move.o differ diff --git a/src/display.c b/src/display.c index 6652ecf..4bd6d98 100644 --- a/src/display.c +++ b/src/display.c @@ -386,6 +386,13 @@ SDL_Vertex construct_vertex(double px, double py, int r, int g, int b) { return vtx ; } + double px0; double py0; double pz0; + double px1; double py1; double pz1; + double px2; double py2; double pz2; + double fpx0; double fpy0; double fpz0; + double fpx1; double fpy1; double fpz1; + double mpx0; double mpy0; double mpz0; + double mpx1; double mpy1; double mpz1; void renderTriangle( SDL_Renderer* renderer, double x0, double y0, double z0, @@ -393,9 +400,6 @@ void renderTriangle( double x2, double y2, double z2, int red, int green, int blue ) { - double px0; double py0; double pz0; - double px1; double py1; double pz1; - double px2; double py2; double pz2; project_to_camera(x0, y0, z0, &px0, &py0, &pz0); project_to_camera(x1, y1, z1, &px1, &py1, &pz1); project_to_camera(x2, y2, z2, &px2, &py2, &pz2); @@ -407,10 +411,6 @@ void renderTriangle( }; SDL_RenderGeometry(renderer, NULL, vtxs, 3, NULL, 0); } else if((pz0 >= draw_constant) + (pz1 >= draw_constant) + (pz2 >= draw_constant) == 2) { - double fpx0; double fpy0; double fpz0; - double fpx1; double fpy1; double fpz1; - double mpx0; double mpy0; double mpz0; - double mpx1; double mpy1; double mpz1; if(pz0 < draw_constant) { // pz1 >= draw_constant and pz2 >+ draw_constant fpx0 = px1 ; fpy0 = py1 ; fpz0 = pz1 ; @@ -445,7 +445,7 @@ void renderTriangle( convex_pt(y2, y1, (pz2 - draw_constant)/(pz2 - pz1)), convex_pt(z2, z1, (pz2 - draw_constant)/(pz2 - pz1)), &mpx1, &mpy1, &mpz1) ; - } else if(pz2 < draw_constant) { + } else /*if(pz2 < draw_constant)*/ { // pz1 >= draw_constant and pz0 >+ draw_constant fpx0 = px0 ; fpy0 = py0 ; fpz0 = pz0 ; fpx1 = px1 ; fpy1 = py1 ; fpz1 = pz1 ; @@ -525,9 +525,9 @@ void renderTriangleRotated( int red, int green, int blue, cube_0 cb ) { - double px0; double py0; double pz0; + /*double px0; double py0; double pz0; double px1; double py1; double pz1; - double px2; double py2; double pz2; + double px2; double py2; double pz2;*/ rotate_cube(x0, y0, z0, &px0, &py0, &pz0, cb); rotate_cube(x1, y1, z1, &px1, &py1, &pz1, cb); rotate_cube(x2, y2, z2, &px2, &py2, &pz2, cb); @@ -630,15 +630,9 @@ void drawCurrentRoom(SDL_Renderer* renderer) { insertionSort_cb(current_room->map, current_room->map_size); insertionSort_tp(current_room->tps, current_room->tps_size); for(int k = 0; k < current_room->map_size; k++) { - SDL_SetRenderDrawColor(renderer, current_room->map[k].red/2, current_room->map[k].green/2, current_room->map[k].blue/2, 255); - drawOutlineOfCube_0(renderer, current_room->map[k]); - drawFullCube(renderer, current_room->map[k]); } for(int k = 0; k < current_room->tps_size; k++) { - SDL_SetRenderDrawColor(renderer, current_room->tps[k].hitbox.red/2, current_room->tps[k].hitbox.green/2, current_room->tps[k].hitbox.blue/2, 255); - drawOutlineOfCube_0(renderer, current_room->tps[k].hitbox); - drawFullCube(renderer, current_room->tps[k].hitbox); } } diff --git a/templates/room_2 b/templates/room_2 index a152dec..c129fd5 100644 --- a/templates/room_2 +++ b/templates/room_2 @@ -14,6 +14,6 @@ Teleporters : [-5.0, 1.0, 9.0, 10.0, 2.0, 1.0, 0.0, 0.0, 0, 0, 255; 1, 0] Weight : -10 +30 $ \ No newline at end of file