diff options
author | rodri <rgl@antares-labs.eu> | 2021-07-29 20:03:15 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2021-07-29 20:03:15 +0000 |
commit | b57dba67153279a84a16bba40ae007c8ae710056 (patch) | |
tree | 62ff359275ae3c70b16d341fabf59c4df1431137 /muswd.c | |
parent | 3241d4b8c80f9424a3f725b5905def22916fc854 (diff) | |
download | musw-b57dba67153279a84a16bba40ae007c8ae710056.tar.gz musw-b57dba67153279a84a16bba40ae007c8ae710056.tar.bz2 musw-b57dba67153279a84a16bba40ae007c8ae710056.zip |
incorporated libgeometry into the project.
transitioned the integrator from scalar to vector-based.
added a packing procedure for Point2.
created the structure to model bullets.
Diffstat (limited to 'muswd.c')
-rw-r--r-- | muswd.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,7 +1,8 @@ #include <u.h> #include <libc.h> #include <thread.h> -#include <draw.h> /* because of dat.h */ +#include <draw.h> +#include "libgeometry/geometry.h" #include "dat.h" #include "fns.h" @@ -70,7 +71,7 @@ broadcaststate(void) Party *p, *np; for(p = theparty.next; p != &theparty; p = p->next){ - n = pack(buf, sizeof buf, "dd", p->state.x, p->state.v); + n = pack(buf, sizeof buf, "PP", p->state.p, p->state.v); for(i = 0; i < nelem(p->players); i++){ if(write(p->players[i].conn.data, buf, n) != n){ @@ -90,7 +91,7 @@ void resetsim(Party *p) { memset(&p->state, 0, sizeof p->state); - p->state.x = 100; + p->state.p = Pt2(0,100,1); } void @@ -159,8 +160,8 @@ fprintstates(int fd) Party *p; for(p = theparty.next; p != &theparty; p = p->next, i++) - fprint(fd, "%lud [x %g v %g]\n", - i, p->state.x, p->state.v); + fprint(fd, "%lud [p %v v %v]\n", + i, p->state.p, p->state.v); } @@ -215,6 +216,7 @@ threadmain(int argc, char *argv[]) int acfd; char adir[40], *addr; + GEOMfmtinstall(); addr = "tcp!*!112"; /* for testing. will work out udp soon */ ARGBEGIN{ case 'a': |