summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Data/Textures/BulletHole.pngbin149 -> 0 bytes
-rw-r--r--Data/Textures/snow.pngbin193 -> 0 bytes
-rw-r--r--Data/textures/black.png (renamed from Data/Textures/Crater.png)bin149 -> 149 bytes
-rw-r--r--Data/textures/blood/00.png (renamed from Data/Textures/Blood/Blood1.png)bin436 -> 436 bytes
-rw-r--r--Data/textures/blood/01.png (renamed from Data/Textures/Blood/Blood2.png)bin500 -> 500 bytes
-rw-r--r--Data/textures/blood/02.png (renamed from Data/Textures/Blood/Blood3.png)bin567 -> 567 bytes
-rw-r--r--Data/textures/blood/03.png (renamed from Data/Textures/Blood/Blood4.png)bin653 -> 653 bytes
-rw-r--r--Data/textures/blood/04.png (renamed from Data/Textures/Blood/Blood5.png)bin712 -> 712 bytes
-rw-r--r--Data/textures/blood/05.png (renamed from Data/Textures/Blood/Blood6.png)bin773 -> 773 bytes
-rw-r--r--Data/textures/blood/06.png (renamed from Data/Textures/Blood/Blood7.png)bin888 -> 888 bytes
-rw-r--r--Data/textures/blood/07.png (renamed from Data/Textures/Blood/Blood8.png)bin949 -> 949 bytes
-rw-r--r--Data/textures/blood/08.png (renamed from Data/Textures/Blood/Blood9.png)bin1023 -> 1023 bytes
-rw-r--r--Data/textures/blood/09.png (renamed from Data/Textures/Blood/Blood10.png)bin1092 -> 1092 bytes
-rw-r--r--Data/textures/blood/10.png (renamed from Data/Textures/Blood/Blood11.png)bin1077 -> 1077 bytes
-rw-r--r--Data/textures/flare.png (renamed from Data/Textures/Flare.png)bin22161 -> 22161 bytes
-rw-r--r--Data/textures/font.png (renamed from Data/Textures/Font.png)bin26185 -> 26185 bytes
-rw-r--r--Data/textures/scope.png (renamed from Data/Textures/Scope.png)bin15169 -> 15169 bytes
-rw-r--r--Data/textures/sprites/blood.png (renamed from Data/Textures/Blood.png)bin5573 -> 5573 bytes
-rw-r--r--Data/textures/sprites/flash-hit.png (renamed from Data/Textures/HitFlash.png)bin19154 -> 19154 bytes
-rw-r--r--Data/textures/sprites/flash-muzzle.png (renamed from Data/Textures/MuzzleFlash.png)bin20095 -> 20095 bytes
-rw-r--r--Data/textures/sprites/person-dead.png (renamed from Data/Textures/DeadPersonsprite.png)bin6447 -> 6447 bytes
-rw-r--r--Data/textures/sprites/person.png (renamed from Data/Textures/Personsprite.png)bin6173 -> 6173 bytes
-rw-r--r--Data/textures/sprites/smoke.png (renamed from Data/Textures/Smoke.png)bin2868 -> 2868 bytes
-rw-r--r--Data/textures/sprites/white.png (renamed from Data/Textures/rain.png)bin193 -> 193 bytes
-rw-r--r--src/GameInitDispose.cpp52
-rw-r--r--src/main.zig6
-rw-r--r--src/misc.zig12
27 files changed, 36 insertions, 34 deletions
diff --git a/Data/Textures/BulletHole.png b/Data/Textures/BulletHole.png
deleted file mode 100644
index dde7d91..0000000
--- a/Data/Textures/BulletHole.png
+++ /dev/null
Binary files differdiff --git a/Data/Textures/snow.png b/Data/Textures/snow.png
deleted file mode 100644
index ffec64e..0000000
--- a/Data/Textures/snow.png
+++ /dev/null
Binary files differdiff --git a/Data/Textures/Crater.png b/Data/textures/black.png
index 9fff93b..9fff93b 100644
--- a/Data/Textures/Crater.png
+++ b/Data/textures/black.png
Binary files differdiff --git a/Data/Textures/Blood/Blood1.png b/Data/textures/blood/00.png
index c43e6e8..c43e6e8 100644
--- a/Data/Textures/Blood/Blood1.png
+++ b/Data/textures/blood/00.png
Binary files differdiff --git a/Data/Textures/Blood/Blood2.png b/Data/textures/blood/01.png
index 996f90e..996f90e 100644
--- a/Data/Textures/Blood/Blood2.png
+++ b/Data/textures/blood/01.png
Binary files differdiff --git a/Data/Textures/Blood/Blood3.png b/Data/textures/blood/02.png
index f691690..f691690 100644
--- a/Data/Textures/Blood/Blood3.png
+++ b/Data/textures/blood/02.png
Binary files differdiff --git a/Data/Textures/Blood/Blood4.png b/Data/textures/blood/03.png
index 15a2101..15a2101 100644
--- a/Data/Textures/Blood/Blood4.png
+++ b/Data/textures/blood/03.png
Binary files differdiff --git a/Data/Textures/Blood/Blood5.png b/Data/textures/blood/04.png
index 4c8e5cb..4c8e5cb 100644
--- a/Data/Textures/Blood/Blood5.png
+++ b/Data/textures/blood/04.png
Binary files differdiff --git a/Data/Textures/Blood/Blood6.png b/Data/textures/blood/05.png
index a54c138..a54c138 100644
--- a/Data/Textures/Blood/Blood6.png
+++ b/Data/textures/blood/05.png
Binary files differdiff --git a/Data/Textures/Blood/Blood7.png b/Data/textures/blood/06.png
index 1ff2dea..1ff2dea 100644
--- a/Data/Textures/Blood/Blood7.png
+++ b/Data/textures/blood/06.png
Binary files differdiff --git a/Data/Textures/Blood/Blood8.png b/Data/textures/blood/07.png
index f746bc9..f746bc9 100644
--- a/Data/Textures/Blood/Blood8.png
+++ b/Data/textures/blood/07.png
Binary files differdiff --git a/Data/Textures/Blood/Blood9.png b/Data/textures/blood/08.png
index 0bcd5a5..0bcd5a5 100644
--- a/Data/Textures/Blood/Blood9.png
+++ b/Data/textures/blood/08.png
Binary files differdiff --git a/Data/Textures/Blood/Blood10.png b/Data/textures/blood/09.png
index 3dade05..3dade05 100644
--- a/Data/Textures/Blood/Blood10.png
+++ b/Data/textures/blood/09.png
Binary files differdiff --git a/Data/Textures/Blood/Blood11.png b/Data/textures/blood/10.png
index fb461da..fb461da 100644
--- a/Data/Textures/Blood/Blood11.png
+++ b/Data/textures/blood/10.png
Binary files differdiff --git a/Data/Textures/Flare.png b/Data/textures/flare.png
index b7f0c30..b7f0c30 100644
--- a/Data/Textures/Flare.png
+++ b/Data/textures/flare.png
Binary files differdiff --git a/Data/Textures/Font.png b/Data/textures/font.png
index a48ae83..a48ae83 100644
--- a/Data/Textures/Font.png
+++ b/Data/textures/font.png
Binary files differdiff --git a/Data/Textures/Scope.png b/Data/textures/scope.png
index e3acddf..e3acddf 100644
--- a/Data/Textures/Scope.png
+++ b/Data/textures/scope.png
Binary files differdiff --git a/Data/Textures/Blood.png b/Data/textures/sprites/blood.png
index 6c02b02..6c02b02 100644
--- a/Data/Textures/Blood.png
+++ b/Data/textures/sprites/blood.png
Binary files differdiff --git a/Data/Textures/HitFlash.png b/Data/textures/sprites/flash-hit.png
index 0b7781b..0b7781b 100644
--- a/Data/Textures/HitFlash.png
+++ b/Data/textures/sprites/flash-hit.png
Binary files differdiff --git a/Data/Textures/MuzzleFlash.png b/Data/textures/sprites/flash-muzzle.png
index ec99efd..ec99efd 100644
--- a/Data/Textures/MuzzleFlash.png
+++ b/Data/textures/sprites/flash-muzzle.png
Binary files differdiff --git a/Data/Textures/DeadPersonsprite.png b/Data/textures/sprites/person-dead.png
index fc2c78f..fc2c78f 100644
--- a/Data/Textures/DeadPersonsprite.png
+++ b/Data/textures/sprites/person-dead.png
Binary files differdiff --git a/Data/Textures/Personsprite.png b/Data/textures/sprites/person.png
index d1a7cb0..d1a7cb0 100644
--- a/Data/Textures/Personsprite.png
+++ b/Data/textures/sprites/person.png
Binary files differdiff --git a/Data/Textures/Smoke.png b/Data/textures/sprites/smoke.png
index 1cef15c..1cef15c 100644
--- a/Data/Textures/Smoke.png
+++ b/Data/textures/sprites/smoke.png
Binary files differdiff --git a/Data/Textures/rain.png b/Data/textures/sprites/white.png
index 0768357..0768357 100644
--- a/Data/Textures/rain.png
+++ b/Data/textures/sprites/white.png
Binary files differdiff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index 3930a05..94ad884 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -1630,33 +1630,33 @@ void initGl(Game* game)
 	glPolygonOffset(-8,0);
 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 
-	game->text.FontTexture = loadTexture("Font.png");
+	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");
+	game->personspritetextureptr = loadTexture("sprites/person.png");
+	game->deadpersonspritetextureptr = loadTexture("sprites/person-dead.png");
+	game->scopetextureptr = loadTexture("scope.png");
+	game->flaretextureptr = loadTexture("flare.png");
+
+	sprites.flaretextureptr = loadTexture("sprites/flash-hit.png");
+	sprites.muzzleflaretextureptr = loadTexture("sprites/flash-muzzle.png");
+	sprites.smoketextureptr = loadTexture("sprites/smoke.png");
+	sprites.bloodtextureptr = loadTexture("sprites/blood.png");
+	sprites.raintextureptr = loadTexture("sprites/white.png");
+	sprites.snowtextureptr = loadTexture("sprites/white.png");
+
+	decals.bulletholetextureptr = loadTexture("black.png");
+	decals.cratertextureptr = loadTexture("black.png");
+	decals.bloodtextureptr[0u] = loadTexture("blood/00.png");
+	decals.bloodtextureptr[1u] = loadTexture("blood/01.png");
+	decals.bloodtextureptr[2u] = loadTexture("blood/02.png");
+	decals.bloodtextureptr[3u] = loadTexture("blood/03.png");
+	decals.bloodtextureptr[4u] = loadTexture("blood/04.png");
+	decals.bloodtextureptr[5u] = loadTexture("blood/05.png");
+	decals.bloodtextureptr[6u] = loadTexture("blood/06.png");
+	decals.bloodtextureptr[7u] = loadTexture("blood/07.png");
+	decals.bloodtextureptr[8u] = loadTexture("blood/08.png");
+	decals.bloodtextureptr[9u] = loadTexture("blood/09.png");
+	decals.bloodtextureptr[10] = loadTexture("blood/10.png");
 }
 
 GLvoid Game::ReSizeGLScene(float fov, float near)
diff --git a/src/main.zig b/src/main.zig
index 5c4e1c2..e6eea7b 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -24,6 +24,11 @@ const gf = @import("gfz");
 const gl = @import("zgl");
 const legacy = @cImport(@cInclude("Game.h"));
 
+comptime {
+    // Work around lazy compilation.
+    @export(@import("misc.zig").loadTexture, .{ .name = "loadTexture" });
+}
+
 var game: *legacy.Game = undefined;
 
 fn resizeWindow(window: ?*gf.Window.Impl,
@@ -75,7 +80,6 @@ pub fn main() !void {
     defer context.deinit() catch unreachable;
     try al.useContext(context);
 
-    _ = @import("misc.zig").loadTexture("Font.png"); // work around laziness
     legacy.initGame(game);
     defer legacy.closeGame(game);
     while (!try window.shouldClose()) {
diff --git a/src/misc.zig b/src/misc.zig
index ff45adc..9015a02 100644
--- a/src/misc.zig
+++ b/src/misc.zig
@@ -24,26 +24,24 @@ usingnamespace @cImport({
 
 const allocator = std.heap.c_allocator;
 const cwd = std.fs.cwd;
-const data_dir = @import("build_options").data_dir;
+const data_dir = @import("build_options").data_dir ++ [_]u8{ sep };
 const free = std.c.free;
 const sep = std.fs.path.sep;
 const maxInt = std.math.maxInt;
 const std = @import("std");
 const span = std.mem.span;
 
-const max_size = maxInt(usize); // don't judge me, take care of me
-const texture_dir = data_dir ++ [_]u8{ sep } ++ "textures";
-
 fn check(errorString: fn (c_uint) callconv(.C) [*c]const u8,
          status: anytype) void {
     if (status != 0)
         @panic(span(errorString(@intCast(c_uint, status))));
 }
 
-pub export fn loadTexture(filename: [*:0]const u8) GLuint {
-    var dir = cwd().openDir(texture_dir, .{}) catch unreachable;
+pub fn loadTexture(filename: [*:0]const u8) callconv(.C) GLuint {
+    var dir = cwd().openDir(data_dir ++ "textures", .{}) catch unreachable;
     defer dir.close();
-    var file = dir.readFileAlloc(allocator, span(filename), max_size)
+    // Don't judge me, take care of me!
+    var file = dir.readFileAlloc(allocator, span(filename), maxInt(usize))
         catch unreachable;
     defer allocator.free(file);