diff --git a/.gitignore b/.gitignore index 3eca1c57a..6b2702a76 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ Win32_LIB_ASM_Release /make /bin /build +/CMakeUserPresets.json diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index d8eac4a44..a336bd53c 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -249,7 +249,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p if ((cx + fwidth) > clip->right) { - const float n = (clip->right - clip->left); + const float n = (clip->right - cx); s_max = (s_min + ((n / fwidth) * s_max)); fwidth = n; @@ -257,7 +257,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p if ((cy + fheight) > clip->bottom) { - const float n = (clip->bottom - clip->top); + const float n = (clip->bottom - cy); t_max = (t_min + ((n / fheight) * t_max)); fheight = n; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e30a725e9..0f861f642 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -938,8 +938,7 @@ static void HU_TickSongCredits(void) if (cursongcredit.anim > 0) { - char *str = va("\x1F"" %s", cursongcredit.def->source); - INT32 len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + INT32 len = V_ThinStringWidth(cursongcredit.text, V_ALLOWLOWERCASE|V_6WIDTHSPACE); fixed_t destx = (len+7) * FRACUNIT; if (cursongcredit.trans > 0) @@ -2045,29 +2044,28 @@ static void HU_DrawDemoInfo(void) // void HU_DrawSongCredits(void) { - char *str; fixed_t x; fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT; INT32 bgt; - if (!cursongcredit.def) // No def + if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def { return; } - str = va("\x1F"" %s", cursongcredit.def->source); bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2); x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x); if (bgt < NUMTRANSMAPS) { - V_DrawFixedPatch(x, y - (2 * FRACUNIT), FRACUNIT, V_SNAPTOLEFT|(bgt< 1) ? 1 : 0); - patch_t *localpatch[3] = { kp_nodraw }; + patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw }; patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags... diff --git a/src/k_objects.h b/src/k_objects.h index d9d89321e..c0da8034f 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -56,6 +56,7 @@ void Obj_DuelBombInit(mobj_t *bomb); /* Broly Ki */ mobj_t *Obj_SpawnBrolyKi(mobj_t *source, tic_t duration); +void Obj_BrolyKiThink(mobj_t *ki); /* Special Stage UFO */ void Obj_SpecialUFOThinker(mobj_t *ufo); diff --git a/src/objects/broly.c b/src/objects/broly.c index 8c743a64a..d041c23b7 100644 --- a/src/objects/broly.c +++ b/src/objects/broly.c @@ -2,9 +2,33 @@ #include "../info.h" #include "../k_kart.h" #include "../k_objects.h" +#include "../m_easing.h" #include "../p_local.h" #include "../s_sound.h" +// TODO: generic function +static void P_InstaScale(mobj_t *thing, fixed_t scale) +{ + P_SetScale(thing, scale); + thing->destscale = scale; +} + +/* An object may not be visible on the same tic: + 1) that it spawned + 2) that it cycles to the next state */ +#define BUFFER_TICS (2) + +#define broly_duration(o) ((o)->extravalue1) +#define broly_maxscale(o) ((o)->extravalue2) + +static inline fixed_t +get_unit_linear (const mobj_t *x) +{ + const tic_t t = (x->tics - BUFFER_TICS); + + return t * FRACUNIT / broly_duration(x); +} + mobj_t * Obj_SpawnBrolyKi ( mobj_t * source, @@ -25,13 +49,10 @@ Obj_SpawnBrolyKi x->color = source->color; x->hitlag = 0; // do not copy source hitlag - P_SetScale(x, 64 * mapobjectscale); - x->scalespeed = x->scale / duration; + broly_maxscale(x) = 64 * mapobjectscale; + broly_duration(x) = duration; - // The last tic doesn't actually get rendered so in order - // to show scale = destscale, add one buffer tic. - x->tics = (duration + 1); - x->destscale = 1; // 0 also doesn't work + x->tics = (duration + BUFFER_TICS); K_ReduceVFX(x, NULL); @@ -39,3 +60,13 @@ Obj_SpawnBrolyKi return x; } + +void +Obj_BrolyKiThink (mobj_t *x) +{ + const fixed_t + t = get_unit_linear(x), + n = Easing_OutSine(t, 0, broly_maxscale(x)); + + P_InstaScale(x, n); +} diff --git a/src/p_mobj.c b/src/p_mobj.c index d4e2d46a3..2ac670b93 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6522,6 +6522,9 @@ static void P_MobjSceneryThink(mobj_t *mobj) case MT_DRIFTELECTRICSPARK: mobj->renderflags ^= RF_DONTDRAW; break; + case MT_BROLY: + Obj_BrolyKiThink(mobj); + break; case MT_VWREF: case MT_VWREB: { diff --git a/src/p_setup.c b/src/p_setup.c index 6a1c5c049..3be049311 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -6837,6 +6837,7 @@ static void P_InitLevelSettings(void) memset(&quake,0,sizeof(struct quake)); // song credit init + Z_Free(cursongcredit.text); memset(&cursongcredit,0,sizeof(struct cursongcredit)); cursongcredit.trans = NUMTRANSMAPS; diff --git a/src/s_sound.c b/src/s_sound.c index fb21cc190..96211d653 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1476,16 +1476,32 @@ ReadMusicDefFields textline = value; - /* based ignored lumps */ - if (!stricmp(stoken, "usage")) { -#if 0 // Ignore for now - STRBUFCPY(def->usage, textline); -#endif - } else if (!stricmp(stoken, "source")) { - STRBUFCPY(def->source, textline); - } else if (!stricmp(stoken, "volume")) { + if (!stricmp(stoken, "title")) + { + Z_Free(def->title); + def->title = Z_StrDup(textline); + } + else if (!stricmp(stoken, "author")) + { + Z_Free(def->author); + def->author = Z_StrDup(textline); + } + else if (!stricmp(stoken, "source")) + { + Z_Free(def->source); + def->source = Z_StrDup(textline); + } + else if (!stricmp(stoken, "originalcomposers")) + { + Z_Free(def->composers); + def->composers = Z_StrDup(textline); + } + else if (!stricmp(stoken, "volume")) + { def->volume = atoi(textline); - } else { + } + else + { MusicDefError(CONS_WARNING, "Unknown field '%s'.", stoken, lumpnum, line); @@ -1608,14 +1624,53 @@ void S_ShowMusicCredit(void) { if (!stricmp(def->name, music_name)) { + char credittext[128] = ""; + char *work = NULL; + size_t len = 128, worklen; + + if (!def->title) + { + return; + } + + work = va("\x1F %s", def->title); + worklen = strlen(work); + if (worklen <= len) + { + strncat(credittext, work, len); + len -= worklen; + +#define MUSICCREDITAPPEND(field)\ + if (field)\ + {\ + work = va(" - %s", field);\ + worklen = strlen(work);\ + if (worklen <= len)\ + {\ + strncat(credittext, work, len);\ + len -= worklen;\ + }\ + } + + MUSICCREDITAPPEND(def->author); + MUSICCREDITAPPEND(def->source); + +#undef MUSICCREDITAPPEND + } + + if (credittext[0] == '\0') + return; + cursongcredit.def = def; + Z_Free(cursongcredit.text); + cursongcredit.text = Z_StrDup(credittext); cursongcredit.anim = 5*TICRATE; - cursongcredit.x = cursongcredit.old_x =0; + cursongcredit.x = cursongcredit.old_x = 0; cursongcredit.trans = NUMTRANSMAPS; return; } - else - def = def->next; + + def = def->next; } } diff --git a/src/s_sound.h b/src/s_sound.h index adbf92533..c9a86a2f5 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -173,8 +173,10 @@ boolean S_SpeedMusic(float speed); struct musicdef_t { char name[7]; - //char usage[256]; - char source[256]; + char *title; + char *author; + char *source; + char *composers; int volume; musicdef_t *next; }; @@ -182,6 +184,7 @@ struct musicdef_t extern struct cursongcredit { musicdef_t *def; + char *text; UINT16 anim; UINT8 trans; fixed_t x;