Misc cleanup. Removed ability to use .CON files found in the .GRP when the .CON files found in the directory can't be compiled.

git-svn-id: https://svn.eduke32.com/eduke32@5883 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-10-09 00:15:10 +00:00
parent cf6790b23e
commit 231c22d654

View file

@ -6287,7 +6287,7 @@ void C_PrintStats(void)
initprintf("\n"); initprintf("\n");
} }
void C_Compile(const char *filenam) void C_Compile(const char *fileName)
{ {
int32_t i; int32_t i;
@ -6298,14 +6298,12 @@ void C_Compile(const char *filenam)
Bmemset(&g_tile[i], 0, sizeof(tiledata_t)); Bmemset(&g_tile[i], 0, sizeof(tiledata_t));
C_InitHashes(); C_InitHashes();
Gv_Init(); Gv_Init();
C_InitProjectiles(); C_InitProjectiles();
int32_t fp = kopen4loadfrommod(filenam,g_loadFromGroupOnly); int kFile = kopen4loadfrommod(fileName,g_loadFromGroupOnly);
if (fp == -1) // JBF: was 0 if (kFile == -1) // JBF: was 0
{ {
if (g_loadFromGroupOnly == 1 || numgroupfiles == 0) if (g_loadFromGroupOnly == 1 || numgroupfiles == 0)
{ {
@ -6318,7 +6316,7 @@ void C_Compile(const char *filenam)
} }
else else
{ {
Bsprintf(tempbuf,"CON file `%s' missing.", filenam); Bsprintf(tempbuf,"CON file `%s' missing.", fileName);
G_GameExit(tempbuf); G_GameExit(tempbuf);
} }
@ -6326,20 +6324,20 @@ void C_Compile(const char *filenam)
return; //Not there return; //Not there
} }
int32_t const fs = kfilelength(fp); int const kFileLen = kfilelength(kFile);
initprintf("Compiling: %s (%d bytes)\n",filenam,fs); initprintf("Compiling: %s (%d bytes)\n", fileName, kFileLen);
flushlogwindow = 0; flushlogwindow = 0;
uint32_t const startcompiletime = getticks(); uint32_t const startcompiletime = getticks();
char * mptr = (char *)Xmalloc(fs+1); char * mptr = (char *)Xmalloc(kFileLen+1);
mptr[fs] = 0; mptr[kFileLen] = 0;
textptr = (char *) mptr; textptr = (char *) mptr;
kread(fp,(char *)textptr,fs); kread(kFile,(char *)textptr,kFileLen);
kclose(fp); kclose(kFile);
Bfree(apScript); Bfree(apScript);
@ -6347,7 +6345,8 @@ void C_Compile(const char *filenam)
bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t)); bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t));
// initprintf("script: %d, bitptr: %d\n",script,bitptr); // initprintf("script: %d, bitptr: %d\n",script,bitptr);
g_labelCnt = g_defaultLabelCnt = 0; g_labelCnt = 0;
g_defaultLabelCnt = 0;
g_scriptPtr = apScript + 3; // move permits constants 0 and 1; moveptr[1] would be script[2] (reachable?) g_scriptPtr = apScript + 3; // move permits constants 0 and 1; moveptr[1] would be script[2] (reachable?)
g_warningCnt = 0; g_warningCnt = 0;
g_errorCnt = 0; g_errorCnt = 0;
@ -6356,7 +6355,7 @@ void C_Compile(const char *filenam)
C_AddDefaultDefinitions(); C_AddDefaultDefinitions();
Bstrcpy(g_scriptFileName, filenam); Bstrcpy(g_scriptFileName, fileName);
C_ParseCommand(1); C_ParseCommand(1);
@ -6381,40 +6380,11 @@ void C_Compile(const char *filenam)
initprintf("Found %d warning(s), %d error(s).\n", g_warningCnt, g_errorCnt); initprintf("Found %d warning(s), %d error(s).\n", g_warningCnt, g_errorCnt);
if (g_errorCnt) if (g_errorCnt)
{
if (g_loadFromGroupOnly)
{ {
Bsprintf(buf, "Error compiling CON files."); Bsprintf(buf, "Error compiling CON files.");
G_GameExit(buf); G_GameExit(buf);
} }
else
{
if (g_groupFileHandle != -1 && g_loadFromGroupOnly == 0)
{
// initprintf("Error(s) found in file `%s'. Do you want to use the INTERNAL DEFAULTS (y/N)?\n",filenam);
i=wm_ynbox("CON File Compilation Error", "Error(s) found in file `%s'. Do you want to use the "
"INTERNAL DEFAULTS?",filenam);
if (i) i = 'y';
if (i == 'y' || i == 'Y')
{
initprintf(" Yes\n");
g_loadFromGroupOnly = 1;
return;
}
else
{
# if (defined _WIN32 || (defined RENDERTYPESDL && ((defined __APPLE__ && defined OSX_STARTUPWINDOW) || defined HAVE_GTK2)))
while (!quitevent) // keep the window open so people can copy CON errors out of it
handleevents();
# endif
G_GameExit("");
}
}
}
}
else
{
for (i = 0; i < MAXEVENTS; ++i) for (i = 0; i < MAXEVENTS; ++i)
{ {
intptr_t *eventEnd = apScript + apScriptGameEventEnd[i]; intptr_t *eventEnd = apScript + apScriptGameEventEnd[i];
@ -6449,7 +6419,6 @@ void C_Compile(const char *filenam)
C_InitQuotes(); C_InitQuotes();
} }
}
void C_ReportError(int32_t iError) void C_ReportError(int32_t iError)
{ {