mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 20:11:44 +00:00
Early version of fteqccgui-qt
a few other misc tweaks, eg for the debug protocol in linux fteqw. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5387 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
cb88355800
commit
2163fb7c77
27 changed files with 2232 additions and 228 deletions
|
@ -29,6 +29,7 @@ extern cvar_t cl_predict_players_frac;
|
|||
extern cvar_t cl_predict_players_latency;
|
||||
extern cvar_t cl_predict_players_nudge;
|
||||
extern cvar_t cl_lerp_players;
|
||||
extern cvar_t cl_lerp_maxinterval;
|
||||
extern cvar_t cl_solid_players;
|
||||
extern cvar_t cl_item_bobbing;
|
||||
|
||||
|
@ -3279,7 +3280,7 @@ static void CL_UpdateNetFrameLerpState(qboolean force, int curframe, int curbase
|
|||
frame = (fst==FST_BASE)?curbaseframe:curframe;
|
||||
if (force || frame != le->newframe[fst])
|
||||
{
|
||||
le->framelerpdeltatime[fst] = bound(0, cl.servertime - le->newframestarttime[fst], 0.1); //clamp to 10 tics per second
|
||||
le->framelerpdeltatime[fst] = bound(0, cl.servertime - le->newframestarttime[fst], cl_lerp_maxinterval.value); //clamp to 10 tics per second
|
||||
|
||||
if (!force)
|
||||
{
|
||||
|
@ -3607,7 +3608,7 @@ static void CL_TransitionPacketEntities(int newsequence, packet_entities_t *newp
|
|||
if (!VectorEquals(le->neworigin, snew__origin) || !VectorEquals(le->newangle, snew->angles))
|
||||
{
|
||||
le->newsequence = snew->sequence;
|
||||
le->orglerpdeltatime = bound(0, oldpack->servertime - le->orglerpstarttime, 0.11); //clamp to 10 tics per second
|
||||
le->orglerpdeltatime = bound(0, oldpack->servertime - le->orglerpstarttime, cl_lerp_maxinterval.value); //clamp to 10 tics per second
|
||||
le->orglerpstarttime = oldpack->servertime;
|
||||
|
||||
VectorCopy(le->neworigin, le->oldorigin);
|
||||
|
|
|
@ -101,6 +101,7 @@ cvar_t m_yaw = CVARF("m_yaw","0.022", CVAR_ARCHIVE);
|
|||
cvar_t m_forward = CVARF("m_forward","1", CVAR_ARCHIVE);
|
||||
cvar_t m_side = CVARF("m_side","0.8", CVAR_ARCHIVE);
|
||||
|
||||
cvar_t cl_lerp_maxinterval = CVARD("cl_lerp_maxinterval", "0.3", "Maximum interval between keyframes, in seconds. Larger values can result in entities drifting very slowly when they move sporadically.");
|
||||
cvar_t cl_lerp_players = CVARD("cl_lerp_players", "1", "Set this to make other players smoother, though it may increase effective latency. Affects only QuakeWorld.");
|
||||
cvar_t cl_predict_players = CVARD("cl_predict_players", "1", "Clear this cvar to see ents exactly how they are on the server.");
|
||||
cvar_t cl_predict_players_frac = CVARD("cl_predict_players_frac", "0.9", "How much of other players to predict. Values less than 1 will help minimize overruns.");
|
||||
|
@ -4455,6 +4456,7 @@ void CL_Init (void)
|
|||
Cvar_Register (&rcon_password, cl_controlgroup);
|
||||
Cvar_Register (&rcon_address, cl_controlgroup);
|
||||
|
||||
Cvar_Register (&cl_lerp_maxinterval, cl_controlgroup);
|
||||
Cvar_Register (&cl_lerp_players, cl_controlgroup);
|
||||
Cvar_Register (&cl_predict_players, cl_predictiongroup);
|
||||
Cvar_Register (&cl_predict_players_frac, cl_predictiongroup);
|
||||
|
|
|
@ -1066,6 +1066,16 @@ void FPS_Preset_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!stricmp("dp", arg))
|
||||
{
|
||||
Cbuf_InsertText(
|
||||
"set sv_listen_dp 1\n"
|
||||
"set sv_bigcoords 1\n"
|
||||
"echo you may need to restart the map\n"
|
||||
, RESTRICT_LOCAL, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp("tenebrae", arg))
|
||||
{ //for the luls. combine with the tenebrae mod for maximum effect.
|
||||
Cbuf_InsertText(
|
||||
|
|
|
@ -2996,7 +2996,7 @@ void R_SetFrustum (float projmat[16], float viewmat[16])
|
|||
|
||||
//do far plane
|
||||
//fog will logically not actually reach 0, though precision issues will force it. we cut off at an exponant of -500
|
||||
if (r_refdef.globalfog.density && r_fog_cullentities.ival)
|
||||
if (r_refdef.globalfog.density && r_refdef.globalfog.alpha>=1 && r_fog_cullentities.ival)
|
||||
{
|
||||
float culldist;
|
||||
float fog;
|
||||
|
|
|
@ -850,7 +850,7 @@ char *Sys_ConsoleInput(void)
|
|||
{
|
||||
#if 1
|
||||
static char text[256];
|
||||
int len;
|
||||
char *nl;
|
||||
|
||||
#ifdef SUBSERVERS
|
||||
if (SSV_IsSubServer())
|
||||
|
@ -865,11 +865,10 @@ char *Sys_ConsoleInput(void)
|
|||
|
||||
// if (!qrenderer)
|
||||
{
|
||||
len = read (STDIN_FILENO, text, sizeof(text));
|
||||
if (len < 1)
|
||||
if (!fgets(text, sizeof(text), stdin))
|
||||
return NULL;
|
||||
|
||||
text[len-1] = 0; // rip off the /n and terminate
|
||||
nl = strchr(text, '\n');
|
||||
*nl = 0;
|
||||
|
||||
//Con_Printf("console input: %s\n", text);
|
||||
|
||||
|
@ -937,6 +936,22 @@ int main (int c, const char **v)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (COM_CheckParm("-qcdebug"))
|
||||
{
|
||||
isPlugin = 3;
|
||||
nostdout = true; //only spew debugging messages.
|
||||
}
|
||||
else
|
||||
{
|
||||
isPlugin = !!COM_CheckParm("-plugin");
|
||||
if (isPlugin)
|
||||
{
|
||||
printf("status Starting up!\n");
|
||||
fflush(stdout);
|
||||
nostdout = true;
|
||||
}
|
||||
}
|
||||
|
||||
parms.basedir = realpath(".", NULL);
|
||||
memset(bindir, 0, sizeof(bindir)); //readlink does NOT null terminate, apparently.
|
||||
#ifdef __linux__
|
||||
|
@ -944,7 +959,7 @@ int main (int c, const char **v)
|
|||
if (readlink("/proc/self/exe", bindir, sizeof(bindir)-1) > 0)
|
||||
{
|
||||
*COM_SkipPath(bindir) = 0;
|
||||
printf("Binary is located at \"%s\"\n", bindir);
|
||||
Sys_Printf("Binary is located at \"%s\"\n", bindir);
|
||||
parms.binarydir = bindir;
|
||||
}
|
||||
/*#elif defined(__bsd__)
|
||||
|
@ -952,21 +967,13 @@ int main (int c, const char **v)
|
|||
if (readlink("/proc/self/file", bindir, sizeof(bindir)-1) > 0)
|
||||
{
|
||||
*COM_SkipPath(bindir) = 0;
|
||||
printf("Binary is located at "%s"\n", bindir);
|
||||
Sys_Printf("Binary is located at "%s"\n", bindir);
|
||||
parms.binarydir = bindir;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
TL_InitLanguages(parms.binarydir);
|
||||
|
||||
isPlugin = !!COM_CheckParm("-plugin");
|
||||
if (isPlugin)
|
||||
{
|
||||
printf("status Starting up!\n");
|
||||
fflush(stdout);
|
||||
nostdout = true;
|
||||
}
|
||||
|
||||
|
||||
noconinput = COM_CheckParm("-noconinput");
|
||||
#ifndef __DJGPP__
|
||||
|
|
|
@ -17,6 +17,7 @@ static char *cvargroup_progs = "Progs variables";
|
|||
cvar_t utf8_enable = CVARD("utf8_enable", "0", "When 1, changes the qc builtins to act upon codepoints instead of bytes. Do not use unless com_parseutf8 is also set.");
|
||||
cvar_t sv_gameplayfix_nolinknonsolid = CVARD("sv_gameplayfix_nolinknonsolid", "1", "When 0, setorigin et al will not link the entity into the collision nodes (which is faster, especially if you have a lot of non-solid entities. When 1, allows entities to freely switch between .solid values (except for SOLID_BSP) without relinking. A lot of DP mods assume a value of 1 and will bug out otherwise, while 0 will restore a bugs present in various mods.");
|
||||
cvar_t sv_gameplayfix_blowupfallenzombies = CVARD("sv_gameplayfix_blowupfallenzombies", "0", "Allow findradius to find non-solid entities. This may break certain mods. It is better for mods to use FL_FINDABLE_NONSOLID instead.");
|
||||
cvar_t sv_gameplayfix_droptofloorstartsolid = CVARD("sv_gameplayfix_droptofloorstartsolid", "0", "When droptofloor fails, this causes a second attemp, but with traceline instead.");
|
||||
cvar_t dpcompat_findradiusarealinks = CVARD("dpcompat_findradiusarealinks", "0", "Use the world collision info to accelerate findradius instead of looping through every single entity. May actually be slower for large radiuses, or fail to find entities which have not been linked properly with setorigin.");
|
||||
#ifndef NOLEGACY
|
||||
cvar_t dpcompat_strcat_limit = CVARD("dpcompat_strcat_limit", "", "When set, cripples strcat (and related function) string lengths to the value specified.\nSet to 16383 to replicate DP's limit, otherwise leave as 0 to avoid limits.");
|
||||
|
@ -73,6 +74,7 @@ void PF_Common_RegisterCvars(void)
|
|||
|
||||
Cvar_Register (&sv_gameplayfix_blowupfallenzombies, cvargroup_progs);
|
||||
Cvar_Register (&sv_gameplayfix_nolinknonsolid, cvargroup_progs);
|
||||
Cvar_Register (&sv_gameplayfix_droptofloorstartsolid, cvargroup_progs);
|
||||
Cvar_Register (&dpcompat_findradiusarealinks, cvargroup_progs);
|
||||
#ifndef NOLEGACY
|
||||
Cvar_Register (&dpcompat_strcat_limit, cvargroup_progs);
|
||||
|
@ -187,7 +189,6 @@ static int debuggerstacky;
|
|||
int QCLibEditor(pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *error, pbool fatal);
|
||||
void QCLoadBreakpoints(const char *vmname, const char *progsname)
|
||||
{ //this asks the gui to reapply any active breakpoints and waits for them so that any spawn functions can be breakpointed properly.
|
||||
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX)
|
||||
extern int isPlugin;
|
||||
if (isPlugin >= 2)
|
||||
{
|
||||
|
@ -197,14 +198,20 @@ void QCLoadBreakpoints(const char *vmname, const char *progsname)
|
|||
Sys_SendKeyEvents();
|
||||
#endif
|
||||
debuggerresume = -1;
|
||||
printf("qcreloaded \"%s\" \"%s\"\n", vmname, progsname);
|
||||
fprintf(stdout, "qcreloaded \"%s\" \"%s\"\n", vmname, progsname);
|
||||
fflush(stdout);
|
||||
#ifdef _WIN32
|
||||
#ifndef SERVERONLY
|
||||
INS_UpdateGrabs(false, false);
|
||||
#endif
|
||||
#endif
|
||||
while(debuggerresume == -1 && !wantquit)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(10);
|
||||
#else
|
||||
usleep(10*1000);
|
||||
#endif
|
||||
#ifdef SERVERONLY
|
||||
SV_GetConsoleCommands();
|
||||
#else
|
||||
|
@ -212,7 +219,6 @@ void QCLoadBreakpoints(const char *vmname, const char *progsname)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
extern cvar_t pr_sourcedir;
|
||||
pubprogfuncs_t *debuggerinstance;
|
||||
|
@ -373,7 +379,7 @@ qboolean QCExternalDebuggerCommand(char *text)
|
|||
|
||||
int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason, pbool fatal)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX)
|
||||
//#if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX)
|
||||
if (isPlugin >= 2)
|
||||
{
|
||||
if (wantquit)
|
||||
|
@ -395,8 +401,10 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
|
|||
#endif
|
||||
debuggerresume = -1;
|
||||
debuggerresumeline = *line;
|
||||
#ifdef _WIN32
|
||||
if (debuggerwnd)
|
||||
SetForegroundWindow((HWND)debuggerwnd);
|
||||
#endif
|
||||
if (reason)
|
||||
{
|
||||
char tmpbuffer[8192];
|
||||
|
@ -415,18 +423,28 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
|
|||
}
|
||||
while(debuggerresume == -1 && !wantquit)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(10);
|
||||
#else
|
||||
usleep(10*1000);
|
||||
#endif
|
||||
SV_GetConsoleCommands();
|
||||
}
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
INS_UpdateGrabs(false, false);
|
||||
#endif
|
||||
if (reason)
|
||||
Con_Footerf(NULL, false, "^bDebugging: %s", reason);
|
||||
else
|
||||
Con_Footerf(NULL, false, "^bDebugging");
|
||||
while(debuggerresume == -1 && !wantquit)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(10);
|
||||
#else
|
||||
usleep(10*1000);
|
||||
#endif
|
||||
Sys_SendKeyEvents();
|
||||
|
||||
if (qrenderer)
|
||||
|
@ -453,7 +471,7 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
|
|||
return DEBUG_TRACE_ABORT;
|
||||
return debuggerresume;
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#ifdef TEXTEDITOR
|
||||
return QCLibEditor(prinst, filename, line, statement, reason, fatal);
|
||||
|
@ -5290,7 +5308,25 @@ void QCBUILTIN PF_droptofloor (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
VectorCopy (ent->v->origin, start);
|
||||
trace = World_Move (world, start, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);
|
||||
|
||||
if (trace.fraction == 1 || trace.allsolid)
|
||||
if (trace.allsolid && sv_gameplayfix_droptofloorstartsolid.ival && gravitydir[2] == -1)
|
||||
{
|
||||
//try again but with a traceline, something is better than nothing.
|
||||
vec3_t offset;
|
||||
VectorAvg(ent->v->maxs, ent->v->mins, offset);
|
||||
offset[2] = ent->v->mins[2];
|
||||
VectorAdd(start, offset, start);
|
||||
VectorAdd(end, offset, end);
|
||||
trace = World_Move (world, start, vec3_origin, vec3_origin, end, MOVE_NORMAL, ent);
|
||||
if (trace.fraction < 1)
|
||||
{
|
||||
VectorSubtract (trace.endpos, offset, ent->v->origin);
|
||||
World_LinkEdict (world, ent, false);
|
||||
ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
|
||||
ent->v->groundentity = EDICT_TO_PROG(prinst, trace.ent);
|
||||
G_FLOAT(OFS_RETURN) = 1;
|
||||
}
|
||||
}
|
||||
else if (trace.fraction == 1 || trace.allsolid)
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3030,13 +3030,13 @@ void Terr_DrawTerrainModel (batch_t **batches, entity_t *e)
|
|||
|
||||
Terr_Brush_Draw(hm, batches, e);
|
||||
|
||||
if (r_refdef.globalfog.density || r_refdef.maxdist>0)
|
||||
if ((r_refdef.globalfog.density&&r_refdef.globalfog.alpha>=1) || r_refdef.maxdist>0)
|
||||
{
|
||||
float culldist;
|
||||
extern cvar_t r_fog_exp2;
|
||||
|
||||
if (r_refdef.globalfog.density)
|
||||
{
|
||||
if (r_refdef.globalfog.density&&r_refdef.globalfog.alpha>=1)
|
||||
{ //fogalpha<1 means you can always see through it, so don't cull when its invisible.
|
||||
//figure out the eyespace distance required to reach that fog value
|
||||
culldist = log(0.5/255.0f);
|
||||
if (r_fog_exp2.ival)
|
||||
|
|
|
@ -215,7 +215,7 @@ void R_GenerateFlashblendTexture(void)
|
|||
pixels[y][x][3] = 255;
|
||||
}
|
||||
}
|
||||
R_LoadReplacementTexture("***flashblend***", NULL, 0, pixels, 32, 32, TF_RGBA32);
|
||||
R_LoadReplacementTexture("***flashblend***", NULL, IF_LINEAR, pixels, 32, 32, TF_RGBA32);
|
||||
}
|
||||
void R_InitFlashblends(void)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
// set these before calling CheckParm
|
||||
extern int myargc;
|
||||
extern char **myargv;
|
||||
extern const char **myargv;
|
||||
|
||||
//char *strupr (char *in);
|
||||
//char *strlower (char *in);
|
||||
|
|
|
@ -77,12 +77,12 @@ pbool PreCompile(void)
|
|||
return !!qcchunk;
|
||||
}
|
||||
|
||||
pbool QCC_main (int argc, char **argv);
|
||||
pbool QCC_main (int argc, const char **argv);
|
||||
void QCC_FinishCompile(void);
|
||||
|
||||
int comp_nump;char **comp_parms;
|
||||
int comp_nump;const char **comp_parms;
|
||||
//void Editor(char *fname, int line, int numparms, char **compileparms);
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, char **parms)
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, const char **parms)
|
||||
{
|
||||
comp_nump = nump;
|
||||
comp_parms = parms;
|
||||
|
@ -113,7 +113,7 @@ pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, char **pa
|
|||
|
||||
return true;
|
||||
}
|
||||
int PDECL Comp_Begin(pubprogfuncs_t *progfuncs, int nump, char **parms)
|
||||
int PDECL Comp_Begin(pubprogfuncs_t *progfuncs, int nump, const char **parms)
|
||||
{
|
||||
comp_nump = nump;
|
||||
comp_parms = parms;
|
||||
|
@ -158,7 +158,7 @@ pbool CompileFile(progfuncs_t *progfuncs, const char *filename)
|
|||
#else
|
||||
char srcfile[32];
|
||||
char newname[32];
|
||||
static char *p[5];
|
||||
static const char *p[5];
|
||||
int parms;
|
||||
char *s, *s2;
|
||||
|
||||
|
|
|
@ -172,6 +172,13 @@ pbool IsConstant(QCC_ddef_t *def)
|
|||
return true;
|
||||
}
|
||||
|
||||
const char *qcstring(int str)
|
||||
{
|
||||
if ((unsigned)str >= strofs)
|
||||
return "";
|
||||
return strings+str;
|
||||
}
|
||||
|
||||
char *type_name (QCC_ddef_t *def)
|
||||
{
|
||||
QCC_ddef_t *j;
|
||||
|
@ -509,10 +516,10 @@ static struct {
|
|||
{108, "showpicent", NULL, {NULL}, "void(string slot, entity player)"},
|
||||
{109, "hidepicent", NULL, {NULL}, "void(string slot, entity player)"},
|
||||
|
||||
{110, "fopen", &type_float, {&type_string,&type_float}, "filestream(string filename, float mode, optional float mmapminsize)"},
|
||||
{111, "fclose", NULL, {&type_float}, "void(filestream fhandle)"},
|
||||
{112, "fgets", &type_string, {&type_float,&type_string}, "string(filestream fhandle)"},
|
||||
{113, "fputs", NULL, {&type_float,&type_string}, "void(filestream fhandle, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)"},
|
||||
{110, "fopen", &type_float, {&type_string,&type_float}, "float(string filename, float mode, optional float mmapminsize)"},
|
||||
{111, "fclose", NULL, {&type_float}, "void(float fhandle)"},
|
||||
{112, "fgets", &type_string, {&type_float,&type_string}, "string(float fhandle)"},
|
||||
{113, "fputs", NULL, {&type_float,&type_string}, "void(float fhandle, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)"},
|
||||
{114, "strlen", &type_float, {&type_string}, "float(string s)"},
|
||||
{115, "strcat", &type_string, {&type_string,&type_string}, "string(string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)"},
|
||||
{116, "substring", &type_string, {&type_string,&type_float,&type_float}, "string(string s, float start, float length)"},
|
||||
|
@ -1254,8 +1261,9 @@ char *DecompileGlobal(dfunction_t *df, gofs_t ofs, QCC_type_t * req_t)
|
|||
|
||||
if (def)
|
||||
{
|
||||
const char *defname = qcstring(def->s_name);
|
||||
|
||||
if (!strcmp(strings + def->s_name, "IMMEDIATE") || !strcmp(strings + def->s_name, ".imm") || !def->s_name)
|
||||
if (!strcmp(defname, "IMMEDIATE") || !strcmp(defname, ".imm") || !def->s_name)
|
||||
{
|
||||
etype_t ty;
|
||||
if (!req_t)
|
||||
|
@ -1270,7 +1278,7 @@ char *DecompileGlobal(dfunction_t *df, gofs_t ofs, QCC_type_t * req_t)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!strings[def->s_name])
|
||||
if (!*defname)
|
||||
{
|
||||
char line[16];
|
||||
char *buf;
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
void GoToDefinition(char *name);
|
||||
int Grep(char *filename, char *string);
|
||||
void GoToDefinition(const char *name);
|
||||
int Grep(const char *filename, const char *string);
|
||||
void EditFile(const char *name, int line, pbool setcontrol);
|
||||
|
||||
void GUI_SetDefaultOpts(void);
|
||||
int GUI_BuildParms(char *args, char **argv, pbool quick);
|
||||
int GUI_BuildParms(const char *args, const char **argv, pbool quick);
|
||||
|
||||
//unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz);
|
||||
int QCC_RawFileSize (const char *fname);
|
||||
pbool QCC_WriteFile (const char *name, void *data, int len);
|
||||
void GUI_DialogPrint(char *title, char *text);
|
||||
void GUI_DialogPrint(const char *title, const char *text);
|
||||
|
||||
void *GUIReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile);
|
||||
int GUIFileSize(const char *fname);
|
||||
|
||||
int GUI_ParseCommandLine(char *args, pbool keepsrcanddir); //0=gui, 1=commandline
|
||||
int GUI_ParseCommandLine(const char *args, pbool keepsrcanddir); //0=gui, 1=commandline
|
||||
void GUI_SaveConfig(void);
|
||||
void GUI_RevealOptions(void);
|
||||
int GUIprintf(const char *msg, ...);
|
||||
|
||||
pbool GenBuiltinsList(char *buffer, int buffersize);
|
||||
|
||||
extern char parameters[16384];
|
||||
|
||||
extern char progssrcname[256];
|
||||
|
|
|
@ -1015,7 +1015,6 @@ static void PKG_WritePackageData(struct pkgctx_s *ctx, struct output_s *out, uns
|
|||
#define misint64(ptr,ofs,data) do{misint((ptr),(ofs),(data));misint((ptr),(ofs)+4,((quint64_t)(data))>>32);}while(0)
|
||||
qofs_t num=0;
|
||||
pbool pak = false;
|
||||
int startofs = 0;
|
||||
|
||||
struct file_s *f;
|
||||
char centralheader[46+sizeof(f->write.name)];
|
||||
|
@ -1291,6 +1290,7 @@ static void PKG_WritePackageData(struct pkgctx_s *ctx, struct output_s *out, uns
|
|||
fclose(outf);
|
||||
}
|
||||
|
||||
/*
|
||||
#include <sys/stat.h>
|
||||
static time_t PKG_GetFileTime(const char *filename)
|
||||
{
|
||||
|
@ -1298,6 +1298,7 @@ static time_t PKG_GetFileTime(const char *filename)
|
|||
if (stat(filename, &s) != -1)
|
||||
return s.st_mtime;
|
||||
}
|
||||
*/
|
||||
|
||||
static void PKG_ReadPackContents(struct pkgctx_s *ctx, struct oldpack_s *old)
|
||||
{
|
||||
|
|
|
@ -289,7 +289,7 @@ typedef struct edictrun_s
|
|||
} edictrun_t;
|
||||
|
||||
|
||||
int PDECL Comp_Begin(pubprogfuncs_t *progfuncs, int nump, char **parms);
|
||||
int PDECL Comp_Begin(pubprogfuncs_t *progfuncs, int nump, const char **parms);
|
||||
int PDECL Comp_Continue(pubprogfuncs_t *progfuncs);
|
||||
|
||||
pbool PDECL PR_SetWatchPoint(pubprogfuncs_t *progfuncs, const char *key);
|
||||
|
|
|
@ -114,11 +114,11 @@ struct pubprogfuncs_s
|
|||
|
||||
func_t (PDECL *FindFunction) (pubprogfuncs_t *prinst, const char *funcname, progsnum_t num);
|
||||
|
||||
int (PDECL *StartCompile) (pubprogfuncs_t *prinst, int argv, char **argc); //1 if can compile, 0 if failed to compile
|
||||
int (PDECL *StartCompile) (pubprogfuncs_t *prinst, int argv, const char **argc); //1 if can compile, 0 if failed to compile
|
||||
int (PDECL *ContinueCompile) (pubprogfuncs_t *prinst); //2 if finished, 1 if more to go, 0 if failed
|
||||
|
||||
char *(PDECL *filefromprogs) (pubprogfuncs_t *prinst, progsnum_t prnum, char *fname, size_t *size, char *buffer); //reveals encoded/added files from already loaded progs
|
||||
char *(PDECL *filefromnewprogs) (pubprogfuncs_t *prinst, char *prname, char *fname, size_t *size, char *buffer); //reveals encoded/added files from a progs on the disk somewhere
|
||||
char *(PDECL *filefromprogs) (pubprogfuncs_t *prinst, progsnum_t prnum, const char *fname, size_t *size, char *buffer); //reveals encoded/added files from already loaded progs
|
||||
char *(PDECL *filefromnewprogs) (pubprogfuncs_t *prinst, const char *prname, const char *fname, size_t *size, char *buffer); //reveals encoded/added files from a progs on the disk somewhere
|
||||
|
||||
void (PDECL *ED_Print) (pubprogfuncs_t *prinst, struct edict_s *ed);
|
||||
char *(PDECL *save_ents) (pubprogfuncs_t *prinst, char *buf, size_t *size, size_t maxsize, int mode); //dump the entire progs info into one big self allocated string
|
||||
|
|
|
@ -694,7 +694,7 @@ extern int optres_locals_overlapping;
|
|||
extern int optres_logicops;
|
||||
extern int optres_inlines;
|
||||
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, char **parms);
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, const char **parms);
|
||||
|
||||
void QCC_PR_PrintStatement (QCC_statement_t *s);
|
||||
|
||||
|
@ -711,7 +711,6 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype);
|
|||
QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype);
|
||||
QCC_type_t *QCC_PR_GenFunctionType (QCC_type_t *rettype, struct QCC_typeparam_s *args, int numargs);
|
||||
char *QCC_PR_ParseName (void);
|
||||
CompilerConstant_t *QCC_PR_DefineName(char *name);
|
||||
struct QCC_typeparam_s *QCC_PR_FindStructMember(QCC_type_t *t, const char *membername, unsigned int *out_ofs);
|
||||
QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto);
|
||||
|
||||
|
@ -1054,7 +1053,7 @@ void QCC_PR_ParseInitializerDef(QCC_def_t *def, unsigned int flags);
|
|||
void QCC_PR_FinaliseFunctions(void);
|
||||
|
||||
|
||||
pbool QCC_main (int argc, char **argv); //as part of the quake engine
|
||||
pbool QCC_main (int argc, const char **argv); //as part of the quake engine
|
||||
void QCC_ContinueCompile(void);
|
||||
void PostCompile(void);
|
||||
pbool PreCompile(void);
|
||||
|
@ -1195,6 +1194,7 @@ static void inline QCC_PR_Expect (const char *string)
|
|||
}
|
||||
#endif
|
||||
|
||||
CompilerConstant_t *QCC_PR_DefineName(const char *name);
|
||||
void editbadfile(const char *fname, int line);
|
||||
char *TypeName(QCC_type_t *type, char *buffer, int buffersize);
|
||||
void QCC_PR_AddIncludePath(const char *newinc);
|
||||
|
@ -1210,10 +1210,12 @@ extern void (*pHash_RemoveData)(hashtable_t *table, const char *name, void *data
|
|||
//when originally running from a .dat, we load up all the functions and work from those rather than actual files.
|
||||
//(these get re-written into the resulting .dat)
|
||||
typedef struct qcc_cachedsourcefile_s vfile_t;
|
||||
void QCC_CloseAllVFiles(void);
|
||||
vfile_t *QCC_FindVFile(const char *name);
|
||||
vfile_t *QCC_AddVFile(const char *name, void *data, size_t size);
|
||||
void QCC_CatVFile(vfile_t *, const char *fmt, ...);
|
||||
void QCC_InsertVFile(vfile_t *, size_t pos, const char *fmt, ...);
|
||||
char *ReadProgsCopyright(char *buf, size_t bufsize);
|
||||
|
||||
//void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ extern jmp_buf qcccompileerror;
|
|||
|
||||
// set these before calling CheckParm
|
||||
int myargc;
|
||||
char **myargv;
|
||||
const char **myargv;
|
||||
|
||||
char qcc_token[1024];
|
||||
int qcc_eof;
|
||||
|
|
|
@ -12108,7 +12108,7 @@ static void QCC_CheckForDeadAndMissingReturns(int first, int last, int rettype)
|
|||
{
|
||||
if (statements[last-1].op != OP_GOTO || (signed)statements[last-1].a.ofs > 0)
|
||||
{
|
||||
QCC_PR_ParseWarning(WARN_MISSINGRETURN, "%s: not all control paths return a value", pr_scope->name );
|
||||
QCC_PR_Warning(WARN_MISSINGRETURN, s_filen, statements[last].linenum, "%s: not all control paths return a value", pr_scope->name );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1,s2)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
|
||||
|
||||
void QCC_PR_PreProcessor_Define(pbool append);
|
||||
pbool QCC_PR_UndefineName(char *name);
|
||||
char *QCC_PR_CheckCompConstString(char *def);
|
||||
CompilerConstant_t *QCC_PR_CheckCompConstDefined(char *def);
|
||||
pbool QCC_PR_UndefineName(const char *name);
|
||||
const char *QCC_PR_CheckCompConstString(const char *def);
|
||||
CompilerConstant_t *QCC_PR_CheckCompConstDefined(const char *def);
|
||||
int QCC_PR_CheckCompConst(void);
|
||||
pbool QCC_Include(char *filename);
|
||||
pbool QCC_Include(const char *filename);
|
||||
void QCC_FreeDef(QCC_def_t *def);
|
||||
|
||||
#define MAXINCLUDEDIRS 8
|
||||
|
@ -1579,7 +1579,8 @@ void QCC_PR_LexString (void)
|
|||
unsigned int c, t;
|
||||
int bytecount;
|
||||
int len = 0;
|
||||
char *end, *cnst;
|
||||
char *end;
|
||||
const char *cnst;
|
||||
int raw;
|
||||
char rawdelim[64];
|
||||
int stringtype;
|
||||
|
@ -2833,7 +2834,7 @@ static void QCC_PR_LexGrab (void)
|
|||
//===========================
|
||||
//compiler constants - dmw
|
||||
|
||||
pbool QCC_PR_UndefineName(char *name)
|
||||
pbool QCC_PR_UndefineName(const char *name)
|
||||
{
|
||||
// int a;
|
||||
CompilerConstant_t *c;
|
||||
|
@ -2848,7 +2849,7 @@ pbool QCC_PR_UndefineName(char *name)
|
|||
return true;
|
||||
}
|
||||
|
||||
CompilerConstant_t *QCC_PR_DefineName(char *name)
|
||||
CompilerConstant_t *QCC_PR_DefineName(const char *name)
|
||||
{
|
||||
int i;
|
||||
CompilerConstant_t *cnst;
|
||||
|
@ -3653,9 +3654,9 @@ int QCC_PR_CheckCompConst(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
char *QCC_PR_CheckCompConstString(char *def)
|
||||
const char *QCC_PR_CheckCompConstString(const char *def)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
CompilerConstant_t *c;
|
||||
|
||||
|
@ -3669,7 +3670,7 @@ char *QCC_PR_CheckCompConstString(char *def)
|
|||
return def;
|
||||
}
|
||||
|
||||
CompilerConstant_t *QCC_PR_CheckCompConstDefined(char *def)
|
||||
CompilerConstant_t *QCC_PR_CheckCompConstDefined(const char *def)
|
||||
{
|
||||
CompilerConstant_t *c = pHash_Get(&compconstantstable, def);
|
||||
return c;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
void OptionsDialog(void);
|
||||
static void GUI_CreateInstaller_Windows(void);
|
||||
static void GUI_CreateInstaller_Android(void);
|
||||
pbool GenBuiltinsList(char *buffer, int buffersize);
|
||||
static void SetProgsSrcFileAndPath(char *filename);
|
||||
static void CreateOutputWindow(pbool doannoates);
|
||||
void AddSourceFile(const char *parentsrc, const char *filename);
|
||||
|
@ -355,8 +354,8 @@ static pbool QCC_RegSetValue(HKEY base, char *keyname, char *valuename, int type
|
|||
#undef Sys_Error
|
||||
void Sys_Error(const char *text, ...);
|
||||
|
||||
pbool qcc_vfiles_changed;
|
||||
static vfile_t *qcc_vfiles;
|
||||
extern pbool qcc_vfiles_changed;
|
||||
extern vfile_t *qcc_vfiles;
|
||||
HWND mainwindow;
|
||||
HINSTANCE ghInstance;
|
||||
static INT CALLBACK StupidBrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) ;
|
||||
|
@ -451,96 +450,6 @@ void QCC_SaveVFiles(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
void QCC_CloseAllVFiles(void)
|
||||
{
|
||||
vfile_t *f;
|
||||
|
||||
while(qcc_vfiles)
|
||||
{
|
||||
f = qcc_vfiles;
|
||||
qcc_vfiles = f->next;
|
||||
|
||||
free(f->file);
|
||||
free(f);
|
||||
}
|
||||
qcc_vfiles_changed = false;
|
||||
}
|
||||
vfile_t *QCC_FindVFile(const char *name)
|
||||
{
|
||||
vfile_t *f;
|
||||
for (f = qcc_vfiles; f; f = f->next)
|
||||
{
|
||||
if (!strcmp(f->filename, name))
|
||||
return f;
|
||||
}
|
||||
//give it another go, for case
|
||||
for (f = qcc_vfiles; f; f = f->next)
|
||||
{
|
||||
if (!QC_strcasecmp(f->filename, name))
|
||||
return f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
vfile_t *QCC_AddVFile(const char *name, void *data, size_t size)
|
||||
{
|
||||
vfile_t *f = QCC_FindVFile(name);
|
||||
if (!f)
|
||||
{
|
||||
f = malloc(sizeof(vfile_t) + strlen(name));
|
||||
f->next = qcc_vfiles;
|
||||
strcpy(f->filename, name);
|
||||
qcc_vfiles = f;
|
||||
}
|
||||
else
|
||||
free(f->file);
|
||||
f->file = malloc(size);
|
||||
f->type = FT_CODE;
|
||||
memcpy(f->file, data, size);
|
||||
f->size = f->bufsize = size;
|
||||
|
||||
qcc_vfiles_changed = true;
|
||||
return f;
|
||||
}
|
||||
void QCC_CatVFile(vfile_t *f, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[8192];
|
||||
size_t n;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
QC_vsnprintf (msg,sizeof(msg)-1, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
n = strlen(msg);
|
||||
if (f->size+n > f->bufsize)
|
||||
{
|
||||
size_t msize = f->bufsize + n + 8192;
|
||||
f->file = realloc(f->file, msize);
|
||||
f->bufsize = msize;
|
||||
}
|
||||
memcpy((char*)f->file+f->size, msg, n);
|
||||
f->size += n;
|
||||
}
|
||||
void QCC_InsertVFile(vfile_t *f, size_t pos, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[8192];
|
||||
size_t n;
|
||||
va_start (argptr,fmt);
|
||||
QC_vsnprintf (msg,sizeof(msg)-1, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
n = strlen(msg);
|
||||
if (f->size+n > f->bufsize)
|
||||
{
|
||||
size_t msize = f->bufsize + n + 8192;
|
||||
f->file = realloc(f->file, msize);
|
||||
f->bufsize = msize;
|
||||
}
|
||||
memmove((char*)f->file+pos+n, (char*)f->file+pos, f->size-pos);
|
||||
f->size += n;
|
||||
memcpy((char*)f->file+pos, msg, n);
|
||||
}
|
||||
|
||||
void QCC_EnumerateFilesResult(const char *name, const void *compdata, size_t compsize, int method, size_t plainsize)
|
||||
{
|
||||
|
@ -1144,7 +1053,7 @@ enum
|
|||
|
||||
|
||||
|
||||
void GUI_DialogPrint(char *title, char *text)
|
||||
void GUI_DialogPrint(const char *title, const char *text)
|
||||
{
|
||||
MessageBox(mainwindow, text, title, 0);
|
||||
}
|
||||
|
@ -2407,45 +2316,6 @@ pbool GenAutoCompleteList(char *prefix, char *buffer, int buffersize)
|
|||
return usedbuffer>0;
|
||||
}
|
||||
|
||||
pbool GenBuiltinsList(char *buffer, int buffersize)
|
||||
{
|
||||
QCC_def_t *def;
|
||||
int usedbuffer = 0;
|
||||
int l;
|
||||
int fno;
|
||||
for (fno = 0; fno < sourcefilesnumdefs; fno++)
|
||||
{
|
||||
for (def = sourcefilesdefs[fno]; def; def = def->next)
|
||||
{
|
||||
if (def->scope)
|
||||
continue; //ignore locals, because we don't know where we are, and they're probably irrelevent.
|
||||
|
||||
//if its a builtin function...
|
||||
if (def->type->type == ev_function && def->symboldata->function && functions[def->symboldata->function].code<0)
|
||||
;
|
||||
else if (def->filen && strstr(def->filen, "extensions"))
|
||||
;
|
||||
else
|
||||
continue;
|
||||
|
||||
//but ignore it if its one of those special things that you're not meant to know about.
|
||||
if (strcmp(def->name, "IMMEDIATE") && !strchr(def->name, ':') && !strchr(def->name, '.') && !strchr(def->name, '*') && !strchr(def->name, '['))
|
||||
{
|
||||
l = strlen(def->name);
|
||||
if (l && usedbuffer+2+l < buffersize)
|
||||
{
|
||||
if (usedbuffer)
|
||||
buffer[usedbuffer++] = ' ';
|
||||
memcpy(buffer+usedbuffer, def->name, l);
|
||||
usedbuffer += l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer[usedbuffer] = 0;
|
||||
return usedbuffer>0;
|
||||
}
|
||||
|
||||
editor_t *tooltip_editor = NULL;
|
||||
char tooltip_variable[256];
|
||||
char tooltip_type[256];
|
||||
|
@ -4673,6 +4543,7 @@ void GUI_CreateInstaller_Android(void)
|
|||
free(mandata);
|
||||
}
|
||||
|
||||
#ifdef AVAIL_PNGLIB
|
||||
//size info that microsoft recommends
|
||||
static const struct
|
||||
{
|
||||
|
@ -4692,6 +4563,8 @@ static const struct
|
|||
// {32, 32, 1},
|
||||
{256, 256, 32} //vista!
|
||||
};
|
||||
#endif
|
||||
|
||||
//dates back to 16bit windows. bah.
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
|
@ -6885,7 +6758,7 @@ void compilecb(void)
|
|||
void Sys_Error(const char *text, ...);
|
||||
void RunCompiler(char *args, pbool quick)
|
||||
{
|
||||
char *argv[128];
|
||||
const char *argv[128];
|
||||
int argc;
|
||||
progexterns_t ext;
|
||||
progfuncs_t funcs;
|
||||
|
|
1914
engine/qclib/qccguiqt.cpp
Normal file
1914
engine/qclib/qccguiqt.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,7 @@
|
|||
#include "qcc.h"
|
||||
#include "gui.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define alloca _alloca
|
||||
#else
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -25,8 +23,15 @@ char enginebinary[MAX_OSPATH];
|
|||
char enginebasedir[MAX_OSPATH];
|
||||
char enginecommandline[8192];
|
||||
|
||||
pbool qcc_vfiles_changed;
|
||||
vfile_t *qcc_vfiles;
|
||||
|
||||
//for finding symbol keywords
|
||||
extern QCC_def_t *sourcefilesdefs[];
|
||||
extern int sourcefilesnumdefs;
|
||||
|
||||
int qccpersisthunk = 1;
|
||||
int Grep(char *filename, char *string)
|
||||
int Grep(const char *filename, const char *string)
|
||||
{
|
||||
int foundcount = 0;
|
||||
char *last, *found, *linestart;
|
||||
|
@ -74,7 +79,7 @@ int Grep(char *filename, char *string)
|
|||
|
||||
return foundcount;
|
||||
}
|
||||
void GoToDefinition(char *name)
|
||||
void GoToDefinition(const char *name)
|
||||
{
|
||||
#define MAXSOURCEFILESLIST 8
|
||||
extern QCC_def_t *sourcefilesdefs[MAXSOURCEFILESLIST];
|
||||
|
@ -84,16 +89,23 @@ void GoToDefinition(char *name)
|
|||
QCC_def_t *def, *guess;
|
||||
QCC_function_t *fnc;
|
||||
|
||||
char *strip; //trim whitespace (for convieniance).
|
||||
const char *strip; //trim whitespace (for convieniance).
|
||||
while (*name <= ' ' && *name)
|
||||
name++;
|
||||
for (strip = name + strlen(name)-1; *strip; strip++)
|
||||
for (strip = name + strlen(name)-1; strip > name; strip--)
|
||||
{
|
||||
if (*strip <= ' ')
|
||||
*strip = '\0';
|
||||
continue;
|
||||
else //got some part of a word
|
||||
break;
|
||||
}
|
||||
if (*strip <= ' ')
|
||||
{
|
||||
char *t = alloca(strip-name+1);
|
||||
memcpy(t, name, strip-t);
|
||||
t[strip-t] = 0;
|
||||
name = t;
|
||||
}
|
||||
|
||||
if (!globalstable.numbuckets)
|
||||
{
|
||||
|
@ -449,11 +461,11 @@ void GUI_LoadConfig(void)
|
|||
|
||||
|
||||
//this function takes the windows specified commandline and strips out all the options menu items.
|
||||
int GUI_ParseCommandLine(char *args, pbool keepsrcanddir)
|
||||
int GUI_ParseCommandLine(const char *args, pbool keepsrcanddir)
|
||||
{
|
||||
int paramlen=0;
|
||||
int l, p;
|
||||
char *next;
|
||||
const char *next;
|
||||
int mode = 0;
|
||||
|
||||
if (!*args)
|
||||
|
@ -469,8 +481,8 @@ int GUI_ParseCommandLine(char *args, pbool keepsrcanddir)
|
|||
len = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
args = alloca(len+1);
|
||||
fread(args, 1, len, f);
|
||||
args[len] = '\0';
|
||||
fread((char*)args, 1, len, f);
|
||||
((char*)args)[len] = '\0';
|
||||
fclose(f);
|
||||
|
||||
while((s = strchr(args, '\r')))
|
||||
|
@ -835,12 +847,12 @@ void GUI_RevealOptions(void)
|
|||
|
||||
|
||||
|
||||
int GUI_BuildParms(char *args, char **argv, pbool quick)//, char *forceoutputfile)
|
||||
int GUI_BuildParms(const char *args, const char **argv, pbool quick)//, char *forceoutputfile)
|
||||
{
|
||||
static char param[2048];
|
||||
int paramlen = 0;
|
||||
int argc;
|
||||
char *next;
|
||||
const char *next;
|
||||
int i;
|
||||
int targ;
|
||||
char *targs[] = {"", "-Th2", "-Tfte", "-Tfteh2"};
|
||||
|
@ -938,3 +950,133 @@ int GUI_BuildParms(char *args, char **argv, pbool quick)//, char *forceoutputfil
|
|||
|
||||
return argc;
|
||||
}
|
||||
|
||||
pbool GenBuiltinsList(char *buffer, int buffersize)
|
||||
{
|
||||
QCC_def_t *def;
|
||||
int usedbuffer = 0;
|
||||
int l;
|
||||
int fno;
|
||||
for (fno = 0; fno < sourcefilesnumdefs; fno++)
|
||||
{
|
||||
for (def = sourcefilesdefs[fno]; def; def = def->next)
|
||||
{
|
||||
if (def->scope)
|
||||
continue; //ignore locals, because we don't know where we are, and they're probably irrelevent.
|
||||
|
||||
//if its a builtin function...
|
||||
if (def->type->type == ev_function && def->symboldata->function && functions[def->symboldata->function].code<0)
|
||||
;
|
||||
else if (def->filen && strstr(def->filen, "extensions"))
|
||||
;
|
||||
else
|
||||
continue;
|
||||
|
||||
//but ignore it if its one of those special things that you're not meant to know about.
|
||||
if (strcmp(def->name, "IMMEDIATE") && !strchr(def->name, ':') && !strchr(def->name, '.') && !strchr(def->name, '*') && !strchr(def->name, '['))
|
||||
{
|
||||
l = strlen(def->name);
|
||||
if (l && usedbuffer+2+l < buffersize)
|
||||
{
|
||||
if (usedbuffer)
|
||||
buffer[usedbuffer++] = ' ';
|
||||
memcpy(buffer+usedbuffer, def->name, l);
|
||||
usedbuffer += l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer[usedbuffer] = 0;
|
||||
return usedbuffer>0;
|
||||
}
|
||||
|
||||
void QCC_CloseAllVFiles(void)
|
||||
{
|
||||
vfile_t *f;
|
||||
|
||||
while(qcc_vfiles)
|
||||
{
|
||||
f = qcc_vfiles;
|
||||
qcc_vfiles = f->next;
|
||||
|
||||
free(f->file);
|
||||
free(f);
|
||||
}
|
||||
qcc_vfiles_changed = false;
|
||||
}
|
||||
vfile_t *QCC_FindVFile(const char *name)
|
||||
{
|
||||
vfile_t *f;
|
||||
for (f = qcc_vfiles; f; f = f->next)
|
||||
{
|
||||
if (!strcmp(f->filename, name))
|
||||
return f;
|
||||
}
|
||||
//give it another go, for case
|
||||
for (f = qcc_vfiles; f; f = f->next)
|
||||
{
|
||||
if (!QC_strcasecmp(f->filename, name))
|
||||
return f;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
vfile_t *QCC_AddVFile(const char *name, void *data, size_t size)
|
||||
{
|
||||
vfile_t *f = QCC_FindVFile(name);
|
||||
if (!f)
|
||||
{
|
||||
f = malloc(sizeof(vfile_t) + strlen(name));
|
||||
f->next = qcc_vfiles;
|
||||
strcpy(f->filename, name);
|
||||
qcc_vfiles = f;
|
||||
}
|
||||
else
|
||||
free(f->file);
|
||||
f->file = malloc(size);
|
||||
f->type = FT_CODE;
|
||||
memcpy(f->file, data, size);
|
||||
f->size = f->bufsize = size;
|
||||
|
||||
qcc_vfiles_changed = true;
|
||||
return f;
|
||||
}
|
||||
void QCC_CatVFile(vfile_t *f, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[8192];
|
||||
size_t n;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
QC_vsnprintf (msg,sizeof(msg)-1, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
n = strlen(msg);
|
||||
if (f->size+n > f->bufsize)
|
||||
{
|
||||
size_t msize = f->bufsize + n + 8192;
|
||||
f->file = realloc(f->file, msize);
|
||||
f->bufsize = msize;
|
||||
}
|
||||
memcpy((char*)f->file+f->size, msg, n);
|
||||
f->size += n;
|
||||
}
|
||||
void QCC_InsertVFile(vfile_t *f, size_t pos, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[8192];
|
||||
size_t n;
|
||||
va_start (argptr,fmt);
|
||||
QC_vsnprintf (msg,sizeof(msg)-1, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
n = strlen(msg);
|
||||
if (f->size+n > f->bufsize)
|
||||
{
|
||||
size_t msize = f->bufsize + n + 8192;
|
||||
f->file = realloc(f->file, msize);
|
||||
f->bufsize = msize;
|
||||
}
|
||||
memmove((char*)f->file+pos+n, (char*)f->file+pos, f->size-pos);
|
||||
f->size += n;
|
||||
memcpy((char*)f->file+pos, msg, n);
|
||||
}
|
||||
|
|
|
@ -3973,7 +3973,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
{
|
||||
CompilerConstant_t *cnst;
|
||||
int i, j, p;
|
||||
char *name, *val;
|
||||
const char *name, *val;
|
||||
pbool werror = false;
|
||||
qcc_nopragmaoptimise = false;
|
||||
|
||||
|
@ -4036,10 +4036,15 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
val = strchr(name, '=');
|
||||
if (val)
|
||||
{
|
||||
*val = '\0';
|
||||
char *t = malloc(val-name+1);
|
||||
memcpy(t, name, val-name);
|
||||
t[val-name] = 0;
|
||||
cnst = QCC_PR_DefineName(t);
|
||||
free(t);
|
||||
val++;
|
||||
}
|
||||
cnst = QCC_PR_DefineName(name);
|
||||
else
|
||||
cnst = QCC_PR_DefineName(name);
|
||||
if (val)
|
||||
{
|
||||
cnst->value = qccHunkAlloc(strlen(val)+1);
|
||||
|
@ -4065,7 +4070,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *a = myargv[i]+2;
|
||||
const char *a = myargv[i]+2;
|
||||
pbool state = true;
|
||||
if (!strnicmp(a, "no-", 3))
|
||||
{
|
||||
|
@ -4284,7 +4289,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
|
||||
else if ( !strnicmp(myargv[i], "-W", 2) || WINDOWSARG(!strnicmp(myargv[i], "/W", 2)) )
|
||||
{
|
||||
char *a = myargv[i]+2;
|
||||
const char *a = myargv[i]+2;
|
||||
if (!stricmp(a, "all"))
|
||||
{
|
||||
for (j = 0; j < ERR_PARSEERRORS; j++)
|
||||
|
@ -4662,7 +4667,7 @@ const char *qcccol[COL_MAX];
|
|||
int qcc_compileactive = false;
|
||||
extern int accglobalsblock;
|
||||
char *originalqccmsrc; //for autoprototype.
|
||||
pbool QCC_main (int argc, char **argv) //as part of the quake engine
|
||||
pbool QCC_main (int argc, const char **argv) //as part of the quake engine
|
||||
{
|
||||
extern int pr_bracelevel;
|
||||
time_t long_time;
|
||||
|
|
|
@ -115,7 +115,7 @@ static int logprintf(const char *format, ...)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int main (int argc, const char **argv)
|
||||
{
|
||||
unsigned int i;
|
||||
pbool sucess;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
pbool QC_decodeMethodSupported(int method);
|
||||
char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, const char *info, char *buffer);
|
||||
char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, const void *info, char *buffer);
|
||||
int QC_encode(progfuncs_t *progfuncs, int len, int method, const char *in, int handle);
|
||||
int QC_EnumerateFilesFromBlob(const void *blob, size_t blobsize, void (*cb)(const char *name, const void *compdata, size_t compsize, int method, size_t plainsize));
|
||||
int QC_encodecrc(int len, char *in);
|
||||
|
||||
char *PDECL filefromprogs(pubprogfuncs_t *progfuncs, progsnum_t prnum, char *fname, size_t *size, char *buffer);
|
||||
char *filefromnewprogs(pubprogfuncs_t *progfuncs, char *prname, char *fname, size_t *size, char *buffer);//fixme - remove parm 1
|
||||
char *PDECL filefromprogs(pubprogfuncs_t *progfuncs, progsnum_t prnum, const char *fname, size_t *size, char *buffer);
|
||||
char *filefromnewprogs(pubprogfuncs_t *progfuncs, const char *prname, const char *fname, size_t *size, char *buffer);//fixme - remove parm 1
|
||||
|
||||
void DecompileProgsDat(char *name, void *buf, size_t bufsize);
|
||||
char *ReadProgsCopyright(char *buf, size_t bufsize);
|
||||
|
|
|
@ -41,7 +41,7 @@ pbool QC_decodeMethodSupported(int method)
|
|||
return false;
|
||||
}
|
||||
|
||||
char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, const char *info, char *buffer)
|
||||
char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, const void *info, char *buffer)
|
||||
{
|
||||
int i;
|
||||
if (method == 0) //copy
|
||||
|
@ -53,7 +53,7 @@ char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, const
|
|||
{
|
||||
if (complen != len) Sys_Error("lengths do not match");
|
||||
for (i = 0; i < len; i++)
|
||||
buffer[i] = info[i] ^ 0xA5;
|
||||
buffer[i] = ((const char*)info)[i] ^ 0xA5;
|
||||
}
|
||||
#ifdef AVAIL_ZLIB
|
||||
else if (method == 2 || method == 8) //compression (ZLIB)
|
||||
|
@ -272,7 +272,7 @@ int QC_EnumerateFilesFromBlob(const void *blob, size_t blobsize, void (*cb)(cons
|
|||
return ret;
|
||||
}
|
||||
|
||||
char *PDECL filefromprogs(pubprogfuncs_t *ppf, progsnum_t prnum, char *fname, size_t *size, char *buffer)
|
||||
char *PDECL filefromprogs(pubprogfuncs_t *ppf, progsnum_t prnum, const char *fname, size_t *size, char *buffer)
|
||||
{
|
||||
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
|
||||
int num;
|
||||
|
@ -310,7 +310,7 @@ char *PDECL filefromprogs(pubprogfuncs_t *ppf, progsnum_t prnum, char *fname, si
|
|||
}
|
||||
|
||||
/*
|
||||
char *filefromnewprogs(progfuncs_t *progfuncs, char *prname, char *fname, int *size, char *buffer)
|
||||
char *filefromnewprogs(progfuncs_t *progfuncs, const char *prname, const char *fname, int *size, char *buffer)
|
||||
{
|
||||
int num;
|
||||
includeddatafile_t *s;
|
||||
|
|
|
@ -1313,7 +1313,7 @@ static void PR_Compile_f(void)
|
|||
qboolean killondone = false;
|
||||
int argc=3;
|
||||
double time = Sys_DoubleTime();
|
||||
char *argv[64] = {"", "-src", pr_sourcedir.string, "-srcfile", "progs.src"};
|
||||
const char *argv[64] = {"", "-src", pr_sourcedir.string, "-srcfile", "progs.src"};
|
||||
|
||||
if (Cmd_Argc()>2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue