Merge branch 'rvz-hardcode' of https://git.magicalgirl.moe/STJr/SRB2Internal into rvz-hardcode

This commit is contained in:
lachwright 2019-10-06 22:12:47 +08:00
commit 2d33950590
10 changed files with 110 additions and 43 deletions

View file

@ -6598,6 +6598,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SPLISH8",
"S_SPLISH9",
// Lava splish
"S_LAVASPLISH",
// added water splash
"S_SPLASH1",
"S_SPLASH2",
@ -7769,6 +7772,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_RAIN", // Rain
"MT_SNOWFLAKE", // Snowflake
"MT_SPLISH", // Water splish!
"MT_LAVASPLISH", // Lava splish!
"MT_SMOKE",
"MT_SMALLBUBBLE", // small bubble
"MT_MEDIUMBUBBLE", // medium bubble

View file

@ -477,6 +477,7 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_RAIN
&lspr[NOLIGHT], // SPR_SNO1
&lspr[NOLIGHT], // SPR_SPLH
&lspr[NOLIGHT], // SPR_LSPL
&lspr[NOLIGHT], // SPR_SPLA
&lspr[NOLIGHT], // SPR_SMOK
&lspr[NOLIGHT], // SPR_BUBL

View file

@ -372,6 +372,7 @@ char sprnames[NUMSPRITES + 1][5] =
"RAIN", // Rain
"SNO1", // Snowflake
"SPLH", // Water Splish
"LSPL", // Lava Splish
"SPLA", // Water Splash
"SMOK",
"BUBL", // Bubble
@ -3233,6 +3234,9 @@ state_t states[NUMSTATES] =
{SPR_SPLH, FF_TRANS50|7, 2, {NULL}, 0, 0, S_SPLISH9}, // S_SPLISH8
{SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9
// Lava splish
{SPR_LSPL, FF_ANIMATE, 16, {NULL}, 7, 2, S_NULL}, // S_LAVASPLISH
// Water Splash
{SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1
{SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2
@ -12761,7 +12765,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // speed
30*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
1, // display offset
100, // mass
0, // damage
sfx_None, // activesound
@ -16823,6 +16827,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_LAVASPLISH
-1, // doomednum
S_LAVASPLISH, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
6*FRACUNIT, // radius
1*FRACUNIT, // height
0, // display offset
100, // mass
1, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_SMOKE
-1, // doomednum
S_SMOKE1, // spawnstate

View file

@ -626,6 +626,7 @@ typedef enum sprite
SPR_RAIN, // Rain
SPR_SNO1, // Snowflake
SPR_SPLH, // Water Splish
SPR_LSPL, // Lava Splish
SPR_SPLA, // Water Splash
SPR_SMOK,
SPR_BUBL, // Bubble
@ -3353,6 +3354,9 @@ typedef enum state
S_SPLISH8,
S_SPLISH9,
// Lava Splish
S_LAVASPLISH,
// added water splash
S_SPLASH1,
S_SPLASH2,
@ -4546,6 +4550,7 @@ typedef enum mobj_type
MT_RAIN, // Rain
MT_SNOWFLAKE, // Snowflake
MT_SPLISH, // Water splish!
MT_LAVASPLISH, // Lava splish!
MT_SMOKE,
MT_SMALLBUBBLE, // small bubble
MT_MEDIUMBUBBLE, // medium bubble

View file

@ -12042,7 +12042,7 @@ void A_MineExplode(mobj_t *actor)
#undef dist
if (actor->watertop != INT32_MAX)
P_SpawnMobj(actor->x, actor->y, actor->watertop, MT_SPLISH);
P_SpawnMobj(actor->x, actor->y, actor->watertop, (actor->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH);
}
}
@ -13820,7 +13820,8 @@ void A_FallingLavaCheck(mobj_t *actor)
{
actor->flags = MF_NOGRAVITY|MF_NOCLIPTHING;
actor->momz = 0;
actor->z = actor->watertop;
if (actor->eflags & MFE_TOUCHWATER)
actor->z = (actor->eflags & MFE_VERTICALFLIP) ? actor->waterbottom : actor->watertop;
P_SetMobjState(actor, actor->info->deathstate);
}
}

View file

@ -1778,6 +1778,7 @@ static mobj_t *SearchMarioNode(msecnode_t *node)
case MT_RAIN:
case MT_SNOWFLAKE:
case MT_SPLISH:
case MT_LAVASPLISH:
case MT_SMOKE:
case MT_SMALLBUBBLE:
case MT_MEDIUMBUBBLE:

View file

@ -888,6 +888,15 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
#endif
if (tmthing->type == MT_LAVAFALL_LAVA && (thing->type == MT_RING || thing->type == MT_REDTEAMRING || thing->type == MT_BLUETEAMRING || thing->type == MT_FLINGRING))
{
//height check
if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !(thing->health))
return true;
P_KillMobj(thing, tmthing, tmthing, DMG_FIRE);
}
if (tmthing->type == MT_MINECART)
{
//height check

View file

@ -3318,7 +3318,7 @@ void P_MobjCheckWater(mobj_t *mobj)
mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT;
// Reset water state.
mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER);
mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER|MFE_TOUCHLAVA);
for (rover = sector->ffloors; rover; rover = rover->next)
{
@ -3359,16 +3359,18 @@ void P_MobjCheckWater(mobj_t *mobj)
// Just touching the water?
if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - height < bottomheight)
|| (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + height > topheight))
{
mobj->eflags |= MFE_TOUCHWATER;
if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY))
mobj->eflags |= MFE_GOOWATER;
}
// Actually in the water?
if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - (height>>1) > bottomheight)
|| (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + (height>>1) < topheight))
{
mobj->eflags |= MFE_UNDERWATER;
if (mobj->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))
{
if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 3)
mobj->eflags |= MFE_TOUCHLAVA;
if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY))
mobj->eflags |= MFE_GOOWATER;
}
@ -3446,14 +3448,15 @@ void P_MobjCheckWater(mobj_t *mobj)
{
// Spawn a splash
mobj_t *splish;
mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
if (mobj->eflags & MFE_VERTICALFLIP)
{
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[MT_SPLISH].height, mobj->scale), MT_SPLISH);
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
splish->flags2 |= MF2_OBJECTFLIP;
splish->eflags |= MFE_VERTICALFLIP;
}
else
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, MT_SPLISH);
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
splish->destscale = mobj->scale;
P_SetScale(splish, mobj->scale);
}
@ -3481,14 +3484,15 @@ void P_MobjCheckWater(mobj_t *mobj)
{
// Spawn a splash
mobj_t *splish;
mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
if (mobj->eflags & MFE_VERTICALFLIP)
{
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[MT_SPLISH].height, mobj->scale), MT_SPLISH);
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
splish->flags2 |= MF2_OBJECTFLIP;
splish->eflags |= MFE_VERTICALFLIP;
}
else
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, MT_SPLISH);
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
splish->destscale = mobj->scale;
P_SetScale(splish, mobj->scale);
}
@ -3504,6 +3508,8 @@ void P_MobjCheckWater(mobj_t *mobj)
if (mobj->eflags & MFE_GOOWATER || wasingoo)
S_StartSound(mobj, sfx_ghit);
else if (mobj->eflags & MFE_TOUCHLAVA)
S_StartSound(mobj, sfx_splash);
else
S_StartSound(mobj, sfx_splish); // And make a sound!
@ -8828,13 +8834,13 @@ void P_MobjThinker(mobj_t *mobj)
}
break;
case MT_RING:
case MT_COIN:
case MT_REDTEAMRING:
case MT_BLUETEAMRING:
P_KillRingsInLava(mobj);
if (P_MobjWasRemoved(mobj))
return;
/* FALLTHRU */
case MT_COIN:
case MT_BLUESPHERE:
case MT_BOMBSPHERE:
case MT_NIGHTSCHIP:
@ -8848,11 +8854,11 @@ void P_MobjThinker(mobj_t *mobj)
return;
// Flung items
case MT_FLINGRING:
case MT_FLINGCOIN:
P_KillRingsInLava(mobj);
if (P_MobjWasRemoved(mobj))
return;
/* FALLTHRU */
case MT_FLINGCOIN:
case MT_FLINGBLUESPHERE:
case MT_FLINGNIGHTSCHIP:
if (mobj->flags2 & MF2_NIGHTSPULL)
@ -9090,13 +9096,11 @@ void P_MobjThinker(mobj_t *mobj)
if (hdist < 1000*FRACUNIT)
{
fixed_t dist = P_AproxDistance(hdist, mobj->target->z - mobj->z);
//Aim for player z position. If too close to floor/ceiling, aim just above/below them.
fixed_t destz = min(max(mobj->target->z, mobj->target->floorz + 70*FRACUNIT), mobj->target->ceilingz - 80*FRACUNIT - mobj->height);
fixed_t dist = P_AproxDistance(hdist, destz - mobj->z);
P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT);
//aim for player z position; if too close to floor, aim just above them
if (mobj->z - mobj->floorz >= 80*FRACUNIT)
mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, dist), 2*FRACUNIT);
else
mobj->momz = FixedMul(FixedDiv((mobj->target->z + 70*FRACUNIT) - mobj->z, dist), 2*FRACUNIT);
mobj->momz = FixedMul(FixedDiv(destz - mobj->z, dist), 2*FRACUNIT);
}
else
{
@ -9149,7 +9153,7 @@ void P_MobjThinker(mobj_t *mobj)
}
vdist = mobj->z - mobj->target->z - mobj->target->height;
if (vdist <= 0)
if (P_MobjFlip(mobj)*vdist <= 0)
{
P_SetTarget(&mobj->target, NULL);
break;
@ -10045,19 +10049,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID));
mobj->tracer->angle = mobj->angle + ANGLE_90;
break;
case MT_BIGFERN:
{
UINT8 i;
for (i = 0; i < 8; i++)
{
UINT8 j = (i + 2) % 8;
fixed_t xoffs = (j % 4) ? FRACUNIT : 0;
fixed_t yoffs = (i % 4) ? FRACUNIT : 0;
mobj_t *leaf = P_SpawnMobjFromMobj(mobj, (j > 3) ? -xoffs : xoffs, (i > 3) ? -yoffs : yoffs, 0, MT_BIGFERNLEAF);
leaf->angle = (angle_t)i * ANGLE_45;
}
break;
}
case MT_TORCHFLOWER:
{
mobj_t *fire = P_SpawnMobjFromMobj(mobj, 0, 0, 46*FRACUNIT, MT_FLAME);
@ -12097,6 +12088,21 @@ ML_EFFECT5 : Don't stop thinking when too far away
S_StartSound(mobj, sfx_s3kd3l);
}
break;
case MT_BIGFERN:
{
angle_t angle = FixedAngle(mthing->angle << FRACBITS);
UINT8 i;
for (i = 0; i < 8; i++)
{
angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK;
fixed_t xoffs = FINECOSINE(fa);
fixed_t yoffs = FINESINE(fa);
mobj_t *leaf = P_SpawnMobjFromMobj(mobj, xoffs, yoffs, 0, MT_BIGFERNLEAF);
leaf->angle = angle;
angle += ANGLE_45;
}
break;
}
default:
break;
}

