mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'lua-splitscreen' into 'master'
Fix V_SPLITSCREEN for Lua HUD hooks See merge request kart-krew-dev/ring-racers!18
This commit is contained in:
commit
e3c323a20e
1 changed files with 22 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "r_fps.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
|
||||||
|
|
@ -65,6 +66,7 @@ typedef struct drawitem_s {
|
||||||
INT32 threshold;
|
INT32 threshold;
|
||||||
boolean bossmode;
|
boolean bossmode;
|
||||||
boolean p4;
|
boolean p4;
|
||||||
|
enum viewcontext_e splitnum; // save view number to account for splitscreen
|
||||||
} drawitem_t;
|
} drawitem_t;
|
||||||
|
|
||||||
// The internal structure of a drawlist.
|
// The internal structure of a drawlist.
|
||||||
|
|
@ -202,6 +204,7 @@ void LUA_HUD_AddDraw(
|
||||||
item->patch = patch;
|
item->patch = patch;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->colormap = colormap;
|
item->colormap = colormap;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawScaled(
|
void LUA_HUD_AddDrawScaled(
|
||||||
|
|
@ -223,6 +226,7 @@ void LUA_HUD_AddDrawScaled(
|
||||||
item->patch = patch;
|
item->patch = patch;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->colormap = colormap;
|
item->colormap = colormap;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawStretched(
|
void LUA_HUD_AddDrawStretched(
|
||||||
|
|
@ -246,6 +250,7 @@ void LUA_HUD_AddDrawStretched(
|
||||||
item->patch = patch;
|
item->patch = patch;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->colormap = colormap;
|
item->colormap = colormap;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawNum(
|
void LUA_HUD_AddDrawNum(
|
||||||
|
|
@ -263,6 +268,7 @@ void LUA_HUD_AddDrawNum(
|
||||||
item->y = y;
|
item->y = y;
|
||||||
item->num = num;
|
item->num = num;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawPaddedNum(
|
void LUA_HUD_AddDrawPaddedNum(
|
||||||
|
|
@ -282,6 +288,7 @@ void LUA_HUD_AddDrawPaddedNum(
|
||||||
item->num = num;
|
item->num = num;
|
||||||
item->digits = digits;
|
item->digits = digits;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawPingNum(
|
void LUA_HUD_AddDrawPingNum(
|
||||||
|
|
@ -301,6 +308,7 @@ void LUA_HUD_AddDrawPingNum(
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->num = num;
|
item->num = num;
|
||||||
item->colormap = colormap;
|
item->colormap = colormap;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawFill(
|
void LUA_HUD_AddDrawFill(
|
||||||
|
|
@ -320,6 +328,7 @@ void LUA_HUD_AddDrawFill(
|
||||||
item->w = w;
|
item->w = w;
|
||||||
item->h = h;
|
item->h = h;
|
||||||
item->c = c;
|
item->c = c;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawString(
|
void LUA_HUD_AddDrawString(
|
||||||
|
|
@ -339,6 +348,7 @@ void LUA_HUD_AddDrawString(
|
||||||
item->stroffset = CopyString(list, str);
|
item->stroffset = CopyString(list, str);
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->align = align;
|
item->align = align;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddFadeScreen(
|
void LUA_HUD_AddFadeScreen(
|
||||||
|
|
@ -352,6 +362,7 @@ void LUA_HUD_AddFadeScreen(
|
||||||
item->type = DI_FadeScreen;
|
item->type = DI_FadeScreen;
|
||||||
item->color = color;
|
item->color = color;
|
||||||
item->strength = strength;
|
item->strength = strength;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawTitleCardString(
|
void LUA_HUD_AddDrawTitleCardString(
|
||||||
|
|
@ -377,6 +388,7 @@ void LUA_HUD_AddDrawTitleCardString(
|
||||||
item->timer = timer;
|
item->timer = timer;
|
||||||
item->threshold = threshold;
|
item->threshold = threshold;
|
||||||
item->p4 = p4;
|
item->p4 = p4;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddDrawKartString(
|
void LUA_HUD_AddDrawKartString(
|
||||||
|
|
@ -394,6 +406,7 @@ void LUA_HUD_AddDrawKartString(
|
||||||
item->y = y;
|
item->y = y;
|
||||||
item->stroffset = CopyString(list, str);
|
item->stroffset = CopyString(list, str);
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddSetClipRect(
|
void LUA_HUD_AddSetClipRect(
|
||||||
|
|
@ -413,6 +426,7 @@ void LUA_HUD_AddSetClipRect(
|
||||||
item->w = w;
|
item->w = w;
|
||||||
item->h = h;
|
item->h = h;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_AddClearClipRect(
|
void LUA_HUD_AddClearClipRect(
|
||||||
|
|
@ -422,6 +436,7 @@ void LUA_HUD_AddClearClipRect(
|
||||||
size_t i = AllocateDrawItem(list);
|
size_t i = AllocateDrawItem(list);
|
||||||
drawitem_t *item = &list->items[i];
|
drawitem_t *item = &list->items[i];
|
||||||
item->type = DI_ClearClipRect;
|
item->type = DI_ClearClipRect;
|
||||||
|
item->splitnum = R_GetViewNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HUD_DrawList(huddrawlist_h list)
|
void LUA_HUD_DrawList(huddrawlist_h list)
|
||||||
|
|
@ -436,6 +451,10 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||||
{
|
{
|
||||||
drawitem_t *item = &list->items[i];
|
drawitem_t *item = &list->items[i];
|
||||||
const char *itemstr = &list->strbuf[item->stroffset];
|
const char *itemstr = &list->strbuf[item->stroffset];
|
||||||
|
enum viewcontext_e old_viewcontext = viewcontext;
|
||||||
|
|
||||||
|
// Set view context to account for V_SPLITSCREEN
|
||||||
|
R_SetViewContext(item->splitnum);
|
||||||
|
|
||||||
switch (item->type)
|
switch (item->type)
|
||||||
{
|
{
|
||||||
|
|
@ -514,5 +533,8 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||||
I_Error("can't draw draw list item: invalid draw list item type");
|
I_Error("can't draw draw list item: invalid draw list item type");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset view context back, just incase of some stupid shenanigans
|
||||||
|
R_SetViewContext(old_viewcontext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue