mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Happy fun memory usage optimization
git-svn-id: https://svn.eduke32.com/eduke32@385 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ccb93c19d8
commit
c8abb8384d
2 changed files with 50 additions and 23 deletions
|
@ -2370,14 +2370,18 @@ char parsecommand(void)
|
|||
if (*textptr == 0) break;
|
||||
}
|
||||
j = 0;
|
||||
if (music_fn[k][i] == NULL)
|
||||
music_fn[k][i] = Bcalloc(BMAX_PATH,sizeof(char));
|
||||
while (isaltok(*(textptr+j)))
|
||||
{
|
||||
music_fn[k][i][j] = textptr[j];
|
||||
tempbuf[j] = textptr[j];
|
||||
j++;
|
||||
}
|
||||
music_fn[k][i][j] = '\0';
|
||||
tempbuf[j] = '\0';
|
||||
|
||||
if (music_fn[k][i] == NULL)
|
||||
music_fn[k][i] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
|
||||
|
||||
Bstrcpy(music_fn[k][i],tempbuf);
|
||||
|
||||
textptr += j;
|
||||
if (i > MAXLEVELS-1) break;
|
||||
i++;
|
||||
|
@ -4519,12 +4523,9 @@ repeatcase:
|
|||
|
||||
i = 0;
|
||||
|
||||
if (level_file_names[j*MAXLEVELS+k] == NULL)
|
||||
level_file_names[j*MAXLEVELS+k] = Bcalloc(BMAX_PATH,sizeof(char));
|
||||
|
||||
while (*textptr != ' ' && *textptr != '\t' && *textptr != 0x0a)
|
||||
{
|
||||
level_file_names[j*MAXLEVELS+k][i] = *textptr;
|
||||
tempbuf[i] = *textptr;
|
||||
textptr++,i++;
|
||||
if (i >= BMAX_PATH)
|
||||
{
|
||||
|
@ -4534,7 +4535,14 @@ repeatcase:
|
|||
break;
|
||||
}
|
||||
}
|
||||
level_file_names[j*MAXLEVELS+k][i] = '\0';
|
||||
tempbuf[i] = '\0';
|
||||
|
||||
if (level_file_names[j*MAXLEVELS+k] == NULL)
|
||||
level_file_names[j*MAXLEVELS+k] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
|
||||
|
||||
/* initprintf("level file name string len: %ld\n",Bstrlen(tempbuf)); */
|
||||
|
||||
Bstrcpy(level_file_names[j*MAXLEVELS+k],tempbuf);
|
||||
|
||||
while (*textptr == ' ' || *textptr == '\t') textptr++;
|
||||
|
||||
|
@ -4554,22 +4562,28 @@ repeatcase:
|
|||
|
||||
i = 0;
|
||||
|
||||
if (level_names[j*MAXLEVELS+k] == NULL)
|
||||
level_names[j*MAXLEVELS+k] = Bcalloc(32,sizeof(char));
|
||||
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
|
||||
{
|
||||
level_names[j*MAXLEVELS+k][i] = toupper(*textptr);
|
||||
tempbuf[i] = Btoupper(*textptr);
|
||||
textptr++,i++;
|
||||
if (i >= 32)
|
||||
{
|
||||
initprintf("%s:%ld: error: level name exceeds limit of %ld characters.\n",compilefile,line_number,sizeof(level_names[j*MAXLEVELS+k])-1);
|
||||
initprintf("%s:%ld: error: level name exceeds limit of %ld characters.\n",compilefile,line_number,32);
|
||||
error++;
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
level_names[j*MAXLEVELS+k][i] = '\0';
|
||||
|
||||
tempbuf[i] = '\0';
|
||||
|
||||
if (level_names[j*MAXLEVELS+k] == NULL)
|
||||
level_names[j*MAXLEVELS+k] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
|
||||
|
||||
/* initprintf("level name string len: %ld\n",Bstrlen(tempbuf)); */
|
||||
|
||||
Bstrcpy(level_names[j*MAXLEVELS+k],tempbuf);
|
||||
|
||||
return 0;
|
||||
|
||||
case CON_DEFINEQUOTE:
|
||||
|
|
|
@ -1609,20 +1609,27 @@ int enterlevel(char g)
|
|||
if ((g&MODE_DEMO) == 0 && ud.recstat == 2)
|
||||
ud.recstat = 0;
|
||||
|
||||
if (VOLUMEALL) Bsprintf(tempbuf,HEAD2);
|
||||
else Bsprintf(tempbuf,HEAD);
|
||||
|
||||
Bstrcat(tempbuf,apptitle);
|
||||
wm_setapptitle(tempbuf);
|
||||
|
||||
FX_StopAllSounds();
|
||||
clearsoundlocks();
|
||||
FX_SetReverb(0);
|
||||
|
||||
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL || level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL)
|
||||
{
|
||||
initprintf("Map E%ldL%ld not defined!\n",ud.volume_number+1,ud.level_number+1);
|
||||
return 1;
|
||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
{
|
||||
if (level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL)
|
||||
level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] = Bcalloc(BMAX_PATH,sizeof(char));
|
||||
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL)
|
||||
{
|
||||
level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] = Bcalloc(8,sizeof(char));
|
||||
Bsprintf(level_names[(ud.volume_number*MAXLEVELS)+ud.level_number],"USER MAP");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Map E%ldL%ld not defined!\n",ud.volume_number+1,ud.level_number+1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
i = ud.screen_size;
|
||||
|
@ -1638,6 +1645,12 @@ int enterlevel(char g)
|
|||
}
|
||||
else Bsprintf(apptitle," - %s",level_names[(ud.volume_number*MAXLEVELS)+ud.level_number]);
|
||||
|
||||
if (VOLUMEALL) Bsprintf(tempbuf,HEAD2);
|
||||
else Bsprintf(tempbuf,HEAD);
|
||||
|
||||
Bstrcat(tempbuf,apptitle);
|
||||
wm_setapptitle(tempbuf);
|
||||
|
||||
if (!VOLUMEONE)
|
||||
{
|
||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
|
|
Loading…
Reference in a new issue