Fixed a long standing bug I didn't realize where I did -1 on the map in the raycaster which made the textures not actually work.
This commit is contained in:
parent
90c37fe4c9
commit
e361984c40
1 changed files with 2 additions and 2 deletions
|
@ -37,7 +37,7 @@ union ColorConv {
|
||||||
//
|
//
|
||||||
inline uint32_t new_new_lighting(uint32_t pixel, float dist, int level) {
|
inline uint32_t new_new_lighting(uint32_t pixel, float dist, int level) {
|
||||||
ColorConv conv{.as_int=pixel};
|
ColorConv conv{.as_int=pixel};
|
||||||
float intensity = (float(level) * PERCENT) / (dist+1) * 2.5;
|
float intensity = (float(level) * PERCENT) / (dist + 1) * 2.5;
|
||||||
|
|
||||||
conv.as_color.r *= intensity;
|
conv.as_color.r *= intensity;
|
||||||
conv.as_color.g *= intensity;
|
conv.as_color.g *= intensity;
|
||||||
|
@ -304,7 +304,7 @@ void Raycaster::cast_rays() {
|
||||||
int draw_end = line_height / 2 + $height / 2 + $pitch;
|
int draw_end = line_height / 2 + $height / 2 + $pitch;
|
||||||
if(draw_end >= $height) draw_end = $height - 1;
|
if(draw_end >= $height) draw_end = $height - 1;
|
||||||
|
|
||||||
auto texture = textures::get_surface($map[map_y][map_x] - 1);
|
auto texture = textures::get_surface($map[map_y][map_x]);
|
||||||
|
|
||||||
// calculate value of wall_x
|
// calculate value of wall_x
|
||||||
double wall_x; // where exactly the wall was hit
|
double wall_x; // where exactly the wall was hit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue