mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Don't clobber E1L8 for user maps
git-svn-id: https://svn.eduke32.com/eduke32@8016 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
733cb636cd
commit
4f5434dffe
7 changed files with 54 additions and 22 deletions
|
@ -4760,6 +4760,7 @@ void G_HandleLocalKeys(void)
|
||||||
{
|
{
|
||||||
const unsigned int maxi = VOLUMEALL ? MUS_FIRST_SPECIAL : 6;
|
const unsigned int maxi = VOLUMEALL ? MUS_FIRST_SPECIAL : 6;
|
||||||
|
|
||||||
|
unsigned int const oldMusicIndex = g_musicIndex;
|
||||||
unsigned int MyMusicIndex = g_musicIndex;
|
unsigned int MyMusicIndex = g_musicIndex;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -4767,7 +4768,7 @@ void G_HandleLocalKeys(void)
|
||||||
if (MyMusicIndex >= maxi)
|
if (MyMusicIndex >= maxi)
|
||||||
MyMusicIndex = 0;
|
MyMusicIndex = 0;
|
||||||
}
|
}
|
||||||
while (S_TryPlayLevelMusic(MyMusicIndex));
|
while (S_TryPlayLevelMusic(MyMusicIndex) && MyMusicIndex != oldMusicIndex);
|
||||||
|
|
||||||
G_PrintCurrentMusic();
|
G_PrintCurrentMusic();
|
||||||
|
|
||||||
|
|
|
@ -301,6 +301,9 @@ extern user_defs ud;
|
||||||
extern const char *s_buildDate;
|
extern const char *s_buildDate;
|
||||||
|
|
||||||
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
|
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
|
||||||
|
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES
|
||||||
|
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
|
||||||
|
#define USERMAPMUSICFAKESLOT ((USERMAPMUSICFAKEVOLUME * MAXLEVELS) + USERMAPMUSICFAKELEVEL)
|
||||||
|
|
||||||
static inline int G_HaveUserMap(void)
|
static inline int G_HaveUserMap(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3817,6 +3817,12 @@ badindex:
|
||||||
case STR_MAPNAME:
|
case STR_MAPNAME:
|
||||||
case STR_MAPFILENAME:
|
case STR_MAPFILENAME:
|
||||||
{
|
{
|
||||||
|
if (G_HaveUserMap())
|
||||||
|
{
|
||||||
|
snprintf(apStrings[q], MAXQUOTELEN, "%s", boardfilename);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int const levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
|
int const levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
|
||||||
const char *pName;
|
const char *pName;
|
||||||
|
|
||||||
|
@ -3848,6 +3854,12 @@ badindex:
|
||||||
break;
|
break;
|
||||||
case STR_GAMETYPE: Bstrcpy(apStrings[q], g_gametypeNames[ud.coop]); break;
|
case STR_GAMETYPE: Bstrcpy(apStrings[q], g_gametypeNames[ud.coop]); break;
|
||||||
case STR_VOLUMENAME:
|
case STR_VOLUMENAME:
|
||||||
|
if (G_HaveUserMap())
|
||||||
|
{
|
||||||
|
apStrings[q][0] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned)ud.volume_number >= MAXVOLUMES))
|
if (EDUKE32_PREDICT_FALSE((unsigned)ud.volume_number >= MAXVOLUMES))
|
||||||
{
|
{
|
||||||
CON_ERRPRINTF("invalid volume %d\n", ud.volume_number);
|
CON_ERRPRINTF("invalid volume %d\n", ud.volume_number);
|
||||||
|
@ -3859,7 +3871,7 @@ badindex:
|
||||||
case STR_PARTIME: Bstrcpy(apStrings[q], G_PrintParTime()); break;
|
case STR_PARTIME: Bstrcpy(apStrings[q], G_PrintParTime()); break;
|
||||||
case STR_DESIGNERTIME: Bstrcpy(apStrings[q], G_PrintDesignerTime()); break;
|
case STR_DESIGNERTIME: Bstrcpy(apStrings[q], G_PrintDesignerTime()); break;
|
||||||
case STR_BESTTIME: Bstrcpy(apStrings[q], G_PrintBestTime()); break;
|
case STR_BESTTIME: Bstrcpy(apStrings[q], G_PrintBestTime()); break;
|
||||||
case STR_USERMAPFILENAME: Bstrcpy(apStrings[q], boardfilename); break;
|
case STR_USERMAPFILENAME: snprintf(apStrings[q], MAXQUOTELEN, "%s", boardfilename); break;
|
||||||
default: CON_ERRPRINTF("invalid string index %d or %d\n", q, j); abort_after_error();
|
default: CON_ERRPRINTF("invalid string index %d or %d\n", q, j); abort_after_error();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// levnamebuf should have at least size BMAX_PATH
|
// levnamebuf should have at least size BMAX_PATH
|
||||||
void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum)
|
void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char const *exts[] = {
|
char const *exts[] = {
|
||||||
|
@ -1797,14 +1797,29 @@ void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum
|
||||||
if ((kFile = kopen4loadfrommod(nameBuf, 0)) != buildvfs_kfd_invalid)
|
if ((kFile = kopen4loadfrommod(nameBuf, 0)) != buildvfs_kfd_invalid)
|
||||||
{
|
{
|
||||||
kclose(kFile);
|
kclose(kFile);
|
||||||
realloc_copy(&g_mapInfo[levelNum].musicfn, nameBuf);
|
realloc_copy(&g_mapInfo[USERMAPMUSICFAKESLOT].musicfn, nameBuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char const * usermapMusic = g_mapInfo[MUS_USERMAP].musicfn;
|
char const * usermapMusic = g_mapInfo[MUS_USERMAP].musicfn;
|
||||||
if (usermapMusic != nullptr)
|
if (usermapMusic != nullptr)
|
||||||
realloc_copy(&g_mapInfo[levelNum].musicfn, usermapMusic);
|
{
|
||||||
|
realloc_copy(&g_mapInfo[USERMAPMUSICFAKESLOT].musicfn, usermapMusic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef EDUKE32_STANDALONE
|
||||||
|
if (!FURY)
|
||||||
|
{
|
||||||
|
char const * e1l8 = g_mapInfo[7].musicfn;
|
||||||
|
if (e1l8 != nullptr)
|
||||||
|
{
|
||||||
|
realloc_copy(&g_mapInfo[USERMAPMUSICFAKESLOT].musicfn, e1l8);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_CheckIfStateless()
|
static void G_CheckIfStateless()
|
||||||
|
@ -1870,6 +1885,8 @@ int G_EnterLevel(int gameMode)
|
||||||
boardfilename[0] = 0;
|
boardfilename[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
boardfilename[0] = '\0';
|
||||||
|
|
||||||
int const mapidx = (ud.volume_number * MAXLEVELS) + ud.level_number;
|
int const mapidx = (ud.volume_number * MAXLEVELS) + ud.level_number;
|
||||||
|
|
||||||
|
@ -1877,17 +1894,9 @@ int G_EnterLevel(int gameMode)
|
||||||
|
|
||||||
auto &m = g_mapInfo[mapidx];
|
auto &m = g_mapInfo[mapidx];
|
||||||
|
|
||||||
|
if (VOLUMEONE || !Menu_HaveUserMap())
|
||||||
|
{
|
||||||
if (m.name == NULL || m.filename == NULL)
|
if (m.name == NULL || m.filename == NULL)
|
||||||
{
|
|
||||||
if (Menu_HaveUserMap())
|
|
||||||
{
|
|
||||||
if (m.filename == NULL)
|
|
||||||
m.filename = (char *)Xcalloc(BMAX_PATH, sizeof(uint8_t));
|
|
||||||
|
|
||||||
if (m.name == NULL)
|
|
||||||
m.name = Xstrdup("User Map");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1944,7 +1953,7 @@ int G_EnterLevel(int gameMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
G_LoadMapHack(levelName, boardfilename);
|
G_LoadMapHack(levelName, boardfilename);
|
||||||
G_SetupFilenameBasedMusic(levelName, boardfilename, ud.m_level_number);
|
G_SetupFilenameBasedMusic(levelName, boardfilename);
|
||||||
}
|
}
|
||||||
else if (engineLoadBoard(m.filename, VOLUMEONE, &p0.pos, &playerAngle, &p0.cursectnum) < 0)
|
else if (engineLoadBoard(m.filename, VOLUMEONE, &p0.pos, &playerAngle, &p0.cursectnum) < 0)
|
||||||
{
|
{
|
||||||
|
@ -1982,7 +1991,11 @@ int G_EnterLevel(int gameMode)
|
||||||
|
|
||||||
if (ud.recstat != 2)
|
if (ud.recstat != 2)
|
||||||
{
|
{
|
||||||
if (g_mapInfo[g_musicIndex].musicfn == NULL || m.musicfn == NULL ||
|
if (Menu_HaveUserMap())
|
||||||
|
{
|
||||||
|
S_PlayLevelMusicOrNothing(USERMAPMUSICFAKESLOT);
|
||||||
|
}
|
||||||
|
else if (g_mapInfo[g_musicIndex].musicfn == NULL || m.musicfn == NULL ||
|
||||||
strcmp(g_mapInfo[g_musicIndex].musicfn, m.musicfn) || g_musicSize == 0 || ud.last_level == -1)
|
strcmp(g_mapInfo[g_musicIndex].musicfn, m.musicfn) || g_musicSize == 0 || ud.last_level == -1)
|
||||||
{
|
{
|
||||||
S_PlayLevelMusicOrNothing(mapidx);
|
S_PlayLevelMusicOrNothing(mapidx);
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
||||||
extern int32_t g_levelTextTime;
|
extern int32_t g_levelTextTime;
|
||||||
extern int32_t voting,vote_map,vote_episode;
|
extern int32_t voting,vote_map,vote_episode;
|
||||||
extern palette_t CrosshairColors;
|
extern palette_t CrosshairColors;
|
||||||
void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum);
|
void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName);
|
||||||
int G_EnterLevel(int gameMode);
|
int G_EnterLevel(int gameMode);
|
||||||
int G_FindLevelByFile(const char *fileName);
|
int G_FindLevelByFile(const char *fileName);
|
||||||
void G_CacheMapData(void);
|
void G_CacheMapData(void);
|
||||||
|
|
|
@ -2454,10 +2454,10 @@ static void postloadplayer(int32_t savegamep)
|
||||||
S_ClearSoundLocks();
|
S_ClearSoundLocks();
|
||||||
G_CacheMapData();
|
G_CacheMapData();
|
||||||
|
|
||||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 && ud.music_level == 7 && ud.music_episode == 0)
|
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 && ud.music_level == USERMAPMUSICFAKELEVEL && ud.music_episode == USERMAPMUSICFAKEVOLUME)
|
||||||
{
|
{
|
||||||
char levname[BMAX_PATH];
|
char levname[BMAX_PATH];
|
||||||
G_SetupFilenameBasedMusic(levname, boardfilename, ud.level_number);
|
G_SetupFilenameBasedMusic(levname, boardfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_mapInfo[musicIdx].musicfn != NULL && (musicIdx != g_musicIndex || different_user_map))
|
if (g_mapInfo[musicIdx].musicfn != NULL && (musicIdx != g_musicIndex || different_user_map))
|
||||||
|
|
|
@ -1118,9 +1118,12 @@ void G_DisplayRest(int32_t smoothratio)
|
||||||
if (textret == 0 && ud.overhead_on == 2)
|
if (textret == 0 && ud.overhead_on == 2)
|
||||||
{
|
{
|
||||||
const int32_t a = (ud.screen_size > 0) ? 147 : 179;
|
const int32_t a = (ud.screen_size > 0) ? 147 : 179;
|
||||||
if (!(G_GetLogoFlags() & LOGO_HIDEEPISODE) && !G_HaveUserMap())
|
char const * levelname = g_mapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name;
|
||||||
|
if (G_HaveUserMap())
|
||||||
|
levelname = boardfilename;
|
||||||
|
else if (!(G_GetLogoFlags() & LOGO_HIDEEPISODE))
|
||||||
minitext(5, a+6, g_volumeNames[ud.volume_number], 0, 2+8+16+256);
|
minitext(5, a+6, g_volumeNames[ud.volume_number], 0, 2+8+16+256);
|
||||||
minitext(5, a+6+6, g_mapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name, 0, 2+8+16+256);
|
minitext(5, a+6+6, levelname, 0, 2+8+16+256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue