mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'master' of https://git.do.srb2.org/KartKrew/RingRacers
This commit is contained in:
commit
1e502da748
13 changed files with 279 additions and 208 deletions
|
|
@ -4975,6 +4975,11 @@ struct int_const_s const INT_CONST[] = {
|
||||||
{"BT_DRIFT",BT_DRIFT},
|
{"BT_DRIFT",BT_DRIFT},
|
||||||
{"BT_BRAKE",BT_BRAKE},
|
{"BT_BRAKE",BT_BRAKE},
|
||||||
{"BT_ATTACK",BT_ATTACK},
|
{"BT_ATTACK",BT_ATTACK},
|
||||||
|
{"BT_LOOKBACK",BT_LOOKBACK},
|
||||||
|
{"BT_RESPAWN",BT_RESPAWN},
|
||||||
|
{"BT_VOTE",BT_VOTE},
|
||||||
|
{"BT_EBRAKEMASK",BT_EBRAKEMASK}, // Macro button
|
||||||
|
{"BT_SPINDASHMASK",BT_SPINDASHMASK}, // Macro button
|
||||||
{"BT_LUAA",BT_LUAA}, // Lua customizable
|
{"BT_LUAA",BT_LUAA}, // Lua customizable
|
||||||
{"BT_LUAB",BT_LUAB}, // Lua customizable
|
{"BT_LUAB",BT_LUAB}, // Lua customizable
|
||||||
{"BT_LUAC",BT_LUAC}, // Lua customizable
|
{"BT_LUAC",BT_LUAC}, // Lua customizable
|
||||||
|
|
|
||||||
170
src/k_hud.cpp
170
src/k_hud.cpp
|
|
@ -3874,24 +3874,24 @@ static boolean K_ShowPlayerNametag(player_t *p)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_DrawLocalTagForPlayer(fixed_t x, fixed_t y, player_t *p, UINT8 id)
|
static void K_DrawLocalTagForPlayer(fixed_t x, fixed_t y, player_t *p, UINT8 id, UINT32 flags)
|
||||||
{
|
{
|
||||||
UINT8 blink = ((leveltime / 7) & 1);
|
UINT8 blink = ((leveltime / 7) & 1);
|
||||||
UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolornum_t>(p->skincolor), GTC_CACHE);
|
UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolornum_t>(p->skincolor), GTC_CACHE);
|
||||||
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN, kp_localtag[id][blink], colormap);
|
V_DrawFixedPatch(x, y, FRACUNIT, flags, kp_localtag[id][blink], colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_DrawRivalTagForPlayer(fixed_t x, fixed_t y)
|
static void K_DrawRivalTagForPlayer(fixed_t x, fixed_t y, UINT32 flags)
|
||||||
{
|
{
|
||||||
UINT8 blink = ((leveltime / 7) & 1);
|
UINT8 blink = ((leveltime / 7) & 1);
|
||||||
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN, kp_rival[blink], NULL);
|
V_DrawFixedPatch(x, y, FRACUNIT, flags, kp_rival[blink], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_DrawTypingDot(fixed_t x, fixed_t y, UINT8 duration, player_t *p, INT32 flags)
|
static void K_DrawTypingDot(fixed_t x, fixed_t y, UINT8 duration, player_t *p, INT32 flags)
|
||||||
{
|
{
|
||||||
if (p->typing_duration > duration)
|
if (p->typing_duration > duration)
|
||||||
{
|
{
|
||||||
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN|flags, kp_typdot, NULL);
|
V_DrawFixedPatch(x, y, FRACUNIT, flags, kp_typdot, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3913,8 +3913,19 @@ static void K_DrawNameTagItemSpy(INT32 x, INT32 y, player_t *p, INT32 flags)
|
||||||
{
|
{
|
||||||
using srb2::Draw;
|
using srb2::Draw;
|
||||||
bool tiny = r_splitscreen > 1;
|
bool tiny = r_splitscreen > 1;
|
||||||
|
SINT8 flip = 1, flipboxoffset = 0;
|
||||||
|
if ((flags & V_VFLIP) == V_VFLIP)
|
||||||
|
{
|
||||||
|
// Remove the v_vflip flag - it makes things messy, but we also understand
|
||||||
|
// that we want to make this look okay for flipped players, so simply use this
|
||||||
|
// opportunity to flip vertical offsets accordingly instead.
|
||||||
|
flags &= ~V_VFLIP;
|
||||||
|
flip = P_MobjFlip(p->mo);
|
||||||
|
flipboxoffset = 8;
|
||||||
|
}
|
||||||
|
|
||||||
Draw bar = Draw(x, y).flags(V_NOSCALESTART|flags);
|
Draw bar = Draw(x, y).flags(V_NOSCALESTART|flags);
|
||||||
Draw box = tiny ? bar.xy(-22 * vid.dupx, -17 * vid.dupy) : bar.xy(-40 * vid.dupx, -26 * vid.dupy);
|
Draw box = tiny ? bar.xy(-22 * vid.dupx, (-17+flipboxoffset) * vid.dupy) : bar.xy(-40 * vid.dupx, (-26+flipboxoffset) * vid.dupy);
|
||||||
|
|
||||||
box.colorize(p->skincolor).patch(kp_itembg[tiny ? 4 : 2]);
|
box.colorize(p->skincolor).patch(kp_itembg[tiny ? 4 : 2]);
|
||||||
|
|
||||||
|
|
@ -3941,8 +3952,8 @@ static void K_DrawNameTagItemSpy(INT32 x, INT32 y, player_t *p, INT32 flags)
|
||||||
if (p->itemamount > 1)
|
if (p->itemamount > 1)
|
||||||
{
|
{
|
||||||
(tiny ?
|
(tiny ?
|
||||||
bar.xy(-3 * vid.dupx, -4 * vid.dupy).font(Draw::Font::kPing) :
|
bar.xy(-3 * vid.dupx, (-4*flip) * vid.dupy).font(Draw::Font::kPing) :
|
||||||
bar.xy(-4 * vid.dupx, -2 * vid.dupy).font(Draw::Font::kThinTimer)
|
bar.xy(-4 * vid.dupx, (-2*flip) * vid.dupy).font(Draw::Font::kThinTimer)
|
||||||
)
|
)
|
||||||
.align(Draw::Align::kRight)
|
.align(Draw::Align::kRight)
|
||||||
.text("{}", p->itemamount);
|
.text("{}", p->itemamount);
|
||||||
|
|
@ -3988,6 +3999,13 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, INT32 flag
|
||||||
|
|
||||||
UINT8 *colormap = V_GetStringColormap(clr);
|
UINT8 *colormap = V_GetStringColormap(clr);
|
||||||
INT32 barx = 0, bary = 0, barw = 0;
|
INT32 barx = 0, bary = 0, barw = 0;
|
||||||
|
INT32 flipped = P_MobjFlip(p->mo), flipfilloffset = 0, flipfontoffset = 0, flipspheresoffset = 0;
|
||||||
|
if (flipped == -1)
|
||||||
|
{
|
||||||
|
flipfilloffset = -3; // You cannot really flip drawfill.
|
||||||
|
flipfontoffset = -9; // Accounts for font height.
|
||||||
|
flipspheresoffset = 2;
|
||||||
|
}
|
||||||
|
|
||||||
UINT8 cnum = R_GetViewNumber();
|
UINT8 cnum = R_GetViewNumber();
|
||||||
|
|
||||||
|
|
@ -4010,7 +4028,7 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, INT32 flag
|
||||||
bary = (y * vid.dupy) / FRACUNIT;
|
bary = (y * vid.dupy) / FRACUNIT;
|
||||||
|
|
||||||
barx += (6 * vid.dupx);
|
barx += (6 * vid.dupx);
|
||||||
bary -= (16 * vid.dupx);
|
bary -= ((16 + flipfilloffset) * vid.dupx) * flipped;
|
||||||
|
|
||||||
// Center it if necessary
|
// Center it if necessary
|
||||||
if (vid.width != BASEVIDWIDTH * vid.dupx)
|
if (vid.width != BASEVIDWIDTH * vid.dupx)
|
||||||
|
|
@ -4031,7 +4049,7 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, INT32 flag
|
||||||
|
|
||||||
if (gametyperules & GTR_SPHERES)
|
if (gametyperules & GTR_SPHERES)
|
||||||
{
|
{
|
||||||
K_DrawNameTagSphereMeter(barx, bary + (4 * vid.dupy), barw, p->spheres, flags);
|
K_DrawNameTagSphereMeter(barx, bary + (((4 + flipspheresoffset) * vid.dupy) * P_MobjFlip(p->mo)), barw, p->spheres, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lat: 10/06/2020: colormap can be NULL on the frame you join a game, just arbitrarily use palette indexes 31 and 0 instead of whatever the colormap would give us instead to avoid crashes.
|
// Lat: 10/06/2020: colormap can be NULL on the frame you join a game, just arbitrarily use palette indexes 31 and 0 instead of whatever the colormap would give us instead to avoid crashes.
|
||||||
|
|
@ -4043,7 +4061,7 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, INT32 flag
|
||||||
V_DrawFixedPatch(x, y, FRACUNIT, flags, kp_nametagstem, colormap);
|
V_DrawFixedPatch(x, y, FRACUNIT, flags, kp_nametagstem, colormap);
|
||||||
|
|
||||||
// Draw the name itself
|
// Draw the name itself
|
||||||
V_DrawThinStringAtFixed(x + (5*FRACUNIT), y - (26*FRACUNIT), clr|flags, player_names[p - players]);
|
V_DrawThinStringAtFixed(x + (5*FRACUNIT), y - (((26 + flipfontoffset) * FRACUNIT) * P_MobjFlip(p->mo)), clr|flags, player_names[p - players]);
|
||||||
}
|
}
|
||||||
|
|
||||||
playertagtype_t K_WhichPlayerTag(player_t *p)
|
playertagtype_t K_WhichPlayerTag(player_t *p)
|
||||||
|
|
@ -4073,19 +4091,25 @@ playertagtype_t K_WhichPlayerTag(player_t *p)
|
||||||
return PLAYERTAG_NONE;
|
return PLAYERTAG_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, INT32 flags)
|
void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, boolean foreground)
|
||||||
{
|
{
|
||||||
|
INT32 flags = P_IsObjectFlipped(p->mo) ? V_VFLIP : 0;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case PLAYERTAG_LOCAL:
|
case PLAYERTAG_LOCAL:
|
||||||
K_DrawLocalTagForPlayer(x, y, p, G_PartyPosition(p - players));
|
flags |= V_HUDTRANS|V_SPLITSCREEN;
|
||||||
|
K_DrawLocalTagForPlayer(x, y, p, G_PartyPosition(p - players), flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYERTAG_RIVAL:
|
case PLAYERTAG_RIVAL:
|
||||||
K_DrawRivalTagForPlayer(x, y);
|
flags |= V_HUDTRANS|V_SPLITSCREEN;
|
||||||
|
K_DrawRivalTagForPlayer(x, y, flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYERTAG_NAME:
|
case PLAYERTAG_NAME:
|
||||||
|
// We only care about the trans flag here (based?) as well as V_VFLIP.
|
||||||
|
flags |= foreground ? 0 : V_60TRANS;
|
||||||
K_DrawNameTagForPlayer(x, y, p, flags);
|
K_DrawNameTagForPlayer(x, y, p, flags);
|
||||||
K_DrawTypingNotifier(x, y, p, flags);
|
K_DrawTypingNotifier(x, y, p, flags);
|
||||||
break;
|
break;
|
||||||
|
|
@ -4298,6 +4322,19 @@ static void K_drawKartProgressionMinimapIcon(UINT32 distancetofinish, INT32 hudx
|
||||||
V_DrawFixedPatch(hudx, hudy, FRACUNIT, flags, icon, colormap);
|
V_DrawFixedPatch(hudx, hudy, FRACUNIT, flags, icon, colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
position_t K_GetKartObjectPosToMinimapPos(fixed_t objx, fixed_t objy)
|
||||||
|
{
|
||||||
|
fixed_t amnumxpos, amnumypos;
|
||||||
|
|
||||||
|
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
|
||||||
|
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
|
||||||
|
|
||||||
|
if (encoremode)
|
||||||
|
amnumxpos = -amnumxpos;
|
||||||
|
|
||||||
|
return (position_t){amnumxpos, amnumypos};
|
||||||
|
}
|
||||||
|
|
||||||
static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, patch_t *icon, UINT8 *colormap)
|
static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, patch_t *icon, UINT8 *colormap)
|
||||||
{
|
{
|
||||||
// amnum xpos & ypos are the icon's speed around the HUD.
|
// amnum xpos & ypos are the icon's speed around the HUD.
|
||||||
|
|
@ -4307,34 +4344,26 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32
|
||||||
// am xpos & ypos are the icon's starting position. Withouht
|
// am xpos & ypos are the icon's starting position. Withouht
|
||||||
// it, they wouldn't 'spawn' on the top-right side of the HUD.
|
// it, they wouldn't 'spawn' on the top-right side of the HUD.
|
||||||
|
|
||||||
fixed_t amnumxpos, amnumypos;
|
position_t amnumpos;
|
||||||
INT32 amxpos, amypos;
|
INT32 amxpos, amypos;
|
||||||
|
|
||||||
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
|
amnumpos = K_GetKartObjectPosToMinimapPos(objx, objy);
|
||||||
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
|
|
||||||
|
|
||||||
if (encoremode)
|
amxpos = amnumpos.x + ((hudx - (SHORT(icon->width))/2)<<FRACBITS);
|
||||||
amnumxpos = -amnumxpos;
|
amypos = amnumpos.y + ((hudy - (SHORT(icon->height))/2)<<FRACBITS);
|
||||||
|
|
||||||
amxpos = amnumxpos + ((hudx - (SHORT(icon->width))/2)<<FRACBITS);
|
|
||||||
amypos = amnumypos + ((hudy - (SHORT(icon->height))/2)<<FRACBITS);
|
|
||||||
|
|
||||||
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, icon, colormap);
|
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, icon, colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_drawKartMinimapDot(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, UINT8 color, UINT8 size)
|
static void K_drawKartMinimapDot(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, UINT8 color, UINT8 size)
|
||||||
{
|
{
|
||||||
fixed_t amnumxpos, amnumypos;
|
position_t amnumpos;
|
||||||
INT32 amxpos, amypos;
|
INT32 amxpos, amypos;
|
||||||
|
|
||||||
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
|
amnumpos = K_GetKartObjectPosToMinimapPos(objx, objy);
|
||||||
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
|
|
||||||
|
|
||||||
if (encoremode)
|
amxpos = (amnumpos.x / FRACUNIT);
|
||||||
amnumxpos = -amnumxpos;
|
amypos = (amnumpos.y / FRACUNIT);
|
||||||
|
|
||||||
amxpos = (amnumxpos / FRACUNIT);
|
|
||||||
amypos = (amnumypos / FRACUNIT);
|
|
||||||
|
|
||||||
if (flags & V_NOSCALESTART)
|
if (flags & V_NOSCALESTART)
|
||||||
{
|
{
|
||||||
|
|
@ -4397,6 +4426,50 @@ static void K_drawKartMinimapWaypoint(waypoint_t *wp, UINT8 rank, INT32 hudx, IN
|
||||||
K_drawKartMinimapDot(wp->mobj->x, wp->mobj->y, hudx, hudy, flags | V_NOSCALESTART, pal, size);
|
K_drawKartMinimapDot(wp->mobj->x, wp->mobj->y, hudx, hudy, flags | V_NOSCALESTART, pal, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT32 K_GetMinimapTransFlags(const boolean usingProgressBar)
|
||||||
|
{
|
||||||
|
INT32 minimaptrans = 4;
|
||||||
|
boolean dofade = (usingProgressBar && r_splitscreen > 0) || (!usingProgressBar && r_splitscreen >= 1);
|
||||||
|
|
||||||
|
if (dofade)
|
||||||
|
{
|
||||||
|
minimaptrans = FixedMul(minimaptrans, (st_translucency * FRACUNIT) / 10);
|
||||||
|
|
||||||
|
// If the minimap is fully transparent, just get your 0 back. Bail out with this.
|
||||||
|
if (!minimaptrans)
|
||||||
|
return minimaptrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
minimaptrans = ((10-minimaptrans)<<V_ALPHASHIFT);
|
||||||
|
|
||||||
|
return minimaptrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT32 K_GetMinimapSplitFlags(const boolean usingProgressBar)
|
||||||
|
{
|
||||||
|
INT32 splitflags = 0;
|
||||||
|
|
||||||
|
if (usingProgressBar)
|
||||||
|
splitflags = (V_SLIDEIN|V_SNAPTOBOTTOM);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (r_splitscreen < 1) // 1P right aligned
|
||||||
|
{
|
||||||
|
splitflags = (V_SLIDEIN|V_SNAPTORIGHT);
|
||||||
|
}
|
||||||
|
else // 2/4P splits
|
||||||
|
{
|
||||||
|
if (r_splitscreen == 1)
|
||||||
|
splitflags = V_SNAPTORIGHT; // 2P right aligned
|
||||||
|
|
||||||
|
// 3P lives in the middle of the bottom right
|
||||||
|
// viewport and shouldn't fade in OR slide
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return splitflags;
|
||||||
|
}
|
||||||
|
|
||||||
#define ICON_DOT_RADIUS (10)
|
#define ICON_DOT_RADIUS (10)
|
||||||
|
|
||||||
static void K_drawKartMinimap(void)
|
static void K_drawKartMinimap(void)
|
||||||
|
|
@ -4406,8 +4479,8 @@ static void K_drawKartMinimap(void)
|
||||||
INT32 i = 0;
|
INT32 i = 0;
|
||||||
INT32 x, y;
|
INT32 x, y;
|
||||||
|
|
||||||
INT32 minimaptrans = 4;
|
INT32 minimaptrans;
|
||||||
INT32 splitflags = 0;
|
INT32 splitflags;
|
||||||
|
|
||||||
UINT8 skin = 0;
|
UINT8 skin = 0;
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
|
|
@ -4420,7 +4493,7 @@ static void K_drawKartMinimap(void)
|
||||||
fixed_t interpx, interpy;
|
fixed_t interpx, interpy;
|
||||||
|
|
||||||
boolean doprogressionbar = false;
|
boolean doprogressionbar = false;
|
||||||
boolean dofade = false, doencore = false;
|
boolean doencore = false;
|
||||||
|
|
||||||
UINT8 minipal;
|
UINT8 minipal;
|
||||||
|
|
||||||
|
|
@ -4442,6 +4515,11 @@ static void K_drawKartMinimap(void)
|
||||||
doprogressionbar = true;
|
doprogressionbar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minimaptrans = K_GetMinimapTransFlags(doprogressionbar);
|
||||||
|
if (!minimaptrans) return; // Exit early if it wouldn't draw anyway.
|
||||||
|
|
||||||
|
splitflags = K_GetMinimapSplitFlags(doprogressionbar);
|
||||||
|
|
||||||
if (doprogressionbar == false)
|
if (doprogressionbar == false)
|
||||||
{
|
{
|
||||||
if (minimapinfo.minimap_pic == NULL)
|
if (minimapinfo.minimap_pic == NULL)
|
||||||
|
|
@ -4449,20 +4527,6 @@ static void K_drawKartMinimap(void)
|
||||||
return; // no pic, just get outta here
|
return; // no pic, just get outta here
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (r_splitscreen < 1) // 1P right aligned
|
|
||||||
{
|
|
||||||
splitflags = (V_SLIDEIN|V_SNAPTORIGHT);
|
|
||||||
}
|
|
||||||
else // 2/4P splits
|
|
||||||
{
|
|
||||||
if (r_splitscreen == 1)
|
|
||||||
splitflags = V_SNAPTORIGHT; // 2P right aligned
|
|
||||||
|
|
||||||
dofade = true;
|
|
||||||
}
|
|
||||||
// 3P lives in the middle of the bottom right
|
|
||||||
// viewport and shouldn't fade in OR slide
|
|
||||||
|
|
||||||
x = MINI_X;
|
x = MINI_X;
|
||||||
y = MINI_Y;
|
y = MINI_Y;
|
||||||
|
|
||||||
|
|
@ -4477,27 +4541,15 @@ static void K_drawKartMinimap(void)
|
||||||
if (r_splitscreen > 0)
|
if (r_splitscreen > 0)
|
||||||
{
|
{
|
||||||
y = BASEVIDHEIGHT/2;
|
y = BASEVIDHEIGHT/2;
|
||||||
dofade = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y = 180;
|
y = 180;
|
||||||
splitflags = (V_SLIDEIN|V_SNAPTOBOTTOM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
workingPic = kp_wouldyoustillcatchmeifiwereaworm;
|
workingPic = kp_wouldyoustillcatchmeifiwereaworm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dofade)
|
|
||||||
{
|
|
||||||
minimaptrans = FixedMul(minimaptrans, (st_translucency * FRACUNIT) / 10);
|
|
||||||
|
|
||||||
if (!minimaptrans)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
minimaptrans = ((10-minimaptrans)<<V_ALPHASHIFT);
|
|
||||||
|
|
||||||
// Really looking forward to never writing this loop again
|
// Really looking forward to never writing this loop again
|
||||||
UINT8 bestplayer = MAXPLAYERS;
|
UINT8 bestplayer = MAXPLAYERS;
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
|
||||||
13
src/k_hud.h
13
src/k_hud.h
|
|
@ -25,6 +25,8 @@ extern "C" {
|
||||||
|
|
||||||
#define POS_DELAY_TIME 10
|
#define POS_DELAY_TIME 10
|
||||||
|
|
||||||
|
extern INT32 MINI_X, MINI_Y;
|
||||||
|
|
||||||
struct trackingResult_t
|
struct trackingResult_t
|
||||||
{
|
{
|
||||||
fixed_t x, y;
|
fixed_t x, y;
|
||||||
|
|
@ -34,6 +36,11 @@ struct trackingResult_t
|
||||||
fixed_t fov;
|
fixed_t fov;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct position_t
|
||||||
|
{
|
||||||
|
fixed_t x, y;
|
||||||
|
} position_t;
|
||||||
|
|
||||||
void K_ObjectTracking(trackingResult_t *result, const vector3_t *point, boolean reverse);
|
void K_ObjectTracking(trackingResult_t *result, const vector3_t *point, boolean reverse);
|
||||||
|
|
||||||
tic_t K_TranslateTimer(tic_t drawtime, UINT8 mode, INT32 *return_jitter);
|
tic_t K_TranslateTimer(tic_t drawtime, UINT8 mode, INT32 *return_jitter);
|
||||||
|
|
@ -116,7 +123,11 @@ typedef enum
|
||||||
playertagtype_t;
|
playertagtype_t;
|
||||||
|
|
||||||
playertagtype_t K_WhichPlayerTag(player_t *p);
|
playertagtype_t K_WhichPlayerTag(player_t *p);
|
||||||
void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, INT32 flags);
|
void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, boolean foreground);
|
||||||
|
|
||||||
|
INT32 K_GetMinimapTransFlags(const boolean usingProgressBar);
|
||||||
|
INT32 K_GetMinimapSplitFlags(const boolean usingProgressBar);
|
||||||
|
position_t K_GetKartObjectPosToMinimapPos(fixed_t objx, fixed_t objy);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ void K_DrawTargetTracking(const TargetTracking& target)
|
||||||
{
|
{
|
||||||
if (target.nametag != PLAYERTAG_NONE)
|
if (target.nametag != PLAYERTAG_NONE)
|
||||||
{
|
{
|
||||||
K_DrawPlayerTag(target.result.x, target.result.y, target.mobj->player, target.nametag, target.foreground ? 0 : V_60TRANS);
|
K_DrawPlayerTag(target.result.x, target.result.y, target.mobj->player, target.nametag, target.foreground);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
20
src/k_kart.c
20
src/k_kart.c
|
|
@ -8787,12 +8787,20 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
// GROSS. In order to have a transparent version of this for a splitscreen local player, we actually need to spawn two!
|
// GROSS. In order to have a transparent version of this for a splitscreen local player, we actually need to spawn two!
|
||||||
for (doubler = 0; doubler < 2; doubler++)
|
for (doubler = 0; doubler < 2; doubler++)
|
||||||
{
|
{
|
||||||
|
fixed_t heightOffset = player->mo->height + (24*player->mo->scale);
|
||||||
|
if (P_IsObjectFlipped(player->mo))
|
||||||
|
{
|
||||||
|
// This counteracts the offset added by K_FlipFromObject so it looks seamless from non-flipped.
|
||||||
|
heightOffset += player->mo->height - FixedMul(player->mo->scale, player->mo->height);
|
||||||
|
heightOffset *= P_MobjFlip(player->mo); // Fleep.
|
||||||
|
}
|
||||||
|
|
||||||
mobj_t *debtflag = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy,
|
mobj_t *debtflag = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy,
|
||||||
player->mo->z + P_GetMobjZMovement(player->mo) + player->mo->height + (24*player->mo->scale), MT_THOK);
|
player->mo->z + P_GetMobjZMovement(player->mo) + heightOffset, MT_THOK);
|
||||||
|
|
||||||
debtflag->old_x = player->mo->old_x;
|
debtflag->old_x = player->mo->old_x;
|
||||||
debtflag->old_y = player->mo->old_y;
|
debtflag->old_y = player->mo->old_y;
|
||||||
debtflag->old_z = player->mo->old_z + P_GetMobjZMovement(player->mo) + player->mo->height + (24*player->mo->scale);
|
debtflag->old_z = player->mo->old_z + P_GetMobjZMovement(player->mo) + heightOffset;
|
||||||
|
|
||||||
P_SetMobjState(debtflag, S_RINGDEBT);
|
P_SetMobjState(debtflag, S_RINGDEBT);
|
||||||
P_SetScale(debtflag, (debtflag->destscale = player->mo->scale));
|
P_SetScale(debtflag, (debtflag->destscale = player->mo->scale));
|
||||||
|
|
@ -9440,6 +9448,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
for(i = 0;i < 5;i++)
|
for(i = 0;i < 5;i++)
|
||||||
{
|
{
|
||||||
mobj_t *aura = P_SpawnMobjFromMobj(player->mo, 0, 0, player->mo->height/2, MT_CHARGEAURA);
|
mobj_t *aura = P_SpawnMobjFromMobj(player->mo, 0, 0, player->mo->height/2, MT_CHARGEAURA);
|
||||||
|
aura->eflags &= ~MFE_VERTICALFLIP;
|
||||||
aura->angle = player->mo->angle + i*ANG15;
|
aura->angle = player->mo->angle + i*ANG15;
|
||||||
P_SetTarget(&aura->target, player->mo);
|
P_SetTarget(&aura->target, player->mo);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
|
@ -11821,7 +11830,7 @@ void K_KartEbrakeVisuals(player_t *p)
|
||||||
{
|
{
|
||||||
if (p->ebrakefor % 20 == 0)
|
if (p->ebrakefor % 20 == 0)
|
||||||
{
|
{
|
||||||
wave = P_SpawnMobj(p->mo->x, p->mo->y, p->mo->floorz, MT_SOFTLANDING);
|
wave = P_SpawnMobj(p->mo->x, p->mo->y, P_GetMobjGround(p->mo), MT_SOFTLANDING);
|
||||||
P_InstaScale(wave, p->mo->scale);
|
P_InstaScale(wave, p->mo->scale);
|
||||||
P_SetTarget(&wave->target, p->mo);
|
P_SetTarget(&wave->target, p->mo);
|
||||||
P_SetTarget(&wave->owner, p->mo);
|
P_SetTarget(&wave->owner, p->mo);
|
||||||
|
|
@ -13481,6 +13490,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
if (player->curshield != KSHIELD_BUBBLE)
|
if (player->curshield != KSHIELD_BUBBLE)
|
||||||
{
|
{
|
||||||
mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELD);
|
mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BUBBLESHIELD);
|
||||||
|
// MT_BUBBLESHIELD doesn't have MF_NOBLOCKMAP so we need to remove this manually.
|
||||||
|
// Otherwise if you roll a bubble shield while flipped, the visuals look too mismatched.
|
||||||
|
shield->eflags &= ~MFE_VERTICALFLIP;
|
||||||
P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2));
|
P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2));
|
||||||
P_SetTarget(&shield->target, player->mo);
|
P_SetTarget(&shield->target, player->mo);
|
||||||
S_StartSound(player->mo, sfx_s3k3f);
|
S_StartSound(player->mo, sfx_s3k3f);
|
||||||
|
|
@ -13829,7 +13841,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
|
|
||||||
// debug shit
|
// debug shit
|
||||||
//CONS_Printf("%d\n", player->mo->momz / mapobjectscale);
|
//CONS_Printf("%d\n", player->mo->momz / mapobjectscale);
|
||||||
if (momz < -10*FRACUNIT) // :youfuckedup:
|
if (momz * P_MobjFlip(player->mo) < -10*FRACUNIT) // :youfuckedup:
|
||||||
{
|
{
|
||||||
// tumble if you let your chance pass!!
|
// tumble if you let your chance pass!!
|
||||||
player->tumbleBounces = 1;
|
player->tumbleBounces = 1;
|
||||||
|
|
|
||||||
|
|
@ -2981,6 +2981,54 @@ static int lib_gTicsToMilliseconds(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// K_HUD
|
||||||
|
////////////
|
||||||
|
|
||||||
|
static int lib_kAddMessage(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *msg = luaL_checkstring(L, 1);
|
||||||
|
boolean interrupt = lua_optboolean(L, 2);
|
||||||
|
boolean persist = lua_optboolean(L, 3);
|
||||||
|
INLEVEL
|
||||||
|
if (msg == NULL)
|
||||||
|
return luaL_error(L, "argument #1 not given (expected string)");
|
||||||
|
K_AddMessage(msg, interrupt, persist);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_kAddMessageForPlayer(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
const char *msg = luaL_checkstring(L, 2);
|
||||||
|
boolean interrupt = lua_optboolean(L, 3);
|
||||||
|
boolean persist = lua_optboolean(L, 4);
|
||||||
|
INLEVEL
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
if (msg == NULL)
|
||||||
|
return luaL_error(L, "argument #2 not given (expected string)");
|
||||||
|
K_AddMessageForPlayer(player, msg, interrupt, persist);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_kClearPersistentMessages(lua_State *L)
|
||||||
|
{
|
||||||
|
INLEVEL
|
||||||
|
K_ClearPersistentMessages();
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_kClearPersistentMessageForPlayer(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
INLEVEL
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
K_ClearPersistentMessageForPlayer(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// K_KART
|
// K_KART
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
|
@ -3815,6 +3863,12 @@ static luaL_Reg lib[] = {
|
||||||
{"G_TicsToMilliseconds",lib_gTicsToMilliseconds},
|
{"G_TicsToMilliseconds",lib_gTicsToMilliseconds},
|
||||||
{"getTimeMicros",lib_getTimeMicros},
|
{"getTimeMicros",lib_getTimeMicros},
|
||||||
|
|
||||||
|
// k_hud
|
||||||
|
{"K_AddMessage", lib_kAddMessage},
|
||||||
|
{"K_AddMessageForPlayer", lib_kAddMessageForPlayer},
|
||||||
|
{"K_ClearPersistentMessages", lib_kClearPersistentMessages},
|
||||||
|
{"K_ClearPersistentMessageForPlayer", lib_kClearPersistentMessageForPlayer},
|
||||||
|
|
||||||
// k_kart
|
// k_kart
|
||||||
{"K_PlayAttackTaunt", lib_kAttackSound},
|
{"K_PlayAttackTaunt", lib_kAttackSound},
|
||||||
{"K_PlayBoostTaunt", lib_kBoostSound},
|
{"K_PlayBoostTaunt", lib_kBoostSound},
|
||||||
|
|
|
||||||
148
src/lua_hudlib.c
148
src/lua_hudlib.c
|
|
@ -26,6 +26,7 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
|
#include "k_hud.h"
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
|
|
@ -575,6 +576,7 @@ static int libd_drawStretched(lua_State *L)
|
||||||
|
|
||||||
// KART: draw patch on minimap from x, y coordinates on the map
|
// KART: draw patch on minimap from x, y coordinates on the map
|
||||||
// Sal: Let's please just merge the relevant info into the actual function, and have Lua call that...
|
// Sal: Let's please just merge the relevant info into the actual function, and have Lua call that...
|
||||||
|
// JugadorXEI: hey, sure.
|
||||||
static int libd_drawOnMinimap(lua_State *L)
|
static int libd_drawOnMinimap(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x, y, scale; // coordinates of the object
|
fixed_t x, y, scale; // coordinates of the object
|
||||||
|
|
@ -585,22 +587,12 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||||
|
|
||||||
// variables used to replicate k_kart's mmap drawer:
|
// variables used to replicate k_kart's mmap drawer:
|
||||||
patch_t *AutomapPic;
|
patch_t *AutomapPic;
|
||||||
INT32 mx, my;
|
|
||||||
INT32 splitflags, minimaptrans;
|
|
||||||
|
|
||||||
// base position of the minimap which also takes splits into account:
|
|
||||||
INT32 MM_X, MM_Y;
|
|
||||||
|
|
||||||
// variables used for actually drawing the icon:
|
// variables used for actually drawing the icon:
|
||||||
fixed_t amnumxpos, amnumypos;
|
position_t amnumpos;
|
||||||
INT32 amxpos, amypos;
|
INT32 minimapflags;
|
||||||
|
fixed_t amxpos, amypos;
|
||||||
node_t *bsp = &nodes[numnodes-1];
|
INT32 mm_x, mm_y;
|
||||||
fixed_t maxx, minx, maxy, miny;
|
|
||||||
|
|
||||||
fixed_t mapwidth, mapheight;
|
|
||||||
fixed_t xoffset, yoffset;
|
|
||||||
fixed_t xscale, yscale, zoom;
|
|
||||||
fixed_t patchw, patchh;
|
fixed_t patchw, patchh;
|
||||||
|
|
||||||
HUDONLY // only run this function in hud hooks
|
HUDONLY // only run this function in hud hooks
|
||||||
|
|
@ -612,55 +604,6 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||||
centered = lua_optboolean(L, 6);
|
centered = lua_optboolean(L, 6);
|
||||||
|
|
||||||
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
|
|
||||||
|
|
||||||
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
|
|
||||||
MM_X = BASEVIDWIDTH - 50; // 270
|
|
||||||
MM_Y = (BASEVIDHEIGHT/2)-16; // 84
|
|
||||||
if (r_splitscreen)
|
|
||||||
{
|
|
||||||
MM_Y = (BASEVIDHEIGHT/2);
|
|
||||||
if (r_splitscreen > 1) // 3P : bottom right
|
|
||||||
{
|
|
||||||
MM_X = (3*BASEVIDWIDTH/4);
|
|
||||||
MM_Y = (3*BASEVIDHEIGHT/4);
|
|
||||||
|
|
||||||
if (r_splitscreen > 2) // 4P: centered
|
|
||||||
{
|
|
||||||
MM_X = (BASEVIDWIDTH/2);
|
|
||||||
MM_Y = (BASEVIDHEIGHT/2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// splitscreen flags
|
|
||||||
splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
|
|
||||||
|
|
||||||
{
|
|
||||||
const tic_t length = TICRATE/2;
|
|
||||||
|
|
||||||
if (!lt_exitticker)
|
|
||||||
return 0;
|
|
||||||
minimaptrans = 4;
|
|
||||||
if (lt_exitticker < length)
|
|
||||||
minimaptrans = (((INT32)lt_exitticker)*minimaptrans)/((INT32)length);
|
|
||||||
if (!minimaptrans)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
|
|
||||||
splitflags |= minimaptrans;
|
|
||||||
|
|
||||||
if (!(r_splitscreen == 2))
|
|
||||||
{
|
|
||||||
splitflags &= ~minimaptrans;
|
|
||||||
splitflags |= V_HUDTRANSHALF;
|
|
||||||
}
|
|
||||||
|
|
||||||
splitflags &= ~V_HUDTRANSHALF;
|
|
||||||
splitflags |= V_HUDTRANS;
|
|
||||||
|
|
||||||
// Draw the HUD only when playing in a level.
|
// Draw the HUD only when playing in a level.
|
||||||
// hu_stuff needs this, unlike st_stuff.
|
// hu_stuff needs this, unlike st_stuff.
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
|
|
@ -669,78 +612,39 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||||
if (R_GetViewNumber() != 0)
|
if (R_GetViewNumber() != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
AutomapPic = mapheaderinfo[gamemap-1]->minimapPic;
|
AutomapPic = minimapinfo.minimap_pic;
|
||||||
|
|
||||||
if (!AutomapPic)
|
if (!AutomapPic)
|
||||||
{
|
{
|
||||||
return 0; // no pic, just get outta here
|
return 0; // no pic, just get outta here
|
||||||
}
|
}
|
||||||
|
|
||||||
mx = MM_X - (AutomapPic->width/2);
|
// Handle offsets and stuff.
|
||||||
my = MM_Y - (AutomapPic->height/2);
|
mm_x = MINI_X;
|
||||||
|
mm_y = MINI_Y - SHORT(AutomapPic->topoffset);
|
||||||
|
|
||||||
// let offsets transfer to the heads, too!
|
|
||||||
if (encoremode)
|
if (encoremode)
|
||||||
mx += SHORT(AutomapPic->leftoffset);
|
{
|
||||||
|
mm_x += SHORT(AutomapPic->leftoffset);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mx -= SHORT(AutomapPic->leftoffset);
|
{
|
||||||
my -= SHORT(AutomapPic->topoffset);
|
mm_x -= SHORT(AutomapPic->leftoffset);
|
||||||
|
}
|
||||||
|
|
||||||
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
|
// Minimap flags:
|
||||||
|
minimapflags = K_GetMinimapSplitFlags(false)|K_GetMinimapTransFlags(false);
|
||||||
// get map boundaries using nodes
|
|
||||||
maxx = maxy = INT32_MAX;
|
|
||||||
minx = miny = INT32_MIN;
|
|
||||||
minx = bsp->bbox[0][BOXLEFT];
|
|
||||||
maxx = bsp->bbox[0][BOXRIGHT];
|
|
||||||
miny = bsp->bbox[0][BOXBOTTOM];
|
|
||||||
maxy = bsp->bbox[0][BOXTOP];
|
|
||||||
|
|
||||||
if (bsp->bbox[1][BOXLEFT] < minx)
|
|
||||||
minx = bsp->bbox[1][BOXLEFT];
|
|
||||||
if (bsp->bbox[1][BOXRIGHT] > maxx)
|
|
||||||
maxx = bsp->bbox[1][BOXRIGHT];
|
|
||||||
if (bsp->bbox[1][BOXBOTTOM] < miny)
|
|
||||||
miny = bsp->bbox[1][BOXBOTTOM];
|
|
||||||
if (bsp->bbox[1][BOXTOP] > maxy)
|
|
||||||
maxy = bsp->bbox[1][BOXTOP];
|
|
||||||
|
|
||||||
// You might be wondering why these are being bitshift here
|
|
||||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
|
||||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
|
||||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
|
||||||
minx >>= FRACBITS;
|
|
||||||
maxx >>= FRACBITS;
|
|
||||||
miny >>= FRACBITS;
|
|
||||||
maxy >>= FRACBITS;
|
|
||||||
|
|
||||||
// these are our final map boundaries:
|
|
||||||
mapwidth = maxx - minx;
|
|
||||||
mapheight = maxy - miny;
|
|
||||||
|
|
||||||
// These should always be small enough to be bitshift back right now
|
|
||||||
xoffset = (minx + mapwidth/2)<<FRACBITS;
|
|
||||||
yoffset = (miny + mapheight/2)<<FRACBITS;
|
|
||||||
|
|
||||||
xscale = FixedDiv(AutomapPic->width, mapwidth);
|
|
||||||
yscale = FixedDiv(AutomapPic->height, mapheight);
|
|
||||||
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
|
|
||||||
|
|
||||||
amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom));
|
|
||||||
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
|
|
||||||
|
|
||||||
if (encoremode)
|
|
||||||
amnumxpos = -amnumxpos;
|
|
||||||
|
|
||||||
// scale patch coords
|
// scale patch coords
|
||||||
patchw = patch->width*scale /2;
|
patchw = (SHORT(patch->width) / 2) * scale;
|
||||||
patchh = patch->height*scale /2;
|
patchh = (SHORT(patch->height) / 2) * scale;
|
||||||
|
|
||||||
if (centered)
|
if (centered)
|
||||||
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
|
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
|
||||||
|
|
||||||
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
|
amnumpos = K_GetKartObjectPosToMinimapPos(x, y);
|
||||||
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
|
|
||||||
|
amxpos = amnumpos.x + (mm_x<<FRACBITS) - patchw;
|
||||||
|
amypos = amnumpos.y + (mm_y<<FRACBITS) - patchh;
|
||||||
|
|
||||||
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
|
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||||
|
|
@ -748,9 +652,9 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
if (LUA_HUD_IsDrawListValid(list))
|
if (LUA_HUD_IsDrawListValid(list))
|
||||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, minimapflags, colormap);
|
||||||
else
|
else
|
||||||
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
|
V_DrawFixedPatch(amxpos, amypos, scale, minimapflags, patch, colormap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->gateBoost);
|
lua_pushinteger(L, plr->gateBoost);
|
||||||
else if (fastcmp(field,"gatesound"))
|
else if (fastcmp(field,"gatesound"))
|
||||||
lua_pushinteger(L, plr->gateSound);
|
lua_pushinteger(L, plr->gateSound);
|
||||||
|
else if (fastcmp(field,"startboost"))
|
||||||
|
lua_pushinteger(L, plr->startboost);
|
||||||
else if (fastcmp(field,"aizdriftstraft"))
|
else if (fastcmp(field,"aizdriftstraft"))
|
||||||
lua_pushinteger(L, plr->aizdriftstrat);
|
lua_pushinteger(L, plr->aizdriftstrat);
|
||||||
else if (fastcmp(field,"aizdriftextend"))
|
else if (fastcmp(field,"aizdriftextend"))
|
||||||
|
|
@ -876,6 +878,8 @@ static int player_set(lua_State *L)
|
||||||
plr->gateBoost = luaL_checkinteger(L, 3);
|
plr->gateBoost = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"gatesound"))
|
else if (fastcmp(field,"gatesound"))
|
||||||
plr->gateSound = luaL_checkinteger(L, 3);
|
plr->gateSound = luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"startboost"))
|
||||||
|
plr->startboost = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"aizdriftstraft"))
|
else if (fastcmp(field,"aizdriftstraft"))
|
||||||
plr->aizdriftstrat = luaL_checkinteger(L, 3);
|
plr->aizdriftstrat = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"aizdrifttilt"))
|
else if (fastcmp(field,"aizdrifttilt"))
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,10 @@ sine_bob
|
||||||
fixed_t sineofs)
|
fixed_t sineofs)
|
||||||
{
|
{
|
||||||
hyu->sprzoff = FixedMul(HYU_VISUAL_HEIGHT * hyu->scale,
|
hyu->sprzoff = FixedMul(HYU_VISUAL_HEIGHT * hyu->scale,
|
||||||
sineofs + FINESINE(a >> ANGLETOFINESHIFT));
|
sineofs + FINESINE(a >> ANGLETOFINESHIFT)) * P_MobjFlip(hyu);
|
||||||
|
|
||||||
|
if (P_IsObjectFlipped(hyu))
|
||||||
|
hyu->sprzoff -= hyu->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -155,11 +158,6 @@ project_hyudoro (mobj_t *hyu)
|
||||||
|
|
||||||
hyu->z = P_GetZAt(center->standingslope, hyu->x, hyu->y,
|
hyu->z = P_GetZAt(center->standingslope, hyu->x, hyu->y,
|
||||||
P_GetMobjGround(center));
|
P_GetMobjGround(center));
|
||||||
|
|
||||||
if (P_IsObjectFlipped(hyu))
|
|
||||||
{
|
|
||||||
hyu->z -= hyu->height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "../p_local.h"
|
#include "../p_local.h"
|
||||||
#include "../p_mobj.h"
|
#include "../p_mobj.h"
|
||||||
#include "../tables.h"
|
#include "../tables.h"
|
||||||
|
#include "../k_kart.h"
|
||||||
|
|
||||||
// copied from objects/monitor.c
|
// copied from objects/monitor.c
|
||||||
#define FINE90 (FINEANGLES/4)
|
#define FINE90 (FINEANGLES/4)
|
||||||
|
|
@ -92,7 +93,10 @@ struct Aura : mobj_t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
P_MoveOrigin(this, origin()->x, origin()->y, origin()->z);
|
K_FlipFromObject(this, origin());
|
||||||
|
fixed_t flipoffset = P_IsObjectFlipped(origin()) ? origin()->height : 0;
|
||||||
|
|
||||||
|
P_MoveOrigin(this, origin()->x, origin()->y, origin()->z - flipoffset);
|
||||||
P_InstaScale(this, 11 * origin()->scale / 10);
|
P_InstaScale(this, 11 * origin()->scale / 10);
|
||||||
|
|
||||||
translate();
|
translate();
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,18 @@ void Obj_ServantHandSpawning(player_t *player)
|
||||||
player->handtimer++;
|
player->handtimer++;
|
||||||
if (player->hand == NULL && player->handtimer == TICRATE)
|
if (player->hand == NULL && player->handtimer == TICRATE)
|
||||||
{
|
{
|
||||||
|
fixed_t heightOffset = player->mo->height + 30*mapobjectscale;
|
||||||
|
if (P_IsObjectFlipped(player->mo))
|
||||||
|
{
|
||||||
|
// This counteracts the offset added by K_FlipFromObject so it looks seamless from non-flipped.
|
||||||
|
heightOffset += player->mo->height - FixedMul(player->mo->scale, player->mo->height);
|
||||||
|
heightOffset *= P_MobjFlip(player->mo); // Fleep.
|
||||||
|
}
|
||||||
|
|
||||||
mobj_t *hand = P_SpawnMobj(
|
mobj_t *hand = P_SpawnMobj(
|
||||||
player->mo->x,
|
player->mo->x,
|
||||||
player->mo->y,
|
player->mo->y,
|
||||||
player->mo->z + player->mo->height + 30*mapobjectscale,
|
player->mo->z + heightOffset,
|
||||||
MT_SERVANTHAND
|
MT_SERVANTHAND
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -116,12 +124,16 @@ void Obj_ServantHandThink(mobj_t *hand)
|
||||||
hand->color = player->skincolor;
|
hand->color = player->skincolor;
|
||||||
hand->angle = player->besthanddirection;
|
hand->angle = player->besthanddirection;
|
||||||
|
|
||||||
|
fixed_t heightOffset = player->mo->height + 30*mapobjectscale;
|
||||||
|
if (P_IsObjectFlipped(player->mo))
|
||||||
|
heightOffset *= P_MobjFlip(player->mo); // Fleep.
|
||||||
|
|
||||||
|
K_FlipFromObject(hand, player->mo);
|
||||||
P_MoveOrigin(hand,
|
P_MoveOrigin(hand,
|
||||||
player->mo->x + xoffs,
|
player->mo->x + xoffs,
|
||||||
player->mo->y + yoffs,
|
player->mo->y + yoffs,
|
||||||
player->mo->z + player->mo->height + 30*mapobjectscale
|
player->mo->z + heightOffset
|
||||||
);
|
);
|
||||||
K_FlipFromObject(hand, player->mo);
|
|
||||||
|
|
||||||
hand->sprzoff = player->mo->sprzoff;
|
hand->sprzoff = player->mo->sprzoff;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,10 @@ sine_bob
|
||||||
|
|
||||||
// slightly modified from objects/hyudoro.c
|
// slightly modified from objects/hyudoro.c
|
||||||
hyu->sprzoff = FixedMul(kBobHeight,
|
hyu->sprzoff = FixedMul(kBobHeight,
|
||||||
sineofs + FINESINE(a >> ANGLETOFINESHIFT));
|
sineofs + FINESINE(a >> ANGLETOFINESHIFT)) * P_MobjFlip(hyu);
|
||||||
|
|
||||||
|
if (P_IsObjectFlipped(hyu))
|
||||||
|
hyu->sprzoff -= hyu->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -303,6 +306,7 @@ struct Flicky : mobj_t
|
||||||
color = super_color();
|
color = super_color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
K_FlipFromObject(this, source());
|
||||||
bob_in_place(this, phase() * 8, 32);
|
bob_in_place(this, phase() * 8, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
src/p_mobj.c
17
src/p_mobj.c
|
|
@ -8355,6 +8355,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||||
P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2));
|
P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2));
|
||||||
|
|
||||||
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + mobj->target->height/2);
|
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + mobj->target->height/2);
|
||||||
|
// Taken from K_FlipFromObject. We just want to flip the visual according to its target, but that's it.
|
||||||
|
mobj->eflags = (mobj->eflags & ~MFE_VERTICALFLIP)|(mobj->target->eflags & MFE_VERTICALFLIP);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MT_BUBBLESHIELD:
|
case MT_BUBBLESHIELD:
|
||||||
|
|
@ -8461,8 +8464,14 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||||
mobj->extravalue2 = mobj->target->player->bubbleblowup;
|
mobj->extravalue2 = mobj->target->player->bubbleblowup;
|
||||||
P_SetScale(mobj, (mobj->destscale = scale));
|
P_SetScale(mobj, (mobj->destscale = scale));
|
||||||
|
|
||||||
|
// For some weird reason, the Bubble Shield is the exception flip-wise, it has the offset baked into the sprite.
|
||||||
|
// So instead of simply flipping the object, we have to do a position offset.
|
||||||
|
fixed_t positionOffset = 0;
|
||||||
|
if (P_IsObjectFlipped(mobj->target))
|
||||||
|
positionOffset -= 8 * mobj->scale;
|
||||||
|
|
||||||
mobj->flags &= ~(MF_NOCLIPTHING);
|
mobj->flags &= ~(MF_NOCLIPTHING);
|
||||||
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
|
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + positionOffset);
|
||||||
mobj->flags |= MF_NOCLIPTHING;
|
mobj->flags |= MF_NOCLIPTHING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -8550,6 +8559,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Taken from K_FlipFromObject. We just want to flip the visual according to its target, but that's it.
|
||||||
|
mobj->eflags = (mobj->eflags & ~MFE_VERTICALFLIP)|(mobj->target->eflags & MFE_VERTICALFLIP);
|
||||||
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + mobj->target->height/2);
|
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + mobj->target->height/2);
|
||||||
mobj->angle = K_MomentumAngle(mobj->target);
|
mobj->angle = K_MomentumAngle(mobj->target);
|
||||||
|
|
||||||
|
|
@ -10578,8 +10589,8 @@ void P_SceneryThinker(mobj_t *mobj)
|
||||||
if (!P_MobjWasRemoved(mobj->target))
|
if (!P_MobjWasRemoved(mobj->target))
|
||||||
{
|
{
|
||||||
// Cast like a shadow on the ground
|
// Cast like a shadow on the ground
|
||||||
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->floorz);
|
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, P_GetMobjGround(mobj->target));
|
||||||
mobj->standingslope = mobj->target->standingslope;
|
mobj->standingslope = P_IsObjectOnGround(mobj->target) ? mobj->target->standingslope : NULL;
|
||||||
|
|
||||||
if (!P_IsObjectOnGround(mobj->target) && mobj->target->momz < -24 * mapobjectscale)
|
if (!P_IsObjectOnGround(mobj->target) && mobj->target->momz < -24 * mapobjectscale)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue