aboutsummaryrefslogtreecommitdiff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-17 22:17:48 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-17 22:17:48 +0700
commitb1e4fa0d290c3f484054b61f8d2875cae33e099d (patch)
treea35307ae1ce237386da728623ad7211dac8b7513 /src/GameInitDispose.cpp
parent1084e3f994eeedaf54cc8c9785f75ddb1727191e (diff)
downloadblackshades-b1e4fa0d290c3f484054b61f8d2875cae33e099d.tar.gz
Convert texture loading code to Zig
LodePNG replaces stb because complicated headers don't play nice with Zig. Textures are now loaded from installed path instead of CWD too.
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index 027d74b..3930a05 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -23,7 +23,7 @@
#include <AL/alc.h>
#include "config.h"
-#include "Textures.h"
+#include "misc.h"
#include "Game.h"
extern unsigned int gSourceID[100];
@@ -1602,35 +1602,6 @@ void initGame(Game* game)
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glEnable(GL_LIGHT0);
- // Load some textures
- if (!game->initialized) {
- game->personspritetextureptr = loadTexture((char*) ":Data:Textures:Personsprite.png");
- game->deadpersonspritetextureptr = loadTexture((char*) ":Data:Textures:DeadPersonsprite.png");
- game->scopetextureptr = loadTexture((char*) ":Data:Textures:Scope.png");
- game->flaretextureptr = loadTexture((char*) ":Data:Textures:Flare.png");
-
- sprites.flaretextureptr = loadTexture((char*) ":Data:Textures:HitFlash.png");
- sprites.muzzleflaretextureptr = loadTexture((char*) ":Data:Textures:MuzzleFlash.png");
- sprites.smoketextureptr = loadTexture((char*) ":Data:Textures:Smoke.png");
- sprites.bloodtextureptr = loadTexture((char*) ":Data:Textures:Blood.png");
- sprites.raintextureptr = loadTexture((char*) ":Data:Textures:rain.png");
- sprites.snowtextureptr = loadTexture((char*) ":Data:Textures:snow.png");
-
- decals.bulletholetextureptr = loadTexture((char*) ":Data:Textures:BulletHole.png");
- decals.cratertextureptr = loadTexture((char*) ":Data:Textures:Crater.png");
- decals.bloodtextureptr[0] = loadTexture((char*) ":Data:Textures:Blood:Blood1.png");
- decals.bloodtextureptr[1] = loadTexture((char*) ":Data:Textures:Blood:Blood2.png");
- decals.bloodtextureptr[2] = loadTexture((char*) ":Data:Textures:Blood:Blood3.png");
- decals.bloodtextureptr[3] = loadTexture((char*) ":Data:Textures:Blood:Blood4.png");
- decals.bloodtextureptr[4] = loadTexture((char*) ":Data:Textures:Blood:Blood5.png");
- decals.bloodtextureptr[5] = loadTexture((char*) ":Data:Textures:Blood:Blood6.png");
- decals.bloodtextureptr[6] = loadTexture((char*) ":Data:Textures:Blood:Blood7.png");
- decals.bloodtextureptr[7] = loadTexture((char*) ":Data:Textures:Blood:Blood8.png");
- decals.bloodtextureptr[8] = loadTexture((char*) ":Data:Textures:Blood:Blood9.png");
- decals.bloodtextureptr[9] = loadTexture((char*) ":Data:Textures:Blood:Blood10.png");
- decals.bloodtextureptr[10] = loadTexture((char*) ":Data:Textures:Blood:Blood11.png");
- }
-
// Setup clip plane equation
game->eqn[0] = 0;
game->eqn[1] = 1;
@@ -1654,12 +1625,38 @@ void initGame(Game* game)
void initGl(Game* game)
{
- game->text.FontTexture = loadTexture((char*) ":Data:Textures:Font.png");
- game->text.BuildFont();
glAlphaFunc(GL_GREATER, 0.01);
glDepthFunc(GL_LESS);
glPolygonOffset(-8,0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ game->text.FontTexture = loadTexture("Font.png");
+ game->text.BuildFont();
+ game->personspritetextureptr = loadTexture("Personsprite.png");
+ game->deadpersonspritetextureptr = loadTexture("DeadPersonsprite.png");
+ game->scopetextureptr = loadTexture("Scope.png");
+ game->flaretextureptr = loadTexture("Flare.png");
+
+ sprites.flaretextureptr = loadTexture("HitFlash.png");
+ sprites.muzzleflaretextureptr = loadTexture("MuzzleFlash.png");
+ sprites.smoketextureptr = loadTexture("Smoke.png");
+ sprites.bloodtextureptr = loadTexture("Blood.png");
+ sprites.raintextureptr = loadTexture("rain.png");
+ sprites.snowtextureptr = loadTexture("snow.png");
+
+ decals.bulletholetextureptr = loadTexture("BulletHole.png");
+ decals.cratertextureptr = loadTexture("Crater.png");
+ decals.bloodtextureptr[0] = loadTexture("Blood/Blood1.png");
+ decals.bloodtextureptr[1] = loadTexture("Blood/Blood2.png");
+ decals.bloodtextureptr[2] = loadTexture("Blood/Blood3.png");
+ decals.bloodtextureptr[3] = loadTexture("Blood/Blood4.png");
+ decals.bloodtextureptr[4] = loadTexture("Blood/Blood5.png");
+ decals.bloodtextureptr[5] = loadTexture("Blood/Blood6.png");
+ decals.bloodtextureptr[6] = loadTexture("Blood/Blood7.png");
+ decals.bloodtextureptr[7] = loadTexture("Blood/Blood8.png");
+ decals.bloodtextureptr[8] = loadTexture("Blood/Blood9.png");
+ decals.bloodtextureptr[9] = loadTexture("Blood/Blood10.png");
+ decals.bloodtextureptr[10] = loadTexture("Blood/Blood11.png");
}
GLvoid Game::ReSizeGLScene(float fov, float near)