Merge branch 'gfz3laser-mkii' into 'next'

New Greenflower Zone 3 laser

See merge request STJr/SRB2!924
This commit is contained in:
LJ Sonic 2020-05-09 16:40:40 -04:00
commit 280633019a
7 changed files with 151 additions and 24 deletions

View file

@ -3033,6 +3033,7 @@ static actionpointer_t actionpointers[] =
{{A_DragonbomberSpawn}, "A_DRAGONBOMERSPAWN"},
{{A_DragonWing}, "A_DRAGONWING"},
{{A_DragonSegment}, "A_DRAGONSEGMENT"},
{{A_ChangeHeight}, "A_CHANGEHEIGHT"},
{{NULL}, "NONE"},
// This NULL entry must be the last in the list
@ -6231,6 +6232,14 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ROCKET",
"S_LASER",
"S_LASER2",
"S_LASERFLASH",
"S_LASERFLAME1",
"S_LASERFLAME2",
"S_LASERFLAME3",
"S_LASERFLAME4",
"S_LASERFLAME5",
"S_TORPEDO",

View file

@ -298,6 +298,8 @@ light_t *t_lspr[NUMSPRITES] =
// Projectiles
&lspr[NOLIGHT], // SPR_MISL
&lspr[SMALLREDBALL_L], // SPR_LASR
&lspr[REDSHINE_L], // SPR_LASF
&lspr[NOLIGHT], // SPR_TORP
&lspr[NOLIGHT], // SPR_ENRG
&lspr[NOLIGHT], // SPR_MINE

View file

@ -187,6 +187,8 @@ char sprnames[NUMSPRITES + 1][5] =
// Projectiles
"MISL",
"LASR", // GFZ3 laser
"LASF", // GFZ3 laser flames
"TORP", // Torpedo
"ENRG", // Energy ball
"MINE", // Skim mine
@ -2058,7 +2060,15 @@ state_t states[NUMSTATES] =
{SPR_MISL, FF_FULLBRIGHT, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_ROCKET}, // S_ROCKET
{SPR_MISL, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_LASER
{SPR_LASR, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_NULL}, // S_LASER
{SPR_LASR, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_NULL}, // S_LASER2
{SPR_LASR, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_NULL}, // S_LASERFLASH
{SPR_LASF, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_LASERFLAME2}, // S_LASERFLAME1
{SPR_LASF, FF_FULLBRIGHT|1, 1, {A_ChangeHeight}, 156*FRACUNIT, 3, S_LASERFLAME3}, // S_LASERFLAME2
{SPR_LASF, FF_FULLBRIGHT|2, 0, {A_ChangeHeight}, 32*FRACUNIT, 3, S_LASERFLAME4}, // S_LASERFLAME3
{SPR_LASF, FF_ANIMATE|FF_PAPERSPRITE|FF_FULLBRIGHT|2, 4, {NULL}, 1, 2, S_LASERFLAME5}, // S_LASERFLAME4
{SPR_LASF, FF_ANIMATE|FF_PAPERSPRITE|FF_FULLBRIGHT|4, 28, {NULL}, 2, 2, S_NULL}, // S_LASERFLAME5
{SPR_TORP, 0, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_TORPEDO}, // S_TORPEDO
@ -5665,28 +5675,28 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_EGGMOBILE_FIRE
-1, // doomednum
S_SPINFIRE1, // spawnstate
S_LASERFLAME1, // spawnstate
1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
sfx_s3kc2s, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
sfx_s3k8d, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
8*FRACUNIT, // radius
14*FRACUNIT, // height
24*FRACUNIT, // radius
84*FRACUNIT, // height
0, // display offset
DMG_FIRE, // mass
1, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE, // flags
MF_NOGRAVITY|MF_FIRE|MF_PAIN, // flags
S_NULL // raisestate
},
@ -9637,8 +9647,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_LASERFLASH, // meleestate
S_LASER2, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
@ -9649,7 +9659,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // mass
20, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags
MF_MISSILE|MF_NOGRAVITY, // flags
S_NULL // raisestate
},

View file

