mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Merge branch 'fruits-clipper' into 'next'
NiGHTS text improvements Closes #1121 See merge request STJr/SRB2!2165
This commit is contained in:
commit
1b060d2b34
5 changed files with 64 additions and 34 deletions
|
@ -373,6 +373,16 @@ typedef enum
|
|||
AI_SPINFOLLOW
|
||||
} aistatetype_t;
|
||||
|
||||
// NiGHTS text
|
||||
typedef enum
|
||||
{
|
||||
NTV_NONE = 0,
|
||||
NTV_GETSPHERES,
|
||||
NTV_GETMORESPHERES,
|
||||
NTV_BONUSTIMESTART,
|
||||
NTV_BONUSTIMEEND,
|
||||
} nightstextvar_t;
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// PLAYER STRUCTURE
|
||||
|
@ -572,7 +582,8 @@ typedef struct player_s
|
|||
// Statistical purposes.
|
||||
tic_t marebegunat; // Leveltime when mare begun
|
||||
tic_t startedtime; // Time which you started this mare with.
|
||||
tic_t finishedtime; // Time it took you to finish the mare (used for display)
|
||||
tic_t finishedtime; // The time it took to destroy the capsule on this mare (used for bonus time display)
|
||||
tic_t lastmaretime; // The time it took to complete the last mare (used for rank display)
|
||||
tic_t lapbegunat; // Leveltime when lap begun
|
||||
tic_t lapstartedtime; // Time which you started this lap with.
|
||||
INT16 finishedspheres; // The spheres you had left upon finishing the mare
|
||||
|
@ -587,7 +598,7 @@ typedef struct player_s
|
|||
UINT8 totalmarebonuslap; // total mare bonus lap
|
||||
INT32 maxlink; // maximum link obtained
|
||||
UINT8 texttimer; // nights_texttime should not be local
|
||||
UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks
|
||||
UINT8 textvar; // which line of NiGHTS text to show -- see nightstextvar_t
|
||||
|
||||
INT16 lastsidehit, lastlinehit;
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ enum player_e
|
|||
player_marelap,
|
||||
player_marebonuslap,
|
||||
player_marebegunat,
|
||||
player_lastmaretime,
|
||||
player_startedtime,
|
||||
player_finishedtime,
|
||||
player_lapbegunat,
|
||||
|
@ -337,6 +338,7 @@ static const char *const player_opt[] = {
|
|||
"marelap",
|
||||
"marebonuslap",
|
||||
"marebegunat",
|
||||
"lastmaretime",
|
||||
"startedtime",
|
||||
"finishedtime",
|
||||
"lapbegunat",
|
||||
|
@ -725,6 +727,9 @@ static int player_get(lua_State *L)
|
|||
case player_marebegunat:
|
||||
lua_pushinteger(L, plr->marebegunat);
|
||||
break;
|
||||
case player_lastmaretime:
|
||||
lua_pushinteger(L, plr->lastmaretime);
|
||||
break;
|
||||
case player_startedtime:
|
||||
lua_pushinteger(L, plr->startedtime);
|
||||
break;
|
||||
|
@ -1219,6 +1224,9 @@ static int player_set(lua_State *L)
|
|||
case player_marebegunat:
|
||||
plr->marebegunat = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case player_lastmaretime:
|
||||
plr->lastmaretime = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case player_startedtime:
|
||||
plr->startedtime = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
|
|
|
@ -261,6 +261,7 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT8(save_p, players[i].marelap);
|
||||
WRITEUINT8(save_p, players[i].marebonuslap);
|
||||
WRITEUINT32(save_p, players[i].marebegunat);
|
||||
WRITEUINT32(save_p, players[i].lastmaretime);
|
||||
WRITEUINT32(save_p, players[i].startedtime);
|
||||
WRITEUINT32(save_p, players[i].finishedtime);
|
||||
WRITEUINT32(save_p, players[i].lapbegunat);
|
||||
|
@ -492,6 +493,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].marelap = READUINT8(save_p);
|
||||
players[i].marebonuslap = READUINT8(save_p);
|
||||
players[i].marebegunat = READUINT32(save_p);
|
||||
players[i].lastmaretime = READUINT32(save_p);
|
||||
players[i].startedtime = READUINT32(save_p);
|
||||
players[i].finishedtime = READUINT32(save_p);
|
||||
players[i].lapbegunat = READUINT32(save_p);
|
||||
|
|
28
src/p_user.c
28
src/p_user.c
|
@ -872,7 +872,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
continue;
|
||||
|
||||
players[i].texttimer = (3 * TICRATE) - 10;
|
||||
players[i].textvar = 4; // Score and grades
|
||||
players[i].textvar = NTV_BONUSTIMEEND; // Score and grades
|
||||
players[i].lastmare = players[i].mare;
|
||||
players[i].lastmarelap = players[i].marelap;
|
||||
players[i].lastmarebonuslap = players[i].marebonuslap;
|
||||
|
@ -890,7 +890,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
|
||||
// Add score to leaderboards now
|
||||
G_AddTempNightsRecords(player, players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);
|
||||
player->lastmaretime = leveltime - player->marebegunat;
|
||||
G_AddTempNightsRecords(player, players[i].marescore, player->lastmaretime, players[i].mare + 1);
|
||||
|
||||
// transfer scores anyway
|
||||
players[i].totalmarescore += players[i].marescore;
|
||||
|
@ -911,12 +912,13 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
player->lastmarelap = oldmarelap;
|
||||
player->lastmarebonuslap = oldmarebonuslap;
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 4; // Score and grades
|
||||
player->textvar = NTV_BONUSTIMEEND; // Score and grades
|
||||
player->finishedspheres = (INT16)(player->spheres);
|
||||
player->finishedrings = (INT16)(player->rings);
|
||||
|
||||
|
||||
// Add score to temp leaderboards
|
||||
G_AddTempNightsRecords(player, player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));
|
||||
player->lastmaretime = leveltime - player->marebegunat;
|
||||
G_AddTempNightsRecords(player, player->marescore, player->lastmaretime, (UINT8)(oldmare + 1));
|
||||
|
||||
// Starting a new mare, transfer scores
|
||||
player->totalmarescore += player->marescore;
|
||||
|
@ -929,7 +931,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->textvar = 5; // Nothing, just tells it to go to the GET n RINGS/SPHERES text in a bit
|
||||
player->textvar = NTV_NONE; // Nothing, just tells it to go to the GET n RINGS/SPHERES text in a bit
|
||||
player->texttimer = 40;
|
||||
|
||||
// Don't show before title card
|
||||
|
@ -7010,7 +7012,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
{
|
||||
players[i].bonustime = true;
|
||||
players[i].texttimer = 4*TICRATE;
|
||||
players[i].textvar = 1; // Time Bonus
|
||||
players[i].textvar = NTV_BONUSTIMESTART; // Time Bonus
|
||||
players[i].finishedtime = players[i].nightstime;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
P_AddPlayerScore(&players[i], (players[i].finishedtime/TICRATE) * 100);
|
||||
|
@ -7094,12 +7096,12 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
{
|
||||
S_StartScreamSound(player->mo, sfx_lose);
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 3; // Get more rings!
|
||||
player->textvar = NTV_GETMORESPHERES; // Get more spheres/chips!
|
||||
player->capsule->reactiontime = 0;
|
||||
player->capsule->extravalue1 = player->capsule->cvmem =\
|
||||
player->capsule->cusval = player->capsule->movecount =\
|
||||
player->capsule->lastlook = player->capsule->extravalue2 = -1;
|
||||
P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked rings
|
||||
P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked spheres/chips
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12453,13 +12455,13 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->texttimer)
|
||||
{
|
||||
--player->texttimer;
|
||||
if (!player->texttimer && !player->exiting && player->textvar >= 4)
|
||||
if (!player->texttimer && !player->exiting && (player->textvar == NTV_NONE || player->textvar == NTV_BONUSTIMEEND))
|
||||
{
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 2; // GET n RINGS!
|
||||
player->textvar = NTV_GETSPHERES; // GET n SPHERES/CHIPS!
|
||||
|
||||
if (!P_MobjWasRemoved(player->capsule) && player->capsule->health != player->capsule->spawnpoint->angle)
|
||||
player->textvar++; // GET n MORE RINGS!
|
||||
if (!P_MobjWasRemoved(player->capsule) && player->capsule->health != player->capsule->spawnpoint->args[1])
|
||||
player->textvar = NTV_GETMORESPHERES; // GET n MORE SPHERES/CHIPS!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1755,22 +1755,23 @@ static void ST_drawNightsRecords(void)
|
|||
|
||||
switch (stplyr->textvar)
|
||||
{
|
||||
case 1: // A "Bonus Time Start" by any other name...
|
||||
case NTV_BONUSTIMESTART: // A "Bonus Time Start" by any other name...
|
||||
{
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 52, V_GREENMAP|aflag, M_GetText("GET TO THE GOAL!"));
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, M_GetText("SCORE MULTIPLIER START!"));
|
||||
|
||||
if (stplyr->finishedtime)
|
||||
{
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, V_ORANGEMAP|aflag, va("%d", (stplyr->startedtime - stplyr->finishedtime)/TICRATE));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, V_ORANGEMAP|aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100));
|
||||
tic_t maretime = stplyr->startedtime - stplyr->finishedtime;
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, V_YELLOWMAP|aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, V_YELLOWMAP|aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, aflag, va("%i:%02i.%02i", G_TicsToMinutes(maretime,true), G_TicsToSeconds(maretime), G_TicsToCentiseconds(maretime)));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Get n Spheres
|
||||
case 3: // Get n more Spheres
|
||||
case NTV_GETSPHERES: // Get n Spheres
|
||||
case NTV_GETMORESPHERES: // Get n more Spheres
|
||||
{
|
||||
if (!stplyr->capsule)
|
||||
return;
|
||||
|
@ -1778,31 +1779,37 @@ static void ST_drawNightsRecords(void)
|
|||
// Yes, this string is an abomination.
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag,
|
||||
va(M_GetText("\x80GET\x82 %d\x80 %s%s%s!"), stplyr->capsule->health,
|
||||
(stplyr->textvar == 3) ? M_GetText("MORE ") : "",
|
||||
(stplyr->textvar == NTV_GETMORESPHERES) ? M_GetText("MORE ") : "",
|
||||
(G_IsSpecialStage(gamemap)) ? "SPHERE" : "CHIP",
|
||||
(stplyr->capsule->health > 1) ? "S" : ""));
|
||||
break;
|
||||
}
|
||||
case 4: // End Bonus
|
||||
case NTV_BONUSTIMEEND: // End Bonus
|
||||
{
|
||||
V_DrawString(BASEVIDWIDTH/2 - 56, 140, aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 56, 148, aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 140, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 148, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres * 50));
|
||||
ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 56)<<FRACBITS, 160<<FRACBITS, FRACUNIT, aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_AZURE);
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 132, V_YELLOWMAP|aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, V_YELLOWMAP|aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, V_YELLOWMAP|aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 132, aflag, va("%i:%02i.%02i", G_TicsToMinutes(stplyr->lastmaretime,true), G_TicsToSeconds(stplyr->lastmaretime), G_TicsToCentiseconds(stplyr->lastmaretime)));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, aflag, va("%d", stplyr->finishedspheres));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, aflag, va("%d", stplyr->finishedspheres * 50));
|
||||
ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 48)<<FRACBITS, 160<<FRACBITS, FRACUNIT, aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_AZURE);
|
||||
|
||||
// If this is a multi-mare map, display the mare number.
|
||||
if (stplyr->lastmare || P_FindLowestMare() < UINT8_MAX)
|
||||
V_DrawLevelActNum(BASEVIDWIDTH/2 - 80, 128 + 3, aflag, stplyr->lastmare + 1);
|
||||
|
||||
// If new record, say so!
|
||||
if (!(netgame || multiplayer) && G_GetBestNightsScore(gamemap, stplyr->lastmare + 1, clientGamedata) <= stplyr->lastmarescore)
|
||||
{
|
||||
if (stplyr->texttimer & 16)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 184, V_YELLOWMAP|aflag, "* NEW RECORD *");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 184, aflag, "\x85* \x82NEW RECORD \x85*\x80");
|
||||
}
|
||||
|
||||
if (P_HasGrades(gamemap, stplyr->lastmare + 1))
|
||||
{
|
||||
UINT8 grade = P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare);
|
||||
if (modeattacking || grade >= GRADE_A)
|
||||
V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 160, aflag, ngradeletters[grade]);
|
||||
if (modeattacking || !G_IsSpecialStage(gamemap) || grade >= GRADE_A)
|
||||
V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 128, aflag, ngradeletters[grade]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1912,7 +1919,7 @@ static void ST_drawNiGHTSHUD(void)
|
|||
// Link drawing
|
||||
if (!oldspecialstage
|
||||
// Don't display when the score is showing (it popping up for a split second when exiting a map is intentional)
|
||||
&& !(stplyr->texttimer && stplyr->textvar == 4)
|
||||
&& !(stplyr->texttimer && stplyr->textvar == NTV_BONUSTIMEEND)
|
||||
&& LUA_HudEnabled(hud_nightslink)
|
||||
&& ((cv_debug & DBG_NIGHTSBASIC) || stplyr->linkcount > 1)) // When debugging, show "0 Link".
|
||||
{
|
||||
|
@ -1959,7 +1966,7 @@ static void ST_drawNiGHTSHUD(void)
|
|||
INT32 amount;
|
||||
const INT32 length = 88;
|
||||
|
||||
origamount = stplyr->capsule->spawnpoint->angle;
|
||||
origamount = stplyr->capsule->spawnpoint->args[1];
|
||||
I_Assert(origamount > 0); // should not happen now
|
||||
|
||||
ST_DrawTopLeftOverlayPatch(72, 8, nbracket);
|
||||
|
|
Loading…
Reference in a new issue