Merge branch 'next' into polyobj-teeter-fix

This commit is contained in:
Alam Ed Arias committed 2016-03-07 16:46:32 -05:00
commit 407bf4f39d
40 files changed
+1210 -4587

No files matched your search

+45 -29
View File
@@ -1854,10 +1854,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused)
{
if (!menuactive || netgame)
S_PauseSound();
S_PauseAudio();
}
else
S_ResumeSound();
S_ResumeAudio();
}
}
@@ -3761,50 +3761,66 @@ static void Command_Displayplayer_f(void)
static void Command_Tunes_f(void)
{
const char *tunearg;
UINT16 tune, track = 0;
UINT16 tunenum, track = 0;
const size_t argc = COM_Argc();
if (argc < 2) //tunes slot ...
{
CONS_Printf("tunes <slot #/map name/\"default\"> <speed> <track>:\n");
CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n"));
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n"));
CONS_Printf(M_GetText("The current tune is: %d\nThe current track is: %d\n"),
(mapmusic & MUSIC_SONGMASK), ((mapmusic & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT));
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
return;
}
tunearg = COM_Argv(1);
tune = (UINT16)atoi(tunearg);
tunenum = (UINT16)atoi(tunearg);
track = 0;
if (!strcasecmp(tunearg, "default"))
if (!strcasecmp(tunearg, "-show"))
{
tune = mapheaderinfo[gamemap-1]->musicslot;
track = mapheaderinfo[gamemap-1]->musicslottrack;
}
else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tune >= NUMMUSIC)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1);
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
return;
}
if (argc > 3)
track = (UINT16)atoi(COM_Argv(3))-1;
mapmusic = tune | (track << MUSIC_TRACKSHIFT);
if (tune == mus_None)
if (!strcasecmp(tunearg, "-none"))
{
S_StopMusic();
else
S_ChangeMusic(mapmusic, true);
return;
}
else if (!strcasecmp(tunearg, "-default"))
{
tunearg = mapheaderinfo[gamemap-1]->musname;
track = mapheaderinfo[gamemap-1]->mustrack;
}
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tunenum && tunenum >= 1036)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
return;
}
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
if (argc > 2)
track = (UINT16)atoi(COM_Argv(2))-1;
if (tunenum)
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
else
strncpy(mapmusname, tunearg, 7);
mapmusname[6] = 0;
mapmusflags = (track & MUSIC_TRACKMASK);
S_ChangeMusic(mapmusname, mapmusflags, true);
if (argc > 3)
{
float speed = (float)atof(COM_Argv(2));
float speed = (float)atof(COM_Argv(3));
if (speed > 0.0f)
S_SpeedMusic(speed);
}
+152 -618
View File
@@ -65,7 +65,9 @@ static mobjtype_t get_mobjtype(const char *word);
static statenum_t get_state(const char *word);
static spritenum_t get_sprite(const char *word);
static sfxenum_t get_sfx(const char *word);
static UINT16 get_mus(const char *word);
#ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
static hudnum_t get_huditem(const char *word);
#ifndef HAVE_BLUA
static powertype_t get_power(const char *word);
@@ -1164,19 +1166,31 @@ static void readlevelheader(MYFILE *f, INT32 num)
mapheaderinfo[num-1]->typeoflevel = tol;
}
}
else if (fastcmp(word, "MUSIC"))
{
if (fastcmp(word2, "NONE"))
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
else
{
deh_strlcpy(mapheaderinfo[num-1]->musname, word2,
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
}
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
// Convert to map number
if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0')
i = M_MapNumber(word2[0], word2[1]);
if (i) // it's just a number
mapheaderinfo[num-1]->musicslot = (UINT16)i;
else // No? Okay, now we'll get technical.
mapheaderinfo[num-1]->musicslot = get_mus(word2); // accepts all of O_CHRSEL, mus_chrsel, or just plain ChrSel
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
else
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
mapheaderinfo[num-1]->musname[6] = 0;
}
else if (fastcmp(word, "MUSICSLOTTRACK"))
mapheaderinfo[num-1]->musicslottrack = ((UINT16)i - 1);
#endif
else if (fastcmp(word, "MUSICTRACK"))
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "FORCECHARACTER"))
{
strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1);
@@ -1443,10 +1457,30 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
else
deh_warning("CutSceneScene %d: unknown word '%s'", num, word);
}
else if (fastcmp(word, "MUSIC"))
{
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicslot), UNDO_NONE);
cutscenes[num]->scene[scenenum].musicslot = get_mus(word2); // accepts all of O_MAP01M, mus_map01m, or just plain MAP01M
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7);
else
cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK"))
{
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
}
else if (fastcmp(word, "MUSICLOOP"))
{
@@ -3187,6 +3221,12 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_gameend_final;
}
else if (fastncmp(word, "SPECLEVEL_", 10))
{
pword = word + 10;
if (fastcmp(pword, "TOWHITE"))
wipeoffset = wipe_speclevel_towhite;
}
if (wipeoffset < 0)
{
@@ -3194,9 +3234,11 @@ static void readwipes(MYFILE *f)
continue;
}
if (value == UINT8_MAX // Cannot disable non-toblack wipes (or the level toblack wipe)
&& (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_level_final))
if (value == UINT8_MAX
&& (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_speclevel_towhite))
{
// Cannot disable non-toblack wipes
// (or the level toblack wipe, or the special towhite wipe)
deh_warning("Wipes: can't disable wipe of type '%s'", word);
continue;
}
@@ -4588,30 +4630,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_MSSHIELD_F12",
// Ring
"S_RING1",
"S_RING2",
"S_RING3",
"S_RING4",
"S_RING5",
"S_RING6",
"S_RING7",
"S_RING8",
"S_RING9",
"S_RING10",
"S_RING11",
"S_RING12",
"S_RING13",
"S_RING14",
"S_RING15",
"S_RING16",
"S_RING17",
"S_RING18",
"S_RING19",
"S_RING20",
"S_RING21",
"S_RING22",
"S_RING23",
"S_RING24",
"S_RING",
// Blue Sphere for special stages
"S_BLUEBALL",
@@ -4627,39 +4646,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_GRAVWELLRED3",
// Individual Team Rings
"S_TEAMRING1",
"S_TEAMRING2",
"S_TEAMRING3",
"S_TEAMRING4",
"S_TEAMRING5",
"S_TEAMRING6",
"S_TEAMRING7",
"S_TEAMRING8",
"S_TEAMRING9",
"S_TEAMRING10",
"S_TEAMRING11",
"S_TEAMRING12",
"S_TEAMRING13",
"S_TEAMRING14",
"S_TEAMRING15",
"S_TEAMRING16",
"S_TEAMRING17",
"S_TEAMRING18",
"S_TEAMRING19",
"S_TEAMRING20",
"S_TEAMRING21",
"S_TEAMRING22",
"S_TEAMRING23",
"S_TEAMRING24",
"S_TEAMRING",
// Special Stage Token
"S_EMMY1",
"S_EMMY2",
"S_EMMY3",
"S_EMMY4",
"S_EMMY5",
"S_EMMY6",
"S_EMMY7",
"S_EMMY",
// Special Stage Token
"S_TOKEN",
@@ -4813,40 +4803,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SPIKED2",
// Starpost
"S_STARPOST1",
"S_STARPOST2",
"S_STARPOST3",
"S_STARPOST4",
"S_STARPOST5",
"S_STARPOST6",
"S_STARPOST7",
"S_STARPOST8",
"S_STARPOST9",
"S_STARPOST10",
"S_STARPOST11",
"S_STARPOST12",
"S_STARPOST13",
"S_STARPOST14",
"S_STARPOST15",
"S_STARPOST16",
"S_STARPOST17",
"S_STARPOST18",
"S_STARPOST19",
"S_STARPOST20",
"S_STARPOST21",
"S_STARPOST22",
"S_STARPOST23",
"S_STARPOST24",
"S_STARPOST25",
"S_STARPOST26",
"S_STARPOST27",
"S_STARPOST28",
"S_STARPOST29",
"S_STARPOST30",
"S_STARPOST31",
"S_STARPOST32",
"S_STARPOST33",
"S_STARPOST34",
"S_STARPOST_IDLE",
"S_STARPOST_FLASH",
"S_STARPOST_SPIN",
// Big floating mine
"S_BIGMINE1",
@@ -5454,38 +5413,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PITY10",
// Invincibility Sparkles
"S_IVSP1",
"S_IVSP2",
"S_IVSP3",
"S_IVSP4",
"S_IVSP5",
"S_IVSP6",
"S_IVSP7",
"S_IVSP8",
"S_IVSP9",
"S_IVSP10",
"S_IVSP11",
"S_IVSP12",
"S_IVSP13",
"S_IVSP14",
"S_IVSP15",
"S_IVSP16",
"S_IVSP17",
"S_IVSP18",
"S_IVSP19",
"S_IVSP20",
"S_IVSP21",
"S_IVSP22",
"S_IVSP23",
"S_IVSP24",
"S_IVSP25",
"S_IVSP26",
"S_IVSP27",
"S_IVSP28",
"S_IVSP29",
"S_IVSP30",
"S_IVSP31",
"S_IVSP32",
"S_IVSP",
// Super Sonic Spark
"S_SSPK1",
@@ -5672,283 +5600,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RRNG6",
"S_RRNG7",
// Bounce Ring
"S_BOUNCERING1",
"S_BOUNCERING2",
"S_BOUNCERING3",
"S_BOUNCERING4",
"S_BOUNCERING5",
"S_BOUNCERING6",
"S_BOUNCERING7",
"S_BOUNCERING8",
"S_BOUNCERING9",
"S_BOUNCERING10",
"S_BOUNCERING11",
"S_BOUNCERING12",
"S_BOUNCERING13",
"S_BOUNCERING14",
"S_BOUNCERING15",
"S_BOUNCERING16",
"S_BOUNCERING17",
"S_BOUNCERING18",
"S_BOUNCERING19",
"S_BOUNCERING20",
"S_BOUNCERING21",
"S_BOUNCERING22",
"S_BOUNCERING23",
"S_BOUNCERING24",
"S_BOUNCERING25",
"S_BOUNCERING26",
"S_BOUNCERING27",
"S_BOUNCERING28",
"S_BOUNCERING29",
"S_BOUNCERING30",
"S_BOUNCERING31",
"S_BOUNCERING32",
"S_BOUNCERING33",
"S_BOUNCERING34",
"S_BOUNCERING35",
// Rail Ring
"S_RAILRING1",
"S_RAILRING2",
"S_RAILRING3",
"S_RAILRING4",
"S_RAILRING5",
"S_RAILRING6",
"S_RAILRING7",
"S_RAILRING8",
"S_RAILRING9",
"S_RAILRING10",
"S_RAILRING11",
"S_RAILRING12",
"S_RAILRING13",
"S_RAILRING14",
"S_RAILRING15",
"S_RAILRING16",
"S_RAILRING17",
"S_RAILRING18",
"S_RAILRING19",
"S_RAILRING20",
"S_RAILRING21",
"S_RAILRING22",
"S_RAILRING23",
"S_RAILRING24",
"S_RAILRING25",
"S_RAILRING26",
"S_RAILRING27",
"S_RAILRING28",
"S_RAILRING29",
"S_RAILRING30",
"S_RAILRING31",
"S_RAILRING32",
"S_RAILRING33",
"S_RAILRING34",
"S_RAILRING35",
// Infinity ring
"S_INFINITYRING1",
"S_INFINITYRING2",
"S_INFINITYRING3",
"S_INFINITYRING4",
"S_INFINITYRING5",
"S_INFINITYRING6",
"S_INFINITYRING7",
"S_INFINITYRING8",
"S_INFINITYRING9",
"S_INFINITYRING10",
"S_INFINITYRING11",
"S_INFINITYRING12",
"S_INFINITYRING13",
"S_INFINITYRING14",
"S_INFINITYRING15",
"S_INFINITYRING16",
"S_INFINITYRING17",
"S_INFINITYRING18",
"S_INFINITYRING19",
"S_INFINITYRING20",
"S_INFINITYRING21",
"S_INFINITYRING22",
"S_INFINITYRING23",
"S_INFINITYRING24",
"S_INFINITYRING25",
"S_INFINITYRING26",
"S_INFINITYRING27",
"S_INFINITYRING28",
"S_INFINITYRING29",
"S_INFINITYRING30",
"S_INFINITYRING31",
"S_INFINITYRING32",
"S_INFINITYRING33",
"S_INFINITYRING34",
"S_INFINITYRING35",
// Automatic Ring
"S_AUTOMATICRING1",
"S_AUTOMATICRING2",
"S_AUTOMATICRING3",
"S_AUTOMATICRING4",
"S_AUTOMATICRING5",
"S_AUTOMATICRING6",
"S_AUTOMATICRING7",
"S_AUTOMATICRING8",
"S_AUTOMATICRING9",
"S_AUTOMATICRING10",
"S_AUTOMATICRING11",
"S_AUTOMATICRING12",
"S_AUTOMATICRING13",
"S_AUTOMATICRING14",
"S_AUTOMATICRING15",
"S_AUTOMATICRING16",
"S_AUTOMATICRING17",
"S_AUTOMATICRING18",
"S_AUTOMATICRING19",
"S_AUTOMATICRING20",
"S_AUTOMATICRING21",
"S_AUTOMATICRING22",
"S_AUTOMATICRING23",
"S_AUTOMATICRING24",
"S_AUTOMATICRING25",
"S_AUTOMATICRING26",
"S_AUTOMATICRING27",
"S_AUTOMATICRING28",
"S_AUTOMATICRING29",
"S_AUTOMATICRING30",
"S_AUTOMATICRING31",
"S_AUTOMATICRING32",
"S_AUTOMATICRING33",
"S_AUTOMATICRING34",
"S_AUTOMATICRING35",
// Explosion Ring
"S_EXPLOSIONRING1",
"S_EXPLOSIONRING2",
"S_EXPLOSIONRING3",
"S_EXPLOSIONRING4",
"S_EXPLOSIONRING5",
"S_EXPLOSIONRING6",
"S_EXPLOSIONRING7",
"S_EXPLOSIONRING8",
"S_EXPLOSIONRING9",
"S_EXPLOSIONRING10",
"S_EXPLOSIONRING11",
"S_EXPLOSIONRING12",
"S_EXPLOSIONRING13",
"S_EXPLOSIONRING14",
"S_EXPLOSIONRING15",
"S_EXPLOSIONRING16",
"S_EXPLOSIONRING17",
"S_EXPLOSIONRING18",
"S_EXPLOSIONRING19",
"S_EXPLOSIONRING20",
"S_EXPLOSIONRING21",
"S_EXPLOSIONRING22",
"S_EXPLOSIONRING23",
"S_EXPLOSIONRING24",
"S_EXPLOSIONRING25",
"S_EXPLOSIONRING26",
"S_EXPLOSIONRING27",
"S_EXPLOSIONRING28",
"S_EXPLOSIONRING29",
"S_EXPLOSIONRING30",
"S_EXPLOSIONRING31",
"S_EXPLOSIONRING32",
"S_EXPLOSIONRING33",
"S_EXPLOSIONRING34",
"S_EXPLOSIONRING35",
// Scatter Ring
"S_SCATTERRING1",
"S_SCATTERRING2",
"S_SCATTERRING3",
"S_SCATTERRING4",
"S_SCATTERRING5",
"S_SCATTERRING6",
"S_SCATTERRING7",
"S_SCATTERRING8",
"S_SCATTERRING9",
"S_SCATTERRING10",
"S_SCATTERRING11",
"S_SCATTERRING12",
"S_SCATTERRING13",
"S_SCATTERRING14",
"S_SCATTERRING15",
"S_SCATTERRING16",
"S_SCATTERRING17",
"S_SCATTERRING18",
"S_SCATTERRING19",
"S_SCATTERRING20",
"S_SCATTERRING21",
"S_SCATTERRING22",
"S_SCATTERRING23",
"S_SCATTERRING24",
"S_SCATTERRING25",
"S_SCATTERRING26",
"S_SCATTERRING27",
"S_SCATTERRING28",
"S_SCATTERRING29",
"S_SCATTERRING30",
"S_SCATTERRING31",
"S_SCATTERRING32",
"S_SCATTERRING33",
"S_SCATTERRING34",
"S_SCATTERRING35",
// Grenade Ring
"S_GRENADERING1",
"S_GRENADERING2",
"S_GRENADERING3",
"S_GRENADERING4",
"S_GRENADERING5",
"S_GRENADERING6",
"S_GRENADERING7",
"S_GRENADERING8",
"S_GRENADERING9",
"S_GRENADERING10",
"S_GRENADERING11",
"S_GRENADERING12",
"S_GRENADERING13",
"S_GRENADERING14",
"S_GRENADERING15",
"S_GRENADERING16",
"S_GRENADERING17",
"S_GRENADERING18",
"S_GRENADERING19",
"S_GRENADERING20",
"S_GRENADERING21",
"S_GRENADERING22",
"S_GRENADERING23",
"S_GRENADERING24",
"S_GRENADERING25",
"S_GRENADERING26",
"S_GRENADERING27",
"S_GRENADERING28",
"S_GRENADERING29",
"S_GRENADERING30",
"S_GRENADERING31",
"S_GRENADERING32",
"S_GRENADERING33",
"S_GRENADERING34",
"S_GRENADERING35",
// Weapon Ring Ammo
"S_BOUNCERINGAMMO",
"S_RAILRINGAMMO",
"S_INFINITYRINGAMMO",
"S_AUTOMATICRINGAMMO",
"S_EXPLOSIONRINGAMMO",
"S_SCATTERRINGAMMO",
"S_GRENADERINGAMMO",
// Weapon pickup
"S_BOUNCEPICKUP1",
"S_BOUNCEPICKUP2",
"S_BOUNCEPICKUP3",
"S_BOUNCEPICKUP4",
"S_BOUNCEPICKUP5",
"S_BOUNCEPICKUP6",
"S_BOUNCEPICKUP7",
"S_BOUNCEPICKUP8",
"S_BOUNCEPICKUP9",
"S_BOUNCEPICKUP10",
"S_BOUNCEPICKUP11",
"S_BOUNCEPICKUP12",
"S_BOUNCEPICKUP13",
"S_BOUNCEPICKUP14",
"S_BOUNCEPICKUP15",
"S_BOUNCEPICKUP16",
"S_BOUNCEPICKUP",
"S_BOUNCEPICKUPFADE1",
"S_BOUNCEPICKUPFADE2",
"S_BOUNCEPICKUPFADE3",
@@ -5958,23 +5620,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BOUNCEPICKUPFADE7",
"S_BOUNCEPICKUPFADE8",
"S_RAILPICKUP1",
"S_RAILPICKUP2",
"S_RAILPICKUP3",
"S_RAILPICKUP4",
"S_RAILPICKUP5",
"S_RAILPICKUP6",
"S_RAILPICKUP7",
"S_RAILPICKUP8",
"S_RAILPICKUP9",
"S_RAILPICKUP10",
"S_RAILPICKUP11",
"S_RAILPICKUP12",
"S_RAILPICKUP13",
"S_RAILPICKUP14",
"S_RAILPICKUP15",
"S_RAILPICKUP16",
"S_RAILPICKUP",
"S_RAILPICKUPFADE1",
"S_RAILPICKUPFADE2",
"S_RAILPICKUPFADE3",
@@ -5984,23 +5630,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RAILPICKUPFADE7",
"S_RAILPICKUPFADE8",
"S_AUTOPICKUP1",
"S_AUTOPICKUP2",
"S_AUTOPICKUP3",
"S_AUTOPICKUP4",
"S_AUTOPICKUP5",
"S_AUTOPICKUP6",
"S_AUTOPICKUP7",
"S_AUTOPICKUP8",
"S_AUTOPICKUP9",
"S_AUTOPICKUP10",
"S_AUTOPICKUP11",
"S_AUTOPICKUP12",
"S_AUTOPICKUP13",
"S_AUTOPICKUP14",
"S_AUTOPICKUP15",
"S_AUTOPICKUP16",
"S_AUTOPICKUP",
"S_AUTOPICKUPFADE1",
"S_AUTOPICKUPFADE2",
"S_AUTOPICKUPFADE3",
@@ -6010,23 +5640,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_AUTOPICKUPFADE7",
"S_AUTOPICKUPFADE8",
"S_EXPLODEPICKUP1",
"S_EXPLODEPICKUP2",
"S_EXPLODEPICKUP3",
"S_EXPLODEPICKUP4",
"S_EXPLODEPICKUP5",
"S_EXPLODEPICKUP6",
"S_EXPLODEPICKUP7",
"S_EXPLODEPICKUP8",
"S_EXPLODEPICKUP9",
"S_EXPLODEPICKUP10",
"S_EXPLODEPICKUP11",
"S_EXPLODEPICKUP12",
"S_EXPLODEPICKUP13",
"S_EXPLODEPICKUP14",
"S_EXPLODEPICKUP15",
"S_EXPLODEPICKUP16",
"S_EXPLODEPICKUP",
"S_EXPLODEPICKUPFADE1",
"S_EXPLODEPICKUPFADE2",
"S_EXPLODEPICKUPFADE3",
@@ -6036,23 +5650,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_EXPLODEPICKUPFADE7",
"S_EXPLODEPICKUPFADE8",
"S_SCATTERPICKUP1",
"S_SCATTERPICKUP2",
"S_SCATTERPICKUP3",
"S_SCATTERPICKUP4",
"S_SCATTERPICKUP5",
"S_SCATTERPICKUP6",
"S_SCATTERPICKUP7",
"S_SCATTERPICKUP8",
"S_SCATTERPICKUP9",
"S_SCATTERPICKUP10",
"S_SCATTERPICKUP11",
"S_SCATTERPICKUP12",
"S_SCATTERPICKUP13",
"S_SCATTERPICKUP14",
"S_SCATTERPICKUP15",
"S_SCATTERPICKUP16",
"S_SCATTERPICKUP",
"S_SCATTERPICKUPFADE1",
"S_SCATTERPICKUPFADE2",
"S_SCATTERPICKUPFADE3",
@@ -6062,23 +5660,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SCATTERPICKUPFADE7",
"S_SCATTERPICKUPFADE8",
"S_GRENADEPICKUP1",
"S_GRENADEPICKUP2",
"S_GRENADEPICKUP3",
"S_GRENADEPICKUP4",
"S_GRENADEPICKUP5",
"S_GRENADEPICKUP6",
"S_GRENADEPICKUP7",
"S_GRENADEPICKUP8",
"S_GRENADEPICKUP9",
"S_GRENADEPICKUP10",
"S_GRENADEPICKUP11",
"S_GRENADEPICKUP12",
"S_GRENADEPICKUP13",
"S_GRENADEPICKUP14",
"S_GRENADEPICKUP15",
"S_GRENADEPICKUP16",
"S_GRENADEPICKUP",
"S_GRENADEPICKUPFADE1",
"S_GRENADEPICKUPFADE2",
"S_GRENADEPICKUPFADE3",
@@ -6459,101 +6041,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ROCKSPAWN",
"S_ROCKCRUMBLEA1",
"S_ROCKCRUMBLEA2",
"S_ROCKCRUMBLEA3",
"S_ROCKCRUMBLEA4",
"S_ROCKCRUMBLEA5",
"S_ROCKCRUMBLEB1",
"S_ROCKCRUMBLEB2",
"S_ROCKCRUMBLEB3",
"S_ROCKCRUMBLEB4",
"S_ROCKCRUMBLEB5",
"S_ROCKCRUMBLEC1",
"S_ROCKCRUMBLEC2",
"S_ROCKCRUMBLEC3",
"S_ROCKCRUMBLEC4",
"S_ROCKCRUMBLEC5",
"S_ROCKCRUMBLED1",
"S_ROCKCRUMBLED2",
"S_ROCKCRUMBLED3",
"S_ROCKCRUMBLED4",
"S_ROCKCRUMBLED5",
"S_ROCKCRUMBLEE1",
"S_ROCKCRUMBLEE2",
"S_ROCKCRUMBLEE3",
"S_ROCKCRUMBLEE4",
"S_ROCKCRUMBLEE5",
"S_ROCKCRUMBLEF1",
"S_ROCKCRUMBLEF2",
"S_ROCKCRUMBLEF3",
"S_ROCKCRUMBLEF4",
"S_ROCKCRUMBLEF5",
"S_ROCKCRUMBLEG1",
"S_ROCKCRUMBLEG2",
"S_ROCKCRUMBLEG3",
"S_ROCKCRUMBLEG4",
"S_ROCKCRUMBLEG5",
"S_ROCKCRUMBLEH1",
"S_ROCKCRUMBLEH2",
"S_ROCKCRUMBLEH3",
"S_ROCKCRUMBLEH4",
"S_ROCKCRUMBLEH5",
"S_ROCKCRUMBLEI1",
"S_ROCKCRUMBLEI2",
"S_ROCKCRUMBLEI3",
"S_ROCKCRUMBLEI4",
"S_ROCKCRUMBLEI5",
"S_ROCKCRUMBLEJ1",
"S_ROCKCRUMBLEJ2",
"S_ROCKCRUMBLEJ3",
"S_ROCKCRUMBLEJ4",
"S_ROCKCRUMBLEJ5",
"S_ROCKCRUMBLEK1",
"S_ROCKCRUMBLEK2",
"S_ROCKCRUMBLEK3",
"S_ROCKCRUMBLEK4",
"S_ROCKCRUMBLEK5",
"S_ROCKCRUMBLEL1",
"S_ROCKCRUMBLEL2",
"S_ROCKCRUMBLEL3",
"S_ROCKCRUMBLEL4",
"S_ROCKCRUMBLEL5",
"S_ROCKCRUMBLEM1",
"S_ROCKCRUMBLEM2",
"S_ROCKCRUMBLEM3",
"S_ROCKCRUMBLEM4",
"S_ROCKCRUMBLEM5",
"S_ROCKCRUMBLEN1",
"S_ROCKCRUMBLEN2",
"S_ROCKCRUMBLEN3",
"S_ROCKCRUMBLEN4",
"S_ROCKCRUMBLEN5",
"S_ROCKCRUMBLEO1",
"S_ROCKCRUMBLEO2",
"S_ROCKCRUMBLEO3",
"S_ROCKCRUMBLEO4",
"S_ROCKCRUMBLEO5",
"S_ROCKCRUMBLEP1",
"S_ROCKCRUMBLEP2",
"S_ROCKCRUMBLEP3",
"S_ROCKCRUMBLEP4",
"S_ROCKCRUMBLEP5",
"S_ROCKCRUMBLEA",
"S_ROCKCRUMBLEB",
"S_ROCKCRUMBLEC",
"S_ROCKCRUMBLED",
"S_ROCKCRUMBLEE",
"S_ROCKCRUMBLEF",
"S_ROCKCRUMBLEG",
"S_ROCKCRUMBLEH",
"S_ROCKCRUMBLEI",
"S_ROCKCRUMBLEJ",
"S_ROCKCRUMBLEK",
"S_ROCKCRUMBLEL",
"S_ROCKCRUMBLEM",
"S_ROCKCRUMBLEN",
"S_ROCKCRUMBLEO",
"S_ROCKCRUMBLEP",
"S_SRB1_CRAWLA1",
"S_SRB1_CRAWLA2",
@@ -7472,6 +6975,8 @@ struct {
{"PUSHACCEL",PUSHACCEL},
{"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into.
{"CODEBASE",CODEBASE}, // or what release of SRB2 this is.
{"VERSION",VERSION}, // Grab the game's version!
{"SUBVERSION",SUBVERSION}, // more precise version number
// Special linedef executor tag numbers!
{"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!)
@@ -7484,6 +6989,7 @@ struct {
// Frame settings
{"FF_FRAMEMASK",FF_FRAMEMASK},
{"FF_ANIMATE",FF_ANIMATE},
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
{"FF_TRANSMASK",FF_TRANSMASK},
{"FF_TRANSSHIFT",FF_TRANSSHIFT},
@@ -7958,21 +7464,45 @@ static sfxenum_t get_sfx(const char *word)
return sfx_None;
}
static UINT16 get_mus(const char *word)
{ // Returns the value of SFX_ enumerations
#ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode)
{ // Returns the value of MUS_ enumerations
UINT16 i;
char lumptmp[4];
if (*word >= '0' && *word <= '9')
return atoi(word);
if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
if (fastncmp("MUS_",word,4))
word += 4; // take off the MUS_
else if (fastncmp("O_",word,2) || fastncmp("D_",word,2))
word += 2; // take off the O_ or D_
for (i = 0; i < NUMMUSIC; i++)
if (S_music[i].name && fasticmp(word, S_music[i].name))
strncpy(lumptmp, word, 4);
lumptmp[3] = 0;
if (fasticmp("MAP",lumptmp))
{
word += 3;
if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
else if ((i = atoi(word)))
return i;
deh_warning("Couldn't find music named 'MUS_%s'",word);
return mus_None;
word -= 3;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
for (i = 0; compat_special_music_slots[i][0]; ++i)
if (fasticmp(word, compat_special_music_slots[i]))
return i + 1036;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
#endif
static hudnum_t get_huditem(const char *word)
{ // Returns the value of HUD_ enumerations
@@ -8172,11 +7702,13 @@ static fixed_t find_const(const char **rword)
free(word);
return r;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
r = get_mus(word);
r = get_mus(word, true);
free(word);
return r;
}
#endif
else if (fastncmp("PW_",word,3)) {
r = get_power(word);
free(word);
@@ -8546,33 +8078,29 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (!mathlib && fastncmp("mus_",word,4)) {
p = word+4;
for (i = 0; i < NUMMUSIC; i++)
if (S_music[i].name && fastcmp(p, S_music[i].name)) {
lua_pushinteger(L, i);
return 1;
}
return 0;
if ((i = get_mus(p, false)) == 0)
return 0;
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
for (i = 0; i < NUMMUSIC; i++)
if (S_music[i].name && fasticmp(p, S_music[i].name)) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "music '%s' could not be found.\n", word);
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
p = word+2;
for (i = 0; i < NUMMUSIC; i++)
if (S_music[i].name && fasticmp(p, S_music[i].name)) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "music '%s' could not be found.\n", word);
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
#endif
else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3;
for (i = 0; i < NUMPOWERS; i++)
@@ -8724,8 +8252,11 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"globallevelskynum")) {
lua_pushinteger(L, globallevelskynum);
return 1;
} else if (fastcmp(word,"mapmusic")) {
lua_pushinteger(L, mapmusic);
} else if (fastcmp(word,"mapmusname")) {
lua_pushstring(L, mapmusname);
return 1;
} else if (fastcmp(word,"mapmusflags")) {
lua_pushinteger(L, mapmusflags);
return 1;
} else if (fastcmp(word,"server")) {
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
@@ -8743,6 +8274,9 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"gravity")) {
lua_pushinteger(L, gravity);
return 1;
} else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING);
return 1;
}
return 0;
+4
View File
@@ -490,4 +490,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
#endif // __DOOMDEF__
+10 -12
View File
@@ -31,15 +31,11 @@
// Selected by user.
extern INT16 gamemap;
// ----------------xxxxxxxxxxxxxxxx = music slot
// -xxxxxxxxxxxxxxx---------------- = track slot
// x------------------------------- = reset music bit
extern UINT32 mapmusic;
#define MUSIC_TRACKSHIFT 16
#define MUSIC_SONGMASK 0x0000FFFF
#define MUSIC_TRACKMASK 0x7FFF0000
#define MUSIC_RELOADRESET 0x80000000
extern char mapmusname[7];
extern UINT16 mapmusflags;
#define MUSIC_TRACKMASK 0x0FFF // ----************
#define MUSIC_RELOADRESET 0x8000 // *---------------
// Use other bits if necessary.
extern INT16 maptol;
extern UINT8 globalweather;
@@ -146,11 +142,13 @@ typedef struct
UINT16 xcoord[8];
UINT16 ycoord[8];
UINT16 picduration[8];
UINT16 musicslot;
UINT8 musicloop;
UINT16 textxpos;
UINT16 textypos;
char musswitch[7];
UINT16 musswitchflags;
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
UINT8 fadeoutid; // ID of the second fade, to the new screen
@@ -218,8 +216,8 @@ typedef struct
UINT8 actnum; ///< Act number or 0 for none.
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
UINT16 musicslot; ///< Music slot number to play. 0 for no music.
UINT16 musicslottrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
char musname[7]; ///< Music track to play. "" for no music.
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
INT16 skynum; ///< Sky number to use.
+15 -10
View File
@@ -559,7 +559,7 @@ static void F_IntroDrawScene(void)
if (finalecount < 4)
S_StopMusic();
if (finalecount == 4)
S_ChangeMusic(mus_stjr, false);
S_ChangeMusicInternal("stjr", false);
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
@@ -771,7 +771,7 @@ void F_IntroDrawer(void)
F_RunWipe(99,true);
}
S_ChangeMusic(mus_read_m, false);
S_ChangeMusicInternal("read_m", false);
}
else if (intro_scenenum == 3)
roidtics = BASEVIDWIDTH - 64;
@@ -977,6 +977,7 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous",
"Ronald \"Furyhunter\" Kinard", // The SDL2 port
"John \"JTE\" Muniz",
"Ehab \"Wolfy\" Saeed",
"\"SSNTails\"",
"Matthew \"Inuyasha\" Walsh",
"",
@@ -1020,7 +1021,7 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous",
"Jarel \"Arrow\" Jones",
"Stefan \"Stuf\" Rimalia",
"Shane Strife",
"Shane Mychal Sexton",
"\"Spazzo\"",
"David \"Big Wave Dave\" Spencer Sr.",
"David \"Instant Sonic\" Spencer Jr.",
@@ -1125,7 +1126,7 @@ void F_StartCredits(void)
CON_ClearHUD();
S_StopMusic();
S_ChangeMusic(mus_credit, false);
S_ChangeMusicInternal("credit", false);
finalecount = 0;
animtimer = 0;
@@ -1422,7 +1423,7 @@ void F_StartTitleScreen(void)
// IWAD dependent stuff.
S_ChangeMusic(mus_titles, looptitle);
S_ChangeMusicInternal("titles", looptitle);
animtimer = 0;
@@ -1588,7 +1589,7 @@ void F_StartContinue(void)
// In case menus are still up?!!
M_ClearMenus(true);
S_ChangeMusic(mus_contsc, false);
S_ChangeMusicInternal("contsc", false);
S_StopSounds();
timetonext = TICRATE*11;
@@ -1702,8 +1703,10 @@ static void F_AdvanceToNextScene(void)
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0)
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop);
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch,
cutscenes[cutnum]->scene[scenenum].musswitchflags,
cutscenes[cutnum]->scene[scenenum].musicloop);
// Fade to the next
dofadenow = true;
@@ -1774,8 +1777,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration
stoptimer = 0;
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0)
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop);
if (cutscenes[cutnum]->scene[0].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch,
cutscenes[cutnum]->scene[0].musswitchflags,
cutscenes[cutnum]->scene[0].musicloop);
else
S_StopMusic();
}
+2 -1
View File
@@ -90,6 +90,7 @@ enum
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
@@ -108,7 +109,7 @@ enum
NUMWIPEDEFS
};
#define WIPEFINALSHIFT 12
#define WIPEFINALSHIFT 13
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif
+1
View File
@@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_specinter_toblack
0, // wipe_multinter_toblack
0, // wipe_speclevel_towhite
0, // wipe_level_final
0, // wipe_intermission_final
+19 -12
View File
@@ -69,8 +69,10 @@ static void G_DoStartContinue(void);
static void G_DoContinued(void);
static void G_DoWorldDone(void);
char mapmusname[7]; // Music name
UINT16 mapmusflags; // Track and reset bit
INT16 gamemap = 1;
UINT32 mapmusic; // music, track, and reset bit
INT16 maptol;
UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE;
@@ -2182,12 +2184,13 @@ void G_PlayerReborn(INT32 player)
if (p-players == consoleplayer)
{
if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here
if (mapmusflags & MUSIC_RELOADRESET)
{
mapmusic = mapheaderinfo[gamemap-1]->musicslot
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT);
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
mapmusname[6] = 0;
mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK;
}
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
}
if (gametype == GT_COOP)
@@ -2328,6 +2331,11 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
}
}
P_MovePlayerToSpawn(playernum, spawnpoint);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
}
mapthing_t *G_FindCTFStart(INT32 playernum)
@@ -2871,7 +2879,8 @@ static void G_DoCompleted(void)
// We are committed to this map now.
// We may as well allocate its header if it doesn't exist
if(!mapheaderinfo[nextmap])
// (That is, if it's a real map)
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
P_AllocMapHeader(nextmap);
if (skipstats)
@@ -3521,7 +3530,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (paused)
{
paused = false;
S_ResumeSound();
S_ResumeAudio();
}
if (netgame || multiplayer) // Nice try, haxor.
@@ -3595,7 +3604,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
globalweather = mapheaderinfo[gamemap-1]->weather;
// Don't carry over custom music change to another map.
mapmusic |= MUSIC_RELOADRESET;
mapmusflags |= MUSIC_RELOADRESET;
ultimatemode = pultmode;
playerdeadview = false;
@@ -4326,10 +4335,8 @@ void G_GhostTicker(void)
switch(g->color)
{
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
if (leveltime % 9 < 5)
g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
else
g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
g->mo->color = SKINCOLOR_SUPER1;
g->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4);
break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
+26 -5
View File
@@ -1503,16 +1503,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWR_GetMappedPatch(gpatch, spr->colormap);
}
if (spr->mobj->frame & FF_ANIMATE)
{
// set duration and tics to be the correct values for FF_ANIMATE states
durs = spr->mobj->state->var2;
tics = spr->mobj->anim_duration;
}
//FIXME: this is not yet correct
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
buff = md2->model->glCommandBuffer;
curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1
&& spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
if (cv_grmd2.value == 1)
{
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
{
UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
if (nextframe >= (UINT32)spr->mobj->state->var1)
nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
nextframe %= md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
else
{
if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
{
const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
}
}
//Hurdler: it seems there is still a small problem with mobj angle
+134 -668
View File
File diff suppressed because it is too large. Load diff
+37 -576
View File
@@ -1433,30 +1433,7 @@ typedef enum state
S_MSSHIELD_F12,
// Ring
S_RING1,
S_RING2,
S_RING3,
S_RING4,
S_RING5,
S_RING6,
S_RING7,
S_RING8,
S_RING9,
S_RING10,
S_RING11,
S_RING12,
S_RING13,
S_RING14,
S_RING15,
S_RING16,
S_RING17,
S_RING18,
S_RING19,
S_RING20,
S_RING21,
S_RING22,
S_RING23,
S_RING24,
S_RING,
// Blue Sphere for special stages
S_BLUEBALL,
@@ -1472,39 +1449,10 @@ typedef enum state
S_GRAVWELLRED3,
// Individual Team Rings
S_TEAMRING1,
S_TEAMRING2,
S_TEAMRING3,
S_TEAMRING4,
S_TEAMRING5,
S_TEAMRING6,
S_TEAMRING7,
S_TEAMRING8,
S_TEAMRING9,
S_TEAMRING10,
S_TEAMRING11,
S_TEAMRING12,
S_TEAMRING13,
S_TEAMRING14,
S_TEAMRING15,
S_TEAMRING16,
S_TEAMRING17,
S_TEAMRING18,
S_TEAMRING19,
S_TEAMRING20,
S_TEAMRING21,
S_TEAMRING22,
S_TEAMRING23,
S_TEAMRING24,
S_TEAMRING,
// Special Stage Token
S_EMMY1,
S_EMMY2,
S_EMMY3,
S_EMMY4,
S_EMMY5,
S_EMMY6,
S_EMMY7,
S_EMMY,
// Special Stage Token
S_TOKEN,
@@ -1658,40 +1606,9 @@ typedef enum state
S_SPIKED2,
// Starpost
S_STARPOST1,
S_STARPOST2,
S_STARPOST3,
S_STARPOST4,
S_STARPOST5,
S_STARPOST6,
S_STARPOST7,
S_STARPOST8,
S_STARPOST9,
S_STARPOST10,
S_STARPOST11,
S_STARPOST12,
S_STARPOST13,
S_STARPOST14,
S_STARPOST15,
S_STARPOST16,
S_STARPOST17,
S_STARPOST18,
S_STARPOST19,
S_STARPOST20,
S_STARPOST21,
S_STARPOST22,
S_STARPOST23,
S_STARPOST24,
S_STARPOST25,
S_STARPOST26,
S_STARPOST27,
S_STARPOST28,
S_STARPOST29,
S_STARPOST30,
S_STARPOST31,
S_STARPOST32,
S_STARPOST33,
S_STARPOST34,
S_STARPOST_IDLE,
S_STARPOST_FLASH,
S_STARPOST_SPIN,
// Big floating mine
S_BIGMINE1,
@@ -2299,38 +2216,7 @@ typedef enum state
S_PITY10,
// Invincibility Sparkles
S_IVSP1,
S_IVSP2,
S_IVSP3,
S_IVSP4,
S_IVSP5,
S_IVSP6,
S_IVSP7,
S_IVSP8,
S_IVSP9,
S_IVSP10,
S_IVSP11,
S_IVSP12,
S_IVSP13,
S_IVSP14,
S_IVSP15,
S_IVSP16,
S_IVSP17,
S_IVSP18,
S_IVSP19,
S_IVSP20,
S_IVSP21,
S_IVSP22,
S_IVSP23,
S_IVSP24,
S_IVSP25,
S_IVSP26,
S_IVSP27,
S_IVSP28,
S_IVSP29,
S_IVSP30,
S_IVSP31,
S_IVSP32,
S_IVSP,
// Super Sonic Spark
S_SSPK1,
@@ -2517,283 +2403,17 @@ typedef enum state
S_RRNG6,
S_RRNG7,
// Bounce Ring
S_BOUNCERING1,
S_BOUNCERING2,
S_BOUNCERING3,
S_BOUNCERING4,
S_BOUNCERING5,
S_BOUNCERING6,
S_BOUNCERING7,
S_BOUNCERING8,
S_BOUNCERING9,
S_BOUNCERING10,
S_BOUNCERING11,
S_BOUNCERING12,
S_BOUNCERING13,
S_BOUNCERING14,
S_BOUNCERING15,
S_BOUNCERING16,
S_BOUNCERING17,
S_BOUNCERING18,
S_BOUNCERING19,
S_BOUNCERING20,
S_BOUNCERING21,
S_BOUNCERING22,
S_BOUNCERING23,
S_BOUNCERING24,
S_BOUNCERING25,
S_BOUNCERING26,
S_BOUNCERING27,
S_BOUNCERING28,
S_BOUNCERING29,
S_BOUNCERING30,
S_BOUNCERING31,
S_BOUNCERING32,
S_BOUNCERING33,
S_BOUNCERING34,
S_BOUNCERING35,
// Rail Ring
S_RAILRING1,
S_RAILRING2,
S_RAILRING3,
S_RAILRING4,
S_RAILRING5,
S_RAILRING6,
S_RAILRING7,
S_RAILRING8,
S_RAILRING9,
S_RAILRING10,
S_RAILRING11,
S_RAILRING12,
S_RAILRING13,
S_RAILRING14,
S_RAILRING15,
S_RAILRING16,
S_RAILRING17,
S_RAILRING18,
S_RAILRING19,
S_RAILRING20,
S_RAILRING21,
S_RAILRING22,
S_RAILRING23,
S_RAILRING24,
S_RAILRING25,
S_RAILRING26,
S_RAILRING27,
S_RAILRING28,
S_RAILRING29,
S_RAILRING30,
S_RAILRING31,
S_RAILRING32,
S_RAILRING33,
S_RAILRING34,
S_RAILRING35,
// Infinity Ring
S_INFINITYRING1,
S_INFINITYRING2,
S_INFINITYRING3,
S_INFINITYRING4,
S_INFINITYRING5,
S_INFINITYRING6,
S_INFINITYRING7,
S_INFINITYRING8,
S_INFINITYRING9,
S_INFINITYRING10,
S_INFINITYRING11,
S_INFINITYRING12,
S_INFINITYRING13,
S_INFINITYRING14,
S_INFINITYRING15,
S_INFINITYRING16,
S_INFINITYRING17,
S_INFINITYRING18,
S_INFINITYRING19,
S_INFINITYRING20,
S_INFINITYRING21,
S_INFINITYRING22,
S_INFINITYRING23,
S_INFINITYRING24,
S_INFINITYRING25,
S_INFINITYRING26,
S_INFINITYRING27,
S_INFINITYRING28,
S_INFINITYRING29,
S_INFINITYRING30,
S_INFINITYRING31,
S_INFINITYRING32,
S_INFINITYRING33,
S_INFINITYRING34,
S_INFINITYRING35,
// Automatic Ring
S_AUTOMATICRING1,
S_AUTOMATICRING2,
S_AUTOMATICRING3,
S_AUTOMATICRING4,
S_AUTOMATICRING5,
S_AUTOMATICRING6,
S_AUTOMATICRING7,
S_AUTOMATICRING8,
S_AUTOMATICRING9,
S_AUTOMATICRING10,
S_AUTOMATICRING11,
S_AUTOMATICRING12,
S_AUTOMATICRING13,
S_AUTOMATICRING14,
S_AUTOMATICRING15,
S_AUTOMATICRING16,
S_AUTOMATICRING17,
S_AUTOMATICRING18,
S_AUTOMATICRING19,
S_AUTOMATICRING20,
S_AUTOMATICRING21,
S_AUTOMATICRING22,
S_AUTOMATICRING23,
S_AUTOMATICRING24,
S_AUTOMATICRING25,
S_AUTOMATICRING26,
S_AUTOMATICRING27,
S_AUTOMATICRING28,
S_AUTOMATICRING29,
S_AUTOMATICRING30,
S_AUTOMATICRING31,
S_AUTOMATICRING32,
S_AUTOMATICRING33,
S_AUTOMATICRING34,
S_AUTOMATICRING35,
// Explosion Ring
S_EXPLOSIONRING1,
S_EXPLOSIONRING2,
S_EXPLOSIONRING3,
S_EXPLOSIONRING4,
S_EXPLOSIONRING5,
S_EXPLOSIONRING6,
S_EXPLOSIONRING7,
S_EXPLOSIONRING8,
S_EXPLOSIONRING9,
S_EXPLOSIONRING10,
S_EXPLOSIONRING11,
S_EXPLOSIONRING12,
S_EXPLOSIONRING13,
S_EXPLOSIONRING14,
S_EXPLOSIONRING15,
S_EXPLOSIONRING16,
S_EXPLOSIONRING17,
S_EXPLOSIONRING18,
S_EXPLOSIONRING19,
S_EXPLOSIONRING20,
S_EXPLOSIONRING21,
S_EXPLOSIONRING22,
S_EXPLOSIONRING23,
S_EXPLOSIONRING24,
S_EXPLOSIONRING25,
S_EXPLOSIONRING26,
S_EXPLOSIONRING27,
S_EXPLOSIONRING28,
S_EXPLOSIONRING29,
S_EXPLOSIONRING30,
S_EXPLOSIONRING31,
S_EXPLOSIONRING32,
S_EXPLOSIONRING33,
S_EXPLOSIONRING34,
S_EXPLOSIONRING35,
// Scatter Ring
S_SCATTERRING1,
S_SCATTERRING2,
S_SCATTERRING3,
S_SCATTERRING4,
S_SCATTERRING5,
S_SCATTERRING6,
S_SCATTERRING7,
S_SCATTERRING8,
S_SCATTERRING9,
S_SCATTERRING10,
S_SCATTERRING11,
S_SCATTERRING12,
S_SCATTERRING13,
S_SCATTERRING14,
S_SCATTERRING15,
S_SCATTERRING16,
S_SCATTERRING17,
S_SCATTERRING18,
S_SCATTERRING19,
S_SCATTERRING20,
S_SCATTERRING21,
S_SCATTERRING22,
S_SCATTERRING23,
S_SCATTERRING24,
S_SCATTERRING25,
S_SCATTERRING26,
S_SCATTERRING27,
S_SCATTERRING28,
S_SCATTERRING29,
S_SCATTERRING30,
S_SCATTERRING31,
S_SCATTERRING32,
S_SCATTERRING33,
S_SCATTERRING34,
S_SCATTERRING35,
// Grenade Ring
S_GRENADERING1,
S_GRENADERING2,
S_GRENADERING3,
S_GRENADERING4,
S_GRENADERING5,
S_GRENADERING6,
S_GRENADERING7,
S_GRENADERING8,
S_GRENADERING9,
S_GRENADERING10,
S_GRENADERING11,
S_GRENADERING12,
S_GRENADERING13,
S_GRENADERING14,
S_GRENADERING15,
S_GRENADERING16,
S_GRENADERING17,
S_GRENADERING18,
S_GRENADERING19,
S_GRENADERING20,
S_GRENADERING21,
S_GRENADERING22,
S_GRENADERING23,
S_GRENADERING24,
S_GRENADERING25,
S_GRENADERING26,
S_GRENADERING27,
S_GRENADERING28,
S_GRENADERING29,
S_GRENADERING30,
S_GRENADERING31,
S_GRENADERING32,
S_GRENADERING33,
S_GRENADERING34,
S_GRENADERING35,
// Weapon Ring Ammo
S_BOUNCERINGAMMO,
S_RAILRINGAMMO,
S_INFINITYRINGAMMO,
S_AUTOMATICRINGAMMO,
S_EXPLOSIONRINGAMMO,
S_SCATTERRINGAMMO,
S_GRENADERINGAMMO,
// Weapon pickup
S_BOUNCEPICKUP1,
S_BOUNCEPICKUP2,
S_BOUNCEPICKUP3,
S_BOUNCEPICKUP4,
S_BOUNCEPICKUP5,
S_BOUNCEPICKUP6,
S_BOUNCEPICKUP7,
S_BOUNCEPICKUP8,
S_BOUNCEPICKUP9,
S_BOUNCEPICKUP10,
S_BOUNCEPICKUP11,
S_BOUNCEPICKUP12,
S_BOUNCEPICKUP13,
S_BOUNCEPICKUP14,
S_BOUNCEPICKUP15,
S_BOUNCEPICKUP16,
S_BOUNCEPICKUP,
S_BOUNCEPICKUPFADE1,
S_BOUNCEPICKUPFADE2,
S_BOUNCEPICKUPFADE3,
@@ -2803,23 +2423,7 @@ typedef enum state
S_BOUNCEPICKUPFADE7,
S_BOUNCEPICKUPFADE8,
S_RAILPICKUP1,
S_RAILPICKUP2,
S_RAILPICKUP3,
S_RAILPICKUP4,
S_RAILPICKUP5,
S_RAILPICKUP6,
S_RAILPICKUP7,
S_RAILPICKUP8,
S_RAILPICKUP9,
S_RAILPICKUP10,
S_RAILPICKUP11,
S_RAILPICKUP12,
S_RAILPICKUP13,
S_RAILPICKUP14,
S_RAILPICKUP15,
S_RAILPICKUP16,
S_RAILPICKUP,
S_RAILPICKUPFADE1,
S_RAILPICKUPFADE2,
S_RAILPICKUPFADE3,
@@ -2829,23 +2433,7 @@ typedef enum state
S_RAILPICKUPFADE7,
S_RAILPICKUPFADE8,
S_AUTOPICKUP1,
S_AUTOPICKUP2,
S_AUTOPICKUP3,
S_AUTOPICKUP4,
S_AUTOPICKUP5,
S_AUTOPICKUP6,
S_AUTOPICKUP7,
S_AUTOPICKUP8,
S_AUTOPICKUP9,
S_AUTOPICKUP10,
S_AUTOPICKUP11,
S_AUTOPICKUP12,
S_AUTOPICKUP13,
S_AUTOPICKUP14,
S_AUTOPICKUP15,
S_AUTOPICKUP16,
S_AUTOPICKUP,
S_AUTOPICKUPFADE1,
S_AUTOPICKUPFADE2,
S_AUTOPICKUPFADE3,
@@ -2855,23 +2443,7 @@ typedef enum state
S_AUTOPICKUPFADE7,
S_AUTOPICKUPFADE8,
S_EXPLODEPICKUP1,
S_EXPLODEPICKUP2,
S_EXPLODEPICKUP3,
S_EXPLODEPICKUP4,
S_EXPLODEPICKUP5,
S_EXPLODEPICKUP6,
S_EXPLODEPICKUP7,
S_EXPLODEPICKUP8,
S_EXPLODEPICKUP9,
S_EXPLODEPICKUP10,
S_EXPLODEPICKUP11,
S_EXPLODEPICKUP12,
S_EXPLODEPICKUP13,
S_EXPLODEPICKUP14,
S_EXPLODEPICKUP15,
S_EXPLODEPICKUP16,
S_EXPLODEPICKUP,
S_EXPLODEPICKUPFADE1,
S_EXPLODEPICKUPFADE2,
S_EXPLODEPICKUPFADE3,
@@ -2881,23 +2453,7 @@ typedef enum state
S_EXPLODEPICKUPFADE7,
S_EXPLODEPICKUPFADE8,
S_SCATTERPICKUP1,
S_SCATTERPICKUP2,
S_SCATTERPICKUP3,
S_SCATTERPICKUP4,
S_SCATTERPICKUP5,
S_SCATTERPICKUP6,
S_SCATTERPICKUP7,
S_SCATTERPICKUP8,
S_SCATTERPICKUP9,
S_SCATTERPICKUP10,
S_SCATTERPICKUP11,
S_SCATTERPICKUP12,
S_SCATTERPICKUP13,
S_SCATTERPICKUP14,
S_SCATTERPICKUP15,
S_SCATTERPICKUP16,
S_SCATTERPICKUP,
S_SCATTERPICKUPFADE1,
S_SCATTERPICKUPFADE2,
S_SCATTERPICKUPFADE3,
@@ -2907,23 +2463,7 @@ typedef enum state
S_SCATTERPICKUPFADE7,
S_SCATTERPICKUPFADE8,
S_GRENADEPICKUP1,
S_GRENADEPICKUP2,
S_GRENADEPICKUP3,
S_GRENADEPICKUP4,
S_GRENADEPICKUP5,
S_GRENADEPICKUP6,
S_GRENADEPICKUP7,
S_GRENADEPICKUP8,
S_GRENADEPICKUP9,
S_GRENADEPICKUP10,
S_GRENADEPICKUP11,
S_GRENADEPICKUP12,
S_GRENADEPICKUP13,
S_GRENADEPICKUP14,
S_GRENADEPICKUP15,
S_GRENADEPICKUP16,
S_GRENADEPICKUP,
S_GRENADEPICKUPFADE1,
S_GRENADEPICKUPFADE2,
S_GRENADEPICKUPFADE3,
@@ -3304,101 +2844,22 @@ typedef enum state
S_ROCKSPAWN,
S_ROCKCRUMBLEA1,
S_ROCKCRUMBLEA2,
S_ROCKCRUMBLEA3,
S_ROCKCRUMBLEA4,
S_ROCKCRUMBLEA5,
S_ROCKCRUMBLEB1,
S_ROCKCRUMBLEB2,
S_ROCKCRUMBLEB3,
S_ROCKCRUMBLEB4,
S_ROCKCRUMBLEB5,
S_ROCKCRUMBLEC1,
S_ROCKCRUMBLEC2,
S_ROCKCRUMBLEC3,
S_ROCKCRUMBLEC4,
S_ROCKCRUMBLEC5,
S_ROCKCRUMBLED1,
S_ROCKCRUMBLED2,
S_ROCKCRUMBLED3,
S_ROCKCRUMBLED4,
S_ROCKCRUMBLED5,
S_ROCKCRUMBLEE1,
S_ROCKCRUMBLEE2,
S_ROCKCRUMBLEE3,
S_ROCKCRUMBLEE4,
S_ROCKCRUMBLEE5,
S_ROCKCRUMBLEF1,
S_ROCKCRUMBLEF2,
S_ROCKCRUMBLEF3,
S_ROCKCRUMBLEF4,
S_ROCKCRUMBLEF5,
S_ROCKCRUMBLEG1,
S_ROCKCRUMBLEG2,
S_ROCKCRUMBLEG3,
S_ROCKCRUMBLEG4,
S_ROCKCRUMBLEG5,
S_ROCKCRUMBLEH1,
S_ROCKCRUMBLEH2,
S_ROCKCRUMBLEH3,
S_ROCKCRUMBLEH4,
S_ROCKCRUMBLEH5,
S_ROCKCRUMBLEI1,
S_ROCKCRUMBLEI2,
S_ROCKCRUMBLEI3,
S_ROCKCRUMBLEI4,
S_ROCKCRUMBLEI5,
S_ROCKCRUMBLEJ1,
S_ROCKCRUMBLEJ2,
S_ROCKCRUMBLEJ3,
S_ROCKCRUMBLEJ4,
S_ROCKCRUMBLEJ5,
S_ROCKCRUMBLEK1,
S_ROCKCRUMBLEK2,
S_ROCKCRUMBLEK3,
S_ROCKCRUMBLEK4,
S_ROCKCRUMBLEK5,
S_ROCKCRUMBLEL1,
S_ROCKCRUMBLEL2,
S_ROCKCRUMBLEL3,
S_ROCKCRUMBLEL4,
S_ROCKCRUMBLEL5,
S_ROCKCRUMBLEM1,
S_ROCKCRUMBLEM2,
S_ROCKCRUMBLEM3,
S_ROCKCRUMBLEM4,
S_ROCKCRUMBLEM5,
S_ROCKCRUMBLEN1,
S_ROCKCRUMBLEN2,
S_ROCKCRUMBLEN3,
S_ROCKCRUMBLEN4,
S_ROCKCRUMBLEN5,
S_ROCKCRUMBLEO1,
S_ROCKCRUMBLEO2,
S_ROCKCRUMBLEO3,
S_ROCKCRUMBLEO4,
S_ROCKCRUMBLEO5,
S_ROCKCRUMBLEP1,
S_ROCKCRUMBLEP2,
S_ROCKCRUMBLEP3,
S_ROCKCRUMBLEP4,
S_ROCKCRUMBLEP5,
S_ROCKCRUMBLEA,
S_ROCKCRUMBLEB,
S_ROCKCRUMBLEC,
S_ROCKCRUMBLED,
S_ROCKCRUMBLEE,
S_ROCKCRUMBLEF,
S_ROCKCRUMBLEG,
S_ROCKCRUMBLEH,
S_ROCKCRUMBLEI,
S_ROCKCRUMBLEJ,
S_ROCKCRUMBLEK,
S_ROCKCRUMBLEL,
S_ROCKCRUMBLEM,
S_ROCKCRUMBLEN,
S_ROCKCRUMBLEO,
S_ROCKCRUMBLEP,
S_SRB1_CRAWLA1,
S_SRB1_CRAWLA2,
+47 -2
View File
@@ -1636,18 +1636,63 @@ static int lib_sStopSound(lua_State *L)
static int lib_sChangeMusic(lua_State *L)
{
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1);
#ifdef MUSICSLOT_COMPATIBILITY
const char *music_name;
UINT32 music_num;
char music_compat_name[7];
boolean looping;
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
if (lua_isnumber(L, 1))
{
music_num = (UINT32)luaL_checkinteger(L, 1);
music_flags = (UINT16)(music_num & 0x0000FFFF);
if (music_flags && music_flags <= 1035)
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
else if (music_flags && music_flags <= 1050)
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
else
music_compat_name[0] = 0; // becomes empty string
music_compat_name[6] = 0;
music_name = (const char *)&music_compat_name;
music_flags = 0;
}
else
{
music_num = 0;
music_name = luaL_checkstring(L, 1);
}
looping = (boolean)lua_opttrueboolean(L, 2);
#else
const char *music_name = luaL_checkstring(L, 1);
boolean looping = (boolean)lua_opttrueboolean(L, 2);
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
#endif
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
#ifdef MUSICSLOT_COMPATIBILITY
if (music_num)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
if (!player || P_IsLocalPlayer(player))
S_ChangeMusic(music_num, looping);
S_ChangeMusic(music_name, music_flags, looping);
return 0;
}
+2
View File
@@ -42,6 +42,7 @@ enum hook {
hook_LinedefExecute,
hook_PlayerMsg,
hook_HurtMsg,
hook_PlayerSpawn,
hook_MAX // last hook
};
@@ -75,5 +76,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_B
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
#endif
+30
View File
@@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = {
"LinedefExecute",
"PlayerMsg",
"HurtMsg",
"PlayerSpawn",
NULL
};
@@ -768,4 +769,33 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
return hooked;
}
void LUAh_NetArchiveHook(lua_CFunction archFunc)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_NetVars/8] & (1<<(hook_NetVars%8))))
return;
// stack: tables
I_Assert(lua_gettop(gL) > 0);
I_Assert(lua_istable(gL, -1));
// tables becomes an upvalue of archFunc
lua_pushvalue(gL, -1);
lua_pushcclosure(gL, archFunc, 1);
// stack: tables, archFunc
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_NetVars)
{
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -2); // archFunc
LUA_Call(gL, 1);
}
lua_pop(gL, 1); // pop archFunc
// stack: tables
}
#endif
+31 -1
View File
@@ -16,7 +16,9 @@
#include "r_local.h"
#include "st_stuff.h" // hudinfo[]
#include "g_game.h"
#include "i_video.h" // rendermode
#include "p_local.h" // camera_t
#include "screen.h" // screen width/height
#include "v_video.h"
#include "w_wad.h"
#include "z_zone.h"
@@ -486,7 +488,7 @@ static int libd_getColormap(lua_State *L)
INT32 skinnum = TC_DEFAULT;
skincolors_t color = luaL_optinteger(L, 2, 0);
UINT8* colormap = NULL;
//HUDSAFE
HUDONLY
if (lua_isnoneornil(L, 1))
; // defaults to TC_DEFAULT
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
@@ -510,6 +512,31 @@ static int libd_getColormap(lua_State *L)
return 1;
}
static int libd_width(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.width); // push screen width
return 1;
}
static int libd_height(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.height); // push screen height
return 1;
}
static int libd_renderer(lua_State *L)
{
HUDONLY
switch (rendermode) {
case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer
case render_soft: lua_pushliteral(L, "software"); break; // Software renderer
default: lua_pushliteral(L, "none"); break; // render_none (for dedicated), in case there's any reason this should be run
}
return 1;
}
static luaL_Reg lib_draw[] = {
{"patchExists", libd_patchExists},
{"cachePatch", libd_cachePatch},
@@ -521,6 +548,9 @@ static luaL_Reg lib_draw[] = {
{"drawString", libd_drawString},
{"stringWidth", libd_stringWidth},
{"getColormap", libd_getColormap},
{"width", libd_width},
{"height", libd_height},
{"renderer", libd_renderer},
{NULL, NULL}
};
+1
View File
@@ -42,6 +42,7 @@ extern lua_State *gL;
#define META_CVAR "CONSVAR_T*"
#define META_SECTORLINES "SECTOR_T*LINES"
#define META_SIDENUM "LINE_T*SIDENUM"
#define META_HUDINFO "HUDINFO_T*"
+83 -5
View File
@@ -37,6 +37,7 @@ enum sector_e {
sector_thinglist,
sector_heightsec,
sector_camsec,
sector_lines,
sector_ffloors
};
@@ -52,6 +53,7 @@ static const char *const sector_opt[] = {
"thinglist",
"heightsec",
"camsec",
"lines",
"ffloors",
NULL};
@@ -260,6 +262,67 @@ static int sector_iterate(lua_State *L)
return 3;
}
// sector.lines, i -> sector.lines[i]
// sector.lines.valid, for validity checking
static int sectorlines_get(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t i;
size_t numoflines = 0;
lua_settop(L, 2);
if (!lua_isnumber(L, 2))
{
int field = luaL_checkoption(L, 2, NULL, valid_opt);
if (!seclines)
{
if (field == 0) {
lua_pushboolean(L, 0);
return 1;
}
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
} else if (field == 0) {
lua_pushboolean(L, 1);
return 1;
}
}
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
if (!numoflines)
return luaL_error(L, "no lines found!");
i = (size_t)lua_tointeger(L, 2);
if (i >= numoflines)
return 0;
LUA_PushUserdata(L, seclines[i], META_LINE);
return 1;
}
static int sectorlines_num(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t numoflines = 0;
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
lua_pushinteger(L, numoflines);
return 1;
}
static int sector_get(lua_State *L)
{
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
@@ -325,6 +388,9 @@ static int sector_get(lua_State *L)
return 0;
LUA_PushUserdata(L, &sectors[sector->camsec], META_SECTOR);
return 1;
case sector_lines: // lines
LUA_PushUserdata(L, sector->lines, META_SECTORLINES);
return 1;
case sector_ffloors: // ffloors
lua_pushcfunction(L, lib_iterateSectorFFloors);
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
@@ -1111,9 +1177,13 @@ static int ffloor_set(lua_State *L)
case ffloor_bottompic:
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
break;
case ffloor_flags:
case ffloor_flags: {
ffloortype_e oldflags = ffloor->flags; // store FOF's old flags
ffloor->flags = luaL_checkinteger(L, 3);
if (ffloor->flags != oldflags)
ffloor->target->moved = true; // reset target sector's lightlist
break;
}
case ffloor_alpha:
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
break;
@@ -1168,10 +1238,10 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->typeoflevel);
else if (fastcmp(field,"nextlevel"))
lua_pushinteger(L, header->nextlevel);
else if (fastcmp(field,"musicslot"))
lua_pushinteger(L, header->musicslot);
else if (fastcmp(field,"musicslottrack"))
lua_pushinteger(L, header->musicslottrack);
else if (fastcmp(field,"musname"))
lua_pushstring(L, header->musname);
else if (fastcmp(field,"mustrack"))
lua_pushinteger(L, header->mustrack);
else if (fastcmp(field,"forcecharacter"))
lua_pushstring(L, header->forcecharacter);
else if (fastcmp(field,"weather"))
@@ -1230,6 +1300,14 @@ static int mapheaderinfo_get(lua_State *L)
int LUA_MapLib(lua_State *L)
{
luaL_newmetatable(L, META_SECTORLINES);
lua_pushcfunction(L, sectorlines_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, sectorlines_num);
lua_setfield(L, -2, "__len");
lua_pop(L, 1);
luaL_newmetatable(L, META_SECTOR);
lua_pushcfunction(L, sector_get);
lua_setfield(L, -2, "__index");
+8
View File
@@ -34,6 +34,7 @@ enum mobj_e {
mobj_angle,
mobj_sprite,
mobj_frame,
mobj_anim_duration,
mobj_touching_sectorlist,
mobj_subsector,
mobj_floorz,
@@ -92,6 +93,7 @@ static const char *const mobj_opt[] = {
"angle",
"sprite",
"frame",
"anim_duration",
"touching_sectorlist",
"subsector",
"floorz",
@@ -187,6 +189,9 @@ static int mobj_get(lua_State *L)
case mobj_frame:
lua_pushinteger(L, mo->frame);
break;
case mobj_anim_duration:
lua_pushinteger(L, mo->anim_duration);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:
@@ -406,6 +411,9 @@ static int mobj_set(lua_State *L)
case mobj_frame:
mo->frame = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:
+2 -26
View File
@@ -915,30 +915,6 @@ static void UnArchiveTables(void)
}
}
static void NetArchiveHook(lua_CFunction archFunc)
{
int TABLESINDEX;
if (!gL)
return;
TABLESINDEX = lua_gettop(gL);
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hook_NetVars);
lua_remove(gL, -2);
I_Assert(lua_istable(gL, -1));
lua_pushvalue(gL, TABLESINDEX);
lua_pushcclosure(gL, archFunc, 1);
lua_pushnil(gL);
while (lua_next(gL, -3) != 0) {
lua_pushvalue(gL, -3); // function
LUA_Call(gL, 1);
}
lua_pop(gL, 2);
}
void LUA_Step(void)
{
if (!gL)
@@ -972,7 +948,7 @@ void LUA_Archive(void)
}
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
ArchiveTables();
if (gL)
@@ -1003,7 +979,7 @@ void LUA_UnArchive(void)
UnArchiveExtVars(th); // apply variables
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
UnArchiveTables();
if (gL)
+1
View File
@@ -55,6 +55,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
void LUA_CVarChanged(const char *name); // lua_consolelib.c
int Lua_optoption(lua_State *L, int narg,
const char *def, const char *const lst[]);
void LUAh_NetArchiveHook(lua_CFunction archFunc);
// Console wrapper
void COM_Lua_f(void);
+8 -8
View File
@@ -4751,7 +4751,7 @@ static void M_SetupChoosePlayer(INT32 choice)
if (Playing() == false)
{
S_StopMusic();
S_ChangeMusic(mus_chrsel, true);
S_ChangeMusicInternal("chrsel", true);
}
SP_PlayerDef.prevMenu = currentMenu;
@@ -5202,7 +5202,7 @@ void M_DrawTimeAttackMenu(void)
lumpnum_t lumpnum;
char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback
S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@@ -5365,7 +5365,7 @@ static void M_TimeAttack(INT32 choice)
itemOn = tastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true);
S_ChangeMusicInternal("racent", true);
}
// Drawing function for Nights Attack
@@ -5375,7 +5375,7 @@ void M_DrawNightsAttackMenu(void)
lumpnum_t lumpnum;
char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback
S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@@ -5498,7 +5498,7 @@ static void M_NightsAttack(INT32 choice)
itemOn = nastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true);
S_ChangeMusicInternal("racent", true);
}
// Player has selected the "START" from the nights attack screen
@@ -5732,7 +5732,7 @@ static void M_ModeAttackEndGame(INT32 choice)
itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE;
S_ChangeMusic(mus_racent, true);
S_ChangeMusicInternal("racent", true);
// Update replay availability.
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
@@ -6944,7 +6944,7 @@ static void M_ToggleDigital(void)
if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StopMusic();
S_ChangeMusic(mus_lclear, false);
S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
}
else
@@ -6971,7 +6971,7 @@ static void M_ToggleMIDI(void)
I_InitMIDIMusic();
if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_ChangeMusic(mus_lclear, false);
S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
}
else
+2 -6
View File
@@ -3063,12 +3063,8 @@ void A_Invincibility(mobj_t *actor)
{
S_StopMusic();
if (mariomode)
{
S_ChangeMusic(mus_minvnc, false);
G_GhostAddColor(GHC_INVINCIBLE);
}
else
S_ChangeMusic(mus_invinc, false);
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
}
}
@@ -3104,7 +3100,7 @@ void A_SuperSneakers(mobj_t *actor)
else
{
S_StopMusic();
S_ChangeMusic(mus_shoes, false);
S_ChangeMusicInternal("shoes", false);
}
}
}
+2 -2
View File
@@ -2076,7 +2076,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
if (P_IsLocalPlayer(target->player) && target->player == &players[consoleplayer])
{
S_StopMusic(); // Stop the Music! Tails 03-14-2000
S_ChangeMusic(mus_gmover, false); // Yousa dead now, Okieday? Tails 03-14-2000
S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000
}
}
}
@@ -2464,7 +2464,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
&& player->nightstime < 10*TICRATE)
{
//S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusic(mus_drown,false);
S_ChangeMusicInternal("drown",false);
}
}
}
+1
View File
@@ -212,6 +212,7 @@ void P_RemoveSavegameMobj(mobj_t *th);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_RunShields(void);
void P_RunOverlays(void);
void P_MobjThinker(mobj_t *mobj);
boolean P_RailThinker(mobj_t *mobj);
void P_PushableThinker(mobj_t *mobj);
+101 -56
View File
@@ -79,11 +79,31 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum)
actioncachehead.prev = newaction;
}
//
// P_CycleStateAnimation
//
FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
{
// var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return;
mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from
// if more than var1 away from it, swap back to the original
// else just advance by one
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1)
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK);
}
//
// P_CycleMobjState
//
static void P_CycleMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@@ -102,6 +122,9 @@ static void P_CycleMobjState(mobj_t *mobj)
//
static void P_CyclePlayerMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@@ -279,6 +302,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Modified handling.
// Call action functions when the state is set
@@ -346,6 +370,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Modified handling.
// Call action functions when the state is set
@@ -399,6 +424,8 @@ boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@@ -416,6 +443,8 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@@ -3716,6 +3745,8 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
void P_SnowThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
// adjust height
if ((mobj->z += mobj->momz) <= mobj->floorz)
mobj->z = mobj->ceilingz;
@@ -3723,6 +3754,8 @@ void P_SnowThinker(precipmobj_t *mobj)
void P_RainThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
if (mobj->state != &states[S_RAIN1])
{
// cycle through states,
@@ -5833,8 +5866,6 @@ INT32 numshields = 0;
void P_RunShields(void)
{
INT32 i;
mobj_t *mo, *next;
fixed_t destx,desty,zoffs;
// run shields
for (i = 0; i < numshields; i++)
@@ -5843,60 +5874,6 @@ void P_RunShields(void)
P_SetTarget(&shields[i], NULL);
}
numshields = 0;
// run overlays
next = NULL;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
mo->angle = mo->target->angle;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
static boolean P_AddShield(mobj_t *thing)
@@ -5933,6 +5910,71 @@ static boolean P_AddShield(mobj_t *thing)
return true;
}
void P_RunOverlays(void)
{
// run overlays
mobj_t *mo, *next = NULL;
fixed_t destx,desty,zoffs;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (!(mo->state->frame & FF_ANIMATE) && mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
mo->angle = mo->target->angle;
if (!(mo->state->frame & FF_ANIMATE))
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
// if you're using FF_ANIMATE on an overlay,
// then you're on your own.
else
zoffs = 0;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
// Called only when MT_OVERLAY thinks.
static void P_AddOverlay(mobj_t *thing)
{
@@ -7502,6 +7544,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
mobj->friction = ORIG_FRICTION;
mobj->movefactor = ORIG_FRICTION_FACTOR;
@@ -7727,6 +7771,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// set subsector and/or block links
P_SetPrecipitationThingPosition(mobj);
+3 -1
View File
@@ -270,6 +270,7 @@ typedef struct mobj_s
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -383,7 +384,8 @@ typedef struct precipmobj_s
// More drawing info: to determine current sprite.
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
INT32 frame; // frame number, plus bits see p_pspr.h
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
+4 -2
View File
@@ -36,9 +36,11 @@
#endif
/// \brief Frame flags: only the frame number
#define FF_FRAMEMASK 0x7fff
#define FF_FRAMEMASK 0x3fff
/// \brief Frame flags: Simple stateless animation
#define FF_ANIMATE 0x4000
/// \brief Frame flags: frame always appears full bright
#define FF_FULLBRIGHT 0x8000 //
#define FF_FULLBRIGHT 0x8000
/// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table
#define FF_TRANSMASK 0xf0000
/// \brief shift for FF_TRANSMASK
+12 -1
View File
@@ -1058,6 +1058,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff |= MD_SPRITE;
if (mobj->frame != mobj->state->frame)
diff |= MD_FRAME;
if (mobj->anim_duration != (UINT16)mobj->state->var2)
diff |= MD_FRAME;
if (mobj->eflags)
diff |= MD_EFLAGS;
if (mobj->player)
@@ -1178,7 +1180,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
if (diff & MD_SPRITE)
WRITEUINT16(save_p, mobj->sprite);
if (diff & MD_FRAME)
{
WRITEUINT32(save_p, mobj->frame);
WRITEUINT16(save_p, mobj->anim_duration);
}
if (diff & MD_EFLAGS)
WRITEUINT16(save_p, mobj->eflags);
if (diff & MD_PLAYER)
@@ -2004,9 +2009,15 @@ static void LoadMobjThinker(actionf_p1 thinker)
else
mobj->sprite = mobj->state->sprite;
if (diff & MD_FRAME)
{
mobj->frame = READUINT32(save_p);
mobj->anim_duration = READUINT16(save_p);
}
else
{
mobj->frame = mobj->state->frame;
mobj->anim_duration = (UINT16)mobj->state->var2;
}
if (diff & MD_EFLAGS)
mobj->eflags = READUINT16(save_p);
if (diff & MD_PLAYER)
@@ -3192,7 +3203,7 @@ static inline boolean P_NetUnArchiveMisc(void)
// tell the sound code to reset the music since we're skipping what
// normally sets this flag
mapmusic |= MUSIC_RELOADRESET;
mapmusflags |= MUSIC_RELOADRESET;
G_SetGamestate(READINT16(save_p));
+66 -24
View File
@@ -180,10 +180,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->typeoflevel = 0;
DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE);
mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
DEH_WriteUndoline("MUSICSLOT", va("%d", mapheaderinfo[num]->musicslot), UNDO_NONE);
mapheaderinfo[num]->musicslot = mus_map01m + num;
DEH_WriteUndoline("MUSICSLOTTRACK", va("%d", mapheaderinfo[num]->musicslottrack), UNDO_NONE);
mapheaderinfo[num]->musicslottrack = 0;
DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE);
snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
mapheaderinfo[num]->musname[6] = 0;
DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE);
mapheaderinfo[num]->mustrack = 0;
DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE);
mapheaderinfo[num]->forcecharacter[0] = '\0';
DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE);
@@ -1439,6 +1440,29 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
#endif
case 413: // Change music
{
char process[8+1];
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
{
M_Memcpy(process,msd->bottomtexture,8);
process[8] = '\0';
sd->bottomtexture = get_number(process)-1;
}
M_Memcpy(process,msd->toptexture,8);
process[8] = '\0';
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
// If they type in O_ or D_ and their music name, just shrug,
// then copy the rest instead.
if ((process[0] == 'O' || process[0] == 'D') && process[7])
M_Memcpy(sd->text, process+2, 6);
else // Assume it's a proper music name.
M_Memcpy(sd->text, process, 6);
sd->text[6] = 0;
break;
}
case 414: // Play SFX
{
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
@@ -1449,13 +1473,6 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
process[8] = '\0';
sd->toptexture = get_number(process);
}
if (sd->special == 413 && (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0'))
{
char process[8+1];
M_Memcpy(process,msd->bottomtexture,8);
process[8] = '\0';
sd->bottomtexture = get_number(process)-1;
}
break;
}
@@ -2369,7 +2386,7 @@ boolean P_SetupLevel(boolean skipprecip)
// use gamemap to get map number.
// 99% of the things already did, so.
// Map header should always be in place at this point
INT32 i, loadprecip = 1;
INT32 i, loadprecip = 1, ranspecialwipe = 0;
INT32 loademblems = 1;
INT32 fromnetsave = 0;
boolean loadedbm = false;
@@ -2442,6 +2459,28 @@ boolean P_SetupLevel(boolean skipprecip)
// will be set by player think.
players[consoleplayer].viewz = 1;
// Special stage fade to white
// This is handled BEFORE sounds are stopped.
if (rendermode != render_none && G_IsSpecialStage(gamemap))
{
tic_t starttime = I_GetTime();
tic_t endtime = starttime + (3*TICRATE)/2;
S_StartSound(NULL, sfx_s3kaf);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
// Hold on white for extra effect.
while (I_GetTime() < endtime)
I_Sleep();
ranspecialwipe = 1;
}
// Make sure all sounds are stopped before Z_FreeTags.
S_StopSounds();
S_ClearSfx();
@@ -2451,25 +2490,28 @@ boolean P_SetupLevel(boolean skipprecip)
S_Start();
// Let's fade to black here
if (rendermode != render_none)
// But only if we didn't do the special stage wipe
if (rendermode != render_none && !ranspecialwipe)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false);
}
// Print "SPEEDING OFF TO [ZONE] [ACT 1]..."
if (rendermode != render_none)
{
// Don't include these in the fade!
{
char tx[64];
V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to..."));
snprintf(tx, 63, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : "");
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
I_UpdateNoVsync();
}
char tx[64];
V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to..."));
snprintf(tx, 63, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : "");
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
I_UpdateNoVsync();
}
#ifdef HAVE_BLUA
@@ -2767,7 +2809,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Remove the loading shit from the screen
if (rendermode != render_none)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (ranspecialwipe) ? 0 : 31);
if (precache || dedicated)
R_PrecacheLevel();
+15 -9
View File
@@ -2390,20 +2390,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// console player only unless NOCLIMB is set
if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)))
{
UINT16 musicnum = (UINT16)sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture;
mapmusic = musicnum | (tracknum << MUSIC_TRACKSHIFT);
if (!(line->flags & ML_BLOCKMONSTERS))
mapmusic |= MUSIC_RELOADRESET;
strncpy(mapmusname, sides[line->sidenum[0]].text, 7);
mapmusname[6] = 0;
if (musicnum >= NUMMUSIC || musicnum == mus_None)
S_StopMusic();
else
S_ChangeMusic(mapmusic, !(line->flags & ML_EFFECT4));
mapmusflags = tracknum & MUSIC_TRACKMASK;
if (!(line->flags & ML_BLOCKMONSTERS))
mapmusflags |= MUSIC_RELOADRESET;
S_ChangeMusic(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4));
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior.
// if (mapmusic & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
// if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
}
break;
@@ -3039,6 +3038,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible (or not visible) in
ffloor_t *rover; // FOF to vanish/un-vanish
ffloortype_e oldflags; // store FOF's old flags
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
{
@@ -3062,11 +3062,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
return;
}
oldflags = rover->flags;
// Abracadabra!
if (line->flags & ML_NOCLIMB)
rover->flags |= FF_EXISTS;
else
rover->flags &= ~FF_EXISTS;
// if flags changed, reset sector's light list
if (rover->flags != oldflags)
sec->moved = true;
}
}
break;
+2
View File
@@ -631,6 +631,7 @@ void P_Ticker(boolean run)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();
@@ -742,6 +743,7 @@ void P_PreTicker(INT32 frames)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();
+18 -31
View File
@@ -962,7 +962,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player))
{
S_StopMusic();
S_ChangeMusic(mus_supers, true);
S_ChangeMusicInternal("supers", true);
}
S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi
@@ -1098,7 +1098,7 @@ void P_PlayLivesJingle(player_t *player)
if (player)
player->powers[pw_extralife] = extralifetics + 1;
S_StopMusic(); // otherwise it won't restart if this is done twice in a row
S_ChangeMusic(mus_xtlife, false);
S_ChangeMusicInternal("xtlife", false);
}
}
@@ -1116,21 +1116,21 @@ void P_RestoreMusic(player_t *player)
return;
S_SpeedMusic(1.0f);
if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC))
S_ChangeMusic(mus_supers, true);
S_ChangeMusicInternal("supers", true);
else if (player->powers[pw_invulnerability] > 1)
S_ChangeMusic((mariomode) ? mus_minvnc : mus_invinc, false);
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super])
{
if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)
{
S_SpeedMusic(1.4f);
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
}
else
S_ChangeMusic(mus_shoes, true);
S_ChangeMusicInternal("shoes", true);
}
else
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
}
//
@@ -2039,7 +2039,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
mobj_t *killer;
if ((netgame || multiplayer) && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL);
killer->threshold = 42; // Special flag that it was drowning which killed you.
@@ -2048,7 +2048,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
else if (player->powers[pw_spacetime] == 1)
{
if ((netgame || multiplayer) && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
P_DamageMobj(player->mo, NULL, NULL, 10000);
}
@@ -2083,7 +2083,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
&& player == &players[consoleplayer])
{
S_StopMusic();
S_ChangeMusic(mus_drown, false);
S_ChangeMusicInternal("drown", false);
}
if (player->powers[pw_underwater] == 25*TICRATE + 1)
@@ -3442,27 +3442,14 @@ static void P_DoSuperStuff(player_t *player)
player->mo->health--;
}
// future todo: a skin option for this, and possibly more colors
switch (player->skin)
{
case 1: // Golden orange supertails.
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_TSUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_TSUPER1 + 9 - leveltime % 9;
break;
case 2: // Pink superknux.
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_KSUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_KSUPER1 + 9 - leveltime % 9;
break;
default: // Yousa yellow now!
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
break;
case 1: /* Tails */ player->mo->color = SKINCOLOR_TSUPER1; break;
case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break;
default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break;
}
player->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4);
if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN))
&& !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy))
@@ -5592,7 +5579,7 @@ static void P_NiGHTSMovement(player_t *player)
}
else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE)
// S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusic(mus_drown,false);
S_ChangeMusicInternal("drown",false);
if (player->mo->z < player->mo->floorz)
@@ -7730,7 +7717,7 @@ static void P_DeathThink(player_t *player)
// Return to level music
if (netgame && player->deadtimer == gameovertics && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true);
S_ChangeMusic(mapmusname, mapmusflags, true);
}
if (!player->mo)
@@ -8716,7 +8703,7 @@ void P_PlayerThink(player_t *player)
if (countdown == 11*TICRATE - 1)
{
if (P_IsLocalPlayer(player))
S_ChangeMusic(mus_drown, false);
S_ChangeMusicInternal("drown", false);
}
// If you've hit the countdown and you haven't made
-3
View File
@@ -2698,9 +2698,6 @@ next_token:
}
free(buf2);
// Not in vanilla, you don't.
skin->flags &= ~SF_SUPER;
lump++; // if no sprite defined use spirte just after this one
if (skin->sprite[0] == '\0')
{
+282 -302
View File
@@ -141,14 +141,6 @@ typedef struct
static channel_t *channels = NULL;
static INT32 numofchannels = 0;
// whether songs are mus_paused
static boolean mus_paused = 0;
// music currently being played
musicinfo_t *mus_playing = 0;
static INT32 nextcleanup;
//
// Internals.
//
@@ -307,47 +299,6 @@ static void SetChannelsNum(void)
channels[i].sfxinfo = 0;
}
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
S_SetDigMusicVolume(digMusicVolume);
S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
// Retrieve the lump number of sfx
//
@@ -371,12 +322,6 @@ lumpnum_t S_GetSfxLumpNum(sfxinfo_t *sfx)
return W_GetNumForName("dsthok");
}
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
// Stop all sounds, load level info, THEN start sounds.
void S_StopSounds(void)
{
@@ -442,22 +387,6 @@ void S_StopSoundByNum(sfxenum_t sfxnum)
}
}
void S_Start(void)
{
if (mapmusic & MUSIC_RELOADRESET)
{
mapmusic = mapheaderinfo[gamemap-1]->musicslot
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT);
}
mus_paused = 0;
if (cv_resetmusic.value)
S_StopMusic();
S_ChangeMusic(mapmusic, true);
nextcleanup = 15;
}
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
{
INT32 sep, pitch, priority, cnum;
@@ -745,43 +674,6 @@ void S_StopSound(void *origin)
}
}
//
// Stop and resume music, during game PAUSE.
//
void S_PauseSound(void)
{
if (!nodigimusic)
I_PauseSong(0);
if (mus_playing && !mus_paused)
{
I_PauseSong(mus_playing->handle);
mus_paused = true;
}
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeSound(void)
{
if (!nodigimusic)
I_ResumeSong(0);
else
if (mus_playing && mus_paused)
{
I_ResumeSong(mus_playing->handle);
mus_paused = false;
}
// resume cd music
I_ResumeCD();
}
//
// Updates music & sounds
//
@@ -883,38 +775,6 @@ void S_UpdateSounds(void)
}
}
// Clean up unused data.
#if 0
{
static tic_t nextcleanup = 0;
size_t i;
sfxinfo_t *sfx;
if (!gametic) nextcleanup = 0;
if (gametic > nextcleanup)
{
for (i = 1; i < NUMSFX; i++)
{
if (S_sfx[i].usefulness == 0)
{
S_sfx[i].usefulness--;
// don't forget to unlock it !!!
// __dmpi_unlock_....
//Z_ChangeTag(S_sfx[i].data, PU_CACHE);
I_FreeSfx(S_sfx+i);
//S_sfx[i].data = 0;
CONS_Debug(DBG_GAMELOGIC, "flushed sfx %.6s\n", S_sfx[i].name);
}
}
nextcleanup = gametic + 15;
}
}
#endif
// FIXTHIS: nextcleanup is probably unused
for (cnum = 0; cnum < numofchannels; cnum++)
{
c = &channels[cnum];
@@ -984,37 +844,6 @@ void S_UpdateSounds(void)
I_UpdateSound();
}
void S_SetDigMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_digmusicvolume, volume&31);
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
if (!nodigimusic)
I_SetDigMusicVolume(volume&31);
}
void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}
void S_SetSfxVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
@@ -1031,137 +860,6 @@ void S_SetSfxVolume(INT32 volume)
#endif
}
static boolean S_MIDIMusic(musicinfo_t *music, boolean looping)
{
if (nomidimusic)
return true; // no error
if (music_disabled)
return true; // no error
// get lumpnum if neccessary
if (!music->lumpnum)
{
if (W_CheckNumForName(va("d_%s", music->name)) == LUMPERROR)
return false;
music->lumpnum = W_GetNumForName(va("d_%s", music->name));
}
// load & register it
music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
#if defined (macintosh) && !defined (HAVE_SDL)
music->handle = I_RegisterSong(music_num);
#else
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
#endif
#ifdef MUSSERV
if (msg_id != -1)
{
struct musmsg msg_buffer;
msg_buffer.msg_type = 6;
memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text));
sprintf(msg_buffer.msg_text, "d_%s", music->name);
msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT);
}
#endif
// play it
if (!I_PlaySong(music->handle, looping))
return false;
mus_playing = music;
return true;
}
static boolean S_DigMusic(musicinfo_t *music, boolean looping)
{
if (nodigimusic)
return false; // try midi
if (digital_disabled)
return false; // try midi
if (!I_StartDigSong(music->name, looping))
return false;
mus_playing = music;
return true;
}
void S_ChangeMusic(UINT32 mslotnum, boolean looping)
{
musicinfo_t *music;
musicenum_t music_num = (signed)(mslotnum & MUSIC_SONGMASK);
INT32 track_num = (mslotnum & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT;
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
S_ClearSfx();
#endif
if (nomidimusic && nodigimusic)
return;
if (music_disabled && digital_disabled)
return;
// No Music
if (music_num == mus_None)
{
S_StopMusic();
return;
}
if (music_num >= NUMMUSIC)
{
CONS_Alert(CONS_ERROR, "Bad music number %d\n", music_num);
return;
}
else
music = &S_music[music_num];
if (mus_playing != music)
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(music, looping) && !S_MIDIMusic(music, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), music->name);
return;
}
}
I_SetSongTrack(track_num);
}
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
void S_StopMusic(void)
{
if (!mus_playing)
return;
if (mus_paused)
I_ResumeSong(mus_playing->handle);
if (!nodigimusic)
I_StopDigSong();
S_SpeedMusic(1.0f);
I_StopSong(mus_playing->handle);
I_UnRegisterSong(mus_playing->handle);
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(mus_playing->data, PU_CACHE);
#endif
mus_playing->data = NULL;
mus_playing = NULL;
}
void S_ClearSfx(void)
{
#ifndef DJGPPDOS
@@ -1452,3 +1150,285 @@ void S_StartSoundName(void *mo, const char *soundname)
S_StartSound(mo, soundnum);
}
/// ------------------------
/// Music
/// ------------------------
#ifdef MUSICSLOT_COMPATIBILITY
const char *compat_special_music_slots[16] =
{
"titles", // 1036 title screen
"read_m", // 1037 intro
"lclear", // 1038 level clear
"invinc", // 1039 invincibility
"shoes", // 1040 super sneakers
"minvnc", // 1041 Mario invincibility
"drown", // 1042 drowning
"gmover", // 1043 game over
"xtlife", // 1044 extra life
"contsc", // 1045 continue screen
"supers", // 1046 Super Sonic
"chrsel", // 1047 character select
"credit", // 1048 credits
"racent", // 1049 Race Results
"stjr", // 1050 Sonic Team Jr. Presents
""
};
#endif
#define music_playing (music_name[0]) // String is empty if no music is playing
static char music_name[7]; // up to 6-character name
static lumpnum_t music_lumpnum; // lump number of music (used??)
static void *music_data; // music raw data
static INT32 music_handle; // once registered, the handle for the music
static boolean mus_paused = 0; // whether songs are mus_paused
static boolean S_MIDIMusic(const char *mname, boolean looping)
{
lumpnum_t mlumpnum;
void *mdata;
INT32 mhandle;
if (nomidimusic || music_disabled)
return false; // didn't search.
if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR)
return false;
mlumpnum = W_GetNumForName(va("d_%s", mname));
// load & register it
mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC);
mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum));
#ifdef MUSSERV
if (msg_id != -1)
{
struct musmsg msg_buffer;
msg_buffer.msg_type = 6;
memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text));
sprintf(msg_buffer.msg_text, "d_%s", mname);
msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT);
}
#endif
// play it
if (!I_PlaySong(mhandle, looping))
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = mlumpnum;
music_data = mdata;
music_handle = mhandle;
return true;
}
static boolean S_DigMusic(const char *mname, boolean looping)
{
if (nodigimusic || digital_disabled)
return false; // try midi
if (!I_StartDigSong(mname, looping))
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = LUMPERROR;
music_data = NULL;
music_handle = 0;
return true;
}
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
{
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
S_ClearSfx();
#endif
if ((nomidimusic || music_disabled) && (nodigimusic || digital_disabled))
return;
// No Music (empty string)
if (mmusic[0] == 0)
{
S_StopMusic();
return;
}
if (strncmp(music_name, mmusic, 6))
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
return;
}
}
I_SetSongTrack(mflags & MUSIC_TRACKMASK);
}
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
void S_StopMusic(void)
{
if (!music_playing)
return;
if (mus_paused)
I_ResumeSong(music_handle);
if (!nodigimusic)
I_StopDigSong();
S_SpeedMusic(1.0f);
I_StopSong(music_handle);
I_UnRegisterSong(music_handle);
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(music_data, PU_CACHE);
#endif
music_data = NULL;
music_name[0] = 0;
}
void S_SetDigMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_digmusicvolume, volume&31);
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
if (!nodigimusic)
I_SetDigMusicVolume(volume&31);
}
void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}
/// ------------------------
/// Init & Others
/// ------------------------
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
S_SetDigMusicVolume(digMusicVolume);
S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
void S_Start(void)
{
if (mapmusflags & MUSIC_RELOADRESET)
{
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
mapmusname[6] = 0;
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
}
mus_paused = 0;
if (cv_resetmusic.value)
S_StopMusic();
S_ChangeMusic(mapmusname, mapmusflags, true);
}
//
// Stop and resume music, during game PAUSE.
//
void S_PauseAudio(void)
{
if (!nodigimusic)
I_PauseSong(0);
if (music_playing && !mus_paused)
{
I_PauseSong(music_handle);
mus_paused = true;
}
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeAudio(void)
{
if (!nodigimusic)
I_ResumeSong(0);
else
if (music_playing && mus_paused)
{
I_ResumeSong(music_handle);
mus_paused = false;
}
// resume cd music
I_ResumeCD();
}
+13 -9
View File
@@ -48,9 +48,6 @@ typedef enum
extern consvar_t play_mode;
#endif
//in case you're wondering why: I need to define this as extern so P_RestoreMusic can get to it so we don't do stupid song/speed changes
extern musicinfo_t *mus_playing;
typedef enum
{
SF_TOTALLYSINGLE = 1, // Only play one of these sounds at a time...GLOBALLY
@@ -100,11 +97,12 @@ void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume);
// Stop sound for thing at <origin>
void S_StopSound(void *origin);
// Start music using <music_id> from sounds.h, and set whether looping
// note: music slot is first 16 bits for songnum,
// next 15 bits for tracknum (gme, other formats with more than one track)
// Start music track, arbitrary, given its name, and set whether looping
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
// 13-15 aren't used yet
// and the last bit we ignore (internal game flag for resetting music on reload)
void S_ChangeMusic(UINT32 mslotnum, boolean looping);
#define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b)
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
// Set Speed of Music
boolean S_SpeedMusic(float speed);
@@ -113,8 +111,8 @@ boolean S_SpeedMusic(float speed);
void S_StopMusic(void);
// Stop and resume music, during game PAUSE.
void S_PauseSound(void);
void S_ResumeSound(void);
void S_PauseAudio(void);
void S_ResumeAudio(void);
//
// Updates music & sounds
@@ -141,4 +139,10 @@ void S_StopSoundByNum(sfxenum_t sfxnum);
#define S_StartScreamSound S_StartSound
#endif
#ifdef MUSICSLOT_COMPATIBILITY
// For compatibility with code/scripts relying on older versions
// This is a list of all the "special" slot names and their associated numbers
const char *compat_special_music_slots[16];
#endif
#endif
+1
View File
@@ -395,6 +395,7 @@ void I_FreeSfx(sfxinfo_t *sfx)
if (sfx->data)
Mix_FreeChunk(sfx->data);
sfx->data = NULL;
sfx->lumpnum = LUMPERROR;
}
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
-1061
View File
File diff suppressed because it is too large. Load diff
-1086
View File
File diff suppressed because it is too large. Load diff
+26 -17
View File
@@ -32,6 +32,7 @@
#include "w_wad.h"
#include "z_zone.h"
#include "fastcmp.h"
#include "i_video.h" // rendermode
#include "d_netfil.h"
@@ -147,24 +148,32 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
}
#endif
// Check for MAINCFG
for (lump = 0;lump != INT16_MAX;lump++)
{
lump = W_CheckNumForNamePwad("MAINCFG", wadnum, lump);
if (lump == INT16_MAX)
break;
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
// Check for OBJCTCFG
for (lump = 0;lump < INT16_MAX;lump++)
{
lump = W_CheckNumForNamePwad("OBJCTCFG", wadnum, lump);
if (lump == INT16_MAX)
break;
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
{ // shameless copy+paste of code from LUA_LoadLump
char *name = malloc(strlen(wadfiles[wadnum]->filename)+10);
strcpy(name, wadfiles[wadnum]->filename);
if (!fasticmp(&name[strlen(name) - 4], ".soc")) {
// If it's not a .soc file, copy the lump name in too.
name[strlen(wadfiles[wadnum]->filename)] = '|';
M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8);
name[strlen(wadfiles[wadnum]->filename)+9] = '\0';
}
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
{
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
else if (memcmp(lump_p->name,"OBJCTCFG",8)==0) // Check for OBJCTCFG
{
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
}
#ifdef SCANTHINGS
+4 -4
View File
@@ -632,7 +632,7 @@ void Y_Ticker(void)
boolean anybonuses = false;
if (!intertic) // first time only
S_ChangeMusic(mus_lclear, false); // don't loop it
S_ChangeMusicInternal("lclear", false); // don't loop it
if (intertic < TICRATE) // one second pause before tally begins
return;
@@ -693,7 +693,7 @@ void Y_Ticker(void)
if (!intertic) // first time only
{
S_ChangeMusic(mus_lclear, false); // don't loop it
S_ChangeMusicInternal("lclear", false); // don't loop it
tallydonetic = 0;
}
@@ -754,7 +754,7 @@ void Y_Ticker(void)
else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match
{
if (!intertic) // first time only
S_ChangeMusic(mus_racent, true); // loop it
S_ChangeMusicInternal("racent", true); // loop it
// If a player has left or joined, recalculate scores.
if (data.match.numplayers != D_NumPlayers())
@@ -763,7 +763,7 @@ void Y_Ticker(void)
else if (intertype == int_race || intertype == int_classicrace) // race
{
if (!intertic) // first time only
S_ChangeMusic(mus_racent, true); // loop it
S_ChangeMusicInternal("racent", true); // loop it
// Don't bother recalcing for race. It doesn't make as much sense.
}