From dd424fac70ce3db57bb3b39bc189d631736efbe0 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 17 Nov 2012 19:46:33 +0000 Subject: [PATCH] Mapster32: fix cycling picnum in 3D mode. Using non-keypad [-]/[+] or LMB + mousewheel, it was broken when a void tile was in between. git-svn-id: https://svn.eduke32.com/eduke32@3203 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index eae75f467..f1b963a45 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5650,14 +5650,16 @@ static void Keys3d(void) { if (ASSERT_AIMING) { - j = i = (keystatus[KEYSC_EQUAL] || (bstatus&16)) ? 1 : -1; + int32_t pic = AIMED_SELOVR_PICNUM; + int32_t dir = (keystatus[KEYSC_EQUAL] || (bstatus&16)) ? 1 : -1; - while (!tilesizx[AIMED_SELOVR_PICNUM] || !tilesizy[AIMED_SELOVR_PICNUM] || j) + do { - i += AIMED_SELOVR_PICNUM + MAXTILES; - AIMED_SELOVR_PICNUM = i % MAXTILES; - j = 0; + pic += dir + MAXTILES; + pic %= MAXTILES; } + while (tilesizx[pic]<=0 || tilesizy[pic]<=0); + AIMED_SELOVR_PICNUM = pic; if (AIMING_AT_SPRITE) correct_sprite_yoffset(searchwall);