Compare commits

...

5 Commits

18 changed files with 1389 additions and 116 deletions

View File

@ -4,17 +4,23 @@ LFLAGS = -lSDL2 -lSDL2_image -lm -lncurses
all: bin/back all: bin/back
test-1: bin/back
bin/back templates_lv0.txt 27 0
test0: bin/back test0: bin/back
bin/back templates.txt 47 bin/back templates.txt 48 1
test1: bin/back test1: bin/back
bin/back templates_lv1.txt 14 bin/back templates_lv1.txt 18 1
test2: bin/back test2: bin/back
bin/back templates_lv2.txt 52 bin/back templates_lv2.txt 52 1
test3: bin/back test3: bin/back
bin/back templates_lv3.txt 33 bin/back templates_lv3.txt 33 1
test4: bin/back
bin/back templates_lv4.txt 52 1
bin/back: obj/main.o obj/generation.o obj/display.o obj/base.o obj/hash.o obj/move.o bin/back: obj/main.o obj/generation.o obj/display.o obj/base.o obj/hash.o obj/move.o
mkdir -p bin mkdir -p bin

View File

@ -5,6 +5,18 @@
> TAB : exit > TAB : exit
> p : zoom out > p : zoom out
> m : zoom in > m : zoom in
| EXECUTION | | EXECUTION |
*make test0 : default template pool (small/medium-sized corridorq)* *make test-1 : extermly unorganized generation*
*make test1 : more hallways but small corridors only* *make test0 : default template pool (small/medium-sized corridors)*
*make test1 : large rooms with rotating walls*
*make test2 : more hallways but small corridors only*
*make test3 : long, wide hallways*
| TILE LIST |
> 0 : nothing
> 1 : wall
> 2 : CCW rotation wall
> 3 : CW rotation wall
> 4, 5, 6, 7 : translation wall (resp. +X, -X, +Y and -Y)

BIN
bin/back

Binary file not shown.

View File

