mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-27 08:48:11 +00:00
Merge branch 'master' into special-stages
This commit is contained in:
commit
a6e1731538
11 changed files with 138 additions and 38 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -22,3 +22,4 @@ Win32_LIB_ASM_Release
|
|||
/make
|
||||
/bin
|
||||
/build
|
||||
/CMakeUserPresets.json
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<<V_ALPHASHIFT), songcreditbg, NULL);
|
||||
V_DrawFixedPatch(x, y - (2 * FRACUNIT),
|
||||
FRACUNIT, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT),
|
||||
songcreditbg, NULL);
|
||||
}
|
||||
|
||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||
{
|
||||
V_DrawRightAlignedThinStringAtFixed(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||
}
|
||||
V_DrawRightAlignedThinStringAtFixed(x, y,
|
||||
V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT),
|
||||
cursongcredit.text);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,18 @@
|
|||
--------------------------------------------------*/
|
||||
UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b)
|
||||
{
|
||||
UINT32 redweight = 1063 * r;
|
||||
UINT32 greenweight = 3576 * g;
|
||||
UINT32 blueweight = 361 * b;
|
||||
UINT32 brightness = (redweight + greenweight + blueweight) / 5000;
|
||||
return min(brightness, UINT8_MAX);
|
||||
double redWeight = ((r * 1.0) / UINT8_MAX);
|
||||
double greenWeight = ((g * 1.0) / UINT8_MAX);
|
||||
double blueWeight = ((b * 1.0) / UINT8_MAX);
|
||||
double brightness = 0.5;
|
||||
|
||||
redWeight = pow(redWeight, 2.2) * 0.2126;
|
||||
greenWeight = pow(greenWeight, 2.2) * 0.7152;
|
||||
blueWeight = pow(greenWeight, 2.2) * 0.0722;
|
||||
|
||||
brightness = pow(redWeight + greenWeight + blueWeight, 1.0 / 2.2);
|
||||
|
||||
return (UINT8)(brightness * UINT8_MAX);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1023,7 +1023,7 @@ static void K_drawKartItem(void)
|
|||
// Why write V_DrawScaledPatch calls over and over when they're all the same?
|
||||
// Set to 'no item' just in case.
|
||||
const UINT8 offset = ((r_splitscreen > 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...
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue