Compare commits

..

No commits in common. "48a4f4f88b9b2906e078dfab10bed5e279a7e75a" and "5d80d12382467d04bb65ae279db1cbe9ab38006b" have entirely different histories.

9 changed files with 17 additions and 493 deletions

View File

@ -4,11 +4,8 @@ LFLAGS = -lSDL2 -lSDL2_image -lm -lncurses
all: bin/back
test0: bin/back
bin/back templates.txt 47
test1: bin/back
bin/back templates_lv2.txt 49
test: bin/back
bin/back
bin/back: obj/main.o obj/generation.o obj/display.o obj/base.o obj/hash.o obj/move.o
mkdir -p bin

View File

@ -1,10 +1,7 @@
**intended to be a backrooms generator**
**with configurable room pool**
** intended to be a backrooms generator **
** with configurable room pool **
| COMMANDS |
> zqsd : move
> TAB : exit
> p : zoom out
> m : zoom in
| EXECUTION |
*make test0 : default template pool (small/medium-sized corridorq)*
*make test1 : more hallways but small corridors only*

BIN
bin/back

Binary file not shown.

View File

@ -99,17 +99,6 @@ int line_count(char* filename) {
return (n+1);
}
int str_to_int(char* s) {
int res = 0 ;
int i = 0 ;
while(s[i] != '\0' && is_an_integer(s[i])) {
res *= 10 ;
res += (int)s[i] - 48 ;
i++;
};
return res;
}
int get_integer(FILE* ptr) {
char c = fgetc(ptr);

View File

@ -25,8 +25,6 @@ double distance_pt(int x1, int x2, int y1, int y2);
int line_count(char* filename);
int str_to_int(char* s);
int get_integer(FILE* ptr);
int get_integer_plus_align(FILE* ptr, FILE* ptr2);

View File

@ -139,6 +139,9 @@ void drawStringToRenderer(SDL_Renderer* renderer, imgs data, char* s, int X, int
void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax, int ymin, int ymax) {
if(ch->draw_id != draw_par) {
ch->draw_id = draw_par ;
//printf("[DDDDD] chunk (%d, %d) has signature : \n", ch.chx, ch.chy);
//signature(ch.chdata);
//printf("\n");
for(int i = 0; i < 8; i++) {
uint8_t cur = ch->chdata.lines[i] ;
for(int j = 0; j < 8; j++) {
@ -147,16 +150,13 @@ void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax,
int cux2 = 50*(8*ch->chx + j+1);
int cuy2 = 50*(8*ch->chy + i+1);
if(true) {
//if(cux - 50/zoom > xmin || cux - 50/zoom < xmax || cuy > ymin || cuy < ymax) {
if(cur%2 == 1) {
int nxmin = to_int((to_double(cux) - to_double(xmin)) * to_double(__width__)) / (to_double(xmax) - to_double(xmin)) ;
int nymin = to_int((to_double(cuy) - to_double(ymin)) * to_double(__height__)) / (to_double(ymax) - to_double(ymin)) ;
int nxmin2 = to_int((to_double(cux2) - to_double(xmin)) * to_double(__width__)) / (to_double(xmax) - to_double(xmin)) ;
int nymin2 = to_int((to_double(cuy2) - to_double(ymin)) * to_double(__height__)) / (to_double(ymax) - to_double(ymin)) ;
if(abs(ch->chx + ch->chy)%2 == 0) {
placeRectToRenderer(renderer, nxmin, nymin, nxmin2 - nxmin, nymin2 - nymin, 255, 192, 192, SDL_ALPHA_OPAQUE);
} else {
placeRectToRenderer(renderer, nxmin, nymin, nxmin2 - nxmin, nymin2 - nymin, 192, 192, 255, SDL_ALPHA_OPAQUE);
}
placeRectToRenderer(renderer, nxmin, nymin, nxmin2 - nxmin, nymin2 - nymin, 255, 255, 255, SDL_ALPHA_OPAQUE);
};
cur = cur / 2 ;
}

View File

@ -215,8 +215,7 @@ void generate_chunk_all(int cx, int cy) {
}
}
};
//printf("generating %d at (%d, %d)...\n", idx, cx, cy);
//print_template(idx);
//printf("\ngenerating %d\n", idx);
generate_chunk(cx, cy, idx);
}
@ -251,10 +250,10 @@ void parse_one(FILE* ptr, FILE* ptr2, int index) {
configs[index].lines[i] *= 2 ;
configs[index].lines[i] += xres ;
if(j == 7) {
if(j == 0) {
configs[index].westsig *= 2;
configs[index].westsig += xres;
} else if(j == 0) {
} else if(j == 7) {
configs[index].eastsig *= 2;
configs[index].eastsig += xres;
}

View File

@ -19,15 +19,6 @@
#include "move.h"
int main(int argc, char** argv) {
if(argc != 3) {
fprintf(stderr, "usage : bin/back <template_pool> <n_templates>\n");
exit(1);
};
char* filename = argv[1];
int length = str_to_int(argv[2]);
srand(time(NULL));
//-------------------------------------------------------------------------------//
@ -52,16 +43,13 @@ int main(int argc, char** argv) {
/* -------------------------------------------------------- */
//one_debug();
parse_configs(filename, length);
parse_configs("templates.txt", 47);
initialize(rend);
int temp = render_distance ;
for(int i = 1; i <= temp; i++) {
printf("%d/%d\n", i, temp);
render_distance = i ;
drawMapToRenderer(rend, -300 * 250/zoom + to_int(50 * (8*player_cx + player_x + εx)), 300 * 250/zoom + to_int(50 * (8*player_cx + player_x + εx)), -300 * 250/zoom + to_int(50 * (8*player_cy + player_y + εy)), 300 * 250/zoom + to_int(50 * (8*player_cy + player_y + εy)));
};
//print_template(1);
//rotateTemplateClockWise(1);
//print_template(1);
moveFunctionMaster(rend);
@ -73,7 +61,5 @@ int main(int argc, char** argv) {
SDL_DestroyWindow(win);
SDL_Quit();
/* -------------------------------------------------------- */
return 0;
}

View File

@ -1,442 +0,0 @@
1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1
1 0 1 1 1 1 0 1
1 0 1 0 0 1 0 1
1 0 1 0 0 1 0 1
1 0 1 1 1 1 0 1
1 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 0 1 1 1 1 0 1
0 0 0 0 0 0 0 0
1 1 1 0 0 1 1 1
1 1 1 0 0 1 1 1
1 1 1 0 0 1 1 1
1 1 1 0 0 1 1 1
0 0 0 0 0 0 0 0
1 0 1 1 1 1 0 1
1 0 1 1 1 1 1 1
0 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 0 0
1 1 1 1 1 1 0 1
1 0 1 1 1 1 1 1
0 0 1 1 1 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