Compare commits

..

3 Commits

32 changed files with 423 additions and 200 deletions

View File

@ -7,7 +7,7 @@ all: bin/back
test: bin/back
bin/back
bin/back: obj/main.o obj/generation.o obj/display.o obj/entities.o obj/triangles.o obj/move.o obj/base.o obj/hash.o
bin/back: obj/main.o obj/generation.o obj/display.o obj/entities.o obj/bullets.o obj/menus.o obj/triangles.o obj/move.o obj/base.o obj/hash.o
mkdir -p bin
$(CC) $(FLAGS) $^ $(LFLAGS) -o $@
@ -20,8 +20,10 @@ obj/generation.o: src/generation.c
obj/display.o: src/display.c
obj/entities.o: src/entities.c
obj/triangles.o: src/triangles.c
obj/bullets.o: src/bullets.c
obj/move.o: src/move.c
obj/base.o: src/base.c
obj/menus.o: src/menus.c
obj/hash.o: src/hash.c
.PHONY: clean mrproper

BIN
bin/back

Binary file not shown.

Binary file not shown.

BIN
obj/bullets.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
obj/menus.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -182,7 +182,7 @@ bool str_equal(char* s1, char* s2) {
// ------------------------------------------------------------------------------------------------ //
cube_0 create_cube_0(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b) {
cube_0* create_cube_0(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b) {
cube_0* cb = malloc(sizeof(cube_0)) ;
cb->red = r ;
cb->green = g ;
@ -195,12 +195,12 @@ cube_0 create_cube_0(double x, double y, double z, double w, double h, double d,
cb->d = d ;
cb->hz_angle = hz_a ;
cb->vt_angle = vt_a ;
return *cb ;
return cb ;
}
cube create_cube(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b) {
cube cb = malloc(sizeof(cube_0));
*cb = create_cube_0(x, y, z, w, h, d, hz_a, vt_a, r, g, b) ;
cb = create_cube_0(x, y, z, w, h, d, hz_a, vt_a, r, g, b) ;
return cb;
}
@ -276,23 +276,23 @@ double distance_pt_cube_aligned_3d_max(double x0, double y0, double z0, double c
return (distance_pt_cube_axis_max(x0, cx, cx+cw)+distance_pt_cube_axis_max(y0, cy, cy+ch)+distance_pt_cube_axis_max(z0, cz, cz+cd)) ;
}
double distance_pt_cube_0_3d(double x0, double y0, double z0, cube_0 c) {
double distance_pt_cube_0_3d(double x0, double y0, double z0, cube_0* c) {
// places the origin at the center of the cube
double x = x0 - (c.x + c.w/2.0) ;
double y = y0 - (c.y + c.h/2.0) ;
double z = z0 - (c.z + c.d/2.0) ;
double x = x0 - (c->x + c->w/2.0) ;
double y = y0 - (c->y + c->h/2.0) ;
double z = z0 - (c->z + c->d/2.0) ;
// rotate the point : y then x
double xry = x*cos(c.hz_angle) + z*sin(c.hz_angle) ;
double xry = x*cos(c->hz_angle) + z*sin(c->hz_angle) ;
double yry = y ;
double zry = z*cos(c.hz_angle) - x*sin(c.hz_angle) ;
double zry = z*cos(c->hz_angle) - x*sin(c->hz_angle) ;
double xrx = xry ;
double yrx = yry*cos(c.vt_angle) - zry*sin(c.vt_angle) ;
double zrx = zry*cos(c.vt_angle) + yry*sin(c.vt_angle) ;
double yrx = yry*cos(c->vt_angle) - zry*sin(c->vt_angle) ;
double zrx = zry*cos(c->vt_angle) + yry*sin(c->vt_angle) ;
// now the cube and pt are aligned, and (0, 0, 0) is at the cube's (bary)center
return distance_pt_cube_aligned_3d(xrx, yrx, zrx, -c.w/2.0, -c.h/2.0, -c.d/2.0, c.w, c.h, c.d) ;
return distance_pt_cube_aligned_3d(xrx, yrx, zrx, -c->w/2.0, -c->h/2.0, -c->d/2.0, c->w, c->h, c->d) ;
}
double distance_pt_cube_0_3d_max(double x0, double y0, double z0, cube_0 c) {
@ -338,7 +338,7 @@ double distance_pt_cube_0_3d_weighted(double x0, double y0, double z0, double mx
}
double distance_pt_cube_3d(double x0, double y0, double z0, cube cb) {
return distance_pt_cube_0_3d(x0, y0, z0, *cb) ;
return distance_pt_cube_0_3d(x0, y0, z0, cb) ;
}
double zdepth_of_pt(double x0, double y0, double z0) {

View File

@ -29,7 +29,7 @@ pt_2d vect_diff(pt_2d p1, pt_2d p2);
double dot2D(pt_2d p1, pt_2d p2);
double dot3D(pt_2d p1, pt_2d p2);
cube_0 create_cube_0(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b);
cube_0* create_cube_0(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b);
cube create_cube(double x, double y, double z, double w, double h, double d, double hz_a, double vt_a, int r, int g, int b);
void free_cube(cube c);
teleporter create_teleporter(
@ -48,7 +48,7 @@ double distance_pt_pt_3d(double x0, double y0, double z0, double x1, double y1,
double distance_pt_seg_3d(double x, double y, double z, double sx, double sy, double sz, double ex, double ey, double ez);
double distance_pt_cube_axis(double coord, double begin, double end);
double distance_pt_cube_aligned_3d(double x0, double y0, double z0, double cx, double cy, double cz, double cw, double ch, double cd);
double distance_pt_cube_0_3d(double x0, double y0, double z0, cube_0 c);
double distance_pt_cube_0_3d(double x0, double y0, double z0, cube_0* c);
double distance_pt_cube_aligned_3d_weighted(double x0, double y0, double z0, double cx, double cy, double cz, double cw, double ch, double cd, double mx, double my, double mz);
double distance_pt_cube_0_3d_weighted(double x0, double y0, double z0, double mx, double my, double mz, cube_0 c);

19
src/bullets.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <ncurses.h>
#include <unistd.h>
#include <termios.h>
#include <limits.h>
#include <time.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "hash.h"
#include "structure.h"
#include "base.h"
#include "move.h"
#include "entities.h"
#include "bullets.h"

5
src/bullets.h Normal file
View File

@ -0,0 +1,5 @@
#ifndef BULLETS_H
#define BULLETS_H
#endif

View File

@ -82,8 +82,8 @@ void placeRectToRenderer(SDL_Renderer* renderer, int X, int Y, int W, int H, int
rect.y = Y;
rect.w = W;
rect.h = H;
SDL_SetRenderDrawColor(renderer, R, G, B, A);
SDL_RenderFillRect(renderer, &rect);
assert(SDL_SetRenderDrawColor(renderer, R, G, B, A) == 0);
assert(SDL_RenderFillRect(renderer, &rect) == 0);
}
void placeRectToRendererNoColor(SDL_Renderer* renderer, int X, int Y, int W, int H) {
@ -225,59 +225,23 @@ double square_z_distance_to_camera(
) {
return maxd(segment_z_distance_to_camera(x0, y0, z0, x1, y1, z1), segment_z_distance_to_camera(x0, y0, z0, x2, y2, z2));
}
double cube_z_distance_to_camera(cube_0 cb) {
double dist_0 = square_z_distance_to_camera(
cb.x + cb.w, cb.y, cb.z,
cb.x + cb.w, cb.y + cb.h, cb.z,
cb.x + cb.w, cb.y, cb.z + cb.d
);
double dist_1 = square_z_distance_to_camera(
cb.x, cb.y, cb.z,
cb.x, cb.y + cb.h, cb.z,
cb.x, cb.y, cb.z + cb.d
);
double dist_2 = square_z_distance_to_camera(
cb.x, cb.y + cb.h, cb.z,
cb.x + cb.w, cb.y + cb.h, cb.z,
cb.x, cb.y + cb.h, cb.z + cb.d
);
double dist_3 = square_z_distance_to_camera(
cb.x, cb.y, cb.z,
cb.x + cb.w, cb.y, cb.z,
cb.x, cb.y, cb.z + cb.d
);
double dist_4 = square_z_distance_to_camera(
cb.x, cb.y, cb.z + cb.d,
cb.x + cb.w, cb.y, cb.z + cb.d,
cb.x, cb.y + cb.h, cb.z + cb.d
);
double dist_5 = square_z_distance_to_camera(
cb.x, cb.y, cb.z,
cb.x + cb.w, cb.y, cb.z,
cb.x, cb.y + cb.h, cb.z
);
return maxd(maxd(dist_0, dist_1), maxd(maxd(dist_2, dist_3), maxd(dist_4, dist_5)));
}
// ---------------------------------------------------------------------------------------------------------------------------------- //
void rotate_cube(double x0, double y0, double z0, double* rx, double* ry, double* rz, cube_0 cb) {
void rotate_cube(double x0, double y0, double z0, double* rx, double* ry, double* rz, cube_0* cb) {
// align pt to (0, 0, 0)
double x = x0 - (cb.x + cb.w/2) ;
double y = y0 - (cb.y + cb.h/2) ;
double z = z0 - (cb.z + cb.d/2) ;
double x = x0 - (cb->x + cb->w/2) ;
double y = y0 - (cb->y + cb->h/2) ;
double z = z0 - (cb->z + cb->d/2) ;
// rotate (y)
double xry = x*cos(cb.hz_angle) - z*sin(cb.hz_angle) ;
double xry = x*cos(cb->hz_angle) - z*sin(cb->hz_angle) ;
double yry = y ;
double zry = z*cos(cb.hz_angle) + x*sin(cb.hz_angle) ;
double zry = z*cos(cb->hz_angle) + x*sin(cb->hz_angle) ;
// rotate (x)
*rx = (cb.x + cb.w/2) + xry ;
*ry = (cb.y + cb.h/2) + yry*cos(cb.vt_angle) - zry*sin(cb.vt_angle) ;
*rz = (cb.z + cb.d/2) + zry*cos(cb.vt_angle) + yry*sin(cb.vt_angle) ;
*rx = (cb->x + cb->w/2) + xry ;
*ry = (cb->y + cb->h/2) + yry*cos(cb->vt_angle) - zry*sin(cb->vt_angle) ;
*rz = (cb->z + cb->d/2) + zry*cos(cb->vt_angle) + yry*sin(cb->vt_angle) ;
}
void draw_segment(SDL_Renderer* renderer, double sx, double sy, double sz, double ex, double ey, double ez) {
@ -401,44 +365,44 @@ void drawOutlineOfCube_0(SDL_Renderer* renderer, cube_0 c) {
// -------------------------------------------------------------------------------------------------------------------------------- //
// this is where the fun begins
int surfaceDrawOrder(double x0, double y0, double z0, cube_0 cb) {
int surfaceDrawOrder(double x0, double y0, double z0, cube_0* cb) {
// returns the number of surfaces that should be drawn, as well as filling drawOrder for said surfaces :
// 0 = +x ; 1 = -x
// 2 = +y ; 3 = -y
// 4 = +z ; 5 = -z
// align cube center to (0, 0, 0)
double x = x0 - (cb.x + cb.w/2.0) ;
double y = y0 - (cb.y + cb.h/2.0) ;
double z = z0 - (cb.z + cb.d/2.0) ;
double x = x0 - (cb->x + cb->w/2.0) ;
double y = y0 - (cb->y + cb->h/2.0) ;
double z = z0 - (cb->z + cb->d/2.0) ;
// rotate (y)
double xry = x*cos(cb.hz_angle) + z*sin(cb.hz_angle) ;
double xry = x*cos(cb->hz_angle) + z*sin(cb->hz_angle) ;
double yry = y ;
double zry = z*cos(cb.hz_angle) - x*sin(cb.hz_angle) ;
double zry = z*cos(cb->hz_angle) - x*sin(cb->hz_angle) ;
// rotate (x)
double xrx = xry ;
double yrx = yry*cos(cb.vt_angle) + zry*sin(cb.vt_angle) ;
double zrx = zry*cos(cb.vt_angle) - yry*sin(cb.vt_angle) ;
double yrx = yry*cos(cb->vt_angle) + zry*sin(cb->vt_angle) ;
double zrx = zry*cos(cb->vt_angle) - yry*sin(cb->vt_angle) ;
// cube is centered and aligned
int id = 0 ;
if(xrx > cb.w/2.0) {
if(xrx > cb->w/2.0) {
drawOrder[id] = 0 ;
id += 1 ;
} else if(xrx < -cb.w/2.0) {
} else if(xrx < -cb->w/2.0) {
drawOrder[id] = 1 ;
id += 1 ;
}
if(yrx > cb.h/2.0) {
if(yrx > cb->h/2.0) {
drawOrder[id] = 2 ;
id += 1 ;
} else if(yrx < -cb.h/2.0) {
} else if(yrx < -cb->h/2.0) {
drawOrder[id] = 3 ;
id += 1 ;
}
if(zrx > cb.d/2.0) {
if(zrx > cb->d/2.0) {
drawOrder[id] = 4 ;
id += 1 ;
} else if(zrx < -cb.d/2.0) {
} else if(zrx < -cb->d/2.0) {
drawOrder[id] = 5 ;
id += 1 ;
}
@ -481,7 +445,7 @@ void renderTriangleNoProject(
if(debug) {
printf("P[*] : (%f, %f), (%f, %f), (%f, %f)\n", vtxs[0].position.x, vtxs[0].position.y, vtxs[1].position.x, vtxs[1].position.y, vtxs[2].position.x, vtxs[2].position.y);
}
SDL_RenderGeometry(renderer, NULL, vtxs, 3, NULL, 0);
assert(SDL_RenderGeometry(renderer, NULL, vtxs, 3, NULL, 0) == 0);
}
double near = -1.0 ;
@ -691,7 +655,7 @@ void addTriangleRotated(
double x1, double y1, double z1,
double x2, double y2, double z2,
int red, int green, int blue,
cube_0 cb
cube_0* cb
) {
double px0; double py0; double pz0;
double px1; double py1; double pz1;
@ -704,54 +668,54 @@ void addTriangleRotated(
// -------------------------------------------------------------------------------------------------------------------------------- //
void add_single(cube_0 c) { // x
void add_single(cube_0* c) { // x
int leng = surfaceDrawOrder(camx, camy, camz, c);
for(int sf0 = 0; sf0 < leng; sf0++) {
int sf = drawOrder[sf0];
if(sf == 0 || sf == 1) {
addTriangleRotated(
c.x + c.w*(sf==0), c.y , c.z,
c.x + c.w*(sf==0), c.y + c.h, c.z,
c.x + c.w*(sf==0), c.y + c.h, c.z + c.d,
c.red, c.green, c.blue, c
c->x + c->w*(sf==0), c->y , c->z,
c->x + c->w*(sf==0), c->y + c->h, c->z,
c->x + c->w*(sf==0), c->y + c->h, c->z + c->d,
c->red, c->green, c->blue, c
);
addTriangleRotated(
c.x + c.w*(sf==0), c.y, c.z,
c.x + c.w*(sf==0), c.y, c.z + c.d,
c.x + c.w*(sf==0), c.y + c.h, c.z + c.d,
c.red, c.green, c.blue, c
c->x + c->w*(sf==0), c->y, c->z,
c->x + c->w*(sf==0), c->y, c->z + c->d,
c->x + c->w*(sf==0), c->y + c->h, c->z + c->d,
c->red, c->green, c->blue, c
);
} else if(sf == 2 || sf == 3) {
addTriangleRotated(
c.x , c.y + c.h*(sf==2), c.z,
c.x + c.w, c.y + c.h*(sf==2), c.z,
c.x + c.w, c.y + c.h*(sf==2), c.z + c.d,
c.red, c.green, c.blue, c
c->x , c->y + c->h*(sf==2), c->z,
c->x + c->w, c->y + c->h*(sf==2), c->z,
c->x + c->w, c->y + c->h*(sf==2), c->z + c->d,
c->red, c->green, c->blue, c
);
addTriangleRotated(
c.x , c.y + c.h*(sf==2), c.z,
c.x , c.y + c.h*(sf==2), c.z + c.d,
c.x + c.w, c.y + c.h*(sf==2), c.z + c.d,
c.red, c.green, c.blue, c
c->x , c->y + c->h*(sf==2), c->z,
c->x , c->y + c->h*(sf==2), c->z + c->d,
c->x + c->w, c->y + c->h*(sf==2), c->z + c->d,
c->red, c->green, c->blue, c
);
} else { // z
addTriangleRotated(
c.x , c.y , c.z + c.d*(sf==4),
c.x + c.w, c.y , c.z + c.d*(sf==4),
c.x + c.w, c.y + c.h, c.z + c.d*(sf==4),
c.red, c.green, c.blue, c
c->x , c->y , c->z + c->d*(sf==4),
c->x + c->w, c->y , c->z + c->d*(sf==4),
c->x + c->w, c->y + c->h, c->z + c->d*(sf==4),
c->red, c->green, c->blue, c
);
addTriangleRotated(
c.x , c.y , c.z + c.d*(sf==4),
c.x , c.y + c.h, c.z + c.d*(sf==4),
c.x + c.w, c.y + c.h, c.z + c.d*(sf==4),
c.red, c.green, c.blue, c
c->x , c->y , c->z + c->d*(sf==4),
c->x , c->y + c->h, c->z + c->d*(sf==4),
c->x + c->w, c->y + c->h, c->z + c->d*(sf==4),
c->red, c->green, c->blue, c
);
}
}
}
void add_triangles_cb(cube_0* arr, int len) {
void add_triangles_cb(cube_0** arr, int len) {
for(int k = 0; k < len; k++) {
add_single(arr[k]);
}
@ -765,7 +729,7 @@ void add_triangles_tp(teleporter* arr, int len) {
void add_triangles_ent(entity* arr, int len) {
for(int k = 0; k < len; k++) {
add_single(*(arr[k].pos));
add_single(arr[k].pos);
}
}
@ -779,7 +743,7 @@ void renderTriangleFull(SDL_Renderer* renderer, int k) {
}
void remove_hidden(SDL_Renderer* renderer) {
printf("%d --> ", triangles_i);
//printf("%d --> ", triangles_i);
for(int k = 0; k < triangles_i; k++) {
int halt = 1 ;
bool fst = false ;
@ -804,8 +768,9 @@ void remove_hidden(SDL_Renderer* renderer) {
}
}
}
halt = 1 ;
}
printf("%d\n", triangles_i);
//printf("%d\n", triangles_i);
}
void visit(int k, bool vflag) {

View File

@ -28,7 +28,6 @@ double square_z_distance_to_camera(
double x1, double y1, double z1,
double x2, double y2, double z2
);
double cube_z_distance_to_camera(cube_0 cb);
void axialRotation_X0(double* y, double* z, double theta);
void axialRotation_X(double* y, double* z, double theta, double cst_y, double cst_z);

View File

@ -71,8 +71,40 @@ void detectHit(float dtime, int* hp, int* dmg, cube_0* ret) {
ret->green = 192;
ret->blue = 0;
coins += *hp;
player_hp -= 10*(*hp);
player_hp -= (*dmg);
if(*dmg != 0) {
fade_dmg = 255 ;
}
*hp = 0 ;
}
}
void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, cube_0* ret) {
double dx = (x+w/2 - camx);
double dy = (y+h/2 - camy);
double dz = (z+d/2 - camz);
double total = sqrt(dx*dx + dy*dy + dz*dz) ;
dx = 7.0*dx/total;
dy = 7.0*dy/total;
dz = 7.0*dz/total;
ret->x -=12.0*dtime*dx ;
if(is_colliding_with_map(*ret) || is_colliding_with_tp(*ret)) {
ret->x +=12.0*dtime*dx ;
}
ret->y -=12.0*dtime*dy ;
if(is_colliding_with_map(*ret) || is_colliding_with_tp(*ret)) {
ret->y +=12.0*dtime*dy ;
}
ret->z -=12.0*dtime*dz ;
if(is_colliding_with_map(*ret) || is_colliding_with_tp(*ret)) {
ret->z +=12.0*dtime*dz ;
}
}
void explodeOnHit(float dtime, int* hp, int* dmg, cube_0* ret) {
player_hp -= (*dmg);
if(*dmg != 0) {
fade_dmg = 255 ;
}
*hp = 0 ;
}

View File

@ -8,9 +8,11 @@ void update_entity(entity* ent, float dtime);
void update_entities(float dtime);
void speen(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, 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, cube_0* ret);
void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, cube_0* ret);
void detectHit(float dtime, int* hp, int* dmg, cube_0* ret);
void explodeOnHit(float dtime, int* hp, int* dmg, cube_0* ret);
#endif

View File

@ -28,26 +28,64 @@ int pool_size ;
int total_weight ;
int coins ;
int fct_entry_size ;
fct_entry* hashtbl_entities ;
void init_ent_generator(int n) {
hashtbl_entities = malloc(sizeof(fct_entry)*n);
fct_entry_size = n;
for(int k = 0; k < 10; k++) {
hashtbl_entities[k].id = (-1) ;
}
hashtbl_entities[0].id = 0;
hashtbl_entities[0].name = "Coin"; // 0 = default
hashtbl_entities[0].updatePos = &speen2 ;
hashtbl_entities[0].onHit = &detectHit ;
hashtbl_entities[0].onDeath = NULL ;
hashtbl_entities[1].id = 1;
hashtbl_entities[1].name = "ExplosiveStill";
hashtbl_entities[1].updatePos = &speen2 ;
hashtbl_entities[1].onHit = &explodeOnHit ;
hashtbl_entities[1].onDeath = NULL ;
hashtbl_entities[2].id = 2;
hashtbl_entities[2].name = "ExplosiveSeek";
hashtbl_entities[2].updatePos = &go_to_player ;
hashtbl_entities[2].onHit = &explodeOnHit ;
hashtbl_entities[2].onDeath = NULL ;
}
fct_entry* get_entry(int k0) {
for(int k = 0; k < fct_entry_size; k++) {
if(hashtbl_entities[k].id == k0) {
return &(hashtbl_entities[k]);
}
}
return NULL;
}
void copy_room(room* src, room* dest, int chx, int chy) {
// considering dest has already been malloc'd
dest->chunk_x = chx ;
dest->chunk_y = chy ;
dest->map = malloc(sizeof(cube_0)*src->map_size);
dest->map = malloc(sizeof(cube_0*)*src->map_size);
for(int k = 0; k < src->map_size; k++) {
dest->map[k] = create_cube_0(
src->map[k].x, src->map[k].y, src->map[k].z,
src->map[k].w, src->map[k].h, src->map[k].d,
src->map[k].hz_angle, src->map[k].vt_angle, src->map[k].red, src->map[k].green, src->map[k].blue
src->map[k]->x, src->map[k]->y, src->map[k]->z,
src->map[k]->w, src->map[k]->h, src->map[k]->d,
src->map[k]->hz_angle, src->map[k]->vt_angle, src->map[k]->red, src->map[k]->green, src->map[k]->blue
);
}
dest->map_size = src->map_size ;
dest->tps = malloc(sizeof(teleporter)*src->tps_size);
for(int k = 0; k < src->tps_size; k++) {
dest->tps[k].hitbox = create_cube_0(
src->tps[k].hitbox.x, src->tps[k].hitbox.y, src->tps[k].hitbox.z,
src->tps[k].hitbox.w, src->tps[k].hitbox.h, src->tps[k].hitbox.d,
src->tps[k].hitbox.hz_angle, src->tps[k].hitbox.vt_angle, src->tps[k].hitbox.red, src->tps[k].hitbox.green, src->tps[k].hitbox.blue
src->tps[k].hitbox->x, src->tps[k].hitbox->y, src->tps[k].hitbox->z,
src->tps[k].hitbox->w, src->tps[k].hitbox->h, src->tps[k].hitbox->d,
src->tps[k].hitbox->hz_angle, src->tps[k].hitbox->vt_angle, src->tps[k].hitbox->red, src->tps[k].hitbox->green, src->tps[k].hitbox->blue
);
dest->tps[k].dest_chx = src->tps[k].dest_chx + chx;
dest->tps[k].dest_chy = src->tps[k].dest_chy + chy;
@ -62,8 +100,7 @@ void copy_room(room* src, room* dest, int chx, int chy) {
dest->ents[k].damage = src->ents[k].damage ;
dest->ents[k].hitpoints = malloc(sizeof(int));
*(dest->ents[k].hitpoints) = *(src->ents[k].hitpoints) ;
dest->ents[k].pos = malloc(sizeof(cube_0));
*(dest->ents[k].pos) = create_cube_0(
dest->ents[k].pos = create_cube_0(
(*(src->ents[k].pos)).x, (*(src->ents[k].pos)).y, (*(src->ents[k].pos)).z,
(*(src->ents[k].pos)).w, (*(src->ents[k].pos)).h, (*(src->ents[k].pos)).d,
(*(src->ents[k].pos)).hz_angle, (*(src->ents[k].pos)).vt_angle, (*(src->ents[k].pos)).red, (*(src->ents[k].pos)).green, (*(src->ents[k].pos)).blue
@ -79,7 +116,7 @@ void build_starting_chunk(int chx, int chy) {
room* new = malloc(sizeof(room));
new->chunk_x = chx ;
new->chunk_y = chy ;
new->map = malloc(sizeof(cube_0)*8);
new->map = malloc(sizeof(cube_0)*9);
new->map_size = 9 ;
new->tps = malloc(sizeof(teleporter)*4);
new->tps_size = 4 ;
@ -102,8 +139,7 @@ void build_starting_chunk(int chx, int chy) {
new->ents = malloc(sizeof(entity)*128);
new->ent_len = 1 ;
new->ent_memlen = 128 ;
new->ents[0].pos = malloc(sizeof(cube_0));
*(new->ents[0].pos) = create_cube_0(-0.25, 8.25, -0.25, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 128, 0);
new->ents[0].pos = create_cube_0(-0.25, 8.25, -0.25, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 128, 0);
new->ents[0].damage = 0 ;
new->ents[0].hitpoints = malloc(sizeof(int));
*(new->ents[0].hitpoints) = 5 ;
@ -279,31 +315,39 @@ void parse_one_room(int id, char* filename) {
int blue = read_int(ptr, true);
int hp = read_int(ptr, true);
int dmg = read_int(ptr, true);
pool[id].area->ents[k].pos = malloc(sizeof(cube_0));
*(pool[id].area->ents[k].pos) = create_cube_0(cx, cy, cz, cw, ch, cd, chz, cvt, red, green, blue);
int fid = read_int(ptr, true);
fct_entry* entry = get_entry(fid);
if(entry == NULL) {
entry = get_entry(0);
}
pool[id].area->ents[k].pos = create_cube_0(cx, cy, cz, cw, ch, cd, chz, cvt, red, green, blue);
pool[id].area->ents[k].damage = dmg ;
pool[id].area->ents[k].hitpoints = malloc(sizeof(int));
*(pool[id].area->ents[k].hitpoints) = hp ;
pool[id].area->ents[k].updatePos = *speen ;
pool[id].area->ents[k].onHit = *detectHit ;
pool[id].area->ents[k].onDeath = NULL ;
pool[id].area->ents[k].updatePos = entry->updatePos ;
pool[id].area->ents[k].onHit = entry->onHit ;
pool[id].area->ents[k].onDeath = entry->onDeath ;
//pool[id].area->ents[k].updatePos = &speen2 ;
//pool[id].area->ents[k].onHit = &detectHit ;
//pool[id].area->ents[k].onDeath = NULL ;
//printf("\n");
}
// debug
for(int k = 0; k < ncubes; k++) {
printf("(%lf, %lf, %lf), (%lf, %lf, %lf), (%lf, %lf), (%d, %d, %d)\n",
pool[id].area->map[k].x,
pool[id].area->map[k].y,
pool[id].area->map[k].z,
pool[id].area->map[k].w,
pool[id].area->map[k].h,
pool[id].area->map[k].d,
pool[id].area->map[k].hz_angle,
pool[id].area->map[k].vt_angle,
pool[id].area->map[k].red,
pool[id].area->map[k].green,
pool[id].area->map[k].blue
pool[id].area->map[k]->x,
pool[id].area->map[k]->y,
pool[id].area->map[k]->z,
pool[id].area->map[k]->w,
pool[id].area->map[k]->h,
pool[id].area->map[k]->d,
pool[id].area->map[k]->hz_angle,
pool[id].area->map[k]->vt_angle,
pool[id].area->map[k]->red,
pool[id].area->map[k]->green,
pool[id].area->map[k]->blue
);
}
printf("\n\n");
@ -379,3 +423,22 @@ void generate_nearby_chunks(int render_dist) {
}
}
}
void free_pool() {
for(int k0 = 0; k0 < pool_size; k0++) {
for(int k = 0; k < pool[k0].area->map_size; k++) {
free(pool[k0].area->map[k]);
}
for(int k = 0; k < pool[k0].area->tps_size; k++) {
free(pool[k0].area->tps[k].hitbox);
}
for(int k = 0; k < pool[k0].area->ent_len; k++) {
free(pool[k0].area->ents[k].hitpoints);
free(pool[k0].area->ents[k].pos);
}
free(pool[k0].area->ents);
free(pool[k0].area->tps);
free(pool[k0].area->map);
}
free(pool);
}

View File

@ -6,6 +6,18 @@ typedef struct entry {
int weight ;
} entry ;
typedef struct fct_entry {
int id ;
char* name ;
void (*updatePos)(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, cube_0* ret) ;
// act as velocity function
void (*onHit)(float dtime, int* hp, int* dmg, cube_0* ret) ;
// triggers when object is hit
void (*onDeath)(float dtime) ;
} fct_entry ;
void init_ent_generator(int n);
void copy_room(room* src, room* dest, int chx, int chy) ;
void build_starting_chunk(int chx, int chy) ;
@ -20,4 +32,6 @@ void parse_rooms(int n_rooms) ;
void generate_nearby_chunks(int render_dist) ;
void free_pool();
#endif

View File

@ -60,9 +60,27 @@ void linkedList_add(linkedList lst, int chx, int chy, room* area) {
}
}
void free_all_cubes(room* r) {
for(int k = 0; k < r->map_size; k++) {
free(r->map[k]);
}
for(int k = 0; k < r->tps_size; k++) {
free(r->tps[k].hitbox);
}
for(int k = 0; k < r->ent_len; k++) {
free(r->ents[k].hitpoints);
free(r->ents[k].pos);
}
free(r->ents);
free(r->tps);
free(r->map);
}
void linkedList_free(linkedList lst) {
// frees rooms as well (require all created rooms to be there)
if(lst != NULL) {
printf("freeing (%d, %d)\n", lst->chx, lst->chy);
free_all_cubes(lst->area);
linkedList_free(lst->next);
free(lst->area);
free(lst);
@ -133,7 +151,8 @@ void hashtbl_add(hashtbl tbl, int chx, int chy, room* area) {
void hashtbl_free(hashtbl tbl) {
for(int k = 0; k < tbl->tabLength; k++) {
free(tbl->tab[k]);
linkedList_free(tbl->tab[k]);
}
free(tbl->tab);
free(tbl);
}

View File

@ -37,7 +37,11 @@ int main(int argc, char** argv) {
Uint32 render_flags = SDL_RENDERER_ACCELERATED;
SDL_Renderer* rend = SDL_CreateRenderer(win, -1, render_flags);
SDL_SetRenderDrawBlendMode(rend, SDL_BLENDMODE_BLEND);
if(rend == NULL) {
printf( "ERROR : cannot initialize SDL renderer\n");
exit(1);
}
printf( "%d\n", SDL_SetRenderDrawBlendMode(rend, SDL_BLENDMODE_BLEND));
//-------------------------------------------------------------------------------//
@ -52,9 +56,12 @@ int main(int argc, char** argv) {
int interval = 1000000/fps;
double intervalf = 1.0/((double)(fps));
bool debug_main = true ;
init_csts();
init_hashtbl();
init_draworder();
init_ent_generator(10);
trInit();
parse_rooms(5);
import_digits(rend) ;
@ -66,45 +73,91 @@ int main(int argc, char** argv) {
clock_t entstart = clock();
clock_t entend = clock();
float delta;
while(true) {
while(!stop_evetything) {
resetRenderer(rend) ;
origin = clock();
SDL_SetRenderDrawColor(rend, 255, 255, 255, SDL_ALPHA_OPAQUE) ;
entend = clock();
//printf("00\n");
//printf("%s\n", SDL_GetError());
fflush(stdout);
playerActions(((float)entend - (float)entstart)/CLOCKS_PER_SEC) ;
//printf("01\n");
fflush(stdout);
generate_nearby_chunks(1);
//printf("02\n");
fflush(stdout);
entend = clock();
update_entities(((float)entend - (float)entstart)/CLOCKS_PER_SEC);
//printf("03\n");
fflush(stdout);
entstart = clock();
drawCurrentRoom(rend);
//printf("04\n");
//printf("%s\n", SDL_GetError());
fflush(stdout);
drawData(rend) ;
//printf("05\n");
fflush(stdout);
drawHPbar(rend);
//printf("06\n");
fflush(stdout);
finish = clock();
fade_dmg = max(fade_dmg-5, 0);
delta = ((float)finish - (float)origin)/CLOCKS_PER_SEC;
//printf("07\n");
fflush(stdout);
drawNumberToRenderer(rend, digits, (int)(1.0f/delta), 720, 60, 75/2, 105/2, 0);
drawNumberToRenderer(rend, digits, (int)(10*sim_time), 720, 110, 75/2, 105/2, 0);
drawNumberToRenderer(rend, digits, coins, 1500/2-55, 1000 - 70, 75/3, 105/3, 0);
//printf("08\n");
fflush(stdout);
//printf("%s\n", SDL_GetError());
updateRenderer(rend) ;
sim_time += delta + intervalf ;
//printf("09\n");
fflush(stdout);
usleep(interval) ;
}
//printf("GPNE\n");
fflush(stdout);
free_digits(digits) ;
for(int k = 0; k < MAX_SIZE; k++) {
free(triangles_to_render[k]);
free(triangles_og_coords[k]);
}
free(drawOrder);
free(triangles_to_render);
free(triangles_og_coords);
free(reds);
free(greens);
free(blues);
free(triangles_order);
free(visited_tri);
//printf("10\n");
fflush(stdout);
hashtbl_free(visited);
free_pool();
/* -------------------------------------------------------- */
SDL_DestroyRenderer(rend);
//printf("10\n");
fflush(stdout);
SDL_DestroyWindow(win);
//printf("11\n");
fflush(stdout);
SDL_Quit();
//printf("12\n");
fflush(stdout);
/* -------------------------------------------------------- */
printf("Done\n") ;
//printf("Done\n") ;
fflush(stdout);
return 0;
}

18
src/menus.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <ncurses.h>
#include <unistd.h>
#include <termios.h>
#include <limits.h>
#include <time.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "hash.h"
#include "structure.h"
#include "base.h"
#include "entities.h"
#include "menus.h"

6
src/menus.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef MENUS_H
#define MENUS_H
#endif

View File

@ -26,6 +26,8 @@ double min_dist = 0.7 ;
int player_hp ;
bool stop_evetything;
double camx ;
double camy ;
double camz ;
@ -45,10 +47,11 @@ void init_csts() {
camy = 3.0 ;
camz = 3.0 ;
rot_hz = 0.0 ;
rot_vt = 180.0 ;
rot_vt = 180.0*3.14159/180.0 ;
draw_type = 0 ;
player_hp = 1000 ;
fade_dmg = 0;
stop_evetything = false ;
tan_fov = tan((fov * 3.14159 / 180.0) / 2.0) ;
}
@ -56,9 +59,9 @@ void set_player_coords(int old_chx, int old_chy) {
for(int k = 0; k < current_room->tps_size; k++) {
if(current_room->tps[k].dest_chx == old_chx && current_room->tps[k].dest_chy == old_chy) {
if(true) {
camx = current_room->tps[k].hitbox.x + current_room->tps[k].hitbox.w/2.0;
camy = current_room->tps[k].hitbox.y + current_room->tps[k].hitbox.h +1.5;
camz = current_room->tps[k].hitbox.z + current_room->tps[k].hitbox.d/2.0;
camx = current_room->tps[k].hitbox->x + current_room->tps[k].hitbox->w/2.0;
camy = current_room->tps[k].hitbox->y + current_room->tps[k].hitbox->h +1.5;
camz = current_room->tps[k].hitbox->z + current_room->tps[k].hitbox->d/2.0;
}
return ;
}
@ -85,7 +88,7 @@ bool is_colliding(float dtime) {
}
}
for(int k = 0; k < current_room->ent_len; k++) {
double dist = distance_pt_cube_0_3d(camx, camy, camz, *(current_room->ents[k].pos)) ;
double dist = distance_pt_cube_0_3d(camx, camy, camz, current_room->ents[k].pos) ;
if(dist <= min_dist) {
if(current_room->ents[k].onHit != NULL) {
(*current_room->ents[k].onHit)(dtime, current_room->ents[k].hitpoints, &current_room->ents[k].damage, &(*(current_room->ents[k].pos)));
@ -178,10 +181,7 @@ void playerActions(float dtime) {
}
if(state[SDL_SCANCODE_SPACE] == 1) {
if(pass) {
pass = false ;
draw_type = (1+draw_type)%2 ;
}
stop_evetything = true ;
} else {
pass = true ;
}

View File

@ -27,7 +27,7 @@ typedef struct cube_0 cube_0 ;
typedef cube_0* cube ;
typedef struct teleporter {
cube_0 hitbox ;
cube_0* hitbox ;
int dest_chx ; // in the pool, these are offsets
int dest_chy ;
double dest_x ;
@ -54,7 +54,7 @@ struct room {
// (0, 0, 0) = bottom, left and down
int chunk_x ;
int chunk_y ;
cube_0* map ;
cube_0** map ;
int map_size ;
teleporter* tps ;
int tps_size ;
@ -124,4 +124,15 @@ extern int player_hp ;
extern int fade_dmg ;
extern bool stop_evetything ;
extern int* reds ;
extern int* greens ;
extern int* blues ;
extern int* triangles_order ;
extern bool* visited_tri ;
extern int MAX_SIZE ;
#endif

View File

@ -304,16 +304,21 @@ bool pt_equal(pt_2d p1, pt_2d p2, double epsilon) {
return (absf(p2.x - p1.x) <= epsilon && absf(p2.y - p1.y) <= epsilon && absf(p2.z - p1.z) <= epsilon) ;
}
bool nonzero(double tha, double thb, double thc, double epsilon) {
return (absf(tha) > epsilon && absf(thb) > epsilon && absf(thc) > epsilon);
}
double u = 0.0 ;
double v = 0.0 ;
double w = 0.0 ;
double th1, th2;
double dist ;
bool is_hidden(SDL_Renderer* renderer, pt_2d p, pt_2d ogp, pt_2d* tri, pt_2d* og) {
if(pt_equal(p, tri[0], 0.0001) || pt_equal(p, tri[1], 0.0001) || pt_equal(p, tri[2], 0.0001)) {
return false;
}
double u = 0.0 ;
double v = 0.0 ;
double w = 0.0 ;
get_barycentric(p, tri, &u, &v, &w);
pt_2d mid = convex_pt2d_tri(og[0], u, og[1], v, og[2], w);
if(renderer != NULL && (u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) {
/*if(renderer != NULL && (u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) {
if(mid.z >= 0.4) {
SDL_Rect r;
r.x = (int)(1500.0 * (1.0 + (mid.x / (1.5 * mid.z * tan_fov))) / 2.0) -2;
@ -323,30 +328,32 @@ bool is_hidden(SDL_Renderer* renderer, pt_2d p, pt_2d ogp, pt_2d* tri, pt_2d* og
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderFillRect(renderer, &r);
}
}*/
if(((u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) && nonzero(u, v, w, 0.0001)) {
pt_2d mid = convex_pt2d_tri(og[0], u, og[1], v, og[2], w);
dist = proj_pt_distance_to_camera(mid) - proj_pt_distance_to_camera(ogp);
if(absf(dist) >= 0.0001) {
//return (proj_pt_distance_to_camera(mid) <= proj_pt_distance_to_camera(ogp));
return (dist <= 0.0);
}
if((u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) {
return (proj_pt_distance_to_camera(mid) <= proj_pt_distance_to_camera(ogp));
}
return false;
}
bool nonzero(double tha, double thb, double thc, double epsilon) {
return (absf(tha) > epsilon && absf(thb) > epsilon && absf(thc) > epsilon);
}
bool is_in_front(pt_2d* tri1, pt_2d* og1, pt_2d* tri2, pt_2d* og2) {
for(int k = 0; k < 3; k++) {
pt_2d p = tri1[k];
if(pt_equal(p, tri2[0], 0.0001) || pt_equal(p, tri2[1], 0.0001) || pt_equal(p, tri2[2], 0.0001)) {
return false;
}
double u = 0.0 ;
double v = 0.0 ;
double w = 0.0 ;
get_barycentric(p, tri2, &u, &v, &w);
pt_2d mid = convex_pt2d_tri(og2[0], u, og2[1], v, og2[2], w);
if(((u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) && nonzero(u, v, w, 0.0001)) {
return !(proj_pt_distance_to_camera(mid) <= proj_pt_distance_to_camera(og1[k]));
dist = proj_pt_distance_to_camera(mid) - proj_pt_distance_to_camera(og1[k]);
if(absf(dist) >= 0.0001) {
//return !(proj_pt_distance_to_camera(mid) <= proj_pt_distance_to_camera(og1[k]));
return !(dist <= 0.0);
}
}
}
for(int k = 0; k < 3; k++) {
@ -354,22 +361,26 @@ bool is_in_front(pt_2d* tri1, pt_2d* og1, pt_2d* tri2, pt_2d* og2) {
if(pt_equal(p, tri1[0], 0.0001) || pt_equal(p, tri1[1], 0.0001) || pt_equal(p, tri1[2], 0.0001)) {
return false;
}
double u = 0.0 ;
double v = 0.0 ;
double w = 0.0 ;
get_barycentric(p, tri1, &u, &v, &w);
pt_2d mid = convex_pt2d_tri(og1[0], u, og1[1], v, og1[2], w);
if(((u >= 0.0) && (v >= 0.0) && (w >= 0.0) && (u+v+w <= 1.0)) && nonzero(u, v, w, 0.0001)) {
return !(proj_pt_distance_to_camera(mid) >= proj_pt_distance_to_camera(og2[k]));
dist = proj_pt_distance_to_camera(mid) - proj_pt_distance_to_camera(og2[k]);
if(absf(dist) >= 0.0001) {
//return !(proj_pt_distance_to_camera(mid) >= proj_pt_distance_to_camera(og2[k]));
return !(dist >= 0.0) ;
}
}
}
for(int k1 = 0; k1 < 3; k1++) {
for(int k2 = 0; k2 < 3; k2++) {
double th1, th2;
if(seg_seg_inter(tri1[k1], tri1[(k1+1)%3], tri2[k2], tri2[(k2+1)%3], &th1, &th2)) {
pt_2d mid1 = convex_pt2d(tri1[k1], tri1[(k1+1)%3], th1);
pt_2d mid2 = convex_pt2d(tri2[k2], tri2[(k2+1)%3], th2);
return (proj_pt_distance_to_camera(mid1) <= proj_pt_distance_to_camera(mid2));
dist = proj_pt_distance_to_camera(mid1) - proj_pt_distance_to_camera(mid2);
if(absf(dist) >= 0.0001) {
//return (proj_pt_distance_to_camera(mid1) <= proj_pt_distance_to_camera(mid2));
return (dist <= 0.0);
}
}
}
}

View File

@ -12,14 +12,14 @@ Teleporters :
[7.0, 0.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 0, 0, 255; 1, 0]
Entities :
[0.0, 3.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 4.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 5.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 6.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 7.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 8.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 9.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 10.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[0.0, 3.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 4.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 5.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 6.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 7.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 8.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 9.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
[0.0, 10.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0, 0]
Weight :
10

View File

@ -14,10 +14,10 @@ Teleporters :
[-5.0, 1.0, 9.0, 10.0, 2.0, 1.0, 0.0, 0.0, 0, 0, 255; 1, 0]
Entities :
[3.0, 3.0, 3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[-3.0, 3.0, 3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[3.0, 3.0, -3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 0]
[-3.0, 3.0, -3.0, 0.5, 0.5, 0.5, 0.0, 0.0, 193, 192, 0, 1, 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, 193, 192, 0, 1, 0, 0]
Weight :
20

View File

@ -8,7 +8,11 @@ Teleporters :
[9.0, 1.0, -5.0, 1.0, 2.0, 10.0, 0.0, 0.0, 0, 255, 0; 0, 1]
[-5.0, 1.0, 9.0, 10.0, 2.0, 1.0, 0.0, 0.0, 0, 0, 255; 1, 0]
Entities :
[0.0, 3.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 255, 64, 0, 5, 100, 1]
[0.0, 40.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 255, 64, 0, 5, 100, 2]
Weight :
10
100
$