@ -209,6 +209,95 @@ void pop(array* arr, int elt) {
} }
} }
bool str_equal(char* s1, char* s2) {
if(s1[0] == '\0' || s2[0] == '\0') {
return (s1[0] == '\0' && s2[0] == '\0');
}
return (s1[0] == s2[0] && str_equal(&s1[1], &s2[1]));
}
// ------------------------------------------------------------------------------------------------ //
void linked_add(linkedList* lst, int x, int y, char* flag) {
if(lst == NULL) {
fprintf(stderr, "ERROR : linked list has not been initialized\n");
exit(1);
} else if(lst->next == NULL) {
lst->next = malloc(sizeof(linkedList));
lst->next->coord = x + 16*y ;
lst->next->flag = flag ;
lst->next->next = NULL ;
} else {
linked_add(lst->next, x, y, flag);
}
}
void linked_removeCoord(linkedList* lst, int x, int y) {
if(lst != NULL) {
if(lst->coord == x + 16*y) {
linkedList* temp = lst->next ;
free(lst) ;
lst = temp ;
} else {
linked_removeCoord(lst->next, x, y);
}
}
}
void linked_removeFlag(linkedList* lst, char* flag) {
if(lst != NULL) {
if(lst->flag == flag) {
linkedList* temp = lst->next ;
free(lst) ;
lst = temp ;
} else {
linked_removeFlag(lst->next, flag);
}
}
}
void linked_change(linkedList* lst, int x, int y, char* flag) {
linked_removeCoord(lst, x, y);
linked_add(lst, x, y, flag);
}
bool linked_mem(linkedList* lst, int x, int y, char** flag) {
if(lst == NULL) {
return false;
}
if(lst->coord == x + 16*y) {
*flag = lst->flag;
return true ;
}
return linked_mem(lst->next, x, y, flag);
}
linkedList* linked_copy(linkedList* src) {
linkedList* new = malloc(sizeof(linkedList)) ;
new->flag = "E" ;
new->coord = 0 ;
new->next = NULL ;
//printf("in\n");
linkedList* curSrc = src->next ;
//printf("out\n");
while(curSrc != NULL) {
//printf("cp\n");
linked_add(new, curSrc->coord%8, curSrc->coord/16, curSrc->flag);
curSrc = curSrc->next;
}
return new ;
}
void linkedPrint(linkedList* lst) {
if(lst != NULL) {
printf("[(%d, %d), %s] ", lst->coord%8, lst->coord/16, lst->flag);
linkedPrint(lst->next);
}
}
// ------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------ //
void import_digits(SDL_Renderer* renderer) { void import_digits(SDL_Renderer* renderer) {

View File

@ -47,6 +47,22 @@ void append(array* arr, int elt);
void pop(array* arr, int elt); void pop(array* arr, int elt);
bool str_equal(char* s1, char* s2);
void linked_add(linkedList* lst, int x, int y, char* flag);
void linked_removeCoord(linkedList* lst, int x, int y);
void linked_removeFlag(linkedList* lst, char* flag);
void linked_change(linkedList* lst, int x, int y, char* flag);
bool linked_mem(linkedList* lst, int x, int y, char** flag);
linkedList* linked_copy(linkedList* src);
void linkedPrint(linkedList* lst);
void import_digits(SDL_Renderer* renderer); void import_digits(SDL_Renderer* renderer);
void import_letters(SDL_Renderer* renderer); void import_letters(SDL_Renderer* renderer);

View File

@ -136,6 +136,22 @@ void drawStringToRenderer(SDL_Renderer* renderer, imgs data, char* s, int X, int
} }
} }
void linked_draw(SDL_Renderer* renderer, linkedList* lst, int chx, int chy, int xmin, int xmax, int ymin, int ymax) {
if(lst != NULL) {
int cux = 50*(8*chx + lst->coord/16);
int cuy = 50*(8*chy + lst->coord%8);
int cux2 = 50*(8*chx + lst->coord/16+1);
int cuy2 = 50*(8*chy + lst->coord%8+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)) ;
placeRectToRenderer(renderer, nxmin, nymin, nxmin2 - nxmin, nymin2 - nymin, 32+96*(str_equal(lst->flag, "spinCC")), 255, 32+96*(str_equal(lst->flag, "spinCW")), SDL_ALPHA_OPAQUE/2);
linked_draw(renderer, lst->next, chx, chy, xmin, xmax, ymin, ymax);
}
}
void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax, int ymin, int ymax) { void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax, int ymin, int ymax) {
if(ch->draw_id != draw_par) { if(ch->draw_id != draw_par) {
ch->draw_id = draw_par ; ch->draw_id = draw_par ;
@ -146,24 +162,19 @@ void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax,
int cuy = 50*(8*ch->chy + i); int cuy = 50*(8*ch->chy + i);
int cux2 = 50*(8*ch->chx + j+1); int cux2 = 50*(8*ch->chx + j+1);
int cuy2 = 50*(8*ch->chy + i+1); int cuy2 = 50*(8*ch->chy + i+1);
if(true) { int nxmin = to_int((to_double(cux) - to_double(xmin)) * to_double(__width__)) / (to_double(xmax) - to_double(xmin)) ;
if(cur%2 == 1) { int nymin = to_int((to_double(cuy) - to_double(ymin)) * to_double(__height__)) / (to_double(ymax) - to_double(ymin)) ;
int nxmin = to_int((to_double(cux) - to_double(xmin)) * to_double(__width__)) / (to_double(xmax) - to_double(xmin)) ; int nxmin2 = to_int((to_double(cux2) - 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 nymin2 = to_int((to_double(cuy2) - 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)) ; bool x = abs(ch->chx + ch->chy)%2 == 0 ;
int nymin2 = to_int((to_double(cuy2) - to_double(ymin)) * to_double(__height__)) / (to_double(ymax) - to_double(ymin)) ; placeRectToRenderer(renderer, nxmin, nymin, nxmin2 - nxmin, nymin2 - nymin, 192+63*(1-x)*(ch->chdata.meta->next != NULL), 192+63*x*(ch->chdata.meta->next != NULL), 32, SDL_ALPHA_OPAQUE/(1+3*(cur%2 == 0)));
if(abs(ch->chx + ch->chy)%2 == 0) { cur = cur / 2 ;
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);
}
};
cur = cur / 2 ;
}
} }
} }
linked_draw(renderer, ch->chdata.meta->next, ch->chx, ch->chy, xmin, xmax, ymin, ymax);
} }
} }
// branchless goes brrr
void drawHashToRenderer(SDL_Renderer* renderer, int chx, int chy, int xmin, int xmax, int ymin, int ymax, int distx, int disty) { void drawHashToRenderer(SDL_Renderer* renderer, int chx, int chy, int xmin, int xmax, int ymin, int ymax, int distx, int disty) {
if(distx < render_distance && disty < render_distance) { if(distx < render_distance && disty < render_distance) {

View File

@ -21,6 +21,8 @@ void drawNumberToRenderer(SDL_Renderer* renderer, imgs data, int n, int X, int Y
void drawStringToRenderer(SDL_Renderer* renderer, imgs data, char* s, int X, int Y, int W, int H); void drawStringToRenderer(SDL_Renderer* renderer, imgs data, char* s, int X, int Y, int W, int H);
void linked_draw(SDL_Renderer* renderer, linkedList* lst, int chx, int chy, int xmin, int xmax, int ymin, int ymax);
void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax, int ymin, int ymax); void drawChunkToRenderer(SDL_Renderer* renderer, chunk* ch, int xmin, int xmax, int ymin, int ymax);
void drawHashToRenderer(SDL_Renderer* renderer, int chx, int chy, int xmin, int xmax, int ymin, int ymax, int distx, int disty); void drawHashToRenderer(SDL_Renderer* renderer, int chx, int chy, int xmin, int xmax, int ymin, int ymax, int distx, int disty);

View File

@ -20,6 +20,9 @@
Grid map ; Grid map ;
int emptyChance = 75 ; // 1 out of this number for empty chunk override
int sizeIncreaseChance = 15 ; // % for an empty chunk to increase in size
template* configs ; template* configs ;
array** matches ; array** matches ;
int n_configs = 18; int n_configs = 18;
@ -42,6 +45,12 @@ imgs digits ;
imgs letters ; imgs letters ;
template full ; template full ;
template empty ;
linkedList* endLst ;
char** level_list ;
int level_count ;
// yes Valentin I learned to use .h the intended way xD // yes Valentin I learned to use .h the intended way xD
@ -56,6 +65,8 @@ template copy(template src) {
new.id = src.id ; new.id = src.id ;
new.eastsig = src.eastsig; new.eastsig = src.eastsig;
new.westsig = src.westsig; new.westsig = src.westsig;
new.checkCompat = src.checkCompat ;
new.meta = linked_copy(src.meta);
new.lines = malloc(sizeof(uint8_t)*8); new.lines = malloc(sizeof(uint8_t)*8);
for(int i = 0; i < 8; i++) { for(int i = 0; i < 8; i++) {
new.lines[i] = src.lines[i]; new.lines[i] = src.lines[i];
@ -77,6 +88,16 @@ void generate_chunk(int x, int y, int config_id) {
gridInsert(map, x, y, new); gridInsert(map, x, y, new);
} }
void generate_chunk_raw(int x, int y, template tpl) {
chunk* new = malloc(sizeof(chunk)) ;
new->chx = x ;
new->chy = y ;
new->draw_id = draw_par - 2;
new->chdata = copy(tpl);
//printf("%d\n", new->chdata.checkCompat);
gridInsert(map, x, y, new);
}
void print_template(int config_id) { void print_template(int config_id) {
for(int i = 0; i < 8; i++) { for(int i = 0; i < 8; i++) {
uint8_t rem = configs[config_id].lines[i]; uint8_t rem = configs[config_id].lines[i];
@ -93,7 +114,15 @@ void print_template(int config_id) {
printf("\n"); printf("\n");
} }
void rotateTemplateClockWise(int config_id) { void rotateLinkedListCounterClockWise(linkedList* lst) {
if(lst != NULL) {
uint8_t newc = (lst->coord/16) + 16 * (7- (lst->coord%8));
lst->coord = newc ;
rotateLinkedListCounterClockWise(lst->next);
}
}
void rotateTemplateCounterClockWise(int config_id) {
// 1st line become last column ... last line become 1st column // 1st line become last column ... last line become 1st column
uint8_t* new = malloc(sizeof(uint8_t)*8); uint8_t* new = malloc(sizeof(uint8_t)*8);
@ -113,16 +142,141 @@ void rotateTemplateClockWise(int config_id) {
} }
}; };
if(config_id >= 9 ) { rotateLinkedListCounterClockWise(configs[config_id].meta);
//print_template(config_id);
}
free(new); free(new);
} }
void transateLinkedList(linkedList* lst, int dy, int dx) {
if(lst != NULL) {
lst->coord = ((lst->coord%8) + dx + 8)%8 + 16*(((lst->coord/16) + dy + 8)%8) ;
transateLinkedList(lst->next, dy, dx);
}
}
// ---------------------------------------------- //
void rotateChunkCounterClockWise(int chx, int chy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : cannot rotate non-existing chunk\n");
exit(1);
}
// 1st line become last column ... last line become 1st column
uint8_t* new = malloc(sizeof(uint8_t)*8);
ch->chdata.westsig = ch->chdata.lines[7];
ch->chdata.eastsig = ch->chdata.lines[0];
for(int i = 0; i < 8; i++) {
new[i] = ch->chdata.lines[i];
ch->chdata.lines[i] = 0;
};
for(int i = 0; i < 8; i++) {
uint8_t rem = new[i];
for(int j = 0; j < 8; j++) {
ch->chdata.lines[j] *= 2 ;
ch->chdata.lines[j] += rem%2 ;
rem = rem / 2 ;
}
};
rotateLinkedListCounterClockWise(ch->chdata.meta);
free(new);
}
void translateChunkX(int chx, int chy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : cannot translate non-existing chunk\n");
exit(1);
}
ch->chdata.eastsig = 0 ;
ch->chdata.westsig = 0 ;
for(int i = 7; i >= 0; i--) {
ch->chdata.eastsig *= 2 ;
ch->chdata.eastsig += (int)(unpack_coord(ch->chdata.lines, 6, i));
ch->chdata.westsig *= 2 ;
ch->chdata.eastsig += (int)(unpack_coord(ch->chdata.lines, 7, i));
}
for(int i = 0; i < 8; i++) {
ch->chdata.lines[i] = (2*ch->chdata.lines[i] + ch->chdata.lines[i]/128)%256 ;
}
transateLinkedList(ch->chdata.meta->next, 1, 0);
}
void translateChunk_X(int chx, int chy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : cannot translate non-existing chunk\n");
exit(1);
}
ch->chdata.eastsig = 0 ;
ch->chdata.westsig = 0 ;
for(int i = 7; i >= 0; i--) {
ch->chdata.eastsig *= 2 ;
ch->chdata.eastsig += (int)(unpack_coord(ch->chdata.lines, 0, i));
ch->chdata.westsig *= 2 ;
ch->chdata.eastsig += (int)(unpack_coord(ch->chdata.lines, 1, i));
}
for(int i = 0; i < 8; i++) {
ch->chdata.lines[i] = ((ch->chdata.lines[i])/2 + 128*(ch->chdata.lines[i]%2))%256 ;
}
transateLinkedList(ch->chdata.meta->next, -1, 0);
}
void translateChunkY(int chx, int chy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : cannot translate non-existing chunk\n");
exit(1);
}
ch->chdata.eastsig = (2*ch->chdata.eastsig + ch->chdata.eastsig/128)%256;
ch->chdata.westsig = (2*ch->chdata.westsig + ch->chdata.westsig/128)%256;
uint8_t temp = ch->chdata.lines[0] ;
for(int i = 0; i < 7; i++) {
ch->chdata.lines[i] = ch->chdata.lines[i+1] ;
}
ch->chdata.lines[7] = temp ;
transateLinkedList(ch->chdata.meta->next, 0, -1);
}
void translateChunk_Y(int chx, int chy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : cannot translate non-existing chunk\n");
exit(1);
}
ch->chdata.eastsig = (2*ch->chdata.eastsig + ch->chdata.eastsig/128)%256;
ch->chdata.westsig = (2*ch->chdata.westsig + ch->chdata.westsig/128)%256;
uint8_t temp = ch->chdata.lines[7] ;
for(int i = 6; i >= 0; i--) {
ch->chdata.lines[i+1] = ch->chdata.lines[i] ;
}
ch->chdata.lines[0] = temp ;
transateLinkedList(ch->chdata.meta->next, 0, 1);
}
// ---------------------------------------------- //
bool is_compat_sig_north(int cx, int cy, int idx) { bool is_compat_sig_north(int cx, int cy, int idx) {
chunk* cp = gridGet(map, cx, cy-1); chunk* cp = gridGet(map, cx, cy-1);
if(cp == NULL) { if(cp == NULL || !cp->chdata.checkCompat) {
return true; return true;
} else { } else {
return cp->chdata.lines[7] == configs[idx].lines[0]; return cp->chdata.lines[7] == configs[idx].lines[0];
@ -130,7 +284,7 @@ bool is_compat_sig_north(int cx, int cy, int idx) {
} }
bool is_compat_sig_south(int cx, int cy, int idx) { bool is_compat_sig_south(int cx, int cy, int idx) {
chunk* cp = gridGet(map, cx, cy+1); chunk* cp = gridGet(map, cx, cy+1);
if(cp == NULL) { if(cp == NULL || !cp->chdata.checkCompat) {
return true; return true;
} else { } else {
return cp->chdata.lines[0] == configs[idx].lines[7]; return cp->chdata.lines[0] == configs[idx].lines[7];
@ -138,7 +292,7 @@ bool is_compat_sig_south(int cx, int cy, int idx) {
} }
bool is_compat_sig_east(int cx, int cy, int idx) { bool is_compat_sig_east(int cx, int cy, int idx) {
chunk* cp = gridGet(map, cx+1, cy); chunk* cp = gridGet(map, cx+1, cy);
if(cp == NULL) { if(cp == NULL || !cp->chdata.checkCompat) {
return true; return true;
} else { } else {
return cp->chdata.westsig == configs[idx].eastsig; return cp->chdata.westsig == configs[idx].eastsig;
@ -146,7 +300,7 @@ bool is_compat_sig_east(int cx, int cy, int idx) {
} }
bool is_compat_sig_west(int cx, int cy, int idx) { bool is_compat_sig_west(int cx, int cy, int idx) {
chunk* cp = gridGet(map, cx-1, cy); chunk* cp = gridGet(map, cx-1, cy);
if(cp == NULL) { if(cp == NULL || !cp->chdata.checkCompat) {
return true; return true;
} else { } else {
return cp->chdata.eastsig == configs[idx].westsig; return cp->chdata.eastsig == configs[idx].westsig;
@ -165,7 +319,7 @@ bool is_compat_with_spins(int cx, int cy, int idx) {
if(is_compat_sig_north(cx, cy, idx) && is_compat_sig_east(cx, cy, idx) && is_compat_sig_south(cx, cy, idx) && is_compat_sig_west(cx, cy, idx)) { if(is_compat_sig_north(cx, cy, idx) && is_compat_sig_east(cx, cy, idx) && is_compat_sig_south(cx, cy, idx) && is_compat_sig_west(cx, cy, idx)) {
return true ; return true ;
} else { } else {
rotateTemplateClockWise(idx); rotateTemplateCounterClockWise(idx);
} }
}; };
return false; return false;
@ -175,7 +329,7 @@ bool is_compat_with_spins_uno(int cx, int cy, int idx) {
if(is_compat_sig_north(cx, cy, idx) && is_compat_sig_east(cx, cy, idx) && is_compat_sig_south(cx, cy, idx) && is_compat_sig_west(cx, cy, idx)) { if(is_compat_sig_north(cx, cy, idx) && is_compat_sig_east(cx, cy, idx) && is_compat_sig_south(cx, cy, idx) && is_compat_sig_west(cx, cy, idx)) {
return true ; return true ;
} else { } else {
rotateTemplateClockWise(idx); rotateTemplateCounterClockWise(idx);
return false; return false;
} }
} }
@ -186,7 +340,7 @@ void generate_chunk_all(int cx, int cy) {
int turn = 0 ; int turn = 0 ;
int k = 0 ; int k = 0 ;
while(i > 0) { while(i > 0) {
if(turn > 100*n_configs) { if(turn > 50*n_configs) {
i = 0 ; i = 0 ;
idx = 0 ; idx = 0 ;
printf("failed\n"); printf("failed\n");
@ -194,8 +348,12 @@ void generate_chunk_all(int cx, int cy) {
if(is_compat_with_spins_uno(cx, cy, idx)) { if(is_compat_with_spins_uno(cx, cy, idx)) {
i -= 1; i -= 1;
if(i != 0) { if(i != 0) {
rotateTemplateCounterClockWise(idx);
if(k == 3) { if(k == 3) {
idx = (idx+1)%n_configs; idx += 1;
if(idx == n_configs) {
idx = 1;
};
k = 0 ; k = 0 ;
} else { } else {
k++ ; k++ ;
@ -215,9 +373,31 @@ void generate_chunk_all(int cx, int cy) {
} }
} }
}; };
//printf("generating %d at (%d, %d)...\n", idx, cx, cy); int R = rand()%emptyChance;
//print_template(idx); if(R != 0) {
generate_chunk(cx, cy, idx); generate_chunk(cx, cy, idx);
} else {
generate_chunk_raw(cx, cy, empty);
if(rand()%100 < sizeIncreaseChance) {
if(!(gridMem(map, cx+1, cy) || gridMem(map, cx+1, cy+1) || gridMem(map, cx, cy+1))) {
generate_chunk_raw(cx+1, cy, empty);
generate_chunk_raw(cx, cy+1, empty);
generate_chunk_raw(cx+1, cy+1, empty);
} else if(!(gridMem(map, cx+1, cy) || gridMem(map, cx+1, cy-1) || gridMem(map, cx, cy-1))) {
generate_chunk_raw(cx+1, cy, empty);
generate_chunk_raw(cx, cy-1, empty);
generate_chunk_raw(cx+1, cy-1, empty);
} else if(!(gridMem(map, cx-1, cy) || gridMem(map, cx-1, cy-1) || gridMem(map, cx, cy-1))) {
generate_chunk_raw(cx-1, cy, empty);
generate_chunk_raw(cx, cy-1, empty);
generate_chunk_raw(cx-1, cy-1, empty);
} else if(!(gridMem(map, cx-1, cy) || gridMem(map, cx-1, cy+1) || gridMem(map, cx, cy+1))) {
generate_chunk_raw(cx-1, cy, empty);
generate_chunk_raw(cx, cy+1, empty);
generate_chunk_raw(cx-1, cy+1, empty);
}
}
}
} }
void initialize(SDL_Renderer* renderer) { void initialize(SDL_Renderer* renderer) {
@ -227,11 +407,58 @@ void initialize(SDL_Renderer* renderer) {
import_digits(renderer); import_digits(renderer);
full.lines = malloc(sizeof(uint8_t)*8); full.lines = malloc(sizeof(uint8_t)*8);
full.westsig = 255 ;
full.eastsig = 255 ;
full.meta = malloc(sizeof(linkedList)) ;
full.meta->flag = "E" ;
full.meta->coord = 0 ;
full.meta->next = NULL ;
full.checkCompat = false ;
for(int i = 0; i < 8; i++) { for(int i = 0; i < 8; i++) {
full.lines[i] = 255 ; full.lines[i] = 255 ;
}; };
full.id = -1 ; full.id = -1 ;
empty.lines = malloc(sizeof(uint8_t)*8);
empty.westsig = 0 ;
empty.eastsig = 0 ;
empty.checkCompat = false ;
empty.lines[0] = 0 ;
empty.lines[1] = 0 ;
empty.lines[2] = 0 ;
empty.lines[3] = 24 ;
empty.lines[4] = 24 ;
empty.lines[5] = 0 ;
empty.lines[6] = 0 ;
empty.lines[7] = 0 ;
empty.id = -1 ;
empty.meta = malloc(sizeof(linkedList)) ;
empty.meta->flag = "E" ;
empty.meta->coord = 0 ;
empty.meta->next = NULL ;
endLst = malloc(sizeof(linkedList));
endLst->flag = "E";
endLst->coord = 0 ;
endLst->next = NULL ;
level_count = 6 ;
level_list = malloc(sizeof(char*)*level_count);
level_list[0] = "templates_lv0.txt";
level_list[1] = "templates.txt";
level_list[2] = "templates_lv1.txt";
level_list[3] = "templates_lv2.txt";
level_list[4] = "templates_lv3.txt";
level_list[5] = "templates_lv4.txt";
generate_chunk(0, 0, 2); generate_chunk(0, 0, 2);
} }
@ -241,7 +468,10 @@ void destroy() {
free_digits(digits); free_digits(digits);
free_digits(letters); free_digits(letters);
free(level_list);
free(full.lines); free(full.lines);
free(empty.lines);
} }
void parse_one(FILE* ptr, FILE* ptr2, int index) { void parse_one(FILE* ptr, FILE* ptr2, int index) {
@ -249,15 +479,31 @@ void parse_one(FILE* ptr, FILE* ptr2, int index) {
for(int j = 0; j < 8; j++) { for(int j = 0; j < 8; j++) {
int xres = get_integer_plus_align(ptr, ptr2); int xres = get_integer_plus_align(ptr, ptr2);
configs[index].lines[i] *= 2 ; configs[index].lines[i] *= 2 ;
configs[index].lines[i] += xres ; configs[index].lines[i] += (xres > 0) ;
if(xres == 2) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "spinCC");
} else if(xres == 3) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "spinCW");
} else if(xres == 4) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "beltX");
} else if(xres == 5) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "belt-X");
} else if(xres == 6) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "beltY");
} else if(xres == 7) {
printf("[%d] SP+1 : %d, %d\n", index, i, 7-j);
linked_add(configs[index].meta, i, 7-j, "belt-Y");
}
if(j == 7) { if(j == 7) {
//configs[index].westsig *= 2;
//configs[index].westsig += xres;
configs[index].westsig += pw(2, i) * xres ; configs[index].westsig += pw(2, i) * xres ;
} else if(j == 0) { } else if(j == 0) {
//configs[index].eastsig *= 2;
//configs[index].eastsig += xres;
configs[index].eastsig += pw(2, i) * xres ; configs[index].eastsig += pw(2, i) * xres ;
} }
} }
@ -269,7 +515,9 @@ void parse_one(FILE* ptr, FILE* ptr2, int index) {
printf("-----| Template %d (line %d) |-----\n", index, 9*index); printf("-----| Template %d (line %d) |-----\n", index, 9*index);
print_template(index); print_template(index);
printf("sigs : (%d, %d, %d, %d) (N, E, S, W)\n", configs[index].lines[0], configs[index].eastsig, configs[index].lines[7], configs[index].westsig); printf("sigs : (%d, %d, %d, %d) (N, E, S, W)\n", configs[index].lines[0], configs[index].eastsig, configs[index].lines[7], configs[index].westsig);
printf("\n"); printf("SP : ");
linkedPrint(configs[index].meta);
printf("\n-----------------------------------\n");
} }
void parse_configs(char* filename, int n_conf) { void parse_configs(char* filename, int n_conf) {
@ -283,6 +531,13 @@ void parse_configs(char* filename, int n_conf) {
configs[i].id = i; configs[i].id = i;
configs[i].eastsig = 0 ; configs[i].eastsig = 0 ;
configs[i].westsig = 0 ; configs[i].westsig = 0 ;
configs[i].checkCompat = doCheck ;
configs[i].meta = malloc(sizeof(linkedList)) ;
configs[i].meta->flag = "E" ;
configs[i].meta->coord = 0 ;
configs[i].meta->next = NULL ;
configs[i].lines = malloc(sizeof(uint8_t)*8); configs[i].lines = malloc(sizeof(uint8_t)*8);
for(int j = 0; j < 8; j++) { for(int j = 0; j < 8; j++) {
configs[i].lines[j] = 0; configs[i].lines[j] = 0;
@ -293,7 +548,18 @@ void parse_configs(char* filename, int n_conf) {
FILE* ptr = fopen(filename, "r"); FILE* ptr = fopen(filename, "r");
FILE* ptr2 = fopen(filename, "r"); FILE* ptr2 = fopen(filename, "r");
// one pointer for data
// one pointer for counting
for(int k = 0; k < n_conf; k++) { for(int k = 0; k < n_conf; k++) {
parse_one(ptr, ptr2, k); parse_one(ptr, ptr2, k);
} }
} }
void change_configs(char* new_filename, int n_conf) {
for(int i = 0; i < n_conf; i++) {
free(configs[i].lines);
}
free(configs);
parse_configs(new_filename, n_conf);
}

View File

@ -5,9 +5,21 @@ bool unpack_coord(uint8_t* lines, int cx, int cy);
void generate_chunk(int x, int y, int config_id); void generate_chunk(int x, int y, int config_id);
void generate_chunk_raw(int x, int y, template tpl);
void print_template(int config_id); void print_template(int config_id);
void rotateTemplateClockWise(int config_id); void rotateTemplateCounterClockWise(int config_id);
void rotateChunkCounterClockWise(int chx, int chy);
void translateChunkX(int chx, int chy);
void translateChunk_X(int chx, int chy);
void translateChunkY(int chx, int chy);
void translateChunk_Y(int chx, int chy);
void signature(template t); void signature(template t);
@ -21,4 +33,6 @@ void destroy();
void parse_configs(char* filename, int n_conf); void parse_configs(char* filename, int n_conf);
void change_configs(char* new_filename, int n_conf);
#endif #endif

View File

@ -4,12 +4,22 @@
#define GRID_H #define GRID_H
#include <stdbool.h> #include <stdbool.h>
typedef struct linkedList {
uint8_t coord ; // coord%8 = x ; coord/16 = y
char* flag ;
struct linkedList* next ;
} linkedList ;
typedef struct template { typedef struct template {
uint8_t id ; uint8_t id ;
uint8_t* lines ; // len = 8 uint8_t* lines ; // len = 8
bool checkCompat ;
uint8_t eastsig ; uint8_t eastsig ;
uint8_t westsig ; uint8_t westsig ;
linkedList* meta ;
} template ; } template ;
typedef struct chunk { typedef struct chunk {

View File

@ -18,15 +18,18 @@
#include "generation.h" #include "generation.h"
#include "move.h" #include "move.h"
bool doCheck ;
int main(int argc, char** argv) { int main(int argc, char** argv) {
if(argc != 3) { if(argc != 4) {
fprintf(stderr, "usage : bin/back <template_pool> <n_templates>\n"); fprintf(stderr, "usage : bin/back <template_pool> <n_templates> <ckeckSideCompat>\n");
exit(1); exit(1);
}; };
char* filename = argv[1]; char* filename = argv[1];
int length = str_to_int(argv[2]); int length = str_to_int(argv[2]);
doCheck = (bool)((int)argv[3][0] - 48);
srand(time(NULL)); srand(time(NULL));

View File

@ -19,66 +19,11 @@
#include "move.h" #include "move.h"
double speed = 0.5 ; double speed = 0.5 ;
int precision = 12 ; int precision = 8 ;
double εx = 0.0; double εx = 0.0;
double εy = 0.0; double εy = 0.0;
bool checkCollision() {
return (unpack_coord(gridGet(map, player_cx, player_cy)->chdata.lines, player_x, player_y));
}
bool checkCollision2(int cx, int cy, int x, int y) {
return (unpack_coord(gridGet(map, cx, cy)->chdata.lines, x, y));
}
void normalize(int* ch_coord, int* coord, double* ε) {
if(*ε >= 1.0) {
*ε -= 1.0 ;
*coord += 1 ;
if(*coord >= 8) {
*coord -= 8 ;
*ch_coord += 1;
}
} else if(*ε < 0.0) {
*ε += 1.0 ;
*coord -= 1 ;
if(*coord < 0) {
*coord += 8 ;
*ch_coord -= 1;
}
}
}
bool checkCollisionSquare(double square_size) {
double εxmin = εx - square_size;
double εxmax = εx + square_size;
double εymin = εy - square_size;
double εymax = εy + square_size;
int xmin = player_x ;
int xmax = player_x ;
int ymin = player_y ;
int ymax = player_y ;
int cxmin = player_cx ;
int cxmax = player_cx ;
int cymin = player_cy ;
int cymax = player_cy ;
normalize(&cxmin, &xmin, &εxmin);
normalize(&cxmax, &xmax, &εxmax);
normalize(&cymin, &ymin, &εymin);
normalize(&cymax, &ymax, &εymax);
return (
checkCollision2(cxmin, cymin, xmin, ymin) ||
checkCollision2(cxmin, cymax, xmin, ymax) ||
checkCollision2(cxmax, cymin, xmax, ymin) ||
checkCollision2(cxmax, cymax, xmax, ymax)
);
}
void increment_x(double dx) { void increment_x(double dx) {
εx = εx + dx ; εx = εx + dx ;
if(εx >= 1.0) { if(εx >= 1.0) {
@ -117,10 +62,132 @@ void increment_y(double dy) {
} }
} }
bool useSpecialTiles(int chx, int chy, int x, int y, double dx, double dy) {
chunk* ch = gridGet(map, chx, chy);
if(ch == NULL) {
fprintf(stderr, "ERROR : action performed in unloaded chunk\n");
exit(1);
}
//linkedPrint(ch->chdata.meta->next);
//printf("\n");
char* flag ;
if(linked_mem(ch->chdata.meta->next, y, x, &flag)) {
//printf("Triggered\n");
if(str_equal(flag, "spinCC")) {
rotateChunkCounterClockWise(chx, chy);
increment_x(-dx);
increment_y(-dy);
double plx = (double)(player_x + εx) ;
double ply = (double)(player_y + εy) ;
double npx = 7.99999999 - ply ;
double npy = plx ;
//printf("(%lf, %lf) -> (%lf, %lf)\n", plx, ply, npx, npy);
player_x = (int)npx ;
εx = (double)(npx - (int)npx) ;
player_y = (int)npy ;
εy = (double)(npy - (int)npy) ;
increment_x(dx);
increment_y(dy);
} else if(str_equal(flag, "spinCW")) {
increment_x(-dx);
increment_y(-dy);
for(int k = 0; k < 3; k++) {
rotateChunkCounterClockWise(chx, chy);
double plx = (double)(player_x + εx) ;
double ply = (double)(player_y + εy) ;
double npx = 7.99999999 - ply ;
double npy = plx ;
//printf("(%lf, %lf) -> (%lf, %lf)\n", plx, ply, npx, npy);
player_x = (int)npx ;
εx = (double)(npx - (int)npx) ;
player_y = (int)npy ;
εy = (double)(npy - (int)npy) ;
}
increment_x(dx);
increment_y(dy);
} else if(str_equal(flag, "beltX")) {
translateChunkX(chx, chy);
player_x = (player_x+1)%8;
} else if(str_equal(flag, "belt-X")) {
translateChunk_X(chx, chy);
player_x = (player_x+7)%8;
} else if(str_equal(flag, "beltY")) {
translateChunkY(chx, chy);
player_y = (player_y+7)%8;
} else if(str_equal(flag, "belt-Y")) {
translateChunk_Y(chx, chy);
player_y = (player_y+1)%8;
}
}
return true ;
}
bool checkCollision() {
return (unpack_coord(gridGet(map, player_cx, player_cy)->chdata.lines, player_x, player_y));
}
bool checkCollision2(int cx, int cy, int x, int y, double dx, double dy) {
return (unpack_coord(gridGet(map, cx, cy)->chdata.lines, x, y) && useSpecialTiles(cx, cy, x, y, dx, dy));
}
void normalize(int* ch_coord, int* coord, double* ε) {
if(*ε >= 1.0) {
*ε -= 1.0 ;
*coord += 1 ;
if(*coord >= 8) {
*coord -= 8 ;
*ch_coord += 1;
}
} else if(*ε < 0.0) {
*ε += 1.0 ;
*coord -= 1 ;
if(*coord < 0) {
*coord += 8 ;
*ch_coord -= 1;
}
}
}
bool checkCollisionSquare(double square_size, double dx, double dy) {
double εxmin = εx - square_size;
double εxmax = εx + square_size;
double εymin = εy - square_size;
double εymax = εy + square_size;
int xmin = player_x ;
int xmax = player_x ;
int ymin = player_y ;
int ymax = player_y ;
int cxmin = player_cx ;
int cxmax = player_cx ;
int cymin = player_cy ;
int cymax = player_cy ;
normalize(&cxmin, &xmin, &εxmin);
normalize(&cxmax, &xmax, &εxmax);
normalize(&cymin, &ymin, &εymin);
normalize(&cymax, &ymax, &εymax);
return (
checkCollision2(cxmin, cymin, xmin, ymin, dx, dy) ||
checkCollision2(cxmin, cymax, xmin, ymax, dx, dy) ||
checkCollision2(cxmax, cymin, xmax, ymin, dx, dy) ||
checkCollision2(cxmax, cymax, xmax, ymax, dx, dy)
);
}
bool moveRequest(double dx, double dy) { bool moveRequest(double dx, double dy) {
increment_x(dx); increment_x(dx);
increment_y(dy); increment_y(dy);
if(checkCollisionSquare(0.15)) { if(checkCollisionSquare(0.1, dx, dy)) {
increment_x(-dx); increment_x(-dx);
increment_y(-dy); increment_y(-dy);
return false; return false;
@ -174,17 +241,22 @@ void moveControl(bool* halt) {
void moveFunctionMaster(SDL_Renderer* renderer) { void moveFunctionMaster(SDL_Renderer* renderer) {
bool halt = false ; bool halt = false ;
while(!halt) { while(!halt) {
//clock_t start = clock();
moveControl(&halt); moveControl(&halt);
resetRenderer(renderer); resetRenderer(renderer);
drawMapToRenderer(renderer, -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))); drawMapToRenderer(renderer, -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)));
drawNumberToRenderer(renderer, digits, player_cx, 10, 10, 50, 70, 0); drawNumberToRenderer(renderer, digits, player_cx, 10, 10, 50, 70, 0);
drawNumberToRenderer(renderer, digits, player_cy, 10, 80, 50, 70, 0); drawNumberToRenderer(renderer, digits, player_cy, 10, 80, 50, 70, 0);
drawNumberToRenderer(renderer, digits, player_x, __width__ / 3, 10, 50, 70, 0); drawNumberToRenderer(renderer, digits, player_x, __width__ / 3, 10, 50, 70, 0);
drawCharToRenderer(renderer, letters, 'x', __width__ / 3 -20, 10, 50, 70);
drawNumberToRenderer(renderer, digits, player_y, __width__ / 3, 80, 50, 70, 0); drawNumberToRenderer(renderer, digits, player_y, __width__ / 3, 80, 50, 70, 0);
drawCharToRenderer(renderer, letters, 'y', __width__ / 3 -20, 80, 50, 70);
drawNumberToRenderer(renderer, digits, to_int(εx*100), 2 * __width__ / 3, 10, 50, 70, 0); drawNumberToRenderer(renderer, digits, to_int(εx*100), 2 * __width__ / 3, 10, 50, 70, 0);
drawNumberToRenderer(renderer, digits, to_int(εy*100), 2 * __width__ / 3, 80, 50, 70, 0); drawNumberToRenderer(renderer, digits, to_int(εy*100), 2 * __width__ / 3, 80, 50, 70, 0);
updateRenderer(renderer); updateRenderer(renderer);
draw_par += 1 ; draw_par += 1 ;
//clock_t end = clock();
//printf("Time(ms) : %f | FPS : %d\n", 1000.0f * (float)(end - start) / CLOCKS_PER_SEC, (int)(CLOCKS_PER_SEC / (float)(end - start)));
usleep(20000); usleep(20000);
} }
} }

View File

@ -1,18 +1,20 @@
#ifndef BACK_MOVE_H #ifndef BACK_MOVE_H
#define BACK_MOVE_H #define BACK_MOVE_H
bool checkCollision();
bool checkCollision2(int cx, int cy, int x, int y);
void normalize(int* ch_coord, int* coord, double* ε);
bool checkCollisionSquare(double square_size);
void increment_x(double dx); void increment_x(double dx);
void increment_y(double dy); void increment_y(double dy);
bool useSpecialTiles(int chx, int chy, int x, int y, double dx, double dy);
bool checkCollision();
bool checkCollision2(int cx, int cy, int x, int y, double dx, double dy);
void normalize(int* ch_coord, int* coord, double* ε);
bool checkCollisionSquare(double square_size, double dx, double dy);
bool moveRequest(double dx, double dy); bool moveRequest(double dx, double dy);
void moveControl(bool* halt); void moveControl(bool* halt);

View File

@ -15,6 +15,13 @@ typedef enum cardinal {NORTH, EAST, SOUTH, WEST} cardinal ;
extern Grid map ; extern Grid map ;
extern bool doCheck ;
extern linkedList* endLst ;
extern int emptyChance ;
extern int sizeIncreaseChance ;
extern int zoom ; extern int zoom ;
extern int render_distance ; extern int render_distance ;
@ -46,5 +53,9 @@ extern imgs digits ;
extern imgs letters ; extern imgs letters ;
extern template full ; extern template full ;
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