aboutsummaryrefslogtreecommitdiff
path: root/musw.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-04-25 01:40:32 +0000
committerrodri <rgl@antares-labs.eu>2023-04-25 01:40:32 +0000
commitfcc06b383c3490d105b527849dcf0b9d7af8481f (patch)
treef4f1be410c1e91efd79aa41562380b73ddd1814c /musw.c
parent826fce49c5319d0965c603dc950623cc07996376 (diff)
downloadmusw-fcc06b383c3490d105b527849dcf0b9d7af8481f.tar.gz
musw-fcc06b383c3490d105b527849dcf0b9d7af8481f.tar.bz2
musw-fcc06b383c3490d105b527849dcf0b9d7af8481f.zip
bullets aren't fired unless the server says otherwise. also don't draw bullets that weren't fired.
Diffstat (limited to 'musw.c')
-rw-r--r--musw.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/musw.c b/musw.c
index 8d428c0..0703393 100644
--- a/musw.c
+++ b/musw.c
@@ -166,6 +166,9 @@ drawbullets(Ship *ship, Image *dst)
Point2 v;
for(i = 0; i < nelem(ship->rounds); i++){
+ if(!ship->rounds[i].fired)
+ continue;
+
b = &ship->rounds[i];
v = Vec2(-1,0); /* it's pointing backwards to paint the tail */
Matrix R = {
@@ -391,13 +394,18 @@ threadnetppu(void *)
fprint(2, "nfired0 %d nfired1 %d\n", nfired[0], nfired[1]);
for(i = 0; i < nelem(universe->ships); i++)
+ for(j = 0; j < nelem(universe->ships[i].rounds); j++)
+ universe->ships[i].rounds[j].fired = 0;
+
+ for(i = 0; i < nelem(universe->ships); i++)
for(j = 0; j < nfired[i]; j++){
bufp += unpack(bufp, frame->len - (bufp-frame->data), "b",
&bi);
if(debug)
- fprint(2, "bi %d\n", bi);
+ fprint(2, "si %d bi %d\n", i, bi);
bufp += unpack(bufp, frame->len - (bufp-frame->data), "Pd",
&universe->ships[i].rounds[bi].p, &universe->ships[i].rounds[bi].θ);
+ universe->ships[i].rounds[bi].fired++;
}
break;
case NSnudge: