From: John Tsiombikas Date: Thu, 16 Sep 2021 21:18:41 +0000 (+0300) Subject: starts to sortof look like a dungeon if you squint X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrlugburz;a=commitdiff_plain;h=2562604c2c0de321b67317f315a52335a60b708f starts to sortof look like a dungeon if you squint --- diff --git a/src/level.c b/src/level.c index ced5b69..383ebb5 100644 --- a/src/level.c +++ b/src/level.c @@ -109,16 +109,16 @@ int load_level(struct level *lvl, const char *fname) node = (struct ts_node*)cell->next; cell->next = 0; - if(j <= 0 || cell[-1].type == CELL_SOLID) { + if(i >= lvl->height - 1 || cell[lvl->width].type == CELL_SOLID) { cell->wall[0] = TILE_STRAIGHT; } - if(i <= 0 || cell[-lvl->width].type == CELL_SOLID) { + if(j >= lvl->width - 1 || cell[1].type == CELL_SOLID) { cell->wall[1] = TILE_STRAIGHT; } - if(j >= lvl->width - 1 || cell[1].type == CELL_SOLID) { + if(i <= 0 || cell[-lvl->width].type == CELL_SOLID) { cell->wall[2] = TILE_STRAIGHT; } - if(i >= lvl->height - 1 || cell[lvl->width].type == CELL_SOLID) { + if(j <= 0 || cell[-1].type == CELL_SOLID) { cell->wall[3] = TILE_STRAIGHT; } diff --git a/src/mesh.c b/src/mesh.c index dbafcbd..9f208a4 100644 --- a/src/mesh.c +++ b/src/mesh.c @@ -302,7 +302,7 @@ static int update_mesh_vbo(struct mesh *m) static int update_meshgroup_vbo(struct meshgroup *mg) { - int i; + int i, j, idx0 = 0; struct vertex *varr, *vptr; unsigned int *iarr = 0, *iptr; struct mesh *m; @@ -337,8 +337,10 @@ static int update_meshgroup_vbo(struct meshgroup *mg) vptr += m->num_verts; if(iarr) { - memcpy(iptr, m->iarr, m->num_idx * sizeof *iptr); - iptr += m->num_idx; + for(j=0; jnum_idx; j++) { + *iptr++ = m->iarr[j] + idx0; + } + idx0 += m->num_idx; } }