diff --git a/src/dehacked.c b/src/dehacked.c index 2f28a74cf..7e18063ed 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2010,12 +2010,63 @@ static void readmenu(MYFILE *f, INT32 num) menupres[num].bgcolor = get_number(word2); titlechanged = true; } - else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS")) + else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS") || fastcmp(word, "TITLEPICSHIDE")) { // true by default, except MM_MAIN menupres[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); titlechanged = true; } + else if (fastcmp(word, "TITLEPICSMODE")) + { + if (fastcmp(word2, "USER")) + menupres[num].ttmode = TTMODE_USER; + else if (fastcmp(word2, "ALACROIX")) + menupres[num].ttmode = TTMODE_ALACROIX; + else if (fastcmp(word2, "HIDE") || fastcmp(word2, "HIDDEN") || fastcmp(word2, "NONE")) + { + menupres[num].ttmode = TTMODE_USER; + menupres[num].ttname[0] = 0; + menupres[num].hidetitlepics = true; + } + else // if (fastcmp(word2, "OLD") || fastcmp(word2, "SSNTAILS")) + menupres[num].ttmode = TTMODE_OLD; + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSSCALE")) + { + menupres[num].ttscale = max(1, min(8, (UINT8)get_number(word2))); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSCOUNTERSET")) + { + menupres[num].ttcounterset = (INT32)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSNAME")) + { + strncpy(menupres[num].ttname, word2, 9); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSX")) + { + menupres[num].ttx = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSY")) + { + menupres[num].tty = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSLOOP")) + { + menupres[num].ttloop = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSTICS")) + { + menupres[num].tttics = (UINT16)get_number(word2); + titlechanged = true; + } else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED") || fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED")) { @@ -3374,11 +3425,62 @@ static void readmaincfg(MYFILE *f) titlemap = (INT16)value; titlechanged = true; } - else if (fastcmp(word, "HIDETITLEPICS")) + else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "TITLEPICSHIDE")) { hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); titlechanged = true; } + else if (fastcmp(word, "TITLEPICSMODE")) + { + if (fastcmp(word2, "USER")) + ttmode = TTMODE_USER; + else if (fastcmp(word2, "ALACROIX")) + ttmode = TTMODE_ALACROIX; + else if (fastcmp(word2, "HIDE") || fastcmp(word2, "HIDDEN") || fastcmp(word2, "NONE")) + { + ttmode = TTMODE_USER; + ttname[0] = 0; + hidetitlepics = true; + } + else // if (fastcmp(word2, "OLD") || fastcmp(word2, "SSNTAILS")) + ttmode = TTMODE_OLD; + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSSCALE")) + { + ttscale = max(1, min(8, (UINT8)get_number(word2))); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSCOUNTERSET")) + { + ttcounterset = (INT32)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSNAME")) + { + strncpy(ttname, word2, 9); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSX")) + { + ttx = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSY")) + { + tty = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSLOOP")) + { + ttloop = (INT16)get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLEPICSTICS")) + { + tttics = (UINT16)get_number(word2); + titlechanged = true; + } else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")) { titlescrollxspeed = get_number(word2); diff --git a/src/f_finale.c b/src/f_finale.c index f3ab235b8..846377218 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -70,7 +70,6 @@ mobj_t *titlemapcameraref = NULL; // menu presentation state char curbgname[9]; SINT8 curfadevalue; -boolean curhidepics; INT32 curbgcolor; INT32 curbgxspeed; INT32 curbgyspeed; @@ -80,6 +79,30 @@ static UINT8 curDemo = 0; static UINT32 demoDelayLeft; static UINT32 demoIdleLeft; +// customizable title screen graphics + +ttmode_enum ttmode = TTMODE_OLD; +UINT8 ttscale = 1; // FRACUNIT / ttscale +INT32 ttcounterset = -1; +// ttmode user vars +char ttname[9]; +INT16 ttx = 0; +INT16 tty = 0; +INT16 ttloop = 0; +UINT16 tttics = 1; + +boolean curhidepics; +ttmode_enum curttmode; +UINT8 curttscale; +INT32 curttcounterset; +// ttmode user vars +char curttname[9]; +INT16 curttx; +INT16 curtty; +INT16 curttloop; +UINT16 curtttics; + +// ttmode old static patch_t *ttbanner; // white banner with "robo blast" and "2" static patch_t *ttwing; // wing background static patch_t *ttsonic; // "SONIC" @@ -96,6 +119,16 @@ static patch_t *ttspop5; static patch_t *ttspop6; static patch_t *ttspop7; +// ttmode alacroix +static patch_t *ttribb[TTMAX_ALACROIX]; +static patch_t *ttsntx[TTMAX_ALACROIX]; +static patch_t *ttrobo[TTMAX_ALACROIX]; +static patch_t *tttwot[TTMAX_ALACROIX]; +static patch_t *ttembl[TTMAX_ALACROIX]; + +// ttmode user +static patch_t *ttuser[TTMAX_USER]; + static boolean goodending; static patch_t *endbrdr[2]; // border - blue, white, pink - where have i seen those colours before? static patch_t *endbgsp[3]; // nebula, sun, planet @@ -2095,16 +2128,25 @@ void F_InitMenuPresValues(void) // Set defaults for presentation values strncpy(curbgname, "TITLESKY", 9); curfadevalue = 16; - curhidepics = hidetitlepics; curbgcolor = -1; curbgxspeed = titlescrollxspeed; curbgyspeed = titlescrollyspeed; curbghide = true; + + curhidepics = hidetitlepics; + curttmode = ttmode; + curttscale = ttscale; + curttcounterset = ttcounterset; + strncpy(curttname, ttname, 9); + curttx = ttx; + curtty = tty; + curttloop = ttloop; + curtttics = tttics; // Find current presentation values M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY"); M_SetMenuCurFadeValue(16); - M_SetMenuCurHideTitlePics(); + M_SetMenuCurTitlePics(); } // @@ -2180,7 +2222,10 @@ void F_StartTitleScreen(void) if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS) { - finalecount = 0; + if (curttmode == TTMODE_ALACROIX) + finalecount = -3; // hack so that frames don't advance during the entry wipe + else + finalecount = 0; wipetypepost = menupres[MN_MAIN].enterwipe; } else @@ -2255,27 +2300,86 @@ void F_StartTitleScreen(void) demoDelayLeft = demoDelayTime; demoIdleLeft = demoIdleTime; - ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL); - ttwing = W_CachePatchName("TTWING", PU_LEVEL); - ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL); - ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL); - ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL); - ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL); - ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL); - ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL); - ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL); - ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL); - ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL); - ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL); - ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL); - ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL); - ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL); +#define LOADTTGFX(arr, name, maxf) \ +lumpnum = W_CheckNumForName(name); \ +if (lumpnum != LUMPERROR) \ +{ \ + arr[0] = W_CachePatchName(name, PU_LEVEL); \ + arr[min(1, maxf-1)] = 0; \ +} \ +else if (strlen(name) <= 6) \ +{ \ + fixed_t cnt = strlen(name); \ + strncpy(lumpname, name, 7); \ + for (i = 0; i < maxf-1; i++) \ + { \ + sprintf(&lumpname[cnt], "%.2hu", (UINT16)(i+1)); \ + lumpname[8] = 0; \ + lumpnum = W_CheckNumForName(lumpname); \ + if (lumpnum != LUMPERROR) \ + arr[i] = W_CachePatchName(lumpname, PU_LEVEL); \ + else \ + break; \ + } \ + arr[min(i, maxf-1)] = 0; \ +} \ +else \ + arr[0] = 0; + + switch(curttmode) + { + case TTMODE_OLD: + case TTMODE_NONE: + ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL); + ttwing = W_CachePatchName("TTWING", PU_LEVEL); + ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL); + ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL); + ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL); + ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL); + ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL); + ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL); + ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL); + ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL); + ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL); + ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL); + ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL); + ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL); + ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL); + break; + + case TTMODE_ALACROIX: + { + UINT16 i; + lumpnum_t lumpnum; + char lumpname[9]; + + LOADTTGFX(ttembl, "TTEMBL", TTMAX_ALACROIX) + LOADTTGFX(ttribb, "TTRIBB", TTMAX_ALACROIX) + LOADTTGFX(ttsntx, "TTSNTX", TTMAX_ALACROIX) + LOADTTGFX(ttrobo, "TTROBO", TTMAX_ALACROIX) + LOADTTGFX(tttwot, "TTTWOT", TTMAX_ALACROIX) + break; + } + + case TTMODE_USER: + { + UINT16 i; + lumpnum_t lumpnum; + char lumpname[9]; + + LOADTTGFX(ttuser, curttname, TTMAX_USER) + break; + } + } + +#undef LOADTTGFX } // (no longer) De-Demo'd Title Screen void F_TitleScreenDrawer(void) { boolean hidepics; + fixed_t sc = FRACUNIT / max(1, curttscale); if (modeattacking) return; // We likely came here from retrying. Don't do a damn thing. @@ -2287,7 +2391,7 @@ void F_TitleScreenDrawer(void) F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); // Don't draw outside of the title screen, or if the patch isn't there. - if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) + if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS) return; // rei|miru: use title pics? @@ -2299,42 +2403,109 @@ void F_TitleScreenDrawer(void) return; #endif - V_DrawScaledPatch(30, 14, 0, ttwing); - - if (finalecount < 57) + switch(curttmode) { - if (finalecount == 35) - V_DrawScaledPatch(115, 15, 0, ttspop1); - else if (finalecount == 36) - V_DrawScaledPatch(114, 15, 0,ttspop2); - else if (finalecount == 37) - V_DrawScaledPatch(113, 15, 0,ttspop3); - else if (finalecount == 38) - V_DrawScaledPatch(112, 15, 0,ttspop4); - else if (finalecount == 39) - V_DrawScaledPatch(111, 15, 0,ttspop5); - else if (finalecount == 40) - V_DrawScaledPatch(110, 15, 0, ttspop6); - else if (finalecount >= 41 && finalecount <= 44) - V_DrawScaledPatch(109, 15, 0, ttspop7); - else if (finalecount >= 45 && finalecount <= 48) - V_DrawScaledPatch(108, 12, 0, ttsprep1); - else if (finalecount >= 49 && finalecount <= 52) - V_DrawScaledPatch(107, 9, 0, ttsprep2); - else if (finalecount >= 53 && finalecount <= 56) - V_DrawScaledPatch(106, 6, 0, ttswip1); - V_DrawScaledPatch(93, 106, 0, ttsonic); - } - else - { - V_DrawScaledPatch(93, 106, 0,ttsonic); - if (finalecount/5 & 1) - V_DrawScaledPatch(100, 3, 0,ttswave1); - else - V_DrawScaledPatch(100,3, 0,ttswave2); - } + case TTMODE_OLD: + case TTMODE_NONE: + V_DrawSciencePatch(30<= 41 && finalecount <= 44) + V_DrawSciencePatch(109<= 45 && finalecount <= 48) + V_DrawSciencePatch(108<= 49 && finalecount <= 52) + V_DrawSciencePatch(107<= 53 && finalecount <= 56) + V_DrawSciencePatch(106< 7 && 17-finalecount > 0 && 17-finalecount < 10) + V_DrawFadeScreen(0, 17-finalecount); + + // Draw emblem + V_DrawSciencePatch(52< 9) + { + // Fade value for ROBO BLAST + INT32 fadeval = 0; + + // Draw SONIC text + V_DrawSciencePatch(94<= 0 || curbgname[0]) void F_InitMenuPresValues(void); diff --git a/src/m_menu.c b/src/m_menu.c index ca389a94d..3af93ddd2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2228,6 +2228,14 @@ void M_InitMenuPresTables(void) // so-called "undefined" menupres[i].fadestrength = -1; menupres[i].hidetitlepics = -1; // inherits global hidetitlepics + menupres[i].ttmode = TTMODE_NONE; + menupres[i].ttscale = UINT8_MAX; + menupres[i].ttcounterset = INT32_MAX; + menupres[i].ttname[0] = 0; + menupres[i].ttx = INT16_MAX; + menupres[i].tty = INT16_MAX; + menupres[i].ttloop = INT16_MAX; + menupres[i].tttics = UINT16_MAX; menupres[i].enterwipe = -1; menupres[i].exitwipe = -1; menupres[i].bgcolor = -1; @@ -2404,7 +2412,7 @@ static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval, return false; } -static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +static boolean MIT_SetCurTitlePics(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) { (void)input; (void)retval; @@ -2418,8 +2426,44 @@ static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retv curhidepics = menupres[menutype].hidetitlepics; return true; } + else if (menupres[menutype].ttmode == TTMODE_USER) + { + if (menupres[menutype].ttname[0]) + { + curhidepics = menupres[menutype].hidetitlepics; + curttmode = menupres[menutype].ttmode; + curttscale = (menupres[menutype].ttscale != UINT8_MAX ? menupres[menutype].ttscale : ttscale); + curttcounterset = (menupres[menutype].ttcounterset != INT32_MAX ? menupres[menutype].ttcounterset : ttcounterset); + strncpy(curttname, menupres[menutype].ttname, 9); + curttx = (menupres[menutype].ttx != INT16_MAX ? menupres[menutype].ttx : ttx); + curtty = (menupres[menutype].tty != INT16_MAX ? menupres[menutype].tty : tty); + curttloop = (menupres[menutype].ttloop != INT16_MAX ? menupres[menutype].ttloop : ttloop); + curtttics = (menupres[menutype].tttics != UINT16_MAX ? menupres[menutype].tttics : tttics); + } + else + curhidepics = menupres[menutype].hidetitlepics; + return true; + } + else if (menupres[menutype].ttmode != TTMODE_NONE) + { + curhidepics = menupres[menutype].hidetitlepics; + curttmode = menupres[menutype].ttmode; + curttscale = (menupres[menutype].ttscale != UINT8_MAX ? menupres[menutype].ttscale : ttscale); + curttcounterset = (menupres[menutype].ttcounterset != INT32_MAX ? menupres[menutype].ttcounterset : ttcounterset); + return true; + } else if (!level) + { curhidepics = hidetitlepics; + curttmode = ttmode; + curttscale = ttscale; + curttcounterset = ttcounterset; + strncpy(curttname, ttname, 9); + curttx = ttx; + curtty = tty; + curttloop = ttloop; + curtttics = tttics; + } return false; } @@ -2464,9 +2508,9 @@ void M_SetMenuCurFadeValue(UINT8 defaultvalue) M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue); } -void M_SetMenuCurHideTitlePics(void) +void M_SetMenuCurTitlePics(void) { - M_IterateMenuTree(MIT_SetCurHideTitlePics, NULL); + M_IterateMenuTree(MIT_SetCurTitlePics, NULL); } // ==================================== @@ -2516,6 +2560,15 @@ static void M_HandleMenuPresState(menu_t *newMenu) curbgyspeed = titlescrollyspeed; curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus + curttmode = ttmode; + curttscale = ttscale; + curttcounterset = ttcounterset; + strncpy(curttname, ttname, 9); + curttx = ttx; + curtty = tty; + curttloop = ttloop; + curtttics = tttics; + // don't do the below during the in-game menus if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) return; @@ -2523,7 +2576,7 @@ static void M_HandleMenuPresState(menu_t *newMenu) // Find current presentation values M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY"); M_SetMenuCurFadeValue(16); - M_SetMenuCurHideTitlePics(); + M_SetMenuCurTitlePics(); // Loop through both menu IDs in parallel and look for type changes // The youngest child in activeMenuId is the entered menu diff --git a/src/m_menu.h b/src/m_menu.h index 347725e10..9461a0d3a 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -18,6 +18,7 @@ #include "d_event.h" #include "command.h" #include "r_things.h" // for SKINNAMESIZE +#include "f_finale.h" // for ttmode_enum // // MENUS @@ -124,19 +125,28 @@ typedef enum typedef struct { char bgname[8]; // name for background gfx lump; lays over titlemap if this is set - SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting + SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined + INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules. INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting INT32 titlescrollyspeed; // y scroll - INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules. boolean bghide; // for titlemaps, hide the background. + SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting + ttmode_enum ttmode; // title wing animation mode; default TTMODE_OLD + UINT8 ttscale; // scale of title wing gfx (FRACUNIT / ttscale); -1 means undefined, inherits global setting + INT32 ttcounterset; // Value to reset animation counter to on subsequent menu viewings. + char ttname[9]; // lump name of title wing gfx. If name length is <= 6, engine will attempt to load numbered frames (TTNAMExx) + INT16 ttx; // X position of title wing + INT16 tty; // Y position of title wing + INT16 ttloop; // # frame to loop; -1 means dont loop + UINT16 tttics; // # of tics per frame + 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. boolean muslooping; ///< Loop the music boolean musstop; ///< Don't play any music boolean musignore; ///< Let the current music keep playing - SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined boolean enterbubble; // run all entrance line execs after common ancestor and up to child. If false, only run the child's exec boolean exitbubble; // run all exit line execs from child and up to before common ancestor. If false, only run the child's exec INT32 entertag; // line exec to run on menu enter, if titlemap @@ -154,7 +164,7 @@ UINT8 M_GetYoungestChildMenu(void); void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping); void M_SetMenuCurBackground(const char *defaultname); void M_SetMenuCurFadeValue(UINT8 defaultvalue); -void M_SetMenuCurHideTitlePics(void); +void M_SetMenuCurTitlePics(void); // Called by main loop, // saves config file and calls I_Quit when user exits.