New attract shield active
Homing attack when activating the attract shield while jumping.
This commit is contained in:
parent
91934d5aec
commit
4a1f0ce91c
|
@ -5375,6 +5375,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||||
"S_MAGN10",
|
"S_MAGN10",
|
||||||
"S_MAGN11",
|
"S_MAGN11",
|
||||||
"S_MAGN12",
|
"S_MAGN12",
|
||||||
|
"S_MAGN13",
|
||||||
|
|
||||||
"S_FORC1",
|
"S_FORC1",
|
||||||
"S_FORC2",
|
"S_FORC2",
|
||||||
|
|
|
@ -1757,6 +1757,7 @@ state_t states[NUMSTATES] =
|
||||||
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_MAGN11}, // S_MAGN10
|
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_MAGN11}, // S_MAGN10
|
||||||
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_MAGN12}, // S_MAGN11
|
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_MAGN12}, // S_MAGN11
|
||||||
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN12
|
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN12
|
||||||
|
{SPR_MAGN, FF_FULLBRIGHT|FF_TRANS10|12, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN13
|
||||||
|
|
||||||
{SPR_FORC, FF_TRANS50 , 3, {NULL}, 0, 0, S_FORC2 }, // S_FORC1
|
{SPR_FORC, FF_TRANS50 , 3, {NULL}, 0, 0, S_FORC2 }, // S_FORC1
|
||||||
{SPR_FORC, FF_TRANS50|1, 3, {NULL}, 0, 0, S_FORC3 }, // S_FORC2
|
{SPR_FORC, FF_TRANS50|1, 3, {NULL}, 0, 0, S_FORC3 }, // S_FORC2
|
||||||
|
@ -10365,7 +10366,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||||
sfx_None, // seesound
|
sfx_None, // seesound
|
||||||
8, // reactiontime
|
8, // reactiontime
|
||||||
sfx_None, // attacksound
|
sfx_None, // attacksound
|
||||||
S_NULL, // painstate
|
S_MAGN13, // painstate
|
||||||
SKINCOLOR_NONE, // painchance
|
SKINCOLOR_NONE, // painchance
|
||||||
sfx_None, // painsound
|
sfx_None, // painsound
|
||||||
S_NULL, // meleestate
|
S_NULL, // meleestate
|
||||||
|
|
|
@ -2262,6 +2262,7 @@ typedef enum state
|
||||||
S_MAGN10,
|
S_MAGN10,
|
||||||
S_MAGN11,
|
S_MAGN11,
|
||||||
S_MAGN12,
|
S_MAGN12,
|
||||||
|
S_MAGN13,
|
||||||
|
|
||||||
S_FORC1,
|
S_FORC1,
|
||||||
S_FORC2,
|
S_FORC2,
|
||||||
|
|
|
@ -791,10 +791,11 @@ static int lib_pReturnThrustY(lua_State *L)
|
||||||
static int lib_pLookForEnemies(lua_State *L)
|
static int lib_pLookForEnemies(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
boolean nonenemies = lua_opttrueboolean(L, 2);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
lua_pushboolean(L, P_LookForEnemies(player));
|
lua_pushboolean(L, P_LookForEnemies(player, nonenemies));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);
|
fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
|
|
||||||
boolean P_LookForEnemies(player_t *player);
|
boolean P_LookForEnemies(player_t *player, boolean nonenemies);
|
||||||
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
|
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
|
||||||
void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
||||||
boolean P_SuperReady(player_t *player);
|
boolean P_SuperReady(player_t *player);
|
||||||
|
|
|
@ -5608,12 +5608,17 @@ void P_MobjThinker(mobj_t *mobj)
|
||||||
case MT_BLACKORB:
|
case MT_BLACKORB:
|
||||||
case MT_WHITEORB:
|
case MT_WHITEORB:
|
||||||
case MT_GREENORB:
|
case MT_GREENORB:
|
||||||
case MT_YELLOWORB:
|
|
||||||
case MT_BLUEORB:
|
case MT_BLUEORB:
|
||||||
case MT_PITYORB:
|
case MT_PITYORB:
|
||||||
if (!P_AddShield(mobj))
|
if (!P_AddShield(mobj))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
case MT_YELLOWORB:
|
||||||
|
if (!P_AddShield(mobj))
|
||||||
|
return;
|
||||||
|
if (mobj->target->player->homing)
|
||||||
|
P_SetMobjState(mobj, mobj->info->painstate);
|
||||||
|
break;
|
||||||
case MT_WATERDROP:
|
case MT_WATERDROP:
|
||||||
P_SceneryCheckWater(mobj);
|
P_SceneryCheckWater(mobj);
|
||||||
if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop)
|
if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop)
|
||||||
|
|
41
src/p_user.c
41
src/p_user.c
|
@ -3971,7 +3971,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
||||||
|
|
||||||
if (player->charability == CA_HOMINGTHOK && !player->homing)
|
if (player->charability == CA_HOMINGTHOK && !player->homing)
|
||||||
{
|
{
|
||||||
if (P_LookForEnemies(player))
|
if (P_LookForEnemies(player, true))
|
||||||
{
|
{
|
||||||
if (player->mo->tracer)
|
if (player->mo->tracer)
|
||||||
player->homing = 3*TICRATE;
|
player->homing = 3*TICRATE;
|
||||||
|
@ -6792,6 +6792,17 @@ static void P_MovePlayer(player_t *player)
|
||||||
if (!(player->powers[pw_super] || player->powers[pw_invulnerability]))
|
if (!(player->powers[pw_super] || player->powers[pw_invulnerability]))
|
||||||
P_BlackOw(player);
|
P_BlackOw(player);
|
||||||
}
|
}
|
||||||
|
// Attract shield activation
|
||||||
|
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)
|
||||||
|
{
|
||||||
|
if (!(player->pflags & PF_THOKKED))
|
||||||
|
{
|
||||||
|
player->pflags |= PF_THOKKED;
|
||||||
|
player->homing = 2;
|
||||||
|
if (P_LookForEnemies(player, false) && player->mo->tracer)
|
||||||
|
player->homing = 3*TICRATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Super Sonic move
|
// Super Sonic move
|
||||||
if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
|
if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
|
||||||
|
@ -6807,8 +6818,20 @@ static void P_MovePlayer(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)
|
||||||
|
{
|
||||||
|
if (player->homing && player->mo->tracer)
|
||||||
|
{
|
||||||
|
if (!(player->pflags & PF_JUMPED)
|
||||||
|
|| player->mo->tracer->health <= 0
|
||||||
|
|| player->mo->tracer->flags2 & MF2_FRET)
|
||||||
|
player->homing = 0;
|
||||||
|
else
|
||||||
|
P_HomingAttack(player->mo, player->mo->tracer);
|
||||||
|
}
|
||||||
|
}
|
||||||
// HOMING option.
|
// HOMING option.
|
||||||
if (player->charability == CA_HOMINGTHOK)
|
else if (player->charability == CA_HOMINGTHOK)
|
||||||
{
|
{
|
||||||
// If you've got a target, chase after it!
|
// If you've got a target, chase after it!
|
||||||
if (player->homing && player->mo->tracer)
|
if (player->homing && player->mo->tracer)
|
||||||
|
@ -7410,9 +7433,9 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
|
||||||
//
|
//
|
||||||
// P_LookForEnemies
|
// P_LookForEnemies
|
||||||
// Looks for something you can hit - Used for homing attack
|
// Looks for something you can hit - Used for homing attack
|
||||||
// Includes monitors and springs!
|
// If nonenemies is true, includes monitors and springs!
|
||||||
//
|
//
|
||||||
boolean P_LookForEnemies(player_t *player)
|
boolean P_LookForEnemies(player_t *player, boolean nonenemies)
|
||||||
{
|
{
|
||||||
mobj_t *mo;
|
mobj_t *mo;
|
||||||
thinker_t *think;
|
thinker_t *think;
|
||||||
|
@ -7425,7 +7448,8 @@ boolean P_LookForEnemies(player_t *player)
|
||||||
continue; // not a mobj thinker
|
continue; // not a mobj thinker
|
||||||
|
|
||||||
mo = (mobj_t *)think;
|
mo = (mobj_t *)think;
|
||||||
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
|
if ((nonenemies && !(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
|
||||||
|
|| (!nonenemies && !(mo->flags & (MF_ENEMY|MF_BOSS))))
|
||||||
continue; // not a valid enemy
|
continue; // not a valid enemy
|
||||||
|
|
||||||
if (mo->health <= 0) // dead
|
if (mo->health <= 0) // dead
|
||||||
|
@ -7524,7 +7548,12 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target
|
||||||
ns = FixedMul(source->info->speed, source->scale);
|
ns = FixedMul(source->info->speed, source->scale);
|
||||||
}
|
}
|
||||||
else if (source->player)
|
else if (source->player)
|
||||||
ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2);
|
{
|
||||||
|
if (source->player->charability == CA_HOMINGTHOK)
|
||||||
|
ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2);
|
||||||
|
else //if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)
|
||||||
|
ns = FixedMul(80*FRACUNIT, source->scale);
|
||||||
|
}
|
||||||
|
|
||||||
source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns);
|
source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns);
|
||||||
source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns);
|
source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns);
|
||||||
|
|
Loading…
Reference in a new issue