mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'fof-cleanup' into udmf-fofs-mkii
# Conflicts: # src/p_spec.c
This commit is contained in:
commit
1ae797359e
3 changed files with 59 additions and 86 deletions
|
@ -1980,8 +1980,7 @@ static void SaveLaserThinker(const thinker_t *th, const UINT8 type)
|
|||
{
|
||||
const laserthink_t *ht = (const void *)th;
|
||||
WRITEUINT8(save_p, type);
|
||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||
WRITEUINT32(save_p, SaveSector(ht->sec));
|
||||
WRITEINT16(save_p, ht->tag);
|
||||
WRITEUINT32(save_p, SaveLine(ht->sourceline));
|
||||
WRITEUINT8(save_p, ht->nobosses);
|
||||
}
|
||||
|
@ -3095,16 +3094,10 @@ static thinker_t* LoadPusherThinker(actionf_p1 thinker)
|
|||
static inline thinker_t* LoadLaserThinker(actionf_p1 thinker)
|
||||
{
|
||||
laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||
ffloor_t *rover = NULL;
|
||||
ht->thinker.function.acp1 = thinker;
|
||||
ht->sector = LoadSector(READUINT32(save_p));
|
||||
ht->sec = LoadSector(READUINT32(save_p));
|
||||
ht->tag = READINT16(save_p);
|
||||
ht->sourceline = LoadLine(READUINT32(save_p));
|
||||
ht->nobosses = READUINT8(save_p);
|
||||
for (rover = ht->sector->ffloors; rover; rover = rover->next)
|
||||
if (rover->secnum == (size_t)(ht->sec - sectors)
|
||||
&& rover->master == ht->sourceline)
|
||||
ht->ffloor = rover;
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
|
|
130
src/p_spec.c
130
src/p_spec.c
|
@ -6146,92 +6146,83 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
|
|||
elevator->distance = FixedInt(AngleFixed(angle));
|
||||
}
|
||||
|
||||
static const ffloortype_e laserflags = FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT;
|
||||
|
||||
/** Flashes a laser block.
|
||||
*
|
||||
* \param flash Thinker structure for this laser.
|
||||
* \sa EV_AddLaserThinker
|
||||
* \sa P_AddLaserThinker
|
||||
* \author SSNTails <http://www.ssntails.org>
|
||||
*/
|
||||
void T_LaserFlash(laserthink_t *flash)
|
||||
{
|
||||
msecnode_t *node;
|
||||
mobj_t *thing;
|
||||
sector_t *sourcesec;
|
||||
ffloor_t *fflr = flash->ffloor;
|
||||
sector_t *sector = flash->sector;
|
||||
INT32 s;
|
||||
ffloor_t *fflr;
|
||||
sector_t *sector;
|
||||
sector_t *sourcesec = flash->sourceline->frontsector;
|
||||
fixed_t top, bottom;
|
||||
|
||||
if (!fflr || !(fflr->flags & FF_EXISTS))
|
||||
return;
|
||||
|
||||
if (leveltime & 2)
|
||||
//fflr->flags |= FF_RENDERALL;
|
||||
fflr->alpha = 0xB0;
|
||||
else
|
||||
//fflr->flags &= ~FF_RENDERALL;
|
||||
fflr->alpha = 0x90;
|
||||
|
||||
sourcesec = fflr->master->frontsector; // Less to type!
|
||||
|
||||
top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y)
|
||||
: *fflr->topheight;
|
||||
bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y)
|
||||
: *fflr->bottomheight;
|
||||
sector->soundorg.z = (top + bottom)/2;
|
||||
S_StartSound(§or->soundorg, sfx_laser);
|
||||
|
||||
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
|
||||
for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_thinglist_next)
|
||||
for (s = -1; (s = P_FindSectorFromTag(flash->tag, s)) >= 0 ;)
|
||||
{
|
||||
thing = node->m_thing;
|
||||
sector = §ors[s];
|
||||
for (fflr = sector->ffloors; fflr; fflr = fflr->next)
|
||||
{
|
||||
if (fflr->master != flash->sourceline)
|
||||
continue;
|
||||
|
||||
if (flash->nobosses && thing->flags & MF_BOSS)
|
||||
continue; // Don't hurt bosses
|
||||
if (!(fflr->flags & FF_EXISTS))
|
||||
break;
|
||||
|
||||
// Don't endlessly kill egg guard shields (or anything else for that matter)
|
||||
if (thing->health <= 0)
|
||||
continue;
|
||||
if (leveltime & 2)
|
||||
//fflr->flags |= FF_RENDERALL;
|
||||
fflr->alpha = 0xB0;
|
||||
else
|
||||
//fflr->flags &= ~FF_RENDERALL;
|
||||
fflr->alpha = 0x90;
|
||||
|
||||
top = P_GetSpecialTopZ(thing, sourcesec, sector);
|
||||
bottom = P_GetSpecialBottomZ(thing, sourcesec, sector);
|
||||
top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y) : *fflr->topheight;
|
||||
bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y) : *fflr->bottomheight;
|
||||
sector->soundorg.z = (top + bottom)/2;
|
||||
S_StartSound(§or->soundorg, sfx_laser);
|
||||
|
||||
if (thing->z >= top
|
||||
|| thing->z + thing->height <= bottom)
|
||||
continue;
|
||||
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
|
||||
for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_thinglist_next)
|
||||
{
|
||||
thing = node->m_thing;
|
||||
|
||||
if (thing->flags & MF_SHOOTABLE)
|
||||
P_DamageMobj(thing, NULL, NULL, 1, 0);
|
||||
else if (thing->type == MT_EGGSHIELD)
|
||||
P_KillMobj(thing, NULL, NULL, 0);
|
||||
if (flash->nobosses && thing->flags & MF_BOSS)
|
||||
continue; // Don't hurt bosses
|
||||
|
||||
// Don't endlessly kill egg guard shields (or anything else for that matter)
|
||||
if (thing->health <= 0)
|
||||
continue;
|
||||
|
||||
top = P_GetSpecialTopZ(thing, sourcesec, sector);
|
||||
bottom = P_GetSpecialBottomZ(thing, sourcesec, sector);
|
||||
|
||||
if (thing->z >= top
|
||||
|| thing->z + thing->height <= bottom)
|
||||
continue;
|
||||
|
||||
if (thing->flags & MF_SHOOTABLE)
|
||||
P_DamageMobj(thing, NULL, NULL, 1, 0);
|
||||
else if (thing->type == MT_EGGSHIELD)
|
||||
P_KillMobj(thing, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds a laser thinker to a 3Dfloor.
|
||||
*
|
||||
* \param fflr 3Dfloor to turn into a laser block.
|
||||
* \param sector Target sector.
|
||||
* \param secthkiners Lists of thinkers sorted by sector. May be NULL.
|
||||
* \sa T_LaserFlash
|
||||
* \author SSNTails <http://www.ssntails.org>
|
||||
*/
|
||||
static inline void EV_AddLaserThinker(sector_t *sec, sector_t *sec2, line_t *line, thinkerlist_t *secthinkers, boolean nobosses)
|
||||
static inline void P_AddLaserThinker(INT16 tag, line_t *line, boolean nobosses)
|
||||
{
|
||||
laserthink_t *flash;
|
||||
ffloor_t *fflr = P_AddFakeFloor(sec, sec2, line, laserflags, secthinkers);
|
||||
|
||||
if (!fflr)
|
||||
return;
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
laserthink_t *flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LaserFlash;
|
||||
flash->ffloor = fflr;
|
||||
flash->sector = sec; // For finding mobjs
|
||||
flash->sec = sec2;
|
||||
flash->tag = tag;
|
||||
flash->sourceline = line;
|
||||
flash->nobosses = nobosses;
|
||||
}
|
||||
|
@ -6901,14 +6892,8 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
case 251: // A THWOMP!
|
||||
{
|
||||
UINT16 sound = (lines[i].stringargs[0]) ? get_number(lines[i].stringargs[0]) : sfx_thwomp;
|
||||
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
|
||||
{
|
||||
P_AddThwompThinker(§ors[sec], lines[i].args[0], &lines[i], lines[i].args[1] << FRACBITS, lines[i].args[2] << FRACBITS, sound);
|
||||
P_AddFakeFloor(§ors[s], §ors[sec], lines + i,
|
||||
FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers);
|
||||
}
|
||||
P_AddThwompThinker(lines[i].frontsector, lines[i].args[0], &lines[i], lines[i].args[1] << FRACBITS, lines[i].args[2] << FRACBITS, sound);
|
||||
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6952,11 +6937,8 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
break;
|
||||
|
||||
case 258: // Laser block
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
|
||||
// No longer totally disrupts netgames
|
||||
for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
|
||||
EV_AddLaserThinker(§ors[s], §ors[sec], lines + i, secthinkers, !!(lines[i].args[1]));
|
||||
P_AddLaserThinker(lines[i].args[0], lines + i, !!(lines[i].args[1]));
|
||||
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT, secthinkers);
|
||||
break;
|
||||
|
||||
case 259: // Custom FOF
|
||||
|
|
|
@ -180,9 +180,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
thinker_t thinker; ///< Thinker structure for laser.
|
||||
ffloor_t *ffloor; ///< 3Dfloor that is a laser.
|
||||
sector_t *sector; ///< Sector in which the effect takes place.
|
||||
sector_t *sec;
|
||||
INT16 tag;
|
||||
line_t *sourceline;
|
||||
UINT8 nobosses;
|
||||
} laserthink_t;
|
||||
|
|
Loading…
Reference in a new issue