From 73f85b6d9c264a91f74e6fe96311ad443cdfd6f5 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 23 Nov 2025 00:26:48 -0800
Subject: [PATCH] Added a sprite CRC to verify all players have identical
collision data
---
game/Maelstrom_Globals.h | 1 +
game/init.cpp | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/game/Maelstrom_Globals.h b/game/Maelstrom_Globals.h
index 6a894cca..559a481a 100644
--- a/game/Maelstrom_Globals.h
+++ b/game/Maelstrom_Globals.h
@@ -100,6 +100,7 @@ extern MPoint gThrustOrigins[SHIP_FRAMES];
extern MPoint gVelocityTable[SHIP_FRAMES];
extern StarPtr gTheStars[MAX_STARS];
extern Uint32 gStarColors[];
+extern Uint32 gSpriteCRC;
// in game.cpp :
extern int gDisplayed;
diff --git a/game/init.cpp b/game/init.cpp
index b4b5ca83..41ca73f5 100644
--- a/game/init.cpp
+++ b/game/init.cpp
@@ -60,6 +60,7 @@ MPoint gThrustOrigins[SHIP_FRAMES];
MPoint gVelocityTable[SHIP_FRAMES];
StarPtr gTheStars[MAX_STARS];
Uint32 gStarColors[20];
+Uint32 gSpriteCRC = 0;
/* -- The blit'ers we use */
BlitPtr gRock1R, gRock2R, gRock3R, gDamagedShip;
@@ -1195,8 +1196,6 @@ static int LoadSprite(bool large, BlitPtr *theBlit, int baseID, int numFrames)
}
SetRect(&aBlit->hitRect, left, top, right, bottom);
- SDL_DestroySurface(surface);
-
/* Load the image */
aBlit->sprite[index] = GetSprite(screen, baseID+index, large);
if ( aBlit->sprite[index] == NULL ) {
@@ -1210,6 +1209,9 @@ static int LoadSprite(bool large, BlitPtr *theBlit, int baseID, int numFrames)
for ( offset=0; offset<length; ++offset ) {
aBlit->mask[index][offset] = mask[offset*4];
}
+ gSpriteCRC = SDL_crc32(gSpriteCRC, aBlit->mask[index], length);
+
+ SDL_DestroySurface(surface);
}
(*theBlit) = aBlit;
return(0);