Skip to content

Commit

Permalink
Blackout wipe texture when playing a movie
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Nov 14, 2023
1 parent e4d0c87 commit df05465
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source_files/edge/i_movie.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "i_system.h"
#include "r_gldefs.h"
#include "r_modes.h"
#include "r_wipe.h"
#include "s_sound.h"
#include "w_files.h"

Expand Down Expand Up @@ -159,6 +160,8 @@ void E_PlayMovie(const std::string &name)
plm_set_audio_stream(decoder, 0);
}

RGL_BlackoutWipeTex();

glClearColor(0, 0, 0, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
I_FinishFrame();
Expand Down
23 changes: 23 additions & 0 deletions source_files/edge/r_wipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,29 @@ static void CaptureScreenAsTexture(bool speckly, bool spooky)
cur_wipe_tex = R_UploadTexture(&img);
}

void RGL_BlackoutWipeTex(void)
{
int total_w = W_MakeValidSize(SCREENWIDTH);
int total_h = W_MakeValidSize(SCREENHEIGHT);

epi::image_data_c img(total_w, total_h, 4);

img.Clear();

cur_wipe_right = SCREENWIDTH / (float)total_w;
cur_wipe_top = SCREENHEIGHT / (float)total_h;

for (int y = 0; y < SCREENHEIGHT; y++)
{
u8_t *dest = img.PixelAt(0, y);

dest[0] = dest[1] = dest[2] = 0;
dest[3] = 1;
}

cur_wipe_tex = R_UploadTexture(&img);
}

static void RGL_Init_Melt(void)
{
int x, r;
Expand Down
2 changes: 2 additions & 0 deletions source_files/edge/r_wipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ extern const char WIPE_EnumStr[];
void RGL_InitWipe(wipetype_e effect);
void RGL_StopWipe(void);
bool RGL_DoWipe(void);
// Primarily for movie use; replaces the initial wipe texture with all black
void RGL_BlackoutWipeTex(void);

#endif // __R_WIPE__

Expand Down

0 comments on commit df05465

Please sign in to comment.