mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 20:41:25 +00:00
Add P_SetPower; remove mobj hack from line 434
This commit is contained in:
parent
9dfa153e74
commit
6325185091
4 changed files with 28 additions and 20 deletions
|
@ -4179,7 +4179,6 @@ void A_CustomPower(mobj_t *actor)
|
||||||
player_t *player;
|
player_t *player;
|
||||||
INT32 locvar1 = var1;
|
INT32 locvar1 = var1;
|
||||||
INT32 locvar2 = var2;
|
INT32 locvar2 = var2;
|
||||||
boolean spawnshield = false;
|
|
||||||
|
|
||||||
if (LUA_CallAction(A_CUSTOMPOWER, actor))
|
if (LUA_CallAction(A_CUSTOMPOWER, actor))
|
||||||
return;
|
return;
|
||||||
|
@ -4198,15 +4197,10 @@ void A_CustomPower(mobj_t *actor)
|
||||||
|
|
||||||
player = actor->target->player;
|
player = actor->target->player;
|
||||||
|
|
||||||
if (locvar1 == pw_shield && player->powers[pw_shield] != locvar2)
|
P_SetPower(player, locvar1, locvar2);
|
||||||
spawnshield = true;
|
|
||||||
|
|
||||||
player->powers[locvar1] = (UINT16)locvar2;
|
|
||||||
if (actor->info->seesound)
|
if (actor->info->seesound)
|
||||||
S_StartSound(player->mo, actor->info->seesound);
|
S_StartSound(player->mo, actor->info->seesound);
|
||||||
|
|
||||||
if (spawnshield) //workaround for a bug
|
|
||||||
P_SpawnShieldOrb(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: A_GiveWeapon
|
// Function: A_GiveWeapon
|
||||||
|
|
|
@ -155,6 +155,7 @@ 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);
|
||||||
|
void P_SetPower(player_t *player, powertype_t power, UINT16 value);
|
||||||
void P_SpawnShieldOrb(player_t *player);
|
void P_SpawnShieldOrb(player_t *player);
|
||||||
void P_SwitchShield(player_t *player, UINT16 shieldtype);
|
void P_SwitchShield(player_t *player, UINT16 shieldtype);
|
||||||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||||
|
|
21
src/p_spec.c
21
src/p_spec.c
|
@ -2888,25 +2888,20 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
case 434: // Custom Power
|
case 434: // Custom Power
|
||||||
if (mo && mo->player)
|
if (mo && mo->player)
|
||||||
{
|
{
|
||||||
mobj_t *dummy = P_SpawnMobj(mo->x, mo->y, mo->z, MT_NULL);
|
powertype_t power = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1;
|
||||||
|
UINT16 value;
|
||||||
var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1;
|
|
||||||
|
|
||||||
if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef
|
if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef
|
||||||
var2 = sides[line->sidenum[1]].toptexture;
|
value = sides[line->sidenum[1]].toptexture;
|
||||||
else if (line->flags & ML_NOCLIMB) // 'Infinite'
|
else if (line->flags & ML_NOCLIMB) // 'Infinite'
|
||||||
var2 = UINT16_MAX;
|
value = UINT16_MAX;
|
||||||
else
|
else
|
||||||
var2 = sides[line->sidenum[0]].textureoffset>>FRACBITS;
|
value = sides[line->sidenum[0]].textureoffset>>FRACBITS;
|
||||||
|
|
||||||
P_SetTarget(&dummy->target, mo);
|
P_SetPower(mo->player, power, value);
|
||||||
A_CustomPower(dummy);
|
|
||||||
|
|
||||||
if (bot) {
|
if (bot)
|
||||||
P_SetTarget(&dummy->target, bot);
|
P_SetPower(bot->player, power, value);
|
||||||
A_CustomPower(dummy);
|
|
||||||
}
|
|
||||||
P_RemoveMobj(dummy);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
18
src/p_user.c
18
src/p_user.c
|
@ -2011,6 +2011,24 @@ void P_SwitchShield(player_t *player, UINT16 shieldtype)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_SetPower
|
||||||
|
//
|
||||||
|
// Sets a power and spawns a shield orb if required.
|
||||||
|
//
|
||||||
|
void P_SetPower(player_t *player, powertype_t power, UINT16 value)
|
||||||
|
{
|
||||||
|
boolean spawnshield = false;
|
||||||
|
|
||||||
|
if (power == pw_shield && player->powers[pw_shield] != value)
|
||||||
|
spawnshield = true;
|
||||||
|
|
||||||
|
player->powers[power] = value;
|
||||||
|
|
||||||
|
if (spawnshield) //workaround for a bug
|
||||||
|
P_SpawnShieldOrb(player);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_SpawnGhostMobj
|
// P_SpawnGhostMobj
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue