mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-16 17:51:27 +00:00
* AN OPPORTUNITY FOR GAMETYPE CHANGES ON THE VOTE SCREEN!
* Super important to allow dedicated servers to continue forever without needing to add Terminal. * To facilitate understanding, add gametype dog-ears to the vote screen! * To do the above, add V_DrawDiag! Works in GL, too!! * Unrelated shit! * Fix a buffer overrun in the randmapbuffer! * Disable spectating in splitscreen... Not 100% sure, but in 2p battle, if you spectate, you just lose one balloon and respawn... * Improve all the string drawing functions' behaviour - both with being SLIGHTLY clipped by the edge of the screen, and when confronted with drawing off the base 320*200 internal area
This commit is contained in:
parent
c815e3b791
commit
dcec24605e
11 changed files with 351 additions and 52 deletions
|
@ -1963,13 +1963,23 @@ void D_SetupVote(void)
|
|||
char buf[8];
|
||||
char *p = buf;
|
||||
INT32 i;
|
||||
INT16 gt = gametype;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (i == 3)
|
||||
if (i == 2) // sometimes a different gametype
|
||||
{
|
||||
WRITEUINT16(p, G_RandMap(G_TOLFlag(gt = G_SometimesGetDifferentGametype()), prevmap, false, false));
|
||||
WRITEUINT16(p, gt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 3) // unknown-random
|
||||
WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false));
|
||||
else
|
||||
WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false));
|
||||
WRITEUINT16(p, gametype);
|
||||
}
|
||||
}
|
||||
|
||||
SendNetXCmd(XD_SETUPVOTE, buf, p - buf);
|
||||
|
@ -4618,9 +4628,10 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
votelevels[i] = (INT16)READUINT16(*cp);
|
||||
if (!mapheaderinfo[votelevels[i]])
|
||||
P_AllocMapHeader(votelevels[i]);
|
||||
votelevels[i][0] = (INT16)READUINT16(*cp);
|
||||
votelevels[i][1] = (INT16)READUINT16(*cp);
|
||||
if (!mapheaderinfo[votelevels[i][0]])
|
||||
P_AllocMapHeader(votelevels[i][0]);
|
||||
}
|
||||
|
||||
G_SetGamestate(GS_VOTING);
|
||||
|
|
|
@ -455,7 +455,7 @@ extern boolean legitimateexit;
|
|||
extern boolean comebackshowninfo;
|
||||
extern tic_t curlap, bestlap;
|
||||
|
||||
extern INT16 votelevels[4];
|
||||
extern INT16 votelevels[4][2];
|
||||
extern SINT8 votes[MAXPLAYERS];
|
||||
extern SINT8 pickedvote;
|
||||
|
||||
|
|
45
src/g_game.c
45
src/g_game.c
|
@ -250,7 +250,7 @@ boolean franticitems; // Frantic items currently enabled?
|
|||
boolean comeback; // Battle Mode's karma comeback is on/off
|
||||
|
||||
// Voting system
|
||||
INT16 votelevels[4]; // Levels that were rolled by the host
|
||||
INT16 votelevels[4][2]; // Levels that were rolled by the host
|
||||
SINT8 votes[MAXPLAYERS]; // Each player's vote
|
||||
SINT8 pickedvote; // What vote the host rolls
|
||||
|
||||
|
@ -264,7 +264,7 @@ boolean legitimateexit; // Did this client actually finish the match?
|
|||
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
|
||||
tic_t curlap; // Current lap time
|
||||
tic_t bestlap; // Best lap time
|
||||
static INT16 randmapbuffer[NUMMAPS]; // Buffer for maps RandMap is allowed to roll
|
||||
static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to roll
|
||||
|
||||
tic_t hidetime;
|
||||
|
||||
|
@ -3026,7 +3026,7 @@ boolean G_GametypeHasSpectators(void)
|
|||
#if 0
|
||||
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE);
|
||||
#else
|
||||
return true;
|
||||
return (!splitscreen);//true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3040,6 +3040,37 @@ boolean G_BattleGametype(void)
|
|||
return (gametype == GT_MATCH);
|
||||
}
|
||||
|
||||
//
|
||||
// G_SometimesGetDifferentGametype
|
||||
//
|
||||
// I pity the fool who adds more gametypes later, because it'll require some element of randomisation which needs to be synched...
|
||||
//
|
||||
INT16 G_SometimesGetDifferentGametype(void)
|
||||
{
|
||||
if (randmapbuffer[NUMMAPS] != -1)
|
||||
return gametype;
|
||||
|
||||
randmapbuffer[NUMMAPS] = gametype;
|
||||
|
||||
if (gametype == GT_MATCH)
|
||||
return GT_RACE;
|
||||
return GT_MATCH;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GetGametypeColor
|
||||
//
|
||||
// Pretty and consistent ^u^
|
||||
//
|
||||
UINT8 G_GetGametypeColor(INT16 gt)
|
||||
{
|
||||
if (gt == GT_MATCH)
|
||||
return 128; // red
|
||||
if (gt == GT_RACE)
|
||||
return 215; // sky blue
|
||||
return 247; // FALLBACK
|
||||
}
|
||||
|
||||
//
|
||||
// G_RaceGametype
|
||||
//
|
||||
|
@ -3152,7 +3183,7 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb
|
|||
return G_RandMap(tolflags, pprevmap, dontadd, true); // If there's no matches, (An incredibly silly function chain, buuut... :V)
|
||||
|
||||
ix = 0; // Sorry, none match. You get MAP01.
|
||||
for (bufx = 0; bufx < NUMMAPS; bufx++)
|
||||
for (bufx = 0; bufx < NUMMAPS+1; bufx++)
|
||||
randmapbuffer[bufx] = -1; // if we're having trouble finding a map we should probably clear it
|
||||
}
|
||||
else
|
||||
|
@ -3160,7 +3191,7 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb
|
|||
ix = okmaps[M_RandomKey(numokmaps)];
|
||||
if (!dontadd)
|
||||
{
|
||||
for (bufx = NUMMAPS; bufx > 0; bufx--)
|
||||
for (bufx = NUMMAPS-1; bufx > 0; bufx--)
|
||||
randmapbuffer[bufx] = randmapbuffer[bufx-1];
|
||||
randmapbuffer[0] = ix;
|
||||
}
|
||||
|
@ -3293,7 +3324,7 @@ static void G_DoCompleted(void)
|
|||
|
||||
if (randmapbuffer[TOLMaps(G_TOLFlag(gametype))-4] != -1) // we're getting pretty full, so lets clear it
|
||||
{
|
||||
for (i = 0; i < NUMMAPS; i++)
|
||||
for (i = 0; i < NUMMAPS+1; i++)
|
||||
randmapbuffer[i] = -1;
|
||||
}
|
||||
|
||||
|
@ -3947,7 +3978,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, U
|
|||
COM_BufAddText("stopdemo\n");
|
||||
ghosts = NULL;
|
||||
|
||||
for (i = 0; i < NUMMAPS; i++)
|
||||
for (i = 0; i < NUMMAPS+1; i++)
|
||||
randmapbuffer[i] = -1;
|
||||
|
||||
// this leave the actual game if needed
|
||||
|
|
|
@ -183,6 +183,8 @@ boolean G_GametypeUsesLives(void);
|
|||
boolean G_GametypeHasTeams(void);
|
||||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_BattleGametype(void);
|
||||
INT16 G_SometimesGetDifferentGametype(void);
|
||||
UINT8 G_GetGametypeColor(INT16 gt);
|
||||
boolean G_RaceGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
void G_ExitLevel(void);
|
||||
|
|
|
@ -904,6 +904,98 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawDiag : draw flat coloured rectangle, with no texture
|
||||
// -----------------+
|
||||
void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
|
||||
if (wh < 0)
|
||||
return; // consistency w/ software
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
// |/ |
|
||||
// 0--1
|
||||
|
||||
fx = (float)x;
|
||||
fy = (float)y;
|
||||
fw = fh = (float)wh;
|
||||
|
||||
if (!(color & V_NOSCALESTART))
|
||||
{
|
||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||
|
||||
fx *= dupx;
|
||||
fy *= dupy;
|
||||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (vid.width != BASEVIDWIDTH * vid.dupx)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// same thing here
|
||||
if (color & V_SNAPTOBOTTOM)
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
else if (!(color & 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) -- oh gee oh boy oh shit
|
||||
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[2].x = v[3].x = fx;
|
||||
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 = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
|
|
@ -52,6 +52,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum);
|
|||
void HWR_CreateStaticLightmaps(INT32 bspnum);
|
||||
void HWR_PrepLevelCache(size_t pnumtextures);
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
||||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
||||
|
||||
void HWR_AddCommands(void);
|
||||
|
|
|
@ -5120,7 +5120,7 @@ void K_drawKartHUD(void)
|
|||
// Draw a white fade on level opening
|
||||
if (leveltime < 15 && stplyr == &players[displayplayer])
|
||||
{
|
||||
if (leveltime < 5)
|
||||
if (leveltime <= 5)
|
||||
V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,120); // Pure white on first three frames, to hide SRB2's awful level load artifacts
|
||||
else
|
||||
V_DrawFadeScreen(120, 15-leveltime); // Then gradually fade out from there
|
||||
|
|
|
@ -3209,7 +3209,10 @@ static void P_NetArchiveMisc(void)
|
|||
WRITEINT16(save_p, lastmap);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
WRITEINT16(save_p, votelevels[i]);
|
||||
{
|
||||
WRITEINT16(save_p, votelevels[i][0]);
|
||||
WRITEINT16(save_p, votelevels[i][1]);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
WRITESINT8(save_p, votes[i]);
|
||||
|
@ -3306,7 +3309,10 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
lastmap = READINT16(save_p);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
votelevels[i] = READINT16(save_p);
|
||||
{
|
||||
votelevels[i][0] = READINT16(save_p);
|
||||
votelevels[i][1] = READINT16(save_p);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
votes[i] = READSINT8(save_p);
|
||||
|
|
164
src/v_video.c
164
src/v_video.c
|
@ -837,7 +837,104 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
c &= 255;
|
||||
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, (UINT8)(c&255), w * vid.bpp);
|
||||
memset(dest, c, w * vid.bpp);
|
||||
}
|
||||
|
||||
//
|
||||
// Fills a triangle of pixels with a single color, NOTE: scaled to screen size
|
||||
//
|
||||
// ...
|
||||
// .. <-- this shape only for now, i'm afraid
|
||||
// .
|
||||
//
|
||||
void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
|
||||
{
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
INT32 w, h, wait = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && !con_startup)
|
||||
{
|
||||
HWR_DrawDiag(x, y, wh, c);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(c & V_NOSCALESTART))
|
||||
{
|
||||
INT32 dupx = vid.dupx, dupy = vid.dupy;
|
||||
|
||||
x *= dupx;
|
||||
y *= dupy;
|
||||
wh *= dupx;
|
||||
|
||||
// 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 (y < 0)
|
||||
{
|
||||
wh += y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
w = h = wh;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
w += x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (w <= 0 || h <= 0)
|
||||
return; // zero width/height wouldn't draw anything
|
||||
if (x + w > vid.width)
|
||||
{
|
||||
wait = w - (vid.width - x);
|
||||
w = vid.width - x;
|
||||
}
|
||||
if (y + w > vid.height)
|
||||
h = vid.height - y;
|
||||
|
||||
if (h > w)
|
||||
h = w;
|
||||
|
||||
dest = screens[0] + y*vid.width + x;
|
||||
deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
c &= 255;
|
||||
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
{
|
||||
memset(dest, c, w * vid.bpp);
|
||||
if (wait)
|
||||
wait--;
|
||||
else
|
||||
w--;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1144,7 +1241,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||
//
|
||||
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth = BASEVIDWIDTH, center = 0;
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
|
@ -1160,7 +1257,11 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
|
@ -1221,9 +1322,9 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx;
|
||||
|
||||
if (cx + w > scrwidth)
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx < 0) //left boundary check
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
|
@ -1239,7 +1340,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
// SRB2kart
|
||||
void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth = BASEVIDWIDTH, center = 0;
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
|
@ -1255,7 +1356,11 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
|
@ -1316,9 +1421,9 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
else
|
||||
w = SHORT(kart_font[c]->width) * dupx;
|
||||
|
||||
if (cx + w > scrwidth)
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx < 0) //left boundary check
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
|
@ -1350,7 +1455,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
|
|||
//
|
||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth = BASEVIDWIDTH, center = 0;
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
|
@ -1366,7 +1471,11 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
|
@ -1425,9 +1534,9 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
}
|
||||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx / 2;
|
||||
if (cx + w > scrwidth)
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx < 0) //left boundary check
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
|
@ -1452,7 +1561,7 @@ void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *s
|
|||
//
|
||||
void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth = BASEVIDWIDTH;
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
|
@ -1468,7 +1577,11 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
|
@ -1525,9 +1638,9 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
else
|
||||
w = (SHORT(tny_font[c]->width) * dupx);
|
||||
|
||||
if (cx + w > scrwidth)
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx < 0) //left boundary check
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
|
@ -1550,7 +1663,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
|
|||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth = BASEVIDWIDTH, center = 0;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 spacewidth = 4, charwidth = 0;
|
||||
|
||||
|
@ -1564,7 +1677,11 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
|
@ -1618,9 +1735,9 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
|||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx;
|
||||
|
||||
if ((cx>>FRACBITS) + w > scrwidth)
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
break;
|
||||
if (cx < 0) //left boundary check
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w<<FRACBITS;
|
||||
continue;
|
||||
|
@ -1720,7 +1837,7 @@ void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string)
|
|||
}
|
||||
|
||||
w = SHORT(cred_font[c]->width) * dupx;
|
||||
if ((cx>>FRACBITS) + w > scrwidth)
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
break;
|
||||
|
||||
V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT);
|
||||
|
@ -1756,7 +1873,7 @@ INT32 V_CreditStringWidth(const char *string)
|
|||
//
|
||||
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth = BASEVIDWIDTH;
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0;
|
||||
const char *ch = string;
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
|
@ -1766,7 +1883,11 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -1788,11 +1909,10 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
}
|
||||
|
||||
w = SHORT(lt_font[c]->width) * dupx;
|
||||
if (cx + w > scrwidth)
|
||||
break;
|
||||
|
||||
//left boundary check
|
||||
if (cx < 0)
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx + left < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
|
|
|
@ -139,6 +139,8 @@ void V_DrawScaledPic (INT32 px1, INT32 py1, INT32 scrn, INT32 lumpnum);
|
|||
|
||||
// fill a box with a single color
|
||||
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
||||
// fill a triangle with a single color
|
||||
void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c);
|
||||
// fill a box with a flat as a pattern
|
||||
void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum);
|
||||
|
||||
|
|
|
@ -173,6 +173,8 @@ static void Y_UnloadData(void);
|
|||
typedef struct
|
||||
{
|
||||
char str[40];
|
||||
UINT8 gtc;
|
||||
const char *gts;
|
||||
patch_t *pic;
|
||||
} y_votelvlinfo;
|
||||
|
||||
|
@ -2185,9 +2187,7 @@ void Y_VoteDrawer(void)
|
|||
{
|
||||
char str[40];
|
||||
patch_t *pic;
|
||||
UINT8 sizeadd = selected[i];
|
||||
UINT8 j;
|
||||
UINT8 color;
|
||||
UINT8 sizeadd = selected[i], j, color, gtc = levelinfo[i].gtc;
|
||||
|
||||
if (i == 3)
|
||||
{
|
||||
|
@ -2262,11 +2262,26 @@ void Y_VoteDrawer(void)
|
|||
|
||||
V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, pic);
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 40+y, V_SNAPTORIGHT, str);
|
||||
{
|
||||
INT32 w = 0;
|
||||
if (levelinfo[i].gts)
|
||||
{
|
||||
w = V_StringWidth(levelinfo[i].gts, V_SNAPTORIGHT)+2;
|
||||
V_DrawFill(BASEVIDWIDTH-100, y+9, w+1, 2, V_SNAPTORIGHT|31);
|
||||
V_DrawFill(BASEVIDWIDTH-100, y, w, 10, V_SNAPTORIGHT|gtc);
|
||||
V_DrawString(BASEVIDWIDTH-99, y+1, V_SNAPTORIGHT, levelinfo[i].gts);
|
||||
}
|
||||
V_DrawDiag(BASEVIDWIDTH-100+w+1, y, 11, V_SNAPTORIGHT|31);
|
||||
V_DrawDiag(BASEVIDWIDTH-100+w, y, 10, V_SNAPTORIGHT|gtc);
|
||||
}
|
||||
|
||||
y += 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawTinyScaledPatch(BASEVIDWIDTH-60, y, V_SNAPTORIGHT, pic);
|
||||
V_DrawDiag(BASEVIDWIDTH-60, y, 8, V_SNAPTORIGHT|31);
|
||||
V_DrawDiag(BASEVIDWIDTH-60, y, 6, V_SNAPTORIGHT|gtc);
|
||||
y += 25;
|
||||
}
|
||||
|
||||
|
@ -2284,6 +2299,7 @@ void Y_VoteDrawer(void)
|
|||
if ((playeringame[i] && !players[i].spectator) && votes[i] != -1)
|
||||
{
|
||||
patch_t *pic;
|
||||
UINT8 gtc = levelinfo[votes[i]].gtc;
|
||||
|
||||
if (votes[i] == 3 && (i != pickedvote || voteendtic == -1))
|
||||
pic = randomlvl;
|
||||
|
@ -2300,6 +2316,8 @@ void Y_VoteDrawer(void)
|
|||
}
|
||||
|
||||
V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, pic);
|
||||
V_DrawDiag(x, y, 8, V_SNAPTOLEFT|31);
|
||||
V_DrawDiag(x, y, 6, V_SNAPTOLEFT|gtc);
|
||||
|
||||
if (players[i].skincolor == 0)
|
||||
V_DrawSmallScaledPatch(x+24, y+9, V_SNAPTOLEFT, faceprefix[players[i].skin]);
|
||||
|
@ -2564,40 +2582,51 @@ void Y_StartVote(void)
|
|||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
lumpnum_t lumpnum;
|
||||
INT16 j;
|
||||
|
||||
// set up the str
|
||||
if (strlen(mapheaderinfo[votelevels[i]]->zonttl) > 0)
|
||||
if (strlen(mapheaderinfo[votelevels[i][0]]->zonttl) > 0)
|
||||
{
|
||||
if (strlen(mapheaderinfo[votelevels[i]]->actnum) > 0)
|
||||
if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0)
|
||||
snprintf(levelinfo[i].str,
|
||||
sizeof levelinfo[i].str,
|
||||
"%.32s %.32s %s",
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->zonttl, mapheaderinfo[votelevels[i]]->actnum);
|
||||
mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl, mapheaderinfo[votelevels[i][0]]->actnum);
|
||||
else
|
||||
snprintf(levelinfo[i].str,
|
||||
sizeof levelinfo[i].str,
|
||||
"%.32s %.32s",
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->zonttl);
|
||||
mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(mapheaderinfo[votelevels[i]]->actnum) > 0)
|
||||
if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0)
|
||||
snprintf(levelinfo[i].str,
|
||||
sizeof levelinfo[i].str,
|
||||
"%.32s %s",
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->actnum);
|
||||
mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum);
|
||||
else
|
||||
snprintf(levelinfo[i].str,
|
||||
sizeof levelinfo[i].str,
|
||||
"%.32s",
|
||||
mapheaderinfo[votelevels[i]]->lvlttl);
|
||||
mapheaderinfo[votelevels[i][0]]->lvlttl);
|
||||
}
|
||||
|
||||
levelinfo[i].str[sizeof levelinfo[i].str - 1] = '\0';
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i]+1)));
|
||||
// set up the gtc and gts
|
||||
levelinfo[i].gtc = G_GetGametypeColor(votelevels[i][1]);
|
||||
levelinfo[i].gts = NULL;
|
||||
for (j = 0; gametype_cons_t[j].strvalue; j++)
|
||||
{
|
||||
if (gametype_cons_t[j].value == votelevels[i][1])
|
||||
levelinfo[i].gts = gametype_cons_t[j].strvalue;
|
||||
}
|
||||
|
||||
// set up the pic
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i]+1)), PU_STATIC);
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_STATIC);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_STATIC);
|
||||
}
|
||||
|
@ -2691,6 +2720,11 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level)
|
|||
}
|
||||
|
||||
pickedvote = pick;
|
||||
nextmap = votelevels[level];
|
||||
nextmap = votelevels[level][0];
|
||||
if (gametype != votelevels[level][1])
|
||||
{
|
||||
//CONS_Printf("yer dun\n"); -- if we want to do anything else special for a gametype switch, it'd be here
|
||||
gametype = votelevels[level][1];
|
||||
}
|
||||
timer = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue