mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-12 22:02:12 +00:00
Bustable blocks revamped. I'm on a roll!
Linedef type 14 (Bustable block parameter) * Applied to one of the linedefs of any FOF's control sector * Concatenation of frontside textures is MT_ object type to spawn, defaults to MT_ROCKCRUMBLE1 if not present * Sound played when being busted is object type's activesound * Frontside x offset is spacing (in fracunits) of spawned particles, defaults to 32<<FRACBITS * Frontside y offset is the fuse of spawned particles in tics, defaults to 3*TICRATE, if set to -1 assume infinite lifetime * Effect 1/Slope Skew flag makes particles fly out Linedef type 250 (Mario Block): * No Climb flag turns it into a brick block (busts when hit from the bottom, player hits their head/fist/whatever, no more upwards momentum)
This commit is contained in:
parent
52dd1c62c2
commit
6f291d667e
5 changed files with 70 additions and 34 deletions
32
src/info.c
32
src/info.c
|
@ -12937,7 +12937,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -12964,7 +12964,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -12991,7 +12991,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13018,7 +13018,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13045,7 +13045,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13072,7 +13072,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13099,7 +13099,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13126,7 +13126,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13153,7 +13153,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13180,7 +13180,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13207,7 +13207,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13234,7 +13234,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13261,7 +13261,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13288,7 +13288,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13315,7 +13315,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
@ -13342,7 +13342,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // display offset
|
||||
1000, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
sfx_crumbl, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
|
|
@ -1797,10 +1797,13 @@ static mobj_t *SearchMarioNode(msecnode_t *node)
|
|||
void T_MarioBlockChecker(levelspecthink_t *block)
|
||||
{
|
||||
line_t *masterline = block->sourceline;
|
||||
if (SearchMarioNode(block->sector->touching_thinglist))
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].bottomtexture;
|
||||
else
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].toptexture;
|
||||
if (!(masterline->flags & ML_NOCLIMB)) // Don't change the textures of a brick block, just a question block
|
||||
{
|
||||
if (SearchMarioNode(block->sector->touching_thinglist))
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].bottomtexture;
|
||||
else
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].toptexture;
|
||||
}
|
||||
}
|
||||
|
||||
// This is the Thwomp's 'brain'. It looks around for players nearby, and if
|
||||
|
@ -2878,17 +2881,35 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
|||
fixed_t leftx, rightx;
|
||||
fixed_t topy, bottomy;
|
||||
fixed_t topz;
|
||||
fixed_t widthfactor, heightfactor;
|
||||
fixed_t a, b, c;
|
||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
||||
fixed_t spacing = (32<<FRACBITS);
|
||||
tic_t lifetime = 3*TICRATE;
|
||||
INT16 flags = 0;
|
||||
|
||||
// If the control sector has a special
|
||||
// of Section3:7-15, use the custom debris.
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 3) >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(GETSECSPECIAL(rover->master->frontsector->special, 3)-7);
|
||||
#define controlsec rover->master->frontsector
|
||||
|
||||
for (i = 0; i < controlsec->linecount; i++)
|
||||
{
|
||||
if (controlsec->lines[i]->special == 14) // If we can use bustable block parameters, we will.
|
||||
{
|
||||
if (sides[controlsec->lines[i]->sidenum[0]].toptexture)
|
||||
type = (mobjtype_t)sides[controlsec->lines[i]->sidenum[0]].toptexture; // Set as object type in p_setup.c...
|
||||
if (sides[controlsec->lines[i]->sidenum[0]].textureoffset)
|
||||
spacing = sides[controlsec->lines[i]->sidenum[0]].textureoffset;
|
||||
if (sides[controlsec->lines[i]->sidenum[0]].rowoffset)
|
||||
lifetime = (sides[controlsec->lines[i]->sidenum[0]].rowoffset>>FRACBITS);
|
||||
flags = controlsec->lines[i]->flags;
|
||||
break; // If someone has multiple parameter linedefs per control sector, TOUGH.
|
||||
}
|
||||
}
|
||||
|
||||
#undef controlsec
|
||||
|
||||
// soundorg z height never gets set normally, so MEH.
|
||||
sec->soundorg.z = sec->floorheight;
|
||||
S_StartSound(&sec->soundorg, sfx_crumbl);
|
||||
S_StartSound(&sec->soundorg, mobjinfo[type].activesound);
|
||||
|
||||
// Find the outermost vertexes in the subsector
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
|
@ -2907,23 +2928,32 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
|||
bottommostvertex = i;
|
||||
}
|
||||
|
||||
leftx = sec->lines[leftmostvertex]->v1->x+(16<<FRACBITS);
|
||||
leftx = sec->lines[leftmostvertex]->v1->x+(spacing>>1);
|
||||
rightx = sec->lines[rightmostvertex]->v1->x;
|
||||
topy = sec->lines[topmostvertex]->v1->y-(16<<FRACBITS);
|
||||
topy = sec->lines[topmostvertex]->v1->y-(spacing>>1);
|
||||
bottomy = sec->lines[bottommostvertex]->v1->y;
|
||||
topz = *rover->topheight-(16<<FRACBITS);
|
||||
topz = *rover->topheight-(spacing>>1);
|
||||
|
||||
for (a = leftx; a < rightx; a += (32<<FRACBITS))
|
||||
widthfactor = (rightx + topy - leftx - bottomy)>>3;
|
||||
heightfactor = (topz - *rover->bottomheight)>>2;
|
||||
|
||||
for (a = leftx; a < rightx; a += spacing)
|
||||
{
|
||||
for (b = topy; b > bottomy; b -= (32<<FRACBITS))
|
||||
for (b = topy; b > bottomy; b -= spacing)
|
||||
{
|
||||
if (R_PointInSubsector(a, b)->sector == sec)
|
||||
{
|
||||
mobj_t *spawned = NULL;
|
||||
for (c = topz; c > *rover->bottomheight; c -= (32<<FRACBITS))
|
||||
for (c = topz; c > *rover->bottomheight; c -= spacing)
|
||||
{
|
||||
spawned = P_SpawnMobj(a, b, c, type);
|
||||
spawned->fuse = 3*TICRATE;
|
||||
if (flags & ML_EFFECT1)
|
||||
{
|
||||
P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(P_AproxDistance(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor));
|
||||
P_SetObjectMomZ(spawned, FixedDiv((c - *rover->bottomheight), heightfactor), false);
|
||||
}
|
||||
if (lifetime != -1)
|
||||
spawned->fuse = lifetime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3068,8 +3068,13 @@ nightsdone:
|
|||
if (rover->flags & FF_MARIO
|
||||
&& !(mo->eflags & MFE_VERTICALFLIP) // if you were flipped, your head isn't actually hitting your ceilingz is it?
|
||||
&& *rover->bottomheight == mo->ceilingz) // The player's head hit the bottom!
|
||||
{
|
||||
// DO THE MARIO!
|
||||
EV_MarioBlock(rover->master->frontsector, node->m_sector, *rover->topheight, mo);
|
||||
if (rover->master->flags & ML_NOCLIMB) // Brick block!
|
||||
EV_CrumbleChain(node->m_sector, rover);
|
||||
else // Question block!
|
||||
EV_MarioBlock(rover->master->frontsector, node->m_sector, *rover->topheight, mo);
|
||||
}
|
||||
}
|
||||
} // Ugly ugly billions of braces! Argh!
|
||||
}
|
||||
|
|
|
@ -1476,6 +1476,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
|||
break;
|
||||
}
|
||||
|
||||
case 14: // Bustable block parameter
|
||||
case 425: // Calls P_SetMobjState on calling mobj
|
||||
case 434: // Custom Power
|
||||
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
|
||||
|
|
|
@ -3712,7 +3712,7 @@ DoneSection2:
|
|||
}
|
||||
break;
|
||||
|
||||
case 7: // Bustable block sprite parameter
|
||||
case 7: // N/A (formerly bustable block sprite parameters)
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
|
|
Loading…
Reference in a new issue