Mapster32: don't show wall length of *line* highlight when dragging points.

Also, factor out 2x dup'd code of insertsprite() into do_insertsprite()
and add searchwall-displaying code into package/samples/a.m32.

git-svn-id: https://svn.eduke32.com/eduke32@3395 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-16 20:38:46 +00:00
parent 8fb886b14a
commit ac31e386ff
2 changed files with 32 additions and 44 deletions

View file

@ -5460,8 +5460,6 @@ end_after_dragging:
} }
dragpoint(pointhighlight,dax,day,2); dragpoint(pointhighlight,dax,day,2);
if ((unsigned)linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14); wall[lastwall(pointhighlight)].cstat |= (1<<14);
} }
else if ((pointhighlight&0xc000) == 16384) else if ((pointhighlight&0xc000) == 16384)
@ -8380,61 +8378,47 @@ static void flipwalls(int16_t numwalls, int16_t newnumwalls)
} }
} }
// returns number of points inserted (1; or 2 if wall had a nextwall) static void do_insertpoint(int32_t w, int32_t dax, int32_t day, int32_t *mapwallnum)
// *mapwallnum contains the new wallnum of the former (pre-insertpoint) *mapwallnum
// (the new one can only be >= than the old one; ptr may be NULL if we don't care)
static int32_t insertpoint(int16_t linehighlight, int32_t dax, int32_t day, int32_t *mapwallnum)
{ {
int16_t sucksect; int32_t i;
int32_t i, j, k; const int32_t sucksect = sectorofwall(w);
uint32_t templenrepquot; const uint32_t lenbyrep = getlenbyrep(wallength(w), wall[w].xrepeat);
j = linehighlight;
sucksect = sectorofwall(j);
templenrepquot = getlenbyrep(wallength(j), wall[j].xrepeat);
sector[sucksect].wallnum++; sector[sucksect].wallnum++;
for (i=sucksect+1; i<numsectors; i++) for (i=sucksect+1; i<numsectors; i++)
sector[i].wallptr++; sector[i].wallptr++;
if (mapwallnum && *mapwallnum >= j+1) if (mapwallnum && *mapwallnum >= w+1)
(*mapwallnum)++; (*mapwallnum)++;
movewalls(j+1, +1);
Bmemcpy(&wall[j+1], &wall[j], sizeof(walltype)); movewalls(w+1, +1);
Bmemcpy(&wall[w+1], &wall[w], sizeof(walltype));
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
wall[j+1].cstat &= ~(1<<14); wall[w+1].cstat &= ~(1<<14);
#endif #endif
wall[j].point2 = j+1; wall[w].point2 = w+1;
wall[j+1].x = dax; wall[w+1].x = dax;
wall[j+1].y = day; wall[w+1].y = day;
fixxrepeat(j, templenrepquot);
AlignWallPoint2(j); fixxrepeat(w, lenbyrep);
fixxrepeat(j+1, templenrepquot); AlignWallPoint2(w);
fixxrepeat(w+1, lenbyrep);
}
// Returns number of points inserted (1; or 2 if wall had a nextwall).
// *mapwallnum is set to the new wallnum of the former (pre-insertpoint) *mapwallnum
// (the new one can only be >= than the old one; ptr may be NULL if we don't care)
static int32_t insertpoint(int16_t linehighlight, int32_t dax, int32_t day, int32_t *mapwallnum)
{
int32_t j = linehighlight;
do_insertpoint(j, dax, day, mapwallnum);
if (wall[j].nextwall >= 0) if (wall[j].nextwall >= 0)
{ {
k = wall[j].nextwall; int32_t k = wall[j].nextwall;
templenrepquot = getlenbyrep(wallength(k), wall[k].xrepeat);
sucksect = sectorofwall(k); do_insertpoint(k, dax, day, mapwallnum);
sector[sucksect].wallnum++;
for (i=sucksect+1; i<numsectors; i++)
sector[i].wallptr++;
if (mapwallnum && *mapwallnum >= k+1)
(*mapwallnum)++;
movewalls(k+1, +1);
Bmemcpy(&wall[k+1], &wall[k], sizeof(walltype));
#ifdef YAX_ENABLE
wall[k+1].cstat &= ~(1<<14);
#endif
wall[k].point2 = k+1;
wall[k+1].x = dax;
wall[k+1].y = day;
fixxrepeat(k, templenrepquot);
AlignWallPoint2(k);
fixxrepeat(k+1, templenrepquot);
j = wall[k].nextwall; j = wall[k].nextwall;
wall[j].nextwall = k+1; wall[j].nextwall = k+1;

View file

@ -1404,6 +1404,10 @@ gamevar scrshot 0 1
onevent EVENT_DRAW3DSCREEN onevent EVENT_DRAW3DSCREEN
ifge searchwall 0, ifl searchwall MAXWALLS ifge searchwall 0, ifl searchwall MAXWALLS
{ {
// Which wall is considered targeted?
qsprintf TQUOTE "searchwall = %d" searchwall
printext256 TQUOTE 30 30 -15 0 0
qsprintf TQUOTE "y panning = %d" wall[searchwall].ypanning qsprintf TQUOTE "y panning = %d" wall[searchwall].ypanning
printext256 TQUOTE 30 30 -15 0 0 printext256 TQUOTE 30 30 -15 0 0
} }