Commit e27a7b62 authored by Jordon Moss's avatar Jordon Moss
Browse files

Add wall cstat mask parameter to cansee, and add optional param at the end of CON_CANSEE for it.

parent 54177821
......@@ -1354,7 +1354,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange
int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8)));
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
int32_t x2, int32_t y2, int32_t z2, int16_t sect2, int32_t wallmask = CSTAT_WALL_1WAY);
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
void calc_sector_reachability(void);
int sectorsareconnected(int const, int const);
......
......@@ -12184,7 +12184,7 @@ int32_t cansee_19950829(int32_t xs, int32_t ys, int32_t zs, int16_t sectnums, in
return 0;
}
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2)
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2, int32_t wallmask)
{
MICROPROFILE_SCOPEI("Engine", EDUKE32_FUNCTION, MP_AUTO);
......@@ -12297,7 +12297,7 @@ restart_grand:
#ifdef YAX_ENABLE
if (bn[0]<0 && bn[1]<0)
#endif
if (nexts < 0 || wal->cstat&32)
if (nexts < 0 || wal->cstat & wallmask)
return 0;
t = divscale24(t,bot);
......@@ -12339,7 +12339,7 @@ restart_grand:
}
#ifdef YAX_ENABLE
if (nexts < 0 || (wal->cstat&32))
if (nexts < 0 || (wal->cstat & wallmask))
return 0;
#endif
getzsofslope(nexts, x,y, &cfz[0],&cfz[1]);
......
......@@ -4728,6 +4728,16 @@ ifvar:
C_GetManyVars(tw==CON_CANSEE?8:7);
C_GetManyVarsType(GAMEVAR_READONLY,tw==CON_CANSEE?1:6);
if (tw==CON_HITSCAN) C_GetNextVar();
if (tw == CON_CANSEE)
{
if (C_GetKeyword() == -1)
C_GetNextVar();
else
{
scriptWriteValue(GV_FLAG_CONSTANT);
scriptWriteValue(CSTAT_WALL_1WAY);
}
}
continue;
case CON_CANSEESPR:
......
......@@ -4762,11 +4762,14 @@ badindex:
int32_t secondSector;
} v;
Gv_FillWithVars(v);
int32_t returnvar = *insptr++;
int32_t wallmask = Gv_GetVar(*insptr++);
VM_ABORT_IF(((unsigned)v.firstSector >= (unsigned)numsectors) | ((unsigned)v.secondSector >= (unsigned)numsectors), "invalid sector %d",
(unsigned)v.firstSector >= (unsigned)numsectors ? v.firstSector : v.secondSector);
Gv_SetVar(*insptr++, cansee(v.vec1.x, v.vec1.y, v.vec1.z, v.firstSector, v.vec2.x, v.vec2.y, v.vec2.z, v.secondSector));
Gv_SetVar(returnvar, cansee(v.vec1.x, v.vec1.y, v.vec1.z, v.firstSector, v.vec2.x, v.vec2.y, v.vec2.z, v.secondSector, wallmask));
dispatch();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment