Merge branch 'bustables_misc' into 'master'
Bustables and landing events Closes #157 and #162 See merge request STJr/SRB2Internal!262
This commit is contained in:
commit
af38c0e227
|
@ -2047,12 +2047,22 @@ static int lib_pStartQuake(lua_State *L)
|
||||||
|
|
||||||
static int lib_evCrumbleChain(lua_State *L)
|
static int lib_evCrumbleChain(lua_State *L)
|
||||||
{
|
{
|
||||||
sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
sector_t *sec = NULL;
|
||||||
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
ffloor_t *rover = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!sec)
|
if (!lua_isnone(L, 2))
|
||||||
return LUA_ErrInvalid(L, "sector_t");
|
{
|
||||||
|
if (!lua_isnil(L, 1))
|
||||||
|
{
|
||||||
|
sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||||
|
if (!sec)
|
||||||
|
return LUA_ErrInvalid(L, "sector_t");
|
||||||
|
}
|
||||||
|
rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rover = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
|
||||||
if (!rover)
|
if (!rover)
|
||||||
return LUA_ErrInvalid(L, "ffloor_t");
|
return LUA_ErrInvalid(L, "ffloor_t");
|
||||||
EV_CrumbleChain(sec, rover);
|
EV_CrumbleChain(sec, rover);
|
||||||
|
|
|
@ -719,6 +719,8 @@ void T_ContinuousFalling(levelspecthink_t *faller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
P_CheckSector(faller->sector, false); // you might think this is irrelevant. you would be wrong
|
||||||
|
|
||||||
faller->sector->floorspeed = faller->speed*faller->direction;
|
faller->sector->floorspeed = faller->speed*faller->direction;
|
||||||
faller->sector->ceilspeed = 42;
|
faller->sector->ceilspeed = 42;
|
||||||
faller->sector->moved = true;
|
faller->sector->moved = true;
|
||||||
|
@ -3029,20 +3031,40 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
||||||
|
|
||||||
void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i, leftmostvertex, rightmostvertex, topmostvertex, bottommostvertex;
|
||||||
size_t leftmostvertex = 0, rightmostvertex = 0;
|
fixed_t leftx, rightx, topy, bottomy, topz, bottomz, widthfactor, heightfactor, a, b, c, spacing;
|
||||||
size_t topmostvertex = 0, bottommostvertex = 0;
|
mobjtype_t type;
|
||||||
fixed_t leftx, rightx;
|
tic_t lifetime;
|
||||||
fixed_t topy, bottomy;
|
INT16 flags;
|
||||||
fixed_t topz, bottomz;
|
|
||||||
fixed_t widthfactor = FRACUNIT, heightfactor = FRACUNIT;
|
|
||||||
fixed_t a, b, c;
|
|
||||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
|
||||||
fixed_t spacing = (32<<FRACBITS);
|
|
||||||
tic_t lifetime = 3*TICRATE;
|
|
||||||
INT16 flags = 0;
|
|
||||||
|
|
||||||
#define controlsec rover->master->frontsector
|
sector_t *controlsec = rover->master->frontsector;
|
||||||
|
|
||||||
|
if (sec == NULL)
|
||||||
|
{
|
||||||
|
if (controlsec->numattached)
|
||||||
|
{
|
||||||
|
for (i = 0; i < controlsec->numattached; i++)
|
||||||
|
{
|
||||||
|
sec = §ors[controlsec->attached[i]];
|
||||||
|
if (!sec->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (rover->master->frontsector == controlsec)
|
||||||
|
EV_CrumbleChain(sec, rover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
leftmostvertex = rightmostvertex = topmostvertex = bottommostvertex = 0;
|
||||||
|
widthfactor = heightfactor = FRACUNIT;
|
||||||
|
spacing = (32<<FRACBITS);
|
||||||
|
type = MT_ROCKCRUMBLE1;
|
||||||
|
lifetime = 3*TICRATE;
|
||||||
|
flags = 0;
|
||||||
|
|
||||||
if (controlsec->tag != 0)
|
if (controlsec->tag != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,7 +142,7 @@ boolean P_IsObjectOnGround(mobj_t *mo);
|
||||||
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
||||||
boolean P_InSpaceSector(mobj_t *mo);
|
boolean P_InSpaceSector(mobj_t *mo);
|
||||||
boolean P_InQuicksand(mobj_t *mo);
|
boolean P_InQuicksand(mobj_t *mo);
|
||||||
boolean P_PlayerHitFloor(player_t *player);
|
boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff);
|
||||||
|
|
||||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||||
void P_RestoreMusic(player_t *player);
|
void P_RestoreMusic(player_t *player);
|
||||||
|
|
|
@ -2820,7 +2820,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
static boolean P_ThingHeightClip(mobj_t *thing)
|
static boolean P_ThingHeightClip(mobj_t *thing)
|
||||||
{
|
{
|
||||||
boolean floormoved;
|
boolean floormoved;
|
||||||
fixed_t oldfloorz = thing->floorz;
|
fixed_t oldfloorz = thing->floorz, oldz = thing->z;
|
||||||
ffloor_t *oldfloorrover = thing->floorrover;
|
ffloor_t *oldfloorrover = thing->floorrover;
|
||||||
ffloor_t *oldceilingrover = thing->ceilingrover;
|
ffloor_t *oldceilingrover = thing->ceilingrover;
|
||||||
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
|
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
|
||||||
|
@ -2879,6 +2879,12 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
||||||
thing->z = thing->ceilingz - thing->height;
|
thing->z = thing->ceilingz - thing->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thing->z != oldz)
|
||||||
|
{
|
||||||
|
if (thing->player)
|
||||||
|
P_PlayerHitFloor(thing->player, false);
|
||||||
|
}
|
||||||
|
|
||||||
// debug: be sure it falls to the floor
|
// debug: be sure it falls to the floor
|
||||||
thing->eflags &= ~MFE_ONGROUND;
|
thing->eflags &= ~MFE_ONGROUND;
|
||||||
|
|
||||||
|
|
|
@ -1784,7 +1784,7 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
EV_CrumbleChain(node->m_sector, rover);
|
EV_CrumbleChain(NULL, rover); // node->m_sector
|
||||||
|
|
||||||
// Run a linedef executor??
|
// Run a linedef executor??
|
||||||
if (rover->master->flags & ML_EFFECT5)
|
if (rover->master->flags & ML_EFFECT5)
|
||||||
|
@ -3047,7 +3047,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clipmomz = P_PlayerHitFloor(mo->player);
|
clipmomz = P_PlayerHitFloor(mo->player, true);
|
||||||
|
|
||||||
if (!(mo->player->pflags & PF_SPINNING) && mo->player->powers[pw_carry] != CR_NIGHTSMODE)
|
if (!(mo->player->pflags & PF_SPINNING) && mo->player->powers[pw_carry] != CR_NIGHTSMODE)
|
||||||
mo->player->pflags &= ~PF_STARTDASH;
|
mo->player->pflags &= ~PF_STARTDASH;
|
||||||
|
@ -3129,7 +3129,7 @@ nightsdone:
|
||||||
{
|
{
|
||||||
// DO THE MARIO!
|
// DO THE MARIO!
|
||||||
if (rover->flags & FF_SHATTERBOTTOM) // Brick block!
|
if (rover->flags & FF_SHATTERBOTTOM) // Brick block!
|
||||||
EV_CrumbleChain(node->m_sector, rover);
|
EV_CrumbleChain(NULL, rover); // node->m_sector
|
||||||
else // Question block!
|
else // Question block!
|
||||||
EV_MarioBlock(rover, node->m_sector, mo);
|
EV_MarioBlock(rover, node->m_sector, mo);
|
||||||
}
|
}
|
||||||
|
|
98
src/p_user.c
98
src/p_user.c
|
@ -2031,7 +2031,7 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
|
||||||
//
|
//
|
||||||
// Handles player hitting floor surface.
|
// Handles player hitting floor surface.
|
||||||
// Returns whether to clip momz.
|
// Returns whether to clip momz.
|
||||||
boolean P_PlayerHitFloor(player_t *player)
|
boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
||||||
{
|
{
|
||||||
boolean clipmomz;
|
boolean clipmomz;
|
||||||
|
|
||||||
|
@ -2039,22 +2039,31 @@ boolean P_PlayerHitFloor(player_t *player)
|
||||||
|
|
||||||
if ((clipmomz = !(P_CheckDeathPitCollide(player->mo))) && player->mo->health && !player->spectator)
|
if ((clipmomz = !(P_CheckDeathPitCollide(player->mo))) && player->mo->health && !player->spectator)
|
||||||
{
|
{
|
||||||
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale)))
|
if (dorollstuff)
|
||||||
{
|
{
|
||||||
player->pflags |= PF_SPINNING;
|
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale)))
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
{
|
||||||
S_StartSound(player->mo, sfx_spin);
|
player->pflags |= PF_SPINNING;
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||||
|
S_StartSound(player->mo, sfx_spin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player->pflags &= ~PF_SPINNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
player->pflags &= ~PF_SPINNING;
|
|
||||||
|
|
||||||
if (player->pflags & PF_GLIDING) // ground gliding
|
if (player->pflags & PF_GLIDING) // ground gliding
|
||||||
|
{
|
||||||
|
if (dorollstuff)
|
||||||
{
|
{
|
||||||
player->skidtime = TICRATE;
|
player->skidtime = TICRATE;
|
||||||
player->mo->tics = -1;
|
player->mo->tics = -1;
|
||||||
}
|
}
|
||||||
else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING))
|
else
|
||||||
|
player->pflags &= ~PF_GLIDING;
|
||||||
|
}
|
||||||
|
else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)
|
||||||
|
{
|
||||||
|
if (player->mo->state-states != S_PLAY_MELEE_LANDING)
|
||||||
{
|
{
|
||||||
mobjtype_t type = player->revitem;
|
mobjtype_t type = player->revitem;
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING);
|
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING);
|
||||||
|
@ -2086,45 +2095,48 @@ boolean P_PlayerHitFloor(player_t *player)
|
||||||
P_ReturnThrustY(missile, throwang, mu)); // side to side component
|
P_ReturnThrustY(missile, throwang, mu)); // side to side component
|
||||||
P_Thrust(missile, player->drawangle, mu2); // forward component
|
P_Thrust(missile, player->drawangle, mu2); // forward component
|
||||||
P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true);
|
P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true);
|
||||||
|
missile->momz += player->mo->pmomz;
|
||||||
missile->fuse = TICRATE/2;
|
missile->fuse = TICRATE/2;
|
||||||
missile->extravalue2 = ev;
|
missile->extravalue2 = ev;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
throwang += ANG30;
|
throwang += ANG30;
|
||||||
}
|
}
|
||||||
if (mobjinfo[type].seesound)
|
if (mobjinfo[type].seesound && missile)
|
||||||
S_StartSound(missile, missile->info->seesound);
|
S_StartSound(missile, missile->info->seesound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING)
|
}
|
||||||
|
else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2)
|
||||||
|
;
|
||||||
|
else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING)
|
||||||
|| player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED)
|
|| player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED)
|
||||||
|
{
|
||||||
|
if (player->cmomx || player->cmomy)
|
||||||
{
|
{
|
||||||
if (player->cmomx || player->cmomy)
|
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||||
{
|
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
else if ((player->rmomx || player->rmomy)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||||
else if ((player->rmomx || player->rmomy)
|
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||||
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
|
}
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
else
|
||||||
}
|
{
|
||||||
else
|
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||||
{
|
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
else if ((player->mo->momx || player->mo->momy)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||||
else if ((player->mo->momx || player->mo->momy)
|
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||||
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
|
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2344,7 +2356,7 @@ static void P_CheckBustableBlocks(player_t *player)
|
||||||
//if (metalrecording)
|
//if (metalrecording)
|
||||||
// G_RecordBustup(rover);
|
// G_RecordBustup(rover);
|
||||||
|
|
||||||
EV_CrumbleChain(node->m_sector, rover);
|
EV_CrumbleChain(NULL, rover); // node->m_sector
|
||||||
|
|
||||||
// Run a linedef executor??
|
// Run a linedef executor??
|
||||||
if (rover->master->flags & ML_EFFECT5)
|
if (rover->master->flags & ML_EFFECT5)
|
||||||
|
@ -2561,7 +2573,7 @@ static void P_CheckQuicksand(player_t *player)
|
||||||
player->mo->z = ceilingheight - player->mo->height;
|
player->mo->z = ceilingheight - player->mo->height;
|
||||||
|
|
||||||
if (player->mo->momz <= 0)
|
if (player->mo->momz <= 0)
|
||||||
P_PlayerHitFloor(player);
|
P_PlayerHitFloor(player, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2573,7 +2585,7 @@ static void P_CheckQuicksand(player_t *player)
|
||||||
player->mo->z = floorheight;
|
player->mo->z = floorheight;
|
||||||
|
|
||||||
if (player->mo->momz >= 0)
|
if (player->mo->momz >= 0)
|
||||||
P_PlayerHitFloor(player);
|
P_PlayerHitFloor(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
friction = abs(rover->master->v1->y - rover->master->v2->y)>>6;
|
friction = abs(rover->master->v1->y - rover->master->v2->y)>>6;
|
||||||
|
@ -4434,6 +4446,10 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
player->mo->z += P_MobjFlip(player->mo);
|
player->mo->z += P_MobjFlip(player->mo);
|
||||||
P_SetObjectMomZ(player->mo, player->mindash, false);
|
P_SetObjectMomZ(player->mo, player->mindash, false);
|
||||||
|
if (P_MobjFlip(player->mo)*player->mo->pmomz > 0)
|
||||||
|
player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
|
||||||
|
else
|
||||||
|
player->mo->pmomz = 0;
|
||||||
if (player->mo->eflags & MFE_UNDERWATER)
|
if (player->mo->eflags & MFE_UNDERWATER)
|
||||||
player->mo->momz >>= 1;
|
player->mo->momz >>= 1;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in a new issue