Menu-FN: Make the Internet server browser refresh more useful

This commit is contained in:
Marco Cawthorne 2020-10-27 00:21:53 +01:00
parent de0f6b7e81
commit 90478acec4
9 changed files with 132 additions and 40 deletions

View File

@ -13,3 +13,5 @@ Unless other games benefit from this, keep it seperate to one of the game
sub-directories.
That's about it.
Join us on #freecs at irc.freenode.org

55
doc/faq
View File

@ -1,4 +1,4 @@
NUCLIDE SOURCE TREE FAQ
NUCLIDE FREQUENTLY ASKED QUESTIONS
Q: Why does this project exist?
A: I wanted a free variant of the best version of Counter-Strike in 2016 as
@ -22,6 +22,8 @@ A: It depends. If you've got crashes etc. to report that are really bad
If a crash to console happens, it's most likely my bug. If the whole engine
comes crashing down, it's FTEQW's fault. Not mine.
FREECS SPECIFIC:
Q: It doesn't work with my Half-Life/Counter-Strike version.
A: This is designed for the disc version of Half-Life, released before Steam.
Supporting both is a bit annoying right now. I might add support for the
@ -29,9 +31,6 @@ A: This is designed for the disc version of Half-Life, released before Steam.
work, the backend is constantly changing still and I can't afford to support
all these things at once.
Q: I don't like how you're doing [insert thing here]!
A: Too bad!
Q: Why Counter-Strike 1.5? Not any earlier/later version?
A: The best and last free to distribute version, no shield, no gambling.
@ -50,13 +49,29 @@ A: Other mods. They do kinda keep the codebase in check too, since
there's a lot of shared code between them and they do help keep specifics
into their own source tree.
Q: Make a wiki/discord/youtube/twitter/facebook etc. and spend time on
maintaining that, instead of working on the project, to build 'hype'.
A: I'm sure you are the first one to suggest such an idea... No thanks.
Q: [insert thing here] isn't 100% exact as in the original 1.5.
A: Sometimes bugs get fixed, sometimes very minor details get streamlined in
order to get more work done in other areas. FreeCS will most likely never
be done in that accuracy aspect, but it'll get better with time.
Feel free to contribute when it comes to low-hanging fruit like tweaking
variables! Trust me, plenty of people come and go and they seem to be really
distressed when a weapon damage is off by few hitpoints. I know.
Q: X#sh3D? Why not use that instead of FTE QuakeWorld?
A: There are enough GPL violators around, I do not need to contribute to that
cesspool. 'From scratch' my a$$.
Q: Why do this when you can just run a VM?
A: FreeCS isn't just making CS more portable. It also fixes bugs. It optimises
the netcode greatly. It's got much better lag compensation and client-side
player and weapon prediction than CS ever did. Yes, even the Steam version.
Q: I still don't get it - why not play CS on Steam?
A: This is clearly not intended for you, then!
Q: Will you make Nuclide's supported games available on Google Play?
A: No. If you can manually copy over the content (that I legally cannot and will
not ever distribute with the project) onto your internal phone/tablet memory
then you can also install FTEQW's official .apk - which may I remind you is
a completely different project entirely.
DEVELOPMENT:
Q: Is FTEQW a GoldSrc replacement?
A: No. It is not aiming to be anything like that. FTE has been around for
@ -65,17 +80,11 @@ A: No. It is not aiming to be anything like that. FTE has been around for
You can easily make very modern games with it too. It's not limited like
GoldSrc and Source in terms of rendering as it's fully accessible.
Q: [insert thing here] isn't 100% exact as in the original 1.5.
A: Sometimes bugs get fixed, sometimes very minor details get streamlined in
order to get more work done in other areas. FreeCS will most likely never
be done in that accuracy aspect, but it'll get better with time.
Feel free to contribute when it comes to low-hanging fruit like tweaking
variables!
Q: X#sh3D? Why not use that instead of FTE QuakeWorld?
A: There are enough GPL violators around, I do not need to contribute to that
cesspool. 'From scratch' my a$$. Ironically, that project took code from
FTEQW going all the way back to the late 2000s. Do not support it.
Q: Why do this when you can just run a VM?
A: FreeCS isn't just making CS more portable. It also fixes bugs. It optimises
the netcode greatly. It's got much better lag compensation and client-side
player and weapon prediction than CS ever did. Yes, even the Steam version.
Q: I still don't get it - why not play CS on Steam?
A: This is clearly not intended for you, then!
Q: Make a wiki/discord/youtube/twitter/facebook etc. and spend time on
maintaining that, instead of working on the project, to build 'hype'.
A: I'm sure you are the first one to suggest such an idea... No thanks.

View File

@ -46,3 +46,8 @@ a work environment similar to GoldSrc for the original Quake engine.
In April of 2020, the weapons were rewritten to be fully client-side predicted.
This brought the Counter-Strike component on par with the advances of the other
games that Nuclide supports.
So the meaning and scope of Nuclide has changed, mainly to make work easier
as at one point TW and FreeCS were two seperate code-trees. Now they're unified
into one. I'd like to consider Nuclide to be FTE's reference SDK for game-logic,
like 'Source SDK Base' is to 'Source Engine'.

View File

@ -21,7 +21,6 @@ Contact #fte at irc.quakenet.org
If you crash to console, contact #freecs at irc.freenode.net or irc.frag-net.com
Notes
=======================================

View File

@ -14,6 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var int g_inetrefresh = FALSE;
CWidget fn_inet;
CMainButton inet_btnJoin;
CMainButton inet_btnCreate;
@ -34,6 +36,9 @@ CListBox inet_lbServers_Players;
CListBox inet_lbServers_Addresses;
CScrollbar inet_sbServers;
CDialog inet_dgRefresh;
CMainButton inet_btnRefDone;
/* Button Callbacks */
void
inet_btnjoin(void)
@ -80,11 +85,24 @@ inet_btndone_start(void)
void
inet_btnrefresh(void)
{
g_inetrefresh = TRUE;
}
void
inet_refreshframe(void)
{
static float refreshtime;
int count = 0;
int added = 0;
Master_RefreshCache();
count = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
/* only rebuild every half a frame */
if (refreshtime > time)
return;
count = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
refreshtime = time + 0.5f;
inet_lbServers_Name.Clear();
inet_lbServers_Ping.Clear();
@ -116,13 +134,19 @@ inet_btnrefresh(void)
inet_lbServers_Game.AddEntry(gethostcachestring(srv_fldGame, i));
inet_lbServers_Players.AddEntry(players);
inet_lbServers_Addresses.AddEntry(address);
print(sprintf("Adding %s to the Internet server list\n", address));
dprint(sprintf("Adding %s to the Internet server list\n", address));
added++;
}
print(sprintf("Added %i Internet servers.\n", added));
dprint(sprintf("Added %i Internet servers.\n", added));
inet_sbServers.SetMax(added);
}
void
inet_refreshfinish(void)
{
g_inetrefresh = FALSE;
}
void
inet_lb_clicked(int val)
{
@ -246,6 +270,14 @@ menu_internetgames_init(void)
inet_btnDone.SetExecute(inet_btndone_start);
inet_btnDone.SetPos(30,396);
Widget_Add(fn_inet, inet_btnDone);
inet_dgRefresh = spawn(CDialog);
inet_btnRefDone = spawn(CMainButton);
inet_btnRefDone.SetImage(BTN_DONE);
inet_btnRefDone.SetPos(233,291);
inet_btnRefDone.SetLength(68);
inet_btnRefDone.SetExecute(inet_refreshfinish);
Widget_Add(inet_dgRefresh, inet_btnRefDone);
}
void
@ -267,10 +299,26 @@ menu_internetgames_draw(void)
1.0f, 0, font_arial);
WLabel_Static(552, 128, m_reslbl[IDS_SERVER_PLAYERS], 10, 10, [1,1,1],
1.0f, 0, font_arial);
if (!g_inetrefresh)
return;
inet_refreshframe();
inet_dgRefresh.Draw();
Widget_Draw(inet_dgRefresh);
WField_Static(162, 180, "Refreshing server list...", 320, 260,
col_prompt_text, 1.0f, 2, font_label_p);
WField_Static(162, 220, sprintf("Listing %i applicable servers\n",
Master_GetInternetServers()), 320, 260,
col_prompt_title, 1.0f, 2, font_label_p);
}
void
menu_internetgames_input(float evtype, float scanx, float chary, float devid)
{
Widget_Input(fn_inet, evtype, scanx, chary, devid);
if (!g_inetrefresh)
Widget_Input(fn_inet, evtype, scanx, chary, devid);
else {
Widget_Input(inet_dgRefresh, evtype, scanx, chary, devid);
}
}

