From 42ea627853d79a54ef956a831e2f8badff5bfdb8 Mon Sep 17 00:00:00 2001 From: rodri Date: Sun, 9 Apr 2023 22:14:26 +0000 Subject: added a new pulsar animation for the star sprite. wrote a little description for the manpage. generalized the drawconnecting() procedure into a drawprogressing() one that takes an arbitrary, nul-terminated string as input. --- assets/spr/pulsar.pic | Bin 0 -> 9294 bytes musw.c | 13 ++++++------- musw.man | 6 +++++- muswd.c | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 assets/spr/pulsar.pic diff --git a/assets/spr/pulsar.pic b/assets/spr/pulsar.pic new file mode 100644 index 0000000..2444d31 Binary files /dev/null and b/assets/spr/pulsar.pic differ diff --git a/musw.c b/musw.c index 026ed9c..019410a 100644 --- a/musw.c +++ b/musw.c @@ -480,7 +480,7 @@ darkness: } void -drawconnecting(void) +drawprogressing(char *s) { static double t0; static Point p = {100,300}; @@ -491,11 +491,11 @@ drawconnecting(void) t0 = nanosec(); if(nanosec()-t0 >= 5e9){ /* every five seconds */ - p = Pt(ntruerand(SCRW-2*100)+100,ntruerand(SCRH-100)+100); + p = Pt(ntruerand(SCRW-stringwidth(font, s)-3*font->width),ntruerand(SCRH-font->height)); t0 = nanosec(); } - np = string(screenb, addpt(screenb->r.min, p), display->white, ZP, font, "connecting"); + np = string(screenb, addpt(screenb->r.min, p), display->white, ZP, font, s); for(i = 1; i < 3+1; i++){ if(nanosec()-t0 > i*1e9) @@ -518,9 +518,10 @@ redraw(void) intro->draw(intro, screenb, subpt(divpt(screenb->r.max, 2), divpt(intro->r.max, 2))); break; case GSConnecting: - drawconnecting(); + drawprogressing("connecting"); break; case GSMatching: + drawprogressing("waiting for players"); break; case GSPlaying: drawship(&universe->ships[0], screenb); @@ -548,8 +549,6 @@ resize(void) sysfatal("resize failed"); unlockdisplay(display); -// screenrf.p = Pt2(screen->r.min.x+Dx(screen->r)/2,screen->r.max.y-Dy(screen->r)/2,1); - /* ignore move events */ if(Dx(screen->r) != SCRW || Dy(screen->r) != SCRH){ fd = open("/dev/wctl", OWRITE); @@ -660,7 +659,7 @@ threadmain(int argc, char *argv[]) sysfatal("readvmodel: %r"); universe->ships[0].mdl = needlemdl; universe->ships[1].mdl = wedgemdl; - universe->star.spr = readsprite("assets/spr/earth.pic", ZP, Rect(0,0,32,32), 5, 20e3); + universe->star.spr = readsprite("assets/spr/pulsar.pic", ZP, Rect(0,0,64,64), 9, 50); intro = readsprite("assets/spr/intro.pic", ZP, Rect(0,0,640,480), 1, 0); diff --git a/musw.man b/musw.man index d344308..70d738b 100644 --- a/musw.man +++ b/musw.man @@ -4,7 +4,7 @@ musw, muswd \- multi-user spacewar! .SH SYNOPSIS .B games/musw [ -.B -d +.B -dg ] .I dialstring .br @@ -17,6 +17,10 @@ musw, muswd \- multi-user spacewar! .I addr ] .SH DESCRIPTION +.I Musw +is a multi-user, on-line version of +.IR Spacewar! , +the space dogfight simulation game developed by Steve Russell in the 1960s for the PDP-1. .SH EXAMPLE .SH SOURCE .B /sys/src/games/musw diff --git a/muswd.c b/muswd.c index cc5c73a..27a9e00 100644 --- a/muswd.c +++ b/muswd.c @@ -473,12 +473,12 @@ threadmain(int argc, char *argv[]) fmtinstall(L'Φ', Φfmt); addr = "udp!*!112"; ARGBEGIN{ - case 'a': - addr = EARGF(usage()); - break; case 'd': debug++; break; + case 'a': + addr = EARGF(usage()); + break; default: usage(); }ARGEND; -- cgit v1.2.3