Fix up the ability to edit slope zdelta and zangle with Lua (zangle is untested as of writing)

This commit is contained in:
Monster Iestyn 2018-10-21 17:32:53 +01:00
parent e15ed742c1
commit 3ec8743c1b

View file

@ -1359,15 +1359,19 @@ static int slope_set(lua_State *L)
}
case slope_zdelta: { // zdelta, this is temp until i figure out wtf to do
slope->zdelta = luaL_checkfixed(L, 3);
slope->zangle = R_PointToAngle2(0, 0, FRACUNIT, slope->zdelta);
slope->zangle = R_PointToAngle2(0, 0, FRACUNIT, -slope->zdelta);
P_CalculateSlopeNormal(slope);
break;
}
case slope_zangle: // zangle
slope->zangle = luaL_checkangle(L, 3);
slope->zdelta = FINETANGENT(slope->zangle>>ANGLETOFINESHIFT);
case slope_zangle: { // zangle
angle_t zangle = luaL_checkangle(L, 3);
if (zangle == ANGLE_90 || zangle == ANGLE_270)
return luaL_error(L, "invalid zangle for slope!");
slope->zangle = zangle;
slope->zdelta = -FINETANGENT(((slope->zangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095);
P_CalculateSlopeNormal(slope);
break;
}
case slope_xydirection: // xydirection
slope->xydirection = luaL_checkangle(L, 3);
P_CalculateSlopeNormal(slope);