summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/misc.h4
-rw-r--r--src/misc.zig23
2 files changed, 9 insertions, 18 deletions
diff --git a/src/misc.h b/src/misc.h
index 5fa1b56..efe575a 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -27,10 +27,10 @@ struct MuscleData {
 #ifdef __cplusplus
 extern "C" {
 #endif // __cplusplus
-	ALuint loadSound(const char*);
-	GLuint loadTexture(const char*);
 	void loadJoints(JointData*);
 	void loadMuscles(MuscleData*);
+	ALuint loadSound(const char*);
+	GLuint loadTexture(const char*);
 	void playSound(ALuint source, ALfloat x, ALfloat y, ALfloat z);
 #ifdef __cplusplus
 } // extern "C"
diff --git a/src/misc.zig b/src/misc.zig
index f4021ac..f9e0628 100644
--- a/src/misc.zig
+++ b/src/misc.zig
@@ -72,8 +72,8 @@ const Joint = extern struct {
     }
 };
 
-/// Load joints in character's frame
-fn loadJoints(joints: [*]Joint) callconv(.C) void {
+/// Load joints in character's skeleton.
+export fn loadJoints(joints: [*]Joint) void {
     var tsv = tokenize(@embedFile("joints.tsv"), "\n");
     _ = tsv.next().?; // ignore field names
     var i = @as(u8, 0);
@@ -106,8 +106,8 @@ const Muscle = extern struct {
     }
 };
 
-/// Load muscles in character's frame
-fn loadMuscles(muscles: [*]Muscle) callconv(.C) void {
+/// Load muscles in character's skeleton.
+export fn loadMuscles(muscles: [*]Muscle) void {
     var tsv = tokenize(@embedFile("muscles.tsv"), "\n");
     _ = tsv.next().?; // ignore field names
     var i = @as(u8, 0);
@@ -118,7 +118,7 @@ fn loadMuscles(muscles: [*]Muscle) callconv(.C) void {
 }
 
 /// Load audio file into an OpenAL buffer and return it.
-fn loadSound(filename: [*:0]const u8) callconv(.C) u32 {
+export fn loadSound(filename: [*:0]const u8) u32 {
     const path = join(allocator, &.{ data_dir ++ "sounds", span(filename) })
         catch unreachable;
     defer allocator.free(path);
@@ -135,7 +135,7 @@ fn check(errorString: fn (c_uint) callconv(.C) [*c]const u8,
 }
 
 /// Load PNG file into an OpenGL buffer and return it.
-fn loadTexture(filename: [*:0]const u8) callconv(.C) GLuint {
+export fn loadTexture(filename: [*:0]const u8) GLuint {
     var dir = cwd().openDir(data_dir ++ "textures", .{}) catch unreachable;
     defer dir.close();
     // Don't judge me, take care of me!
@@ -169,18 +169,9 @@ fn loadTexture(filename: [*:0]const u8) callconv(.C) GLuint {
 }
 
 /// Move sound source to given position and play it.
-fn playSound(source: u32, x: f32, y: f32, z: f32) callconv(.C) void {
+export fn playSound(source: u32, x: f32, y: f32, z: f32) void {
     const src = al.Source{ .reference = source };
     _ = alGetError(); // TODO: remove when completely migrate to zeal
     src.setPosition(.{ x / 32, y / 32, z / 32 }) catch unreachable;
     src.play() catch unreachable;
 }
-
-comptime {
-    // Work around lazy compilation.
-    @export(loadJoints, .{ .name = "loadJoints" });
-    @export(loadMuscles, .{ .name = "loadMuscles" });
-    @export(loadSound, .{ .name = "loadSound" });
-    @export(loadTexture, .{ .name = "loadTexture" });
-    @export(playSound, .{ .name = "playSound" });
-}