Skip to content

Commit

Permalink
Bump submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
vtereshkov authored and marekmaskarinec committed Nov 9, 2023
1 parent b0bcfd3 commit e6144d9
Show file tree
Hide file tree
Showing 7 changed files with 1,514 additions and 3,243 deletions.
2 changes: 1 addition & 1 deletion lib/umka
5 changes: 3 additions & 2 deletions src/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,12 +1110,13 @@ umth_nav_mesh_add_quad(UmkaStackSlot *p, UmkaStackSlot *r)
void
umth_nav_mesh_nav(UmkaStackSlot *p, UmkaStackSlot *r)
{
th_vf2s *cameFrom = p[3].ptrVal;
th_vf2s *cameFrom = p[4].ptrVal;
void *cameFromType = p[3].ptrVal;
th_navmesh *m = p[2].ptrVal;
th_vf2 p1 = *(th_vf2 *)&p[1];
th_vf2 p2 = *(th_vf2 *)&p[0];

th_navmesh_nav(cameFrom, m, p1, p2);
th_navmesh_nav(cameFrom, cameFromType, m, p1, p2);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ warning(UmkaError *error)
int
th_init(const char *scriptpath, const char *script_src)
{
char *mainmod_fmt = "import (mainmod = \"%s\"; \"window.um\"; \"nav.um\")\n"
char *mainmod_fmt = "import (mainmod = \"%s\"; \"window.um\")\n"
"fn main() {}\n"
"fn __th_init*() {\n"
" mainmod.init()\n"
Expand Down
7 changes: 2 additions & 5 deletions src/nav.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,15 @@ check_bounds(th_navmesh *m, th_vf2 p, size_t h)
return p.x >= 0 && p.y >= 0 && p.x < m->w && p.y < h;
}

static void *umka_vf2s = NULL;

void
th_navmesh_nav(th_vf2s *cameFrom, th_navmesh *m, th_vf2 p1, th_vf2 p2)
th_navmesh_nav(th_vf2s *cameFrom, void *cameFromType, th_navmesh *m, th_vf2 p1, th_vf2 p2)
{
const th_vf2 movemap[] = {{{-1, -1}}, {{+0, -1}}, {{+1, -1}}, {{-1, +0}}, {{+1, +0}},
{{-1, +1}}, {{+0, +1}}, {{+1, +1}}};
const size_t msiz = umkaGetDynArrayLen((void *)&m->d);
const size_t mh = msiz / m->w;

umkaMakeDynArray(thg->umka, cameFrom, umka_vf2s, msiz);
umkaMakeDynArray(thg->umka, cameFrom, cameFromType, msiz);

for (int i = 0; i < msiz; ++i) {
cameFrom->data[i].x = -1;
Expand Down Expand Up @@ -174,5 +172,4 @@ th_navmesh_nav(th_vf2s *cameFrom, th_navmesh *m, th_vf2 p1, th_vf2 p2)
void
th_nav_init(void)
{
umka_vf2s = umkaGetType(thg->umka, "nav.um", "Vf2s");
}
Loading

0 comments on commit e6144d9

Please sign in to comment.