remove antipiracy

master
an 2019-11-26 20:37:03 -05:00
parent 796107d4cc
commit a3995e795d
5 changed files with 9 additions and 119 deletions

View File

@ -31,7 +31,7 @@ static char argvdummy[] = " ";
int32_t safemode;
cvar_t registered = {"registered", "1", CVAR_ROM}; /* set to correct value in COM_CheckRegistered() */
cvar_t registered = {"registered", "1", CVAR_ROM};
cvar_t cmdline = {"cmdline", "", CVAR_ROM/*|CVAR_SERVERINFO*/}; /* sending cmdline upon CCREQ_RULE_INFO is evil */
static bool com_modified; // set true if using non-id files
@ -58,27 +58,6 @@ char com_cmdline[CMDLINE_LENGTH];
bool standard_quake = true, rogue, hipnotic;
// this graphic needs to be in the pak file to use registered features
static uint16_t pop[] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6600, 0x0000, 0x0000, 0x0000, 0x6600, 0x0000,
0x0000, 0x0066, 0x0000, 0x0000, 0x0000, 0x0000, 0x0067, 0x0000,
0x0000, 0x6665, 0x0000, 0x0000, 0x0000, 0x0000, 0x0065, 0x6600,
0x0063, 0x6561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0061, 0x6563,
0x0064, 0x6561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0061, 0x6564,
0x0064, 0x6564, 0x0000, 0x6469, 0x6969, 0x6400, 0x0064, 0x6564,
0x0063, 0x6568, 0x6200, 0x0064, 0x6864, 0x0000, 0x6268, 0x6563,
0x0000, 0x6567, 0x6963, 0x0064, 0x6764, 0x0063, 0x6967, 0x6500,
0x0000, 0x6266, 0x6769, 0x6a68, 0x6768, 0x6a69, 0x6766, 0x6200,
0x0000, 0x0062, 0x6566, 0x6666, 0x6666, 0x6666, 0x6562, 0x0000,
0x0000, 0x0000, 0x0062, 0x6364, 0x6664, 0x6362, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0062, 0x6662, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0061, 0x6661, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6500, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6400, 0x0000, 0x0000, 0x0000
};
/*
All of Quake's data access is through a hierchal file system, but the contents
@ -102,13 +81,6 @@ especially over ISDN / T1 lines. If there is a cache directory specified, when
a file is found by the normal search path, it will be mirrored into the cache
directory, then opened there.
FIXME:
The file "parms.txt" will be read out of the game directory and appended to the
current command line arguments to allow different games to initialize startup
parms differently. This could be used to add a "-sspeed 22050" for the high
quality sound edition. Because they are added at the end, they will not
override an explicit setting on the original command line.
*/
//============================================================================
@ -1272,58 +1244,6 @@ int32_t COM_CheckParm(const char *parm)
return 0;
}
/*
================
COM_CheckRegistered
Looks for the pop.txt file and verifies it.
Sets the "registered" cvar.
Immediately exits out if an alternate game was attempted to be started without
being registered.
================
*/
static void COM_CheckRegistered(void)
{
int32_t h;
uint16_t check[128];
int32_t i;
COM_OpenFile("gfx/pop.lmp", &h, NULL);
if(h == -1)
{
Cvar_SetROM("registered", "0");
Con_Printf("Playing shareware version.\n");
if(com_modified)
Sys_Error("You must have the registered version to use modified games.\n\n"
"Basedir is: %s\n\n"
"Check that this has an " GAMENAME " subdirectory containing pak0.pak and pak1.pak, "
"or use the -basedir command-line option to specify another directory.",
com_basedir);
return;
}
Sys_FileRead(h, check, sizeof(check));
COM_CloseFile(h);
for(i = 0; i < 128; i++)
{
if(pop[i] != (uint16_t)BigShort(check[i]))
Sys_Error("Corrupted data file.");
}
for(i = 0; com_cmdline[i]; i++)
{
if(com_cmdline[i] != ' ')
break;
}
Cvar_SetROM("cmdline", &com_cmdline[i]);
Cvar_SetROM("registered", "1");
Con_Printf("Playing registered version.\n");
}
/*
================
COM_InitArgv
@ -1448,14 +1368,12 @@ void COM_Init(void)
============
va
does a varargs printf into a temp buffer. cycles between
4 different static buffers. the number of buffers cycled
is defined in VA_NUM_BUFFS.
FIXME: make this buffer size safe someday
does a varargs printf into a temp buffer. cycles between a number of static
buffers.
============
*/
#define VA_NUM_BUFFS 4
#define VA_BUFFERLEN 1024
#define VA_NUM_BUFFS 8
#define VA_BUFFERLEN 4096
static char *get_va_buffer(void)
{
@ -1663,13 +1581,6 @@ static int32_t COM_FindFile(const char *filename, int32_t *handle, FILE **file,
}
else /* check a file in the directory tree */
{
if(!registered.value)
{
/* if not a registered version, don't ever go beyond base */
if(strchr(filename, '/') || strchr(filename, '\\'))
continue;
}
q_snprintf(netpath, sizeof(netpath), "%s/%s", search->filename, filename);
findtime = Sys_FileTime(netpath);
if(findtime == -1)
@ -2107,12 +2018,6 @@ static void COM_Game_f(void)
const char *p2 = Cmd_Argv(2);
searchpath_t *search;
if(!registered.value) //disable shareware quake
{
Con_Printf("You must have the registered version to use modified games\n");
return;
}
if(!*p || !strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":"))
{
Con_Printf("gamedir should be a single directory name, not a path\n");
@ -2251,7 +2156,6 @@ void COM_InitFilesystem(void) //johnfitz -- modified based on topaz's tutorial
{
int32_t i, j;
Cvar_RegisterVariable(&registered);
Cvar_RegisterVariable(&cmdline);
Cmd_AddCommand("path", COM_Path_f);
Cmd_AddCommand("game", COM_Game_f); //johnfitz
@ -2312,8 +2216,6 @@ void COM_InitFilesystem(void) //johnfitz -- modified based on topaz's tutorial
}
}
}
COM_CheckRegistered();
}

