Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
Show changes
Commits on Source (26)
......@@ -4140,7 +4140,22 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent)
static void G_DoCompleted(void)
{
INT32 i;
INT16 initprevmap = (INT16)(gamemap - 1);
// NOTE: G_GetNextMap is used twice with the expectation that the lua modder would use G_SetCustomExitVars function within the hook
//if 0, vanilla behavior. if 1 (true) stops game from executing G_DoCompleted. if 2 (false), stops tally from rewarding players
int mapfinishlua = LUA_HookMapFinish(skipstats, initprevmap, G_GetNextMap(false, true));
if (mapfinishlua == 1) {
gameaction = ga_nothing;
return;
}
//Get and set prevmap/nextmap
prevmap = initprevmap;
nextmap = G_GetNextMap(false, false);
tokenlist = 0; // Reset the list
if (modeattacking && pausedelay)
......@@ -4164,10 +4179,6 @@ static void G_DoCompleted(void)
AM_Stop();
S_StopSounds();
//Get and set prevmap/nextmap
prevmap = (INT16)(gamemap-1);
nextmap = G_GetNextMap(false, false);
automapactive = false;
......@@ -4187,7 +4198,7 @@ static void G_DoCompleted(void)
else
{
G_SetGamestate(GS_INTERMISSION);
Y_StartIntermission();
Y_StartIntermission(mapfinishlua);
Y_LoadIntermissionData();
G_HandleSaveLevel();
}
......
......@@ -47,6 +47,7 @@ automatically.
X (NetVars),/* add to archive table (netsave) */\
X (MapChange),/* (before map load) */\
X (MapLoad),\
X (MapFinish),/* G_DoCompleted */\
X (PlayerJoin),/* Got_AddPlayer */\
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
......@@ -119,7 +120,8 @@ extern boolean hook_cmd_running;
void LUA_HookVoid(int hook);
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
int LUA_HookCharacterHUD
int LUA_HookIntermissionThinker(boolean pstagefailed, INT32 intertic, INT32 tallydonetic, INT32 endtic);
int LUA_HookCharacterHUD
(
int hook, huddrawlist_h drawlist, player_t *player,
fixed_t x, fixed_t y, fixed_t scale,
......@@ -158,5 +160,8 @@ int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend);
int LUA_HookShouldJingleContinue(player_t *, const char *musname);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
int LUA_HookMapFinish(UINT8 pskipstats, INT16 currentmap, INT16 pnextmap);
fixed_t LUA_HookPlayerHeight(player_t *player);
int LUA_HookPlayerCanEnterSpinGaps(player_t *player);
......@@ -1059,6 +1059,33 @@ void LUA_HookPlayerQuit(player_t *plr, kickreason_t reason)
}
}
int LUA_HookIntermissionThinker(boolean pstagefailed, INT32 intertic, INT32 tallydonetic, INT32 endtic)
{
Hook_State hook;
if (prepare_hook(&hook, 0, HOOK(IntermissionThinker)))
{
lua_pushboolean(gL, pstagefailed);
lua_pushinteger(gL, intertic);
lua_pushinteger(gL, tallydonetic);
lua_pushinteger(gL, endtic);
call_hooks(&hook, 1, res_force);
}
return hook.status;
}
int LUA_HookMapFinish(UINT8 pskipstats, INT16 currentmap, INT16 pnextmap)
{
Hook_State hook;
if (prepare_hook(&hook, 0, HOOK(MapFinish)))
{
lua_pushinteger(gL, pskipstats);
lua_pushinteger(gL, currentmap+1);
lua_pushinteger(gL, pnextmap+1);
call_hooks(&hook, 1, res_force);
}
return hook.status;
}
int LUA_HookTeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble)
{
Hook_State hook;
......
......@@ -1512,5 +1512,8 @@ void LUA_SetHudHook(int hook, huddrawlist_h list)
case HUD_HOOK(intermission):
lua_pushboolean(gL, stagefailed);
lua_pushinteger(gL, interlasttic);
lua_pushinteger(gL, interlasttallyendtic);
lua_pushinteger(gL, interlastendtic);
}
}
......@@ -163,14 +163,18 @@ static INT32 intertic;
static INT32 tallydonetic = -1;
static INT32 endtic = -1;
INT32 interlasttic = 0;
INT32 interlastendtic = 0;
INT32 interlasttallyendtic = 0;
intertype_t intertype = int_none;
intertype_t intermissiontypes[NUMGAMETYPES];
static huddrawlist_h luahuddrawlist_intermission;
static void Y_RescaleScreenBuffer(void);
static void Y_AwardCoopBonuses(void);
static void Y_AwardSpecialStageBonus(void);
static void Y_AwardCoopBonuses(int award);
static void Y_AwardSpecialStageBonus(int award);
static void Y_CalculateCompetitionWinners(void);
static void Y_CalculateTimeRaceWinners(void);
static void Y_CalculateMatchWinners(void);
......@@ -998,9 +1002,17 @@ void Y_Ticker(void)
if (paused || P_AutoPause())
return;
LUA_HookBool(stagefailed, HOOK(IntermissionThinker));
// Saving last tics for lua drawer use, without refactoring static timer variable
// if 0 default behavior, if 2 (false) pause, if 1 (true) ends intermission
int boollua = LUA_HookIntermissionThinker(stagefailed, intertic, tallydonetic, endtic);
// Pauses tally logic for custom tally screens with their own calculations.
if (boollua == 2)
return;
intertic++;
interlasttic = intertic;
// Saving last tics for lua drawer use, without refactoring static timer variable
// Team scramble code for team match and CTF.
// Don't do this if we're going to automatically scramble teams next round.
......@@ -1008,12 +1020,26 @@ void Y_Ticker(void)
{
// If we run out of time in intermission, the beauty is that
// the P_Ticker() team scramble code will pick it up.
if ((intertic % (TICRATE/7)) == 0)
if ((intertic % (TICRATE / 7)) == 0)
P_DoTeamscrambling();
}
// Regardless of multiplayer/singleplayer, Lua gets priority to end tally
if (boollua == 1)
{
if (!demoplayback && (intertype == int_coop || intertype == int_spec))
{
M_SilentUpdateUnlockablesAndEmblems(serverGamedata);
M_UpdateUnlockablesAndExtraEmblems(clientGamedata);
G_SaveGameData(clientGamedata);
}
Y_EndIntermission();
G_AfterIntermission();
return;
}
// multiplayer uses timer (based on cv_inttime)
if (timer)
else if (timer)
{
if (!--timer)
{
......@@ -1265,6 +1291,9 @@ void Y_Ticker(void)
// Don't bother recalcing for race. It doesn't make as much sense.
}
interlasttallyendtic = tallydonetic;
interlastendtic = endtic;
}
//
......@@ -1301,7 +1330,7 @@ void Y_DetermineIntermissionType(void)
// Called by G_DoCompleted. Sets up data for intermission drawer/ticker.
//
//
void Y_StartIntermission(void)
void Y_StartIntermission(int awarddenial)
{
intertic = -1;
......@@ -1341,7 +1370,7 @@ void Y_StartIntermission(void)
case int_coop: // coop or single player, normal level
{
// award time and ring bonuses
Y_AwardCoopBonuses();
Y_AwardCoopBonuses(awarddenial);
// setup time data
data.coop.tics = players[consoleplayer].realtime;
......@@ -1429,7 +1458,7 @@ void Y_StartIntermission(void)
case int_spec: // coop or single player, special stage
{
// give out ring bonuses
Y_AwardSpecialStageBonus();
Y_AwardSpecialStageBonus(awarddenial);
// grab an interscreen if appropriate
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
......@@ -2037,7 +2066,7 @@ bonus_f bonuses_list[6][4] = {
//
// Awards the time and ring bonuses.
//
static void Y_AwardCoopBonuses(void)
static void Y_AwardCoopBonuses(int awarddenial)
{
INT32 i, j, bonusnum, oldscore, ptlives;
y_bonus_t localbonuses[4];
......@@ -2061,23 +2090,26 @@ static void Y_AwardCoopBonuses(void)
for (j = 0; j < 4; ++j) // Set bonuses
{
//Set the bonus, but only if we actually finished
if (players[i].pflags & PF_FINISHED)
if (players[i].pflags & PF_FINISHED && awarddenial != 2)
(bonuses_list[bonusnum][j])(&players[i], &localbonuses[j]);
else
Y_SetNullBonus(&players[i], &localbonuses[j]);
players[i].score += localbonuses[j].points;
if (players[i].score > MAXSCORE)
players[i].score = MAXSCORE;
players[i].recordscore += localbonuses[j].points;
if (players[i].recordscore > MAXSCORE)
players[i].recordscore = MAXSCORE;
if (awarddenial != 2)
{
players[i].score += localbonuses[j].points;
if (players[i].score > MAXSCORE)
players[i].score = MAXSCORE;
players[i].recordscore += localbonuses[j].points;
if (players[i].recordscore > MAXSCORE)
players[i].recordscore = MAXSCORE;
}
}
ptlives = min(
(INT32)((!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((INT32)((players[i].score/50000) - (oldscore/50000)), (INT32)0) : 0),
(INT32)((!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((INT32)((players[i].score / 50000) - (oldscore / 50000)), (INT32)0) : 0),
(INT32)(mapheaderinfo[prevmap]->maxbonuslives < 0 ? INT32_MAX : mapheaderinfo[prevmap]->maxbonuslives));
if (ptlives)
if (ptlives && awarddenial != 2)
P_GivePlayerLives(&players[i], ptlives);
if (i == consoleplayer)
......@@ -2096,7 +2128,7 @@ static void Y_AwardCoopBonuses(void)
// Y_AwardSpecialStageBonus
//
// Gives a ring bonus only.
static void Y_AwardSpecialStageBonus(void)
static void Y_AwardSpecialStageBonus(int awarddenial)
{
INT32 i, oldscore, ptlives;
y_bonus_t localbonuses[2];
......@@ -2124,20 +2156,25 @@ static void Y_AwardSpecialStageBonus(void)
Y_SetSpecialRingBonus(&players[i], &localbonuses[0]);
Y_SetPerfectBonus(&players[i], &localbonuses[1]);
}
players[i].score += localbonuses[0].points;
players[i].score += localbonuses[1].points;
if (players[i].score > MAXSCORE)
players[i].score = MAXSCORE;
players[i].recordscore += localbonuses[0].points;
players[i].recordscore += localbonuses[1].points;
if (players[i].recordscore > MAXSCORE)
players[i].recordscore = MAXSCORE;
// grant extra lives right away since tally is faked
ptlives = min(
(INT32)((!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((INT32)((players[i].score/50000) - (oldscore/50000)), (INT32)0) : 0),
(INT32)((!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((INT32)((players[i].score / 50000) - (oldscore / 50000)), (INT32)0) : 0),
(INT32)(mapheaderinfo[prevmap]->maxbonuslives < 0 ? INT32_MAX : mapheaderinfo[prevmap]->maxbonuslives));
P_GivePlayerLives(&players[i], ptlives);
if (awarddenial != 2)
{
players[i].score += localbonuses[0].points;
players[i].score += localbonuses[1].points;
if (players[i].score > MAXSCORE)
players[i].score = MAXSCORE;
players[i].recordscore += localbonuses[0].points;
players[i].recordscore += localbonuses[1].points;
if (players[i].recordscore > MAXSCORE)
players[i].recordscore = MAXSCORE;
// grant extra lives right away since tally is faked
P_GivePlayerLives(&players[i], ptlives);
}
if (i == consoleplayer)
{
......
......@@ -11,11 +11,12 @@
extern boolean usebuffer;
// Exposed for lua_hudlib.c
void Y_IntermissionDrawer(void);
void Y_Ticker(void);
void Y_LoadIntermissionData(void);
void Y_StartIntermission(void);
void Y_StartIntermission(int awarddenial);
void Y_EndIntermission(void);
void Y_ConsiderScreenBuffer(void);
......@@ -23,6 +24,9 @@ void Y_CleanupScreenBuffer(void);
void Y_DetermineIntermissionType(void);
// For Lua
extern INT32 interlasttic, interlastendtic, interlasttallyendtic;
typedef enum
{
int_none,
......