From b45d7cd653cab5f72c1a4077f77cac10b6c685a1 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 19 May 2022 19:10:38 +0100 Subject: [PATCH] Grey out non-demo servers if playing with demo pak0 - don't allow players to even start a MP game on a non-demo server - fixed the website url - updated the message about the demo in the main menu --- .../app/src/main/cpp/code/q3_ui/ui_credits.c | 2 +- android/app/src/main/cpp/code/q3_ui/ui_menu.c | 2 +- .../app/src/main/cpp/code/q3_ui/ui_servers2.c | 47 +++++++++++++++---- .../app/src/main/cpp/code/qcommon/q_math.c | 4 +- .../app/src/main/cpp/code/qcommon/q_shared.h | 8 +++- 5 files changed, 49 insertions(+), 14 deletions(-) diff --git a/android/app/src/main/cpp/code/q3_ui/ui_credits.c b/android/app/src/main/cpp/code/q3_ui/ui_credits.c index f7b16c92..1a510685 100644 --- a/android/app/src/main/cpp/code/q3_ui/ui_credits.c +++ b/android/app/src/main/cpp/code/q3_ui/ui_credits.c @@ -163,7 +163,7 @@ Special Thanks to the whole discord! UI_DrawProportionalString(320, y, "original ioquake3 contributors!", UI_CENTER | UI_SMALLFONT, color_orange); } - UI_DrawString( 320, 459, "Quake3Quest: https://www.quake3.quakevr.com/", UI_CENTER|UI_SMALLFONT, color_red ); + UI_DrawString( 320, 459, "Quake3Quest: https://quake3.quakevr.com/", UI_CENTER|UI_SMALLFONT, color_red ); } diff --git a/android/app/src/main/cpp/code/q3_ui/ui_menu.c b/android/app/src/main/cpp/code/q3_ui/ui_menu.c index 1d7d5120..8b7cda21 100644 --- a/android/app/src/main/cpp/code/q3_ui/ui_menu.c +++ b/android/app/src/main/cpp/code/q3_ui/ui_menu.c @@ -229,7 +229,7 @@ static void Main_MenuDraw( void ) { int yPos = 410; if (uis.demoversion) { yPos = 372; - UI_DrawString( 320, yPos, "Demo: Play the 1st tier of SP or MP on our demo servers", UI_CENTER|UI_SMALLFONT, color_white ); + UI_DrawString( 320, yPos, "DEMO: You can only play on Demo-Servers and play first part of SP!", UI_CENTER|UI_SMALLFONT, color_white ); yPos += SMALLCHAR_HEIGHT; UI_DrawString( 320, yPos, "Install full game for more!", UI_CENTER|UI_SMALLFONT, color_white ); yPos += SMALLCHAR_HEIGHT; diff --git a/android/app/src/main/cpp/code/q3_ui/ui_servers2.c b/android/app/src/main/cpp/code/q3_ui/ui_servers2.c index bb6d4654..29ebde52 100644 --- a/android/app/src/main/cpp/code/q3_ui/ui_servers2.c +++ b/android/app/src/main/cpp/code/q3_ui/ui_servers2.c @@ -194,6 +194,7 @@ typedef struct servernode_s { int minPing; int maxPing; qboolean bPB; + qboolean demo; } servernode_t; @@ -395,7 +396,6 @@ static void ArenaServers_UpdatePicture( void ) { servernodeptr = g_arenaservers.table[g_arenaservers.list.curvalue].servernode; Com_sprintf( picname, sizeof(picname), "levelshots/%s.tga", servernodeptr->mapname ); g_arenaservers.mappic.generic.name = picname; - } // force shader update during draw @@ -490,9 +490,6 @@ static void ArenaServers_UpdateMenu( void ) { g_arenaservers.punkbuster.generic.flags &= ~QMF_GRAYED; } - //Specify should always be grayed out - g_arenaservers.specify.generic.flags |= QMF_GRAYED; - // zero out list box g_arenaservers.list.numitems = 0; g_arenaservers.list.curvalue = 0; @@ -503,7 +500,17 @@ static void ArenaServers_UpdateMenu( void ) { return; } - // build list box strings - apply culling filters + //Specify should always be grayed out + g_arenaservers.specify.generic.flags |= QMF_GRAYED; + + servernode_t* servernode; + servernode = g_arenaservers.table[g_arenaservers.list.curvalue].servernode; + if( servernode && uis.demoversion && !servernode->demo) { + //Demo pak cannot connect to a non-demo server + g_arenaservers.go.generic.flags |= QMF_GRAYED; + } + + // build list box strings - apply culling filters servernodeptr = g_arenaservers.serverlist; count = *g_arenaservers.numservers; for( i = 0, j = 0; i < count; i++, servernodeptr++ ) { @@ -565,10 +572,20 @@ static void ArenaServers_UpdateMenu( void ) { pingColor = S_COLOR_RED; } - Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %4s%s%3d " S_COLOR_YELLOW "%s", - servernodeptr->hostname, servernodeptr->mapname, servernodeptr->numclients, - servernodeptr->maxclients, servernodeptr->gamename, - netnames[servernodeptr->nettype], pingColor, servernodeptr->pingtime, servernodeptr->bPB ? "Yes" : "No" ); + if (uis.demoversion && !servernodeptr->demo) + { + Com_sprintf( buff, MAX_LISTBOXWIDTH, S_COLOR_MID_GREY "%-20.20s %-12.12s %2d/%2d %-8.8s %4s%s%3d " S_COLOR_YELLOW "%s", + servernodeptr->hostname, servernodeptr->mapname, servernodeptr->numclients, + servernodeptr->maxclients, servernodeptr->gamename, + netnames[servernodeptr->nettype], pingColor, servernodeptr->pingtime, servernodeptr->bPB ? "Yes" : "No" ); + } + else + { + Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %4s%s%3d " S_COLOR_YELLOW "%s", + servernodeptr->hostname, servernodeptr->mapname, servernodeptr->numclients, + servernodeptr->maxclients, servernodeptr->gamename, + netnames[servernodeptr->nettype], pingColor, servernodeptr->pingtime, servernodeptr->bPB ? "Yes" : "No" ); + } j++; } @@ -685,6 +702,7 @@ static void ArenaServers_Insert( char* adrstr, char* info, int pingtime ) servernodeptr->minPing = atoi( Info_ValueForKey( info, "minPing") ); servernodeptr->maxPing = atoi( Info_ValueForKey( info, "maxPing") ); servernodeptr->bPB = atoi( Info_ValueForKey( info, "punkbuster") ); + servernodeptr->demo = (strcasestr(info, "demo") != NULL); /* s = Info_ValueForKey( info, "nettype" ); @@ -1242,6 +1260,17 @@ static void ArenaServers_Event( void* ptr, int event ) { case ID_LIST: if( event == QM_GOTFOCUS ) { ArenaServers_UpdatePicture(); + + servernode_t* servernode; + servernode = g_arenaservers.table[g_arenaservers.list.curvalue].servernode; + if( servernode && uis.demoversion && !servernode->demo) { + //Demo pak cannot connect to a non-demo server + g_arenaservers.go.generic.flags |= QMF_GRAYED; + } + else + { + g_arenaservers.go.generic.flags &= ~QMF_GRAYED; + } } break; diff --git a/android/app/src/main/cpp/code/qcommon/q_math.c b/android/app/src/main/cpp/code/qcommon/q_math.c index 8e48545f..4b65fd8b 100644 --- a/android/app/src/main/cpp/code/qcommon/q_math.c +++ b/android/app/src/main/cpp/code/qcommon/q_math.c @@ -47,7 +47,7 @@ vec4_t colorLtGrey = {0.75, 0.75, 0.75, 1}; vec4_t colorMdGrey = {0.5, 0.5, 0.5, 1}; vec4_t colorDkGrey = {0.25, 0.25, 0.25, 1}; -vec4_t g_color_table[8] = +vec4_t g_color_table[10] = { {0.0, 0.0, 0.0, 1.0}, {1.0, 0.0, 0.0, 1.0}, @@ -57,6 +57,8 @@ vec4_t g_color_table[8] = {0.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 1.0, 1.0}, + {0.75, 0.75, 0.75, 1.0}, + {0.5, 0.5, 0.5, 1.0}, }; diff --git a/android/app/src/main/cpp/code/qcommon/q_shared.h b/android/app/src/main/cpp/code/qcommon/q_shared.h index 2794c2fc..95c62ead 100644 --- a/android/app/src/main/cpp/code/qcommon/q_shared.h +++ b/android/app/src/main/cpp/code/qcommon/q_shared.h @@ -431,7 +431,9 @@ qboolean Q_IsColorString(const char *p); // ^[0-9a-zA-Z] #define COLOR_CYAN '5' #define COLOR_MAGENTA '6' #define COLOR_WHITE '7' -#define ColorIndexForNumber(c) ((c) & 0x07) +#define COLOR_LIGHT_GREY '8' +#define COLOR_MID_GREY '9' +#define ColorIndexForNumber(c) ((c) & 0x0f) #define ColorIndex(c) (ColorIndexForNumber((c) - '0')) #define S_COLOR_BLACK "^0" @@ -442,8 +444,10 @@ qboolean Q_IsColorString(const char *p); // ^[0-9a-zA-Z] #define S_COLOR_CYAN "^5" #define S_COLOR_MAGENTA "^6" #define S_COLOR_WHITE "^7" +#define S_COLOR_LIGHT_GREY "^8" +#define S_COLOR_MID_GREY "^9" -extern vec4_t g_color_table[8]; +extern vec4_t g_color_table[10]; #define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b #define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a