mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 12:21:19 +00:00
Fix errors from merge
This commit is contained in:
parent
daec4f9f7e
commit
49f2d65e95
9 changed files with 83 additions and 805 deletions
|
@ -51,7 +51,7 @@ static void COM_Wait_f(void);
|
|||
static void COM_Help_f(void);
|
||||
static void COM_Toggle_f(void);
|
||||
|
||||
#if USE_VERSION_FILTERING
|
||||
#ifdef USE_VERSION_FILTERING
|
||||
static void CV_EnforceExecVersion(void);
|
||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
||||
#endif
|
||||
|
|
|
@ -281,6 +281,7 @@ consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_
|
|||
I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
#ifdef LJOYSTICK
|
||||
|
@ -798,15 +799,6 @@ void D_RegisterClientCommands(void)
|
|||
//CV_RegisterVar(&cv_alwaysfreelook2);
|
||||
//CV_RegisterVar(&cv_chasefreelook);
|
||||
//CV_RegisterVar(&cv_chasefreelook2);
|
||||
CV_RegisterVar(&cv_chatbacktint);
|
||||
CV_RegisterVar(&cv_consolechat);
|
||||
CV_RegisterVar(&cv_chatnotifications);
|
||||
CV_RegisterVar(&cv_crosshair);
|
||||
CV_RegisterVar(&cv_crosshair2);
|
||||
CV_RegisterVar(&cv_alwaysfreelook);
|
||||
CV_RegisterVar(&cv_alwaysfreelook2);
|
||||
CV_RegisterVar(&cv_chasefreelook);
|
||||
CV_RegisterVar(&cv_chasefreelook2);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_turnaxis);
|
||||
|
|
|
@ -1450,6 +1450,12 @@ INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify)
|
|||
|
||||
static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT32 *keynum1, INT32 *keynum2, boolean *nestedoverride)
|
||||
{
|
||||
#ifndef USE_VERSION_FILTERING
|
||||
(void)numctrl;
|
||||
(void)player;
|
||||
(void)nestedoverride;
|
||||
#endif
|
||||
|
||||
// Special case: ignore KEY_PAUSE because it's hardcoded
|
||||
if (keyidx == 0 && *keynum1 == KEY_PAUSE)
|
||||
{
|
||||
|
@ -1573,9 +1579,18 @@ static void setcontrol(INT32 (*gc)[2])
|
|||
INT32 numctrl;
|
||||
const char *namectrl;
|
||||
INT32 keynum, keynum1, keynum2;
|
||||
INT32 player = ((void*)gc == (void*)&gamecontrolbis ? 1 : 0);
|
||||
INT32 player;
|
||||
boolean nestedoverride = false;
|
||||
|
||||
if ((void*)gc == (void*)&gamecontrol4)
|
||||
player = 3;
|
||||
else if ((void*)gc == (void*)&gamecontrol3)
|
||||
player = 2;
|
||||
else if ((void*)gc == (void*)&gamecontrolbis)
|
||||
player = 1;
|
||||
else
|
||||
player = 0;
|
||||
|
||||
namectrl = COM_Argv(1);
|
||||
for (numctrl = 0; numctrl < num_gamecontrols && stricmp(namectrl, gamecontrolname[numctrl]);
|
||||
numctrl++)
|
||||
|
@ -1664,7 +1679,7 @@ void Command_Setcontrol3_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrol3, na);
|
||||
setcontrol(gamecontrol3);
|
||||
}
|
||||
|
||||
void Command_Setcontrol4_f(void)
|
||||
|
@ -1679,5 +1694,5 @@ void Command_Setcontrol4_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrol4, na);
|
||||
}
|
||||
setcontrol(gamecontrol4);
|
||||
}
|
||||
|
|
|
@ -797,111 +797,6 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
|||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -------------------+
|
||||
// HWR_DrawConsoleFill : draw flat coloured transparent rectangle because that's cool, and hw sucks less than sw for that.
|
||||
// -------------------+
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
return; // consistency w/ software
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
// |/ |
|
||||
// 0--1
|
||||
|
||||
fx = (float)x;
|
||||
fy = (float)y;
|
||||
fw = (float)w;
|
||||
fh = (float)h;
|
||||
|
||||
if (!(options & V_NOSCALESTART))
|
||||
{
|
||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||
|
||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||
{
|
||||
RGBA_t rgbaColour = V_GetColor(color);
|
||||
FRGBAFloat clearColour;
|
||||
clearColour.red = (float)rgbaColour.s.red / 255;
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
fx *= dupx;
|
||||
fy *= dupy;
|
||||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
{
|
||||
if (options & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(options & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (options & V_SNAPTOBOTTOM)
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
else if (!(options & V_SNAPTOTOP))
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (fx >= vid.width || fy >= vid.height)
|
||||
return;
|
||||
if (fx < 0)
|
||||
{
|
||||
fw += fx;
|
||||
fx = 0;
|
||||
}
|
||||
if (fy < 0)
|
||||
{
|
||||
fh += fy;
|
||||
fy = 0;
|
||||
}
|
||||
|
||||
if (fw <= 0 || fh <= 0)
|
||||
return;
|
||||
if (fx + fw > vid.width)
|
||||
fw = (float)vid.width - fx;
|
||||
if (fy + fh > vid.height)
|
||||
fh = (float)vid.height - fy;
|
||||
|
||||
fx = -1 + fx / (vid.width / 2);
|
||||
fy = 1 - fy / (vid.height / 2);
|
||||
fw = fw / (vid.width / 2);
|
||||
fh = fh / (vid.height / 2);
|
||||
|
||||
v[0].x = v[3].x = fx;
|
||||
v[2].x = v[1].x = fx + fw;
|
||||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawFill : draw flat coloured rectangle, with no texture
|
||||
// -----------------+
|
||||
|
@ -1055,14 +950,14 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (vid.width != BASEVIDWIDTH * vid.dupx)
|
||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
{
|
||||
if (options & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(options & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (options & V_SNAPTOBOTTOM)
|
||||
|
@ -1114,7 +1009,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
|
||||
|
@ -1151,14 +1046,14 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (vid.width != BASEVIDWIDTH * vid.dupx)
|
||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
{
|
||||
if (color & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
else if (!(color & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (color & V_SNAPTOBOTTOM)
|
||||
|
|
526
src/hu_stuff.c
526
src/hu_stuff.c
|
@ -435,7 +435,6 @@ void HU_AddChatText(const char *text, boolean playsound)
|
|||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
|
||||
|
||||
static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
{
|
||||
XBOXSTATIC char buf[254];
|
||||
|
@ -477,8 +476,8 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
|||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
char *nodenum = (char*) malloc(3);
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
|
||||
strncpy(nodenum, msg+3, 3);
|
||||
// check for undesirable characters in our "number"
|
||||
|
@ -1282,7 +1281,6 @@ boolean HU_Responder(event_t *ev)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//======================================================================
|
||||
// HEADS UP DRAWING
|
||||
//======================================================================
|
||||
|
@ -1307,7 +1305,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||
for (i = 0; i < slen; ++i)
|
||||
{
|
||||
c = newstring[i];
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
|
||||
continue;
|
||||
|
||||
if (c == '\n')
|
||||
|
@ -1368,8 +1366,8 @@ static void HU_drawMiniChat(void)
|
|||
if (!chat_nummsg_min)
|
||||
return; // needless to say it's useless to do anything if we don't have anything to draw.
|
||||
|
||||
/*if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);*/
|
||||
if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);
|
||||
|
||||
for (; i>0; i--)
|
||||
{
|
||||
|
@ -1419,13 +1417,13 @@ static void HU_drawMiniChat(void)
|
|||
|
||||
y = chaty - charheight*(msglines+1);
|
||||
|
||||
/*if (splitscreen)
|
||||
if (splitscreen)
|
||||
{
|
||||
y -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
y += 16;
|
||||
}*/
|
||||
y -= (G_RingSlingerGametype() ? 16 : 0);
|
||||
}
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
|
@ -1500,6 +1498,7 @@ static void HU_drawChatLog(INT32 offset)
|
|||
INT32 x = chatx+2, y, dx = 0, dy = 0;
|
||||
UINT32 i = 0;
|
||||
INT32 chat_topy, chat_bottomy;
|
||||
INT32 highlight = HU_GetHighlightColor();
|
||||
boolean atbottom = false;
|
||||
|
||||
// make sure that our scroll position isn't "illegal";
|
||||
|
@ -1524,8 +1523,9 @@ static void HU_drawChatLog(INT32 offset)
|
|||
if (splitscreen > 1)
|
||||
y += 16;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
y -= (G_RingSlingerGametype() ? 16 : 0);
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
|
||||
chat_topy = y + chat_scroll*charheight;
|
||||
|
@ -1588,10 +1588,10 @@ static void HU_drawChatLog(INT32 offset)
|
|||
|
||||
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
|
||||
chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
|
||||
if (chat_maxscroll <= (UINT32)cv_chatheight.value)
|
||||
if (chat_maxscroll <= (UINT32)boxh)
|
||||
chat_maxscroll = 0;
|
||||
else
|
||||
chat_maxscroll -= cv_chatheight.value;
|
||||
chat_maxscroll -= boxh;
|
||||
|
||||
// if we're not bound by the time, autoscroll for next frame:
|
||||
if (atbottom)
|
||||
|
@ -1599,9 +1599,9 @@ static void HU_drawChatLog(INT32 offset)
|
|||
|
||||
// draw arrows to indicate that we can (or not) scroll.
|
||||
if (chat_scroll > 0)
|
||||
V_DrawThinString(chatx-8, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1A"); // up arrow
|
||||
V_DrawThinString(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, "\x1A"); // up arrow
|
||||
if (chat_scroll < chat_maxscroll)
|
||||
V_DrawThinString(chatx-8, chat_bottomy-((justscrolleddown) ? 5 : 6), V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1B"); // down arrow
|
||||
V_DrawThinString(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6), V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, "\x1B"); // down arrow
|
||||
|
||||
justscrolleddown = false;
|
||||
justscrolledup = false;
|
||||
|
@ -1634,8 +1634,9 @@ static void HU_DrawChat(void)
|
|||
boxw = max(64, boxw/2);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
y -= (G_RingSlingerGametype() ? 16 : 0);
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
if (teamtalk)
|
||||
{
|
||||
|
@ -1727,8 +1728,9 @@ static void HU_DrawChat(void)
|
|||
if (splitscreen > 1)
|
||||
p_dispy += 16;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
p_dispy -= (G_RingSlingerGametype() ? 16 : 0);
|
||||
p_dispy -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
i = 0;
|
||||
for(i=0; (i<MAXPLAYERS); i++)
|
||||
|
@ -1799,6 +1801,7 @@ static void HU_DrawChat(void)
|
|||
|
||||
// For anyone who, for some godforsaken reason, likes oldchat.
|
||||
|
||||
|
||||
static void HU_DrawChat_Old(void)
|
||||
{
|
||||
INT32 t = 0, c = 0, y = HU_INPUTY;
|
||||
|
@ -1818,18 +1821,20 @@ static void HU_DrawChat_Old(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < slen; ++i)
|
||||
while (talk[i])
|
||||
{
|
||||
c = newstring[i];
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
|
||||
continue;
|
||||
|
||||
if (c == '\n')
|
||||
if (talk[i] < HU_FONTSTART)
|
||||
{
|
||||
x = 0;
|
||||
lastusablespace = 0;
|
||||
continue;
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
//charwidth = SHORT(hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c, y+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
|
@ -1848,479 +1853,24 @@ static void HU_DrawChat_Old(void)
|
|||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
{
|
||||
chw = charwidth;
|
||||
lastusablespace = i;
|
||||
}
|
||||
else
|
||||
chw = charwidth;
|
||||
|
||||
x += chw;
|
||||
|
||||
if (lastusablespace != 0 && x > w)
|
||||
{
|
||||
//CONS_Printf("Wrap at index %d\n", i);
|
||||
newstring[lastusablespace] = '\n';
|
||||
i = lastusablespace+1;
|
||||
lastusablespace = 0;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
|
||||
|
||||
// chat stuff by VincyTM LOL XD!
|
||||
|
||||
// HU_DrawMiniChat
|
||||
|
||||
static void HU_drawMiniChat(void)
|
||||
{
|
||||
INT32 x = chatx+2;
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value;
|
||||
INT32 dx = 0, dy = 0;
|
||||
size_t i = chat_nummsg_min;
|
||||
boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place.
|
||||
|
||||
INT32 msglines = 0;
|
||||
// process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has...
|
||||
INT32 y;
|
||||
|
||||
if (!chat_nummsg_min)
|
||||
return; // needless to say it's useless to do anything if we don't have anything to draw.
|
||||
|
||||
if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);
|
||||
|
||||
for (; i>0; i--)
|
||||
{
|
||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||
size_t j = 0;
|
||||
INT32 linescount = 0;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
if (!prev_linereturn)
|
||||
{
|
||||
linescount += 1;
|
||||
dx = 0;
|
||||
}
|
||||
prev_linereturn = true;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
}
|
||||
prev_linereturn = false;
|
||||
dx += charwidth;
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
linescount += 1;
|
||||
}
|
||||
}
|
||||
dy = 0;
|
||||
dx = 0;
|
||||
msglines += linescount+1;
|
||||
}
|
||||
|
||||
y = chaty - charheight*(msglines+1);
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
y -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
y += 16;
|
||||
}
|
||||
else
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
i = 0;
|
||||
prev_linereturn = false;
|
||||
|
||||
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
|
||||
size_t j = 0;
|
||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
if (!prev_linereturn)
|
||||
{
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
prev_linereturn = true;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
colormap = V_GetStringColormap(clrflag);
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cv_chatbacktint.value) // on request of wolfy
|
||||
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
|
||||
}
|
||||
|
||||
dx += charwidth;
|
||||
prev_linereturn = false;
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
// decrement addy and make that shit smooth:
|
||||
addy /= 2;
|
||||
|
||||
}
|
||||
|
||||
// HU_DrawChatLog
|
||||
// TODO: fix dumb word wrapping issues
|
||||
|
||||
static void HU_drawChatLog(INT32 offset)
|
||||
{
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value, boxh = cv_chatheight.value;
|
||||
INT32 x = chatx+2, y, dx = 0, dy = 0;
|
||||
UINT32 i = 0;
|
||||
INT32 chat_topy, chat_bottomy;
|
||||
INT32 highlight = HU_GetHighlightColor();
|
||||
boolean atbottom = false;
|
||||
|
||||
// make sure that our scroll position isn't "illegal";
|
||||
if (chat_scroll > chat_maxscroll)
|
||||
chat_scroll = chat_maxscroll;
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
boxh = max(6, boxh/2);
|
||||
if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);
|
||||
}
|
||||
|
||||
y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12;
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
y -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
y += 16;
|
||||
}
|
||||
else
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
chat_topy = y + chat_scroll*charheight;
|
||||
chat_bottomy = chat_topy + boxh*charheight;
|
||||
|
||||
V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
|
||||
|
||||
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 j = 0;
|
||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
||||
UINT8 *colormap = NULL;
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
colormap = V_GetStringColormap(clrflag);
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, !cv_allcaps.value, colormap);
|
||||
else
|
||||
j++; // don't forget to increment this or we'll get stuck in the limbo.
|
||||
}
|
||||
|
||||
dx += charwidth;
|
||||
if (dx >= boxw-charwidth-2 && i<chat_nummsg_log && msg[j] >= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!!
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||
{
|
||||
atbottom = true; // we should scroll
|
||||
}
|
||||
chat_scrollmedown = false;
|
||||
|
||||
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
|
||||
chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
|
||||
if (chat_maxscroll <= (UINT32)boxh)
|
||||
chat_maxscroll = 0;
|
||||
else
|
||||
chat_maxscroll -= boxh;
|
||||
|
||||
// if we're not bound by the time, autoscroll for next frame:
|
||||
if (atbottom)
|
||||
chat_scroll = chat_maxscroll;
|
||||
|
||||
// draw arrows to indicate that we can (or not) scroll.
|
||||
|
||||
if (chat_scroll > 0)
|
||||
{
|
||||
V_DrawCharacter(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)),
|
||||
'\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // up arrow
|
||||
}
|
||||
if (chat_scroll < chat_maxscroll)
|
||||
{
|
||||
V_DrawCharacter(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6),
|
||||
'\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // down arrow
|
||||
}
|
||||
|
||||
justscrolleddown = false;
|
||||
justscrolledup = false;
|
||||
}
|
||||
|
||||
//
|
||||
// HU_DrawChat
|
||||
//
|
||||
// Draw chat input
|
||||
//
|
||||
|
||||
static INT16 typelines = 1; // number of drawfill lines we need. it's some weird hack and might be one frame off but I'm lazy to make another loop.
|
||||
static void HU_DrawChat(void)
|
||||
{
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value;
|
||||
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
|
||||
UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
|
||||
INT32 cflag = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Team: ";
|
||||
const char *talk = ntalk;
|
||||
const char *mute = "Chat has been muted.";
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
y -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
y += 16;
|
||||
boxw = max(64, boxw/2);
|
||||
}
|
||||
}
|
||||
else
|
||||
y -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
|
||||
if (teamtalk)
|
||||
{
|
||||
talk = ttalk;
|
||||
#if 0
|
||||
if (players[consoleplayer].ctfteam == 1)
|
||||
t = 0x500; // Red
|
||||
else if (players[consoleplayer].ctfteam == 2)
|
||||
t = 0x400; // Blue
|
||||
#endif
|
||||
}
|
||||
|
||||
if (CHAT_MUTE)
|
||||
{
|
||||
talk = mute;
|
||||
typelines = 1;
|
||||
cflag = V_GRAYMAP; // set text in gray if chat is muted.
|
||||
}
|
||||
|
||||
V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT);
|
||||
|
||||
while (talk[i])
|
||||
{
|
||||
if (talk[i] < HU_FONTSTART)
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawChatCharacter(chatx + c + 2, y, talk[i] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|cflag, !cv_allcaps.value, V_GetStringColormap(talk[i]|cflag));
|
||||
i++;
|
||||
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
}
|
||||
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
// if chat is muted, just draw the log and get it over with:
|
||||
if (CHAT_MUTE)
|
||||
{
|
||||
HU_drawChatLog(0);
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
typelines = 1;
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
|
||||
while (w_chat[i])
|
||||
{
|
||||
boolean skippedline = false;
|
||||
if (c_input == (i+1))
|
||||
{
|
||||
int cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
|
||||
int cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
||||
if (hu_tick < 4)
|
||||
V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
|
||||
if (cursorx == chatx+1 && saylen == i) // a weirdo hack
|
||||
{
|
||||
typelines += 1;
|
||||
skippedline = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
++i;
|
||||
else
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||
|
||||
c += charwidth;
|
||||
if (c > boxw-(charwidth*2) && !skippedline)
|
||||
if (c >= vid.width)
|
||||
{
|
||||
c = 0;
|
||||
y += charheight;
|
||||
typelines += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// handle /pm list.
|
||||
if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
{
|
||||
INT32 count = 0;
|
||||
INT32 p_dispy = chaty - charheight -1;
|
||||
if (splitscreen)
|
||||
{
|
||||
p_dispy -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
p_dispy += 16;
|
||||
}
|
||||
else
|
||||
p_dispy -= (cv_kartspeedometer.value ? 16 : 0);
|
||||
i = 0;
|
||||
for(i=0; (i<MAXPLAYERS); i++)
|
||||
{
|
||||
|
||||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat[3])
|
||||
{
|
||||
char *nodenum;
|
||||
UINT32 n;
|
||||
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
|
||||
break;
|
||||
|
||||
|
||||
nodenum = (char*) malloc(3);
|
||||
strncpy(nodenum, w_chat+3, 4);
|
||||
n = atoi((const char*) nodenum); // turn that into a number
|
||||
// special cases:
|
||||
|
||||
if ((n == 0) && !(w_chat[4] == '0'))
|
||||
{
|
||||
if (!(i<10))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 1) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 1) || ((i >= 10) && (i <= 19))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 2) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 2) || ((i >= 20) && (i <= 29))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 3) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 3) || ((i >= 30) && (i <= 31))))
|
||||
continue;
|
||||
}
|
||||
else // general case.
|
||||
{
|
||||
if (i != n)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (playeringame[i])
|
||||
{
|
||||
char name[MAXPLAYERNAME+1];
|
||||
strlcpy(name, player_names[i], 7); // shorten name to 7 characters.
|
||||
V_DrawFillConsoleMap(chatx+ boxw + 2, p_dispy- (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud.
|
||||
V_DrawSmallString(chatx+ boxw + 4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x82%d\x80 - %s", i, name));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0) // no results.
|
||||
{
|
||||
V_DrawFillConsoleMap(chatx-50, p_dispy- (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud.
|
||||
V_DrawSmallString(chatx-48, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT.");
|
||||
}
|
||||
}
|
||||
|
||||
HU_drawChatLog(typelines-1); // typelines is the # of lines we're typing. If there's more than 1 then the log should scroll up to give us more space.
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// draw the Crosshair, at the exact center of the view.
|
||||
//
|
||||
|
@ -3012,7 +2562,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
x += BASEVIDWIDTH/2;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//
|
||||
// HU_Draw32TabRankings
|
||||
|
@ -3141,7 +2691,7 @@ void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds)
|
|||
|
||||
if (pemeralds & EMERALD7)
|
||||
V_DrawSmallScaledPatch(x, y, 0, tinyemeraldpics[6]);
|
||||
}
|
||||
}*/
|
||||
|
||||
//
|
||||
// HU_DrawSpectatorTicker
|
||||
|
|
|
@ -446,7 +446,7 @@ void Command_LoadConfig_f(void)
|
|||
|
||||
// load default control
|
||||
G_ClearAllControlKeys();
|
||||
G_Controldefault();
|
||||
G_Controldefault(0);
|
||||
|
||||
// temporarily reset execversion to default
|
||||
#ifdef USE_VERSION_FILTERING
|
||||
|
|
|
@ -7938,9 +7938,8 @@ void P_FindEmerald(void)
|
|||
//
|
||||
static void P_DeathThink(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
player->deltaviewheight = 0;
|
||||
//ticcmd_t *cmd = &player->cmd;
|
||||
//player->deltaviewheight = 0;
|
||||
|
||||
if (player->deadtimer < INT32_MAX)
|
||||
player->deadtimer++;
|
||||
|
|
35
src/r_main.c
35
src/r_main.c
|
@ -1053,29 +1053,11 @@ void R_SkyboxFrame(player_t *player)
|
|||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
// recalc necessary stuff for mouseaiming
|
||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||
// (lmps, network and use F12...)
|
||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
||||
|
||||
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
||||
|
||||
yslope = &yslopetab[(3*viewheight/2) - dy];
|
||||
}
|
||||
centery = (viewheight/2) + dy;
|
||||
centeryfrac = centery<<FRACBITS;
|
||||
|
||||
R_SetupFreelook();
|
||||
}
|
||||
|
||||
void R_SetupFrame(player_t *player, boolean skybox)
|
||||
{
|
||||
INT32 dy = 0;
|
||||
camera_t *thiscam;
|
||||
boolean chasecam = false;
|
||||
|
||||
|
@ -1198,23 +1180,6 @@ void R_SetupFrame(player_t *player, boolean skybox)
|
|||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
// recalc necessary stuff for mouseaiming
|
||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||
// (lmps, network and use F12...)
|
||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
||||
|
||||
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
||||
|
||||
yslope = &yslopetab[(3*viewheight/2) - dy];
|
||||
}
|
||||
centery = (viewheight/2) + dy;
|
||||
centeryfrac = centery<<FRACBITS;
|
||||
|
||||
R_SetupFreelook();
|
||||
}
|
||||
|
||||
|
|
170
src/v_video.c
170
src/v_video.c
|
@ -893,14 +893,12 @@ static UINT32 V_GetHWConsBackColor(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
// THANK YOU MPC!!!
|
||||
|
||||
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest;
|
||||
INT32 u, v;
|
||||
UINT8 *fadetable;
|
||||
UINT32 alphalevel = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
|
@ -985,18 +983,24 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
|
||||
c &= 255;
|
||||
|
||||
// Jimita (12-04-2018)
|
||||
w = min(w, vid.width);
|
||||
h = min(h, vid.height);
|
||||
fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
for (v = 0; v < h; v++, dest += vid.width)
|
||||
for (u = 0; u < w; u++)
|
||||
{
|
||||
if (!alphalevel)
|
||||
if (!alphalevel) {
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = consolebgmap[dest[u]];
|
||||
else
|
||||
dest[u] = fadetable[consolebgmap[dest[u]]];
|
||||
}
|
||||
}
|
||||
} else { // mpc 12-04-2018
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
#define clip(x,y) (x>y) ? y : x
|
||||
w = clip(w,vid.width);
|
||||
h = clip(h,vid.height);
|
||||
#undef clip
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = fadetable[consolebgmap[dest[u]]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1100,148 +1104,6 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
// This is now a function since it's otherwise repeated 2 times and honestly looks retarded:
|
||||
static UINT32 V_GetHWConsBackColor(void)
|
||||
{
|
||||
UINT32 hwcolor;
|
||||
switch (cons_backcolor.value)
|
||||
{
|
||||
case 0: hwcolor = 0xffffff00; break; // White
|
||||
case 1: hwcolor = 0x80808000; break; // Gray
|
||||
case 2: hwcolor = 0xdeb88700; break; // Sepia
|
||||
case 3: hwcolor = 0x40201000; break; // Brown
|
||||
case 4: hwcolor = 0xfa807200; break; // Pink
|
||||
case 5: hwcolor = 0xff69b400; break; // Raspberry
|
||||
case 6: hwcolor = 0xff000000; break; // Red
|
||||
case 7: hwcolor = 0xffd68300; break; // Creamsicle
|
||||
case 8: hwcolor = 0xff800000; break; // Orange
|
||||
case 9: hwcolor = 0xdaa52000; break; // Gold
|
||||
case 10: hwcolor = 0x80800000; break; // Yellow
|
||||
case 11: hwcolor = 0x00ff0000; break; // Emerald
|
||||
case 12: hwcolor = 0x00800000; break; // Green
|
||||
case 13: hwcolor = 0x4080ff00; break; // Cyan
|
||||
case 14: hwcolor = 0x4682b400; break; // Steel
|
||||
case 15: hwcolor = 0x1e90ff00; break; // Periwinkle
|
||||
case 16: hwcolor = 0x0000ff00; break; // Blue
|
||||
case 17: hwcolor = 0xff00ff00; break; // Purple
|
||||
case 18: hwcolor = 0xee82ee00; break; // Lavender
|
||||
// Default green
|
||||
default: hwcolor = 0x00800000; break;
|
||||
}
|
||||
return hwcolor;
|
||||
}
|
||||
#endif
|
||||
|
||||
// THANK YOU MPC!!!
|
||||
|
||||
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest;
|
||||
INT32 u, v;
|
||||
UINT32 alphalevel = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
UINT32 hwcolor = V_GetHWConsBackColor();
|
||||
HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(c & V_NOSCALESTART))
|
||||
{
|
||||
INT32 dupx = vid.dupx, dupy = vid.dupy;
|
||||
|
||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
|
||||
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
|
||||
return;
|
||||
}
|
||||
|
||||
x *= dupx;
|
||||
y *= dupy;
|
||||
w *= dupx;
|
||||
h *= dupy;
|
||||
|
||||
// Center it if necessary
|
||||
if (vid.width != BASEVIDWIDTH * dupx)
|
||||
{
|
||||
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
|
||||
// so center this imaginary screen
|
||||
if (c & V_SNAPTORIGHT)
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx));
|
||||
else if (!(c & V_SNAPTOLEFT))
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
{
|
||||
// same thing here
|
||||
if (c & V_SNAPTOBOTTOM)
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy));
|
||||
else if (!(c & V_SNAPTOTOP))
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (x >= vid.width || y >= vid.height)
|
||||
return; // off the screen
|
||||
if (x < 0) {
|
||||
w += x;
|
||||
x = 0;
|
||||
}
|
||||
if (y < 0) {
|
||||
h += y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if (w <= 0 || h <= 0)
|
||||
return; // zero width/height wouldn't draw anything
|
||||
if (x + w > vid.width)
|
||||
w = vid.width-x;
|
||||
if (y + h > vid.height)
|
||||
h = vid.height-y;
|
||||
|
||||
dest = screens[0] + y*vid.width + x;
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[cv_translucenthud.value];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - cv_translucenthud.value;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[cv_translucenthud.value];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
}
|
||||
|
||||
c &= 255;
|
||||
|
||||
if (!alphalevel) {
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = consolebgmap[dest[u]];
|
||||
}
|
||||
}
|
||||
} else { // mpc 12-04-2018
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
#define clip(x,y) (x>y) ? y : x
|
||||
w = clip(w,vid.width);
|
||||
h = clip(h,vid.height);
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = fadetable[consolebgmap[dest[u]]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fills a box of pixels using a flat texture as a pattern, scaled to screen size.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue