summary refs log tree commit diff
path: root/src/Decals.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Decals.h')
-rw-r--r--src/Decals.h47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/Decals.h b/src/Decals.h
index f37f523..cfe7a0e 100644
--- a/src/Decals.h
+++ b/src/Decals.h
@@ -2,7 +2,7 @@
 // Copyright (C) 2002  David Rosen
 // Copyright (C) 2003  Steven Fuller
 // Copyright (C) 2003  Zachary Jack Slater
-// Copyright (C) 2021  Nguyễn Gia Phong
+// Copyright (C) 2021, 2023  Nguyễn Gia Phong
 //
 // This file is part of Black Shades.
 //
@@ -25,30 +25,33 @@
 #include "Models.h"
 #include "Quaternions.h"
 
-#define maxdecals 120
+#define MAX_DECALS 120
 
-class Decals{
-public:
-	GLuint bulletholetextureptr;
-	GLuint cratertextureptr;
-	GLuint bloodtextureptr[11];
+enum decal { BULLET_HOLE, CRATER, BLOOD_POOL };
 
-	int howmanydecals;
+struct Decals {
+	GLuint hole_textures[2];
+	GLuint blood_textures[11];
 
-	int type[maxdecals];
-
-	XYZ points[8*maxdecals];
-	int numpoints[maxdecals];
-	float texcoordsx[8*maxdecals];
-	float texcoordsy[8*maxdecals];
-	float alivetime[maxdecals];
-
-	void draw();
+	GLuint len;
+	enum decal kind[MAX_DECALS];
+	XYZ points[MAX_DECALS * 8];
+	GLuint numpoints[MAX_DECALS];
+	GLfloat texcoordsx[MAX_DECALS * 8];
+	GLfloat texcoordsy[MAX_DECALS * 8];
+	GLfloat alive[MAX_DECALS];
+};
 
-	int DeleteDecal(int which);
-	int MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, Model *model, XYZ move, float rotation);
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+void addDecal(struct Decals *d, enum decal kind, XYZ location, float size,
+              XYZ normal, int poly, Model *model, XYZ move, float rotation);
+void updateDecals(struct Decals *d);
+void drawDecals(struct Decals *d);
+void destroyDecals(struct Decals *d);
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
 
-	void DoStuff();
-	~Decals();
-};
 #endif // BLACKSHADES_DECALS_H