View file

@ -233,15 +233,17 @@ typedef enum
MFE_VERTICALFLIP = 1<<5,
// Goo water
MFE_GOOWATER = 1<<6,
// The mobj is touching a lava block
MFE_TOUCHLAVA = 1<<7,
// Mobj was already pushed this tic
MFE_PUSHED = 1<<7,
MFE_PUSHED = 1<<8,
// Mobj was already sprung this tic
MFE_SPRUNG = 1<<8,
MFE_SPRUNG = 1<<9,
// Platform movement
MFE_APPLYPMOMZ = 1<<9,
MFE_APPLYPMOMZ = 1<<10,
// Compute and trigger on mobj angle relative to tracer
// See Linedef Exec 457 (Track mobj angle to point)
MFE_TRACERANGLE = 1<<10,
MFE_TRACERANGLE = 1<<11,
// free: to and including 1<<15
} mobjeflag_t;

View file

@ -7150,10 +7150,13 @@ static void P_NiGHTSMovement(player_t *player)
&& player->mo->z + player->mo->height - P_GetPlayerHeight(player) <= player->mo->waterbottom && player->mo->z + player->mo->height >= player->mo->waterbottom))
&& player->speed > 9000 && leveltime % (TICRATE/7) == 0 && !player->spectator)
{
mobjtype_t splishtype = (player->mo->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y,
((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[MT_SPLISH].height, player->mo->scale) : player->mo->watertop), MT_SPLISH);
((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[splishtype].height, player->mo->scale) : player->mo->watertop), splishtype);
if (player->mo->eflags & MFE_GOOWATER)
S_StartSound(water, sfx_ghit);
else if (player->mo->eflags & MFE_TOUCHLAVA)
S_StartSound(water, sfx_splash);
else
S_StartSound(water, sfx_wslap);
if (player->mo->eflags & MFE_VERTICALFLIP)
@ -7915,10 +7918,13 @@ static void P_MovePlayer(player_t *player)
&& (player->speed > runspd || (player->pflags & PF_STARTDASH))
&& leveltime % (TICRATE/7) == 0 && player->mo->momz == 0 && !(player->pflags & PF_SLIDING) && !player->spectator)
{
mobjtype_t splishtype = (player->mo->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
mobj_t *water = P_SpawnMobj(player->mo->x - P_ReturnThrustX(NULL, player->mo->angle, player->mo->radius), player->mo->y - P_ReturnThrustY(NULL, player->mo->angle, player->mo->radius),
((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[MT_SPLISH].height, player->mo->scale) : player->mo->watertop), MT_SPLISH);
((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[splishtype].height, player->mo->scale) : player->mo->watertop), splishtype);
if (player->mo->eflags & MFE_GOOWATER)
S_StartSound(water, sfx_ghit);
else if (player->mo->eflags & MFE_TOUCHLAVA)
S_StartSound(water, sfx_splash);
else
S_StartSound(water, sfx_wslap);
if (player->mo->eflags & MFE_VERTICALFLIP)
@ -11173,6 +11179,7 @@ void P_PlayerThink(player_t *player)
/* FALLTHRU */
case CR_MINECART:
case CR_GENERIC:
case CR_PTERABYTE:
player->drawangle = player->mo->tracer->angle;
break;
case CR_ROLLOUT:
@ -11964,8 +11971,8 @@ void P_PlayerAfterThink(player_t *player)
if (P_AproxDistance(player->mo->x - ptera->x, player->mo->y - ptera->y) > player->mo->radius)
goto dropoff;
if (player->mo->state-states != S_PLAY_RIDE)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
if (player->mo->state-states != S_PLAY_FALL)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
break;
dropoff: