aboutsummaryrefslogtreecommitdiff
path: root/src/raycast.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/raycast.zig')
-rw-r--r--src/raycast.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/raycast.zig b/src/raycast.zig
index 6acc16b..608bb10 100644
--- a/src/raycast.zig
+++ b/src/raycast.zig
@@ -84,11 +84,15 @@ pub const Player = struct {
pub fn renderMapUsing(
self: Player,
window: RenderWindow,
- sprite: Sprite,
+ wallSprite: Sprite,
map: Map,
// the abstract the rendering call
renderWall: RenderWallFunction,
) void {
+ self.renderWalls(window, wallSprite, map, renderWall);
+ }
+
+ fn renderWalls(self: Player, window: RenderWindow, wallSprite: Sprite, map: Map, renderWall: RenderWallFunction) void {
const floor = std.math.floor;
var col: i32 = 0;
@@ -183,7 +187,7 @@ pub const Player = struct {
// textures, in this case clockwise
if ((horizontal_hit and sinra < 0) or (!horizontal_hit and cosra > 0)) texfrac = 1 - texfrac;
- renderWall(window, sprite, col, top, total_length, draw_frac, texfrac, cell.wall_texture);
+ renderWall(window, wallSprite, col, top, total_length, draw_frac, texfrac, cell.wall_texture);
highest_point = top;
}