@ -284,6 +284,7 @@ void A_RolloutRock();
void A_DragonbomberSpawn();
void A_DragonWing();
void A_DragonSegment();
void A_ChangeHeight();
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
#define NUMMOBJFREESLOTS 512
@ -451,6 +452,8 @@ typedef enum sprite
// Projectiles
SPR_MISL,
SPR_LASR, // GFZ3 laser
SPR_LASF, // GFZ3 laser flames
SPR_TORP, // Torpedo
SPR_ENRG, // Energy ball
SPR_MINE, // Skim mine
@ -2220,6 +2223,14 @@ typedef enum state
S_ROCKET,
S_LASER,
S_LASER2,
S_LASERFLASH,
S_LASERFLAME1,
S_LASERFLAME2,
S_LASERFLAME3,
S_LASERFLAME4,
S_LASERFLAME5,
S_TORPEDO,

View file

@ -312,6 +312,7 @@ void A_RolloutRock(mobj_t *actor);
void A_DragonbomberSpawn(mobj_t *actor);
void A_DragonWing(mobj_t *actor);
void A_DragonSegment(mobj_t *actor);
void A_ChangeHeight(mobj_t *actor);
//for p_enemy.c
@ -2990,6 +2991,19 @@ void A_Boss1Laser(mobj_t *actor)
angle_t angle;
mobj_t *point;
tic_t dur;
static const UINT8 LASERCOLORS[] =
{
SKINCOLOR_SUPERRED3,
SKINCOLOR_SUPERRED4,
SKINCOLOR_SUPERRED5,
SKINCOLOR_FLAME,
SKINCOLOR_RED,
SKINCOLOR_RED,
SKINCOLOR_FLAME,
SKINCOLOR_SUPERRED5,
SKINCOLOR_SUPERRED4,
SKINCOLOR_SUPERRED3,
};
if (LUA_CallAction("A_Boss1Laser", actor))
return;
@ -3064,7 +3078,7 @@ void A_Boss1Laser(mobj_t *actor)
point = P_SpawnMobj(x, y, z, locvar1);
P_SetTarget(&point->target, actor);
point->angle = actor->angle;
speed = point->radius*2;
speed = point->radius;
point->momz = FixedMul(FINECOSINE(angle>>ANGLETOFINESHIFT), speed);
point->momx = FixedMul(FINESINE(angle>>ANGLETOFINESHIFT), FixedMul(FINECOSINE(point->angle>>ANGLETOFINESHIFT), speed));
point->momy = FixedMul(FINESINE(angle>>ANGLETOFINESHIFT), FixedMul(FINESINE(point->angle>>ANGLETOFINESHIFT), speed));
@ -3073,23 +3087,69 @@ void A_Boss1Laser(mobj_t *actor)
{
mobj_t *mo = P_SpawnMobj(point->x, point->y, point->z, point->type);
mo->angle = point->angle;
mo->color = LASERCOLORS[((UINT8)(i + 3*dur) >> 2) % sizeof(LASERCOLORS)]; // codeing
P_UnsetThingPosition(mo);
mo->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY;
mo->flags = MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY;
P_SetThingPosition(mo);
if (dur & 1 && mo->info->missilestate)
{
P_SetMobjState(mo, mo->info->missilestate);
if (mo->info->meleestate)
{
mobj_t *mo2 = P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_PARTICLE);
mo2->flags2 |= MF2_LINKDRAW;
P_SetTarget(&mo2->tracer, actor);
P_SetMobjState(mo2, mo->info->meleestate);
}
}
if (dur == 1)
P_SpawnGhostMobj(mo);
x = point->x, y = point->y, z = point->z;
if (P_RailThinker(point))
break;
}
x += point->momx;
y += point->momy;
floorz = P_FloorzAtPos(x, y, z, mobjinfo[MT_EGGMOBILE_FIRE].height);
if (z - floorz < mobjinfo[MT_EGGMOBILE_FIRE].height>>1)
if (z - floorz < mobjinfo[MT_EGGMOBILE_FIRE].height>>1 && dur & 1)
{
point = P_SpawnMobj(x, y, floorz+1, MT_EGGMOBILE_FIRE);
point = P_SpawnMobj(x, y, floorz, MT_EGGMOBILE_FIRE);
point->angle = actor->angle;
point->destscale = actor->scale;
P_SetScale(point, point->destscale);
P_SetTarget(&point->target, actor);
point->destscale = 3*FRACUNIT;
point->scalespeed = FRACUNIT>>2;
point->fuse = TICRATE;
P_MobjCheckWater(point);
if (point->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
{
for (i = 0; i < 2; i++)
{
UINT8 size = 3;
mobj_t *steam = P_SpawnMobj(x, y, point->watertop - size*mobjinfo[MT_DUST].height, MT_DUST);
P_SetScale(steam, size*actor->scale);
P_SetObjectMomZ(steam, FRACUNIT + 2*P_RandomFixed(), true);
P_InstaThrust(steam, FixedAngle(P_RandomKey(360)*FRACUNIT), 2*P_RandomFixed());
if (point->info->painsound)
S_StartSound(steam, point->info->painsound);
}
}
else
{
fixed_t distx = P_ReturnThrustX(point, point->angle, point->radius);
fixed_t disty = P_ReturnThrustY(point, point->angle, point->radius);
if (P_TryMove(point, point->x + distx, point->y + disty, false) // prevents the sprite from clipping into the wall or dangling off ledges
&& P_TryMove(point, point->x - 2*distx, point->y - 2*disty, false)
&& P_TryMove(point, point->x + distx, point->y + disty, false))
{
if (point->info->seesound)
S_StartSound(point, point->info->seesound);
}
else
P_RemoveMobj(point);
}
}
if (dur > 1)
@ -14409,3 +14469,43 @@ void A_DragonSegment(mobj_t *actor)
actor->angle = hangle;
P_TeleportMove(actor, target->x + xdist, target->y + ydist, target->z + zdist);
}
// Function: A_ChangeHeight
//
// Description: Changes the actor's height by var1
//
// var1 = height
// var2 =
// &1: height is absolute
// &2: scale with actor's scale
//
void A_ChangeHeight(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
fixed_t height = locvar1;
boolean reverse;
if (LUA_CallAction("A_ChangeHeight", actor))
return;
reverse = (actor->eflags & MFE_VERTICALFLIP) || (actor->flags2 & MF2_OBJECTFLIP);
if (locvar2 & 2)
height = FixedMul(height, actor->scale);
P_UnsetThingPosition(actor);
if (locvar2 & 1)
{
if (reverse)
actor->z += actor->height - locvar1;
actor->height = locvar1;
}
else
{
if (reverse)
actor->z -= locvar1;
actor->height += locvar1;
}
P_SetThingPosition(actor);
}

View file

@ -7056,8 +7056,7 @@ static void P_MobjScaleThink(mobj_t *mobj)
fixed_t oldheight = mobj->height;
UINT8 correctionType = 0; // Don't correct Z position, just gain height
if ((mobj->flags & MF_NOCLIPHEIGHT || (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz))
&& mobj->type != MT_EGGMOBILE_FIRE)
if (mobj->flags & MF_NOCLIPHEIGHT || (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz))
correctionType = 1; // Correct Z position by centering
else if (mobj->eflags & MFE_VERTICALFLIP)
correctionType = 2; // Correct Z position by moving down
@ -7078,10 +7077,6 @@ static void P_MobjScaleThink(mobj_t *mobj)
/// \todo Lua hook for "reached destscale"?
switch (mobj->type)
{
case MT_EGGMOBILE_FIRE:
mobj->destscale = FRACUNIT;
mobj->scalespeed = FRACUNIT>>4;
break;
default:
break;
}

View file

@ -527,7 +527,7 @@ sfxinfo_t S_sfx[NUMSFX] =
{"s3k8a", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Boing"},
{"s3k8b", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Powerful hit"},
{"s3k8c", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Humming power"},
{"s3k8d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"s3k8d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "/"},
{"s3k8e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Accelerating"},
{"s3k8f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Opening"},
{"s3k90", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Impact"},