Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into prisons-death-fix

# Conflicts:
#	src/p_inter.c
This commit is contained in:
toaster 2023-08-31 14:02:38 +01:00
commit 43eb61dfcb
38 changed files with 721 additions and 172 deletions

View file

@ -338,6 +338,8 @@ static bool ACS_CountThing(mobj_t *mobj, mobjtype_t type)
return false; return false;
} }
// Unused, but it's here if you need it.
#if 0
/*-------------------------------------------------- /*--------------------------------------------------
static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread) static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread)
@ -365,6 +367,7 @@ static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread)
return false; return false;
} }
#endif
/*-------------------------------------------------- /*--------------------------------------------------
static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filter)(mobj_t *)) static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filter)(mobj_t *))
@ -823,8 +826,10 @@ bool CallFunc_EndPrint(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Wo
(void)argV; (void)argV;
(void)argC; (void)argC;
if (ACS_ActivatorIsLocal(thread) == true) auto& info = static_cast<Thread*>(thread)->info;
HU_DoTitlecardCEcho(thread->printBuf.data());
if (P_MobjWasRemoved(info.mo) == false && info.mo->player != nullptr)
HU_DoTitlecardCEcho(info.mo->player, thread->printBuf.data(), true);
thread->printBuf.drop(); thread->printBuf.drop();
return false; return false;
@ -1203,7 +1208,7 @@ bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM
(void)argV; (void)argV;
(void)argC; (void)argC;
HU_DoTitlecardCEcho(thread->printBuf.data()); HU_DoTitlecardCEcho(nullptr, thread->printBuf.data(), true);
thread->printBuf.drop(); thread->printBuf.drop();
return false; return false;

View file

@ -777,15 +777,17 @@ static void COM_CEcho_f(void)
size_t i; size_t i;
char cechotext[1024] = ""; char cechotext[1024] = "";
for (i = 1; i < COM_Argc(); i++) strncpy(cechotext, COM_Argv(1), sizeof(cechotext)-1);
for (i = 2; i < COM_Argc(); i++)
{ {
strncat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
strncat(cechotext, " ", sizeof(cechotext)-1); strncat(cechotext, " ", sizeof(cechotext)-1);
strncat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
} }
cechotext[sizeof(cechotext) - 1] = '\0'; cechotext[sizeof(cechotext) - 1] = '\0';
HU_DoCEcho(cechotext); HU_DoTitlecardCEcho(NULL, cechotext, true);
} }
/** Sets drawing flags for the CECHO command. /** Sets drawing flags for the CECHO command.

View file

@ -786,7 +786,7 @@ consvar_t cv_kartdebughuddrop = OnlineCheat("debugitemdrop", "Off").on_off().des
extern CV_PossibleValue_t kartdebugitem_cons_t[]; extern CV_PossibleValue_t kartdebugitem_cons_t[];
consvar_t cv_kartdebugitem = OnlineCheat("debugitem", "None").values(kartdebugitem_cons_t).description("Force item boxes to only roll one kind of item"); consvar_t cv_kartdebugitem = OnlineCheat("debugitem", "None").values(kartdebugitem_cons_t).description("Force item boxes to only roll one kind of item");
consvar_t cv_kartdebugstart = OnlineCheat("debugstart", "Off").on_off().description("Skip POSITION"); consvar_t cv_kartdebugstart = OnlineCheat("debugstart", "-1").min_max(-1, 16).description("Override playercount for POSITION time calcs. -1 default, 0 skip");
consvar_t cv_kartdebugwaypoints = OnlineCheat("debugwaypoints", "Off").values({{0, "Off"}, {1, "Forwards"}, {2, "Backwards"}}).description("Make waypoints visible"); consvar_t cv_kartdebugwaypoints = OnlineCheat("debugwaypoints", "Off").values({{0, "Off"}, {1, "Forwards"}, {2, "Backwards"}}).description("Make waypoints visible");
#ifdef DEVELOP #ifdef DEVELOP

View file

@ -187,6 +187,8 @@ static void Command_Automate_Set(void);
static void Command_Eval(void); static void Command_Eval(void);
static void Command_WriteTextmap(void);
// ========================================================================= // =========================================================================
// CLIENT VARIABLES // CLIENT VARIABLES
// ========================================================================= // =========================================================================
@ -426,6 +428,8 @@ void D_RegisterServerCommands(void)
COM_AddCommand("eval", Command_Eval); COM_AddCommand("eval", Command_Eval);
COM_AddCommand("writetextmap", Command_WriteTextmap);
// for master server connection // for master server connection
AddMServCommands(); AddMServCommands();
@ -6121,6 +6125,75 @@ static void Command_Eval(void)
} }
} }
static void Command_WriteTextmap(void)
{
if (COM_Argc() < 2)
{
CONS_Printf(
"writetextmap <map> [map2...]: Update a map to the latest UDMF version.\n"
"- Use the full map name, e.g. RR_TestRun.\n"
"- You can give this command UP TO %d map names and it will convert all of them.\n"
"- This command generates TEXTMAP files.\n"
"- The location of the generated TEXTMAPs will appear in the console.\n",
ROUNDQUEUE_MAX
);
return;
}
if (Playing())
{
CONS_Alert(CONS_ERROR, "This command cannot be used in-game. Return to the titlescreen first!\n");
return;
}
if (COM_Argc() - 1 > ROUNDQUEUE_MAX)
{
CONS_Alert(CONS_ERROR, "Cannot convert more than %d maps. Try again.\n", ROUNDQUEUE_MAX);
return;
}
// Start up a "minor" grand prix session
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));
memset(&roundqueue, 0, sizeof(struct roundqueue));
grandprixinfo.gamespeed = KARTSPEED_NORMAL;
grandprixinfo.masterbots = false;
grandprixinfo.gp = true;
grandprixinfo.cup = NULL;
grandprixinfo.wonround = false;
grandprixinfo.initalize = true;
roundqueue.position = 1;
roundqueue.roundnum = 1;
roundqueue.writetextmap = true;
size_t i;
for (i = 1; i < COM_Argc(); ++i)
{
INT32 map = G_MapNumber(COM_Argv(i));
if (map < 0 || map >= nummapheaders)
{
CONS_Alert(CONS_WARNING, "%s: Map doesn't exist. Not doing anything.\n", COM_Argv(i));
// clear round queue (to be safe)
memset(&roundqueue, 0, sizeof(struct roundqueue));
return;
}
INT32 gt = G_GuessGametypeByTOL(mapheaderinfo[map]->typeoflevel);
G_MapIntoRoundQueue(map, gt != -1 ? gt : GT_RACE, false, false);
}
D_MapChange(1 + roundqueue.entries[0].mapnum, roundqueue.entries[0].gametype, false, true, 1, false, false);
CON_ToggleOff();
}
/** Makes a change to ::cv_forceskin take effect immediately. /** Makes a change to ::cv_forceskin take effect immediately.
* *
* \sa Command_SetForcedSkin_f, cv_forceskin, forcedskin * \sa Command_SetForcedSkin_f, cv_forceskin, forcedskin

View file

@ -4252,7 +4252,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_SNEAKERPANEL", "S_SNEAKERPANEL",
"S_SNEAKERPANEL_SMALL", "S_SNEAKERPANEL_SMALL",
"S_SNEAKERPANEL_TINY", "S_SNEAKERPANEL_TINY",
"S_SNEAKERPANELSPAWNER",
// Various plants // Various plants
"S_SONICBUSH", "S_SONICBUSH",

View file

@ -1130,6 +1130,33 @@ void G_DoLoadLevelEx(boolean resetplayer, gamestate_t newstate)
Z_CheckHeap(-2); Z_CheckHeap(-2);
#endif #endif
if (roundqueue.writetextmap == true)
{
if (roundqueue.size > 0)
{
G_GetNextMap();
// roundqueue is wiped after the last round, but
// preserve this to track state into the Podium!
roundqueue.writetextmap = true;
G_NextLevel();
return;
}
else
{
// Podium: writetextmap is finished. Yay!
HU_DoTitlecardCEcho(NULL, va("Congratulations,\\%s!\\Check the console!", cv_playername[0].string), true);
livestudioaudience_timer = 0;
LiveStudioAudience();
CONS_Printf("\n\n\x83""writetextmap: Find your TEXTMAPs in %s\n", srb2home);
roundqueue.writetextmap = false;
}
}
for (i = 0; i <= r_splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (camera[i].chase) if (camera[i].chase)
@ -1249,6 +1276,10 @@ boolean G_IsTitleCardAvailable(void)
if (gametyperules & GTR_SPECIALSTART) if (gametyperules & GTR_SPECIALSTART)
return false; return false;
// ALso.
if (K_PodiumSequence() == true)
return false;
// The title card is available. // The title card is available.
return true; return true;
} }
@ -1899,6 +1930,7 @@ void G_Ticker(boolean run)
case GS_CEREMONY: case GS_CEREMONY:
P_Ticker(run); P_Ticker(run);
K_CeremonyTicker(run); K_CeremonyTicker(run);
HU_Ticker();
break; break;
case GS_WAITINGPLAYERS: case GS_WAITINGPLAYERS:

View file

@ -70,6 +70,7 @@ extern struct roundqueue
UINT8 position; // Head position in the round queue UINT8 position; // Head position in the round queue
UINT8 size; // Number of entries in the round queue UINT8 size; // Number of entries in the round queue
boolean netcommunicate; // As server, should we net-communicate this in XD_MAP? boolean netcommunicate; // As server, should we net-communicate this in XD_MAP?
boolean writetextmap; // This queue is for automated map conversion
roundentry_t entries[ROUNDQUEUE_MAX]; // Entries in the round queue roundentry_t entries[ROUNDQUEUE_MAX]; // Entries in the round queue
} roundqueue; } roundqueue;

View file

@ -62,6 +62,7 @@
#include "r_fps.h" #include "r_fps.h"
#include "d_clisrv.h" #include "d_clisrv.h"
#include "y_inter.h" // Y_PlayerStandingsDrawer #include "y_inter.h" // Y_PlayerStandingsDrawer
#include "g_party.h"
// coords are scaled // coords are scaled
#define HU_INPUTX 0 #define HU_INPUTX 0
@ -157,10 +158,15 @@ static tic_t cechotimer = 0;
static tic_t cechoduration = 5*TICRATE; static tic_t cechoduration = 5*TICRATE;
static INT32 cechoflags = 0; static INT32 cechoflags = 0;
static char tcechotext[1024]; // buffer for the titlecard text struct tcecho_state
static tic_t tcechotimer = 0; // goes up by 1 each frame this is active {
static tic_t tcechoduration = 0; // Set automatically char text[1024]; // buffer for the titlecard text
tic_t start; // gametic that the message started
tic_t duration; // Set automatically
};
#define NUM_TCECHO_STATES (1 + MAXSPLITSCREENPLAYERS)
static struct tcecho_state g_tcecho[NUM_TCECHO_STATES];
static tic_t resynch_ticker = 0; static tic_t resynch_ticker = 0;
@ -283,6 +289,12 @@ void HU_Init(void)
PR ("GTFN"); PR ("GTFN");
REG; REG;
PR ("4GTOL");
REG;
PR ("4GTFN");
REG;
DIG (1); DIG (1);
DIM (0, 10); DIM (0, 10);
@ -960,13 +972,6 @@ void HU_Ticker(void)
if (cechotimer) if (cechotimer)
cechotimer--; cechotimer--;
if (tcechotimer)
{
tcechotimer++;
if (tcechotimer > tcechoduration)
tcechotimer = 0;
}
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL)
{ {
@ -1829,12 +1834,31 @@ static void HU_DrawCEcho(void)
} }
} }
static void HU_DrawTitlecardCEcho(void) static tic_t HU_TitlecardCEchoElapsed(const struct tcecho_state *state)
{ {
if (tcechotimer) return max(gametic, state->start) - state->start;
}
static void HU_DrawTitlecardCEcho(size_t num)
{
const struct tcecho_state *state = &g_tcecho[num];
tic_t elapsed = HU_TitlecardCEchoElapsed(state);
UINT8 viewnum = max(1, num) - 1;
boolean p4 = (num != 0 && r_splitscreen);
// If the splitscreens were somehow decreased in the
// middle of drawing this, don't draw it.
if (viewnum > r_splitscreen)
{
return;
}
if (elapsed < state->duration)
{ {
INT32 i = 0; INT32 i = 0;
INT32 y = (BASEVIDHEIGHT/2)-16; INT32 x = BASEVIDWIDTH/2;
INT32 y = BASEVIDHEIGHT/2;
INT32 pnumlines = 0; INT32 pnumlines = 0;
INT32 timeroffset = 0; INT32 timeroffset = 0;
@ -1842,11 +1866,28 @@ static void HU_DrawTitlecardCEcho(void)
char *echoptr; char *echoptr;
char temp[1024]; char temp[1024];
for (i = 0; tcechotext[i] != '\0'; ++i) for (i = 0; state->text[i] != '\0'; ++i)
if (tcechotext[i] == '\\') if (state->text[i] == '\\')
pnumlines++; pnumlines++;
y -= (pnumlines-1)*16; if (p4)
{
if (r_splitscreen == 1) // 2P
{
y -= (1 - (viewnum * 2)) * (y / 2);
}
else // 3P / 4P
{
x -= (1 - ((viewnum % 2) * 2)) * (x / 2);
y -= (1 - ((viewnum / 2) * 2)) * (y / 2);
}
y -= 11 + ((pnumlines-1) * 9);
}
else
{
y -= 18 + ((pnumlines-1) * 16);
}
// Prevent crashing because I'm sick of this // Prevent crashing because I'm sick of this
if (y < 0) if (y < 0)
@ -1856,13 +1897,13 @@ static void HU_DrawTitlecardCEcho(void)
return; return;
} }
strcpy(temp, tcechotext); strcpy(temp, state->text);
echoptr = &temp[0]; echoptr = &temp[0];
while (*echoptr != '\0') while (*echoptr != '\0')
{ {
INT32 w; INT32 ofs;
INT32 timer = (INT32)(tcechotimer - timeroffset); INT32 timer = (INT32)(elapsed - timeroffset);
if (timer <= 0) if (timer <= 0)
return; // we don't care. return; // we don't care.
@ -1874,10 +1915,10 @@ static void HU_DrawTitlecardCEcho(void)
*line = '\0'; *line = '\0';
w = V_TitleCardStringWidth(echoptr); ofs = V_CenteredTitleCardStringOffset(echoptr, p4);
V_DrawTitleCardString(BASEVIDWIDTH/2 -w/2, y, echoptr, 0, false, timer, TICRATE*4); V_DrawTitleCardString(x - ofs, y, echoptr, 0, false, timer, TICRATE*4, p4);
y += 32; y += p4 ? 18 : 32;
// offset the timer for the next line. // offset the timer for the next line.
timeroffset += strlen(echoptr); timeroffset += strlen(echoptr);
@ -2037,9 +2078,23 @@ drawontop:
if (cechotimer) if (cechotimer)
HU_DrawCEcho(); HU_DrawCEcho();
if (tcechotimer) const struct tcecho_state *firststate = &g_tcecho[0];
HU_DrawTitlecardCEcho();
// Server messages overwrite player-specific messages
if (HU_TitlecardCEchoElapsed(firststate) < firststate->duration)
{
HU_DrawTitlecardCEcho(0);
}
else
{
size_t i;
for (i = 1; i < NUM_TCECHO_STATES; ++i)
{
HU_DrawTitlecardCEcho(i);
}
}
} }
//====================================================================== //======================================================================
@ -2576,17 +2631,41 @@ void HU_DoCEcho(const char *msg)
// No need to bother clearing the buffer or anything. // No need to bother clearing the buffer or anything.
void HU_ClearTitlecardCEcho(void) void HU_ClearTitlecardCEcho(void)
{ {
tcechotimer = 0; size_t i;
for (i = 0; i < NUM_TCECHO_STATES; ++i)
{
g_tcecho[i].duration = 0;
}
} }
// Similar but for titlecard CEcho and also way less convoluted because I have no clue whatever the fuck they were trying above. // Similar but for titlecard CEcho and also way less convoluted because I have no clue whatever the fuck they were trying above.
void HU_DoTitlecardCEcho(const char *msg) void HU_DoTitlecardCEcho(player_t *player, const char *msg, boolean interrupt)
{ {
if (player && !P_IsDisplayPlayer(player))
{
return;
}
struct tcecho_state *state = &g_tcecho[0];
if (player)
{
state = &g_tcecho[1 + G_PartyPosition(player - players)];
}
// If this message should not interrupt an existing
// message. Check if another message is already running.
if (!interrupt && HU_TitlecardCEchoElapsed(state) < state->duration)
{
return;
}
I_OutputMsg("%s\n", msg); // print to log I_OutputMsg("%s\n", msg); // print to log
strncpy(tcechotext, msg, sizeof(tcechotext)); strncpy(state->text, msg, sizeof(state->text));
strncat(tcechotext, "\\", sizeof(tcechotext) - strlen(tcechotext) - 1); strncat(state->text, "\\", sizeof(state->text) - strlen(state->text) - 1);
tcechotext[sizeof(tcechotext) - 1] = '\0'; state->text[sizeof(state->text) - 1] = '\0';
tcechotimer = 1; state->start = gametic;
tcechoduration = TICRATE*6 + strlen(tcechotext); state->duration = TICRATE*6 + strlen(state->text);
} }

View file

@ -77,6 +77,9 @@ enum
X (GTOL), X (GTOL),
X (GTFN), X (GTFN),
X (GTOL4),
X (GTFN4),
X (TALLNUM), X (TALLNUM),
X (NIGHTSNUM), X (NIGHTSNUM),
X (PINGNUM), X (PINGNUM),
@ -163,7 +166,7 @@ void HU_SetCEchoFlags(INT32 flags);
void HU_DoCEcho(const char *msg); void HU_DoCEcho(const char *msg);
// Titlecard CECHO shite // Titlecard CECHO shite
void HU_DoTitlecardCEcho(const char *msg); void HU_DoTitlecardCEcho(player_t *player, const char *msg, boolean interrupt);
void HU_ClearTitlecardCEcho(void); void HU_ClearTitlecardCEcho(void);
void DoSayCommand(char *message, SINT8 target, UINT8 flags, UINT8 source); void DoSayCommand(char *message, SINT8 target, UINT8 flags, UINT8 source);

View file

@ -4959,7 +4959,6 @@ state_t states[NUMSTATES] =
{SPR_BSTP, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL}, // S_SNEAKERPANEL {SPR_BSTP, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL}, // S_SNEAKERPANEL
{SPR_BSTS, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL_SMALL}, // S_SNEAKERPANEL_SMALL {SPR_BSTS, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL_SMALL}, // S_SNEAKERPANEL_SMALL
{SPR_BSTT, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL_TINY}, // S_SNEAKERPANEL_TINY {SPR_BSTT, FF_ANIMATE|FF_GLOBALANIM|FF_FLOORSPRITE|FF_FULLBRIGHT, -1, {NULL}, 5, 2, S_SNEAKERPANEL_TINY}, // S_SNEAKERPANEL_TINY
{SPR_NULL, 0, 65, {A_SpawnSneakerPanel}, 0, 0, S_SNEAKERPANELSPAWNER}, // S_SNEAKERPANELSPAWNER
// Various plants // Various plants
{SPR_SBUS, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SONICBUSH {SPR_SBUS, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SONICBUSH
@ -26747,11 +26746,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_SNEAKERPANELSPAWNER { // MT_SNEAKERPANELSPAWNER
511, // doomednum 511, // doomednum
S_SNEAKERPANELSPAWNER, // spawnstate S_INVISIBLE, // spawnstate
0, // spawnhealth 0, // spawnhealth
S_NULL, // seestate S_NULL, // seestate
sfx_None, // seesound sfx_None, // seesound
0, // reactiontime 65, // reactiontime
sfx_None, // attacksound sfx_None, // attacksound
S_NULL, // painstate S_NULL, // painstate
0, // painchance 0, // painchance
@ -26768,7 +26767,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // mass 0, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOGRAVITY|MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPTHING, // flags MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOCLIPTHING, // flags
S_NULL // raisestate S_NULL // raisestate
}, },

View file

@ -5406,7 +5406,6 @@ typedef enum state
S_SNEAKERPANEL, S_SNEAKERPANEL,
S_SNEAKERPANEL_SMALL, S_SNEAKERPANEL_SMALL,
S_SNEAKERPANEL_TINY, S_SNEAKERPANEL_TINY,
S_SNEAKERPANELSPAWNER,
// Various plants // Various plants
S_SONICBUSH, S_SONICBUSH,

View file

@ -4332,6 +4332,9 @@ static void K_drawKartFinish(boolean finish)
if (finish) if (finish)
{ {
if (gametyperules & GTR_SPECIALSTART)
return;
timer = stplyr->karthud[khud_finish]; timer = stplyr->karthud[khud_finish];
kptodraw = kp_racefinish; kptodraw = kp_racefinish;
minsplitstationary = 2; minsplitstationary = 2;

View file

@ -228,6 +228,9 @@ void K_TimerInit(void)
numPlayers++; numPlayers++;
} }
if (cv_kartdebugstart.value > 0)
numPlayers = cv_kartdebugstart.value;
if (numPlayers < 2) if (numPlayers < 2)
{ {
domodeattack = true; domodeattack = true;
@ -256,7 +259,7 @@ void K_TimerInit(void)
} }
} }
if (cv_kartdebugstart.value || M_NotFreePlay() == false) if (cv_kartdebugstart.value == -1 ? M_NotFreePlay() == false : cv_kartdebugstart.value == 0)
{ {
starttime = 0; starttime = 0;
introtime = 0; introtime = 0;
@ -3918,7 +3921,7 @@ void K_StumblePlayer(player_t *player)
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT); P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
// Reset slope. // Reset slope.
player->mo->pitch = player->mo->roll = 0; P_ResetPitchRoll(player->mo);
} }
boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, boolean fromAir) boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, boolean fromAir)
@ -3936,6 +3939,14 @@ boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, bool
return false; return false;
} }
if (fromAir && player->airtime < STUMBLE_AIRTIME
&& player->airtime > 1) // ACHTUNG HACK, sorry. Ground-to-ground transitions sometimes have 1-tic airtime because collision blows
{
// Short airtime with no reaction window, probably a track traversal setpiece.
// Don't punish for these.
return false;
}
if ((player->mo->pitch == oldPitch) if ((player->mo->pitch == oldPitch)
&& (player->mo->roll == oldRoll)) && (player->mo->roll == oldRoll))
{ {
@ -4099,6 +4110,9 @@ void K_UpdateStumbleIndicator(player_t *player)
mobj->renderflags &= ~RF_HORIZONTALFLIP; mobj->renderflags &= ~RF_HORIZONTALFLIP;
} }
if (air && player->airtime < STUMBLE_AIRTIME)
delta = 0;
steepRange = ANGLE_90 - steepVal; steepRange = ANGLE_90 - steepVal;
delta = max(0, abs(delta) - ((signed)steepVal)); delta = max(0, abs(delta) - ((signed)steepVal));
trans = ((FixedDiv(AngleFixed(delta), AngleFixed(steepRange)) * (NUMTRANSMAPS - 2)) + (FRACUNIT/2)) / FRACUNIT; trans = ((FixedDiv(AngleFixed(delta), AngleFixed(steepRange)) * (NUMTRANSMAPS - 2)) + (FRACUNIT/2)) / FRACUNIT;
@ -4249,7 +4263,7 @@ static void K_HandleTumbleBounce(player_t *player)
player->tumbleHeight = 10; player->tumbleHeight = 10;
player->pflags |= PF_TUMBLELASTBOUNCE; player->pflags |= PF_TUMBLELASTBOUNCE;
player->mo->rollangle = 0; // p_user.c will stop rotating the player automatically player->mo->rollangle = 0; // p_user.c will stop rotating the player automatically
player->mo->pitch = player->mo->roll = 0; // Prevent Kodachrome Void infinite P_ResetPitchRoll(player->mo); // Prevent Kodachrome Void infinite
} }
} }
@ -6142,6 +6156,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->player->trickboostpower = max(FixedDiv(mo->player->speed, K_GetKartSpeed(mo->player, false, false)) - FRACUNIT, 0)*125/100; mo->player->trickboostpower = max(FixedDiv(mo->player->speed, K_GetKartSpeed(mo->player, false, false)) - FRACUNIT, 0)*125/100;
mo->player->trickboostpower = FixedDiv(mo->player->trickboostpower, K_GrowShrinkSpeedMul(mo->player)); mo->player->trickboostpower = FixedDiv(mo->player->trickboostpower, K_GrowShrinkSpeedMul(mo->player));
//CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT); //CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT);
mo->player->fastfall = 0;
} }
mo->momz = FixedMul(thrust, mapobjectscale); mo->momz = FixedMul(thrust, mapobjectscale);
@ -6151,8 +6166,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT)); mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT));
} }
mo->pitch = 0; P_ResetPitchRoll(mo);
mo->roll = 0;
if (sound) if (sound)
{ {
@ -8252,7 +8266,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->incontrol = 0; player->incontrol = 0;
player->incontrol++; player->incontrol++;
} }
player->incontrol = min(player->incontrol, 5*TICRATE); player->incontrol = min(player->incontrol, 5*TICRATE);
player->incontrol = max(player->incontrol, -5*TICRATE); player->incontrol = max(player->incontrol, -5*TICRATE);
@ -9933,7 +9947,7 @@ void K_KartUpdatePosition(player_t *player)
realplayers > 1) realplayers > 1)
{ {
/* grace period so you don't fall off INSTANTLY */ /* grace period so you don't fall off INSTANTLY */
if (position == 1 && player->topinfirst < 2*TICRATE) if (K_GetItemRouletteDistance(player, 8) < 2000 && player->topinfirst < 2*TICRATE) // "Why 8?" Literally no reason, but since we intend for constant-ish distance we choose a fake fixed playercount.
{ {
player->topinfirst++; player->topinfirst++;
} }
@ -10029,9 +10043,10 @@ void K_StripOther(player_t *player)
static INT32 K_FlameShieldMax(player_t *player) static INT32 K_FlameShieldMax(player_t *player)
{ {
UINT32 disttofinish = 0; UINT32 disttofinish = 0;
UINT32 distv = 2048; UINT32 distv = 1024; // Pre no-scams: 2048
distv = distv * 16 / FLAMESHIELD_MAX; // Old distv was based on a 16-segment bar distv = distv * 16 / FLAMESHIELD_MAX; // Old distv was based on a 16-segment bar
UINT8 numplayers = 0; UINT8 numplayers = 0;
UINT32 scamradius = 2000; // How close is close enough that we shouldn't be allowed to scam 1st?
UINT8 i; UINT8 i;
if (gametyperules & GTR_CIRCUIT) if (gametyperules & GTR_CIRCUIT)
@ -10045,18 +10060,21 @@ static INT32 K_FlameShieldMax(player_t *player)
} }
} }
disttofinish = player->distancetofinish - disttofinish;
distv = FixedMul(distv, mapobjectscale);
if (numplayers <= 1) if (numplayers <= 1)
{ {
return FLAMESHIELD_MAX; // max when alone, for testing return FLAMESHIELD_MAX; // max when alone, for testing
// and when in battle, for chaos // and when in battle, for chaos
} }
else if (player->position == 1) else if (player->position == 1 || disttofinish < scamradius)
{ {
return 0; // minimum for first return 0; // minimum for first
} }
disttofinish = player->distancetofinish - disttofinish; disttofinish = disttofinish - scamradius;
distv = FixedMul(distv, mapobjectscale);
return min(FLAMESHIELD_MAX, (FLAMESHIELD_MAX / 16) + (disttofinish / distv)); // Ditto for this minimum, old value was 1/16 return min(FLAMESHIELD_MAX, (FLAMESHIELD_MAX / 16) + (disttofinish / distv)); // Ditto for this minimum, old value was 1/16
} }
@ -10433,16 +10451,18 @@ static void K_KartSpindash(player_t *player)
{ {
if (player->pflags & PF_NOFASTFALL) if (player->pflags & PF_NOFASTFALL)
return; return;
// Update fastfall.
player->fastfall = player->mo->momz;
player->spindash = 0;
if (player->fastfallBase == 0) if (player->fastfall == 0)
{ {
// Factors 3D momentum. // Factors 3D momentum.
player->fastfallBase = FixedHypot(player->speed, player->mo->momz); player->fastfallBase = FixedHypot(player->speed, player->mo->momz);
} }
// Update fastfall.
player->fastfall = player->mo->momz;
player->spindash = 0;
P_ResetPitchRoll(player->mo);
return; return;
} }
else if (player->fastfall != 0) else if (player->fastfall != 0)
@ -10541,8 +10561,11 @@ boolean K_FastFallBounce(player_t *player)
else else
{ {
// Lose speed on bad bounce. // Lose speed on bad bounce.
player->mo->momx /= 2; if (player->curshield != KSHIELD_BUBBLE)
player->mo->momy /= 2; {
player->mo->momx /= 2;
player->mo->momy /= 2;
}
if (bounce < minBounce) if (bounce < minBounce)
{ {
@ -10550,14 +10573,23 @@ boolean K_FastFallBounce(player_t *player)
} }
} }
if (player->curshield == KSHIELD_BUBBLE)
{
S_StartSound(player->mo, sfx_s3k44);
P_InstaThrust(player->mo, player->mo->angle, max(player->speed, abs(player->fastfall)));
bounce += 3 * player->mo->scale;
}
else
{
S_StartSound(player->mo, sfx_ffbonc);
}
if (player->mo->eflags & MFE_UNDERWATER) if (player->mo->eflags & MFE_UNDERWATER)
bounce = (117 * bounce) / 200; bounce = (117 * bounce) / 200;
S_StartSound(player->mo, sfx_ffbonc);
player->mo->momz = bounce * P_MobjFlip(player->mo); player->mo->momz = bounce * P_MobjFlip(player->mo);
player->fastfall = 0; player->fastfall = 0;
player->fastfallBase = 0;
return true; return true;
} }
@ -11421,6 +11453,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->bubbleblowup > bubbletime*2) if (player->bubbleblowup > bubbletime*2)
{ {
K_ThrowKartItem(player, (player->throwdir > 0), MT_BUBBLESHIELDTRAP, -1, 0, 0); K_ThrowKartItem(player, (player->throwdir > 0), MT_BUBBLESHIELDTRAP, -1, 0, 0);
P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale));
player->sliptideZipBoost += TICRATE; // Just for keeping speed briefly vs. tripwire etc.
// If this doesn't turn out to be reliable, I'll change it to directly set leniency or something.
K_PlayAttackTaunt(player->mo); K_PlayAttackTaunt(player->mo);
player->bubbleblowup = 0; player->bubbleblowup = 0;
player->bubblecool = 0; player->bubblecool = 0;

View file

@ -40,8 +40,10 @@ Make sure this matches the actual number of states
#define RR_PROJECTILE_FUSE (8*TICRATE) #define RR_PROJECTILE_FUSE (8*TICRATE)
#define STUMBLE_STEEP_VAL ANG60 // 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron
#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10) #define STUMBLE_STEEP_VAL (ANG60 + ANG20)
#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20)
#define STUMBLE_AIRTIME TICRATE
#define MAXRINGVOLUME 255 #define MAXRINGVOLUME 255
#define MINRINGVOLUME 100 #define MINRINGVOLUME 100

View file

@ -203,6 +203,9 @@ void Obj_SneakerPanelSpriteScale(mobj_t *mobj);
void Obj_SneakerPanelSpawn(mobj_t *mobj); void Obj_SneakerPanelSpawn(mobj_t *mobj);
void Obj_SneakerPanelSetup(mobj_t *mobj, mapthing_t *mthing); void Obj_SneakerPanelSetup(mobj_t *mobj, mapthing_t *mthing);
void Obj_SneakerPanelCollide(mobj_t *pad, mobj_t *mo); void Obj_SneakerPanelCollide(mobj_t *pad, mobj_t *mo);
void Obj_SneakerPanelSpawnerSpawn(mobj_t *mobj);
void Obj_SneakerPanelSpawnerSetup(mobj_t *mobj, mapthing_t *mthing);
void Obj_SneakerPanelSpawnerFuse(mobj_t *mobj);
/* Emerald */ /* Emerald */
void Obj_SpawnEmeraldSparks(mobj_t *source); void Obj_SpawnEmeraldSparks(mobj_t *source);

View file

@ -94,6 +94,21 @@ gp_rank_e K_PodiumGrade(void)
return podiumData.grade; return podiumData.grade;
} }
/*--------------------------------------------------
boolean K_PodiumHasEmerald(void)
See header file for description.
--------------------------------------------------*/
boolean K_PodiumHasEmerald(void)
{
if (K_PodiumSequence() == false)
{
return false;
}
return podiumData.rank.specialWon;
}
/*-------------------------------------------------- /*--------------------------------------------------
UINT8 K_GetPodiumPosition(player_t *player) UINT8 K_GetPodiumPosition(player_t *player)
@ -284,6 +299,7 @@ boolean K_StartCeremony(void)
G_SetGametype(GT_RACE); G_SetGametype(GT_RACE);
G_DoLoadLevelEx(false, GS_CEREMONY); G_DoLoadLevelEx(false, GS_CEREMONY);
wipegamestate = GS_CEREMONY; // I don't know what else to do here
r_splitscreen = 0; // Only one screen for the ceremony r_splitscreen = 0; // Only one screen for the ceremony
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();

View file

@ -69,6 +69,20 @@ boolean K_PodiumRanking(void);
gp_rank_e K_PodiumGrade(void); gp_rank_e K_PodiumGrade(void);
/*--------------------------------------------------
boolean K_PodiumHasEmerald(void)
Returns whether the Emerald or Prize was collected.
Input Arguments:-
N/A
Return:-
true if the Emerald/Prize was collected during the GP, otherwise false.
--------------------------------------------------*/
boolean K_PodiumHasEmerald(void);
/*-------------------------------------------------- /*--------------------------------------------------
UINT8 K_GetPodiumPosition(player_t *player); UINT8 K_GetPodiumPosition(player_t *player);

View file

@ -3515,9 +3515,12 @@ static int lib_getTimeMicros(lua_State *L)
static int lib_startTitlecardCecho(lua_State *L) static int lib_startTitlecardCecho(lua_State *L)
{ {
const char *str = luaL_checkstring(L, 1); player_t *player = lua_isnil(L, 1) ? NULL : *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
HU_DoTitlecardCEcho(str); const char *str = luaL_checkstring(L, 2);
boolean interrupt = lua_optboolean(L, 3);
HU_DoTitlecardCEcho(player, str, interrupt);
return 1; return 1;
} }

View file

@ -948,6 +948,7 @@ static int libd_drawTitleCardString(lua_State *L)
boolean rightalign = lua_optboolean(L, 5); boolean rightalign = lua_optboolean(L, 5);
INT32 timer = luaL_optinteger(L, 6, 0); INT32 timer = luaL_optinteger(L, 6, 0);
INT32 threshold = luaL_optinteger(L, 7, 0); INT32 threshold = luaL_optinteger(L, 7, 0);
boolean p4 = lua_optboolean(L, 8);
huddrawlist_h list; huddrawlist_h list;
flags &= ~V_PARAMMASK; // Don't let crashes happen. flags &= ~V_PARAMMASK; // Don't let crashes happen.
@ -958,9 +959,9 @@ static int libd_drawTitleCardString(lua_State *L)
lua_pop(L, 1); lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list)) if (LUA_HUD_IsDrawListValid(list))
LUA_HUD_AddDrawTitleCardString(list, x, y, flags, str, rightalign, timer, threshold); LUA_HUD_AddDrawTitleCardString(list, x, y, flags, str, rightalign, timer, threshold, p4);
else else
V_DrawTitleCardString(x, y, str, flags, rightalign, timer, threshold); V_DrawTitleCardString(x, y, str, flags, rightalign, timer, threshold, p4);
return 0; return 0;
} }
@ -989,9 +990,10 @@ static int libd_drawKartString(lua_State *L)
static int libd_titleCardStringWidth(lua_State *L) static int libd_titleCardStringWidth(lua_State *L)
{ {
const char *str = luaL_checkstring(L, 1); const char *str = luaL_checkstring(L, 1);
boolean p4 = lua_optboolean(L, 2);
HUDONLY HUDONLY
lua_pushinteger(L, V_TitleCardStringWidth(str)); lua_pushinteger(L, V_TitleCardStringWidth(str, p4));
return 1; return 1;
} }

View file

@ -61,6 +61,7 @@ typedef struct drawitem_s {
INT32 timer; INT32 timer;
INT32 threshold; INT32 threshold;
boolean bossmode; boolean bossmode;
boolean p4;
} drawitem_t; } drawitem_t;
// The internal structure of a drawlist. // The internal structure of a drawlist.
@ -358,7 +359,8 @@ void LUA_HUD_AddDrawTitleCardString(
const char *str, const char *str,
boolean bossmode, boolean bossmode,
INT32 timer, INT32 timer,
INT32 threshold INT32 threshold,
boolean p4
) )
{ {
size_t i = AllocateDrawItem(list); size_t i = AllocateDrawItem(list);
@ -371,6 +373,7 @@ void LUA_HUD_AddDrawTitleCardString(
item->bossmode = bossmode; item->bossmode = bossmode;
item->timer = timer; item->timer = timer;
item->threshold = threshold; item->threshold = threshold;
item->p4 = p4;
} }
void LUA_HUD_AddDrawKartString( void LUA_HUD_AddDrawKartString(
@ -465,7 +468,7 @@ void LUA_HUD_DrawList(huddrawlist_h list)
V_DrawFadeScreen(item->color, item->strength); V_DrawFadeScreen(item->color, item->strength);
break; break;
case DI_DrawTitleCardString: case DI_DrawTitleCardString:
V_DrawTitleCardString(item->x, item->y, itemstr, item->flags, item->bossmode, item->timer, item->threshold); V_DrawTitleCardString(item->x, item->y, itemstr, item->flags, item->bossmode, item->timer, item->threshold, item->p4);
break; break;
case DI_DrawKartString: case DI_DrawKartString:
V_DrawTimerString(item->x, item->y, item->flags, itemstr); V_DrawTimerString(item->x, item->y, item->flags, itemstr);

View file

@ -111,7 +111,8 @@ void LUA_HUD_AddDrawTitleCardString(
const char *str, const char *str,
boolean bossmode, boolean bossmode,
INT32 timer, INT32 timer,
INT32 threshold INT32 threshold,
boolean p4
); );
void LUA_HUD_AddDrawKartString( void LUA_HUD_AddDrawKartString(
huddrawlist_h list, huddrawlist_h list,

View file

@ -28,8 +28,10 @@ menuitem_t OPTIONS_VideoOGL[] =
{IT_STRING | IT_CVAR, "Texture Quality", "Texture depth. Higher values are recommended.", {IT_STRING | IT_CVAR, "Texture Quality", "Texture depth. Higher values are recommended.",
NULL, {.cvar = &cv_scr_depth}, 0, 0}, NULL, {.cvar = &cv_scr_depth}, 0, 0},
/*
{IT_STRING | IT_CVAR, "Texture Filter", "Texture Filter. Nearest is recommended.", {IT_STRING | IT_CVAR, "Texture Filter", "Texture Filter. Nearest is recommended.",
NULL, {.cvar = &cv_glfiltermode}, 0, 0}, NULL, {.cvar = &cv_glfiltermode}, 0, 0},
*/
{IT_STRING | IT_CVAR, "Anisotropic", "Lower values will improve performance at a minor quality loss.", {IT_STRING | IT_CVAR, "Anisotropic", "Lower values will improve performance at a minor quality loss.",
NULL, {.cvar = &cv_glanisotropicmode}, 0, 0}, NULL, {.cvar = &cv_glanisotropicmode}, 0, 0},

View file

@ -161,6 +161,7 @@ static void DashRingLaunch(player_t *player, mobj_t *ring)
player->dashRingPushTics = DASHRING_PUSH_TICS; player->dashRingPushTics = DASHRING_PUSH_TICS;
player->mo->rollangle = 0; player->mo->rollangle = 0;
P_ResetPitchRoll(player->mo);
player->flashing = 0; player->flashing = 0;
player->fastfall = 0; player->fastfall = 0;
K_TumbleInterrupt(player); K_TumbleInterrupt(player);

View file

@ -11,11 +11,6 @@ void Obj_SneakerPanelSpriteScale(mobj_t *mobj)
statenum_t newState; statenum_t newState;
fixed_t spriteScale; fixed_t spriteScale;
if (mobj->scale == mobj->movefactor)
return;
mobj->movefactor = mobj->scale;
if (mobj->scale > FRACUNIT >> 1) if (mobj->scale > FRACUNIT >> 1)
{ {
newState = S_SNEAKERPANEL; newState = S_SNEAKERPANEL;
@ -32,11 +27,8 @@ void Obj_SneakerPanelSpriteScale(mobj_t *mobj)
spriteScale = FRACUNIT << 2; spriteScale = FRACUNIT << 2;
} }
if (((statenum_t)(mobj->state - states)) != newState) P_SetMobjState(mobj, newState);
{ mobj->spritexscale = mobj->spriteyscale = spriteScale;
P_SetMobjState(mobj, newState);
mobj->spritexscale = mobj->spriteyscale = spriteScale;
}
} }
void Obj_SneakerPanelSpawn(mobj_t *mobj) void Obj_SneakerPanelSpawn(mobj_t *mobj)
@ -121,3 +113,23 @@ void Obj_SneakerPanelCollide(mobj_t *panel, mobj_t *mo)
K_DoSneaker(player, 0); K_DoSneaker(player, 0);
} }
void Obj_SneakerPanelSpawnerSpawn(mobj_t *mobj)
{
mobj->fuse = mobj->reactiontime;
}
void Obj_SneakerPanelSpawnerSetup(mobj_t *mobj, mapthing_t *mthing)
{
if (mthing->thing_args[0] != 0)
{
mobj->fuse = mobj->reactiontime = mthing->thing_args[0];
}
}
void Obj_SneakerPanelSpawnerFuse(mobj_t *mobj)
{
var1 = var2 = 0;
A_SpawnSneakerPanel(mobj);
mobj->fuse = mobj->reactiontime;
}

View file

@ -26,6 +26,7 @@
#include "../r_skins.h" #include "../r_skins.h"
#include "../k_hitlag.h" #include "../k_hitlag.h"
#include "../acs/interface.h" #include "../acs/interface.h"
#include "../hu_stuff.h"
#define UFO_BASE_SPEED (42 * FRACUNIT) // UFO's slowest speed. #define UFO_BASE_SPEED (42 * FRACUNIT) // UFO's slowest speed.
#define UFO_SPEEDUP (FRACUNIT >> 1) // Acceleration #define UFO_SPEEDUP (FRACUNIT >> 1) // Acceleration
@ -453,6 +454,8 @@ static void UFOMove(mobj_t *ufo)
// Disable player // Disable player
P_DoAllPlayersExit(PF_NOCONTEST, false); P_DoAllPlayersExit(PF_NOCONTEST, false);
HU_DoTitlecardCEcho(NULL, "TOO LATE...", false);
} }
if (pathfindsuccess == true) if (pathfindsuccess == true)

View file

@ -2075,7 +2075,12 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
return false; return false;
} }
if (specialstageinfo.valid == true || (modeattacking & ATTACKING_SPB)) if (specialstageinfo.valid == true)
{
HU_DoTitlecardCEcho(player, "FALL OUT!", false);
P_DoPlayerExit(player, PF_NOCONTEST);
}
else if (modeattacking & ATTACKING_SPB)
{ {
P_DoPlayerExit(player, PF_NOCONTEST); P_DoPlayerExit(player, PF_NOCONTEST);
} }
@ -2581,7 +2586,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->driftboost = player->strongdriftboost = 0; player->driftboost = player->strongdriftboost = 0;
player->gateBoost = 0; player->gateBoost = 0;
player->fastfall = 0; player->fastfall = 0;
player->fastfallBase = 0;
player->ringboost = 0; player->ringboost = 0;
player->glanceDir = 0; player->glanceDir = 0;
player->pflags &= ~PF_GAINAX; player->pflags &= ~PF_GAINAX;

View file

@ -569,6 +569,7 @@ void P_ExplodeMissile(mobj_t *mo);
void P_CheckGravity(mobj_t *mo, boolean affect); void P_CheckGravity(mobj_t *mo, boolean affect);
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope); void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw); void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw);
void P_ResetPitchRoll(mobj_t *mo);
fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale); fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale);
fixed_t P_GetMobjHead(const mobj_t *); fixed_t P_GetMobjHead(const mobj_t *);
fixed_t P_GetMobjFeet(const mobj_t *); fixed_t P_GetMobjFeet(const mobj_t *);

View file

@ -1333,7 +1333,7 @@ void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope)
} }
else else
{ {
mo->pitch = mo->roll = 0; P_ResetPitchRoll(mo);
} }
} }
@ -1348,6 +1348,15 @@ void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw)
mo->pitch = FixedMul(pitch, FINECOSINE (yaw)); mo->pitch = FixedMul(pitch, FINECOSINE (yaw));
} }
//
// P_ResetPitchRoll
//
void P_ResetPitchRoll(mobj_t *mo)
{
mo->pitch = 0;
mo->roll = 0;
}
#define STOPSPEED (FRACUNIT) #define STOPSPEED (FRACUNIT)
// //
@ -7191,7 +7200,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
} }
case MT_FLOATINGITEM: case MT_FLOATINGITEM:
{ {
mobj->pitch = mobj->roll = 0; P_ResetPitchRoll(mobj);
if (mobj->flags & MF_NOCLIPTHING) if (mobj->flags & MF_NOCLIPTHING)
{ {
if (P_CheckDeathPitCollide(mobj)) if (P_CheckDeathPitCollide(mobj))
@ -8138,7 +8147,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->extravalue1 += 1; mobj->extravalue1 += 1;
mobj->angle += ANG1*mobj->extravalue1; mobj->angle += ANG1*mobj->extravalue1;
mobj->scale = mobj->target->scale; P_SetScale(mobj, mobj->target->scale);
destx = mobj->target->x; destx = mobj->target->x;
desty = mobj->target->y; desty = mobj->target->y;
@ -9835,6 +9844,11 @@ static boolean P_FuseThink(mobj_t *mobj)
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return false; return false;
} }
case MT_SNEAKERPANELSPAWNER:
{
Obj_SneakerPanelSpawnerFuse(mobj);
break;
}
case MT_PLAYER: case MT_PLAYER:
break; // don't remove break; // don't remove
default: default:
@ -10982,6 +10996,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
case MT_SNEAKERPANEL: case MT_SNEAKERPANEL:
Obj_SneakerPanelSpawn(mobj); Obj_SneakerPanelSpawn(mobj);
break; break;
case MT_SNEAKERPANELSPAWNER:
Obj_SneakerPanelSpawnerSpawn(mobj);
break;
default: default:
break; break;
} }
@ -13587,6 +13604,11 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
Obj_SneakerPanelSetup(mobj, mthing); Obj_SneakerPanelSetup(mobj, mthing);
break; break;
} }
case MT_SNEAKERPANELSPAWNER:
{
Obj_SneakerPanelSpawnerSetup(mobj, mthing);
break;
}
default: default:
break; break;
} }

View file

@ -2092,22 +2092,22 @@ static void TextmapUnfixFlatOffsets(sector_t *sec)
{ {
if (sec->floorpic_angle) if (sec->floorpic_angle)
{ {
fixed_t pc = FINECOSINE(sec->floorpic_angle >> ANGLETOFINESHIFT); fixed_t pc = FINECOSINE(sec->floorpic_angle>>ANGLETOFINESHIFT);
fixed_t ps = FINESINE(sec->floorpic_angle >> ANGLETOFINESHIFT); fixed_t ps = -FINESINE (sec->floorpic_angle>>ANGLETOFINESHIFT);
fixed_t xoffs = sec->floor_xoffs; fixed_t xoffs = sec->floor_xoffs;
fixed_t yoffs = sec->floor_yoffs; fixed_t yoffs = sec->floor_yoffs;
sec->floor_xoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE); sec->floor_xoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE);
sec->floor_yoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE); sec->floor_yoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE);
} }
if (sec->ceilingpic_angle) if (sec->ceilingpic_angle)
{ {
fixed_t pc = FINECOSINE(sec->ceilingpic_angle >> ANGLETOFINESHIFT); fixed_t pc = FINECOSINE(sec->ceilingpic_angle>>ANGLETOFINESHIFT);
fixed_t ps = FINESINE(sec->ceilingpic_angle >> ANGLETOFINESHIFT); fixed_t ps = -FINESINE (sec->ceilingpic_angle>>ANGLETOFINESHIFT);
fixed_t xoffs = sec->ceiling_xoffs; fixed_t xoffs = sec->ceiling_xoffs;
fixed_t yoffs = sec->ceiling_yoffs; fixed_t yoffs = sec->ceiling_yoffs;
sec->ceiling_xoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE); sec->ceiling_xoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE);
sec->ceiling_yoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE); sec->ceiling_yoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE);
} }
} }
@ -2127,6 +2127,29 @@ static INT32 P_RGBAToColor(INT32 rgba)
return (r << 16) | (g << 8) | b; return (r << 16) | (g << 8) | b;
} }
static void TextmapWriteSlopeConstants(FILE *f, sector_t *sec)
{
if (sec->f_slope != NULL)
{
const pslope_t *slope = sec->f_slope;
fprintf(f, "floorplane_a = %f;\n", FIXED_TO_FLOAT(slope->constants[0]));
fprintf(f, "floorplane_b = %f;\n", FIXED_TO_FLOAT(slope->constants[1]));
fprintf(f, "floorplane_c = %f;\n", FIXED_TO_FLOAT(slope->constants[2]));
fprintf(f, "floorplane_d = %f;\n", FIXED_TO_FLOAT(slope->constants[3]));
}
if (sec->c_slope != NULL)
{
const pslope_t *slope = sec->c_slope;
fprintf(f, "ceilingplane_a = %f;\n", FIXED_TO_FLOAT(slope->constants[0]));
fprintf(f, "ceilingplane_b = %f;\n", FIXED_TO_FLOAT(slope->constants[1]));
fprintf(f, "ceilingplane_c = %f;\n", FIXED_TO_FLOAT(slope->constants[2]));
fprintf(f, "ceilingplane_d = %f;\n", FIXED_TO_FLOAT(slope->constants[3]));
}
}
typedef struct typedef struct
{ {
mapthing_t *teleport; mapthing_t *teleport;
@ -2134,10 +2157,15 @@ typedef struct
mapthing_t *angleanchor; mapthing_t *angleanchor;
} sectorspecialthings_t; } sectorspecialthings_t;
static boolean P_CanWriteTextmap(void)
{
return roundqueue.writetextmap == true && roundqueue.size > 0;
}
static FILE *P_OpenTextmap(const char *mode, const char *error) static FILE *P_OpenTextmap(const char *mode, const char *error)
{ {
FILE *f; FILE *f;
char *filepath = va(pandf, srb2home, "TEXTMAP"); char *filepath = va("%s" PATHSEP "TEXTMAP.%s.txt", srb2home, mapheaderinfo[gamemap-1]->lumpname);
f = fopen(filepath, mode); f = fopen(filepath, mode);
if (!f) if (!f)
@ -2187,7 +2215,7 @@ static void P_WriteTextmapThing(FILE *f, mapthing_t *wmapthings, size_t i, size_
fprintf(f, "thingarg%s = %d;\n", sizeu1(j), wmapthings[i].thing_args[j]); fprintf(f, "thingarg%s = %d;\n", sizeu1(j), wmapthings[i].thing_args[j]);
for (j = 0; j < NUM_MAPTHING_STRINGARGS; j++) for (j = 0; j < NUM_MAPTHING_STRINGARGS; j++)
if (mapthings[i].thing_stringargs[j]) if (mapthings[i].thing_stringargs[j])
fprintf(f, "stringthingarg%s = \"%s\";\n", sizeu1(j), mapthings[i].thing_stringargs[j]); fprintf(f, "thingstringarg%s = \"%s\";\n", sizeu1(j), mapthings[i].thing_stringargs[j]);
if (wmapthings[i].user.length > 0) if (wmapthings[i].user.length > 0)
{ {
for (j = 0; j < wmapthings[i].user.length; j++) for (j = 0; j < wmapthings[i].user.length; j++)
@ -2899,6 +2927,7 @@ static void P_WriteTextmap(void)
break; break;
} }
} }
TextmapWriteSlopeConstants(f, &wsectors[i]);
if (wsectors[i].action != 0) if (wsectors[i].action != 0)
fprintf(f, "action = %d;\n", wsectors[i].action); fprintf(f, "action = %d;\n", wsectors[i].action);
for (j = 0; j < NUM_SCRIPT_ARGS; j++) for (j = 0; j < NUM_SCRIPT_ARGS; j++)
@ -7439,7 +7468,7 @@ static boolean P_LoadMapFromFile(void)
if (!udmf) if (!udmf)
P_ConvertBinaryMap(); P_ConvertBinaryMap();
if (M_CheckParm("-writetextmap")) if (P_CanWriteTextmap())
P_WriteTextmap(); P_WriteTextmap();
// Copy relevant map data for NetArchive purposes. // Copy relevant map data for NetArchive purposes.
@ -8216,8 +8245,17 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
} }
if (gametyperules & GTR_SPECIALSTART) if (K_PodiumHasEmerald())
{ {
// Special Stage out
if (ranspecialwipe != 2)
S_StartSound(NULL, sfx_s3k6a);
levelfadecol = 0;
wipetype = wipe_encore_towhite;
}
else if (gametyperules & GTR_SPECIALSTART)
{
// Special Stage in
if (ranspecialwipe != 2) if (ranspecialwipe != 2)
S_StartSound(NULL, sfx_s3kaf); S_StartSound(NULL, sfx_s3kaf);
levelfadecol = 0; levelfadecol = 0;
@ -8225,6 +8263,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
else if (skipstats == 1) else if (skipstats == 1)
{ {
// MapWarp
if (ranspecialwipe != 2) if (ranspecialwipe != 2)
S_StartSound(NULL, sfx_s3k73); S_StartSound(NULL, sfx_s3k73);
levelfadecol = 0; levelfadecol = 0;
@ -8232,11 +8271,13 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
else if (encoremode) else if (encoremode)
{ {
// Encore
levelfadecol = 0; levelfadecol = 0;
wipetype = wipe_encore_towhite; wipetype = wipe_encore_towhite;
} }
else else
{ {
// Default
levelfadecol = 31; levelfadecol = 31;
} }
@ -8364,7 +8405,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// Backwards compatibility for non-UDMF maps // Backwards compatibility for non-UDMF maps
K_AdjustWaypointsParameters(); K_AdjustWaypointsParameters();
if (M_CheckParm("-writetextmap")) if (P_CanWriteTextmap())
P_WriteTextmapWaypoints(); P_WriteTextmapWaypoints();
} }

View file

@ -143,6 +143,8 @@ void P_ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector
{ {
vector3_t vec1, vec2; vector3_t vec1, vec2;
memset(slope->constants, 0, sizeof(slope->constants));
// Set origin. // Set origin.
FV3_Copy(&slope->o, &v1); FV3_Copy(&slope->o, &v1);
@ -204,6 +206,11 @@ static void ReconfigureViaConstants (pslope_t *slope, const fixed_t a, const fix
fixed_t o = 0; fixed_t o = 0;
vector3_t *normal = &slope->normal; vector3_t *normal = &slope->normal;
slope->constants[0] = a;
slope->constants[1] = b;
slope->constants[2] = c;
slope->constants[3] = d;
if (c) if (c)
o = abs(c) <= FRACUNIT ? -FixedMul(d, FixedDiv(FRACUNIT, c)) : -FixedDiv(d, c); o = abs(c) <= FRACUNIT ? -FixedMul(d, FixedDiv(FRACUNIT, c)) : -FixedDiv(d, c);

View file

@ -1987,7 +1987,15 @@ static void K_HandleLapIncrement(player_t *player)
player->starpostnum = 0; player->starpostnum = 0;
if (P_IsDisplayPlayer(player)) if (gametyperules & GTR_SPECIALSTART)
{
if (player->laps > numlaps)
{
// Warp out
S_StartSound(NULL, sfx_s3kb3);
}
}
else if (P_IsDisplayPlayer(player))
{ {
if (numlaps > 1 && player->laps == numlaps) // final lap if (numlaps > 1 && player->laps == numlaps) // final lap
S_StartSound(NULL, sfx_s3k68); S_StartSound(NULL, sfx_s3k68);
@ -2053,6 +2061,8 @@ static void K_HandleLapIncrement(player_t *player)
if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo))) if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo)))
{ {
applyflags |= PF_NOCONTEST; applyflags |= PF_NOCONTEST;
HU_DoTitlecardCEcho(player, "EMPTY\\HANDED?", false);
} }
} }

View file

@ -484,12 +484,10 @@ void P_ResetPlayer(player_t *player)
player->trickpanel = 0; player->trickpanel = 0;
player->glanceDir = 0; player->glanceDir = 0;
player->fastfall = 0; player->fastfall = 0;
player->fastfallBase = 0;
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false) if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
{ {
player->mo->pitch = 0; P_ResetPitchRoll(player->mo);
player->mo->roll = 0;
} }
} }
@ -1296,7 +1294,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
{ {
K_UpdateAllPlayerPositions(); K_UpdateAllPlayerPositions();
if (cv_kartvoices.value) if (cv_kartvoices.value && !(gametyperules & GTR_SPECIALSTART))
{ {
if (P_IsDisplayPlayer(player)) if (P_IsDisplayPlayer(player))
{ {
@ -1326,7 +1324,9 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
G_BeginLevelExit(); G_BeginLevelExit();
} }
if (grandprixinfo.gp == true && player->bot == false && losing == false) if (grandprixinfo.gp == true
&& (roundqueue.size && roundqueue.position < roundqueue.size) // Not the last map of GP
&& player->bot == false && losing == false)
{ {
const UINT8 lifethreshold = 20; const UINT8 lifethreshold = 20;
@ -1407,6 +1407,11 @@ void P_DoAllPlayersExit(pflags_t flags, boolean trygivelife)
// You've already finished, don't play again // You've already finished, don't play again
; ;
} }
else if (gametyperules & GTR_SPECIALSTART)
{
// Warp out
S_StartSound(NULL, sfx_s3kb3);
}
else if (musiccountdown == 0) else if (musiccountdown == 0)
{ {
// Other people finish // Other people finish

View file

@ -321,6 +321,9 @@ struct pslope_t
fixed_t lowz; fixed_t lowz;
fixed_t highz; fixed_t highz;
// The ABCD constants used to define this slope
fixed_t constants[4];
// Light offsets (see seg_t) // Light offsets (see seg_t)
SINT8 lightOffset; SINT8 lightOffset;
#ifdef HWRENDER #ifdef HWRENDER

View file

@ -1466,7 +1466,7 @@ static void copy_to_skin (struct ParseSpriteInfoState *parser, INT32 skinnum)
} }
} }
static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean all) static boolean R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean all)
{ {
char *sprinfoToken; char *sprinfoToken;
size_t sprinfoTokenLength; size_t sprinfoTokenLength;
@ -1487,12 +1487,15 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be"); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be\n");
return false;
} }
sprinfoTokenLength = strlen(sprinfoToken); sprinfoTokenLength = strlen(sprinfoToken);
if (sprinfoTokenLength != 1) if (sprinfoTokenLength != 1)
{ {
I_Error("Error parsing SPRTINFO lump: Invalid frame \"%s\"",sprinfoToken); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Invalid frame \"%s\"\n",sprinfoToken);
Z_Free(sprinfoToken);
return false;
} }
else else
frameChar = sprinfoToken; frameChar = sprinfoToken;
@ -1504,7 +1507,10 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
// Left Curly Brace // Left Curly Brace
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
I_Error("Error parsing SPRTINFO lump: Missing sprite info"); {
CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Missing sprite info\n");
return false;
}
else else
{ {
if (strcmp(sprinfoToken,"{")==0) if (strcmp(sprinfoToken,"{")==0)
@ -1513,7 +1519,8 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be"); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be\n");
return false;
} }
while (strcmp(sprinfoToken,"}")!=0) while (strcmp(sprinfoToken,"}")!=0)
{ {
@ -1550,7 +1557,8 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace should be"); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace should be\n");
return false;
} }
} }
} }
@ -1574,7 +1582,11 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
INT32 i; INT32 i;
if (!parser->foundskins) if (!parser->foundskins)
I_Error("Error parsing SPRTINFO lump: No skins specified in this sprite2 definition"); {
CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: No skins specified in this sprite2 definition\n");
Z_Free(bright);
return false;
}
if (parser->foundskins < 0) if (parser->foundskins < 0)
{ {
@ -1607,6 +1619,8 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
M_Memcpy(&spriteinfo[parser->sprnum], parser->info, sizeof(spriteinfo_t)); M_Memcpy(&spriteinfo[parser->sprnum], parser->info, sizeof(spriteinfo_t));
} }
} }
return true;
} }
// //
@ -1614,7 +1628,7 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
// //
// Parse a SPRTINFO lump. // Parse a SPRTINFO lump.
// //
static void R_ParseSpriteInfo(boolean spr2) static boolean R_ParseSpriteInfo(boolean spr2)
{ {
char *sprinfoToken; char *sprinfoToken;
size_t sprinfoTokenLength; size_t sprinfoTokenLength;
@ -1634,7 +1648,8 @@ static void R_ParseSpriteInfo(boolean spr2)
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be"); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be\n");
return false;
} }
if (!strcmp(sprinfoToken, "*")) // All sprites if (!strcmp(sprinfoToken, "*")) // All sprites
@ -1646,7 +1661,9 @@ static void R_ParseSpriteInfo(boolean spr2)
sprinfoTokenLength = strlen(sprinfoToken); sprinfoTokenLength = strlen(sprinfoToken);
if (sprinfoTokenLength != 4) if (sprinfoTokenLength != 4)
{ {
I_Error("Error parsing SPRTINFO lump: Sprite name \"%s\" isn't 4 characters long",sprinfoToken); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Sprite name \"%s\" isn't 4 characters long\n",sprinfoToken);
Z_Free(sprinfoToken);
return false;
} }
else else
{ {
@ -1666,7 +1683,10 @@ static void R_ParseSpriteInfo(boolean spr2)
for (i = 0; i <= NUMSPRITES; i++) for (i = 0; i <= NUMSPRITES; i++)
{ {
if (i == NUMSPRITES) if (i == NUMSPRITES)
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName); {
CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unknown sprite name \"%s\"\n", newSpriteName);
return false;
}
if (!memcmp(newSpriteName,sprnames[i],4)) if (!memcmp(newSpriteName,sprnames[i],4))
{ {
parser.sprnum = i; parser.sprnum = i;
@ -1679,7 +1699,10 @@ static void R_ParseSpriteInfo(boolean spr2)
for (i = 0; i <= NUMPLAYERSPRITES; i++) for (i = 0; i <= NUMPLAYERSPRITES; i++)
{ {
if (i == NUMPLAYERSPRITES) if (i == NUMPLAYERSPRITES)
I_Error("Error parsing SPRTINFO lump: Unknown sprite2 name \"%s\"", newSpriteName); {
CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unknown sprite2 name \"%s\"\n", newSpriteName);
return false;
}
if (!memcmp(newSpriteName,spr2names[i],4)) if (!memcmp(newSpriteName,spr2names[i],4))
{ {
parser.spr2num = i; parser.spr2num = i;
@ -1695,22 +1718,33 @@ static void R_ParseSpriteInfo(boolean spr2)
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be",newSpriteName); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be\n",newSpriteName);
Z_Free(parser.info);
return false;
} }
boolean error = false;
if (strcmp(sprinfoToken,"{")==0) if (strcmp(sprinfoToken,"{")==0)
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be",newSpriteName); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be\n",newSpriteName);
Z_Free(parser.info);
return false;
} }
while (strcmp(sprinfoToken,"}")!=0) while (strcmp(sprinfoToken,"}")!=0)
{ {
if (stricmp(sprinfoToken, "SKIN")==0) if (stricmp(sprinfoToken, "SKIN")==0)
{ {
if (!spr2) if (!spr2)
I_Error("Error parsing SPRTINFO lump: \"SKIN\" token found outside of a sprite2 definition"); {
CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: \"SKIN\" token found outside of a sprite2 definition\n");
error = true;
break;
}
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
R_ParseSpriteInfoSkin(&parser); R_ParseSpriteInfoSkin(&parser);
@ -1718,31 +1752,46 @@ static void R_ParseSpriteInfo(boolean spr2)
else if (stricmp(sprinfoToken, "FRAME")==0) else if (stricmp(sprinfoToken, "FRAME")==0)
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
R_ParseSpriteInfoFrame(&parser, PARSER_FRAME); if (!R_ParseSpriteInfoFrame(&parser, PARSER_FRAME))
{
error = true;
break;
}
} }
else if (stricmp(sprinfoToken, "DEFAULT")==0) else if (stricmp(sprinfoToken, "DEFAULT")==0)
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
R_ParseSpriteInfoFrame(&parser, PARSER_DEFAULT); if (!R_ParseSpriteInfoFrame(&parser, PARSER_DEFAULT))
{
error = true;
break;
}
} }
else else
{ {
I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\" in sprite %s",sprinfoToken,newSpriteName); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unknown keyword \"%s\" in sprite %s\n",sprinfoToken,newSpriteName);
error = true;
break;
} }
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace for sprite \"%s\" should be",newSpriteName); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unexpected end of file where sprite info or right curly brace for sprite \"%s\" should be\n",newSpriteName);
error = true;
break;
} }
} }
} }
else else
{ {
I_Error("Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"",newSpriteName,sprinfoToken); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"\n",newSpriteName,sprinfoToken);
error = true;
} }
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
Z_Free(parser.info); Z_Free(parser.info);
return !error;
} }
// //
@ -1777,13 +1826,20 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum)
sprinfoToken = M_GetToken(sprinfoText); sprinfoToken = M_GetToken(sprinfoText);
while (sprinfoToken != NULL) while (sprinfoToken != NULL)
{ {
boolean error = true;
if (!stricmp(sprinfoToken, "SPRITE")) if (!stricmp(sprinfoToken, "SPRITE"))
R_ParseSpriteInfo(false); error = !R_ParseSpriteInfo(false);
else if (!stricmp(sprinfoToken, "SPRITE2")) else if (!stricmp(sprinfoToken, "SPRITE2"))
R_ParseSpriteInfo(true); error = !R_ParseSpriteInfo(true);
else else
I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\"", sprinfoToken); CONS_Alert(CONS_WARNING, "Error parsing SPRTINFO lump: Unknown keyword \"%s\"\n", sprinfoToken);
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
if (error)
break;
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
} }
Z_Free((void *)sprinfoText); Z_Free((void *)sprinfoText);

View file

@ -943,10 +943,10 @@ void ST_drawTitleCard(void)
// Everything else... // Everything else...
if (bossinfo.enemyname) if (bossinfo.enemyname)
{ {
bx = V_TitleCardStringWidth(bossinfo.enemyname); bx = V_TitleCardStringWidth(bossinfo.enemyname, false);
// Name. // Name.
V_DrawTitleCardString((BASEVIDWIDTH - bx)/2, 75, bossinfo.enemyname, 0, true, bossinfo.titleshow, lt_exitticker); V_DrawTitleCardString((BASEVIDWIDTH - bx)/2, 75, bossinfo.enemyname, 0, true, bossinfo.titleshow, lt_exitticker, false);
// Under-bar. // Under-bar.
{ {
@ -1067,10 +1067,10 @@ void ST_drawTitleCard(void)
V_DrawFixedPatch(eggx2*FRACUNIT, eggy2*FRACUNIT, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, tccirclebottom, NULL); V_DrawFixedPatch(eggx2*FRACUNIT, eggy2*FRACUNIT, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, tccirclebottom, NULL);
// Now the level name. // Now the level name.
V_DrawTitleCardString((actnum) ? 265 : 280, 60, lvlttl, V_SNAPTORIGHT, false, lt_ticker, TTANIMENDTHRESHOLD); V_DrawTitleCardString((actnum) ? 265 : 280, 60, lvlttl, V_SNAPTORIGHT, false, lt_ticker, TTANIMENDTHRESHOLD, false);
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
V_DrawTitleCardString((actnum) ? 265 : 280, 60+32, strlen(zonttl) ? zonttl : "ZONE", V_SNAPTORIGHT, false, lt_ticker - strlen(lvlttl), TTANIMENDTHRESHOLD); V_DrawTitleCardString((actnum) ? 265 : 280, 60+32, strlen(zonttl) ? zonttl : "ZONE", V_SNAPTORIGHT, false, lt_ticker - strlen(lvlttl), TTANIMENDTHRESHOLD, false);
// the act has a similar graphic animation, but we'll handle it here since it's only like 2 graphics lmfao. // the act has a similar graphic animation, but we'll handle it here since it's only like 2 graphics lmfao.
if (actnum && actnum < 10) if (actnum && actnum < 10)

View file

@ -1852,50 +1852,155 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercase, UINT8 *co
); );
} }
// V_TitleCardStringWidth template <bool Centered>
// Get the string's width using the titlecard font. static INT32 Internal_TitleCardStringOffset(const char *str, boolean p4)
INT32 V_TitleCardStringWidth(const char *str)
{ {
int bg_font = GTOL_FONT;
int fg_font = GTFN_FONT;
if (p4)
{
bg_font = GTOL4_FONT;
fg_font = GTFN4_FONT;
}
INT32 xoffs = 0; INT32 xoffs = 0;
const char *ch = str; const char *ch = str;
char c; char c;
patch_t *pp; patch_t *pp;
for (;;ch++) // Returns true if it reached the end, false if interrupted.
auto scan = [&](auto keep_going)
{ {
if (!*ch) for (;;ch++)
break;
if (*ch == '\n')
{ {
xoffs = 0; if (*ch == '\n')
continue; {
xoffs = 0;
return false;
}
if (!keep_going(*ch))
{
break;
}
c = *ch;
c = toupper(c);
c -= LT_FONTSTART;
// check if character exists, if not, it's a space.
if (c < 0 || c >= LT_FONTSIZE || !fontv[bg_font].font[(INT32)c])
{
xoffs += p4 ? 5 : 10;
continue;
}
pp = fontv[fg_font].font[(INT32)c];
xoffs += pp->width - (p4 ? 3 : 5);
} }
c = *ch; return true;
c = toupper(c); };
c -= LT_FONTSTART;
// check if character exists, if not, it's a space. do
if (c < 0 || c >= LT_FONTSIZE || !fontv[GTOL_FONT].font[(INT32)c]) {
// For the sake of centering, don't count spaces or
// punctuation at each end of a line.
// TODO: This should ideally be more sophisticated:
// - Check patch width directly for monospace or
// punctuation that isn't necessarily thin.
// - Apply to all centered string drawing.
if constexpr (Centered)
{ {
xoffs += 10; // Count leading fluff
continue; if (!scan([](int c) { return c && !isalnum(c); }))
{
continue;
}
if (!*ch)
{
// ALL fluff, so center it normally.
break;
}
// xoffs gets halved later, which centers the
// string. If we don't want leading fluff to push
// everything to the right, its full width needs
// to be subtracted, so it's doubled here to
// cancel out the division.
xoffs *= 2;
INT32 trim = -1;
bool reached_end = scan(
[&trim, &xoffs](int c)
{
if (isalnum(c))
{
trim = -1;
}
else if (trim < 0)
{
trim = xoffs;
}
return c;
}
);
// Discount trailing fluff
if (reached_end && trim >= 0)
{
xoffs = trim;
}
}
else
{
scan([](int c) { return c; });
} }
pp = fontv[GTFN_FONT].font[(INT32)c];
xoffs += pp->width-5;
} }
while (*(ch++));
return xoffs; if constexpr (Centered)
{
return xoffs / 2;
}
else
{
return xoffs;
}
}
// V_TitleCardStringWidth
// Get the string's width using the titlecard font.
INT32 V_TitleCardStringWidth(const char *str, boolean p4)
{
return Internal_TitleCardStringOffset<false>(str, p4);
}
// V_CenteredTitleCardStringOffset
// Subtract this offset from an X coordinate to center the string around that point.
INT32 V_CenteredTitleCardStringOffset(const char *str, boolean p4)
{
return Internal_TitleCardStringOffset<true>(str, p4);
} }
// V_DrawTitleCardScreen. // V_DrawTitleCardScreen.
// see v_video.h's prototype for more information. // see v_video.h's prototype for more information.
// //
void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boolean bossmode, INT32 timer, INT32 threshold) void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boolean bossmode, INT32 timer, INT32 threshold, boolean p4)
{ {
int bg_font = GTOL_FONT;
int fg_font = GTFN_FONT;
if (p4)
{
bg_font = GTOL4_FONT;
fg_font = GTFN4_FONT;
}
INT32 xoffs = 0; INT32 xoffs = 0;
INT32 yoffs = 0; INT32 yoffs = 0;
@ -1916,7 +2021,7 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole
x -= 2; // Account for patch width... x -= 2; // Account for patch width...
if (flags & V_SNAPTORIGHT) if (flags & V_SNAPTORIGHT)
x -= V_TitleCardStringWidth(str); x -= V_TitleCardStringWidth(str, p4);
for (;;ch++, i++) for (;;ch++, i++)
@ -1933,7 +2038,7 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole
if (*ch == '\n') if (*ch == '\n')
{ {
xoffs = x; xoffs = x;
yoffs += 32; yoffs += p4 ? 18 : 32;
continue; continue;
} }
@ -1944,14 +2049,14 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole
c -= LT_FONTSTART; c -= LT_FONTSTART;
// check if character exists, if not, it's a space. // check if character exists, if not, it's a space.
if (c < 0 || c >= LT_FONTSIZE || !fontv[GTFN_FONT].font[(INT32)c]) if (c < 0 || c >= LT_FONTSIZE || !fontv[fg_font].font[(INT32)c])
{ {
xoffs += 10; xoffs += p4 ? 5 : 10;
continue; continue;
} }
ol = fontv[GTOL_FONT].font[(INT32)c]; ol = fontv[bg_font].font[(INT32)c];
pp = fontv[GTFN_FONT].font[(INT32)c]; pp = fontv[fg_font].font[(INT32)c];
if (bossmode) if (bossmode)
{ {
@ -2004,7 +2109,7 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole
V_DrawStretchyFixedPatch((x + xoffs)*FRACUNIT + offs, (y+yoffs)*FRACUNIT, abs(scalex), FRACUNIT, flags|flipflag, pp, NULL); V_DrawStretchyFixedPatch((x + xoffs)*FRACUNIT + offs, (y+yoffs)*FRACUNIT, abs(scalex), FRACUNIT, flags|flipflag, pp, NULL);
} }
xoffs += pp->width -5; xoffs += pp->width - (p4 ? 3 : 5);
} }
} }

View file

@ -347,10 +347,13 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con
// threshold: when the letters start disappearing (leave to 0 to disable) (both are INT32 in case you supply negative values...) // threshold: when the letters start disappearing (leave to 0 to disable) (both are INT32 in case you supply negative values...)
// NOTE: This function ignores most conventional string flags (V_RETURN8, V_FORCEUPPERCASE ...) // NOTE: This function ignores most conventional string flags (V_RETURN8, V_FORCEUPPERCASE ...)
// NOTE: This font only works with uppercase letters. // NOTE: This font only works with uppercase letters.
void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boolean bossmode, INT32 timer, INT32 threshold); void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boolean bossmode, INT32 timer, INT32 threshold, boolean p4);
// returns thr width of a string drawn using the above function. // returns thr width of a string drawn using the above function.
INT32 V_TitleCardStringWidth(const char *str); INT32 V_TitleCardStringWidth(const char *str, boolean p4);
// offset that can be subtracted to center align.
INT32 V_CenteredTitleCardStringOffset(const char *str, boolean p4);
// Draw tall nums, used for menu, HUD, intermission // Draw tall nums, used for menu, HUD, intermission
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num); void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);

View file

@ -1462,7 +1462,7 @@ void Y_IntermissionDrawer(void)
} }
else else
{ {
headerwidth = V_TitleCardStringWidth(data.headerstring); headerwidth = V_TitleCardStringWidth(data.headerstring, false);
headerx = (BASEVIDWIDTH - headerwidth)/2; headerx = (BASEVIDWIDTH - headerwidth)/2;
headery = 17; headery = 17;
@ -1490,7 +1490,7 @@ void Y_IntermissionDrawer(void)
V_DrawMappedPatch(x + roundx, 39, 0, roundpatch, NULL); V_DrawMappedPatch(x + roundx, 39, 0, roundpatch, NULL);
} }
V_DrawTitleCardString(x + headerx, headery, data.headerstring, 0, false, 0, 0); V_DrawTitleCardString(x + headerx, headery, data.headerstring, 0, false, 0, 0, false);
} }
// Returns early if there's no players to draw // Returns early if there's no players to draw