aboutsummaryrefslogtreecommitdiff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-13 15:46:47 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-13 17:02:15 +0700
commit7ee1701de3faa287c6d013bd14cefb2cded25bfc (patch)
tree982f2f0591ac25823390b569ee89fd13ce084496 /src/GameInitDispose.cpp
parent4b4adf45b0326ebd902909c07ea78a397fb01300 (diff)
downloadblackshades-7ee1701de3faa287c6d013bd14cefb2cded25bfc.tar.gz
Remove excess abstractions around texture loading
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp61
1 files changed, 26 insertions, 35 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index ef5770e..c5c803e 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -411,13 +411,6 @@ void Game::LoadingScreen(float percent)
glfwSwapBuffers(glfwGetCurrentContext());
}
-void LoadPersonSpriteTexture(char *fileName, GLuint *textureid)
-{
- *textureid = loadTexture(fileName);
- glBindTexture(GL_TEXTURE_2D, *textureid);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-}
-
void initGame(Game* game)
{
// Setup loading screen
@@ -1749,33 +1742,31 @@ void initGame(Game* game)
// Load some textures
if (!game->initialized) {
- LoadPersonSpriteTexture((char*) ":Data:Textures:Personsprite.png",
- &game->personspritetextureptr);
- LoadPersonSpriteTexture((char*) ":Data:Textures:DeadPersonsprite.png",
- &game->deadpersonspritetextureptr);
- LoadPersonSpriteTexture((char*) ":Data:Textures:Scope.png",
- &game->scopetextureptr);
- LoadPersonSpriteTexture((char*) ":Data:Textures:Flare.png",
- &game->flaretextureptr);
- sprites.LoadFlareTexture((char*) ":Data:Textures:HitFlash.png");
- sprites.LoadMuzzleFlareTexture((char*) ":Data:Textures:MuzzleFlash.png");
- sprites.LoadSmokeTexture((char*) ":Data:Textures:Smoke.png");
- sprites.LoadBloodTexture((char*) ":Data:Textures:Blood.png");
- sprites.LoadRainTexture((char*) ":Data:Textures:rain.png");
- sprites.LoadSnowTexture((char*) ":Data:Textures:snow.png");
- decals.LoadBulletHoleTexture((char*) ":Data:Textures:BulletHole.png");
- decals.LoadCraterTexture((char*) ":Data:Textures:Crater.png");
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood1.png", 0);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood2.png", 1);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood3.png", 2);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood4.png", 3);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood5.png", 4);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood6.png", 5);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood7.png", 6);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood8.png", 7);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood9.png", 8);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood10.png", 9);
- decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood11.png", 10);
+ 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
@@ -1811,7 +1802,7 @@ void initGame(Game* game)
void initGl(Game* game)
{
- game->text.LoadFontTexture((char*) ":Data:Textures:Font.png");
+ game->text.FontTexture = loadTexture((char*) ":Data:Textures:Font.png");
game->text.BuildFont();
glAlphaFunc(GL_GREATER, 0.01);
glDepthFunc(GL_LESS);