mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge public master
This commit is contained in:
commit
23818bb55d
5 changed files with 16 additions and 91 deletions
|
|
@ -711,6 +711,9 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LUA_HookPlayerMsg(playernum, target, flags, msg))
|
||||||
|
return;
|
||||||
|
|
||||||
// If it's a CSAY, just CECHO and be done with it.
|
// If it's a CSAY, just CECHO and be done with it.
|
||||||
if (flags & HU_CSAY)
|
if (flags & HU_CSAY)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
||||||
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
|
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
|
||||||
int LUA_HookMobjMoveBlocked(mobj_t *, mobj_t *, line_t *);
|
int LUA_HookMobjMoveBlocked(mobj_t *, mobj_t *, line_t *);
|
||||||
void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringargs);
|
void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringargs);
|
||||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
|
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg);
|
||||||
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
|
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
|
||||||
int LUA_HookMapThingSpawn(mobj_t *, mapthing_t *);
|
int LUA_HookMapThingSpawn(mobj_t *, mapthing_t *);
|
||||||
int LUA_HookFollowMobj(player_t *, mobj_t *);
|
int LUA_HookFollowMobj(player_t *, mobj_t *);
|
||||||
|
|
|
||||||
|
|
@ -843,7 +843,7 @@ void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
|
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook;
|
||||||
if (prepare_hook(&hook, false, HOOK(PlayerMsg)))
|
if (prepare_hook(&hook, false, HOOK(PlayerMsg)))
|
||||||
|
|
@ -863,7 +863,6 @@ int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
|
||||||
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
|
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
|
||||||
}
|
}
|
||||||
lua_pushstring(gL, msg); // msg
|
lua_pushstring(gL, msg); // msg
|
||||||
lua_pushboolean(gL, mute); // the message was supposed to be eaten by spamprotecc.
|
|
||||||
|
|
||||||
call_hooks(&hook, 1, res_true);
|
call_hooks(&hook, 1, res_true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,81 +151,6 @@ get_binary_direction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::optional<vector2_t>
|
|
||||||
intersect
|
|
||||||
( const mobj_t * anchor,
|
|
||||||
const mobj_t * toucher)
|
|
||||||
{
|
|
||||||
struct Line
|
|
||||||
{
|
|
||||||
angle_t a;
|
|
||||||
vector2_t o;
|
|
||||||
|
|
||||||
angle_t k = AbsAngle(a);
|
|
||||||
|
|
||||||
Line(vector2_t o_, angle_t a_) : a(a_), o(o_) {}
|
|
||||||
|
|
||||||
bool vertical() const { return k == ANGLE_90; }
|
|
||||||
|
|
||||||
fixed_t m() const
|
|
||||||
{
|
|
||||||
// tangent table is offset 90 degrees
|
|
||||||
return FTAN(a - ANGLE_90);
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed_t b() const
|
|
||||||
{
|
|
||||||
return o.y - FixedMul(o.x, m());
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed_t y(fixed_t x) const
|
|
||||||
{
|
|
||||||
return FixedMul(m(), x) + b();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (toucher->momx == 0 && toucher->momy == 0)
|
|
||||||
{
|
|
||||||
// undefined angle
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Line a({toucher->x, toucher->y},
|
|
||||||
R_PointToAngle2(0, 0, toucher->momx, toucher->momy));
|
|
||||||
|
|
||||||
Line b({anchor->x, anchor->y}, anchor->angle + ANGLE_90);
|
|
||||||
|
|
||||||
if (a.k == b.k)
|
|
||||||
{
|
|
||||||
// parallel lines do not intersect
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
vector2_t v;
|
|
||||||
|
|
||||||
auto v_intersect = [&v](Line &a, Line &b)
|
|
||||||
{
|
|
||||||
if (a.vertical())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
v.x = b.o.x;
|
|
||||||
v.y = a.y(v.x);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!v_intersect(a, b) && !v_intersect(b, a))
|
|
||||||
{
|
|
||||||
// untested!
|
|
||||||
v.x = FixedDiv(a.b() - b.b(), b.m() - a.m());
|
|
||||||
v.y = a.y(v.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
mobj_t *
|
mobj_t *
|
||||||
Obj_FindLoopCenter (const mtag_t tag)
|
Obj_FindLoopCenter (const mtag_t tag)
|
||||||
{
|
{
|
||||||
|
|
@ -330,10 +255,12 @@ Obj_LoopEndpointCollide
|
||||||
{
|
{
|
||||||
set_shiftxy(player, anchor);
|
set_shiftxy(player, anchor);
|
||||||
|
|
||||||
vector2_t i = intersect(anchor, toucher)
|
const fixed_t magnitude = R_PointToDist2(0, 0, px, py);
|
||||||
.value_or(vector2_t {px, py});
|
const fixed_t newX = FixedDiv(px, magnitude);
|
||||||
|
const fixed_t newY = FixedDiv(py, magnitude);
|
||||||
|
|
||||||
s->origin_shift = {i.x - px, i.y - py};
|
s->origin_shift = {FixedMul(newX, FCOS(anchor->angle)),
|
||||||
|
FixedMul(newY, FSIN(anchor->angle))};
|
||||||
}
|
}
|
||||||
|
|
||||||
flip = get_binary_direction(pitch, toucher);
|
flip = get_binary_direction(pitch, toucher);
|
||||||
|
|
|
||||||
14
src/p_loop.c
14
src/p_loop.c
|
|
@ -101,7 +101,7 @@ boolean P_PlayerOrbit(player_t *player)
|
||||||
fixed_t r, xy, z;
|
fixed_t r, xy, z;
|
||||||
fixed_t xs, ys;
|
fixed_t xs, ys;
|
||||||
|
|
||||||
fixed_t step, th, left;
|
fixed_t step, left;
|
||||||
|
|
||||||
fixed_t grav;
|
fixed_t grav;
|
||||||
|
|
||||||
|
|
@ -136,16 +136,12 @@ boolean P_PlayerOrbit(player_t *player)
|
||||||
|
|
||||||
// XY shift is transformed on wave scale; less movement
|
// XY shift is transformed on wave scale; less movement
|
||||||
// at start and end of rotation, more halfway.
|
// at start and end of rotation, more halfway.
|
||||||
th = FSIN(pitch_normal - ANGLE_90);
|
xs = FixedMul(s->shift.x, FCOS(pitch_normal));
|
||||||
|
ys = FixedMul(s->shift.y, FSIN(pitch_normal - ANGLE_90));
|
||||||
xs = FixedMul(s->shift.x, th);
|
|
||||||
ys = FixedMul(s->shift.y, th);
|
|
||||||
|
|
||||||
// Interpolate 0-1 over entire rotation.
|
// Interpolate 0-1 over entire rotation.
|
||||||
th = FSIN(pitch_normal / 2);
|
xs += FixedMul(s->origin_shift.x, FCOS(pitch_normal));
|
||||||
|
ys += FixedMul(s->origin_shift.y, FSIN(pitch_normal - ANGLE_90));
|
||||||
xs += FixedMul(s->origin_shift.x, th);
|
|
||||||
ys += FixedMul(s->origin_shift.y, th);
|
|
||||||
|
|
||||||
xs += FixedMul(xy, FCOS(s->yaw));
|
xs += FixedMul(xy, FCOS(s->yaw));
|
||||||
ys += FixedMul(xy, FSIN(s->yaw));
|
ys += FixedMul(xy, FSIN(s->yaw));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue