Compare commits

...

4 commits

8 changed files with 81 additions and 8 deletions

View file

@ -351,6 +351,76 @@ float4 doors(float2 st : TEXCOORD0) : COLOR0 {
return color;
}
float4 doom(float2 st : TEXCOORD0) : COLOR0 {
float time=uProgress*0.02;
if(uProgress>50.){time=2.-uProgress*0.02;}
float diff=sin(ceil(st.x*100.)*2.2 + ceil(st.x*st.x*100.)*3.)*0.2 -0.4+time*2.0;
if(diff>0.){
if(uProgress>50.){st.y+=diff;}
else{st.y-=diff;}
}
float4 color = tex2D(uImage0, st);
if(st.y>1. || st.y<0.)color = float4(0,0,0,0);
return color;
}
/* NOTE: FBM is a bit heavier than other tasks, so this will have to wait until I'm doing ps_3_0 things.
float fract(float x){return x-floor(x);}
float mix(float x, float y, float a){return x*(1.-a)+y*a;}
// This FBM functionality from thebookofshaders.com, unfortunately I don't have time to design my own version currently.
float random (in float2 st) {
return fract(sin(dot(
st.xy,
float2(12.9898,78.233)
))*43758.5453123);
}
float noise (in float2 st) {
float2 i = floor(st);
float2 f = fract(st);
float a = random(i);
float b = random(i + float2(1.0, 0.0));
float c = random(i + float2(0.0, 1.0));
float d = random(i + float2(1.0, 1.0));
float2 u = f * f * (3.0 - 2.0 * f);
return mix(a, b, u.x)
+(c - a)* u.y * (1.0 - u.x)
+(d - b) * u.x * u.y;
}
#define FBM_OCTAVES 1
float fbm (in float2 st) {
// Initial values
float value = 0.0;
float amplitude = .5;
float frequency = 0.;
// Loop of octaves
for (int i = 0; i < FBM_OCTAVES; i++) {
value += amplitude * noise(st);
st *= 2.;
amplitude *= .5;
}
return value;
}
// End FBM
float4 fog(float2 st : TEXCOORD0) : COLOR0 {
//st=rotate(st,u_time);
float2 ce=float2(.5,.5);
float4 color = tex2D(uImage0, st);
color.a = 1.-length(st-ce)*fbm(st*2.5+uProgress*0.01);
//color.r=1.-length(st-ce)*fbm(2.5*st+fbm(st+u_time)+u_time)*6.;
//color.r=fbm(2.5*st+fbm(st+u_time));
return color;
}*/
technique Technique1
{
pass Lines {PixelShader = compile ps_2_0 lines();}
@ -366,4 +436,6 @@ technique Technique1
pass Collapse {PixelShader = compile ps_2_0 columns_sudden_angled();}
pass Circle {PixelShader = compile ps_2_0 circle();}
pass Doors {PixelShader = compile ps_2_0 doors();}
pass Doom {PixelShader = compile ps_2_0 doom();}
// pass Rolling{PixelShader = compile ps_2_0 fog();}
}

Binary file not shown.

View file

@ -10,10 +10,10 @@ using Terraria.ModLoader;
namespace smoothDeathTransitions {
public class TransitionPlayer : ModPlayer {
/*public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
{
Player.respawnTimer=150; // For testing
}*/
}
public string GetBiomeSpecificTransitions(){
// This code is going to suck.
@ -44,6 +44,7 @@ namespace smoothDeathTransitions {
if(Player.ZoneSkyHeight)return "Rising";
if(Player.ZoneNormalUnderground || Player.ZoneNormalCaverns)return "Circle";
if(Player.ZoneUnderworldHeight)return "Falling";
if(Player.ZoneSandstorm)return "Doom";
return ModContent.GetInstance<TransitionsConfig>().DefaultTransition;
}
@ -54,7 +55,7 @@ namespace smoothDeathTransitions {
public override void PreUpdate()
{
// Check if appropriate conditions
if(Main.netMode != NetmodeID.Server){
if(Main.netMode != NetmodeID.Server && Main.LocalPlayer == Player){
// Check if the time is nigh
if(transitionTicker==0 && Player.dead && Player.respawnTimer<transitionTime/2){
transitionTicker=transitionTime;

View file

@ -17,7 +17,7 @@ namespace smoothDeathTransitions
[DefaultValue("Lines")]
[TooltipKey("$DefaultTransitionTooltip")]
[DrawTicks]
[OptionStrings(["Lines", "Loving", "Rising", "Falling", "Starry", "Winding", "Jaws", "Flooding", "Wonder", "Collapse", "Circle", "Doors", "Prideful"])]
[OptionStrings(["Lines", "Loving", "Rising", "Falling", "Starry", "Winding", "Jaws", "Flooding", "Wonder", "Collapse", "Circle", "Doors", "Doom", "Prideful"])]
public string DefaultTransition;
[DefaultValue(160)]

View file

@ -1,4 +1,4 @@
displayName = Smooth Death Transitions
author = Emerald Quartz
side = Client
version = 2.0.1
version = 2.0.2

View file

@ -12,6 +12,7 @@ Currently available transitions:
- Collapse - jagged diagonal letterboxing.
- Circle - simple closing-in circle.
- Doors - two-sided shut and open.
- Doom - puts the screen through a paper shredder.
- Prideful - trans flag sweep that optionally replaces the Hallow's ordinary transition.
Explicitly supports Calamity and Confection Rebaked, but all content mods should be fine; it'll just use the default transition.

View file

@ -1,5 +1,3 @@
[h1]Smooth Death Transitions[/h1]
Updates the traditional death screen with smooth transition shaders when you respawn. Fully client-side (does not alter gameplay) and configurable. Explicitly supports Calamity and Confection Rebaked, but all content mods should be fine; it'll just use the default transition for your position.
Currently available transitions:
@ -15,6 +13,7 @@ Currently available transitions:
[*][b]Collapse[/b] - jagged diagonal letterboxing.
[*][b]Circle[/b] - simple closing-in circle.
[*][b]Doors[/b] - two-sided shut and open.
[*][b]Doom[/b] - puts the screen through a paper shredder.
[*][b]Prideful[/b] - trans flag sweep that optionally replaces the Hallow's ordinary transition.
[/list]

View file

@ -10,7 +10,7 @@ namespace smoothDeathTransitions
{
public class SmoothDeathTransitions : Mod
{
public string[] transitionsAvailable = ["Lines", "Loving", "Rising", "Falling", "Starry", "Winding", "Jaws", "Flooding", "Wonder", "Prideful", "Collapse", "Circle", "Doors"];
public string[] transitionsAvailable = ["Lines", "Loving", "Rising", "Falling", "Starry", "Winding", "Jaws", "Flooding", "Wonder", "Prideful", "Collapse", "Circle", "Doors", "Doom"];
public override void Load(){
if(Main.netMode != NetmodeID.Server){
Asset<Effect> screenRef = Assets.Request<Effect>("Effects/transitions");