editor: tweak RShift so that unnecessary gray walls aren't selected; fix ugly bug with TROR joining

game: when entering/leaving water or slime, delay changing palette by one game tic to make it look right


git-svn-id: https://svn.eduke32.com/eduke32@1899 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-05-29 12:30:38 +00:00
parent 61117d4e7b
commit 95a33b72bd
5 changed files with 66 additions and 13 deletions

View file

@ -103,6 +103,9 @@ extern int32_t m32_osd_tryscript;
extern int32_t showheightindicators;
extern int32_t showambiencesounds;
extern int32_t dragpoint_noreset;
extern int32_t numgraysects;
extern uint8_t graysectbitmap[MAXSECTORS>>3];
extern uint8_t graywallbitmap[MAXWALLS>>3];

View file

@ -2210,6 +2210,7 @@ static int32_t backup_drawn_walls(int32_t restore)
return 0;
}
#if 0
#define GETWALCOORD(w) (*(int64_t *)&wall[*(const int32_t *)(w)].x)
static int32_t compare_wall_coords(const void *w1, const void *w2)
{
@ -2220,6 +2221,7 @@ static int32_t compare_wall_coords(const void *w1, const void *w2)
return -1;
}
#undef GETWALCOORD
#endif
#define RESET_EDITOR_VARS() do { \
sectorhighlightstat = -1; \
@ -3399,16 +3401,21 @@ end_yax: ;
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
}
for (i=0; i<numwalls; i++)
wall[i].cstat &= ~(1<<14);
for (i=0; i<numwalls; i++)
{
if (onlySprites)
break;
YAX_SKIPWALL(i);
if (!m32_sideview)
{
tx = wall[i].x;
ty = wall[i].y;
wall[i].cstat &= ~(1<<14);
// wall[i].cstat &= ~(1<<14);
}
else
{
@ -3423,12 +3430,28 @@ end_yax: ;
ty >= highlighty1 && ty <= highlighty2)
{
if (!sub)
show2dwall[i>>3] |= (1<<(i&7));
{
if (numgraysects > 0 || m32_sideview)
{
dragpoint(i, wall[i].x, wall[i].y);
dragpoint_noreset = 1; // vvv
}
else
show2dwall[i>>3] |= (1<<(i&7));
}
else
show2dwall[i>>3] &= ~(1<<(i&7));
}
}
dragpoint_noreset = 0; // ^^^
if (!sub && (numgraysects > 0 || m32_sideview))
{
for (i=0; i<numwalls; i++)
if (wall[i].cstat&(1<<14))
show2dwall[i>>3] |= (1<<(i&7));
}
#if 0
if (m32_sideview && numwalls>0 && !onlySprites)
{
int64_t curcoord;
@ -3472,12 +3495,15 @@ end_yax: ;
}
}
}
#endif
for (i=0; i<MAXSPRITES; i++)
{
if (sprite[i].statnum == MAXSTATUS)
continue;
if ((unsigned)sprite[i].sectnum < MAXSECTORS)
YAX_SKIPSECTOR(sprite[i].sectnum);
if (!m32_sideview)
{
tx = sprite[i].x;
@ -4059,6 +4085,9 @@ try_dragging_sectors:
}
dragpoint(pointhighlight,dax,day);
if ((unsigned)linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
}
else if ((pointhighlight&0xc000) == 16384)
{
@ -4447,7 +4476,7 @@ end_point_dragging:
if (needsdisp)
{
// a component can be displaced if it's not extended on the non-joining side
movestat = (compstat[0][!joinstat]^1) | ((compstat[1][joinstat]^1)<<1);
movestat = (!(compstat[0][!joinstat]&1)) | ((!(compstat[1][joinstat]&1))<<1);
if (!movestat)
{
message("Internal error while TROR-joining: movestat inconsistent!");

View file

@ -188,6 +188,7 @@ int16_t editstatus = 0;
////////// YAX //////////
int32_t numgraysects = 0;
uint8_t graysectbitmap[MAXSECTORS>>3];
uint8_t graywallbitmap[MAXWALLS>>3];
int32_t autogray = 0;
@ -239,11 +240,15 @@ void yax_updategrays(int32_t posze)
}
#endif
numgraysects = 0;
for (i=0; i<numsectors; i++)
{
if (graysectbitmap[i>>3]&(1<<(i&7)))
{
numgraysects++;
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
graywallbitmap[j>>3] |= (1<<(j&7));
}
}
}
@ -10968,6 +10973,7 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang
//
// dragpoint
//
int32_t dragpoint_noreset = 0;
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
#ifdef YAX_ENABLE
{
@ -10977,7 +10983,8 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
uint8_t *walbitmap = (uint8_t *)tempbuf;
Bmemset(walbitmap, 0, (numwalls+7)>>3);
if (!dragpoint_noreset)
Bmemset(walbitmap, 0, (numwalls+7)>>3);
yaxwalls[numyaxwalls++] = pointhighlight;
for (i=0; i<numyaxwalls; i++)
@ -11029,9 +11036,6 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
for (w=0; w<numwalls; w++)
if (walbitmap[w>>3] & (1<<(w&7)))
wall[w].cstat |= (1<<14);
if (linehighlight >= 0 && linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
}
}
#else
@ -14524,13 +14528,16 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
faketimerhandler();
if (zoome >= 256 || editstatus == 0)
if (zoome >= 256 || highlightcnt>0 /*|| editstatus == 0*/)
for (j=0; j<MAXSPRITES; j++)
if (sprite[j].statnum<MAXSTATUS && (editstatus == 1 || (show2dsprite[j>>3]&pow2char[j&7])))
if (sprite[j].statnum<MAXSTATUS /*&& (editstatus == 1 || (show2dsprite[j>>3]&pow2char[j&7]))*/)
{
if (!m32_sideview && sprite[j].sectnum >= 0)
YAX_SKIPSECTOR(sprite[j].sectnum);
if (zoome<256 && (show2dsprite[j>>3]&pow2char[j&7])==0)
continue;
if (!m32_sideview)
drawscreen_drawsprite(j,posxe,posye,posze,zoome);
else

View file

@ -2598,8 +2598,18 @@ void G_DisplayRest(int32_t smoothratio)
// reset a normal palette
else if (g_restorePalette)
{
P_SetGamePalette(pp,pp->palette,2);
g_restorePalette = 0;
static uint32_t omovethingscnt;
if (g_restorePalette < 2 || omovethingscnt+1 == g_moveThingsCount)
{
P_SetGamePalette(pp,pp->palette,2);
g_restorePalette = 0;
}
else
{
// delay setting the palette by one game tic
omovethingscnt = g_moveThingsCount;
}
}
// loogies courtesy of being snotted on
else if (pp->loogcnt > 0)

View file

@ -42,18 +42,22 @@ int32_t g_numSelfObituaries = 0;
void P_UpdateScreenPal(DukePlayer_t *p)
{
int32_t intowater = 0;
if (p->heat_on) p->palette = SLIMEPAL;
else if (p->cursectnum < 0) p->palette = BASEPAL;
else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2))
{
p->palette = SLIMEPAL;
intowater = 1;
}
else
{
if (sector[p->cursectnum].lotag == 2) p->palette = WATERPAL;
else p->palette = BASEPAL;
intowater = 1;
}
g_restorePalette = 1;
g_restorePalette = 1+intowater;
}
static void P_IncurDamage(DukePlayer_t *p)