mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
musname_size variable
Should prevent errors when only 2 music entries are defined
This commit is contained in:
parent
4af4a4e59f
commit
53d301112e
4 changed files with 5 additions and 2 deletions
|
|
@ -1175,6 +1175,7 @@ void readlevelheader(MYFILE *f, char * name)
|
||||||
sizeof(mapheaderinfo[num]->musname[j]), va("Level header %d: music", num));
|
sizeof(mapheaderinfo[num]->musname[j]), va("Level header %d: music", num));
|
||||||
j += 1;
|
j += 1;
|
||||||
} while ((tmp = strtok(NULL,",")) != NULL);
|
} while ((tmp = strtok(NULL,",")) != NULL);
|
||||||
|
mapheaderinfo[num]->musname_size = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "MUSICSLOT"))
|
else if (fastcmp(word, "MUSICSLOT"))
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,7 @@ struct mapheader_t
|
||||||
char musname[3][7]; ///< Music tracks to play. First dimension is the track number, second is the music string. "" for no music.
|
char musname[3][7]; ///< Music tracks to play. First dimension is the track number, second is the music string. "" for no music.
|
||||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||||
UINT32 muspos; ///< Music position to jump to.
|
UINT32 muspos; ///< Music position to jump to.
|
||||||
|
UNIT8 musname_size; ///< Number of music tracks defined
|
||||||
|
|
||||||
// Sky information
|
// Sky information
|
||||||
UINT8 weather; ///< See preciptype_t
|
UINT8 weather; ///< See preciptype_t
|
||||||
|
|
|
||||||
|
|
@ -394,6 +394,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
||||||
}
|
}
|
||||||
mapheaderinfo[num]->mustrack = 0;
|
mapheaderinfo[num]->mustrack = 0;
|
||||||
mapheaderinfo[num]->muspos = 0;
|
mapheaderinfo[num]->muspos = 0;
|
||||||
|
mapheaderinfo[num]->musname_size = 0;
|
||||||
mapheaderinfo[num]->weather = PRECIP_NONE;
|
mapheaderinfo[num]->weather = PRECIP_NONE;
|
||||||
snprintf(mapheaderinfo[num]->skytexture, 5, "SKY1");
|
snprintf(mapheaderinfo[num]->skytexture, 5, "SKY1");
|
||||||
mapheaderinfo[num]->skytexture[4] = 0;
|
mapheaderinfo[num]->skytexture[4] = 0;
|
||||||
|
|
|
||||||
|
|
@ -2432,8 +2432,8 @@ void S_StartEx(boolean reset)
|
||||||
|
|
||||||
if (mapmusflags & MUSIC_RELOADRESET)
|
if (mapmusflags & MUSIC_RELOADRESET)
|
||||||
{
|
{
|
||||||
UINT32 i = P_RandomKey(PR_MUSICSELECT, 3);
|
UINT32 t = P_RandomKey(PR_MUSICSELECT, mapheaderinfo[gamemap-1]->musname_size);
|
||||||
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname[i], 7);
|
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname[t], 7);
|
||||||
mapmusname[6] = 0;
|
mapmusname[6] = 0;
|
||||||
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
|
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
|
||||||
mapmusposition = mapheaderinfo[gamemap-1]->muspos;
|
mapmusposition = mapheaderinfo[gamemap-1]->muspos;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue