* Lua P_MobjFromMobj.

* Make A_Repeat only set extravalue2 if it has a var1.
* Improve sound caption.
* Make activesound state-controllable.
This commit is contained in:
toasterbabe 2017-07-08 11:41:20 +01:00
parent a5f336e51a
commit b91dc51d6f
3 changed files with 20 additions and 4 deletions

View file

@ -422,6 +422,23 @@ static int lib_pSpawnMobj(lua_State *L)
return 1;
}
static int lib_pSpawnMobjFromMobj(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = luaL_checkfixed(L, 4);
mobjtype_t type = luaL_checkinteger(L, 5);
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type), META_MOBJ);
return 1;
}
static int lib_pRemoveMobj(lua_State *L)
{
mobj_t *th = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -2384,6 +2401,7 @@ static luaL_Reg lib[] = {
// p_mobj
// don't add P_SetMobjState or P_SetPlayerMobjState, use "mobj.state = S_NEWSTATE" instead.
{"P_SpawnMobj",lib_pSpawnMobj},
{"P_SpawnMobjFromMobj",lib_pSpawnMobjFromMobj},
{"P_RemoveMobj",lib_pRemoveMobj},
{"P_IsValidSprite2", lib_pIsValidSprite2},
{"P_SpawnLockOn", lib_pSpawnLockOn},

View file

@ -9505,7 +9505,7 @@ void A_Repeat(mobj_t *actor)
return;
#endif
if ((!(actor->extravalue2)) || actor->extravalue2 > locvar1)
if (locvar1 && (!actor->extravalue2 || actor->extravalue2 > locvar1))
actor->extravalue2 = locvar1;
if (--actor->extravalue2 > 0)
@ -10893,8 +10893,6 @@ void A_Boss5Jump(mobj_t *actor)
// Okay, complicated math done. Let's make this object jump already.
A_FaceTracer(actor);
if (actor->info->activesound)
S_StartSound(actor, actor->info->activesound);
if (actor->eflags & MFE_VERTICALFLIP)
actor->z--;

View file

@ -299,7 +299,7 @@ sfxinfo_t S_sfx[NUMSFX] =
{"s3k49", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Falling rock"},
{"s3k4a", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Grab"},
{"s3k4b", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Water splash"},
{"s3k4c", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Heavy landing"},
{"s3k4c", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Heavy hit"},
{"s3k4d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Firing bullet"},
{"s3k4e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bomb explosion"},
{"s3k4f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flamethrower"},