View previous topic :: View next topic |
Author |
Message |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Wed Nov 26, 2008 4:31 pm Post subject: Tutorial: sv_progs: specify the "progs.dat" to run |
|
|
You've got a mod ...
And it supports single player and maybe a bots version and if you are particularly creative maybe a 3rd version that supports who knows.
Do you want to distribute awkward zip files with 3 gamedirs ... because standard Quake would require 3 different progs.dat in 3 different gamedirs?
Adding sv_progs capability to GLQuake/WinQuake
DarkPlaces has had this for over 4 years, no doubt some others.
1. sv_main.c
Quote: | a. Right after "server_static_t svs;" at the top, add:
Code: | cvar_t sv_progs = {"sv_progs", "progs.dat" }; |
We need to define the new cvar.
b. Right after "Cvar_RegisterVariable (&sv_maxspeed);", add:
Code: | Cvar_RegisterVariable (&sv_progs); |
This registers it.
c. Find this and add the yellow
Quote: | // load progs to get entity field count
PR_LoadProgs (sv_progs.string); |
We aren't just calling PR_LoadProgs anymore, but telling it what the "progs.dat" name is. |
2. progs.h
Quote: | Find this and insert the yellow text replacing the word "void":
Quote: | void PR_LoadProgs (char *progsname); |
|
3. pr_edict.c
Quote: | Goto PR_LoadProgs and make yellow changes:
Quote: | void PR_LoadProgs (char *progsname)
{
int i;
// flush the non-C variable lookup cache
for (i=0 ; i<GEFV_CACHESIZE ; i++)
gefvCache[i].field[0] = 0;
if (!progsname || !*progsname)
Host_Error("PR_LoadProgs: passed empty progsname");
CRC_Init (&pr_crc);
if (!(progs = (dprograms_t *)COM_LoadHunkFile (progsname)))
Sys_Error ("PR_LoadProgs: couldn't load %s", progsname);
Con_DPrintf ("Programs occupy %iK.\n", com_filesize/1024);
for (i=0 ; i<com_filesize ; i++)
CRC_ProcessByte (&pr_crc, ((byte *)progs)[i]);
// byte swap the header
for (i=0 ; i<sizeof(*progs)/4 ; i++)
((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
if (progs->version != PROG_VERSION)
Sys_Error ("%s has wrong version number (%i should be %i)", progsname, progs->version, PROG_VERSION);
if (progs->crc != PROGHEADER_CRC)
Sys_Error ("%s system vars have been modified, progdefs.h is out of date", progsname);
pr_functions = (dfunction_t *)((byte *)progs + progs->ofs_functions); |
All we did was replace the instances of "progs.dat" with "%s" and sprintf the progsname in there.
Plus an empty progsname check. |
In Closing
Now you could create a readme.txt with
Quote: | =============
My Readme.txt
=============
glquake -game mycastle +map mycastle
...
( description of mod )
...
We also included a bots version and a dmsp version. Just type "bots" or "dmsp" in the console to run those.
Requires DarkPlaces or <insert name here>
|
[Those bots/dmsp aliases would be in the autoexec.cfg, i.e. alias bots "sv_progs bots.dat; disconnect; maxplayers 4; map dm6", etc.] |
|
Back to top |
|
 |
goldenboy

Joined: 05 Sep 2008 Posts: 310 Location: Kiel
|
Posted: Fri Nov 28, 2008 7:30 pm Post subject: |
|
|
good, is it also possible to have a command line switch? |
|
Back to top |
|
 |
Spirit

Joined: 20 Nov 2004 Posts: 476
|
Posted: Fri Nov 28, 2008 8:52 pm Post subject: |
|
|
AS usual +sv_progs should work? _________________ Quake Maps |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Fri Nov 28, 2008 9:45 pm Post subject: |
|
|
Spirit wrote: | AS usual +sv_progs should work? |
That'd work, yes.
c:\quake\<your quake>.exe -game whatever +sv_progs bots.dat |
|
Back to top |
|
 |
Team Xlink
Joined: 25 Jun 2009 Posts: 320
|
Posted: Fri Nov 20, 2009 12:54 am Post subject: |
|
|
Is it possible to change it through the quake.cmdline file? _________________
Anonymous wrote: | if it works, it works. if it doesn't, HAHAHA! |
Last edited by Team Xlink on Fri Nov 20, 2009 1:05 am; edited 1 time in total |
|
Back to top |
|
 |
Downsider

Joined: 16 Sep 2008 Posts: 478
|
Posted: Fri Nov 20, 2009 1:03 am Post subject: |
|
|
If you read the code, you would know the answer is yes. |
|
Back to top |
|
 |
|