View File

@ -76,11 +76,6 @@ void RemoveLink(link_t *l);
void InsertLinkBefore(link_t *l, link_t *before);
void InsertLinkAfter(link_t *l, link_t *after);
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (intptr_t)&(((t *)0)->m)))
//============================================================================
extern bool host_bigendian;
@ -299,10 +294,11 @@ char *FS_fgets(char *s, int32_t size, fshandle_t *fh);
long FS_filelength(fshandle_t *fh);
extern struct cvar_s registered;
extern bool standard_quake, rogue, hipnotic;
extern bool fitzmode;
/* if true, run in fitzquake mode disabling custom quakespasm hacks */
struct cvar_s;
#endif /* _Q_COMMON_H */

View File

@ -60,7 +60,6 @@
#ifdef __cplusplus
static inline char *FIND_FIRST_DIRSEP(char *_the_path)
{
/* FIXME: What about C:FOO ? */
char *p1 = strchr(_the_path, '/');
char *p2 = strchr(_the_path, '\\');
if(p1 == NULL) return p2;
@ -69,7 +68,6 @@ static inline char *FIND_FIRST_DIRSEP(char *_the_path)
}
static inline char *FIND_LAST_DIRSEP(char *_the_path)
{
/* FIXME: What about C:FOO ? */
char *p1 = strrchr(_the_path, '/');
char *p2 = strrchr(_the_path, '\\');
if(p1 == NULL) return p2;
@ -78,7 +76,6 @@ static inline char *FIND_LAST_DIRSEP(char *_the_path)
}
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
{
/* FIXME: What about C:FOO ? */
const char *p1 = strchr(_the_path, '/');
const char *p2 = strchr(_the_path, '\\');
if(p1 == NULL) return p2;
@ -87,7 +84,6 @@ static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
}
static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
{
/* FIXME: What about C:FOO ? */
const char *p1 = strrchr(_the_path, '/');
const char *p2 = strrchr(_the_path, '\\');
if(p1 == NULL) return p2;
@ -97,7 +93,6 @@ static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
#else
static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
{
/* FIXME: What about C:FOO ? */
char *p1 = strchr(_the_path, '/');
char *p2 = strchr(_the_path, '\\');
if(p1 == NULL) return p2;
@ -106,7 +101,6 @@ static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
}
static inline char *FIND_LAST_DIRSEP(const char *_the_path)
{
/* FIXME: What about C:FOO ? */
char *p1 = strrchr(_the_path, '/');
char *p2 = strrchr(_the_path, '\\');
if(p1 == NULL) return p2;

View File

@ -2305,10 +2305,8 @@ void M_NetStart_Change(int32_t dir)
//PGM 03/02/97 added 1 for dmatch episode
else if(rogue)
count = 4;
else if(registered.value)
count = 7;
else
count = 2;
count = 7;
if(startepisode < 0)
startepisode = count - 1;

View File

@ -55,7 +55,7 @@ typedef struct edict_s
/* other fields from progs come immediately after */
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)l - offsetof(edict_t, area))
//============================================================================