Differences From Artifact [8ffa70a39e]:
- File
src/savegamedemo.mm
— part of check-in
[57b9a0a9db]
at
2025-03-10 20:39:51
on branch trunk
— Fix player not moving on demo playback
It's still broken, though. (user: js, size: 12372) [annotate] [blame] [check-ins using]
To Artifact [7c09343b90]:
- File src/savegamedemo.mm — part of check-in [b81e2948d7] at 2025-03-15 23:42:51 on branch trunk — Migrate last strings (user: js, size: 12415) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
101 102 103 104 105 106 107 | return; } gzwrite(f, (void *)"CUBESAVE", 8); gzputc(f, islittleendian); gzputi(SAVEGAMEVERSION); OFData *data = [player1 dataBySerializing]; gzputi(data.count); | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | return; } gzwrite(f, (void *)"CUBESAVE", 8); gzputc(f, islittleendian); gzputi(SAVEGAMEVERSION); OFData *data = [player1 dataBySerializing]; gzputi(data.count); char map[_MAXDEFSTR] = { 0 }; memcpy(map, getclientmap().UTF8String, min(getclientmap().UTF8StringLength, _MAXDEFSTR - 1)); gzwrite(f, map, _MAXDEFSTR); gzputi(gamemode); gzputi(ents.length()); loopv(ents) gzputc(f, ents[i].spawned); gzwrite(f, data.items, data.count); OFArray<DynamicEntity *> *monsters = getmonsters(); gzputi(monsters.count); |
︙ | ︙ | |||
159 160 161 162 163 164 165 | cStringWithEncoding:OFLocale.encoding], "rb9"); if (!f) { conoutf(@"could not open %@", IRI.string); return; } | > | < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | cStringWithEncoding:OFLocale.encoding], "rb9"); if (!f) { conoutf(@"could not open %@", IRI.string); return; } char mapname[_MAXDEFSTR] = { 0 }; char buf[8]; gzread(f, buf, 8); if (strncmp(buf, "CUBESAVE", 8)) goto out; if (gzgetc(f) != islittleendian) goto out; // not supporting save->load accross // incompatible architectures simpifies things // a LOT if (gzgeti() != SAVEGAMEVERSION || gzgeti() != DynamicEntity.serializedSize) goto out; gzread(f, mapname, _MAXDEFSTR); nextmode = gzgeti(); @autoreleasepool { // continue below once map has been loaded and client & // server have updated changemap(@(mapname)); } |
︙ | ︙ | |||
449 450 451 452 453 454 455 | DynamicEntity *target = players[democlientnum]; assert(target); int extras; // read additional client side state not present in normal // network stream | | | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | DynamicEntity *target = players[democlientnum]; assert(target); int extras; // read additional client side state not present in normal // network stream if ((extras = gzget())) { target.gunselect = gzget(); target.lastattackgun = gzget(); target.lastaction = scaletime(gzgeti()); target.gunwait = gzgeti(); target.health = gzgeti(); target.armour = gzgeti(); target.armourtype = gzget(); loopi(NUMGUNS) target.ammo[i] = gzget(); target.state = gzget(); target.lastmove = playbacktime; if ((bdamage = gzgeti())) damageblend(bdamage); if ((ddamage = gzgeti())) { gzgetv(dorig); particle_splash(3, ddamage, 1000, dorig); } // FIXME: set more client state here } // insert latest copy of player into history |
︙ | ︙ |