summary refs log tree commit diff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-08-24 04:21:46 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-08-24 04:30:20 +0900
commitefd25d51cdd7a9cadda1c0f6983905fc17545f14 (patch)
tree8dea973669d8dfe4e7209c9f419bf8cbbf483323 /src/GameInitDispose.cpp
parent2598835c54a3869a477d287d2845bbe42790a359 (diff)
downloadblackshades-2.5.1.tar.gz
Fix decal fading animation 2.5.1
Also fix missing decal regression.

Fixes: 48417e11854f8 ("Make XYZ C-compatible")
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index 0a21275..86bb2bb 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -998,15 +998,8 @@ void initGame(Game* game)
 	glClearColor(fogcolorr,fogcolorg,fogcolorb,1);
 
 	game->initialized = true;
-	/*
-	for(int i=0;i<sprites.howmanysprites;i++){
-		sprites.DeleteSprite(0);
-	}
-	for(int i=0;i<decals.howmanydecals;i++){
-		decals.DeleteDecal(0);
-	}*/
 
-	decals.howmanydecals=0;
+	decals.len = 0;
 	sprites.howmanysprites=0;
 	game->losedelay = 1;
 }
@@ -1032,19 +1025,20 @@ void initGl(Game* game)
 	sprites.raintextureptr = loadTexture("sprites/white.qoi");
 	sprites.snowtextureptr = loadTexture("sprites/white.qoi");
 
-	decals.bulletholetextureptr = loadTexture("black.qoi");
-	decals.cratertextureptr = loadTexture("black.qoi");
-	decals.bloodtextureptr[0u] = loadTexture("blood/00.qoi");
-	decals.bloodtextureptr[1u] = loadTexture("blood/01.qoi");
-	decals.bloodtextureptr[2u] = loadTexture("blood/02.qoi");
-	decals.bloodtextureptr[3u] = loadTexture("blood/03.qoi");
-	decals.bloodtextureptr[4u] = loadTexture("blood/04.qoi");
-	decals.bloodtextureptr[5u] = loadTexture("blood/05.qoi");
-	decals.bloodtextureptr[6u] = loadTexture("blood/06.qoi");
-	decals.bloodtextureptr[7u] = loadTexture("blood/07.qoi");
-	decals.bloodtextureptr[8u] = loadTexture("blood/08.qoi");
-	decals.bloodtextureptr[9u] = loadTexture("blood/09.qoi");
-	decals.bloodtextureptr[10] = loadTexture("blood/10.qoi");
+	// TODO: use more detailed textuures for hole decals
+	decals.hole_textures[0] = loadTexture("black.qoi");
+	decals.hole_textures[1] = loadTexture("black.qoi");
+	decals.blood_textures[0u] = loadTexture("blood/00.qoi");
+	decals.blood_textures[1u] = loadTexture("blood/01.qoi");
+	decals.blood_textures[2u] = loadTexture("blood/02.qoi");
+	decals.blood_textures[3u] = loadTexture("blood/03.qoi");
+	decals.blood_textures[4u] = loadTexture("blood/04.qoi");
+	decals.blood_textures[5u] = loadTexture("blood/05.qoi");
+	decals.blood_textures[6u] = loadTexture("blood/06.qoi");
+	decals.blood_textures[7u] = loadTexture("blood/07.qoi");
+	decals.blood_textures[8u] = loadTexture("blood/08.qoi");
+	decals.blood_textures[9u] = loadTexture("blood/09.qoi");
+	decals.blood_textures[10] = loadTexture("blood/10.qoi");
 }
 
 struct Scores getScores(Game* game)
@@ -1067,4 +1061,5 @@ void closeGame(Game* game)
 	glDeleteTextures(5, textures);
 	alDeleteSources(33 + game->musictoggle * 4, gSourceID);
 	alDeleteBuffers(33 + game->musictoggle * 4, gSampleSet);
+	destroyDecals(&decals);
 }