mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-03 07:22:10 +00:00
Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into battle-cups
This commit is contained in:
commit
8809c68d55
15 changed files with 144 additions and 44 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -22,3 +22,4 @@ Win32_LIB_ASM_Release
|
||||||
/make
|
/make
|
||||||
/bin
|
/bin
|
||||||
/build
|
/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)
|
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));
|
s_max = (s_min + ((n / fwidth) * s_max));
|
||||||
fwidth = n;
|
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)
|
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));
|
t_max = (t_min + ((n / fheight) * t_max));
|
||||||
fheight = n;
|
fheight = n;
|
||||||
|
|
|
||||||
|
|
@ -938,8 +938,7 @@ static void HU_TickSongCredits(void)
|
||||||
|
|
||||||
if (cursongcredit.anim > 0)
|
if (cursongcredit.anim > 0)
|
||||||
{
|
{
|
||||||
char *str = va("\x1F"" %s", cursongcredit.def->source);
|
INT32 len = V_ThinStringWidth(cursongcredit.text, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
||||||
INT32 len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
|
|
||||||
fixed_t destx = (len+7) * FRACUNIT;
|
fixed_t destx = (len+7) * FRACUNIT;
|
||||||
|
|
||||||
if (cursongcredit.trans > 0)
|
if (cursongcredit.trans > 0)
|
||||||
|
|
@ -2045,29 +2044,28 @@ static void HU_DrawDemoInfo(void)
|
||||||
//
|
//
|
||||||
void HU_DrawSongCredits(void)
|
void HU_DrawSongCredits(void)
|
||||||
{
|
{
|
||||||
char *str;
|
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
fixed_t y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT;
|
||||||
INT32 bgt;
|
INT32 bgt;
|
||||||
|
|
||||||
if (!cursongcredit.def) // No def
|
if (!cursongcredit.def || cursongcredit.trans >= NUMTRANSMAPS) // No def
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = va("\x1F"" %s", cursongcredit.def->source);
|
|
||||||
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2);
|
||||||
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
x = R_InterpolateFixed(cursongcredit.old_x, cursongcredit.x);
|
||||||
|
|
||||||
if (bgt < NUMTRANSMAPS)
|
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),
|
||||||
V_DrawRightAlignedThinStringAtFixed(x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
cursongcredit.text);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
|
||||||
|
|
||||||
// Bomb punting
|
// Bomb punting
|
||||||
if ((t1->state >= &states[S_SSMINE1] && t1->state <= &states[S_SSMINE4])
|
if ((t1->state >= &states[S_SSMINE1] && t1->state <= &states[S_SSMINE4])
|
||||||
|| (t1->state >= &states[S_SSMINE_DEPLOY8] && t1->state <= &states[S_SSMINE_DEPLOY13]))
|
|| (t1->state >= &states[S_SSMINE_DEPLOY8] && t1->state <= &states[S_SSMINE_EXPLODE2]))
|
||||||
{
|
{
|
||||||
P_KillMobj(t1, t2, t2, DMG_NORMAL);
|
P_KillMobj(t1, t2, t2, DMG_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,18 @@
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b)
|
UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b)
|
||||||
{
|
{
|
||||||
UINT32 redweight = 1063 * r;
|
double redWeight = ((r * 1.0) / UINT8_MAX);
|
||||||
UINT32 greenweight = 3576 * g;
|
double greenWeight = ((g * 1.0) / UINT8_MAX);
|
||||||
UINT32 blueweight = 361 * b;
|
double blueWeight = ((b * 1.0) / UINT8_MAX);
|
||||||
UINT32 brightness = (redweight + greenweight + blueweight) / 5000;
|
double brightness = 0.5;
|
||||||
return min(brightness, UINT8_MAX);
|
|
||||||
|
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?
|
// Why write V_DrawScaledPatch calls over and over when they're all the same?
|
||||||
// Set to 'no item' just in case.
|
// Set to 'no item' just in case.
|
||||||
const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0);
|
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 *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]);
|
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...
|
INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
|
||||||
|
|
|
||||||
|
|
@ -56,5 +56,6 @@ void Obj_DuelBombInit(mobj_t *bomb);
|
||||||
|
|
||||||
/* Broly Ki */
|
/* Broly Ki */
|
||||||
mobj_t *Obj_SpawnBrolyKi(mobj_t *source, tic_t duration);
|
mobj_t *Obj_SpawnBrolyKi(mobj_t *source, tic_t duration);
|
||||||
|
void Obj_BrolyKiThink(mobj_t *ki);
|
||||||
|
|
||||||
#endif/*k_objects_H*/
|
#endif/*k_objects_H*/
|
||||||
|
|
|
||||||
|
|
@ -821,7 +821,7 @@ static void K_InitRoulette(itemroulette_t *const roulette)
|
||||||
roulette->secondToFirst = 0;
|
roulette->secondToFirst = 0;
|
||||||
|
|
||||||
roulette->elapsed = 0;
|
roulette->elapsed = 0;
|
||||||
roulette->tics = roulette->speed = ROULETTE_SPEED_FASTEST; // Some default speed
|
roulette->tics = roulette->speed = ROULETTE_SPEED_TIMEATTACK; // Some default speed
|
||||||
|
|
||||||
roulette->active = true;
|
roulette->active = true;
|
||||||
roulette->eggman = false;
|
roulette->eggman = false;
|
||||||
|
|
@ -981,7 +981,7 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette)
|
||||||
// Combine our two factors together.
|
// Combine our two factors together.
|
||||||
total = min(FRACUNIT, (frontRun / 2) + (progress / 2));
|
total = min(FRACUNIT, (frontRun / 2) + (progress / 2));
|
||||||
|
|
||||||
if (leveltime < starttime + 20*TICRATE)
|
if (leveltime < starttime + 30*TICRATE)
|
||||||
{
|
{
|
||||||
// Don't impact as much at the start.
|
// Don't impact as much at the start.
|
||||||
// This makes it so that everyone gets to enjoy the lowest speed at the start.
|
// This makes it so that everyone gets to enjoy the lowest speed at the start.
|
||||||
|
|
@ -991,7 +991,7 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const fixed_t lerp = FixedDiv(leveltime - starttime, 20*TICRATE);
|
const fixed_t lerp = FixedDiv(leveltime - starttime, 30*TICRATE);
|
||||||
total = FRACUNIT + FixedMul(lerp, total - FRACUNIT);
|
total = FRACUNIT + FixedMul(lerp, total - FRACUNIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,33 @@
|
||||||
#include "../info.h"
|
#include "../info.h"
|
||||||
#include "../k_kart.h"
|
#include "../k_kart.h"
|
||||||
#include "../k_objects.h"
|
#include "../k_objects.h"
|
||||||
|
#include "../m_easing.h"
|
||||||
#include "../p_local.h"
|
#include "../p_local.h"
|
||||||
#include "../s_sound.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 *
|
mobj_t *
|
||||||
Obj_SpawnBrolyKi
|
Obj_SpawnBrolyKi
|
||||||
( mobj_t * source,
|
( mobj_t * source,
|
||||||
|
|
@ -25,13 +49,10 @@ Obj_SpawnBrolyKi
|
||||||
x->color = source->color;
|
x->color = source->color;
|
||||||
x->hitlag = 0; // do not copy source hitlag
|
x->hitlag = 0; // do not copy source hitlag
|
||||||
|
|
||||||
P_SetScale(x, 64 * mapobjectscale);
|
broly_maxscale(x) = 64 * mapobjectscale;
|
||||||
x->scalespeed = x->scale / duration;
|
broly_duration(x) = duration;
|
||||||
|
|
||||||
// The last tic doesn't actually get rendered so in order
|
x->tics = (duration + BUFFER_TICS);
|
||||||
// to show scale = destscale, add one buffer tic.
|
|
||||||
x->tics = (duration + 1);
|
|
||||||
x->destscale = 1; // 0 also doesn't work
|
|
||||||
|
|
||||||
K_ReduceVFX(x, NULL);
|
K_ReduceVFX(x, NULL);
|
||||||
|
|
||||||
|
|
@ -39,3 +60,13 @@ Obj_SpawnBrolyKi
|
||||||
|
|
||||||
return x;
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Already have fake
|
// Already have fake
|
||||||
if (player->itemRoulette.eggman == true
|
if ((player->itemRoulette.active && player->itemRoulette.eggman) == true
|
||||||
|| player->eggmanexplode)
|
|| player->eggmanexplode)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
K_TumbleInterrupt(object->player);
|
K_TumbleInterrupt(object->player);
|
||||||
P_ResetPlayer(object->player);
|
P_ResetPlayer(object->player);
|
||||||
|
|
||||||
object->player->springstars = max(vertispeed, horizspeed) / FRACUNIT / 2;
|
object->player->springstars = max(abs(vertispeed), horizspeed) / FRACUNIT / 2;
|
||||||
object->player->springcolor = starcolor;
|
object->player->springcolor = starcolor;
|
||||||
|
|
||||||
// Less friction when hitting springs
|
// Less friction when hitting springs
|
||||||
|
|
|
||||||
|
|
@ -6508,6 +6508,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
||||||
case MT_DRIFTELECTRICSPARK:
|
case MT_DRIFTELECTRICSPARK:
|
||||||
mobj->renderflags ^= RF_DONTDRAW;
|
mobj->renderflags ^= RF_DONTDRAW;
|
||||||
break;
|
break;
|
||||||
|
case MT_BROLY:
|
||||||
|
Obj_BrolyKiThink(mobj);
|
||||||
|
break;
|
||||||
case MT_VWREF:
|
case MT_VWREF:
|
||||||
case MT_VWREB:
|
case MT_VWREB:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6837,6 +6837,7 @@ static void P_InitLevelSettings(void)
|
||||||
memset(&quake,0,sizeof(struct quake));
|
memset(&quake,0,sizeof(struct quake));
|
||||||
|
|
||||||
// song credit init
|
// song credit init
|
||||||
|
Z_Free(cursongcredit.text);
|
||||||
memset(&cursongcredit,0,sizeof(struct cursongcredit));
|
memset(&cursongcredit,0,sizeof(struct cursongcredit));
|
||||||
cursongcredit.trans = NUMTRANSMAPS;
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1476,16 +1476,32 @@ ReadMusicDefFields
|
||||||
|
|
||||||
textline = value;
|
textline = value;
|
||||||
|
|
||||||
/* based ignored lumps */
|
if (!stricmp(stoken, "title"))
|
||||||
if (!stricmp(stoken, "usage")) {
|
{
|
||||||
#if 0 // Ignore for now
|
Z_Free(def->title);
|
||||||
STRBUFCPY(def->usage, textline);
|
def->title = Z_StrDup(textline);
|
||||||
#endif
|
}
|
||||||
} else if (!stricmp(stoken, "source")) {
|
else if (!stricmp(stoken, "author"))
|
||||||
STRBUFCPY(def->source, textline);
|
{
|
||||||
} else if (!stricmp(stoken, "volume")) {
|
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);
|
def->volume = atoi(textline);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
MusicDefError(CONS_WARNING,
|
MusicDefError(CONS_WARNING,
|
||||||
"Unknown field '%s'.",
|
"Unknown field '%s'.",
|
||||||
stoken, lumpnum, line);
|
stoken, lumpnum, line);
|
||||||
|
|
@ -1608,14 +1624,53 @@ void S_ShowMusicCredit(void)
|
||||||
{
|
{
|
||||||
if (!stricmp(def->name, music_name))
|
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;
|
cursongcredit.def = def;
|
||||||
|
Z_Free(cursongcredit.text);
|
||||||
|
cursongcredit.text = Z_StrDup(credittext);
|
||||||
cursongcredit.anim = 5*TICRATE;
|
cursongcredit.anim = 5*TICRATE;
|
||||||
cursongcredit.x = cursongcredit.old_x =0;
|
cursongcredit.x = cursongcredit.old_x = 0;
|
||||||
cursongcredit.trans = NUMTRANSMAPS;
|
cursongcredit.trans = NUMTRANSMAPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
def = def->next;
|
def = def->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,8 +173,10 @@ boolean S_SpeedMusic(float speed);
|
||||||
struct musicdef_t
|
struct musicdef_t
|
||||||
{
|
{
|
||||||
char name[7];
|
char name[7];
|
||||||
//char usage[256];
|
char *title;
|
||||||
char source[256];
|
char *author;
|
||||||
|
char *source;
|
||||||
|
char *composers;
|
||||||
int volume;
|
int volume;
|
||||||
musicdef_t *next;
|
musicdef_t *next;
|
||||||
};
|
};
|
||||||
|
|
@ -182,6 +184,7 @@ struct musicdef_t
|
||||||
extern struct cursongcredit
|
extern struct cursongcredit
|
||||||
{
|
{
|
||||||
musicdef_t *def;
|
musicdef_t *def;
|
||||||
|
char *text;
|
||||||
UINT16 anim;
|
UINT16 anim;
|
||||||
UINT8 trans;
|
UINT8 trans;
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue