- transitioned RR to the new mapinfo

This commit is contained in:
Christoph Oelckers 2019-12-10 00:31:55 +01:00
parent 3b57f38e55
commit 4f04fe66de
12 changed files with 115 additions and 478 deletions

View file

@ -556,12 +556,15 @@ void artClearMapArt(void)
//========================================================================== //==========================================================================
// //
// Load map specfici ART // Load map specficied ART
// //
//========================================================================== //==========================================================================
static FString currentMapArt;
void artSetupMapArt(const char* filename) void artSetupMapArt(const char* filename)
{ {
if (currentMapArt.CompareNoCase(filename)) return;
currentMapArt = filename;
artClearMapArt(); artClearMapArt();
FStringf firstname("%s_00.art", filename); FStringf firstname("%s_00.art", filename);

View file

@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS BEGIN_DUKE_NS
static OutputFileCounter savecounter; static OutputFileCounter savecounter;
char previousboardfilename[BMAX_PATH];
// For storing pointers in files. // For storing pointers in files.
// back_p==0: ptr -> "small int" // back_p==0: ptr -> "small int"
@ -221,6 +220,8 @@ static int different_user_map;
// XXX: keyboard input 'blocked' after load fail? (at least ESC?) // XXX: keyboard input 'blocked' after load fail? (at least ESC?)
int32_t G_LoadPlayer(FSaveGameNode *sv) int32_t G_LoadPlayer(FSaveGameNode *sv)
{ {
char workbuffer[BMAX_PATH];
if (sv->bIsExt) if (sv->bIsExt)
{ {
int volume = -1; int volume = -1;
@ -318,19 +319,17 @@ int32_t G_LoadPlayer(FSaveGameNode *sv)
int const mapIdx = volume*MAXLEVELS + level; int const mapIdx = volume*MAXLEVELS + level;
if (boardfilename[0]) if (boardfilename[0])
strcpy(currentboardfilename, boardfilename); strcpy(workbuffer, boardfilename);
else if (mapList[mapIdx].fileName.IsNotEmpty()) else if (mapList[mapIdx].fileName.IsNotEmpty())
strcpy(currentboardfilename, mapList[mapIdx].fileName); strcpy(workbuffer, mapList[mapIdx].fileName);
if (currentboardfilename[0]) if (workbuffer[0])
{ {
// only setup art if map differs from previous // only setup art if map differs from previous
if (!previousboardfilename[0] || Bstrcmp(previousboardfilename, currentboardfilename)) artSetupMapArt(workbuffer);
artSetupMapArt(currentboardfilename); append_ext_UNSAFE(workbuffer, ".mhk");
Bstrcpy(previousboardfilename, currentboardfilename); engineLoadMHK(workbuffer);
append_ext_UNSAFE(currentboardfilename, ".mhk");
engineLoadMHK(currentboardfilename);
} }
currentboardfilename[0] = '\0'; currentboardfilename[0] = '\0';
@ -520,18 +519,17 @@ int32_t G_LoadPlayer(FSaveGameNode *sv)
int const mapIdx = h.volnum*MAXLEVELS + h.levnum; int const mapIdx = h.volnum*MAXLEVELS + h.levnum;
if (boardfilename[0]) if (boardfilename[0])
strcpy(currentboardfilename, boardfilename); strcpy(workbuffer, boardfilename);
else if (mapList[mapIdx].fileName.IsNotEmpty()) else if (mapList[mapIdx].fileName.IsNotEmpty())
strcpy(currentboardfilename, mapList[mapIdx].fileName); strcpy(workbuffer, mapList[mapIdx].fileName);
if (currentboardfilename[0])
if (workbuffer[0])
{ {
// only setup art if map differs from previous // only setup art if map differs from previous
if (!previousboardfilename[0] || Bstrcmp(previousboardfilename, currentboardfilename)) artSetupMapArt(workbuffer);
artSetupMapArt(currentboardfilename); append_ext_UNSAFE(workbuffer, ".mhk");
Bstrcpy(previousboardfilename, currentboardfilename); engineLoadMHK(workbuffer);
append_ext_UNSAFE(currentboardfilename, ".mhk");
engineLoadMHK(currentboardfilename);
} }
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH); Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "duke3d.h" #include "duke3d.h"
#include "osdcmds.h" #include "osdcmds.h"
#include "cheats.h" #include "cheats.h"
#inclide "mapinfo.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -554,7 +555,7 @@ void G_DoCheats(void)
int32_t const volnume = ud.m_volume_number, levnume = m_level_number; int32_t const volnume = ud.m_volume_number, levnume = m_level_number;
if ((!VOLUMEONE || volnume == 0) && (unsigned)volnume < (unsigned)g_volumeCnt && if ((!VOLUMEONE || volnume == 0) && (unsigned)volnume < (unsigned)g_volumeCnt &&
(unsigned)levnume < MAXLEVELS && g_mapInfo[volnume*MAXLEVELS + levnume].filename != NULL) (unsigned)levnume < MAXLEVELS && mapList[volnume*MAXLEVELS + levnume].fileName.IsNotEmpty())
{ {
ud.volume_number = volnume; ud.volume_number = volnume;
ud.level_number = levnume; ud.level_number = levnume;

View file

@ -1,4 +1,4 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 2016 EDuke32 developers and contributors Copyright (C) 2016 EDuke32 developers and contributors
@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "filesystem/filesystem.h" #include "filesystem/filesystem.h"
#include "statistics.h" #include "statistics.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "mapinfo.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to // Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h. // also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -6366,8 +6367,8 @@ static int32_t S_DefineMusic(const char *ID, const char *name)
if (sel < 0) if (sel < 0)
return -1; return -1;
} }
mapList[sel].music = name;
return S_DefineAudioIfSupported(&g_mapInfo[sel].musicfn, name); return 0;
} }
static int parsedefinitions_game(scriptfile *, int); static int parsedefinitions_game(scriptfile *, int);
@ -6798,10 +6799,6 @@ static void G_Cleanup(void)
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music
{ {
Bfree(g_mapInfo[i].name);
Bfree(g_mapInfo[i].filename);
Bfree(g_mapInfo[i].musicfn);
G_FreeMapState(i); G_FreeMapState(i);
} }

View file

@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "printf.h" #include "printf.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "stringtable.h" #include "stringtable.h"
#include "mapinfo.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -886,10 +887,7 @@ void C_DefineMusic(int volumeNum, int levelNum, const char *fileName)
Bassert((unsigned)volumeNum < MAXVOLUMES+1); Bassert((unsigned)volumeNum < MAXVOLUMES+1);
Bassert((unsigned)levelNum < MAXLEVELS); Bassert((unsigned)levelNum < MAXLEVELS);
map_t *const pMapInfo = &g_mapInfo[(MAXLEVELS*volumeNum)+levelNum]; mapList[(MAXLEVELS*volumeNum)+levelNum].music = fileName;
Bfree(pMapInfo->musicfn);
pMapInfo->musicfn = dup_filename(fileName);
} }
void C_DefineVolumeFlags(int32_t vol, int32_t flags) void C_DefineVolumeFlags(int32_t vol, int32_t flags)
@ -1873,16 +1871,11 @@ static int32_t C_ParseCommand(int32_t loop)
Bcorrectfilename(tempbuf,0); Bcorrectfilename(tempbuf,0);
if (g_mapInfo[j *MAXLEVELS+k].filename == NULL) mapList[j *MAXLEVELS+k].fileName = tempbuf;
g_mapInfo[j *MAXLEVELS+k].filename = (char *)Xcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(g_mapInfo[j*MAXLEVELS+k].filename))
g_mapInfo[j *MAXLEVELS+k].filename = (char *)Xrealloc(g_mapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
Bstrcpy(g_mapInfo[j*MAXLEVELS+k].filename,tempbuf);
C_SkipComments(); C_SkipComments();
g_mapInfo[j *MAXLEVELS+k].partime = mapList[j *MAXLEVELS+k].parTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+ (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
@ -1892,7 +1885,7 @@ static int32_t C_ParseCommand(int32_t loop)
// cheap hack, 0.99 doesn't have the 3D Realms time // cheap hack, 0.99 doesn't have the 3D Realms time
if (*(textptr+2) == ':') if (*(textptr+2) == ':')
{ {
g_mapInfo[j *MAXLEVELS+k].designertime = mapList[j *MAXLEVELS+k].designerTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+ (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
@ -1919,14 +1912,7 @@ static int32_t C_ParseCommand(int32_t loop)
tempbuf[i] = '\0'; tempbuf[i] = '\0';
if (g_mapInfo[j*MAXLEVELS+k].name == NULL) mapList[j *MAXLEVELS+k].name = tempbuf;
g_mapInfo[j*MAXLEVELS+k].name = (char *)Xcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(g_mapInfo[j*MAXLEVELS+k].name))
g_mapInfo[j *MAXLEVELS+k].name = (char *)Xrealloc(g_mapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
/* initprintf("level name string len: %d\n",Bstrlen(tempbuf)); */
Bstrcpy(g_mapInfo[j*MAXLEVELS+k].name,tempbuf);
continue; continue;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "input.h" #include "input.h"
#include "m_crc32.h" #include "m_crc32.h"
#include "mapinfo.h"
#include "enet.h" #include "enet.h"
@ -2359,340 +2360,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
//case PACKET_TYPE_QUIT: //case PACKET_TYPE_QUIT:
// G_GameExit(" "); // G_GameExit(" ");
// break; // break;
#if 0
default:
switch (packbuf[0])
{
case PACKET_TYPE_MESSAGE:
//slaves in M/S mode only send to master
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
{
if (packbuf[1] == 255)
{
//Master re-transmits message to all others
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
Net_SendPacket(i,packbuf,packbufleng);
}
else if (((int)packbuf[1]) != myconnectindex)
{
//Master re-transmits message not intended for master
Net_SendPacket((int)packbuf[1],packbuf,packbufleng);
break;
}
}
Bstrcpy(recbuf,(char*)packbuf+2);
recbuf[packbufleng-2] = 0;
G_AddUserQuote(recbuf);
S_PlaySound(EXITMENUSOUND);
pus = NUMPAGES;
pub = NUMPAGES;
break;
case PACKET_TYPE_NEW_GAME:
//Slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
if (vote_map != -1 || vote_episode != -1 || voting != -1)
G_AddUserQuote("VOTE SUCCEEDED");
m_level_number = ud.level_number = packbuf[1];
ud.m_volume_number = ud.volume_number = packbuf[2];
ud.m_player_skill = ud.player_skill = packbuf[3];
// Non-menu variables handled by G_EnterLevel
ud.m_monsters_off = packbuf[4];
ud.m_respawn_monsters = packbuf[5];
ud.m_respawn_items = packbuf[6];
ud.m_respawn_inventory = packbuf[7];
m_coop = packbuf[8];
m_marker = packbuf[9];
m_ffire = packbuf[10];
m_noexits = packbuf[11];
//ud.m_weaponstay = packbuf[12];
for (int TRAVERSE_CONNECT(i))
{
P_ResetWeapons(i);
P_ResetInventory(i);
}
G_NewGame(ud.volume_number,ud.level_number,ud.player_skill);
if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
break;
case PACKET_TYPE_INIT_SETTINGS:
//Slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i = connectpoint2[connecthead]; i >= 0; i = connectpoint2[i])
if (i != other) Net_SendPacket(i, packbuf, packbufleng);
m_level_number = ud.level_number = packbuf[1];
ud.m_volume_number = ud.volume_number = packbuf[2];
ud.m_player_skill = ud.player_skill = packbuf[3];
// Non-menu variables handled by G_EnterLevel
ud.m_monsters_off = packbuf[4];
ud.m_respawn_monsters = packbuf[5];
ud.m_respawn_items = packbuf[6];
ud.m_respawn_inventory = packbuf[7];
m_coop = packbuf[8];
m_marker = packbuf[9];
m_ffire = packbuf[10];
m_noexits = packbuf[11];
//ud.m_weaponstay = packbuf[12];
break;
case PACKET_TYPE_VERSION:
//slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
if (packbuf[2] != (char)atoi(s_buildDate))
{
initprintf("Player has version %d, expecting %d\n",packbuf[2],(char)atoi(s_buildDate));
G_GameExit("You cannot play with different versions of EDuke32!");
}
if (packbuf[3] != (char)BYTEVERSION)
{
initprintf("Player has version %d, expecting %d (%d, %d, %d)\n",packbuf[3],BYTEVERSION, NETVERSION, PLUTOPAK, VOLUMEONE);
G_GameExit("You cannot play Duke with different versions!");
}
if (packbuf[4] > g_numSyncBytes)
{
initprintf("Sync debugging enabled\n");
g_numSyncBytes = packbuf[4];
}
break;
case PACKET_TYPE_PLAYER_OPTIONS:
//slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
other = packbuf[1];
i = 2;
g_player[other].ps->aim_mode = packbuf[i++];
g_player[other].ps->auto_aim = packbuf[i++];
g_player[other].ps->weaponswitch = packbuf[i++];
g_player[other].ps->palookup = g_player[other].pcolor = packbuf[i++];
g_player[other].pteam = packbuf[i++];
break;
//case PACKET_TYPE_FRAGLIMIT_CHANGED:
// //slaves in M/S mode only send to master
// //Master re-transmits message to all others
// if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
// for (i = connectpoint2[connecthead];i >= 0;i = connectpoint2[i])
// if (i != other) Net_SendPacket(i, packbuf, packbufleng);
//
// ud.fraglimit = packbuf[2];
//
// Bsprintf(tempbuf, "FRAGLIMIT CHANGED TO %d", ud.fraglimit);
// G_AddUserQuote(tempbuf);
// break;
case PACKET_TYPE_EOL:
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
ud.level_number = packbuf[1];
m_level_number = ud.level_number;
ud.from_bonus = packbuf[2];
break;
case PACKET_TYPE_PLAYER_NAME:
//slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
other = packbuf[1];
for (i=2;packbuf[i];i++)
g_player[other].user_name[i-2] = packbuf[i];
g_player[other].user_name[i-2] = 0;
i++;
initprintf("Player %d's name is now %s\n", other, g_player[other].user_name);
break;
case PACKET_TYPE_WEAPON_CHOICE:
//slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
other = packbuf[1];
i = 2;
j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6
for (;i-j<10;i++) g_player[other].wchoice[i-j] = packbuf[i];
break;
case PACKET_TYPE_RTS:
//slaves in M/S mode only send to master
//Master re-transmits message to all others
if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other) Net_SendPacket(i,packbuf,packbufleng);
G_StartRTS(packbuf[1], other);
break;
case PACKET_TYPE_MENU_LEVEL_QUIT:
//slaves in M/S mode only send to master
if (myconnectindex == connecthead)
{
//Master re-transmits message to all others
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
Net_SendPacket(i,packbuf,packbufleng);
}
G_GameExit("Game aborted from menu; disconnected.");
break;
case PACKET_TYPE_USER_MAP:
//slaves in M/S mode only send to master
if (myconnectindex == connecthead)
{
//Master re-transmits message to all others
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
Net_SendPacket(i,packbuf,packbufleng);
}
Bstrcpy(boardfilename,(char*)packbuf+1);
boardfilename[packbufleng-1] = 0;
Bcorrectfilename(boardfilename,0);
if (boardfilename[0] != 0)
{
if (fileSystem.FileExists(boardfilename,0))
{
Bmemset(boardfilename,0,sizeof(boardfilename));
Net_SendUserMapName();
}
}
if (m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0)
m_level_number = 0;
break;
case PACKET_TYPE_MAP_VOTE:
case PACKET_TYPE_MAP_VOTE_INITIATE:
case PACKET_TYPE_MAP_VOTE_CANCEL:
if (myconnectindex == connecthead)
{
//Master re-transmits message to all others
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
Net_SendPacket(i,packbuf,packbufleng);
}
switch (packbuf[0])
{
case PACKET_TYPE_MAP_VOTE:
if (voting == myconnectindex && g_player[packbuf[1]].gotvote == 0)
{
g_player[packbuf[1]].gotvote = 1;
g_player[packbuf[1]].vote = packbuf[2];
Bsprintf(tempbuf,"Confirmed vote from %s",g_player[packbuf[1]].user_name);
G_AddUserQuote(tempbuf);
}
break;
case PACKET_TYPE_MAP_VOTE_INITIATE: // call map vote
/* if (g_networkBroadcastMode == 0 && packbuf[1] == connecthead)
break; // ignore this from master */
voting = packbuf[1];
vote_episode = packbuf[2];
vote_map = packbuf[3];
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",
g_player[packbuf[1]].user_name,
g_mapInfo[(unsigned char)(packbuf[2]*MAXLEVELS + packbuf[3])].name,
packbuf[2]+1,packbuf[3]+1);
G_AddUserQuote(tempbuf);
Bsprintf(tempbuf,"Press F1 to Accept, F2 to Decline");
G_AddUserQuote(tempbuf);
for (i=MAXPLAYERS-1;i>=0;i--)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[voting].gotvote = g_player[voting].vote = 1;
break;
case PACKET_TYPE_MAP_VOTE_CANCEL: // cancel map vote
if (voting == packbuf[1])
{
voting = -1;
i = 0;
for (j=MAXPLAYERS-1;j>=0;j--)
i += g_player[j].gotvote;
if (i != numplayers)
Bsprintf(tempbuf,"%s^00 has canceled the vote",g_player[(unsigned char)packbuf[1]].user_name);
else Bsprintf(tempbuf,"Vote failed");
for (i=MAXPLAYERS-1;i>=0;i--)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
G_AddUserQuote(tempbuf);
}
break;
}
break;
//case PACKET_TYPE_LOAD_GAME:
// //Slaves in M/S mode only send to master
// //Master re-transmits message to all others
// if ((!g_networkBroadcastMode) && (myconnectindex == connecthead))
// for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
// if (i != other) Net_SendPacket(i,packbuf,packbufleng);
//
// multiflag = 2;
// multiwhat = 0;
// multiwho = packbuf[2]; //other: need to send in m/s mode because of possible re-transmit
// multipos = packbuf[1];
// G_LoadPlayer(multipos);
// multiflag = 0;
// break;
}
break;
#endif
} }
} }
@ -3849,7 +3517,7 @@ void Net_ReceiveMapVoteInitiate(uint8_t *pbuf)
Bsprintf(tempbuf,"%s^00 has called a vote to change map to %s (E%dL%d)", Bsprintf(tempbuf,"%s^00 has called a vote to change map to %s (E%dL%d)",
g_player[voting].user_name, g_player[voting].user_name,
g_mapInfo[(uint8_t)(vote_episode*MAXLEVELS + vote_map)].name, mapList[(uint8_t)(vote_episode*MAXLEVELS + vote_map)].DisplayName(),
vote_episode+1,vote_map+1); vote_episode+1,vote_map+1);
G_AddUserQuote(tempbuf); G_AddUserQuote(tempbuf);

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "osdcmds.h" #include "osdcmds.h"
#include "savegame.h" #include "savegame.h"
#include "sbar.h" #include "sbar.h"
#include "mapinfo.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -68,7 +69,7 @@ static int osdcmd_changelevel(osdcmdptr_t parm)
} }
} }
if (level > MAXLEVELS || g_mapInfo[volume *MAXLEVELS+level].filename == NULL) if (level > MAXLEVELS || mapList *MAXLEVELS+level].fileName.IsEmpty)
{ {
OSD_Printf("changelevel: invalid level number\n"); OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;

View file

@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "cmdline.h" #include "cmdline.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "mapinfo.h"
#include "cmdlib.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -504,14 +506,13 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
} }
else if (RR && g_lastLevel) else if (RR && g_lastLevel)
{ {
menutext_center(textY,GStrings("ENTERIN")); menutext_center(textY,GStrings("TXT_ENTERIN"));
menutext_center(textY+16+8,GStrings("TXT_CLOSEENCOUNTERS")); menutext_center(textY+16+8,GStrings("TXT_CLOSEENCOUNTERS"));
} }
else else
{ {
menutext_center(textY, RR ? GStrings("TXT_ENTERIN") : GStrings("TXT_LOADING")); menutext_center(textY, RR ? GStrings("TXT_ENTERIN") : GStrings("TXT_LOADING"));
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL) menutext_center(textY+16+8,mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName());
menutext_center(textY+16+8,g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
} }
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
@ -2179,10 +2180,7 @@ int G_FindLevelByFile(const char *fileName)
for (bssize_t levelNum = 0; levelNum < MAXLEVELS; levelNum++) for (bssize_t levelNum = 0; levelNum < MAXLEVELS; levelNum++)
{ {
if (g_mapInfo[volOffset + levelNum].filename == NULL) if (!mapList[volOffset + levelNum].fileName.CompareNoCase(fileName))
continue;
if (!Bstrcasecmp(fileName, g_mapInfo[volOffset + levelNum].filename))
return volOffset + levelNum; return volOffset + levelNum;
} }
} }
@ -2249,20 +2247,18 @@ void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum
{ {
char *p; char *p;
char const *exts[] = { char const *exts[] = {
#ifdef HAVE_FLAC
"flac", "flac",
#endif
#ifdef HAVE_VORBIS
"ogg", "ogg",
#endif "mp3",
#ifdef HAVE_XMP
"xm", "xm",
"mod", "mod",
"it", "it",
"s3m", "s3m",
"mtm", "mtm",
#endif "mid",
"mid" "hmp",
"hmi",
"xmi"
}; };
Bstrncpy(nameBuf, fileName, BMAX_PATH); Bstrncpy(nameBuf, fileName, BMAX_PATH);
@ -2279,14 +2275,14 @@ void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum
{ {
Bmemcpy(p+1, ext, Bstrlen(ext) + 1); Bmemcpy(p+1, ext, Bstrlen(ext) + 1);
if (fileSystem.FileExists(nameBuf)) if (FileExists(nameBuf))
{ {
realloc_copy(&g_mapInfo[levelNum].musicfn, nameBuf); mapList[levelNum].music = nameBuf;
return; return;
} }
} }
realloc_copy(&g_mapInfo[levelNum].musicfn, "dethtoll.mid"); mapList[levelNum].music = "dethtoll.mid";
} }
int G_EnterLevel(int gameMode) int G_EnterLevel(int gameMode)
@ -2342,22 +2338,19 @@ int G_EnterLevel(int gameMode)
} }
mii = (ud.volume_number*MAXLEVELS)+ud.level_number; mii = (ud.volume_number*MAXLEVELS)+ud.level_number;
auto &mi = mapList[mii];
if (g_mapInfo[mii].name == NULL || g_mapInfo[mii].filename == NULL) if ( mi.name.IsEmpty() || mi.fileName.IsEmpty())
{ {
if (RR && g_lastLevel) if (RR && g_lastLevel)
{ {
if (g_mapInfo[mii].filename == NULL) // FIXME: Initialize this properly in the data structures!
g_mapInfo[mii].filename = (char *)Xcalloc(BMAX_PATH, sizeof(uint8_t)); mi.fileName = "endgame.map";
if (g_mapInfo[mii].name == NULL) mi.name = "$TXT_CLOSEENCOUNTERS";
g_mapInfo[mii].name = Xstrdup("CLOSE ENCOUNTERS");
} }
else if (Menu_HaveUserMap()) else if (Menu_HaveUserMap())
{ {
if (g_mapInfo[mii].filename == NULL) mi.name = "$TXT_USERMAP";
g_mapInfo[mii].filename = (char *)Xcalloc(BMAX_PATH, sizeof(uint8_t));
if (g_mapInfo[mii].name == NULL)
g_mapInfo[mii].name = Xstrdup("User Map");
} }
else else
{ {
@ -2378,18 +2371,7 @@ int G_EnterLevel(int gameMode)
DukePlayer_t *const pPlayer = g_player[0].ps; DukePlayer_t *const pPlayer = g_player[0].ps;
int16_t lbang; int16_t lbang;
if (RR && g_lastLevel) if (!VOLUMEONE && Menu_HaveUserMap())
{
if (engineLoadBoard("endgame.map", 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"endgame.map\" not found or invalid map version!\n");
return 1;
}
G_LoadMapHack(levelName, "endgame.map");
G_SetupFilenameBasedMusic(levelName, "endgame.map", m_level_number);
}
else if (!VOLUMEONE && Menu_HaveUserMap())
{ {
if (engineLoadBoard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) if (engineLoadBoard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
{ {
@ -2401,15 +2383,15 @@ int G_EnterLevel(int gameMode)
G_LoadMapHack(levelName, boardfilename); G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename, m_level_number); G_SetupFilenameBasedMusic(levelName, boardfilename, m_level_number);
} }
else if (engineLoadBoard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) else if (engineLoadBoard(mi.fileName, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
{ {
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", g_mapInfo[mii].filename); OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", mi.fileName.GetChars());
return 1; return 1;
} }
else else
{ {
STAT_NewLevel(g_mapInfo[mii].filename); STAT_NewLevel(mi.fileName);
G_LoadMapHack(levelName, g_mapInfo[mii].filename); G_LoadMapHack(levelName, mi.fileName);
} }
if (RR && !RRRA && ud.volume_number == 1 && ud.level_number == 1) if (RR && !RRRA && ud.volume_number == 1 && ud.level_number == 1)
@ -2444,7 +2426,7 @@ int G_EnterLevel(int gameMode)
G_AlignWarpElevators(); G_AlignWarpElevators();
resetpspritevars(gameMode); resetpspritevars(gameMode);
ud.playerbest = CONFIG_GetMapBestTime(Menu_HaveUserMap() ? boardfilename : g_mapInfo[mii].filename, g_loadedMapHack.md4); ud.playerbest = CONFIG_GetMapBestTime(Menu_HaveUserMap() ? boardfilename : mi.fileName.GetChars(), g_loadedMapHack.md4);
// G_FadeLoad(0,0,0, 252,0, -28, 4, -1); // G_FadeLoad(0,0,0, 252,0, -28, 4, -1);
G_CacheMapData(); G_CacheMapData();
@ -2452,9 +2434,9 @@ int G_EnterLevel(int gameMode)
if (ud.recstat != 2) if (ud.recstat != 2)
{ {
if (g_mapInfo[g_musicIndex].musicfn == NULL || if (mapList[g_musicIndex].music.IsEmpty() ||
g_mapInfo[mii].musicfn == NULL || // intentional, to pass control further while avoiding the strcmp on null mi.music.IsEmpty() ||
strcmp(g_mapInfo[g_musicIndex].musicfn, g_mapInfo[mii].musicfn) || mi.music.CompareNoCase(mapList[g_musicIndex].music) ||
g_musicSize == 0 || g_musicSize == 0 ||
ud.last_level == -1) ud.last_level == -1)
{ {
@ -2545,7 +2527,7 @@ int G_EnterLevel(int gameMode)
else else
{ {
OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n", ud.volume_number+1, ud.level_number+1, OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n", ud.volume_number+1, ud.level_number+1,
g_mapInfo[mii].name); mapList[mii].DisplayName());
} }
g_restorePalette = -1; g_restorePalette = -1;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "version.h" #include "version.h"
#include "z_music.h" #include "z_music.h"
#include "mapinfo.h"
#include "savegamehelp.h" #include "savegamehelp.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -273,17 +274,17 @@ int32_t G_LoadPlayer(const char *path)
Bmemcpy(boardfilename, h.boardfn, sizeof(boardfilename)); Bmemcpy(boardfilename, h.boardfn, sizeof(boardfilename));
int const mapIdx = h.volnum*MAXLEVELS + h.levnum; int const mapIdx = h.volnum*MAXLEVELS + h.levnum;
char workbuffer[BMAX_PATH];
if (boardfilename[0]) if (boardfilename[0])
Bstrcpy(currentboardfilename, boardfilename); Bstrcpy(workbuffer, boardfilename);
else if (g_mapInfo[mapIdx].filename) else
Bstrcpy(currentboardfilename, g_mapInfo[mapIdx].filename); Bstrcpy(workbuffer, mapList[mapIdx].fileName);
if (currentboardfilename[0]) if (workbuffer[0])
{ {
artSetupMapArt(currentboardfilename); artSetupMapArt(workbuffer);
append_ext_UNSAFE(currentboardfilename, ".mhk"); append_ext_UNSAFE(workbuffer, ".mhk");
engineLoadMHK(currentboardfilename); engineLoadMHK(workbuffer);
} }
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH); Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
@ -1169,8 +1170,8 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, char const *name, int8_t spot, i
auto fw = WriteSavegameChunk("header.dat"); auto fw = WriteSavegameChunk("header.dat");
fw->Write(&h, sizeof(savehead_t)); fw->Write(&h, sizeof(savehead_t));
auto& mi = g_mapInfo[(MAXLEVELS * ud.volume_number) + ud.level_number]; auto& mi = mapList[(MAXLEVELS * ud.volume_number) + ud.level_number];
G_WriteSaveHeader(name, mi.filename, mi.name); G_WriteSaveHeader(name, mi.fileName, mi.DisplayName());
} }
else else
{ {

View file

@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mdsprite.h" #include "mdsprite.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "mapinfo.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -175,7 +176,7 @@ static void G_ShowScores(void)
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{ {
gametext_center(SCORESHEETOFFSET+58+2, GStrings("Multiplayer Totals")); gametext_center(SCORESHEETOFFSET+58+2, GStrings("Multiplayer Totals"));
gametext_center(SCORESHEETOFFSET+58+10, g_mapInfo[G_LastMapInfoIndex()].name); gametext_center(SCORESHEETOFFSET+58+10, mapList[G_LastMapInfoIndex()].DisplayName());
t = 0; t = 0;
minitext(70, SCORESHEETOFFSET+80, GStrings("Name"), 8, 2+8+16+ROTATESPRITE_MAX); minitext(70, SCORESHEETOFFSET+80, GStrings("Name"), 8, 2+8+16+ROTATESPRITE_MAX);
@ -994,7 +995,7 @@ void G_DisplayRest(int32_t smoothratio)
{ {
if (!G_HaveUserMap()) if (!G_HaveUserMap())
minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256); minitext(5, a+6, GStrings.localize(gVolumeNames[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, mapList[ud.volume_number*MAXLEVELS + ud.level_number].DisplayName(), 0, 2+8+16+256);
} }
} }
} }
@ -1024,12 +1025,12 @@ void G_DisplayRest(int32_t smoothratio)
else if (g_levelTextTime < 5) else if (g_levelTextTime < 5)
o |= 1; o |= 1;
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL) if (mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].name.IsNotEmpty())
{ {
char const * const fn = currentboardfilename[0] != 0 && char const * const fn = currentboardfilename[0] != 0 &&
ud.volume_number == 0 && ud.level_number == 7 ud.volume_number == 0 && ud.level_number == 7
? currentboardfilename ? currentboardfilename
: g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name; : mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName();
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER); menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
} }
@ -1118,7 +1119,7 @@ void G_DisplayRest(int32_t smoothratio)
{ {
Bsprintf(tempbuf, "%s^00 has called a vote for map", g_player[voting].user_name); Bsprintf(tempbuf, "%s^00 has called a vote for map", g_player[voting].user_name);
gametext_center(40, tempbuf); gametext_center(40, tempbuf);
Bsprintf(tempbuf, "%s (E%dL%d)", g_mapInfo[vote_episode*MAXLEVELS + vote_map].name, vote_episode+1, vote_map+1); Bsprintf(tempbuf, "%s (E%dL%d)", mapList[vote_episode*MAXLEVELS + vote_map].DisplayName(), vote_episode+1, vote_map+1);
gametext_center(48, tempbuf); gametext_center(48, tempbuf);
gametext_center(70, "Press F1 to Accept, F2 to Decline"); gametext_center(70, "Press F1 to Accept, F2 to Decline");
} }
@ -1911,7 +1912,7 @@ static void G_DisplayMPResultsScreen(void)
if (!RR && PLUTOPAK) // JBF 20030804 if (!RR && PLUTOPAK) // JBF 20030804
rotatesprite_fs((260)<<16, 36<<16, 65536L, 0, PLUTOPAKSPRITE+2, 0, 0, 2+8); rotatesprite_fs((260)<<16, 36<<16, 65536L, 0, PLUTOPAKSPRITE+2, 0, 0, 2+8);
gametext_center(58+(RR ? 0 : 2), GStrings("Multiplayer Totals")); gametext_center(58+(RR ? 0 : 2), GStrings("Multiplayer Totals"));
gametext_center(58+10, g_mapInfo[G_LastMapInfoIndex()].name); gametext_center(58+10, mapList[G_LastMapInfoIndex()].DisplayName());
gametext_center_shade(RR ? 175 : 165, GStrings("Presskey"), quotepulseshade); gametext_center_shade(RR ? 175 : 165, GStrings("Presskey"), quotepulseshade);
@ -1979,11 +1980,11 @@ static int32_t G_PrintTime_ClockPad(void)
clockpad = max(clockpad, ij); clockpad = max(clockpad, ij);
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
for (ii=g_mapInfo[G_LastMapInfoIndex()].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { } for (ii=mapList[G_LastMapInfoIndex()].parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij); clockpad = max(clockpad, ij);
if (g_mapInfo[G_LastMapInfoIndex()].designertime) if (mapList[G_LastMapInfoIndex()].designerTime)
{ {
for (ii=g_mapInfo[G_LastMapInfoIndex()].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { } for (ii=mapList[G_LastMapInfoIndex()].designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij); clockpad = max(clockpad, ij);
} }
} }
@ -2012,13 +2013,13 @@ const char* G_PrintParTime(void)
{ {
if (ud.last_level < 1) if (ud.last_level < 1)
return "<invalid>"; return "<invalid>";
return G_PrintTime2(g_mapInfo[G_LastMapInfoIndex()].partime); return G_PrintTime2(mapList[G_LastMapInfoIndex()].parTime);
} }
const char* G_PrintDesignerTime(void) const char* G_PrintDesignerTime(void)
{ {
if (ud.last_level < 1) if (ud.last_level < 1)
return "<invalid>"; return "<invalid>";
return G_PrintTime2(g_mapInfo[G_LastMapInfoIndex()].designertime); return G_PrintTime2(mapList[G_LastMapInfoIndex()].designerTime);
} }
const char* G_PrintBestTime(void) const char* G_PrintBestTime(void)
{ {
@ -2043,17 +2044,17 @@ void G_BonusScreen(int32_t bonusonly)
} }
else else
{ {
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name; lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
if (!lastmapname) // this isn't right but it's better than no name at all if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name; lastmapname = mapList[G_LastMapInfoIndex()].fileName;
} }
if (RR) if (RR)
{ {
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel) if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
lastmapname = "CLOSE ENCOUNTERS"; lastmapname = GStrings("TXT_CLOSEENCOUNTERS");
else if (g_turdLevel) else if (g_turdLevel)
lastmapname = "SMELTING PLANT"; lastmapname = GStrings("SMELTIN' PLANT");
} }
@ -2256,7 +2257,7 @@ void G_BonusScreen(int32_t bonusonly)
yy+= yystep; yy+= yystep;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
if (g_mapInfo[G_LastMapInfoIndex()].partime) if (mapList[G_LastMapInfoIndex()].parTime)
{ {
if (!RR) if (!RR)
gametext(10, yy+9, GStrings("TXT_ParTime")); gametext(10, yy+9, GStrings("TXT_ParTime"));
@ -2264,7 +2265,7 @@ void G_BonusScreen(int32_t bonusonly)
menutext(30, yy, GStrings("TXT_ParTime")); menutext(30, yy, GStrings("TXT_ParTime"));
yy+=yystep; yy+=yystep;
} }
if (g_mapInfo[G_LastMapInfoIndex()].designertime) if (mapList[G_LastMapInfoIndex()].designerTime)
{ {
// EDuke 2.0 / NAM source suggests "Green Beret's Time:" // EDuke 2.0 / NAM source suggests "Green Beret's Time:"
if (DUKE) if (DUKE)
@ -2320,7 +2321,7 @@ void G_BonusScreen(int32_t bonusonly)
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
if (g_mapInfo[G_LastMapInfoIndex()].partime) if (mapList[G_LastMapInfoIndex()].parTime)
{ {
G_PrintParTime(); G_PrintParTime();
if (!RR) if (!RR)
@ -2329,7 +2330,7 @@ void G_BonusScreen(int32_t bonusonly)
menutext(191, yy, tempbuf); menutext(191, yy, tempbuf);
yy+=yystep; yy+=yystep;
} }
if (g_mapInfo[G_LastMapInfoIndex()].designertime) if (mapList[G_LastMapInfoIndex()].designerTime)
{ {
G_PrintDesignerTime(); G_PrintDesignerTime();
if (DUKE) if (DUKE)
@ -2623,9 +2624,9 @@ void G_BonusScreenRRRA(int32_t bonusonly)
} }
else else
{ {
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name; lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
if (!lastmapname) // this isn't right but it's better than no name at all if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name; lastmapname = mapList[G_LastMapInfoIndex()].fileName;
} }
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel) if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
@ -2826,12 +2827,12 @@ void G_BonusScreenRRRA(int32_t bonusonly)
yy+= yystep; yy+= yystep;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
if (g_mapInfo[G_LastMapInfoIndex()].partime) if (mapList[G_LastMapInfoIndex()].parTime)
{ {
menutext(30, yy, GStrings("TXT_PARTIME")); menutext(30, yy, GStrings("TXT_PARTIME"));
yy+=yystep; yy+=yystep;
} }
if (g_mapInfo[G_LastMapInfoIndex()].designertime) if (mapList[G_LastMapInfoIndex()].designerTime)
{ {
menutext(30, yy, GStrings("TXT_XTRTIME")); menutext(30, yy, GStrings("TXT_XTRTIME"));
yy+=yystep; yy+=yystep;
@ -2869,13 +2870,14 @@ void G_BonusScreenRRRA(int32_t bonusonly)
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
if (g_mapInfo[G_LastMapInfoIndex()].partime) if (mapList[G_LastMapInfoIndex()].parTime)
{ {
G_PrintParTime(); G_PrintParTime();
menutext(191, yy, tempbuf); menutext(191, yy, tempbuf);
yy+=yystep; yy+=yystep;
} }
if (g_mapInfo[G_LastMapInfoIndex()].designertime) if (mapList[G_LastMapInfoIndex()].designerT
ime)
{ {
G_PrintDesignerTime(); G_PrintDesignerTime();
menutext(191, yy, tempbuf); menutext(191, yy, tempbuf);

View file

@ -98,12 +98,9 @@ typedef struct {
} mapstate_t; } mapstate_t;
typedef struct { typedef struct {
int32_t partime, designertime;
char *name, *filename, *musicfn;
mapstate_t *savedstate; mapstate_t *savedstate;
} map_t; } map_t;
//extern map_t g_mapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
void G_ActivateBySector(int sect,int spriteNum); void G_ActivateBySector(int sect,int spriteNum);
int S_FindMusicSFX(int sectNum, int *sndptr); int S_FindMusicSFX(int sectNum, int *sndptr);

View file

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "openaudio.h" #include "openaudio.h"
#include "z_music.h" #include "z_music.h"
#include <atomic> #include <atomic>
#include "mapinfo.h"
BEGIN_RR_NS BEGIN_RR_NS
@ -131,7 +132,7 @@ static void S_SetMusicIndex(unsigned int m)
void S_PlayLevelMusicOrNothing(unsigned int m) void S_PlayLevelMusicOrNothing(unsigned int m)
{ {
Mus_Play(g_mapInfo[m].filename, RR ? nullptr : g_mapInfo[m].musicfn, true); Mus_Play(mapList[m].fileName, RR ? nullptr : mapList[m].music, true);
S_SetMusicIndex(m); S_SetMusicIndex(m);
} }
@ -139,8 +140,8 @@ int S_TryPlaySpecialMusic(unsigned int m)
{ {
if (RR) if (RR)
return 1; return 1;
char const * musicfn = g_mapInfo[m].musicfn; auto &musicfn = mapList[m].music;
if (musicfn != NULL) if (musicfn.IsNotEmpty())
{ {
if (!Mus_Play(nullptr, musicfn, 1)) if (!Mus_Play(nullptr, musicfn, 1))
{ {