mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-30 13:00:54 +00:00
Fade-in intro
Also made flashing not-local, again.
This commit is contained in:
parent
5202629246
commit
c0aa630c63
10 changed files with 101 additions and 54 deletions
|
@ -1166,7 +1166,7 @@ static inline void CL_DrawConnectionStatus(void)
|
|||
INT32 ccstime = I_GetTime();
|
||||
|
||||
// Draw background fade
|
||||
V_DrawFadeScreen();
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
||||
// Draw the bottom box.
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
|
|
|
@ -207,7 +207,7 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2);
|
|||
UINT16 extralifetics = 4*TICRATE;
|
||||
|
||||
// SRB2kart
|
||||
tic_t introtime = 108;
|
||||
tic_t introtime = 108+5; // plus 5 for white fade
|
||||
tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
||||
INT32 hyudorotime = 7*TICRATE;
|
||||
INT32 stealtime = TICRATE/2;
|
||||
|
|
|
@ -576,29 +576,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
|||
// | /|
|
||||
// |/ |
|
||||
// 0--1
|
||||
void HWR_FadeScreenMenuBack(UINT32 color, INT32 height)
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
// setup some neat-o translucency effect
|
||||
if (!height) //cool hack 0 height is full height
|
||||
height = vid.height;
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = 1.0f-((height<<1)/(float)vid.height);
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = (UINT8)((0xff/2) * ((float)height / vid.height)); //calum: varies console alpha
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.FlatColor.s.alpha = (strength*8);
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = pLocalPalette[color].rgba;
|
||||
Surf.FlatColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
|
|
|
@ -33,7 +33,7 @@ void HWR_Shutdown(void);
|
|||
|
||||
void HWR_clearAutomap(void);
|
||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||
void HWR_FadeScreenMenuBack(UINT32 color, INT32 height);
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||
void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player);
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
|
|
12
src/k_kart.c
12
src/k_kart.c
|
@ -4786,7 +4786,7 @@ static void K_drawBattleFullscreen(void)
|
|||
if (stplyr->exiting)
|
||||
{
|
||||
if (stplyr == &players[displayplayer])
|
||||
V_DrawFadeScreen();
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
if (stplyr->kartstuff[k_balloon])
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
|
||||
else if (splitscreen < 2)
|
||||
|
@ -4819,7 +4819,7 @@ static void K_drawBattleFullscreen(void)
|
|||
ty += (BASEVIDHEIGHT/2);
|
||||
}
|
||||
else
|
||||
V_DrawFadeScreen();
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
||||
if (!comebackshowninfo)
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battleinfo, NULL);
|
||||
|
@ -4867,6 +4867,14 @@ void K_drawKartHUD(void)
|
|||
// This is handled by console/menu values
|
||||
K_initKartHUD();
|
||||
|
||||
if (leveltime < 15 && stplyr == &players[displayplayer]) // Draw a white fade on level opening
|
||||
{
|
||||
if (leveltime < 5)
|
||||
V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,120); // Pure white on first three frames, to hide SRB2's awful level load artifacts
|
||||
else
|
||||
V_DrawFadeScreen(120, 15-leveltime); // Then gradually fade out from there
|
||||
}
|
||||
|
||||
if (splitscreen == 2) // Player 4 in 3P is basically the minimap :p
|
||||
K_drawKartMinimap();
|
||||
|
||||
|
|
|
@ -424,6 +424,30 @@ static int libd_drawFill(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int libd_fadeScreen(lua_State *L)
|
||||
{
|
||||
UINT16 color = luaL_checkinteger(L, 1);
|
||||
UINT8 strength = luaL_checkinteger(L, 2);
|
||||
const UINT8 maxstrength = ((color & 0xFF00) ? 32 : 10);
|
||||
|
||||
HUDONLY
|
||||
|
||||
if (!strength)
|
||||
return 0;
|
||||
|
||||
if (strength > maxstrength)
|
||||
return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength);
|
||||
|
||||
if (strength == maxstrength) // Allow as a shortcut for drawfill...
|
||||
{
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, ((color & 0xFF00) ? 31 : color));
|
||||
return 0;
|
||||
}
|
||||
|
||||
V_DrawFadeScreen(color, strength);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libd_drawString(lua_State *L)
|
||||
{
|
||||
fixed_t x = luaL_checkinteger(L, 1);
|
||||
|
@ -568,6 +592,7 @@ static luaL_Reg lib_draw[] = {
|
|||
{"drawNum", libd_drawNum},
|
||||
{"drawPaddedNum", libd_drawPaddedNum},
|
||||
{"drawFill", libd_drawFill},
|
||||
{"fadeScreen", libd_fadeScreen},
|
||||
{"drawString", libd_drawString},
|
||||
{"stringWidth", libd_stringWidth},
|
||||
{"getColormap", libd_getColormap},
|
||||
|
|
|
@ -2677,7 +2677,7 @@ void M_Drawer(void)
|
|||
{
|
||||
// now that's more readable with a faded background (yeah like Quake...)
|
||||
if (!WipeInAction)
|
||||
V_DrawFadeScreen();
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
||||
if (currentMenu->drawroutine)
|
||||
currentMenu->drawroutine(); // call current menu Draw routine
|
||||
|
|
29
src/p_user.c
29
src/p_user.c
|
@ -8184,6 +8184,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camrotate = cv_cam4_rotate.value;
|
||||
else
|
||||
camrotate = 0;
|
||||
if (leveltime < introtime) // Whoooshy camera!
|
||||
{
|
||||
const INT32 introcam = (introtime - leveltime);
|
||||
camrotate += introcam*5;
|
||||
}
|
||||
thiscam->angle = focusangle + FixedAngle(camrotate*FRACUNIT);
|
||||
P_ResetCamera(player, thiscam);
|
||||
return true;
|
||||
|
@ -9555,21 +9560,17 @@ void P_PlayerThink(player_t *player)
|
|||
player->losstime--;
|
||||
|
||||
// Flash player after being hit.
|
||||
if (!(player->pflags & PF_NIGHTSMODE))
|
||||
if (!(player->pflags & PF_NIGHTSMODE
|
||||
|| player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should.
|
||||
|| player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either.
|
||||
|| (G_BattleGametype() && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])
|
||||
|| leveltime < starttime)) // Level intro
|
||||
{
|
||||
// SRB2kart - fixes Hyudoro not flashing when it should. Grow doesn't flash either. Flashing is local.
|
||||
if ((player == &players[displayplayer]
|
||||
|| (splitscreen && player == &players[secondarydisplayplayer])
|
||||
|| (splitscreen > 1 && player == &players[thirddisplayplayer])
|
||||
|| (splitscreen > 2 && player == &players[fourthdisplayplayer]))
|
||||
&& player->kartstuff[k_hyudorotimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0
|
||||
&& (player->kartstuff[k_comebacktimer] == 0 || (G_RaceGametype() || player->kartstuff[k_balloon] > 0)))
|
||||
{
|
||||
if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing() && (leveltime & 1))
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing()
|
||||
&& (leveltime & 1))
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
else if (player->mo->tracer)
|
||||
{
|
||||
|
|
|
@ -953,25 +953,34 @@ void V_DrawPatchFill(patch_t *pat)
|
|||
//
|
||||
// Fade all the screen buffer, so that the menu is more readable,
|
||||
// especially now that we use the small hufont in the menus...
|
||||
// If color is 0x00 to 0xFF, draw transtable (strength range 0-9).
|
||||
// Else, use COLORMAP lump (strength range 0-31).
|
||||
// IF YOU ARE NOT CAREFUL, THIS CAN AND WILL CRASH!
|
||||
// I have kept the safety checks out of this function;
|
||||
// the v.fadeScreen Lua interface handles those.
|
||||
//
|
||||
void V_DrawFadeScreen(void)
|
||||
void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
{
|
||||
const UINT8 *fadetable = (UINT8 *)colormaps + 16*256;
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
UINT8 *buf = screens[0];
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_FadeScreenMenuBack(0x01010160, 0); // hack, 0 means full height
|
||||
return;
|
||||
}
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_FadeScreenMenuBack(color, strength);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// heavily simplified -- we don't need to know x or y
|
||||
// position when we're doing a full screen fade
|
||||
for (; buf < deststop; ++buf)
|
||||
*buf = fadetable[*buf];
|
||||
{
|
||||
const UINT8 *fadetable = ((color & 0xFF00) // Color is not palette index?
|
||||
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
||||
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
UINT8 *buf = screens[0];
|
||||
|
||||
// heavily simplified -- we don't need to know x or y
|
||||
// position when we're doing a full screen fade
|
||||
for (; buf < deststop; ++buf)
|
||||
*buf = fadetable[*buf];
|
||||
}
|
||||
}
|
||||
|
||||
// Simple translucency with one color, over a set number of lines starting from the top.
|
||||
|
|
|
@ -143,7 +143,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
|||
void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum);
|
||||
|
||||
// fade down the screen buffer before drawing the menu over
|
||||
void V_DrawFadeScreen(void);
|
||||
void V_DrawFadeScreen(UINT16 color, UINT8 strength);
|
||||
|
||||
void V_DrawFadeConsBack(INT32 plines);
|
||||
|
||||
|
|
Loading…
Reference in a new issue