Skip to content

Commit

Permalink
tr1/output: remove legacy fade APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Jan 8, 2025
1 parent 9293ebc commit 49fd51c
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 119 deletions.
1 change: 0 additions & 1 deletion src/tr1/game/game/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
Game_DrawScene(true); \
Input_Update(); \
Output_EndScene(); \
Output_AnimateFades(); \
Clock_WaitTick(); \
} while (g_Input.key);

Expand Down
2 changes: 0 additions & 2 deletions src/tr1/game/game/game_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,4 @@ void Game_DrawScene(bool draw_overlay)
Lara_Hair_Draw();
Output_FlushTranslucentObjects();
}

Output_DrawBackdropScreen();
}
6 changes: 0 additions & 6 deletions src/tr1/game/gameflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,9 +1137,6 @@ GameFlow_InterpretSequence(int32_t level_num, GAME_FLOW_LEVEL_TYPE level_type)
break;
}

// TODO: do not call me here once everything moves to libtrx faders
Output_FadeReset();

GAME_FLOW_DISPLAY_PICTURE_DATA *data = seq->data;
PHASE *const phase = Phase_Picture_Create((PHASE_PICTURE_ARGS) {
.file_name = data->path,
Expand Down Expand Up @@ -1518,9 +1515,6 @@ GAME_FLOW_COMMAND GameFlow_PlayAvailableStory(int32_t slot_num)

GAME_FLOW_COMMAND GF_ShowInventory(const INVENTORY_MODE inv_mode)
{
// TODO: do not call me here once everything moves to libtrx faders
Output_FadeReset();

PHASE *const phase = Phase_Inventory_Create(inv_mode);
const GAME_FLOW_COMMAND gf_cmd = PhaseExecutor_Run(phase);
Phase_Inventory_Destroy(phase);
Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/inventory_ring/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ void InvRing_Draw(INV_RING *const ring)
ring->camera.pos.z = ring->radius + CAMERA_2_RING;

if (g_InvMode == INV_TITLE_MODE) {
Output_DrawBackdropScreen();
Interpolation_Commit();
} else {
Matrix_LookAt(
Expand Down
91 changes: 0 additions & 91 deletions src/tr1/game/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ void Output_BeginScene(void)

void Output_EndScene(void)
{
Output_DrawOverlayScreen();
S_Output_DisableDepthTest();
S_Output_ClearDepthBuffer();
Overlay_DrawFPSInfo();
Expand Down Expand Up @@ -1168,30 +1167,6 @@ void Output_SetupAboveWater(bool underwater)
m_IsShadeEffect = underwater;
}

void Output_AnimateFades(void)
{
if (!g_Config.visuals.enable_fade_effects) {
return;
}

const double delta =
ClockTimer_TakeElapsed(&m_FadeTimer) * LOGIC_FPS * 10.0;
if (m_OverlayCurAlpha + delta <= m_OverlayDstAlpha) {
m_OverlayCurAlpha += delta;
} else if (m_OverlayCurAlpha - delta >= m_OverlayDstAlpha) {
m_OverlayCurAlpha -= delta;
} else {
m_OverlayCurAlpha = m_OverlayDstAlpha;
}
if (m_BackdropCurAlpha + delta <= m_BackdropDstAlpha) {
m_BackdropCurAlpha += delta;
} else if (m_BackdropCurAlpha - delta >= m_BackdropDstAlpha) {
m_BackdropCurAlpha -= delta;
} else {
m_BackdropCurAlpha = m_BackdropDstAlpha;
}
}

void Output_AnimateTextures(void)
{
m_WibbleOffsetDbl += ClockTimer_TakeElapsed(&m_WibbleTimer) * LOGIC_FPS;
Expand Down Expand Up @@ -1275,72 +1250,6 @@ void Output_DrawPolyList(void)
S_Output_ClearDepthBuffer();
}

void Output_DrawBackdropScreen(void)
{
Output_DrawBlackRectangle(m_BackdropCurAlpha);
}

void Output_DrawOverlayScreen(void)
{
Output_DrawBlackRectangle(m_OverlayCurAlpha);
}

void Output_FadeReset(void)
{
m_BackdropCurAlpha = 0;
m_OverlayCurAlpha = 0;
m_BackdropDstAlpha = 0;
m_OverlayDstAlpha = 0;
ClockTimer_Sync(&m_FadeTimer);
}

void Output_FadeResetToBlack(void)
{
m_OverlayCurAlpha = 255;
m_OverlayDstAlpha = 255;
ClockTimer_Sync(&m_FadeTimer);
}

void Output_FadeToBlack(bool allow_immediate)
{
if (g_Config.visuals.enable_fade_effects) {
m_OverlayDstAlpha = 255;
} else if (allow_immediate) {
m_OverlayCurAlpha = 255;
}
}

void Output_FadeToSemiBlack(bool allow_immediate)
{
if (g_Config.visuals.enable_fade_effects) {
m_BackdropDstAlpha = 128;
m_OverlayDstAlpha = 0;
} else if (allow_immediate) {
m_BackdropCurAlpha = 128;
m_OverlayCurAlpha = 0;
}
}

void Output_FadeToTransparent(bool allow_immediate)
{
if (g_Config.visuals.enable_fade_effects) {
m_BackdropDstAlpha = 0;
m_OverlayDstAlpha = 0;
} else if (allow_immediate) {
m_BackdropCurAlpha = 0;
m_OverlayCurAlpha = 0;
}
}

bool Output_FadeIsAnimating(void)
{
if (!g_Config.visuals.enable_fade_effects) {
return false;
}
return m_OverlayCurAlpha != m_OverlayDstAlpha
|| m_BackdropCurAlpha != m_BackdropDstAlpha;
}

void Output_ApplyFOV(void)
{
int32_t fov = Viewport_GetFOV();
Expand Down
10 changes: 0 additions & 10 deletions src/tr1/game/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ void Output_SetDrawDistFade(int32_t dist);
void Output_SetDrawDistMax(int32_t dist);
void Output_SetWaterColor(const RGB_F *color);

void Output_FadeReset(void);
void Output_FadeResetToBlack(void);
void Output_FadeToBlack(bool allow_immediate);
void Output_FadeToSemiBlack(bool allow_immediate);
void Output_FadeToTransparent(bool allow_immediate);
bool Output_FadeIsAnimating(void);
void Output_DrawBackdropScreen(void);
void Output_DrawOverlayScreen(void);

void Output_BeginScene(void);
void Output_EndScene(void);

Expand Down Expand Up @@ -99,7 +90,6 @@ void Output_DrawUISprite(
void Output_SetupBelowWater(bool underwater);
void Output_SetupAboveWater(bool underwater);
void Output_AnimateTextures(void);
void Output_AnimateFades(void);

void Output_ApplyFOV(void);
void Output_ApplyTint(float *r, float *g, float *b);
Expand Down
3 changes: 0 additions & 3 deletions src/tr1/game/phase/phase_cutscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ static void M_Start(const PHASE_CUTSCENE_ARGS *const args)
return;
}

Output_FadeReset();

if (!Level_Initialise(args->level_num)) {
return;
}
Expand Down Expand Up @@ -198,7 +196,6 @@ static void M_Draw(void)
{
Game_DrawScene(true);
Output_AnimateTextures();
Output_AnimateFades();
}

PHASER g_CutscenePhaser = {
Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/phase/phase_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ static void M_Start(const PHASE_DEMO_ARGS *const args)
Input_Update();

Interpolation_Remember();
Output_FadeReset();

M_PrepareConfig();
M_PrepareResumeInfo();
Expand Down
2 changes: 0 additions & 2 deletions src/tr1/game/phase/phase_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static void M_Start(const void *const args)
{
Interpolation_Remember();
Stats_StartTimer();
Output_FadeReset();
Game_SetIsPlaying(true);
}

Expand Down Expand Up @@ -179,7 +178,6 @@ static void M_Draw(void)
{
Game_DrawScene(true);
Output_AnimateTextures();
Output_AnimateFades();
Text_Draw();
}

Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/phase/phase_inventory.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ static void M_Draw(PHASE *const phase)
M_PRIV *const p = phase->priv;
ASSERT(p->ring != NULL);
InvRing_Draw(p->ring);
Output_AnimateFades();
Text_Draw();
}

Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/phase/phase_pause.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ static void M_Draw(PHASE *const phase)
Game_DrawScene(false);
Fader_Draw(&p->back_fader);
Interpolation_Enable();
Output_AnimateFades();
if (p->ui != NULL) {
p->ui->draw(p->ui);
}
Expand Down

0 comments on commit 49fd51c

Please sign in to comment.