diff options
author | rodri <rgl@antares-labs.eu> | 2023-05-14 15:54:05 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-05-14 15:54:05 +0000 |
commit | 1baca76aaf266a2d071af4a173aee5b85efeffd6 (patch) | |
tree | c5bc3bffe0aa4076dbc053d10103f2125724e4f3 | |
parent | d2c0ab7a62b7a2c99c4c491ce55466859429571b (diff) | |
download | musw-1baca76aaf266a2d071af4a173aee5b85efeffd6.tar.gz musw-1baca76aaf266a2d071af4a173aee5b85efeffd6.tar.bz2 musw-1baca76aaf266a2d071af4a173aee5b85efeffd6.zip |
cleanup and comment improvements.
-rw-r--r-- | dat.h | 14 | ||||
-rw-r--r-- | musw.c | 13 | ||||
-rw-r--r-- | muswd.c | 4 | ||||
-rw-r--r-- | todo | 2 | ||||
-rw-r--r-- | universe.c | 2 |
5 files changed, 20 insertions, 15 deletions
@@ -32,18 +32,18 @@ enum { NShi, /* S accepts. sends P and G for DHX */ NCdhx = 12, /* C shares pubkey */ NSdhx, /* S shares pubkey */ - NCnudge = 16, /* nudge ACK */ - NSnudge, /* check the pulse of the line */ + NCnudge = 16, /* C ACKs nudge */ + NSnudge, /* S checks the pulse of the line */ NCinput = 20, /* C sends player input state */ NSsimstate, /* S sends current simulation state */ - NCawol = 22, /* AWOL ACK */ - NSawol, /* notify the adversary flew away */ + NCawol = 22, /* C ACKs AWOL */ + NSawol, /* S notifies the adversary flew away */ - NCbuhbye = 30, - NSbuhbye, + NCbuhbye = 30, /* C quits gracefully */ + NSbuhbye, /* S kicks the player out */ - NSerror = 66 /* report an error */ + NSerror = 66 /* S reports an error */ }; enum { @@ -737,7 +737,11 @@ threadmain(int argc, char *argv[]) frametime = now - then; then = now; - if(gamestate != &gamestates[GSIntro]){ + switch(gamestate-gamestates){ + case GSPlaying: + universe->star.spr->step(universe->star.spr, frametime/1e6); + /* fallthrough */ + default: if(netconn.state == NCSConnecting) lastpktsent += frametime/1e6; @@ -746,11 +750,12 @@ threadmain(int argc, char *argv[]) initconn(); lastpktsent = 0; } + break; + case GSIntro: + intro->step(intro, frametime/1e6); + break; } - gamestate = gamestate->δ(gamestate, &frametime); - universe->star.spr->step(universe->star.spr, frametime/1e6); - intro->step(intro, frametime/1e6); redraw(); @@ -67,9 +67,9 @@ dissolveparty(Player *player) signframe(f, adv->conn->dh.priv); sendp(egress, f); - return; + goto kickplayer; } - +kickplayer: /* * make sure to free the player even if there's no * party going on. @@ -1,7 +1,7 @@ [ ] collision detection [✓] toroidal warping [✓] respect bullets's ttl - [ ] communicate this event to the clients + [✓] communicate this event to the clients (δ: fired 1 → 0) [ ] explode when the time comes [ ] fuel consumption [ ] hyperjump @@ -95,7 +95,7 @@ warp(Particle *p) p->p.y = r.min.y; } -/* collision resolution */ +/* collision detection and resolution */ static void universe_collide(Universe *u) { |