From de255063b234871021da004d32964e25d549d3e4 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Wed, 1 Sep 2021 15:48:09 -0400 Subject: Scale the projection plane to the screen correctly Also bumped up the textures to 32x32 --- src/raycast.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/raycast.zig') 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; } -- cgit v1.3.1