View File

@ -14,6 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
int Server_IsLan(string address);
#define MASTER_DNS "master.frag-net.com"
#define MASTER_PORT 27950
@ -29,14 +31,14 @@ string
Master_Resolve(void)
{
string out = netaddress_resolve(MASTER_DNS,MASTER_PORT);
print("Resolving master at ");
print(MASTER_DNS);
print(":");
print(ftos(MASTER_PORT));
print("...\n");
dprint("Resolving master at ");
dprint(MASTER_DNS);
dprint(":");
dprint(ftos(MASTER_PORT));
dprint("...\n");
if (!out) {
print("Failed to resolve address.\n");
dprint("Failed to resolve address.\n");
}
return out;
@ -48,15 +50,37 @@ Master_GetTotalServers(void)
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
if (a) {
print(sprintf("Master reports a total of %i servers.\n", a));
dprint(sprintf("Master reports a total of %i servers.\n", a));
}
return gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
}
int
Master_GetInternetServers(void)
{
int count = 0;
int tcount = 0;
count = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
for (int i = 0; i < count; i++) {
string address;
address = gethostcachestring(srv_fldAdress, i);
/* skip LAN */
if (!address || Server_IsLan(address)) {
continue;
}
tcount++;
}
return tcount;
}
void
Master_RefreshCache(void)
{
print("Refreshing host cache...\n");
dprint("Refreshing host cache...\n");
resethostcachemasks();
sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL);
sethostcachesort(gethostcacheindexforkey("ping"), FALSE);
@ -65,14 +89,14 @@ Master_RefreshCache(void)
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
if (a) {
print(sprintf("Master reports a total of %i servers.\n", a));
dprint(sprintf("Master reports a total of %i servers.\n", a));
}
}
void
Master_UpdateCache(void)
{
print("Updating host cache...\n");
dprint("Updating host cache...\n");
resethostcachemasks();
sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL);
sethostcachesort(gethostcacheindexforkey("ping"), FALSE);
@ -81,7 +105,7 @@ Master_UpdateCache(void)
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
if (a) {
print(sprintf("Master reports a total of %i servers.\n", a));
dprint(sprintf("Master reports a total of %i servers.\n", a));
}
}

View File

@ -100,6 +100,9 @@ Music_ParseLoop(string parm)
void
Music_MenuStart(void)
{
if (g_active)
return;
string tinfo = cvar_string("gameinfo_menutrack");
print(tinfo);
print("\n");

View File

@ -155,7 +155,7 @@ FX_BreakModel(int count, vector vMins, vector vMaxs, vector vVel, float fStyle)
eGib.nextthink = time + 10;
if ((fStyle == GSMATERIAL_GLASS) || (fStyle == GSMATERIAL_GLASS_UNBREAKABLE)) {
eGib.effects = EF_ADDITIVE;
eGib.alpha = 0.5f;
}
eGib.drawmask = MASK_ENGINE;

View File

@ -34,6 +34,8 @@ bind "y" "messagemode"
bind "u" "messagemode2"
bind "t" "impulse 201"
bind "f" "impulse 100"
bind "f1" "vote yes"
bind "f2" "vote no"
// Game Variables
seta "hostname" "FreeHL Server"