Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into legacydl-16

This commit is contained in:
toaster 2022-11-12 17:36:23 +00:00
commit a8a69ff03e
14 changed files with 96 additions and 47 deletions

View file

@ -1080,9 +1080,10 @@ static void COM_Toggle_f(void)
for (i = 2; i < COM_Argc() - 1; ++i) for (i = 2; i < COM_Argc() - 1; ++i)
{ {
const char *str = COM_Argv(i); const char *str = COM_Argv(i);
INT32 val; INT32 val = 0;
if (CV_CompleteValue(cvar, &str, &val)) if (!cvar->PossibleValue ||
CV_CompleteValue(cvar, &str, &val))
{ {
if (str ? !stricmp(cvar->string, str) if (str ? !stricmp(cvar->string, str)
: cvar->value == val) : cvar->value == val)

View file

@ -986,6 +986,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_bsaturation); CV_RegisterVar(&cv_bsaturation);
CV_RegisterVar(&cv_msaturation); CV_RegisterVar(&cv_msaturation);
CV_RegisterVar(&cv_palette);
CV_RegisterVar(&cv_palettenum);
// k_menu.c // k_menu.c
//CV_RegisterVar(&cv_compactscoreboard); //CV_RegisterVar(&cv_compactscoreboard);
CV_RegisterVar(&cv_chatheight); CV_RegisterVar(&cv_chatheight);
@ -1089,6 +1092,7 @@ void D_RegisterClientCommands(void)
COM_AddCommand("rteleport", Command_RTeleport_f); COM_AddCommand("rteleport", Command_RTeleport_f);
COM_AddCommand("skynum", Command_Skynum_f); COM_AddCommand("skynum", Command_Skynum_f);
COM_AddCommand("weather", Command_Weather_f); COM_AddCommand("weather", Command_Weather_f);
COM_AddCommand("grayscale", Command_Grayscale_f);
#ifdef _DEBUG #ifdef _DEBUG
COM_AddCommand("causecfail", Command_CauseCfail_f); COM_AddCommand("causecfail", Command_CauseCfail_f);
#endif #endif

View file

@ -3271,6 +3271,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_ITEM_DEBRIS_CLOUD_SPAWNER2", "S_ITEM_DEBRIS_CLOUD_SPAWNER2",
"S_ITEMICON", "S_ITEMICON",
"S_ITEMBACKDROP",
// Item capsules // Item capsules
"S_ITEMCAPSULE", "S_ITEMCAPSULE",

View file

@ -1257,7 +1257,7 @@ boolean HU_Responder(event_t *ev)
if (chatlen+pastelen > HU_MAXMSGLEN) if (chatlen+pastelen > HU_MAXMSGLEN)
return true; // we can't paste this!! return true; // we can't paste this!!
memmove(&w_chat[c_input + pastelen], &w_chat[c_input], pastelen); memmove(&w_chat[c_input + pastelen], &w_chat[c_input], (chatlen - c_input) + 1); // +1 for '\0'
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that. memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
c_input += pastelen; c_input += pastelen;
return true; return true;

View file

@ -531,6 +531,7 @@ char sprnames[NUMSPRITES + 1][5] =
"SBOX", // Sphere Box (for Battle) "SBOX", // Sphere Box (for Battle)
"RPOP", // Random Item Box Pop "RPOP", // Random Item Box Pop
"ITRI", // Item Box Debris "ITRI", // Item Box Debris
"ITPA", // Paper item backdrop
"SGNS", // Signpost sparkle "SGNS", // Signpost sparkle
"FAST", // Speed boost trail "FAST", // Speed boost trail
"DSHR", // Speed boost dust release "DSHR", // Speed boost dust release
@ -3879,6 +3880,7 @@ state_t states[NUMSTATES] =
{SPR_NULL, 0, 7, {A_SpawnItemDebrisCloud}, 20, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2 {SPR_NULL, 0, 7, {A_SpawnItemDebrisCloud}, 20, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2
{SPR_NULL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMICON {SPR_NULL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMICON
{SPR_ITPA, FF_FULLBRIGHT, -1, {NULL}, 1, 0, S_NULL}, // S_ITEMBACKDROP
{SPR_ICAP, FF_ADD|0, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE {SPR_ICAP, FF_ADD|0, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE
{SPR_ICAP, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE_TOP_SIDE {SPR_ICAP, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE_TOP_SIDE

View file

@ -1077,6 +1077,7 @@ typedef enum sprite
SPR_SBOX, // Sphere Box (for Battle) SPR_SBOX, // Sphere Box (for Battle)
SPR_RPOP, // Random Item Box Pop SPR_RPOP, // Random Item Box Pop
SPR_ITRI, // Item Box Debris SPR_ITRI, // Item Box Debris
SPR_ITPA, // Paper item backdrop
SPR_SGNS, // Signpost sparkle SPR_SGNS, // Signpost sparkle
SPR_FAST, // Speed boost trail SPR_FAST, // Speed boost trail
SPR_DSHR, // Speed boost dust release SPR_DSHR, // Speed boost dust release
@ -4282,6 +4283,7 @@ typedef enum state
S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_ITEM_DEBRIS_CLOUD_SPAWNER2,
S_ITEMICON, S_ITEMICON,
S_ITEMBACKDROP,
// Item capsules // Item capsules
S_ITEMCAPSULE, S_ITEMCAPSULE,

View file

@ -6924,6 +6924,11 @@ void K_DropHnextList(player_t *player, boolean keepshields)
mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount) mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount)
{ {
mobj_t *drop = P_SpawnMobj(x, y, z, MT_FLOATINGITEM); mobj_t *drop = P_SpawnMobj(x, y, z, MT_FLOATINGITEM);
mobj_t *backdrop = P_SpawnMobjFromMobj(drop, 0, 0, 0, MT_OVERLAY);
P_SetTarget(&backdrop->target, drop);
P_SetMobjState(backdrop, S_ITEMBACKDROP);
P_SetScale(drop, drop->scale>>4); P_SetScale(drop, drop->scale>>4);
drop->destscale = (3*drop->destscale)/2; drop->destscale = (3*drop->destscale)/2;
@ -7002,6 +7007,9 @@ mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8
} }
drop->flags |= MF_NOCLIPTHING; drop->flags |= MF_NOCLIPTHING;
backdrop->dispoffset = 1;
P_SetTarget(&backdrop->tracer, drop);
backdrop->flags2 |= MF2_LINKDRAW;
return drop; return drop;
} }

View file

@ -762,6 +762,13 @@ void Command_Setlives_f(void)
D_Cheat(consoleplayer, CHEAT_LIVES, atoi(COM_Argv(1))); D_Cheat(consoleplayer, CHEAT_LIVES, atoi(COM_Argv(1)));
} }
void Command_Grayscale_f(void)
{
REQUIRE_CHEATS;
COM_ImmedExecute("toggle palette \"\" GRAYPAL");
}
// //
// OBJECTPLACE (and related variables) // OBJECTPLACE (and related variables)
// //

View file

@ -75,6 +75,7 @@ void Command_Teleport_f(void);
void Command_RTeleport_f(void); void Command_RTeleport_f(void);
void Command_Skynum_f(void); void Command_Skynum_f(void);
void Command_Weather_f(void); void Command_Weather_f(void);
void Command_Grayscale_f(void);
#ifdef _DEBUG #ifdef _DEBUG
void Command_CauseCfail_f(void); void Command_CauseCfail_f(void);
#endif #endif

View file

@ -1997,9 +1997,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// Check if the player is allowed to be damaged! // Check if the player is allowed to be damaged!
// If not, then spawn the instashield effect instead. // If not, then spawn the instashield effect instead.
// NB: "allowcombo", "hardhit" and related checks are here to disallow HITLAG COMBOS, not loss-of-control combos if (!force)
// DMG_EXPLODE bypasses this check to prevent blocking eggbox/SPB with spinout flashtics
if (!force && (type != DMG_EXPLODE))
{ {
if (gametyperules & GTR_BUMPERS) if (gametyperules & GTR_BUMPERS)
{ {
@ -2039,7 +2037,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
allowcombo = false; allowcombo = false;
} }
if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0) // DMG_EXPLODE excluded from flashtic checks to prevent dodging eggbox/SPB with weak spinout
if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0 && type != DMG_EXPLODE)
{ {
// Post-hit invincibility // Post-hit invincibility
K_DoInstashield(player); K_DoInstashield(player);

View file

@ -5257,27 +5257,8 @@ void P_RunOverlays(void)
continue; continue;
} }
if (!r_splitscreen /*&& rendermode != render_soft*/) destx = mo->target->x;
{ desty = mo->target->y;
angle_t viewingangle;
if (players[displayplayers[0]].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y);
else if (!camera[0].chase && players[displayplayers[0]].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera[0].x, camera[0].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->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = FixedMul(mo->target->scale, mo->movefactor); mo->scale = mo->destscale = FixedMul(mo->target->scale, mo->movefactor);
@ -5289,12 +5270,27 @@ void P_RunOverlays(void)
if ((mo->flags & MF_DONTENCOREMAP) != (mo->target->flags & MF_DONTENCOREMAP)) if ((mo->flags & MF_DONTENCOREMAP) != (mo->target->flags & MF_DONTENCOREMAP))
mo->flags ^= MF_DONTENCOREMAP; mo->flags ^= MF_DONTENCOREMAP;
mo->dispoffset = mo->target->dispoffset + mo->info->dispoffset;
if (!(mo->state->frame & FF_ANIMATE)) if (!(mo->state->frame & FF_ANIMATE))
{
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale); zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
// if you're using FF_ANIMATE on an overlay,
// then you're on your own. if (mo->state->var1)
{
mo->dispoffset--;
}
else
{
mo->dispoffset++;
}
}
else else
{
// if you're using FF_ANIMATE on an overlay,
// then you're on your own.
zoffs = 0; zoffs = 0;
}
P_UnsetThingPosition(mo); P_UnsetThingPosition(mo);
mo->x = destx; mo->x = destx;
@ -6786,6 +6782,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
break; break;
case MT_FLOATINGITEM: case MT_FLOATINGITEM:
{ {
mobj->pitch = mobj->roll = 0;
if (mobj->flags & MF_NOCLIPTHING) if (mobj->flags & MF_NOCLIPTHING)
{ {
if (P_CheckDeathPitCollide(mobj)) if (P_CheckDeathPitCollide(mobj))

View file

@ -7357,7 +7357,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// Reset the palette now all fades have been done // Reset the palette now all fades have been done
if (rendermode != render_none) if (rendermode != render_none)
V_SetPaletteLump(GetPalette()); // Set the level palette V_ReloadPalette(); // Set the level palette
if (!(reloadinggamestate || titlemapinaction)) if (!(reloadinggamestate || titlemapinaction))
{ {

View file

@ -86,11 +86,16 @@ static CV_PossibleValue_t constextsize_cons_t[] = {
static void CV_constextsize_OnChange(void); static void CV_constextsize_OnChange(void);
consvar_t cv_constextsize = CVAR_INIT ("con_textsize", "Medium", CV_SAVE|CV_CALL, constextsize_cons_t, CV_constextsize_OnChange); consvar_t cv_constextsize = CVAR_INIT ("con_textsize", "Medium", CV_SAVE|CV_CALL, constextsize_cons_t, CV_constextsize_OnChange);
consvar_t cv_palette = CVAR_INIT ("palette", "", CV_CHEAT|CV_CALL|CV_NOINIT, NULL, CV_palette_OnChange);
consvar_t cv_palettenum = CVAR_INIT ("palettenum", "0", CV_CHEAT|CV_CALL|CV_NOINIT, CV_Unsigned, CV_palette_OnChange);
// local copy of the palette for V_GetColor() // local copy of the palette for V_GetColor()
RGBA_t *pLocalPalette = NULL; RGBA_t *pLocalPalette = NULL;
RGBA_t *pMasterPalette = NULL; RGBA_t *pMasterPalette = NULL;
RGBA_t *pGammaCorrectedPalette = NULL; RGBA_t *pGammaCorrectedPalette = NULL;
static size_t currentPaletteSize;
/* /*
The following was an extremely helpful resource when developing my Colour Cube LUT. The following was an extremely helpful resource when developing my Colour Cube LUT.
http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html
@ -311,9 +316,12 @@ UINT32 V_GammaCorrect(UINT32 input, double power)
static void LoadPalette(const char *lumpname) static void LoadPalette(const char *lumpname)
{ {
lumpnum_t lumpnum = W_GetNumForName(lumpname); lumpnum_t lumpnum = W_GetNumForName(lumpname);
size_t i, palsize = W_LumpLength(lumpnum)/3; size_t i, palsize;
UINT8 *pal; UINT8 *pal;
currentPaletteSize = W_LumpLength(lumpnum);
palsize = currentPaletteSize / 3;
Cubeapply = InitCube(); Cubeapply = InitCube();
if (pLocalPalette != pMasterPalette) if (pLocalPalette != pMasterPalette)
@ -400,8 +408,24 @@ const char *R_GetPalname(UINT16 num)
const char *GetPalette(void) const char *GetPalette(void)
{ {
const char *user = cv_palette.string;
if (user && user[0])
{
if (W_CheckNumForName(user) == LUMPERROR)
{
CONS_Alert(CONS_WARNING,
"cv_palette %s lump does not exist\n", user);
}
else
{
return cv_palette.string;
}
}
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
return R_GetPalname((encoremode ? mapheaderinfo[gamemap-1]->encorepal : mapheaderinfo[gamemap-1]->palette)); return R_GetPalname((encoremode ? mapheaderinfo[gamemap-1]->encorepal : mapheaderinfo[gamemap-1]->palette));
return "PLAYPAL"; return "PLAYPAL";
} }
@ -419,6 +443,19 @@ void V_SetPalette(INT32 palettenum)
if (!pLocalPalette) if (!pLocalPalette)
V_ReloadPalette(); V_ReloadPalette();
if (palettenum == 0)
{
palettenum = cv_palettenum.value;
if (palettenum * 256U > currentPaletteSize - 256)
{
CONS_Alert(CONS_WARNING,
"cv_palettenum %d out of range\n",
palettenum);
palettenum = 0;
}
}
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
HWR_SetPalette(&pLocalPalette[palettenum*256]); HWR_SetPalette(&pLocalPalette[palettenum*256]);
@ -433,23 +470,12 @@ void V_SetPalette(INT32 palettenum)
void V_SetPaletteLump(const char *pal) void V_SetPaletteLump(const char *pal)
{ {
LoadPalette(pal); LoadPalette(pal);
#ifdef HWRENDER V_SetPalette(0);
if (rendermode == render_opengl)
HWR_SetPalette(pLocalPalette);
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
else
#endif
#endif
if (rendermode != render_none)
I_SetPalette(pLocalPalette);
#ifdef HASINVERT
R_MakeInvertmap();
#endif
} }
static void CV_palette_OnChange(void) static void CV_palette_OnChange(void)
{ {
// reload palette // recalculate Color Cube
V_ReloadPalette(); V_ReloadPalette();
V_SetPalette(0); V_SetPalette(0);
} }

View file

@ -34,7 +34,8 @@ extern consvar_t cv_ticrate, cv_constextsize,
cv_globalgamma, cv_globalsaturation, cv_globalgamma, cv_globalsaturation,
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue, cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,
cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma,
cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation; cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation,
cv_palette, cv_palettenum;
// Allocates buffer screens, call before R_Init. // Allocates buffer screens, call before R_Init.
void V_Init(void); void V_Init(void);