Skip to content

Commit

Permalink
Switch PROJECTILE to use PagedEntityContainer<PROJECTILE> as back…
Browse files Browse the repository at this point in the history
…ing storage

The game still uses `psProjectileList` to maintain stable and
predictable order of iteration for projectiles, but the
individual `PROJECTILE` instances are allocated from the
global `PagedEntityContainer<PROJECTILE>` instance.

Optimize `proj_UpdateAll()` by removing additional
checks inside the tight loop, which enumerates all
projectiles currently in play, thus considerably
speeding up this frequent and expensive operation.

Signed-off-by: Pavel Solodovnikov <[email protected]>
  • Loading branch information
ManManson committed Mar 11, 2024
1 parent a81be6f commit 0e9b459
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 78 deletions.
1 change: 1 addition & 0 deletions src/multistruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ bool recvLasSat(NETQUEUE queue)

// Give enemy no quarter, unleash the lasat
proj_SendProjectile(&psStruct->asWeaps[0], nullptr, player, psObj->pos, psObj, true, 0);

psStruct->asWeaps[0].lastFired = gameTime;
psStruct->asWeaps[0].ammo = 1; // abducting this field for keeping track of triggers

Expand Down
Loading

0 comments on commit 0e9b459

Please sign in to comment.