Adapt heat wave effect to UDMF

This commit is contained in:
MascaraSnake 2021-12-30 14:48:40 +01:00
parent b74d06b4e7
commit f30b97ba93
8 changed files with 40 additions and 46 deletions

View file

@ -79,6 +79,7 @@ sectorflags
triggerspecial_touch = "Trigger on Edge Touch";
triggerspecial_headbump = "Trigger on Headbump";
invertprecip = "Invert Precipitation";
heatwave = "Heat Wave";
}
thingflags

View file

@ -340,7 +340,7 @@ static inline int lib_getenum(lua_State *L)
}
else if (fastncmp("MSF_", word, 3)) {
p = word + 4;
for (i = 0; i < 4; i++)
for (i = 0; i < 5; i++)
if (MSF_LIST[i] && fastcmp(p, MSF_LIST[i])) {
lua_pushinteger(L, ((lua_Integer)1 << i));
return 1;

View file

@ -4472,11 +4472,12 @@ const char *const ML_LIST[16] = {
};
// Sector flags
const char *const MSF_LIST[4] = {
const char *const MSF_LIST[5] = {
"FLIPSPECIAL_FLOOR",
"FLIPSPECIAL_CEILING",
"TRIGGERSPECIAL_TOUCH",
"TRIGGERSPECIAL_HEADBUMP",
"HEATWAVE",
};
const char *COLOR_ENUMS[] = {

View file

@ -65,7 +65,7 @@ extern const char *const MAPTHINGFLAG_LIST[4];
extern const char *const PLAYERFLAG_LIST[];
extern const char *const GAMETYPERULE_LIST[];
extern const char *const ML_LIST[16]; // Linedef flags
extern const char* const MSF_LIST[4]; // Sector flags
extern const char* const MSF_LIST[5]; // Sector flags
extern const char *COLOR_ENUMS[];
extern const char *const POWERS_LIST[];
extern const char *const HUDITEMS_LIST[];

View file

@ -3551,19 +3551,16 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
{
sector_t *sector;
fixed_t halfheight = thiscam->z + (thiscam->height >> 1);
size_t i;
// see if we are in water
sector = thiscam->subsector->sector;
for (i = 0; i < sector->tags.count; i++)
if (Tag_FindLineSpecial(13, sector->tags.tags[i]) != -1)
return true;
if (sector->flags & MSF_HEATWAVE)
return true;
if (sector->ffloors)
{
ffloor_t *rover;
size_t j;
for (rover = sector->ffloors; rover; rover = rover->next)
{
@ -3575,8 +3572,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y))
continue;
for (j = 0; j < rover->master->frontsector->tags.count; j++)
if (Tag_FindLineSpecial(13, rover->master->frontsector->tags.tags[j]) != -1)
if (rover->master->frontsector->flags & MSF_HEATWAVE)
return true;
}
}

View file

@ -1672,6 +1672,8 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val)
sectors[i].flags |= MSF_TRIGGERSPECIAL_HEADBUMP;
else if (fastcmp(param, "invertprecip") && fastcmp("true", val))
sectors[i].flags |= MSF_INVERTPRECIP;
else if (fastcmp(param, "heatwave") && fastcmp("true", val))
sectors[i].flags |= MSF_HEATWAVE;
}
static void ParseTextmapSidedefParameter(UINT32 i, char *param, char *val)
@ -3282,6 +3284,15 @@ static void P_ConvertBinaryMap(void)
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;
lines[i].args[2] = !!(lines[i].flags & ML_EFFECT1);
break;
case 13: //Heat wave effect
{
INT32 s;
TAG_ITER_SECTORS(tag, s)
sectors[s].flags |= MSF_HEATWAVE;
break;
}
case 14: //Bustable block parameters
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS;

View file

@ -10466,7 +10466,6 @@ static void P_CalcPostImg(player_t *player)
postimg_t *type;
INT32 *param;
fixed_t pviewheight;
size_t i;
if (player->mo->eflags & MFE_VERTICALFLIP)
pviewheight = player->mo->z + player->mo->height - player->viewheight;
@ -10491,45 +10490,30 @@ static void P_CalcPostImg(player_t *player)
}
// see if we are in heat (no, not THAT kind of heat...)
for (i = 0; i < sector->tags.count; i++)
if (sector->flags & MSF_HEATWAVE)
*type = postimg_heat;
else if (sector->ffloors)
{
if (Tag_FindLineSpecial(13, sector->tags.tags[i]) != -1)
{
*type = postimg_heat;
break;
}
else if (sector->ffloors)
{
ffloor_t *rover;
fixed_t topheight;
fixed_t bottomheight;
boolean gotres = false;
ffloor_t *rover;
fixed_t topheight;
fixed_t bottomheight;
for (rover = sector->ffloors; rover; rover = rover->next)
for (rover = sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
if (rover->master->frontsector->flags & MSF_HEATWAVE)
{
size_t j;
if (!(rover->flags & FF_EXISTS))
continue;
topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y);
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
for (j = 0; j < rover->master->frontsector->tags.count; j++)
{
if (Tag_FindLineSpecial(13, rover->master->frontsector->tags.tags[j]) != -1)
{
*type = postimg_heat;
gotres = true;
break;
}
}
}
if (gotres)
*type = postimg_heat;
break;
}
}
}

View file

@ -284,6 +284,7 @@ typedef enum
MSF_TRIGGERSPECIAL_HEADBUMP = 1<<3,
// invertprecip - inverts presence of precipitation
MSF_INVERTPRECIP = 1<<4,
MSF_HEATWAVE = 1<<5, // heat wave effect
} sectorflags_t;