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
  • 1392-2-2-15-attempting-to-draw-a-hud-graphic-with-the-same-lump-name-as-a-lua-script-crashes-the
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • better-player-states
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results

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
  • 1392-2-2-15-attempting-to-draw-a-hud-graphic-with-the-same-lump-name-as-a-lua-script-crashes-the
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results
Show changes
Commits on Source (16)
......@@ -70,14 +70,9 @@ static boolean consoleready; // console prompt is ready
INT32 con_destlines; // vid lines used by console at final position
static INT32 con_curlines; // vid lines currently used by console
INT32 con_clipviewtop; // (useless)
static UINT8 con_hudlines; // number of console heads up message lines
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
INT32 con_clearlines; // top screen lines to refresh when view reduced
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
// console text output
static char *con_line; // console text output current line
static size_t con_cx; // cursor position in current line
......@@ -473,9 +468,6 @@ void CON_Init(void)
Lock_state();
//note: CON_Ticker should always execute at least once before D_Display()
con_clipviewtop = -1; // -1 does not clip
con_hudlines = atoi(cons_hudlines.defaultvalue);
Unlock_state();
......@@ -749,9 +741,9 @@ void CON_ToggleOff(void)
con_destlines = 0;
con_curlines = 0;
CON_ClearHUD();
con_forcepic = 0;
con_clipviewtop = -1; // remove console clipping of view
CON_ClearHUD();
I_UpdateMouseGrab();
......@@ -800,18 +792,6 @@ void CON_Ticker(void)
CON_ChangeHeight();
}
// clip the view, so that the part under the console is not drawn
con_clipviewtop = -1;
if (cons_backpic.value) // clip only when using an opaque background
{
if (con_curlines > 0)
con_clipviewtop = con_curlines - viewwindowy - 1 - 10;
// NOTE: BIG HACK::SUBTRACT 10, SO THAT WATER DON'T COPY LINES OF THE CONSOLE
// WINDOW!!! (draw some more lines behind the bottom of the console)
if (con_clipviewtop < 0)
con_clipviewtop = -1; // maybe not necessary, provided it's < 0
}
// check if console ready for prompt
if (con_destlines >= minheight)
consoleready = true;
......@@ -1356,9 +1336,6 @@ static void CON_Linefeed(void)
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
memset(con_line, ' ', con_width);
// make sure the view borders are refreshed if hud messages scroll
con_hudupdate = true; // see HU_Erase()
}
// Outputs text into the console text buffer
......@@ -1747,12 +1724,8 @@ static void CON_DrawHudlines(void)
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, true);
y += charheight;
}
// top screen lines that might need clearing when view is reduced
con_clearlines = y; // this is handled by HU_Erase();
}
// Lactozilla: Draws the console's background picture.
static void CON_DrawBackpic(void)
{
patch_t *con_backpic;
......@@ -1768,7 +1741,6 @@ static void CON_DrawBackpic(void)
if (piclump == LUMPERROR)
piclump = W_GetNumForName("MISSING");
// Cache the patch.
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
// Center the backpic, and draw a vertically cropped patch.
......@@ -1776,8 +1748,7 @@ static void CON_DrawBackpic(void)
x = (vid.width / 2) - (w / 2);
h = con_curlines/vid.dup;
// If the patch doesn't fill the entire screen,
// then fill the sides with a solid color.
// If the patch doesn't fill the entire screen, then fill the sides with a solid color.
if (x > 0)
{
column_t *column = (column_t *)((UINT8 *)(con_backpic->columns) + (con_backpic->columnofs[0]));
......@@ -1792,11 +1763,9 @@ static void CON_DrawBackpic(void)
}
}
// Draw the patch.
V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, FRACUNIT, V_NOSCALESTART, con_backpic, NULL,
0, (BASEVIDHEIGHT - h) << FRACBITS, BASEVIDWIDTH << FRACBITS, h << FRACBITS);
// Unlock the cached patch.
W_UnlockCachedPatch(con_backpic);
}
......@@ -1815,10 +1784,6 @@ static void CON_DrawConsole(void)
if (con_curlines <= 0)
return;
//FIXME: refresh borders only when console bg is translucent
con_clearlines = con_curlines; // clear console draw from view borders
con_hudupdate = true; // always refresh while console is on
// draw console background
if (cons_backpic.value || con_forcepic)
CON_DrawBackpic();
......
......@@ -34,14 +34,9 @@ extern boolean con_startup;
// needs explicit screen refresh until we are in the main game loop
extern boolean con_refresh;
// top clip value for view render: do not draw part of view hidden by console
extern INT32 con_clipviewtop;
// 0 means console if off, or moving out
extern INT32 con_destlines;
extern INT32 con_clearlines; // lines of top of screen to refresh
extern boolean con_hudupdate; // hud messages have changed, need refresh
extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor;
......
......@@ -36,6 +36,7 @@
#include "console.h"
#include "netcode/d_net.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "g_game.h"
#include "hu_stuff.h"
#include "i_sound.h"
......@@ -289,113 +290,97 @@ void D_ProcessEvents(void)
}
//
// D_Display
// draw current display, possibly wiping it from the previous
// RENDERING
//
// wipegamestate can be set to -1 to force a wipe on the next draw
// added comment : there is a wipe eatch change of the gamestate
gamestate_t wipegamestate = GS_LEVEL;
// -1: Default; 0-n: Wipe index; INT16_MAX: do not wipe
INT16 wipetypepre = -1;
INT16 wipetypepost = -1;
static void D_Display(void)
static void D_Render(void)
{
boolean forcerefresh = false;
static boolean wipe = false;
INT32 wipedefindex = 0;
if (dedicated)
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap))))
{
PS_START_TIMING(ps_uitime);
return;
}
if (nodrawers)
return; // for comparative timing/profiling
// draw the view directly
if (!automapactive && !dedicated && (!titlecard.prelevel) && cv_renderview.value)
{
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
PS_START_TIMING(ps_rendercalltime);
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
objectsdrawn = 0;
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(0, &players[displayplayer]);
else
#endif
if (rendermode != render_none)
R_RenderPlayerView(&players[displayplayer]);
}
// Lactozilla: Switching renderers works by checking
// if the game has to do it right when the frame
// needs to render. If so, five things will happen:
// 1. Interface functions will be called so
// that switching to OpenGL creates a
// GL context, and switching to Software
// allocates screen buffers.
// 2. Software will set drawer functions,
// and OpenGL will load textures and
// create plane polygons, if necessary.
// 3. Functions related to switching video
// modes (resolution) are called.
// 4. The frame is ready to be drawn!
// render the second screen
if (splitscreen && players[secondarydisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
else
#endif
if (rendermode != render_none)
{
viewwindowy = vid.height / 2;
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
// Check for change of renderer or screen size (video mode)
if ((setrenderneeded || setmodeneeded) && !wipe)
SCR_SetMode(); // change video mode
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
// Recalc the screen
if (vid.recalc)
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
R_RenderPlayerView(&players[secondarydisplayplayer]);
// View morph
if (rendermode == render_soft && !splitscreen)
R_CheckViewMorph();
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
// Change the view size if needed
// Set by changing video mode or renderer
if (setsizeneeded)
{
R_ExecuteSetViewSize();
forcerefresh = true; // force background redraw
}
// Image postprocessing effect
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
// draw buffered stuff to screen
// Used only by linux GGI version
I_UpdateNoBlit();
if (postimgtype)
V_DoPostProcessor(0, postimgtype, postimgparam);
if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2);
}
PS_STOP_TIMING(ps_rendercalltime);
R_RestoreLevelInterpolators();
}
// save the current screen if about to wipe
wipe = (gamestate != wipegamestate);
if (wipe && wipetypepre != INT16_MAX)
if (lastdraw)
{
// set for all later
wipedefindex = gamestate; // wipe_xxx_toblack
if (gamestate == GS_INTERMISSION)
if (rendermode == render_soft)
{
if (intertype == int_spec) // Special Stage
wipedefindex = wipe_specinter_toblack;
else if (intertype != int_coop) // Multiplayer
wipedefindex = wipe_multinter_toblack;
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
Y_ConsiderScreenBuffer();
usebuffer = true;
}
lastdraw = false;
}
if (wipetypepre < 0 || !F_WipeExists(wipetypepre))
wipetypepre = wipedefs[wipedefindex];
if (rendermode != render_none)
{
// Fade to black first
if ((wipegamestate == (gamestate_t)FORCEWIPE ||
(wipegamestate != (gamestate_t)FORCEWIPEOFF
&& !(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
) // fades to black on its own timing, always
&& wipetypepre != UINT8_MAX)
{
F_WipeStartScreen();
// Check for Mega Genesis fade
wipestyleflags = WSF_FADEOUT;
if (wipegamestate == (gamestate_t)FORCEWIPE)
F_WipeColorFill(31);
else if (F_TryColormapFade(31))
wipetypepost = -1; // Don't run the fade below this one
F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}
F_WipeStartScreen();
}
PS_START_TIMING(ps_uitime);
wipetypepre = -1;
if (gamestate == GS_LEVEL)
{
ST_Drawer();
F_TextPromptDrawer();
HU_Drawer();
}
else
wipetypepre = -1;
F_TitleScreenDrawer();
}
// do buffered drawing
static void D_RenderNonLevel(void)
{
switch (gamestate)
{
case GS_TITLESCREEN:
......@@ -407,34 +392,29 @@ static void D_Display(void)
case GS_LEVEL:
if (!gametic)
break;
HU_Erase();
AM_Drawer();
break;
case GS_INTERMISSION:
Y_IntermissionDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_TIMEATTACK:
M_TimeAttackDrawer();
break;
case GS_INTRO:
F_IntroDrawer();
if (wipegamestate == (gamestate_t)-1)
wipe = true;
break;
case GS_ENDING:
F_EndingDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_CUTSCENE:
F_CutsceneDrawer();
HU_Erase();
HU_Drawer();
break;
......@@ -444,7 +424,6 @@ static void D_Display(void)
case GS_EVALUATION:
F_GameEvaluationDrawer();
HU_Erase();
HU_Drawer();
break;
......@@ -454,118 +433,89 @@ static void D_Display(void)
case GS_CREDITS:
F_CreditDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_WAITINGPLAYERS:
// The clientconnect drawer is independent...
if (netgame)
{
// I don't think HOM from nothing drawing is independent...
F_WaitingPlayersDrawer();
HU_Erase();
HU_Drawer();
}
case GS_DEDICATEDSERVER:
case GS_NULL:
default:
break;
}
}
// STUPID race condition...
if (wipegamestate == GS_INTRO && gamestate == GS_TITLESCREEN)
wipegamestate = FORCEWIPEOFF;
else
{
wipegamestate = gamestate;
// clean up border stuff
// see if the border needs to be initially drawn
if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap)))
{
// draw the view directly
if (!automapactive && !dedicated && cv_renderview.value)
{
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
PS_START_TIMING(ps_rendercalltime);
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
objectsdrawn = 0;
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(0, &players[displayplayer]);
else
#endif
if (rendermode != render_none)
R_RenderPlayerView(&players[displayplayer]);
}
//
// Draws the entire screen frame.
//
// render the second screen
if (splitscreen && players[secondarydisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
else
#endif
if (rendermode != render_none)
{
viewwindowy = vid.height / 2;
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
static void D_Display(void)
{
boolean forcerefresh = false;
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
if (dedicated)
return;
R_RenderPlayerView(&players[secondarydisplayplayer]);
if (nodrawers)
return; // for comparative timing/profiling
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
// Check for change of renderer or screen size (video mode)
if (setrenderneeded || setmodeneeded)
{
SCR_SetMode(); // change video mode
if (wipe_running)
ScreenWipe_Stop();
}
// Image postprocessing effect
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
// Recalc the screen
if (vid.recalc)
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
if (postimgtype)
V_DoPostProcessor(0, postimgtype, postimgparam);
if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2);
}
PS_STOP_TIMING(ps_rendercalltime);
R_RestoreLevelInterpolators();
}
// View morph
if (rendermode == render_soft && !splitscreen)
R_CheckViewMorph();
if (lastdraw)
{
if (rendermode == render_soft)
{
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
Y_ConsiderScreenBuffer();
usebuffer = true;
}
lastdraw = false;
}
// Change the view size if needed
// Set by changing video mode or renderer
if (setsizeneeded)
{
R_ExecuteSetViewSize();
forcerefresh = true; // force background redraw
}
PS_START_TIMING(ps_uitime);
// draw buffered stuff to screen
// Used only by linux GGI version
I_UpdateNoBlit();
if (gamestate == GS_LEVEL)
{
ST_Drawer();
F_TextPromptDrawer();
HU_Drawer();
}
else
F_TitleScreenDrawer();
}
else
// save the current screen if about to wipe
wipe_t *wipe = ScreenWipe_GetQueued();
if (wipe && !wipe_running)
{
if (!(wipe->flags & (WIPEFLAGS_FADEIN | WIPEFLAGS_CROSSFADE)))
{
PS_START_TIMING(ps_uitime);
ScreenWipe_SetupFadeOut(wipe->flags);
ScreenWipe_StartPending();
}
if (wipe->flags & WIPEFLAGS_CROSSFADE)
ScreenWipe_StartScreen();
}
// do buffered drawing
if (wipe_running)
{
ScreenWipe_Display();
if (gamestate == GS_LEVEL && !levelstarting)
TitleCard_DrawOverWipe();
}
else
D_RenderNonLevel();
if (!wipe_running)
D_Render();
// change gamma if needed
// (GS_LEVEL handles this already due to level-specific palettes)
......@@ -594,66 +544,43 @@ static void D_Display(void)
// vid size change is now finished if it was on...
vid.recalc = 0;
if (!wipe_running || (wipe_running && (wipe_drawmenuontop || G_GetRetryFlag(RETRY_CUR))))
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of everything
M_Drawer(); // menu is drawn even on top of everything
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
I_unlock_mutex(m_menu_mutex);
#endif
}
// focus lost moved to M_Drawer
CON_Drawer();
PS_STOP_TIMING(ps_uitime);
//
// wipe update
//
if (wipe && wipetypepost != INT16_MAX)
wipe = ScreenWipe_GetQueued();
if (wipe && !wipe_running && (wipe->flags & (WIPEFLAGS_FADEIN | WIPEFLAGS_CROSSFADE)))
{
// note: moved up here because NetUpdate does input changes
// and input during wipe tends to mess things up
wipedefindex += WIPEFINALSHIFT;
if (wipetypepost < 0 || !F_WipeExists(wipetypepost))
wipetypepost = wipedefs[wipedefindex];
ScreenWipe_EndScreen();
if (rendermode != render_none)
if (wipe->flags & WIPEFLAGS_FADEIN)
{
F_WipeEndScreen();
ScreenWipe_DoColorFill(levelfadecol);
ScreenWipe_StartScreen();
}
// Funny.
if (WipeStageTitle && st_overlay)
{
lt_ticker--;
lt_lasttic = lt_ticker;
ST_preLevelTitleCardDrawer();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeStartScreen();
}
ScreenWipe_StartPending();
// Check for Mega Genesis fade
if (F_ShouldColormapFade())
{
wipestyleflags |= WSF_FADEIN;
wipestyleflags &= ~WSF_FADEOUT;
}
ScreenWipe_Display();
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
}
if (titlecard.running)
TitleCard_DrawOverWipe();
}
// reset counters so timedemo doesn't count the wipe duration
if (timingdemo)
{
framecount = 0;
demostarttime = I_GetTime();
}
CON_Drawer();
wipetypepost = -1;
}
else
wipetypepost = -1;
PS_STOP_TIMING(ps_uitime);
NetUpdate(); // send out any new accumulation
......@@ -667,34 +594,31 @@ static void D_Display(void)
//
// normal update
//
if (!wipe)
if (cv_netstat.value)
{
if (cv_netstat.value)
{
char s[50];
Net_GetNetStat();
s[sizeof s - 1] = '\0';
snprintf(s, sizeof s - 1, "get %d b/s", getbps);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-40, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "send %d b/s", sendbps);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-30, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "GameMiss %.2f%%", gamelostpercent);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-20, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
}
if (cv_perfstats.value)
{
M_DrawPerfStats();
}
char s[50];
Net_GetNetStat();
s[sizeof s - 1] = '\0';
snprintf(s, sizeof s - 1, "get %d b/s", getbps);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-40, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "send %d b/s", sendbps);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-30, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "GameMiss %.2f%%", gamelostpercent);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-20, V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent);
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
}
PS_START_TIMING(ps_swaptime);
I_FinishUpdate(); // page flip or blit buffer
PS_STOP_TIMING(ps_swaptime);
if (cv_perfstats.value)
{
M_DrawPerfStats();
}
PS_START_TIMING(ps_swaptime);
I_FinishUpdate(); // page flip or blit buffer
PS_STOP_TIMING(ps_swaptime);
}
// =========================================================================
......@@ -708,7 +632,6 @@ void D_SRB2Loop(void)
tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS;
double deltatics = 0.0;
double deltasecs = 0.0;
static lumpnum_t gstartuplumpnum;
boolean interp = false;
boolean doDisplay = false;
......@@ -756,7 +679,7 @@ void D_SRB2Loop(void)
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */
if (gamestate != GS_TITLESCREEN)
{
gstartuplumpnum = W_CheckNumForName("STARTUP");
lumpnum_t gstartuplumpnum = W_CheckNumForName("STARTUP");
if (gstartuplumpnum == LUMPERROR)
gstartuplumpnum = W_GetNumForName("MISSING");
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH));
......@@ -777,12 +700,6 @@ void D_SRB2Loop(void)
I_UpdateTime(cv_timescale.value);
if (lastwipetic)
{
oldentertics = lastwipetic;
lastwipetic = 0;
}
// get real tics
entertic = I_GetTime();
realtics = entertic - oldentertics;
......@@ -942,6 +859,8 @@ void D_StartTitle(void)
S_StopMusic();
TitleCard_Stop();
if (netgame)
{
if (gametyperules & GTR_CAMPAIGN)
......@@ -1516,8 +1435,6 @@ void D_SRB2Main(void)
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
wipegamestate = gamestate;
savedata.lives = 0; // flag this as not-used
//------------------------------------------------ COMMAND LINE PARAMS
......@@ -1667,7 +1584,6 @@ void D_SRB2Main(void)
G_TimeDemo(tmp);
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
return;
}
......
......@@ -23,6 +23,7 @@
#include "m_menu.h"
#include "m_misc.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "st_stuff.h"
#include "i_system.h"
#include "p_setup.h"
......
......@@ -621,12 +621,6 @@ extern INT32 debugload;
// if true, load all graphics at level load
extern boolean precache;
// wipegamestate can be set to -1
// to force a wipe on the next draw
extern gamestate_t wipegamestate;
extern INT16 wipetypepre;
extern INT16 wipetypepost;
// debug flag to cancel adaptiveness
extern boolean singletics;
......
......@@ -16,6 +16,7 @@
#include "d_main.h"
#include "netcode/d_netcmd.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "g_game.h"
#include "hu_stuff.h"
#include "r_local.h"
......@@ -306,9 +307,9 @@ static void F_NewCutscene(const char *basetext)
// =============
#define NUMINTROSCENES 17
INT32 intro_scenenum = 0;
INT32 intro_curtime = 0;
static INT32 intro_curtime = 0;
const char *introtext[NUMINTROSCENES];
static const char *introtext[NUMINTROSCENES];
static tic_t introscenetime[NUMINTROSCENES] =
{
......@@ -331,14 +332,14 @@ static tic_t introscenetime[NUMINTROSCENES] =
25*TICRATE, // I'm just finding what mission obje...
};
// custom intros
void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean resetplayer, boolean FLS);
void F_StartIntro(void)
{
S_StopMusic();
S_StopSounds();
ScreenWipe_StopAll();
// custom intros
if (introtoplay)
{
if (!cutscenes[introtoplay - 1])
......@@ -490,26 +491,29 @@ void F_StartIntro(void)
"\x80\n\xA9\xD2\xD2"
"\"All right, then\xAF... \xD2\xD2\xA7let's go!\"\n#");
/*
"What are we waiting for? The first emerald is ours!" Sonic was about to
run, when he saw a shadow pass over him, he recognized the silhouette
instantly.
"Knuckles!" Sonic said. The echidna stopped his glide and landed
facing Sonic. "What are you doing here?"
He replied, "This crisis affects the Floating Island,
if that explosion I saw is anything to go by."
If you're willing to help then... let's go!"
*/
boolean do_fade_out = gamestate != GS_NULL;
G_SetGamestate(GS_INTRO);
gameaction = ga_nothing;
paused = false;
CON_ToggleOff();
F_NewCutscene(introtext[0]);
TitleCard_Stop();
intro_scenenum = 0;
intro_curtime = 0;
finalecount = animtimer = skullAnimCounter = stoptimer = 0;
timetonext = introscenetime[intro_scenenum];
if (do_fade_out)
{
wipe_t wipe = {0};
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = wipedefs[wipe_intro_toblack];
wipe.drawmenuontop = false;
wipe.holdframes = TICRATE;
ScreenWipe_StartParametrized(&wipe);
}
}
//
......@@ -618,10 +622,10 @@ void F_IntroDrawer(void)
}
else if (intro_scenenum == 0) // STJr presents
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
if (intro_curtime > 1 && intro_curtime < (INT32)introscenetime[intro_scenenum])
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
if (intro_curtime < TICRATE-5) // Make the text shine!
{
sprintf(stjrintro, "STJRI%03u", intro_curtime-1);
......@@ -639,7 +643,7 @@ void F_IntroDrawer(void)
V_DrawSmallScaledPatch(bgxoffs, 84, 0, background);
}
if (!WipeInAction) // Draw the patch if not in a wipe
if (!wipe_running) // Draw the patch if not in a wipe
{
background = W_CachePatchName(stjrintro, PU_PATCH_LOWPRIORITY);
V_DrawSmallScaledPatch(bgxoffs, 84, 0, background);
......@@ -787,7 +791,7 @@ void F_IntroDrawer(void)
W_UnlockCachedPatch(background);
if (intro_scenenum == 4) // The asteroid SPINS!
if (intro_scenenum == INTRO_ASTEROID) // The asteroid SPINS!
{
if (intro_curtime > 1)
{
......@@ -827,7 +831,7 @@ void F_IntroDrawer(void)
V_DrawFixedPatch(x, y, scale, trans<<V_ALPHASHIFT, rockpat, R_GetTranslationColormap(TC_BLINK, SKINCOLOR_AQUA, GTC_CACHE));
}
}
else if (intro_scenenum == 1 && intro_curtime < 5*TICRATE)
else if (intro_scenenum == INTRO_FIRST && intro_curtime < 5*TICRATE)
{
INT32 trans = intro_curtime + 10 - (5*TICRATE);
if (trans < 0)
......@@ -838,6 +842,92 @@ void F_IntroDrawer(void)
V_DrawString(cx, cy, V_ALLOWLOWERCASE, cutscene_disptext);
}
static void F_IntroCheckMidSceneWipe(void)
{
boolean do_crossfade = false;
if (intro_scenenum == INTRO_STJR && intro_curtime == 2*TICRATE-19)
{
S_ChangeMusicInternal("_stjr", false);
ScreenWipe_DoFadeIn(99, WIPEFLAGS_FADEIN, NULL);
return;
}
else if (intro_scenenum == INTRO_RADAR && intro_curtime == 5*TICRATE)
do_crossfade = true;
else if (intro_scenenum == INTRO_GRASS2 && intro_curtime == 6*TICRATE)
do_crossfade = true;
else if (intro_scenenum == INTRO_SONICDO2 && intro_curtime == 7*TICRATE)
do_crossfade = true;
if (do_crossfade)
ScreenWipe_DoCrossfade(99);
}
static void F_PlayIntroMusic(void)
{
S_ChangeMusicInternal("_intro", false);
}
static void F_IntroDoSpecialWipe(INT32 scene)
{
wipe_t wipe = {0};
wipe.type = 99;
wipe.drawmenuontop = true;
boolean do_fade_in = false;
switch (scene)
{
case INTRO_STJR:
// The intro music is timed with the fade out and fade in
wipe.callback = F_PlayIntroMusic;
do_fade_in = true;
break;
case INTRO_SKYRUNNER:
wipe.flags = WIPEFLAGS_TOWHITE;
wipe.type = 0;
wipe.holdframes = 17;
do_fade_in = true;
break;
case INTRO_LAST:
wipe.holdframes = NEWTICRATE*2;
wipe.callback = D_StartTitle;
break;
default:
wipe.flags = WIPEFLAGS_CROSSFADE;
break;
}
wipe.style = ScreenWipe_GetStyle(wipe.flags);
ScreenWipe_StartParametrized(&wipe);
if (do_fade_in)
{
if (scene == INTRO_SKYRUNNER)
wipe.type = 99;
wipe.flags |= WIPEFLAGS_FADEIN;
wipe.callback = NULL;
wipe.holdframes = 0;
ScreenWipe_StartParametrized(&wipe);
}
}
static boolean F_IntroSceneCrossfades(unsigned scene)
{
switch (scene)
{
case INTRO_STJR:
case INTRO_SKYRUNNER:
case INTRO_LAST:
return false;
default:
return true;
}
}
//
// F_IntroTicker
//
......@@ -854,131 +944,31 @@ void F_IntroTicker(void)
if (keypressed)
keypressed = false;
wipestyleflags = WSF_CROSSFADE;
INT32 lastscene = intro_scenenum;
boolean next = timetonext <= 0;
if (timetonext <= 0)
if (next)
{
if (intro_scenenum == 0)
{
if (rendermode != render_none)
{
wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen();
F_TryColormapFade(31);
F_IntroDrawer();
F_WipeEndScreen();
F_RunWipe(99,true);
}
S_ChangeMusicInternal("_intro", false);
}
else if (intro_scenenum == 10)
if (F_IntroSceneCrossfades(intro_scenenum))
{
if (rendermode != render_none)
{
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
F_WipeStartScreen();
F_TryColormapFade(0);
F_IntroDrawer();
F_WipeEndScreen();
F_RunWipe(99,true);
}
}
else if (intro_scenenum == 16)
{
if (rendermode != render_none)
{
wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen();
F_TryColormapFade(31);
F_IntroDrawer();
F_WipeEndScreen();
F_RunWipe(99,true);
}
// Stay on black for a bit. =)
{
tic_t nowtime, quittime, lasttime;
nowtime = lasttime = I_GetTime();
quittime = nowtime + NEWTICRATE*2; // Shortened the quit time, used to be 2 seconds
while (quittime > nowtime)
{
while (!((nowtime = I_GetTime()) - lasttime))
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
}
lasttime = nowtime;
I_OsPolling();
I_UpdateNoBlit();
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
#endif
I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001
if (moviemode) // make sure we save frames for the white hold too
M_SaveFrame();
}
}
D_StartTitle();
wipegamestate = GS_INTRO;
return;
ScreenWipe_DoCrossfade(99);
next = false;
}
F_NewCutscene(introtext[++intro_scenenum]);
timetonext = introscenetime[intro_scenenum];
F_WipeStartScreen();
wipegamestate = -1;
animtimer = stoptimer = 0;
}
intro_curtime = introscenetime[intro_scenenum] - timetonext;
if (rendermode != render_none)
if (next)
{
if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-19)
{
S_ChangeMusicInternal("_stjr", false);
wipestyleflags = WSF_FADEIN;
F_WipeStartScreen();
F_TryColormapFade(31);
F_IntroDrawer();
F_WipeEndScreen();
F_RunWipe(99,true);
}
else if ((intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|| (intro_scenenum == 7 && intro_curtime == 6*TICRATE)
//|| (intro_scenenum == 11 && intro_curtime == 7*TICRATE)
|| (intro_scenenum == 15 && intro_curtime == 7*TICRATE))
{
F_WipeStartScreen();
F_WipeColorFill(31);
F_IntroDrawer();
F_WipeEndScreen();
F_RunWipe(99,true);
}
F_IntroDoSpecialWipe(lastscene);
return;
}
if (animtimer)
animtimer--;
F_IntroCheckMidSceneWipe();
}
//
......@@ -1249,17 +1239,23 @@ static const UINT8 credits_numpics = sizeof(credits_pics)/sizeof(credits_pics[0]
void F_StartCredits(void)
{
G_SetGamestate(GS_CREDITS);
boolean from_ending = gamestate == GS_ENDING;
ScreenWipe_StopAll();
TitleCard_Stop();
// Just in case they're open ... somehow
M_ClearMenus(true);
if (creditscutscene)
if (creditscutscene && cutscenes[creditscutscene - 1])
{
F_StartCustomCutscene(creditscutscene - 1, false, false, false);
return;
}
G_SetGamestate(GS_CREDITS);
gameaction = ga_nothing;
paused = false;
CON_ToggleOff();
......@@ -1271,6 +1267,10 @@ void F_StartCredits(void)
finalecount = 0;
animtimer = 0;
timetonext = 2*TICRATE;
if (!from_ending)
ScreenWipe_DoFadeOut(wipedefs[wipe_credits_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_credits_final], WIPEFLAGS_FADEIN, NULL);
}
void F_CreditDrawer(void)
......@@ -1466,6 +1466,9 @@ void F_StartGameEvaluation(void)
finalecount = -1;
sparklloop = 0;
ScreenWipe_DoFadeOut(wipedefs[wipe_evaluation_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_evaluation_final], WIPEFLAGS_FADEIN, NULL);
}
void F_GameEvaluationDrawer(void)
......@@ -1684,7 +1687,7 @@ void F_GameEvaluationTicker(void)
#define STOPPINGPOINT (14*TICRATE)
#define SPARKLLOOPTIME 15 // must be odd
static void F_CacheEnding(void)
static void F_LoadEndingGraphics(void)
{
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH_LOWPRIORITY);
......@@ -1763,8 +1766,11 @@ static void F_CacheGoodEnding(void)
void F_StartEnding(void)
{
ScreenWipe_StopAll();
TitleCard_Stop();
G_SetGamestate(GS_ENDING);
wipetypepost = INT16_MAX;
// Just in case they're open ... somehow
M_ClearMenus(true);
......@@ -1780,7 +1786,10 @@ void F_StartEnding(void)
memset(sparkloffs, 0, sizeof(INT32)*3*2);
sparklloop = 0;
F_CacheEnding();
F_LoadEndingGraphics();
ScreenWipe_DoFadeOut(wipedefs[wipe_ending_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_ending_final], WIPEFLAGS_FADEIN, NULL);
}
void F_EndingTicker(void)
......@@ -1788,7 +1797,6 @@ void F_EndingTicker(void)
if (++finalecount > STOPPINGPOINT)
{
F_StartCredits();
wipetypepre = INT16_MAX;
return;
}
......@@ -2222,6 +2230,8 @@ void F_StartGameEnd(void)
M_ClearMenus(true);
timetonext = TICRATE;
ScreenWipe_DoFadeIn(99, 0, NULL);
}
//
......@@ -2229,7 +2239,7 @@ void F_StartGameEnd(void)
//
void F_GameEndDrawer(void)
{
// this function does nothing
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
}
//
......@@ -2396,8 +2406,16 @@ static void F_CacheTitleScreen(void)
}
}
void F_InitTitleScreen(void)
{
if (titlemap)
G_DoLoadLevel();
}
void F_StartTitleScreen(void)
{
ScreenWipe_StopAll();
if (menupres[MN_MAIN].musname[0])
S_ChangeMusic(menupres[MN_MAIN].musname, menupres[MN_MAIN].mustrack, menupres[MN_MAIN].muslooping);
else
......@@ -2418,16 +2436,16 @@ void F_StartTitleScreen(void)
finalecount = -3; // hack so that frames don't advance during the entry wipe
else
finalecount = 0;
wipetypepost = menupres[MN_MAIN].enterwipe;
if (!ScreenWipe_GetQueued())
ScreenWipe_DoFadeOut(wipedefs[wipe_titlescreen_toblack], 0, F_InitTitleScreen);
ScreenWipe_DoFadeIn(menupres[MN_MAIN].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
else
wipegamestate = GS_TITLESCREEN;
G_SetGamestate(GS_TITLESCREEN);
if (titlemap)
{
mapthing_t *startpos;
gamestate_t prevwipegamestate = wipegamestate;
titlemapinaction = TITLEMAP_LOADING;
titlemapcameraref = NULL;
gamemap = titlemap;
......@@ -2438,43 +2456,9 @@ void F_StartTitleScreen(void)
maptol = mapheaderinfo[gamemap-1]->typeoflevel;
globalweather = mapheaderinfo[gamemap-1]->weather;
G_DoLoadLevel(true);
G_StartLevel(true);
if (!titlemap)
return;
players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater)
// Set Default Position
if (playerstarts[0])
startpos = playerstarts[0];
else if (deathmatchstarts[0])
startpos = deathmatchstarts[0];
else
startpos = NULL;
if (startpos)
{
camera.x = startpos->x << FRACBITS;
camera.y = startpos->y << FRACBITS;
camera.subsector = R_PointInSubsector(camera.x, camera.y);
camera.z = camera.subsector->sector->floorheight + (startpos->z << FRACBITS);
camera.angle = (startpos->angle % 360)*ANG1;
camera.aiming = 0;
}
else
{
camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0;
camera.subsector = NULL; // toast is filthy too
}
camera.chase = true;
camera.height = 0;
// Run enter linedef exec for MN_MAIN, since this is where we start
if (menupres[MN_MAIN].entertag)
P_LinedefExecute(menupres[MN_MAIN].entertag, players[displayplayer].mo, NULL);
wipegamestate = prevwipegamestate;
}
else
{
......@@ -2485,10 +2469,6 @@ void F_StartTitleScreen(void)
CON_ClearHUD();
}
G_SetGamestate(GS_TITLESCREEN);
// IWAD dependent stuff.
animtimer = skullAnimCounter = 0;
demoDelayLeft = demoDelayTime;
......@@ -3540,7 +3520,7 @@ void F_StartContinue(void)
return;
}
wipestyleflags = WSF_FADEOUT;
ScreenWipe_StopAll();
G_SetGamestate(GS_CONTINUING);
gameaction = ga_nothing;
......@@ -3592,6 +3572,9 @@ void F_StartContinue(void)
timetonext = (11*TICRATE)+11;
continuetime = 0;
ScreenWipe_DoFadeOut(wipedefs[wipe_continuing_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_continuing_final], WIPEFLAGS_FADEIN, NULL);
}
//
......@@ -3839,22 +3822,35 @@ static INT32 textxpos, textypos;
static boolean cutsceneover = false;
static boolean runningprecutscene = false, precutresetplayer = false, precutFLS = false;
static void F_AdvanceToNextScene(void)
static void F_PlayCutsceneMusic(void)
{
if (rendermode != render_none)
{
F_WipeStartScreen();
// Fade to any palette color you want.
if (cutscenes[cutnum]->scene[scenenum].fadecolor)
{
V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,cutscenes[cutnum]->scene[scenenum].fadecolor);
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
S_ChangeMusicEx(cutscenes[cutnum]->scene[scenenum].musswitch,
cutscenes[cutnum]->scene[scenenum].musswitchflags,
cutscenes[cutnum]->scene[scenenum].musicloop,
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
}
F_WipeEndScreen();
F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeinid, true);
static void F_AdvanceToNextScene(void)
{
ScreenWipe_StopAll();
F_WipeStartScreen();
}
// Fade to any palette color you want.
if (cutscenes[cutnum]->scene[scenenum].fadecolor)
{
wipe_t wipe = {0};
wipe.flags = WIPEFLAGS_CROSSFADE;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = cutscenes[cutnum]->scene[scenenum].fadeinid;
wipe.drawmenuontop = true;
wipe.callback = F_PlayCutsceneMusic;
ScreenWipe_StartParametrized(&wipe);
levelfadecol = cutscenes[cutnum]->scene[scenenum].fadecolor;
}
else
{
ScreenWipe_DoCrossfade(DEFAULTWIPE);
}
// Don't increment until after endcutscene check
......@@ -3873,12 +3869,6 @@ static void F_AdvanceToNextScene(void)
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
S_ChangeMusicEx(cutscenes[cutnum]->scene[scenenum].musswitch,
cutscenes[cutnum]->scene[scenenum].musswitchflags,
cutscenes[cutnum]->scene[scenenum].musicloop,
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
// Fade to the next
F_NewCutscene(cutscenes[cutnum]->scene[scenenum].text);
......@@ -3890,13 +3880,7 @@ static void F_AdvanceToNextScene(void)
animtimer = pictime = cutscenes[cutnum]->scene[scenenum].picduration[picnum];
if (rendermode != render_none)
{
F_CutsceneDrawer();
F_WipeEndScreen();
F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true);
}
ScreenWipe_Start(cutscenes[cutnum]->scene[scenenum].fadeoutid, 0);
}
// See also G_AfterIntermission, the only other place which handles intra-map/ending transitions
......@@ -3926,10 +3910,9 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
if (!cutscenes[cutscenenum])
return;
G_SetGamestate(GS_CUTSCENE);
boolean from_ending = gamestate == GS_ENDING;
if (wipegamestate == GS_CUTSCENE)
wipegamestate = -1;
G_SetGamestate(GS_CUTSCENE);
gameaction = ga_nothing;
paused = false;
......@@ -3965,6 +3948,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
else
S_StopMusic();
S_StopSounds();
if (!from_ending)
ScreenWipe_DoFadeOut(wipedefs[wipe_cutscene_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_cutscene_final], WIPEFLAGS_FADEIN, NULL);
}
//
......@@ -4448,7 +4435,7 @@ void F_TextPromptDrawer(void)
// Data
patch_t *patch;
if (!promptactive)
if (!promptactive || titlecard.prelevel)
return;
iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname);
......@@ -4680,7 +4667,9 @@ void F_TextPromptTicker(void)
void F_StartWaitingPlayers(void)
{
wipegamestate = GS_TITLESCREEN; // technically wiping from title screen
ScreenWipe_DoFadeOut(0, 0, NULL);
ScreenWipe_DoFadeIn(0, WIPEFLAGS_FADEIN, NULL);
finalecount = 0;
}
......@@ -4692,7 +4681,7 @@ void F_WaitingPlayersTicker(void)
finalecount++;
// dumb hack, only start the music on the 1st tick so if you instantly go into the map you aren't hearing a tic of music
if (finalecount == 2)
if (finalecount == 8)
S_ChangeMusicInternal("_CHSEL", true);
}
......
......@@ -10,7 +10,6 @@
//-----------------------------------------------------------------------------
/// \file f_finale.h
/// \brief Title screen, intro, game evaluation, and credits.
/// Also includes protos for screen wipe functions.
#ifndef __F_FINALE__
#define __F_FINALE__
......@@ -74,6 +73,8 @@ void F_StartContinue(void);
void F_ContinueTicker(void);
void F_ContinueDrawer(void);
void F_InitTitleScreen(void);
void F_StartWaitingPlayers(void);
void F_WaitingPlayersTicker(void);
void F_WaitingPlayersDrawer(void);
......@@ -82,6 +83,22 @@ extern INT32 finalecount;
extern INT32 titlescrollxspeed;
extern INT32 titlescrollyspeed;
extern INT32 intro_scenenum;
enum
{
INTRO_STJR = 0,
INTRO_FIRST = 1,
INTRO_ASTEROID = 4,
INTRO_RADAR = 5,
INTRO_GRASS1 = 6,
INTRO_GRASS2 = 7,
INTRO_SKYRUNNER = 10,
INTRO_SONICDO1 = 14,
INTRO_SONICDO2 = 15,
INTRO_LAST = 16
};
typedef enum
{
TTMODE_NONE = 0,
......@@ -103,7 +120,6 @@ extern INT16 ttloop;
extern UINT16 tttics;
extern boolean ttavailable[6];
typedef enum
{
TITLEMAP_OFF = 0,
......@@ -112,7 +128,6 @@ typedef enum
} titlemap_enum;
// Current menu parameters
extern mobj_t *titlemapcameraref;
extern char curbgname[9];
extern SINT8 curfadevalue;
......@@ -125,6 +140,7 @@ extern boolean hidetitlemap;
extern boolean curhidepics;
extern ttmode_enum curttmode;
extern UINT8 curttscale;
// ttmode user vars
extern char curttname[9];
extern INT16 curttx;
......@@ -137,100 +153,4 @@ extern UINT16 curtttics;
void F_InitMenuPresValues(void);
void F_MenuPresTicker(void);
//
// WIPE
//
// HACK for menu fading while titlemapinaction; skips the level check
#define FORCEWIPE -3
#define FORCEWIPEOFF -2
extern boolean WipeInAction;
extern boolean WipeStageTitle;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_COLORMAP
} wipestyle_t;
extern wipestyle_t wipestyle;
typedef enum
{
WSF_FADEOUT = 1,
WSF_FADEIN = 1<<1,
WSF_TOWHITE = 1<<2,
WSF_CROSSFADE = 1<<3,
} wipestyleflags_t;
extern wipestyleflags_t wipestyleflags;
// Even my function names are borderline
boolean F_ShouldColormapFade(void);
boolean F_TryColormapFade(UINT8 wipecolor);
#ifndef NOWIPE
void F_DecideWipeStyle(void);
#endif
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 15
#define FADEGREENFACTOR 15
#define FADEBLUEFACTOR 10
extern INT32 lastwipetic;
// Don't know where else to place this constant
// But this file seems appropriate
#define PRELEVELTIME 24 // frames in tics
void F_WipeStartScreen(void);
void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu);
void F_WipeStageTitle(void);
#define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)
tic_t F_GetWipeLength(UINT8 wipetype);
boolean F_WipeExists(UINT8 wipetype);
enum
{
wipe_credits_intermediate, // makes a good 0 I guess.
wipe_level_toblack,
wipe_intermission_toblack,
wipe_continuing_toblack,
wipe_titlescreen_toblack,
wipe_timeattack_toblack,
wipe_credits_toblack,
wipe_evaluation_toblack,
wipe_gameend_toblack,
wipe_intro_toblack,
wipe_ending_toblack,
wipe_cutscene_toblack,
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
wipe_continuing_final,
wipe_titlescreen_final,
wipe_timeattack_final,
wipe_credits_final,
wipe_evaluation_final,
wipe_gameend_final,
wipe_intro_final,
wipe_ending_final,
wipe_cutscene_final,
// custom intermissions
wipe_specinter_final,
wipe_multinter_final,
NUMWIPEDEFS,
WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack)
};
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif
......@@ -12,13 +12,13 @@
/// \file f_wipe.c
/// \brief SRB2 2.1 custom fade mask "wipe" behavior.
#include "f_finale.h"
#include "f_wipe.h"
#include "i_video.h"
#include "v_video.h"
#include "r_main.h" // framecount
#include "r_state.h" // fadecolormap
#include "r_draw.h" // transtable
#include "p_pspr.h" // tr_transxxx
#include "p_local.h"
#include "st_stuff.h"
#include "w_wad.h"
......@@ -26,11 +26,11 @@
#include "i_time.h"
#include "i_system.h"
#include "i_threads.h"
#include "m_menu.h"
#include "console.h"
#include "d_main.h"
#include "g_game.h"
#include "y_inter.h" // intertype
#include "m_misc.h" // movie mode
#include "doomstat.h"
......@@ -41,10 +41,6 @@
#include "hardware/hw_main.h"
#endif
#if NUMSCREENS < 5
#define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs
#endif
typedef struct fademask_s {
UINT8* mask;
UINT16 width, height;
......@@ -56,14 +52,14 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
99, // wipe_credits_intermediate (0)
0, // wipe_level_toblack
UINT8_MAX, // wipe_intermission_toblack
0, // wipe_intermission_toblack
0, // wipe_continuing_toblack
0, // wipe_titlescreen_toblack
0, // wipe_timeattack_toblack
99, // wipe_credits_toblack
0, // wipe_evaluation_toblack
0, // wipe_gameend_toblack
99, // wipe_intro_toblack (hardcoded)
0, // wipe_intro_toblack (hardcoded)
0, // wipe_ending_toblack
99, // wipe_cutscene_toblack (hardcoded)
......@@ -91,12 +87,23 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
// SCREEN WIPE PACKAGE
//--------------------------------------------------------------------------
boolean WipeInAction = false;
boolean WipeStageTitle = false;
INT32 lastwipetic = 0;
#define WIPEQUEUESIZE 8
static wipe_t wipe_queue[WIPEQUEUESIZE];
static unsigned wipe_numqueued = 0;
static UINT8 wipe_type;
static UINT8 wipe_frame;
static boolean wipe_stopped = false;
static tic_t wipe_holdframes = 0;
static wipestyle_t wipe_style = WIPESTYLE_NORMAL;
static wipeflags_t wipe_flags = 0;
specialwipe_t ranspecialwipe = SPECIALWIPE_NONE;
wipestyle_t wipestyle = WIPESTYLE_NORMAL;
wipestyleflags_t wipestyleflags = WSF_CROSSFADE;
boolean wipe_running = false;
boolean wipe_drawmenuontop = false;
#ifndef NOWIPE
static UINT8 *wipe_scr_start; //screen 3
......@@ -110,7 +117,7 @@ static fixed_t paldiv = 0;
* \return fademask_t for lump
*/
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
static char lumpname[10] = "FADEmmss";
static char lumpname[11] = "FADEmmss";
static fademask_t fm = {NULL,0,0,0,0,0};
lumpnum_t lumpnum;
UINT8 *lump, *mask;
......@@ -162,7 +169,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
{
// Determine pixel to use from fademask
pcolor = &pMasterPalette[*lump++];
if (wipestyle == WIPESTYLE_COLORMAP)
if (wipe_style == WIPESTYLE_COLORMAP)
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
else
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
......@@ -186,20 +193,6 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
return NULL;
}
/** Draw the stage title.
*/
void F_WipeStageTitle(void)
{
// draw level title
if ((WipeStageTitle && st_overlay)
&& (wipestyle == WIPESTYLE_COLORMAP)
&& G_IsTitleCardAvailable())
{
ST_runTitleCard();
ST_drawWipeTitleCard();
}
}
/** Wipe ticker
*
* \param fademask pixels to change
......@@ -327,12 +320,10 @@ static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
{
// wipe screen, start, end
UINT8 *w = wipe_scr;
const UINT8 *s = wipe_scr_start;
const UINT8 *e = wipe_scr_end;
// first pixel for each screen
UINT8 *w_base = w;
const UINT8 *s_base = s;
const UINT8 *e_base = e;
// mask data, end
......@@ -375,47 +366,25 @@ static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
relativepos = (draw_linestart * vid.width) + draw_rowstart;
draw_linestogo = draw_lineend - draw_linestart;
if (*mask == 0)
{
// shortcut - memcpy source to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else if (*mask >= FADECOLORMAPROWS)
{
// shortcut - memcpy target to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else
{
int nmask = *mask;
if (wipestyleflags & WSF_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
int nmask = *mask;
if (wipe_flags & WIPEFLAGS_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = colormap + (nmask * 256);
transtbl = colormap + (nmask * 256);
// DRAWING LOOP
while (draw_linestogo--)
{
w = w_base + relativepos;
s = s_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
// DRAWING LOOP
while (draw_linestogo--)
{
w = w_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
*w++ = transtbl[*e++];
while (draw_rowstogo--)
*w++ = transtbl[*e++];
relativepos += vid.width;
}
// END DRAWING LOOP
relativepos += vid.width;
}
// END DRAWING LOOP
if (++maskx >= fademask->width)
++masky, maskx = 0;
......@@ -427,245 +396,392 @@ static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
}
#endif
/** Save the "before" screen of a wipe.
/** Saves the "before" screen of a wipe.
*/
void F_WipeStartScreen(void)
void ScreenWipe_StartScreen(void)
{
#ifndef NOWIPE
#ifdef HWRENDER
if(rendermode != render_soft)
if (rendermode == render_opengl)
{
HWR_StartScreenWipe();
return;
}
#endif
wipe_scr_start = screens[3];
I_ReadScreen(wipe_scr_start);
#endif
}
/** Save the "after" screen of a wipe.
/** Saves the "after" screen of a wipe.
*/
void F_WipeEndScreen(void)
void ScreenWipe_EndScreen(void)
{
#ifndef NOWIPE
#ifdef HWRENDER
if(rendermode != render_soft)
if (rendermode == render_opengl)
{
HWR_EndScreenWipe();
return;
}
#endif
wipe_scr_end = screens[4];
I_ReadScreen(wipe_scr_end);
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
#endif
}
/** Verifies every condition for a colormapped fade.
*/
boolean F_ShouldColormapFade(void)
static boolean ScreenWipe_CanTint(wipeflags_t flags)
{
#ifndef NOWIPE
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
{
// World
return (gamestate == GS_LEVEL
|| gamestate == GS_TITLESCREEN
// Finales
|| gamestate == GS_CONTINUING
|| gamestate == GS_CREDITS
|| gamestate == GS_EVALUATION
|| gamestate == GS_INTRO
|| gamestate == GS_ENDING
// Menus
|| gamestate == GS_TIMEATTACK);
}
#endif
return false;
if (flags & WIPEFLAGS_CROSSFADE)
return false;
return true;
}
/** Decides what wipe style to use.
*/
#ifndef NOWIPE
void F_DecideWipeStyle(void)
wipestyle_t ScreenWipe_GetStyle(wipeflags_t flags)
{
if (ScreenWipe_CanTint(flags))
return WIPESTYLE_COLORMAP;
else
return WIPESTYLE_NORMAL;
}
static void F_RestartWipe(void)
{
// Set default wipe style
wipestyle = WIPESTYLE_NORMAL;
if (!wipe_numqueued)
return;
wipe_t *curwipe = &wipe_queue[0];
// Check for colormap wipe style
if (F_ShouldColormapFade())
wipestyle = WIPESTYLE_COLORMAP;
wipe_running = true;
wipe_stopped = false;
wipe_type = curwipe->type;
wipe_style = curwipe->style;
wipe_flags = curwipe->flags;
wipe_holdframes = curwipe->holdframes;
wipe_drawmenuontop = curwipe->drawmenuontop;
wipe_frame = 0;
}
#endif
/** Attempt to run a colormap fade,
provided all the conditionals were properly met.
Returns true if so.
I demand you call F_RunWipe after this function.
*/
boolean F_TryColormapFade(UINT8 wipecolor)
void ScreenWipe_StartPending(void)
{
#ifndef NOWIPE
if (F_ShouldColormapFade())
{
#ifdef HWRENDER
if (rendermode == render_opengl)
F_WipeColorFill(wipecolor);
#endif
return true;
}
else
#endif
{
F_WipeColorFill(wipecolor);
return false;
}
if (wipe_numqueued)
F_RestartWipe();
}
/** After setting up the screens you want to wipe,
* calling this will do a 'typical' wipe.
*/
void F_RunWipe(UINT8 wipetype, boolean drawMenu)
void ScreenWipe_Start(UINT8 type, wipeflags_t flags)
{
wipe_t wipe = {0};
wipe.style = ScreenWipe_GetStyle(flags);
wipe.flags = flags;
wipe.type = type;
wipe.drawmenuontop = true;
ScreenWipe_StartParametrized(&wipe);
}
void ScreenWipe_StartParametrized(wipe_t *wipe)
{
#ifdef NOWIPE
(void)wipetype;
(void)drawMenu;
(void)wipe;
#else
tic_t nowtime;
UINT8 wipeframe = 0;
fademask_t *fmask;
if (!paldiv)
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
#endif
// Init the wipe
F_DecideWipeStyle();
WipeInAction = true;
wipe_scr = screens[0];
if (dedicated || wipe_numqueued >= WIPEQUEUESIZE || wipe->type == UINT8_MAX)
{
// Can't queue it, but its callback has to run.
if (wipe->callback)
wipe->callback();
return;
}
// lastwipetic should either be 0 or the tic we last wiped
// on for fade-to-black
for (;;)
wipe_queue[wipe_numqueued] = *wipe;
wipe_numqueued++;
}
/** Runs the current wipe.
*/
void ScreenWipe_Run(void)
{
#ifndef NOWIPE
if (!wipe_numqueued)
return;
if (wipe_stopped)
{
// get fademask first so we can tell if it exists or not
fmask = F_GetFadeMask(wipetype, wipeframe++);
if (!fmask)
break;
wipe_holdframes--;
if (wipe_holdframes <= 0)
ScreenWipe_Stop();
return;
}
// wait loop
while (!((nowtime = I_GetTime()) - lastwipetic))
fademask_t *fmask = F_GetFadeMask(wipe_type, wipe_frame);
if (!fmask)
{
wipe_stopped = true;
if (wipe_holdframes)
{
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
if (!(wipe_flags & WIPEFLAGS_FADEIN))
wipe_frame--;
return;
}
lastwipetic = nowtime;
ScreenWipe_Stop();
return;
}
wipe_frame++;
#else
ScreenWipe_Stop();
#endif
}
/** Stops running the current wipe.
*/
void ScreenWipe_Stop(void)
{
void (*callback)(void) = NULL;
if (wipe_numqueued)
{
callback = wipe_queue[0].callback;
wipe_numqueued--;
if (wipe_numqueued)
memmove(&wipe_queue[0], &wipe_queue[1], wipe_numqueued * sizeof(wipe_t));
}
wipe_stopped = false;
wipe_running = false;
wipe_drawmenuontop = false;
wipe_holdframes = 0;
if (titlecard.wipe)
titlecard.wipe = 0;
if (callback)
callback();
}
void ScreenWipe_StopAll(void)
{
wipe_numqueued = 0;
ScreenWipe_Stop();
}
#ifndef NOWIPE
/** Renders the current wipe into wipe_scr.
*/
static void F_RenderWipe(UINT8 style, UINT8 flags, fademask_t *fmask)
{
if (style == WIPESTYLE_COLORMAP)
{
UINT8 *colormap = fadecolormap;
if (flags & WIPEFLAGS_TOWHITE)
colormap += (FADECOLORMAPROWS * 256);
F_DoColormapWipe(fmask, colormap);
}
else
{
F_DoWipe(fmask);
}
}
// Wipe styles
if (wipestyle == WIPESTYLE_COLORMAP)
{
#ifdef HWRENDER
if (rendermode == render_opengl)
{
// send in the wipe type and wipe frame because we need to cache the graphic
HWR_DoTintedWipe(wipetype, wipeframe-1);
}
else
static void F_RenderWipeHW(UINT8 style, UINT8 type, UINT8 frame)
{
// send in the wipe type and wipe frame because we need to cache the graphic
if (style == WIPESTYLE_COLORMAP)
HWR_DoTintedWipe(type, frame);
else
HWR_DoWipe(type, frame);
}
#endif
#endif
{
UINT8 *colormap = fadecolormap;
if (wipestyleflags & WSF_TOWHITE)
colormap += (FADECOLORMAPROWS * 256);
F_DoColormapWipe(fmask, colormap);
}
// Draw the title card above the wipe
F_WipeStageTitle();
}
else
/** Displays the current wipe.
*/
void ScreenWipe_Display(void)
{
#ifndef NOWIPE
wipe_scr = screens[0];
// get fademask first so we can tell if it exists or not
fademask_t *fmask = F_GetFadeMask(wipe_type, wipe_frame);
if (!fmask)
{
// Save screen for post-wipe
fmask = F_GetFadeMask(wipe_type, wipe_frame-1);
if (fmask)
{
#ifdef HWRENDER
if (rendermode == render_opengl)
{
// send in the wipe type and wipe frame because we need to cache the graphic
HWR_DoWipe(wipetype, wipeframe-1);
}
F_RenderWipeHW(wipe_style, wipe_type, wipe_frame-1);
else
#endif
F_DoWipe(fmask);
F_RenderWipe(wipe_style, wipe_flags, fmask);
ScreenWipe_StartScreen();
}
return;
}
I_OsPolling();
I_UpdateNoBlit();
if (drawMenu)
{
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);
#ifdef HWRENDER
if (rendermode == render_opengl)
F_RenderWipeHW(wipe_style, wipe_type, wipe_frame);
else
#endif
M_Drawer(); // menu is drawn even on top of wipes
#ifdef HAVE_THREADS
I_unlock_mutex(m_menu_mutex);
F_RenderWipe(wipe_style, wipe_flags, fmask);
#endif
}
}
static int F_GetWipedefIndex(void)
{
int index = gamestate; // wipe_xxx_toblack
if (gamestate == GS_INTERMISSION)
{
if (intertype == int_spec) // Special Stage
index = wipe_specinter_toblack;
else if (intertype != int_coop) // Multiplayer
index = wipe_multinter_toblack;
}
return index;
}
wipe_t *ScreenWipe_GetQueued(void)
{
if (wipe_numqueued)
return &wipe_queue[0];
return NULL;
}
I_FinishUpdate(); // page flip or blit buffer
void ScreenWipe_SetupFadeOut(wipeflags_t flags)
{
#ifndef NOWIPE
ScreenWipe_StartScreen();
if (moviemode)
M_SaveFrame();
UINT8 wipecolor = (flags & WIPEFLAGS_TOWHITE) ? 0 : 31;
NetKeepAlive(); // Update the network so we don't cause timeouts
if (ScreenWipe_CanTint(flags))
{
#ifdef HWRENDER
if (rendermode == render_opengl)
ScreenWipe_DoColorFill(wipecolor);
#endif
}
else
{
ScreenWipe_DoColorFill(wipecolor);
}
WipeInAction = false;
WipeStageTitle = false;
ScreenWipe_EndScreen();
#endif
}
void ScreenWipe_DoFadeOutIn(void)
{
ScreenWipe_DoFadeOut(DEFAULTWIPE, 0, NULL);
ScreenWipe_DoFadeIn(DEFAULTWIPE, WIPEFLAGS_FADEIN, NULL);
}
/** Starts the "pre" type of a wipe.
*/
void ScreenWipe_DoFadeOut(INT16 type, wipeflags_t flags, wipe_callback_t callback)
{
if (type == DEFAULTWIPE || !ScreenWipe_Exists(type))
type = wipedefs[F_GetWipedefIndex()];
wipe_t wipe = {0};
wipe.flags = flags;
wipe.style = ScreenWipe_GetStyle(flags);
wipe.type = type;
wipe.drawmenuontop = true;
wipe.callback = callback;
ScreenWipe_StartParametrized(&wipe);
}
/** Starts the "post" type of a wipe.
*/
void ScreenWipe_DoFadeIn(INT16 type, wipeflags_t flags, wipe_callback_t callback)
{
if (type == DEFAULTWIPE || !ScreenWipe_Exists(type))
type = wipedefs[F_GetWipedefIndex() + WIPEFINALSHIFT];
wipe_t wipe = {0};
wipe.flags = flags;
wipe.style = ScreenWipe_GetStyle(flags);
wipe.type = type;
wipe.drawmenuontop = true;
wipe.callback = callback;
ScreenWipe_StartParametrized(&wipe);
}
/** Does a crossfade.
*/
void ScreenWipe_DoCrossfade(INT16 type)
{
wipe_t wipe = {0};
wipe.flags = WIPEFLAGS_CROSSFADE;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = type == DEFAULTWIPE ? wipedefs[F_GetWipedefIndex()] : type;
wipe.drawmenuontop = false;
ScreenWipe_StartParametrized(&wipe);
}
/** Returns tic length of wipe
* One lump equals one tic
*/
tic_t F_GetWipeLength(UINT8 wipetype)
tic_t ScreenWipe_GetLength(UINT8 type)
{
#ifdef NOWIPE
(void)wipetype;
(void)type;
return 0;
#else
static char lumpname[10] = "FADEmmss";
static char lumpname[11] = "FADEmmss";
lumpnum_t lumpnum;
UINT8 wipeframe;
UINT8 frame;
if (wipetype > 99)
if (type > 99)
return 0;
for (wipeframe = 0; wipeframe < 100; wipeframe++)
for (frame = 0; frame < 100; frame++)
{
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipetype, (UINT16)wipeframe);
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT8)type, (UINT8)frame);
lumpnum = W_CheckNumForName(lumpname);
if (lumpnum == LUMPERROR)
return --wipeframe;
return --frame;
}
return --wipeframe;
return --frame;
#endif
}
/** Does the specified wipe exist?
*/
boolean F_WipeExists(UINT8 wipetype)
boolean ScreenWipe_Exists(UINT8 type)
{
#ifdef NOWIPE
(void)wipetype;
(void)type;
return false;
#else
static char lumpname[10] = "FADEmm00";
static char lumpname[11] = "FADEmm00";
lumpnum_t lumpnum;
if (wipetype > 99)
if (type > 99)
return false;
sprintf(&lumpname[4], "%.2hu00", (UINT16)wipetype);
sprintf(&lumpname[4], "%.2hu00", (UINT16)type);
lumpnum = W_CheckNumForName(lumpname);
return !(lumpnum == LUMPERROR);
......
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2023 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file f_wipe.h
/// \brief Screen wipes
#ifndef __F_WIPE__
#define __F_WIPE__
#include "screen.h"
//
// WIPES
//
#if NUMSCREENS < 5
#define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs
#endif
#define DEFAULTWIPE -1
extern boolean wipe_running;
extern boolean wipe_drawmenuontop;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_COLORMAP
} wipestyle_t;
typedef enum
{
WIPEFLAGS_FADEIN = 1,
WIPEFLAGS_TOWHITE = 1<<1,
WIPEFLAGS_CROSSFADE = 1<<2
} wipeflags_t;
typedef void (*wipe_callback_t)(void);
typedef struct
{
UINT8 type;
wipestyle_t style;
wipeflags_t flags;
boolean drawmenuontop;
tic_t holdframes;
wipe_callback_t callback;
} wipe_t;
typedef enum
{
SPECIALWIPE_NONE,
SPECIALWIPE_SSTAGE,
SPECIALWIPE_RETRY,
} specialwipe_t;
extern specialwipe_t ranspecialwipe;
void ScreenWipe_Start(UINT8 type, wipeflags_t flags);
void ScreenWipe_StartParametrized(wipe_t *wipe);
void ScreenWipe_DoFadeOut(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void ScreenWipe_DoFadeIn(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void ScreenWipe_DoFadeOutIn(void);
void ScreenWipe_DoCrossfade(INT16 type);
void ScreenWipe_Run(void);
void ScreenWipe_Display(void);
void ScreenWipe_Stop(void);
void ScreenWipe_StopAll(void);
void ScreenWipe_StartPending(void);
wipe_t *ScreenWipe_GetQueued(void);
wipestyle_t ScreenWipe_GetStyle(wipeflags_t flags);
void ScreenWipe_SetupFadeOut(wipeflags_t flags);
void ScreenWipe_StartScreen(void);
void ScreenWipe_EndScreen(void);
#define ScreenWipe_DoColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 15
#define FADEGREENFACTOR 15
#define FADEBLUEFACTOR 10
tic_t ScreenWipe_GetLength(UINT8 type);
boolean ScreenWipe_Exists(UINT8 type);
enum
{
wipe_credits_intermediate, // makes a good 0 I guess.
wipe_level_toblack,
wipe_intermission_toblack,
wipe_continuing_toblack,
wipe_titlescreen_toblack,
wipe_timeattack_toblack,
wipe_credits_toblack,
wipe_evaluation_toblack,
wipe_gameend_toblack,
wipe_intro_toblack,
wipe_ending_toblack,
wipe_cutscene_toblack,
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
wipe_continuing_final,
wipe_titlescreen_final,
wipe_timeattack_final,
wipe_credits_final,
wipe_evaluation_final,
wipe_gameend_final,
wipe_intro_final,
wipe_ending_final,
wipe_cutscene_final,
// custom intermissions
wipe_specinter_final,
wipe_multinter_final,
NUMWIPEDEFS,
WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack)
};
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif
......@@ -60,6 +60,7 @@ boolean singledemo; // quit after playing a demo from cmdline
boolean demo_start; // don't start playing demo right away
boolean demo_forwardmove_rng; // old demo backwards compatibility
boolean demosynced = true; // console warning message
demoplayer_t *demoplayerinfo; // starting a demo
boolean metalrecording; // recording as metal sonic
mobj_t *metalplayback;
......@@ -1990,10 +1991,8 @@ void G_DoPlayDemo(char *defdemoname)
UINT8 i;
lumpnum_t l;
char skin[17],color[MAXCOLORNAME+1],*n,*pdemoname;
UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration;
pflags_t pflags;
UINT32 randseed, followitem;
fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight;
UINT8 version,subversion;
UINT32 randseed;
char msg[1024];
skin[16] = '\0';
......@@ -2189,35 +2188,47 @@ void G_DoPlayDemo(char *defdemoname)
M_Memcpy(color, demo_p, (demoversion < 0x000d) ? 16 : MAXCOLORNAME);
demo_p += (demoversion < 0x000d) ? 16 : MAXCOLORNAME;
charability = READUINT8(demo_p);
charability2 = READUINT8(demo_p);
actionspd = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
mindash = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
maxdash = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
normalspeed = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
runspeed = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
thrustfactor = READUINT8(demo_p);
accelstart = READUINT8(demo_p);
acceleration = READUINT8(demo_p);
height = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
spinheight = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
camerascale = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
shieldscale = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
jumpfactor = READFIXED(demo_p);
followitem = READUINT32(demo_p);
demoplayer_t *info = Z_Calloc(sizeof(demoplayer_t), PU_STATIC, NULL);
info->charability = READUINT8(demo_p);
info->charability2 = READUINT8(demo_p);
info->actionspd = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->mindash = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->maxdash = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->normalspeed = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->runspeed = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->thrustfactor = READUINT8(demo_p);
info->accelstart = READUINT8(demo_p);
info->acceleration = READUINT8(demo_p);
info->height = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->spinheight = (demoversion < 0x000e) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->camerascale = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->shieldscale = (demoversion < 0x0010) ? (fixed_t)READUINT8(demo_p)<<FRACBITS : READFIXED(demo_p);
info->jumpfactor = READFIXED(demo_p);
info->followitem = READUINT32(demo_p);
// Set color
info->color = SKINCOLOR_NONE;
for (i = 0; i < numskincolors; i++)
if (!stricmp(skincolors[i].name,color))
{
info->color = i;
break;
}
demoplayerinfo = info;
// pflag data
{
UINT8 buf = READUINT8(demo_p);
pflags = 0;
info->pflags = 0;
if (buf & 0x01)
pflags |= PF_FLIPCAM;
info->pflags |= PF_FLIPCAM;
if (buf & 0x02)
pflags |= PF_ANALOGMODE;
info->pflags |= PF_ANALOGMODE;
if (buf & 0x04)
pflags |= PF_DIRECTIONCHAR;
info->pflags |= PF_DIRECTIONCHAR;
if (buf & 0x08)
pflags |= PF_AUTOBRAKE;
info->pflags |= PF_AUTOBRAKE;
CV_SetValue(&cv_showinputjoy, !!(buf & 0x10));
}
......@@ -2239,6 +2250,8 @@ void G_DoPlayDemo(char *defdemoname)
Z_Free(demobuffer);
demoplayback = false;
titledemo = false;
Z_Free(demoplayerinfo);
demoplayerinfo = NULL;
return;
}
......@@ -2262,15 +2275,19 @@ void G_DoPlayDemo(char *defdemoname)
playeringame[0] = true;
P_SetRandSeed(randseed);
G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
}
void G_FinishLoadingDemo(void)
{
demoplayer_t *p = demoplayerinfo;
demo_start = true;
if (p == NULL)
return;
// Set color
players[0].skincolor = skins[players[0].skin]->prefcolor;
for (i = 0; i < numskincolors; i++)
if (!stricmp(skincolors[i].name,color))
{
players[0].skincolor = i;
break;
}
if (p->color != SKINCOLOR_NONE)
players[0].skincolor = p->color;
if (players[0].mo)
{
players[0].mo->color = players[0].skincolor;
......@@ -2282,25 +2299,23 @@ void G_DoPlayDemo(char *defdemoname)
// Set saved attribute values
// No cheat checking here, because even if they ARE wrong...
// it would only break the replay if we clipped them.
players[0].camerascale = camerascale;
players[0].shieldscale = shieldscale;
players[0].charability = charability;
players[0].charability2 = charability2;
players[0].actionspd = actionspd;
players[0].mindash = mindash;
players[0].maxdash = maxdash;
players[0].normalspeed = normalspeed;
players[0].runspeed = runspeed;
players[0].thrustfactor = thrustfactor;
players[0].accelstart = accelstart;
players[0].acceleration = acceleration;
players[0].height = height;
players[0].spinheight = spinheight;
players[0].jumpfactor = jumpfactor;
players[0].followitem = followitem;
players[0].pflags = pflags;
demo_start = true;
players[0].camerascale = p->camerascale;
players[0].shieldscale = p->shieldscale;
players[0].charability = p->charability;
players[0].charability2 = p->charability2;
players[0].actionspd = p->actionspd;
players[0].mindash = p->mindash;
players[0].maxdash = p->maxdash;
players[0].normalspeed = p->normalspeed;
players[0].runspeed = p->runspeed;
players[0].thrustfactor = p->thrustfactor;
players[0].accelstart = p->accelstart;
players[0].acceleration = p->acceleration;
players[0].height = p->height;
players[0].spinheight = p->spinheight;
players[0].jumpfactor = p->jumpfactor;
players[0].followitem = p->followitem;
players[0].pflags = p->pflags;
}
//
......@@ -2858,11 +2873,14 @@ void G_StopDemo(void)
timingdemo = false;
singletics = false;
if (demoplayerinfo)
Z_Free(demoplayerinfo);
demoplayerinfo = NULL;
if (gamestate == GS_INTERMISSION)
Y_EndIntermission(); // cleanup
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
SV_StopServer();
SV_ResetServer();
}
......
......@@ -41,6 +41,16 @@ extern boolean demo_start;
extern boolean demo_forwardmove_rng;
extern boolean demosynced;
typedef struct
{
UINT8 charability,charability2,thrustfactor,accelstart,acceleration;
pflags_t pflags;
UINT32 followitem;
fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight;
INT32 color;
} demoplayer_t;
extern demoplayer_t *demoplayerinfo;
extern mobj_t *metalplayback;
// Only called by startup code.
......@@ -95,6 +105,7 @@ void G_LoadMetal(UINT8 **buffer);
void G_DeferedPlayDemo(const char *demo);
void G_DoPlayDemo(char *defdemoname);
void G_FinishLoadingDemo(void);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
void G_FreeGhosts(void);
......
This diff is collapsed.
......@@ -36,6 +36,10 @@ extern boolean playeringame[MAXPLAYERS];
// gametic at level start
extern tic_t levelstarttic;
extern boolean levelstarting; // starting the level
extern boolean leveldemoload; // starting a demo
extern boolean levelresetplayer; // reset players at level load
// for modding?
extern INT16 prevmap, nextmap;
extern INT32 gameovertics;
......@@ -177,10 +181,35 @@ void G_SpawnPlayer(INT32 playernum);
// Can be called by the startup code or M_Responder.
// A normal game starts at map 1, but a warp test can start elsewhere
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 character, boolean SSSG, boolean FLS);
void G_DoLoadLevel(boolean resetplayer);
void G_StartTitleCard(void);
void G_PreLevelTitleCard(void);
boolean G_IsTitleCardAvailable(void);
void G_StartLevel(boolean resetplayer);
void G_StartLevelWipe(void);
void G_InitLevelGametype(void);
void G_DoLoadLevel(void);
// Title card
void TitleCard_Start(void);
void TitleCard_Run(void);
void TitleCard_Stop(void);
void TitleCard_LoadGraphics(void);
boolean TitleCard_IsAvailable(void);
typedef struct
{
boolean running, prelevel;
UINT8 wipe;
tic_t ticker;
tic_t exitticker, endtime;
fixed_t zigzag, scroll, momentum;
void *patches[3];
} titlecard_t;
extern titlecard_t titlecard;
#define PRELEVELTIME 24 // frames in tics
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
void G_LoadGame(UINT32 slot, INT16 mapoverride);
......@@ -234,13 +263,31 @@ void G_SetExitGameFlag(void);
void G_ClearExitGameFlag(void);
boolean G_GetExitGameFlag(void);
void G_SetRetryFlag(void);
void G_ClearRetryFlag(void);
boolean G_GetRetryFlag(void);
enum
{
RETRY_SP, // Retrying in Single Player.
RETRY_RA, // Retrying in Mode Attack.
// Cleared at G_DoLoadLevel.
RETRY_CUR, // Currently retrying.
RETRY_PAUSED, // Retrying while paused.
RETRY_MAX,
};
void G_SetRetryFlag(INT32 type);
void G_ClearRetryFlag(INT32 type);
boolean G_GetRetryFlag(INT32 type);
void G_SetRetrySP(void);
void G_ClearRetrySP(void);
boolean G_GetRetrySP(void);
void G_SetRetryRA(void);
void G_ClearRetryRA(void);
boolean G_GetRetryRA(void);
void G_SetModeAttackRetryFlag(void);
void G_ClearModeAttackRetryFlag(void);
boolean G_GetModeAttackRetryFlag(void);
void G_ClearAllRetryFlags(void);
void G_LoadGameData(gamedata_t *data);
void G_LoadGameSettings(void);
......
......@@ -22,7 +22,6 @@
#include "hw_drv.h"
#include "../m_misc.h" //FIL_WriteFile()
#include "../r_draw.h" //viewborderlump
#include "../r_main.h"
#include "../w_wad.h"
#include "../z_zone.h"
......@@ -62,63 +61,6 @@ static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
//
// -----------------+
// HWR_DrawPatch : Draw a 'tile' graphic
// Notes : x,y : positions relative to the original Doom resolution
// : textes(console+score) + menus + status bar
// -----------------+
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
{
FOutVector v[4];
FBITFIELD flags;
GLPatch_t *hwrPatch;
// 3--2
// | /|
// |/ |
// 0--1
float sdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
float pdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
// make patch ready in hardware cache
HWR_GetPatch(gpatch);
hwrPatch = ((GLPatch_t *)gpatch->hardware);
switch (option & V_SCALEPATCHMASK)
{
case V_NOSCALEPATCH:
pdup = 2.0f;
break;
case V_SMALLSCALEPATCH:
pdup = 2.0f * FIXED_TO_FLOAT(vid.fsmalldup);
break;
case V_MEDSCALEPATCH:
pdup = 2.0f * FIXED_TO_FLOAT(vid.fmeddup);
break;
}
if (option & V_NOSCALESTART)
sdup = 2.0f;
v[0].x = v[3].x = (x*sdup-(gpatch->leftoffset)*pdup)/vid.width - 1;
v[2].x = v[1].x = (x*sdup+(gpatch->width-gpatch->leftoffset)*pdup)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdup-(gpatch->topoffset)*pdup)/vid.height;
v[2].y = v[3].y = 1-(y*sdup+(gpatch->height-gpatch->topoffset)*pdup)/vid.height;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = hwrPatch->max_s;
v[0].t = v[1].t = 0.0f;
v[2].t = v[3].t = hwrPatch->max_t;
flags = PF_Translucent|PF_NoDepthTest;
// clip it since it is used for bunny scroll in doom I
HWD.pfnDrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
{
FOutVector v[4];
......@@ -992,135 +934,6 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
}
// ==========================================================================
// R_DRAW.C STUFF
// ==========================================================================
// ------------------
// HWR_DrawViewBorder
// Fill the space around the view window with a Doom flat texture, draw the
// beveled edges.
// 'clearlines' is useful to clear the heads up messages, when the view
// window is reduced, it doesn't refresh all the view borders.
// ------------------
void HWR_DrawViewBorder(INT32 clearlines)
{
INT32 x, y;
INT32 top, side;
INT32 baseviewwidth, baseviewheight;
INT32 basewindowx, basewindowy;
patch_t *patch;
// if (gl_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdup)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdup));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdup));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdup));
// top
HWR_DrawFlatFill(0, 0,
BASEVIDWIDTH, (top < clearlines ? top : clearlines),
st_borderpatchnum);
// left
if (top < clearlines)
HWR_DrawFlatFill(0, top, side,
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
st_borderpatchnum);
// right
if (top < clearlines)
HWR_DrawFlatFill(side + baseviewwidth, top, side,
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
st_borderpatchnum);
// bottom
if (top + baseviewheight < clearlines)
HWR_DrawFlatFill(0, top + baseviewheight,
BASEVIDWIDTH, BASEVIDHEIGHT, st_borderpatchnum);
//
// draw the view borders
//
basewindowx = (BASEVIDWIDTH - baseviewwidth)>>1;
if (baseviewwidth == BASEVIDWIDTH)
basewindowy = 0;
else
basewindowy = top;
// top edge
if (clearlines > basewindowy - 8)
{
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
for (x = 0; x < baseviewwidth; x += 8)
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
0);
}
// bottom edge
if (clearlines > basewindowy + baseviewheight)
{
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
for (x = 0; x < baseviewwidth; x += 8)
HWR_DrawPatch(patch, basewindowx + x,
basewindowy + baseviewheight, 0);
}
// left edge
if (clearlines > basewindowy)
{
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
y += 8)
{
HWR_DrawPatch(patch, basewindowx - 8, basewindowy + y,
0);
}
}
// right edge
if (clearlines > basewindowy)
{
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
y += 8)
{
HWR_DrawPatch(patch, basewindowx + baseviewwidth,
basewindowy + y, 0);
}
}
// Draw beveled corners.
if (clearlines > basewindowy - 8)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
PU_PATCH),
basewindowx - 8, basewindowy - 8, 0);
if (clearlines > basewindowy - 8)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
PU_PATCH),
basewindowx + baseviewwidth, basewindowy - 8, 0);
if (clearlines > basewindowy+baseviewheight)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
PU_PATCH),
basewindowx - 8, basewindowy + baseviewheight, 0);
if (clearlines > basewindowy + baseviewheight)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
PU_PATCH),
basewindowx + baseviewwidth,
basewindowy + baseviewheight, 0);
}
// ==========================================================================
// AM_MAP.C DRAWING STUFF
// ==========================================================================
......
......@@ -35,11 +35,9 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_ClearSkyDome(void);
void HWR_BuildSkyDome(void);
void HWR_DrawViewBorder(INT32 clearlines);
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
void HWR_InitTextureMapping(void);
void HWR_SetViewSize(void);
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option);
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
......
......@@ -3169,6 +3169,54 @@ EXPORT void HWRAPI(FlushScreenTextures) (void)
finalScreenTexture = 0;
}
// Draws a screen texture.
static void DrawScreenTexture(GLuint tex)
{
float xfix, yfix;
INT32 texsize = 2048;
const float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
float fix[8];
if(screen_width <= 1024)
texsize = 1024;
if(screen_width <= 512)
texsize = 512;
xfix = 1/((float)(texsize)/((float)((screen_width))));
yfix = 1/((float)(texsize)/((float)((screen_height))));
// const float screenVerts[12]
// float fix[8];
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
fix[3] = yfix;
fix[4] = xfix;
fix[5] = yfix;
fix[6] = xfix;
fix[7] = 0.0f;
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
pglBindTexture(GL_TEXTURE_2D, tex);
pglColor4ubv(white);
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
tex_downloaded = tex;
}
// Create Screen to fade from
EXPORT void HWRAPI(StartScreenWipe) (void)
{
......@@ -3231,53 +3279,10 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
tex_downloaded = endScreenWipe;
}
// Draw the last scene under the intermission
EXPORT void HWRAPI(DrawIntermissionBG)(void)
{
float xfix, yfix;
INT32 texsize = 2048;
const float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
float fix[8];
if(screen_width <= 1024)
texsize = 1024;
if(screen_width <= 512)
texsize = 512;
xfix = 1/((float)(texsize)/((float)((screen_width))));
yfix = 1/((float)(texsize)/((float)((screen_height))));
// const float screenVerts[12]
// float fix[8];
fix[0] = 0.0f;
fix[1] = 0.0f;
fix[2] = 0.0f;
fix[3] = yfix;
fix[4] = xfix;
fix[5] = yfix;
fix[6] = xfix;
fix[7] = 0.0f;
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
pglBindTexture(GL_TEXTURE_2D, screentexture);
pglColor4ubv(white);
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
tex_downloaded = screentexture;
DrawScreenTexture(screentexture);
}
// Do screen fades!
......
......@@ -1817,7 +1817,7 @@ static inline void HU_DrawCrosshairs(void)
INT32 cross1 = cv_crosshair.value & 3;
INT32 cross2 = cv_crosshair2.value & 3;
if (automapactive || demoplayback)
if (automapactive || demoplayback || titlecard.prelevel)
return;
stplyr = ((stplyr == &players[displayplayer]) ? &players[secondarydisplayplayer] : &players[displayplayer]);
......@@ -2042,76 +2042,6 @@ void HU_Drawer(void)
}
}
//======================================================================
// HUD MESSAGES CLEARING FROM SCREEN
//======================================================================
// Clear old messages from the borders around the view window
// (only for reduced view, refresh the borders when needed)
//
// startline: y coord to start clear,
// clearlines: how many lines to clear.
//
static INT32 oldclearlines;
void HU_Erase(void)
{
INT32 topline, bottomline;
INT32 y, yoffset;
#ifdef HWRENDER
// clear hud msgs on double buffer (OpenGL mode)
boolean secondframe;
static INT32 secondframelines;
#endif
if (con_clearlines == oldclearlines && !con_hudupdate && !chat_on)
return;
#ifdef HWRENDER
// clear the other frame in double-buffer modes
secondframe = (con_clearlines != oldclearlines);
if (secondframe)
secondframelines = oldclearlines;
#endif
// clear the message lines that go away, so use _oldclearlines_
bottomline = oldclearlines;
oldclearlines = con_clearlines;
if (chat_on && OLDCHAT)
if (bottomline < 8)
bottomline = 8; // only do it for consolechat. consolechat is gay.
if (automapactive || viewwindowx == 0) // hud msgs don't need to be cleared
return;
// software mode copies view border pattern & beveled edges from the backbuffer
if (rendermode == render_soft)
{
topline = 0;
for (y = topline, yoffset = y*vid.width; y < bottomline; y++, yoffset += vid.width)
{
if (y < viewwindowy || y >= viewwindowy + viewheight)
R_VideoErase(yoffset, vid.width); // erase entire line
else
{
R_VideoErase(yoffset, viewwindowx); // erase left border
// erase right border
R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx);
}
}
con_hudupdate = false; // if it was set..
}
#ifdef HWRENDER
else if (rendermode != render_none)
{
// refresh just what is needed from the view borders
HWR_DrawViewBorder(secondframelines);
con_hudupdate = secondframe;
}
#endif
}
//======================================================================
// IN-LEVEL MULTIPLAYER RANKINGS
//======================================================================
......@@ -2208,10 +2138,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
HU_DrawEmeralds(x-12,y+2,tab[i].emeralds);
}
if (greycheck)
V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, livesback);
else
V_DrawSmallScaledPatch (x, y-4, 0, livesback);
V_DrawSmallScaledPatch (x, y-4, greycheck ? V_80TRANS : 0, livesback);
if (tab[i].color == 0)
{
......@@ -2220,10 +2147,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
V_DrawSmallScaledPatch(x, y-4, 0, superprefix[players[tab[i].num].skin]);
else
{
if (greycheck)
V_DrawSmallTranslucentPatch(x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]);
else
V_DrawSmallScaledPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin]);
V_DrawSmallScaledPatch(x, y-4, greycheck ? V_80TRANS : 0, faceprefix[players[tab[i].num].skin]);
}
}
else
......@@ -2237,7 +2161,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (greycheck)
V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
V_DrawSmallMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
......@@ -2247,10 +2171,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
{
if (greycheck)
V_DrawSmallTranslucentPatch(x-32, y-4, V_60TRANS, tagico);
else
V_DrawSmallScaledPatch(x-32, y-4, 0, tagico);
V_DrawSmallScaledPatch(x-32, y-4, greycheck ? V_60TRANS : 0, tagico);
}
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
......@@ -2506,7 +2427,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (greycheck)
V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
V_DrawSmallMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
......@@ -2580,10 +2501,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]);
else
{
if (greycheck)
V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]);
else
V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
V_DrawSmallScaledPatch (x, y-4, greycheck ? V_80TRANS : 0, faceprefix[players[tab[i].num].skin]);
}
}
else
......@@ -2597,7 +2515,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (greycheck)
V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
V_DrawSmallMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
......
......@@ -111,7 +111,6 @@ boolean HU_Responder(event_t *ev);
void HU_Ticker(void);
void HU_Drawer(void);
char HU_dequeueChatChar(void);
void HU_Erase(void);
void HU_clearChatChars(void);
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags); // Lat': Ping drawer for scoreboard.
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
......
......@@ -1445,8 +1445,8 @@ void LUA_SetHudHook(int hook, huddrawlist_h list)
case HUD_HOOK(titlecard):
LUA_PushUserdata(gL, stplyr, META_PLAYER);
lua_pushinteger(gL, lt_ticker);
lua_pushinteger(gL, (lt_endtime + TICRATE));
lua_pushinteger(gL, titlecard.ticker);
lua_pushinteger(gL, titlecard.endtime + TICRATE);
break;
case HUD_HOOK(intermission):
......
......@@ -47,6 +47,7 @@
#include "p_local.h"
#include "p_setup.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "lua_hook.h"
#ifdef HWRENDER
......@@ -2954,7 +2955,6 @@ static void M_HandleMenuPresState(menu_t *newMenu)
}
}
// Set the wipes for next frame
if (
(exitwipe >= 0 && enterlevel <= exitlevel) ||
......@@ -2962,14 +2962,16 @@ static void M_HandleMenuPresState(menu_t *newMenu)
(anceslevel < 0 && newMenu != &MainDef && currentMenu != &MainDef)
)
{
INT16 wipetypepre = DEFAULTWIPE;
INT16 wipetypepost = DEFAULTWIPE;
if (gamestate == GS_TIMEATTACK)
wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : -1; // force default
wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : DEFAULTWIPE; // force default
else
// HACK: INT16_MAX signals to not wipe
// because 0 is a valid index and -1 means default
wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : INT16_MAX;
wipetypepost = ((enterwipe && enterlevel >= exitlevel) || anceslevel < 0) ? enterwipe : INT16_MAX;
wipegamestate = FORCEWIPE;
// If just one of the above is a force not-wipe,
// mirror the other wipe.
......@@ -2978,7 +2980,9 @@ static void M_HandleMenuPresState(menu_t *newMenu)
else if (wipetypepost != INT16_MAX && wipetypepre == INT16_MAX)
wipetypepre = wipetypepost;
// D_Display runs the next step of processing
ScreenWipe_StopAll();
ScreenWipe_DoFadeOut(wipetypepre, 0, NULL);
ScreenWipe_DoFadeIn(wipetypepost, 0, NULL);
}
}
......@@ -3002,7 +3006,6 @@ static void M_GoBack(INT32 choice)
if ((currentMenu->prevMenu == &MainDef) && (currentMenu == &SP_TimeAttackDef || currentMenu == &SP_NightsAttackDef || currentMenu == &SP_MarathonDef))
{
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
if (levelselect.rows)
{
Z_Free(levelselect.rows);
......@@ -3010,7 +3013,7 @@ static void M_GoBack(INT32 choice)
}
menuactive = false;
wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe;
ScreenWipe_DoFadeOut(menupres[M_GetYoungestChildMenu()].exitwipe, 0, F_InitTitleScreen);
I_UpdateMouseGrab();
D_StartTitle();
}
......@@ -3168,7 +3171,10 @@ boolean M_Responder(event_t *ev)
if (gamestate == GS_TITLESCREEN && finalecount < (cv_tutorialprompt.value ? TICRATE : 0))
return false;
if (CON_Ready() && gamestate != GS_WAITINGPLAYERS)
if (gamestate == GS_TIMEATTACK && wipe_running)
return false;
if (CON_Ready())
return false;
if (noFurtherInput)
......@@ -3567,15 +3573,13 @@ boolean M_Responder(event_t *ev)
//
void M_Drawer(void)
{
boolean wipe = WipeInAction;
if (currentMenu == &MessageDef)
menuactive = true;
if (menuactive)
if (menuactive && gamestate != GS_TIMEATTACK)
{
// now that's more readable with a faded background (yeah like Quake...)
if (!wipe && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK)))
if (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK))
V_DrawFadeScreen(0xFF00, (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) ? 16 : curfadevalue);
if (currentMenu->drawroutine)
......@@ -3613,6 +3617,12 @@ void M_Drawer(void)
}
}
void M_TimeAttackDrawer(void)
{
if (currentMenu->drawroutine)
currentMenu->drawroutine();
}
//
// M_StartControlPanel
//
......@@ -3654,8 +3664,8 @@ void M_StartControlPanel(void)
{
// Devmode unlocks Pandora's Box in the pause menu
boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode);
if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff.
if (gamestate != GS_LEVEL || ultimatemode || G_GetRetryFlag(RETRY_CUR)) // Can't retry if you're already retrying... chief.
{
SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED);
SPauseMenu[spause_retry].status = IT_GRAYEDOUT;
......@@ -3743,7 +3753,7 @@ void M_StartControlPanel(void)
void M_EndModeAttackRun(void)
{
G_ClearModeAttackRetryFlag();
G_ClearRetryRA();
M_ModeAttackEndGame(0);
}
......@@ -4098,53 +4108,6 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines)
{
// Solid color textbox.
V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 159);
//V_DrawFill(x+8, y+8, width*8, boxlines*8, 31);
/*
patch_t *p;
INT32 cx, cy, n;
INT32 step, boff;
step = 8;
boff = 8;
// draw left side
cx = x;
cy = y;
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TL], PU_PATCH));
cy += boff;
p = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
for (n = 0; n < boxlines; n++)
{
V_DrawScaledPatch(cx, cy, 0, p);
cy += step;
}
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BL], PU_PATCH));
// draw middle
V_DrawFlatFill(x + boff, y + boff, width*step, boxlines*step, st_borderpatchnum);
cx += boff;
cy = y;
while (width > 0)
{
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH));
V_DrawScaledPatch(cx, y + boff + boxlines*step, 0, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH));
width--;
cx += step;
}
// draw right side
cy = y;
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TR], PU_PATCH));
cy += boff;
p = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
for (n = 0; n < boxlines; n++)
{
V_DrawScaledPatch(cx, cy, 0, p);
cy += step;
}
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BR], PU_PATCH));
*/
}
//
......@@ -7074,7 +7037,7 @@ static void M_RetryResponse(INT32 ch)
return;
M_ClearMenus(true);
G_SetRetryFlag();
G_SetRetrySP();
}
static void M_Retry(INT32 choice)
......@@ -9401,7 +9364,6 @@ static void M_HandleChoosePlayerMenu(INT32 choice)
case KEY_ENTER:
S_StartSound(NULL, sfx_menu1);
char_scroll = 0; // finish scrolling the menu
M_DrawSetupChoosePlayerMenu(); // draw the finally selected character one last time for the fadeout
// Is this a hack?
charseltimer = 0;
M_ChoosePlayer(char_on);
......@@ -10220,6 +10182,8 @@ static void M_TimeAttack(INT32 choice)
M_PatchSkinNameTable();
ScreenWipe_StopAll();
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
M_SetupNextMenu(&SP_TimeAttackDef);
......@@ -10228,6 +10192,12 @@ static void M_TimeAttack(INT32 choice)
else
Nextmap_OnChange();
if (!ScreenWipe_GetQueued())
{
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_TIMEATTACK].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
itemOn = tastart; // "Start" is selected.
}
......@@ -10458,6 +10428,8 @@ static void M_NightsAttack(INT32 choice)
// This is really just to make sure Sonic is the played character, just in case
M_PatchSkinNameTable();
ScreenWipe_StopAll();
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
M_SetupNextMenu(&SP_NightsAttackDef);
......@@ -10466,6 +10438,12 @@ static void M_NightsAttack(INT32 choice)
else
Nextmap_OnChange();
if (!ScreenWipe_GetQueued())
{
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_NIGHTSATTACK].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
itemOn = nastart; // "Start" is selected.
}
......@@ -10756,7 +10734,7 @@ static void M_SetGuestReplay(INT32 choice)
void M_ModeAttackRetry(INT32 choice)
{
(void)choice;
// todo -- maybe seperate this out and G_SetRetryFlag() here instead? is just calling this from the menu 100% safe?
// todo -- maybe seperate this out and G_SetRetrySP() here instead? is just calling this from the menu 100% safe?
G_CheckDemoStatus(); // Cancel recording
if (modeattacking == ATTACKING_RECORD)
M_ChooseTimeAttack(0);
......@@ -10773,23 +10751,31 @@ static void M_ModeAttackEndGame(INT32 choice)
Command_ExitGame_f();
M_StartControlPanel();
INT16 wipetype;
switch(modeattacking)
{
default:
case ATTACKING_RECORD:
currentMenu = &SP_TimeAttackDef;
wipetypepost = menupres[MN_SP_TIMEATTACK].enterwipe;
wipetype = menupres[MN_SP_TIMEATTACK].enterwipe;
break;
case ATTACKING_NIGHTS:
currentMenu = &SP_NightsAttackDef;
wipetypepost = menupres[MN_SP_NIGHTSATTACK].enterwipe;
wipetype = menupres[MN_SP_NIGHTSATTACK].enterwipe;
break;
}
itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE;
M_ChangeMenuMusic("_title", true);
Nextmap_OnChange();
ScreenWipe_StopAll();
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipetype, WIPEFLAGS_FADEIN, NULL);
}
static void M_MarathonLiveEventBackup(INT32 choice)
......@@ -10862,6 +10848,8 @@ static void M_Marathon(INT32 choice)
M_ChangeMenuMusic("spec8", true);
ScreenWipe_StopAll();
SP_MarathonDef.prevMenu = &MainDef;
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
......@@ -10869,6 +10857,12 @@ static void M_Marathon(INT32 choice)
itemOn = marathonstart; // "Start" is selected.
recatkdrawtimer = (50-8) * FRACUNIT;
char_scroll = 0;
if (!ScreenWipe_GetQueued())
{
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_MARATHON].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
}
static void M_HandleMarathonChoosePlayer(INT32 choice)
......