mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'fof-cleanup' into 'next'
FOF cleanup See merge request STJr/SRB2!910
This commit is contained in:
commit
a7c7f7afa9
3 changed files with 59 additions and 86 deletions
|
@ -1888,8 +1888,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);
|
||||
}
|
||||
|
@ -2995,16 +2994,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;
|
||||
}
|
||||
|
||||
|
|
74
src/p_spec.c
74
src/p_spec.c
|
@ -6135,25 +6135,32 @@ 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;
|
||||
for (s = -1; (s = P_FindSectorFromTag(flash->tag, s)) >= 0 ;)
|
||||
{
|
||||
sector = §ors[s];
|
||||
for (fflr = sector->ffloors; fflr; fflr = fflr->next)
|
||||
{
|
||||
if (fflr->master != flash->sourceline)
|
||||
continue;
|
||||
|
||||
if (!(fflr->flags & FF_EXISTS))
|
||||
break;
|
||||
|
||||
if (leveltime & 2)
|
||||
//fflr->flags |= FF_RENDERALL;
|
||||
|
@ -6162,12 +6169,8 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
//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;
|
||||
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);
|
||||
|
||||
|
@ -6195,32 +6198,20 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
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;
|
||||
}
|
||||
|
@ -6987,14 +6978,8 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
fixed_t crushspeed = (lines[i].flags & ML_EFFECT5) ? lines[i].dy >> 3 : 10*FRACUNIT;
|
||||
fixed_t retractspeed = (lines[i].flags & ML_EFFECT5) ? lines[i].dx >> 3 : 2*FRACUNIT;
|
||||
UINT16 sound = (lines[i].flags & ML_EFFECT4) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : sfx_thwomp;
|
||||
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
for (s = -1; (s = P_FindSectorFromTag(lines[i].tag, s)) >= 0 ;)
|
||||
{
|
||||
P_AddThwompThinker(§ors[sec], lines[i].tag, &lines[i], crushspeed, retractspeed, 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].tag, &lines[i], crushspeed, retractspeed, sound);
|
||||
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7035,11 +7020,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].tag, s)) >= 0 ;)
|
||||
EV_AddLaserThinker(§ors[s], §ors[sec], lines + i, secthinkers, !!(lines[i].flags & ML_EFFECT1));
|
||||
P_AddLaserThinker(lines[i].tag, lines + i, !!(lines[i].flags & ML_EFFECT1));
|
||||
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT, secthinkers);
|
||||
break;
|
||||
|
||||
case 259: // Custom FOF
|
||||
|
|
|
@ -104,9 +104,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