mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-19 14:32:34 +00:00
Server Browser last-minute adjustments
- Menu string for server count
- Thin string for server name
- Gear instead of difficulty (renamed to keep the old assets just in case online GP)
- Pwr fixes
- Handle -1 case as "No Pwr"
- Adjust draw coords a little
- Custom gametype support
- Shows name as net-communicated instead of Pwr
- Affects d_clisrv side a little bit too
- All custom gametypes MUST show up on the Modded room, no exceptions
- Cache gametype info instead of constant strcmp
This commit is contained in:
parent
2a8ddd4a40
commit
0aaf5649dd
4 changed files with 105 additions and 26 deletions
|
|
@ -1537,15 +1537,16 @@ static boolean SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||||
i = SL_SearchServer(node);
|
i = SL_SearchServer(node);
|
||||||
if (i == UINT32_MAX)
|
if (i == UINT32_MAX)
|
||||||
{
|
{
|
||||||
// not found add it
|
// not found, check for packet format rejections
|
||||||
|
|
||||||
if (serverlistcount >= MAXSERVERLIST)
|
if (serverlistcount >= MAXSERVERLIST)
|
||||||
return false; // list full
|
return false; // list full
|
||||||
|
|
||||||
if (info->_255 != 255)
|
if (info->_255 != 255)
|
||||||
return false;/* old packet format */
|
return false; // old packet format
|
||||||
|
|
||||||
if (info->packetversion != PACKETVERSION)
|
if (info->packetversion != PACKETVERSION)
|
||||||
return false;/* old new packet format */
|
return false; // old new packet format
|
||||||
|
|
||||||
if (info->version != VERSION)
|
if (info->version != VERSION)
|
||||||
return false; // Not same version.
|
return false; // Not same version.
|
||||||
|
|
@ -1554,16 +1555,40 @@ static boolean SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||||
return false; // Close, but no cigar.
|
return false; // Close, but no cigar.
|
||||||
|
|
||||||
if (strcmp(info->application, SRB2APPLICATION))
|
if (strcmp(info->application, SRB2APPLICATION))
|
||||||
return false;/* that's a different mod */
|
return false; // that's a different mod
|
||||||
|
}
|
||||||
|
|
||||||
if (serverlistultimatecount && info->modifiedgame != (mpmenu.room == 1))
|
const INT32 gtidentifier = G_GetGametypeByName(info->gametypename);
|
||||||
return false;/* CORE vs MODDED! But only on the server browser page. */
|
UINT8 gtcalc = GTCALC_RACE;
|
||||||
|
if (gtidentifier != GT_RACE)
|
||||||
|
{
|
||||||
|
gtcalc = (gtidentifier == GT_BATTLE) ? GTCALC_BATTLE : GTCALC_CUSTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == UINT32_MAX)
|
||||||
|
{
|
||||||
|
// Still not added to list... check for modifiedgame rejections
|
||||||
|
if (serverlistultimatecount)
|
||||||
|
{
|
||||||
|
// We're on the server browser page. We can reject based on our room.
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
info->modifiedgame != false // self-declared
|
||||||
|
|| (gtcalc == GTCALC_CUSTOM) // not a main two gametype
|
||||||
|
) != (mpmenu.room == 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return false; // CORE vs MODDED!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ok, FINALLY now we can confirm
|
||||||
i = serverlistcount++;
|
i = serverlistcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
serverlist[i].info = *info;
|
serverlist[i].info = *info;
|
||||||
serverlist[i].node = node;
|
serverlist[i].node = node;
|
||||||
|
serverlist[i].cachedgtcalc = gtcalc;
|
||||||
|
|
||||||
// resort server list
|
// resort server list
|
||||||
M_SortServerList();
|
M_SortServerList();
|
||||||
|
|
|
||||||
|
|
@ -459,10 +459,14 @@ struct doomdata_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXSERVERLIST (MAXNETNODES-1)
|
#define MAXSERVERLIST (MAXNETNODES-1)
|
||||||
|
#define GTCALC_RACE 0
|
||||||
|
#define GTCALC_BATTLE 1
|
||||||
|
#define GTCALC_CUSTOM 2
|
||||||
struct serverelem_t
|
struct serverelem_t
|
||||||
{
|
{
|
||||||
SINT8 node;
|
SINT8 node;
|
||||||
serverinfo_pak info;
|
serverinfo_pak info;
|
||||||
|
UINT8 cachedgtcalc;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern serverelem_t serverlist[MAXSERVERLIST];
|
extern serverelem_t serverlist[MAXSERVERLIST];
|
||||||
|
|
|
||||||
|
|
@ -4151,7 +4151,7 @@ static void M_DrawServerCountAndHorizontalBar(void)
|
||||||
|
|
||||||
if (throbindex == UINT8_MAX)
|
if (throbindex == UINT8_MAX)
|
||||||
{
|
{
|
||||||
V_DrawRightAlignedString(
|
V_DrawRightAlignedMenuString(
|
||||||
BASEVIDWIDTH - currentMenu->x,
|
BASEVIDWIDTH - currentMenu->x,
|
||||||
y,
|
y,
|
||||||
highlightflags,
|
highlightflags,
|
||||||
|
|
@ -4160,7 +4160,7 @@ static void M_DrawServerCountAndHorizontalBar(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
V_DrawRightAlignedString(
|
V_DrawRightAlignedMenuString(
|
||||||
BASEVIDWIDTH - currentMenu->x - 12, y,
|
BASEVIDWIDTH - currentMenu->x - 12, y,
|
||||||
highlightflags,
|
highlightflags,
|
||||||
text
|
text
|
||||||
|
|
@ -4186,11 +4186,15 @@ void M_DrawMPServerBrowser(void)
|
||||||
patch_t *text1 = W_CachePatchName("MENUBGT1", PU_CACHE);
|
patch_t *text1 = W_CachePatchName("MENUBGT1", PU_CACHE);
|
||||||
patch_t *text2 = W_CachePatchName("MENUBGT2", PU_CACHE);
|
patch_t *text2 = W_CachePatchName("MENUBGT2", PU_CACHE);
|
||||||
|
|
||||||
patch_t *raceh = W_CachePatchName("M_SERV1", PU_CACHE);
|
UINT8 i;
|
||||||
patch_t *batlh = W_CachePatchName("M_SERV2", PU_CACHE);
|
|
||||||
|
|
||||||
patch_t *racehs = W_CachePatchName("M_SERV12", PU_CACHE);
|
patch_t *servpats[3];
|
||||||
patch_t *batlhs = W_CachePatchName("M_SERV22", PU_CACHE);
|
patch_t *gearpats[3];
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
servpats[i] = W_CachePatchName(va("M_SERV%c", i + '1'), PU_CACHE);
|
||||||
|
gearpats[i] = W_CachePatchName(va("M_SGEAR%c", i + '1'), PU_CACHE);
|
||||||
|
}
|
||||||
|
|
||||||
fixed_t text1loop = SHORT(text1->height)*FRACUNIT;
|
fixed_t text1loop = SHORT(text1->height)*FRACUNIT;
|
||||||
fixed_t text2loop = SHORT(text2->width)*FRACUNIT;
|
fixed_t text2loop = SHORT(text2->width)*FRACUNIT;
|
||||||
|
|
@ -4199,7 +4203,6 @@ void M_DrawMPServerBrowser(void)
|
||||||
const UINT8 basey = 56;
|
const UINT8 basey = 56;
|
||||||
const INT32 starty = basey - 18*mpmenu.scrolln + mpmenu.slide;
|
const INT32 starty = basey - 18*mpmenu.scrolln + mpmenu.slide;
|
||||||
INT32 ypos = 0;
|
INT32 ypos = 0;
|
||||||
UINT8 i;
|
|
||||||
|
|
||||||
// background stuff
|
// background stuff
|
||||||
V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName(header[mode][1], PU_CACHE), NULL);
|
V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName(header[mode][1], PU_CACHE), NULL);
|
||||||
|
|
@ -4221,8 +4224,6 @@ void M_DrawMPServerBrowser(void)
|
||||||
// the actual server list.
|
// the actual server list.
|
||||||
for (i = 0; i < serverlistcount; i++)
|
for (i = 0; i < serverlistcount; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
boolean racegt = strcmp(serverlist[i].info.gametypename, "Race") == 0;
|
|
||||||
INT32 transflag = 0;
|
INT32 transflag = 0;
|
||||||
INT32 basetransflag = 0;
|
INT32 basetransflag = 0;
|
||||||
|
|
||||||
|
|
@ -4242,13 +4243,23 @@ void M_DrawMPServerBrowser(void)
|
||||||
{
|
{
|
||||||
transflag = transflag << V_ALPHASHIFT; // shift the translucency flag.
|
transflag = transflag << V_ALPHASHIFT; // shift the translucency flag.
|
||||||
|
|
||||||
if (itemOn == 2 && mpmenu.servernum == i)
|
if (serverlist[i].cachedgtcalc < 3)
|
||||||
V_DrawFixedPatch(startx*FRACUNIT, (starty + ypos)*FRACUNIT, FRACUNIT, transflag, racegt ? racehs : batlhs, NULL);
|
{
|
||||||
else
|
patch_t *focus;
|
||||||
V_DrawFixedPatch(startx*FRACUNIT, (starty + ypos)*FRACUNIT, FRACUNIT, transflag, racegt ? raceh : batlh, NULL);
|
if (itemOn == 2 && mpmenu.servernum == i)
|
||||||
|
{
|
||||||
|
focus = W_CachePatchName(va("M_SERH%c", serverlist[i].cachedgtcalc + '1'), PU_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
focus = servpats[serverlist[i].cachedgtcalc];
|
||||||
|
}
|
||||||
|
|
||||||
|
V_DrawFixedPatch(startx*FRACUNIT, (starty + ypos)*FRACUNIT, FRACUNIT, transflag, focus, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// Server name:
|
// Server name:
|
||||||
V_DrawString(startx+11, starty + ypos + 6, transflag, serverlist[i].info.servername);
|
V_DrawThinString(startx+11, starty + ypos + 6, transflag, serverlist[i].info.servername);
|
||||||
|
|
||||||
// Ping:
|
// Ping:
|
||||||
V_DrawThinString(startx + 191, starty + ypos + 7, transflag, va("%03d", serverlist[i].info.time));
|
V_DrawThinString(startx + 191, starty + ypos + 7, transflag, va("%03d", serverlist[i].info.time));
|
||||||
|
|
@ -4256,16 +4267,34 @@ void M_DrawMPServerBrowser(void)
|
||||||
// Playercount
|
// Playercount
|
||||||
V_DrawThinString(startx + 214, starty + ypos + 7, transflag, va("%02d/%02d", serverlist[i].info.numberofplayer, serverlist[i].info.maxplayer));
|
V_DrawThinString(startx + 214, starty + ypos + 7, transflag, va("%02d/%02d", serverlist[i].info.numberofplayer, serverlist[i].info.maxplayer));
|
||||||
|
|
||||||
// Power Level
|
const char *pwrtext;
|
||||||
V_DrawThinString(startx + 248, starty + ypos, transflag, va("%04d PLv", serverlist[i].info.avgpwrlv));
|
if (serverlist[i].cachedgtcalc == GTCALC_CUSTOM)
|
||||||
|
{
|
||||||
|
// Show custom gametype name
|
||||||
|
// (custom PWR is not available, and this is the best place to show the name)
|
||||||
|
pwrtext = serverlist[i].info.gametypename;
|
||||||
|
}
|
||||||
|
else if (serverlist[i].info.avgpwrlv != -1)
|
||||||
|
{
|
||||||
|
// Power Level
|
||||||
|
pwrtext = va("%04d Pwr", serverlist[i].info.avgpwrlv);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Fallback
|
||||||
|
pwrtext = "No Pwr";
|
||||||
|
}
|
||||||
|
V_DrawRightAlignedThinString(startx + 276, starty + ypos, transflag, pwrtext);
|
||||||
|
|
||||||
// game speed if applicable:
|
// game speed if applicable:
|
||||||
if (racegt)
|
if (serverlist[i].cachedgtcalc != GTCALC_BATTLE)
|
||||||
{
|
{
|
||||||
UINT8 speed = serverlist[i].info.kartvars & SV_SPEEDMASK;
|
UINT8 speed = serverlist[i].info.kartvars & SV_SPEEDMASK;
|
||||||
patch_t *pp = W_CachePatchName(va("M_SDIFF%d", speed), PU_CACHE);
|
|
||||||
|
|
||||||
V_DrawFixedPatch((startx + 251)*FRACUNIT, (starty + ypos + 9)*FRACUNIT, FRACUNIT, transflag, pp, NULL);
|
if (speed < 3)
|
||||||
|
{
|
||||||
|
V_DrawFixedPatch((startx + 251)*FRACUNIT, (starty + ypos + 9)*FRACUNIT, FRACUNIT, transflag, gearpats[speed], NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ypos += SERVERSPACE;
|
ypos += SERVERSPACE;
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,28 @@ void M_ServerListFillDebug(void)
|
||||||
|
|
||||||
strcpy(serverlist[i].info.servername, va("Serv %d", i+1));
|
strcpy(serverlist[i].info.servername, va("Serv %d", i+1));
|
||||||
|
|
||||||
strcpy(serverlist[i].info.gametypename, i & 1 ? "Race" : "Battle");
|
const char *tempgtname;
|
||||||
|
if (i < 10 && mpmenu.room == 1)
|
||||||
|
{
|
||||||
|
tempgtname = va("%c%c%c%c",
|
||||||
|
'A' + M_RandomKey(26),
|
||||||
|
'a' + M_RandomKey(26),
|
||||||
|
'a' + M_RandomKey(26),
|
||||||
|
'a' + M_RandomKey(26)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tempgtname = (i & 1) ? "Race" : "Battle";
|
||||||
|
|
||||||
|
strcpy(serverlist[i].info.gametypename, tempgtname);
|
||||||
|
|
||||||
|
const INT32 gtidentifier = G_GetGametypeByName(tempgtname);
|
||||||
|
UINT8 gtcalc = GTCALC_RACE;
|
||||||
|
if (gtidentifier != GT_RACE)
|
||||||
|
{
|
||||||
|
gtcalc = (gtidentifier == GT_BATTLE) ? GTCALC_BATTLE : GTCALC_CUSTOM;
|
||||||
|
}
|
||||||
|
serverlist[i].cachedgtcalc = gtcalc;
|
||||||
|
|
||||||
serverlist[i].info.kartvars = M_RandomRange(0, 3) & SV_SPEEDMASK;
|
serverlist[i].info.kartvars = M_RandomRange(0, 3) & SV_SPEEDMASK;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue