Merge branch 'move-your-car' into 'master'

Move your car

See merge request KartKrew/Kart!1990
This commit is contained in:
Oni 2024-03-02 20:26:53 +00:00
commit 48859ba80e
7 changed files with 31 additions and 0 deletions

View file

@ -3004,6 +3004,7 @@ static void Got_KickCmd(const UINT8 **p, INT32 playernum)
kickreason = KR_LEAVE; kickreason = KR_LEAVE;
break; break;
case KICK_MSG_GRIEF: case KICK_MSG_GRIEF:
S_StartSound(NULL, sfx_cftbl1);
HU_AddChatText(va("\x82*%s has been kicked (Automatic grief detection)", player_names[pnum]), false); HU_AddChatText(va("\x82*%s has been kicked (Automatic grief detection)", player_names[pnum]), false);
kickreason = KR_KICK; kickreason = KR_KICK;
break; break;

View file

@ -925,6 +925,7 @@ struct player_t
UINT32 griefValue; UINT32 griefValue;
UINT8 griefStrikes; UINT8 griefStrikes;
boolean griefWarned;
UINT8 typing_timer; // Counts down while keystrokes are not emitted UINT8 typing_timer; // Counts down while keystrokes are not emitted
UINT8 typing_duration; // How long since resumed timer UINT8 typing_duration; // How long since resumed timer

View file

@ -655,6 +655,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->griefValue); lua_pushinteger(L, plr->griefValue);
else if (fastcmp(field,"griefStrikes")) else if (fastcmp(field,"griefStrikes"))
lua_pushinteger(L, plr->griefStrikes); lua_pushinteger(L, plr->griefStrikes);
else if (fastcmp(field,"griefWarned"))
lua_pushinteger(L, plr->griefWarned);
else if (fastcmp(field,"splitscreenindex")) else if (fastcmp(field,"splitscreenindex"))
lua_pushinteger(L, plr->splitscreenindex); lua_pushinteger(L, plr->splitscreenindex);
#ifdef HWRENDER #ifdef HWRENDER
@ -1186,6 +1188,8 @@ static int player_set(lua_State *L)
plr->griefValue = (UINT32)luaL_checkinteger(L, 3); plr->griefValue = (UINT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"griefStrikes")) else if (fastcmp(field,"griefStrikes"))
plr->griefStrikes = (UINT8)luaL_checkinteger(L, 3); plr->griefStrikes = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"griefWarned"))
plr->griefWarned = luaL_checkinteger(L, 3);
else if (fastcmp(field,"splitscreenindex")) else if (fastcmp(field,"splitscreenindex"))
return NOSET; return NOSET;
#ifdef HWRENDER #ifdef HWRENDER

View file

@ -296,6 +296,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT32(save->p, players[i].spectatorReentry); WRITEUINT32(save->p, players[i].spectatorReentry);
WRITEUINT32(save->p, players[i].griefValue); WRITEUINT32(save->p, players[i].griefValue);
WRITEUINT8(save->p, players[i].griefStrikes); WRITEUINT8(save->p, players[i].griefStrikes);
WRITEUINT8(save->p, players[i].griefWarned);
WRITEUINT8(save->p, players[i].splitscreenindex); WRITEUINT8(save->p, players[i].splitscreenindex);
@ -923,6 +924,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].spectatorReentry = READUINT32(save->p); players[i].spectatorReentry = READUINT32(save->p);
players[i].griefValue = READUINT32(save->p); players[i].griefValue = READUINT32(save->p);
players[i].griefStrikes = READUINT8(save->p); players[i].griefStrikes = READUINT8(save->p);
players[i].griefWarned = READUINT8(save->p);
players[i].splitscreenindex = READUINT8(save->p); players[i].splitscreenindex = READUINT8(save->p);

View file

@ -69,6 +69,7 @@
#include "k_objects.h" #include "k_objects.h"
#include "k_endcam.h" #include "k_endcam.h"
#include "k_credits.h" #include "k_credits.h"
#include "k_hud.h" // K_AddMessage
#ifdef HWRENDER #ifdef HWRENDER
#include "hardware/hw_light.h" #include "hardware/hw_light.h"
@ -4643,6 +4644,9 @@ void P_IncrementGriefValue(player_t *player, UINT32 *grief, const UINT32 griefMa
{ {
// Playing normally. // Playing normally.
*grief = *grief - 1; *grief = *grief - 1;
if (*grief == 0)
player->griefWarned = false;
} }
} }
@ -4660,6 +4664,14 @@ void P_CheckRaceGriefing(player_t *player, boolean dopunishment)
P_IncrementGriefValue(player, &player->griefValue, griefMax); P_IncrementGriefValue(player, &player->griefValue, griefMax);
if (dopunishment && !player->griefWarned && player->griefValue >= (griefMax/2))
{
K_AddMessageForPlayer(player, "Get moving!", true, false);
if (P_IsLocalPlayer(player))
S_StartSound(NULL, sfx_cftbl0);
player->griefWarned = true;
}
if (dopunishment && player->griefValue >= griefMax) if (dopunishment && player->griefValue >= griefMax)
{ {
if (player->griefStrikes < 3) if (player->griefStrikes < 3)
@ -4668,6 +4680,7 @@ void P_CheckRaceGriefing(player_t *player, boolean dopunishment)
} }
player->griefValue = 0; player->griefValue = 0;
player->griefWarned = false;
if (server) if (server)
{ {

View file

@ -1493,6 +1493,11 @@ sfxinfo_t S_sfx[NUMSFX] =
{"gshf0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"gshf0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"gshf1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"gshf1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// Pinball
{"cftbl0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"cftbl1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"cftbl2", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// Generic menu SFX // Generic menu SFX
{"tmxatt", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Attention {"tmxatt", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Attention
{"tmxawd", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Award {"tmxawd", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Award

View file

@ -1569,6 +1569,11 @@ typedef enum
sfx_gshf0, sfx_gshf0,
sfx_gshf1, sfx_gshf1,
// Pinball
sfx_cftbl0,
sfx_cftbl1,
sfx_cftbl2,
// Generic menu SFX // Generic menu SFX
sfx_tmxatt, sfx_tmxatt,
sfx_tmxawd, sfx_tmxawd,