m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-28 21:22:13 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-28 21:22:13 +0200
commita50d9c569d4157aa96fb9a80cf3205dbd80babbc (patch)
treef0b44dadd8bb3577ce25ac690c0cbc68edf356d0
parente63a01249d9ce867e7c91abf8c51e5c29ec81f0a (diff)
Handle coordinates in opposite order
-rw-r--r--harddoomdev.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/harddoomdev.c b/harddoomdev.c
index 30c37fe..fc1f0e4 100644
--- a/harddoomdev.c
+++ b/harddoomdev.c
@@ -232,11 +232,16 @@ void draw_column(struct surface_data *surface_data,
struct colors_data *colors_data, struct colors_data *trans_data,
uint8_t flags, uint8_t trans_idx)
{
+ uint16_t y1, y2;
+
+ y1 = min(column.y1, column.y2);
+ y2 = max(column.y1, column.y2);
+
set_surf_dst_pt(surface_data->doom_data, surface_data->page_table_dev);
set_surf_dims(surface_data->doom_data, surface_data->width, surface_data->height);
set_draw_params(surface_data->doom_data, flags);
- set_xy_a(surface_data->doom_data, column.x, column.y1);
- set_xy_b(surface_data->doom_data, column.x, column.y2);
+ set_xy_a(surface_data->doom_data, column.x, y1);
+ set_xy_b(surface_data->doom_data, column.x, y2);
if (!(flags & HARDDOOM_DRAW_PARAMS_FUZZ)) {
set_texture_pt(surface_data->doom_data,
@@ -265,12 +270,17 @@ void draw_column(struct surface_data *surface_data,
void draw_span(struct surface_data *surface_data, struct flat_data *flat_data,
struct doomdev_span span)
{
+ uint16_t x1, x2;
+
+ x1 = min(span.x1, span.x2);
+ x2 = max(span.x1, span.x2);
+
set_surf_dst_pt(surface_data->doom_data, surface_data->page_table_dev);
set_surf_dims(surface_data->doom_data, surface_data->width,
surface_data->height);
set_flat(surface_data->doom_data, flat_data->flat_dev);
- set_xy_a(surface_data->doom_data, span.x1, span.y);
- set_xy_b(surface_data->doom_data, span.x2, span.y);
+ set_xy_a(surface_data->doom_data, x1, span.y);
+ set_xy_b(surface_data->doom_data, x2, span.y);
set_ustart(surface_data->doom_data, span.ustart);
set_ustep(surface_data->doom_data, span.ustep);
set_vstart(surface_data->doom_data, span.vstart);