mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add water particles
This commit is contained in:
parent
6106ce1624
commit
0e96aeec84
4 changed files with 50 additions and 9 deletions
|
|
@ -6744,6 +6744,7 @@ struct int_const_s const INT_CONST[] = {
|
|||
// precipeffect_t
|
||||
{"PRECIPFX_THUNDER",PRECIPFX_THUNDER},
|
||||
{"PRECIPFX_LIGHTNING",PRECIPFX_LIGHTNING},
|
||||
{"PRECIPFX_WATERPARTICLES",PRECIPFX_WATERPARTICLES},
|
||||
|
||||
{NULL,0}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
PRECIPFX_THUNDER = 1,
|
||||
PRECIPFX_LIGHTNING = 1<<1
|
||||
PRECIPFX_LIGHTNING = 1<<1,
|
||||
PRECIPFX_WATERPARTICLES = 1<<2
|
||||
} precipeffect_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
|||
43
src/p_mobj.c
43
src/p_mobj.c
|
|
@ -3764,13 +3764,16 @@ void P_CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
{
|
||||
// recalculate floorz each time
|
||||
const sector_t *mobjsecsubsec;
|
||||
boolean setWater = false;
|
||||
|
||||
if (mobj && mobj->subsector && mobj->subsector->sector)
|
||||
mobjsecsubsec = mobj->subsector->sector;
|
||||
else
|
||||
return;
|
||||
|
||||
mobj->precipflags &= ~PCF_INVISIBLE;
|
||||
mobj->floorz = P_GetSectorFloorZAt(mobjsecsubsec, mobj->x, mobj->y);
|
||||
mobj->ceilingz = P_GetSectorFloorZAt(mobjsecsubsec, mobj->x, mobj->y);
|
||||
|
||||
if (mobjsecsubsec->ffloors)
|
||||
{
|
||||
|
|
@ -3783,14 +3786,44 @@ void P_CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
|
||||
continue;
|
||||
if (precipprops[curWeather].effects & PRECIPFX_WATERPARTICLES)
|
||||
{
|
||||
if (!(rover->flags & FF_SWIMMABLE))
|
||||
continue;
|
||||
|
||||
height = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);
|
||||
if (height > mobj->floorz)
|
||||
mobj->floorz = height;
|
||||
if (setWater == false)
|
||||
{
|
||||
mobj->ceilingz = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);
|
||||
mobj->floorz = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
|
||||
setWater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
height = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);
|
||||
if (height > mobj->ceilingz)
|
||||
mobj->ceilingz = height;
|
||||
|
||||
height = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
|
||||
if (height < mobj->floorz)
|
||||
mobj->floorz = height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
|
||||
continue;
|
||||
|
||||
height = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);
|
||||
if (height > mobj->floorz)
|
||||
mobj->floorz = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((precipprops[curWeather].effects & PRECIPFX_WATERPARTICLES) && setWater == false)
|
||||
{
|
||||
mobj->precipflags |= PCF_INVISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
void P_RecalcPrecipInSector(sector_t *sector)
|
||||
|
|
|
|||
12
src/p_spec.c
12
src/p_spec.c
|
|
@ -1773,6 +1773,7 @@ void P_SwitchWeather(preciptype_t newWeather)
|
|||
{
|
||||
boolean purge = false;
|
||||
mobjtype_t swap = MT_NULL;
|
||||
INT32 oldEffects = precipprops[curWeather].effects;
|
||||
|
||||
if (newWeather >= precip_freeslot)
|
||||
{
|
||||
|
|
@ -1797,6 +1798,8 @@ void P_SwitchWeather(preciptype_t newWeather)
|
|||
}
|
||||
}
|
||||
|
||||
curWeather = newWeather;
|
||||
|
||||
if (purge == true)
|
||||
{
|
||||
thinker_t *think;
|
||||
|
|
@ -1858,12 +1861,15 @@ void P_SwitchWeather(preciptype_t newWeather)
|
|||
{
|
||||
precipmobj->precipflags |= PCF_FLIP;
|
||||
}
|
||||
|
||||
if ((oldEffects & PRECIPFX_WATERPARTICLES) != (precipprops[curWeather].effects & PRECIPFX_WATERPARTICLES))
|
||||
{
|
||||
P_CalculatePrecipFloor(precipmobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curWeather = newWeather;
|
||||
|
||||
if (swap == MT_NULL && precipprops[newWeather].type != MT_NULL)
|
||||
if (swap == MT_NULL && precipprops[curWeather].type != MT_NULL)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue