This commit is contained in:
FajsiEx 2021-07-25 20:10:06 +02:00
commit d013c76a96
721 changed files with 21973 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
_asset
song-assets
skin-assets

24
README.md Normal file
View File

@ -0,0 +1,24 @@
--EXPERIMENTALGEAR SKIN FOR USC--
Project Starter: GSK Bladez
-- Coding --
FajsiEx
fdigl
Hoshikara
GSK Bladez
-- Graphics --
GSK Bladez
Neardayo
YellowBird
-- Translation --
GSK Bladez
Neardayo
RealFD
-- Misc. Help --
Neardayo
DDX
GM'DED

BIN
audio/applause.wav Normal file

Binary file not shown.

BIN
audio/clap.wav Normal file

Binary file not shown.

BIN
audio/click-01.wav Normal file

Binary file not shown.

BIN
audio/click-02.wav Normal file

Binary file not shown.

BIN
audio/cursor_difficulty.wav Normal file

Binary file not shown.

BIN
audio/cursor_song.wav Normal file

Binary file not shown.

BIN
audio/laser_slam.wav Normal file

Binary file not shown.

BIN
audio/laser_slam1.wav Normal file

Binary file not shown.

BIN
audio/laser_slam2.wav Normal file

Binary file not shown.

BIN
audio/laser_slam3.wav Normal file

Binary file not shown.

BIN
audio/laser_slam_fast.wav Normal file

Binary file not shown.

BIN
audio/menu_click.wav Normal file

Binary file not shown.

BIN
audio/result.wav Normal file

Binary file not shown.

BIN
audio/shutter.wav Normal file

Binary file not shown.

BIN
audio/snare.wav Normal file

Binary file not shown.

BIN
audio/snare_lo.wav Normal file

Binary file not shown.

Binary file not shown.

BIN
audio/start.wav Normal file

Binary file not shown.

BIN
audio/title.wav Normal file

Binary file not shown.

BIN
audio/titlescreen/bgm.wav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
audio/woosh.wav Normal file

Binary file not shown.

546
backgrounds/fallback/bg.fs Normal file
View File

@ -0,0 +1,546 @@
#version 330
#extension GL_ARB_separate_shader_objects : enable
layout(location=1) in vec2 texVp;
layout(location=0) out vec4 target;
uniform ivec2 screenCenter;
// x = bar time
// y = off-sync but smooth bpm based timing
// z = real time since song start
uniform vec3 timing;
uniform ivec2 viewport;
uniform float objectGlow;
// bg_texture.png
uniform vec2 tilt;
uniform float clearTransition;
#define HALF_PI 1.570796326794
#define PI 3.14159265359
#define TWO_PI 6.28318530718
// Background
uniform int Bg = 0;
uniform float BgPivot = .27;
uniform int BgBase = 0;
uniform sampler2D BgBaseTex;
uniform int BgBaseClearVersion = 0;
uniform sampler2D BgBaseClearTex;
uniform float BgBaseOffsetY = 0.;
uniform int BgBaseTilt = 1;
uniform float BgBaseAR = 1.125;
uniform int BgBaseAnim = 0;
uniform float BgBaseAnimFramesCount; // should be int
uniform int BgBaseScaleSoft = 0;
uniform int BgBaseClampTiling = 0;
uniform int BgOverlay = 0;
uniform sampler2D BgOverlayTex;
uniform int BgOverlayClearVersion = 0;
uniform sampler2D BgOverlayClearTex;
uniform int BgOverlayFloat = 0;
uniform float BgOverlayFloatFactor = 1.;
uniform float BgOverlayOffsetY = 0.;
uniform int BgOverlayFlashEffect = 0;
uniform int BgOverlayTilt = 1;
uniform int BgLayer = 0;
uniform sampler2D BgLayerTex;
uniform int BgLayerClearVersion = 0;
uniform sampler2D BgLayerClearTex;
uniform float BgLayerAnimFramesCount; // should be int
uniform float BgLayerBrighten = 0.;
uniform int BgLayerScaleHard = 0;
// Center
uniform int Center = 0;
uniform int CenterNormalVersion = 0;
uniform sampler2D CenterTex;
uniform int CenterClearVersion = 0;
uniform sampler2D CenterClearTex;
uniform float CenterScale = 3.; // todo: change to smaller
uniform float CenterFloatFactor = 1.;
uniform float CenterFloatXFactor = 0.;
uniform float CenterFloatRotationFactor = 0.;
uniform int CenterPulse = 0;
uniform int CenterFloat = 0;
uniform int CenterFadeEffect = 0;
uniform int CenterTilt = 1;
uniform float CenterOffsetY = 0.;
uniform int CenterGlow = 0;
uniform int CenterSnapToTrack = 1;
uniform int CenterRotate = 0;
uniform int CenterLayerEffect = 0;
uniform sampler2D CenterLayerEffectTex;
uniform int CenterLayerEffectFade = 0;
uniform int CenterLayerEffectRotate = 0;
uniform float CenterLayerEffectRotateSpeed = 1.;
uniform int CenterLayerEffectGlow = 0;
uniform float CenterLayerEffectScale = 1.;
uniform int CenterLayerEffectDodgeBlend = 0;
uniform float CenterLayerEffectAlpha = 1.;
uniform int CenterAnim = 0;
uniform float CenterAnimFramesCount; // should be int
// Tunnel
uniform int Tunnel = 0;
uniform sampler2D TunnelTex;
uniform int TunnelClearVersion = 0;
uniform sampler2D TunnelClearTex;
uniform float TunnelSides = float(8); // should be int
uniform float TunnelStretch = .15; // lower = "Stretchier"
uniform float TunnelScaleX = 1.; // for scale: lower is longer i believe
uniform float TunnelScaleY = 1.;
uniform float TunnelFog = 10.;
uniform int TunnelFlashEffect = 0;
uniform float TunnelExtraRotation = 0.; // 1. == 2*PI radians
uniform int TunnelVortexEffect = 0;
uniform float TunnelVortexFactor = 1.;
uniform int TunnelDodgeBlend = 0;
// Particle
uniform int Particle = 0;
uniform sampler2D ParticleTex;
uniform int ParticleClearVersion = 0;
uniform sampler2D ParticleClearTex;
uniform float ParticleSpeed = 1.;
uniform float ParticleScale = 1.;
uniform float ParticleOffsetY = 0.;
uniform float ParticleAmount = float(2); // should be int
// MISC CONSTANTS
float TunnelSpeed = 1.;
float TunnelBaseRotation = 0.0; // Default rotation in radians
float TunnelBaseTexRotation = 0.5 * HALF_PI; // Rotation of texture for alignment, in radians
vec2 TunnelScale = vec2(TunnelScaleX, TunnelScaleY);
float bgLayerAR = 1.25;
vec2 bgPivot = vec2(.5, BgPivot);
vec2 hardScale = vec2(.7, .4); // Base scale (lower is more scaled: 1/x) <> how much is subtracted on rotation
vec2 softScale = vec2(.9, .1);
float rotateScaleSmoothnessFactor = 1.3; // Higher is smoother
float portrait(float a, float b) {
if (viewport.y > viewport.x) {
return a;
} else {
return b;
}
}
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
float blendOverlay(float base, float blend) {
return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));
}
vec3 blendOverlay(vec3 base, vec3 blend) {
return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));
}
vec3 blendOverlay(vec3 base, vec3 blend, float opacity) {
return (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));
}
float blendScreen(float base, float blend) {
return 1.0-((1.0-base)*(1.0-blend));
}
vec3 blendScreen(vec3 base, vec3 blend) {
return vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));
}
vec3 blendScreen(vec3 base, vec3 blend, float opacity) {
return (blendScreen(base, blend) * opacity + base * (1.0 - opacity));
}
float blendLinearDodge(float base, float blend) {
// Note : Same implementation as BlendAddf
return min(base+blend,1.0);
}
vec3 blendLinearDodge(vec3 base, vec3 blend) {
// Note : Same implementation as BlendAdd
return min(base+blend,vec3(1.0));
}
vec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {
return (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));
}
vec2 ScaleUV(vec2 uv,float scale,vec2 pivot) {
return (uv - pivot) * scale + pivot;
}
vec2 ScaleUV(vec2 uv,vec2 scale,vec2 pivot) {
return (uv - pivot) * scale + pivot;
}
vec2 rotatePoint(vec2 cen,float angle,vec2 p) {
float s = sin(angle);
float c = cos(angle);
// translate point back to origin:
p.x -= cen.x;
p.y -= cen.y;
// rotate point
float xnew = p.x * c - p.y * s;
float ynew = p.x * s + p.y * c;
// translate point back:
p.x = xnew + cen.x;
p.y = ynew + cen.y;
return p;
}
float mirrorTile(float val, float lower, float upper) {
if (val < lower) return lower * 2 - val;
if (val > upper) return upper * 2. - val;
return val;
}
vec2 mirrorTile(vec2 val, float lower, float upper) {
val.x = mirrorTile(val.x, lower, upper);
val.y = mirrorTile(val.y, lower, upper);
return val;
}
float getRotateScaleModifier(float rotation) {
return smoothstep(0., HALF_PI*.5*rotateScaleSmoothnessFactor, 2 * abs(asin(sin(0.5*rotation*TWO_PI))*1.));
// return min(2. * abs( asin(sin(0.5*layerRotation*TWO_PI))*2. ), .5*HALF_PI ) / (.5*HALF_PI);
}
///////////////////
// END RENDER GIF BG
///////////////////
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
// Reference to
// https://github.com/Ikeiwa/USC-SDVX-IV-Skin (Ikeiwa)
// http://thndl.com/square-shaped-shaders.html
// https://thebookofshaders.com/07/
float GetDistanceShape(vec2 st, /*int*/float N){
vec3 color = vec3(0.0);
float d = 0.0;
// Angle and radius from the current pixel
float a = atan(st.x,st.y)+PI;
float r = TWO_PI/N;
// Shaping function that modulate the distance
d = cos(floor(.5+a/r)*r-a)*length(st);
return d;
}
float mirrored(float v) {
float m = mod(v, 2.0);
return mix(m, 2.0 - m, step(1.0, m));
}
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
vec2 rotate2d(vec2 uv,float _angle, vec2 pivot){
return (uv - pivot) * mat2(cos(_angle),-sin(_angle),
sin(_angle),cos(_angle)) + pivot;
}
void main() {
target.rgba = vec4(vec3(0.),1.);
// MAIN SETUP
float beatTime = mod(timing.y,1.0);
float ar = float(viewport.x) / float(viewport.y);
float var = float(viewport.y) / float(viewport.x);
vec2 screenUV = vec2(texVp.x / viewport.x, texVp.y / viewport.y);
vec2 uv = screenUV;
uv.x *= ar;
vec2 center = vec2(screenCenter) / vec2(viewport);
center.x *= ar;
vec2 point = uv;
float bgrot = dot(tilt, vec2(0.5, 1.0));
point = rotatePoint(center, TunnelBaseRotation + (bgrot * TWO_PI), point);
// BACKGROUND
vec4 backgroundTexture = vec4(0.,0.,0.,1.);
vec4 backgroundTexture2 = vec4(0.);
vec4 layerTexture = vec4(0.);
if (Bg == 1) {
// Bg => BgOverlay => BgLayer
for (int i=0;i<3;++i) {
if ((i == 0 && BgBase == 0) || (i == 1 && BgOverlay == 0) || (i == 2 && BgLayer == 0))
continue;
bool isAnim = (i < 2 && BgBaseAnim == 1) || i == 2;
float frameCount;
if (isAnim) {
frameCount = i < 2 ? BgBaseAnimFramesCount : BgLayerAnimFramesCount;
}
vec2 backgroundUV = screenUV;
// backgroundUV.x -= 0.5;
if (BgOverlay == 1 && i == 1) {
backgroundUV.y -= portrait(BgOverlayOffsetY,-0.5); // todo: figure out landscape
if (BgOverlayFloat == 1)
backgroundUV.y += sin(timing.z) * 0.003 * BgOverlayFloatFactor;
} else {
backgroundUV.y -= portrait(BgBaseOffsetY,-0.5); // todo: figure out landscape
}
// backgroundUV.x *= ar;
// backgroundUV /= 1.2;
// backgroundUV /= ar;
// backgroundUV.x += 0.5;
backgroundUV.y -= portrait(0.15,0.05);
backgroundUV.y /= ar;
if ((i < 2 && BgBaseTilt == 1) || (i == 1 && BgOverlayTilt == 1) || i == 2) {
float rotation = i < 2 && !(i == 1 && BgBaseTilt == 0) // todo: tilt to maximum point?
? dot(tilt, vec2(0.5, 1.0))
: dot(tilt, vec2(1.0));
float scaleModifier = getRotateScaleModifier(rotation);
vec2 scaleConst = ((i == 2 && BgLayerScaleHard == 0) || (i < 2 && BgBaseScaleSoft == 1)) ? softScale : hardScale;
if (BgBaseTilt == 1)
backgroundUV = ScaleUV( backgroundUV, scaleConst.x - (scaleModifier*scaleConst.y), bgPivot );
backgroundUV = rotatePoint(bgPivot, rotation*TWO_PI, backgroundUV);
}
float bgAr = i < 2 && BgBaseAnim == 0 ? BgBaseAR : bgLayerAR;
if (bgAr > 1)
backgroundUV = ScaleUV(backgroundUV, vec2(1/bgAr, 1.), bgPivot);
else
backgroundUV = ScaleUV(backgroundUV, vec2(1., bgAr), bgPivot);
vec2 animOffset;
animOffset = vec2(0.);
if (isAnim) {
float frameFraction = 1. / frameCount;
float currentFrame = floor(timing.y * frameCount);
animOffset = vec2(currentFrame*frameFraction, 0.);
backgroundUV *= vec2(frameFraction, 1.);
}
backgroundUV = BgBaseClampTiling == 0
? mirrorTile(backgroundUV, .001, .999)
: clamp(backgroundUV, .001, .999);
if (isAnim)
backgroundUV += animOffset;
if (i == 0) {
backgroundTexture = texture(BgBaseTex, backgroundUV);
if (BgBaseClearVersion == 1) {
vec4 backgroundClearTexture = texture(BgBaseClearTex, backgroundUV);
backgroundTexture = mix(backgroundTexture,backgroundClearTexture,clearTransition);
}
} else if (i == 1) {
backgroundTexture2 = texture(BgOverlayTex, backgroundUV);
if (BgOverlayClearVersion == 1) {
vec4 backgroundOverlayClearTexture = texture(BgOverlayClearTex, backgroundUV);
backgroundTexture2 = mix(backgroundTexture2,backgroundOverlayClearTexture,clearTransition);
}
if (BgOverlayFlashEffect == 1) {
backgroundTexture2.a *= .9 + timing.y * .1;
}
} else if (i == 2) {
layerTexture = texture(BgLayerTex, backgroundUV);
if (BgLayerClearVersion == 1) {
vec4 layerClearTexture = texture(BgLayerClearTex, backgroundUV);
layerTexture = mix(layerTexture, layerClearTexture, clearTransition);
}
layerTexture.rgb = blendOverlay(layerTexture.rgb, vec3(1.), BgLayerBrighten);
}
}
}
target.rgb = mix(target.rgb, backgroundTexture.rgb, backgroundTexture.a);
if (BgLayer == 1)
target.rgb = blendLinearDodge(target.rgb, layerTexture.rgb, layerTexture.a);
// END BACKGROUND
// TUNNEL -- gaat nog niet goed denkik
if (Tunnel == 1) {
vec2 pointFromCenter = center - point;
pointFromCenter /= TunnelScale;
float diff = GetDistanceShape(pointFromCenter,TunnelSides);
float fog = -1. / (diff * TunnelFog * TunnelScale.x) + 1.;
fog = clamp(fog, 0, 1);
float tunnelTexY = TunnelStretch / diff;
tunnelTexY += timing.y * TunnelSpeed;
float rot = (atan(pointFromCenter.x,pointFromCenter.y) + TunnelBaseTexRotation + TunnelExtraRotation*TWO_PI) / TWO_PI;
if (TunnelVortexEffect == 1)
rot += fract(timing.z*0.1*TunnelVortexFactor);
vec4 tunnelTexture = texture(TunnelTex, vec2(rot,mod(tunnelTexY,1)));
if (TunnelClearVersion == 1) {
vec4 clearTunnelTexture = texture(TunnelClearTex, vec2(rot,mod(tunnelTexY,1)));
tunnelTexture = mix(tunnelTexture,clearTunnelTexture,clearTransition);
}
if (TunnelFlashEffect == 1) {
float brightness = timing.y * 1.;
tunnelTexture.rgb = blendOverlay(tunnelTexture.rgb, vec3(1.), brightness);
}
if (TunnelDodgeBlend == 1)
target.rgb = blendLinearDodge(target.rgb, tunnelTexture.rgb*2, tunnelTexture.a*2*fog);
else
target.rgb = mix(target.rgb, tunnelTexture.rgb*2., tunnelTexture.a*fog);
// target.rgb = backgroundTexture.rgb * (1-target.a) + target.rgb * target.a;
// target.rgb = tunnelTexture.rgb * 2.0;
// target.a = tunnelTexture.a * fog;
}
// END TUNNEL
// CENTER TEXTURE
if (Center == 1) {
vec2 centerUV = screenUV;
//centerUV = center - centerUV; // this would be 'centered uv calculation' (?)
//centerUV *= -1.0;
//centerUV += 0.5;
centerUV.x -= 0.5;
centerUV.y -= CenterOffsetY;
if (CenterSnapToTrack == 1)
centerUV.y += (0.5-center.y);
else
centerUV.y += portrait(0.19,0.25);
if (CenterFloat == 1) {
centerUV -= vec2(
sin(timing.z * 0.6) * 0.003 * CenterFloatXFactor,
cos(timing.z) * 0.007 * CenterFloatFactor
);
}
centerUV.x *= ar;
centerUV.x += 0.5;
centerUV = clamp(centerUV,0.0,1.0);
if (CenterTilt == 1)
centerUV = rotatePoint(vec2(0.5, 0.5-CenterOffsetY), clamp(TunnelBaseRotation + (bgrot * TWO_PI),-360,360), centerUV);
if (CenterFloat == 1 && CenterFloatRotationFactor > 0.) {
centerUV = rotatePoint(vec2(0.5), (sin(timing.z*0.3))*0.05*TWO_PI * CenterFloatRotationFactor, centerUV);
}
centerUV = ScaleUV(centerUV,CenterScale,vec2(0.5));
float GlowTimingProgress = sin(timing.z*6.5)*.5+.5;
if (CenterGlow == 1)
centerUV = ScaleUV(centerUV,GlowTimingProgress*.3+1.,vec2(0.5));
if (CenterRotate == 1)
centerUV = rotatePoint(vec2(0.5), fract(timing.z*0.02)*TWO_PI, centerUV);
// TODO: center anim
vec4 centerTexture = vec4(0.);
if (CenterNormalVersion == 1) {
centerTexture = texture(CenterTex, clamp(centerUV,0.,1.));
}
if (CenterClearVersion == 1) {
vec4 centerTextureClear = texture(CenterClearTex, clamp(centerUV,0.,1.));
centerTexture = mix(centerTexture,centerTextureClear,clearTransition);
}
float opacity = CenterFadeEffect == 1 ? (0.2+abs(cos(timing.z)*0.2)) : 1.;
target.rgb = mix(target.rgb,centerTexture.rgb,centerTexture.a * opacity);
if (BgOverlay == 1)
target.rgb = mix(target.rgb,backgroundTexture2.rgb,backgroundTexture2.a);
if (CenterLayerEffect == 1) {
float a = CenterLayerEffectAlpha;
float sc = CenterLayerEffectScale;
if (CenterLayerEffectFade == 1)
a *= (0.3+(cos(timing.z)*0.3));
if (CenterLayerEffectGlow == 1) {
a *= (GlowTimingProgress*.2+.4);
sc *= (GlowTimingProgress*.05+.95);
}
vec2 centerLayerUV = ScaleUV(centerUV,sc,vec2(.5,.5));
if (CenterLayerEffectRotate == 1)
centerLayerUV = rotatePoint(vec2(0.5), fract(timing.z*0.01*CenterLayerEffectRotateSpeed)*TWO_PI, centerLayerUV);
vec4 centerTexture2 = texture(CenterLayerEffectTex, clamp(centerLayerUV,0.,1.));
if (CenterLayerEffectDodgeBlend == 1)
target.rgb = blendLinearDodge(target.rgb, centerTexture2.rgb, centerTexture2.a*a);
else
target.rgb = mix(target.rgb,centerTexture2.rgb,centerTexture2.a * a);
}
// todo: have pulsing speed factor uniform
if (CenterPulse == 1) { // also has to account for clear version
vec4 centerTextureef = texture(CenterTex, clamp(ScaleUV(centerUV,1.-fract(timing.z*1.5)*0.15,vec2(0.5)),0.0,1.0));
target.rgb = mix(target.rgb,centerTextureef.rgb + target.rgb,centerTextureef.a *(fract(-timing.z*1.5))*0.2);
}
}
// END CENTER TEXTURE
// If Center == 1 this will be drawn in the Center block
if (Center == 0 && BgOverlay == 1)
target.rgb = mix(target.rgb,backgroundTexture2.rgb,backgroundTexture2.a);
//PARTICLES
if (Particle == 1) {
vec2 particlesUV = point;
particlesUV.x = center.x - particlesUV.x;
particlesUV.x = mirrored(clamp(particlesUV.x,-1.0,1.0));
// particlesUV.y += 0.1;
vec4 particles = vec4(vec3(1.),0.);
float particlesTime = timing.z * ParticleSpeed;
for (int i=0;i<ParticleAmount;++i) {
float timeOffset = 1./i;
float particleSpawnTime = floor(particlesTime - timeOffset);
float particleTime = (particlesTime - timeOffset) - particleSpawnTime;
float rnd = rand(vec2(i,particleSpawnTime));
float rnd2 = rand(vec2(particleSpawnTime,i));
float spriteIndex = floor(rnd*4.0);
vec2 particleUV = ScaleUV(particlesUV,(1.0-particleTime)*8.0,vec2(0.0,center.y));
particleUV += vec2(rnd2*-0.4,rnd*0.4 + 0.025 + portrait(ParticleOffsetY,0.2));
particleUV /= ParticleScale;
particleUV = clamp(particleUV,0.0,1.0);
vec4 particle = texture(ParticleTex, particleUV * vec2(0.25,1.) + vec2(spriteIndex*0.25,0.0));
particle.a *= min(particleTime*ParticleAmount,1.0);
if (ParticleClearVersion == 1) {
vec4 clearParticle = texture(ParticleClearTex, particleUV * vec2(0.25,1.) + vec2(spriteIndex,0.0));
clearParticle.a *= min(particleTime*ParticleAmount,1.0);
particle = mix(particle, clearParticle, clearTransition);
}
particles = mix(particles,particle,particle.a);
}
target.rgb = mix(target.rgb,particles.rgb,particles.a);
}
//END PARTICLES
target.a = 1.0;
}
//Edited by Halo ID => edited by Shirijii

618
backgrounds/fallback/bg.lua Normal file
View File

@ -0,0 +1,618 @@
local delayedOperations = {
u={},
speed=nil
}
local dark = game.GetSkinSetting("dark_mode") or game.GetSkinSetting("dark_bgs")
-- backgroundTextures
local bt = {
_={"_.png"},
cyberspace={"cyberspace.jpg", "cyberspace-c.jpg"},
watervault={"watervault.jpg", "watervault-c.jpg"},
underwater={"underwater.jpg", "underwater-c.jpg", bright=true},
ocean={"ocean.jpg", "ocean-c.jpg",bright=true},
grass={"grass.jpg", "grass-c.jpg"},
deepsea={"deepsea.jpg", "deepsea-c.jpg"},
cyber={"cyber.jpg", "cyber-c.jpg"},
desert={"desert.jpg", "desert-c.jpg"},
desertYellowClear={"desert.jpg", "desert-c2.jpg",bright=true},
sky={"sky.jpg", "sky-c.jpg",bright=true},
skyIv={"sky-iv.jpg", "sky-iv-c.jpg",bright=true},
skyIv2={"sky_iv_2.png", "sky_iv_2-c.png",bright=true},
skyIvDark={"sky-iv-dark.jpg"},
sunset={"sunset.jpg", "sunset-c.jpg",bright=true},
redgradient={"redgradient.jpg", "redblur.jpg"},
mars={"mars.jpg", "mars-c.jpg"},
cloudy={"cloudy.jpg", "cloudy-c.jpg"},
redblur={"redblur.jpg", "redblur-c.jpg"},
galaxy={"galaxy.jpg", "galaxy-c.jpg"},
fantasy={"fantasy.jpg", "fantasy-c.jpg",bright=true},
bedroom={"bedroom.jpg", "bedroom-c.jpg",bright=true},
flame={"flame.jpg", "flame-c.jpg"},
game={"game.png",bright=true},
beach={"beach.png"},
night={"night.jpg", "night-c.jpg"},
prettygalaxy={"prettygalaxy.jpg", "prettygalaxy-c.jpg"},
sakura={"sakura.jpg", "sakura-c.jpg"},
cyberspaceNight={"cyberspace_night.png", "cyberspace_night_starburst.png", bright=true},
moonBlue={"moon_blue.jpg", "moon_blue-c.jpg"},
moonPurple={"moon_purple.jpg", "moon_purple-c.jpg",bright=true},
redDusk={"red_dusk.jpg", "red_dusk-c.jpg"},
star={"star.png", "star-c.png",bright=true},
twilight={"twilight.png", "twilight-c.png"},
undersea={"undersea.png", "undersea-c.png"},
}
-- backgroundComposition
local function bc(bt, opts)
local out = {}
for k,v in pairs(bt) do out[k] = v end
for k,v in pairs(opts) do out[k] = v end
return out
end
local btCollections = {
blue={bt.watervault,bc(bt.underwater,{u={TunnelDodgeBlend=true}}),bt.cyberspace,bt.ocean,bt.grass,bt.deepsea,bt.cyber,bt.desert,bt.sky,bt.skyIv,bt.skyIv2,bt.moonBlue,{"city.png"},bt.cyberspaceNight,bt.undersea,bc(bt._,{weight=6})},
red={bc(bt.flame,{u={TunnelDodgeBlend=true}}),bt.sunset,bt.redgradient,bt.mars,bt.cloudy,bt.redDusk,bt.moonPurple,bc(bt._,{weight=4})},
}
local pt = {
lights={"lights_default.png", "lights_default-c.png"},
lightsMoonblue={"lights_moonblue.png", "lights_moonblue-c.png"},
lightsPurplish={"lights_purplish.png"},
lightsOrangePink={"lights_orangepink.png"},
lightsPink={"lights_pink.png", "lights_pink-c.png"},
lightsSea={"lights_sea.png", "lights_sea-c.png"},
lightsYellow={"lights_yellow.png"},
lightsYellowPurple={"lights_yellow.png", "lights_purplish.png"},
lightsYellowGreen={"lights_yellowgreen.png"},
twilight={"twilight.png", "twilight-c.png"},
streetLanterns={"street_lanterns.png", "street_lanterns-c.png"},
starParticles={"star_particles.png", "star_particles-c.png"},
squares={"squares.png", "squares-c.png"},
}
local bgs = {
arrows={
Tunnel={
Tex={{"arrows-large.png", "arrows-large-c.png"},{"arrows-small.png", "arrows-small-c.png",speed=0.7}},
u={ Sides=4, Stretch=0.2, ScaleX=0.8, ScaleY=0.8, Fog=15.0 },
},
Bg={ Base={Tex={bt.redgradient,bt._}} },
Particle={
Tex={"icons.png", "icons-c.png"},
u={ Scale=0.2, OffsetY=-0.2 }
},
speed=0.8,weight=2
},
technoEye={
Bg={ Base={Tex=bt.cyberspace} },
Center={
Tex="techno-eye.png",
u={Pulse=true, Float=true, Scale=2.8},
LayerEffect={Tex="glowshine.png", Fade=true}
},
Tunnel={
Tex={"electro-blue.png", "electro-c.png"},
u={Sides=8, Stretch=0.3, ScaleY=0.9, Fog=10.0, ExtraRotation=-0.125}
},
},
waveBlue={
Bg={ Base={Tex={bc(bt.watervault,{u={Center=false}}),bc(bt.underwater,{u={TunnelDodgeBlend=true,Center=false}}),bc(bt.cyberspace,{u={Center=false}}),bc(bt.ocean,{u={Center=false}}),bt.grass,bt.deepsea,bt.cyber,bc(bt.desert,{u={Center=false}}),bt.sky,bt.moonBlue,{"city.png"},bc(bt.cyberspaceNight,{u={Center=false}}),bc(bt.undersea,{u={Center=false,TunnelDodgeBlend=true}}),bc(bt._,{weight=5})}, ScaleSoft=true}}, -- Customised version of bt.blue
Tunnel={
Tex={{"wave-blue.png", "wave-blue-c.png"},{"wave-green.png", "wave-green-c.png"}},
u={Sides=4, Stretch=0.15, ScaleX=0.8, ScaleY=0.8, FlashEffect=true, Fog=20.0}
},
Center={ Tex={{"moon2.png","moon2-c.png"},{0}}, u={Scale=9.0, OffsetY=-0.05}, LayerEffect={Tex="moon2_shine.png", Glow=true, Scale=0.8, DodgeBlend=true} },
Particle={ Tex=pt.lightsMoonblue, u={OffsetY=-0.02, Amount=4, Speed=2.0} },
weight=2
},
waveRed={
Bg={ Base={Tex=btCollections.red, ScaleSoft=true} },
Tunnel={
Tex={"wave-red.png","wave-red-c.png"},
u={Sides=4, Stretch=0.15, ScaleX=0.8, ScaleY=0.8, FlashEffect=true, Fog=20.0}
},
Center={ Tex={{"moon_pink.png","moon_pink-c.png"},{0}}, u={Scale=8.0, OffsetY=-0.05}, LayerEffect={Tex="moon_pink_shine.png", Glow=true, DodgeBlend=true, Scale=0.8} },
Particle={ Tex=pt.lightsPink, u={OffsetY=-0.02, Amount=4, Speed=2.0} },
},
waveOrange={
Bg={ Base={Tex={bc(bt.twilight,{u={Center=false}}),bc(bt.grass,{u={Center=false}}),bt.redblur,bt.redgradient,bt.redDusk,bc(bt.star,{u={Center=false}}),bt.cyberspace,bt.sunset,bc(bt.cyber,{u={Center=false}}),bc(bt.galaxy,{u={Center=false}}),bc(bt.desertYellowClear,{u={Center=false}}),bc(bt.fantasy,{u={Center=false}}),bt.moonPurple,bc(bt.undersea,{u={Center=false}}),{"city.png"},bc(bt._,{weight=6})}, ScaleSoft=true} },
Tunnel={
Tex={"wave-orange.png","wave-orange-c.png"},
u={Sides=4, Stretch=0.15, ScaleX=0.8, ScaleY=0.8, FlashEffect=true, Fog=20.0}
},
Center={ Tex={{"moon_orange.png","moon_orange-c.png"},{0}}, u={Scale=8.0, OffsetY=-0.05}, LayerEffect={Tex="moon_orange_shine.png", Glow=true, DodgeBlend=true, Scale=0.8} },
Particle={ Tex=pt.lightsOrangePink, u={OffsetY=-0.02, Amount=4, Speed=2.0} },
},
waveRedNoise={
Bg={
Layer={Tex={{"wave4.jpg", "wave4-c.jpg"}}},
Pivot={0.35}
}
},
waveGalaxy={Bg={
Layer={Tex={{"wave6.jpg", "wave6-c.jpg"}}},
Pivot={0.35}
}},
game={
Bg={Base={Tex="game.png", Tilt=false}, Overlay={Tex="game-f.png", Float=true, FlashEffect=true, FloatFactor=2.0}},
Center={Tex={"logo.png", "logo-c.png"}, u={Scale=3.8, Tilt=true}},
Tunnel={Tex="game.png", u={Sides=4, Stretch=0.15, ScaleX=0.8, ScaleY=0.8, FlashEffect=true, Fog=15.0, ExtraRotation=0.375}},
Particle={Tex={bc(pt.squares,{u={ParticleSpeed=1}}),{"triangles.png",weight=2}},
u={OffsetY=-0.1, Amount=5, Speed=2.0, Scale=0.8}
}
},
seaNight={ -- todo: add bg landscapeoffset
Bg={Base={Tex="sea-night.png", OffsetY=-0.19, ScaleSoft=true}, Overlay={Tex="sea-night-f.png", Float=true, OffsetY=-0.17}},
Center={ Tex="ship-night.png", u={Scale=2.5, Float=true, FloatFactor=0.5, SnapToTrack=false}, LayerEffect={Tex="kac-hikari-2.png"}},
Particle={ Tex="shines2.png", u={Speed=1.8, Amount=9} },
-- Tunnel={},
luaParticleEffect = { particles = { {"star-particle.png", 32} } }
},
seaStorm={
Bg={Base={Tex="sea-storm.png", OffsetY=-0.13, ScaleSoft=true}, Overlay={Tex="sea-storm-f.png", Float=true, OffsetY=-0.17}},
Center={ Tex="ship-storm.png", u={Scale=2.5, Float=true, FloatFactor=0.5, SnapToTrack=false}, LayerEffect={Tex="kac-hikari.png"}},
Particle={ Tex="shines2.png", u={Speed=1.8, Amount=9} },
-- Tunnel={},
},
seaIce={
Bg={Base={Tex="sea-ice.png", OffsetY=-0.1, ScaleSoft=true}, Overlay={Tex="sea-ice-f.png", Float=true, OffsetY=-0.15}},
Center={ Tex="ship-ice.png", u={Scale=2.5, Float=true, FloatFactor=0.5, SnapToTrack=false}, LayerEffect={Tex="kac-hikari-2.png"}},
Particle={ Tex="shines1.png", u={Scale=0.3, OffsetY=-0.3, Speed=1.8, Amount=9} },
-- Tunnel={},
luaParticleEffect = { particles = { {"star-particle.png", 32} } }
},
seaThunder={
Bg={Base={Tex="sea-thunder.png", OffsetY=-0.15, ScaleSoft=true}, Overlay={Tex="sea-thunder-f.png", Float=true, OffsetY=-0.16}},
Center={ Tex="ship-storm.png", u={Scale=2.5, Float=true, FloatFactor=0.5, SnapToTrack=false}, LayerEffect={Tex="kac-hikari.png"}},
Particle={ Tex="shines2.png", u={Speed=1.8, Amount=9} },
},
seaDay={ -- todo: fixlandscape, fix rotation
Bg={Base={Tex="sea-day.png", ScaleSoft=true}, Overlay={Tex="sea-day-f.png", Float=true, OffsetY=-0.1}},
Center={Tex="ship-day.png", u={Scale=2, Float=true, FloatFactor=0.5, OffsetY=0.02, SnapToTrack=false}, LayerEffect={Tex="kac-hikari.png"}},
Particle={ Tex="shines2.png", u={Speed=1.8, Amount=9} },
bright=true,
-- Tunnel={},
},
sakuraRainbow={
Bg={Base={Tex=bt.sakura, ScaleSoft=true}},
Center={
Tex="rainbow.png", u={Scale=1.5, FadeEffect=true},
LayerEffect={Tex="kac_hikari_sakura.png"}
},
-- Tunnel: rainbow rings?! probably not xd
Particle={Tex="shines1.png", u={Speed=1.6, OffsetY=-0.3, Amount=6, Scale=0.35}},
luaParticleEffect={particles={{"petal1.png", 140},{"petal2.png", 40},{"petal3.png", 140}}},
bright=true
},
-- colorBokeh={Bg={Layer={Tex={"colorbokeh.jpg", "colorbokeh-c.jpg"} }, u={Pivot=0.35}}}, -- todo: find working bgs (?)
smoke1={Bg={
Base={Tex={bt.fantasy,bt.cyberspaceNight,bt.undersea,bt.watervault,bt.underwater,bt.cyberspace,bt.ocean,bt.grass,bt.deepsea,bt.cyber,bt.desertYellowClear,bt.sky,bc(bt._,{weight=5})},ScaleSoft=true},
Layer={Tex={"smoke.jpg", "smoke-c.jpg"}},
u={Pivot=0.35}
}},
-- sparkles1={Bg={Layer={Tex={"sparkles1.jpg", "sparkles1-c.jpg"}, ScaleHard=true }}},
-- domeLayer={Bg={
-- Base={Tex={bt.redblur,bt._}},
-- Layer={Tex={{"spider1.jpg", "spider1-c.jpg"},{"spider2.jpg", "spider2-c.jpg"},{"spider3.jpg", "spider3-c.jpg", speed=0.75, u={BgPivot=0.27}}}},
-- u={Pivot=0.36}
-- },weight=2},
-- electro1={Bg={
-- Base={Tex={bt.redblur,bt.cyber,bt._}},
-- Layer={Tex={"electro1.jpg", "electro1-c.jpg"}, brightenLayer=0.6}, u={Pivot=0.35}}
-- },
-- electro2={Bg={Layer={Tex={"electro2.jpg", "electro2-c.jpg"} }, u={Pivot=0.3}}},
plasmaTunnel={Bg={Layer={Tex={"plasmatunnel.jpg", "plasmatunnel-c.jpg"}, }, u={Pivot=0.37}}, speed=0.75, bright=true},
-- xcalibur={Bg={Base={Tex={"anim/xcalibur.jpg", "anim/xcalibur-c.jpg"}}, u={Pivot=0.36}}, speed=0.3},
goldleaves={
Bg={Base={Tex={"anim/goldleaves.jpg", "anim/goldleaves-c.jpg"}}},
Particle={ Tex=pt.lightsYellow, u={Speed=1.8, OffsetY=-0.1, Amount=9} },
speed=0.6
},
technocircle={
Bg={Base={Tex={"anim/technocircle.jpg", "anim/technocircle-c.jpg"}, ScaleSoft=true}, u={Pivot=0.37}},
Particle={ Tex="shines2.png", u={Speed=1.8, OffsetY=-0.15, Amount=7} },
speed=0.6, bright=true
},
snow={
Bg={Base={Tex={"anim/snow.jpg", "anim/snow-c.jpg"}}, u={Pivot=0.3}},
Particle={Tex="shines1.png", u={Speed=1.9, OffsetY=-0.3, Amount=8, Scale=0.4}},
},
eye={
Bg={Base={Tex="anim/eye.jpg"}, u={Pivot=0.38}},
Particle={ Tex=pt.lightsPink, u={OffsetY=-0.02, Amount=9, Speed=2.0} },
speed=0.4
},
sky={
Bg={Base={Tex={bt.skyIv,bt.skyIv2}}},
Tunnel={Tex="clouds.png", u={Sides=16, Fog=15, Stretch=0.07, VortexEffect=true}},
Center={
Tex={{speed=0.9, u={TunnelFog=100, TunnelVortexFactor=5}},{"sdvx_iv.png",u={CenterScale=10,CenterOffsetY=0}}},
u={Float=true, Scale=5, FloatXFactor=2, OffsetY=-0.02}
},
Particle={Tex="shines1.png", u={Amount=8, OffsetY=-0.3, Speed=1.9, Scale=0.5}},
speed=0.5, bright=true
},
-- skyDark={
-- Bg={Base={Tex={"sky-iv-dark.jpg"}}},
-- Tunnel={Tex={"clouds-dark.png","clouds-dark-c.png"}, u={Sides=16, Fog=100, Stretch=0.07, VortexEffect=true, VortexFactor=5}},
-- speed=0.9,
-- },
hexagons={
Tunnel={Tex={{"hexagons.png", "hexagons-c.png"},{"hexagons-gray.png","hexagons.png"}}, u={ExtraRotation=-0.125, Fog=30}},
Particle={Tex="hexes.png", u={Amount=3, OffsetY=-0.2, Speed=1.9, Scale=0.7}},
speed=1.2,weight=2
},
dome={ -- todo: fix rotation
Bg={Base={Tex={bt.redblur,bt.redgradient,bt._}}},
Tunnel={Tex={"dome.png","dome-c.png"}, u={ExtraRotation=-0.125/2, Fog=30, Stretch=0.09}},
Center={
Tex={{"glowshine_green.png",weight=2},{0}}, u={Scale=13, Pulse=true, Glow=true},
LayerEffect={Tex="glowshine_sun.png", Glow=true, Scale=0.8}
},
Particle={Tex=pt.lightsYellowGreen, u={Amount=4, OffsetY=0, Speed=1.9}},
speed=0.6,
},
domeRed={
Bg={Base={Tex={bc(bt.redblur,{u={CenterScale=9}}),bt.redgradient,bt._}}},
Tunnel={Tex={"dome-red.png","dome-red-c.png"}, u={ExtraRotation=-0.125/2, Fog=30, Stretch=0.09}},
Center={
Tex={{"glowshine_pink.png",weight=2},{0}}, u={Scale=13, Pulse=true, Glow=true},
LayerEffect={Tex="glowshine_orange.png", Glow=true, Scale=0.8}
},
Particle={Tex=pt.lightsOrangePink, u={Amount=4, OffsetY=0, Speed=1.9}},
speed=0.6
},
iseki={
Tunnel={
Tex={{"iseki.png","iseki-c.png",u={TunnelExtraRotation=-0.125/2}}},
u={Sides=16, Stretch=0.1, FlashEffect=true, Fog=25.0}
},
Center={Tex={{"kac_maxima_gold.png"},{0,weight=4}}, u={Float=true, Scale=5, OffsetY=0.04}, LayerEffect={Tex="kac_hikari_iseki.png", Scale=0.7}},
Particle={Tex=pt.lightsYellow, u={Amount=6, OffsetY=0, Speed=1.9}},
speed=0.5,
},
idofront={
Tunnel={
Tex={{"idofront.png","idofront-c.png",u={TunnelExtraRotation=-0.125/2}}},
u={Sides=16, Stretch=0.1, Fog=25.0}
},
Particle={Tex=pt.lightsPurplish, u={Amount=5, Scale=1.3, Speed=1.9}},
},
genom={
Tunnel={
Tex={{"genom.png","genom-c.png",u={TunnelExtraRotation=-0.125/2*0}}},
u={Sides=16, Stretch=0.1, Fog=25.0}
},
Particle={Tex=pt.lightsOrangePink, u={Amount=5, Scale=1.3, Speed=1.9}},
speed=0.7
},
twilight={
Bg={ Base={Tex=bt.twilight, ScaleSoft=true}},
Tunnel={Tex={"wave-orange.png","wave-orange-c.png"}, u={Sides=4, Stretch=0.15, ScaleX=0.8, ScaleY=0.8, FlashEffect=true, Fog=14.0}},
Center={ Tex="moon_twilight.png", u={Scale=8.0, OffsetY=-0.05}, LayerEffect={Tex="moon_twilight_shine.png", Glow=true} },
Particle={ Tex=pt.twilight, u={OffsetY=-0.3, Amount=5, Speed=1.5, Scale=0.5} },
},
shinwa={ -- todo: put clouds in extra layer of center, remove weird 'bg is static but overlay can tilt' logic
Bg={ Base={Tex="cyberspace_sunrise.png", OffsetY=-0.23, Tilt=false, ClampTiling=true}, Overlay={Tex="cyberspace_sunrise-f.png", Tilt=true, OffsetY=-0.1}},
Center={ Tex={"shinwa.png"}, u={Scale=9.0, OffsetY=0, Float=true, Pulse=true}, LayerEffect={Tex="cyberspace_shine.png", Glow=true, Alpha=0.8, Scale=1, Rotate=true, RotateSpeed=-5} },
Particle={ Tex=pt.lightsYellow, u={OffsetY=-0.3, Amount=9, Speed=2, Scale=0.5} },
},
beach={
Bg={ Base={Tex="beach.png", ScaleSoft=true}},
Center={ Tex={"glowshine_orange.png","glowshine_sun.png"}, u={Scale=8.0, OffsetY=-0.05, Float=true}, LayerEffect={Tex="glowshine_sun.png", Glow=true, Scale=0.9} },
Particle={ Tex=pt.lightsYellow, u={OffsetY=-0.3, Amount=9, Speed=2, Scale=0.5} },
bright=true
},
sonar={
Bg={ Base={Tex={bt.undersea,bt.watervault,bt.underwater}}},
Center={ Tex={"magic_circle.png","magic_circle-c.png"}, u={Scale=2.6, Rotate=true}, LayerEffect={Tex="sonar.png", Rotate=true, RotateSpeed=-10, Scale=3} },
Particle={ Tex=pt.lightsSea, u={OffsetY=-0.1, Amount=9, Speed=1.7} },
},
star={
Bg={ Base={Tex=bt.star, ScaleSoft=true, Tilt=false}},
Center={ Tex="star_core.png", u={Scale=2.15, Tilt=false, SnapToTrack=false, OffsetY=-0.04}, LayerEffect={Tex="star_core.png", Glow=true, DodgeBlend=true } },
Particle={ Tex=pt.starParticles, u={OffsetY=-0.1, Amount=9, Speed=1.7} },
Tunnel={ Tex={"electro.png", "electro-c.png"}, u={Sides=12, Stretch=0.12, ScaleY=0.9, Fog=18.0, ExtraRotation=-0.125}},
},
-- beams={
-- Tunnel={
-- Tex={{"beams.png","beams-c.png",u={TunnelExtraRotation=-0.125/2}}},
-- u={Sides=16, Stretch=0.1, Fog=25.0}
-- },
-- },
}
-- local bgTrumpcard=bgs.shinwa
-- local bgNestedIndices = {
-- -- BgBase=1,
-- -- Tunnel=1,
-- Center=1
-- }
local function stringToNumber(str)
local number = 0
for i = 1, string.len(str) do
number = number + string.byte(str, i)
end
return number
end
local function sign(x)
return x>0 and 1 or x<0 and -1 or 0
end
local function setUniform(key, value)
local valueType = type(value)
if valueType == "number" then
background.SetParamf(key, value)
elseif valueType == "boolean" then
background.SetParami(key, value and 1 or 0)
else
game.Log("Weird param type was passed to setUniform", 1)
end
end
-----------------
-- PARTICLE STUFF
-----------------
local resx, resy = game.GetResolution()
local portrait = resy > resx
local desw = portrait and 720 or 1280
local desh = desw * (resy / resx)
local scale = resx / desw
local shouldRenderParticles = false
local particleTextures = {}
local particles = {}
local psizes = {}
local particleCount = 30
local particleSizeSpread = 0.5
local function initializeParticle(initial)
local particle = {}
particle.x = math.random()
particle.y = math.random() * 1.2 - 0.1
if not initial then particle.y = -0.1 end
particle.r = math.random()
particle.s = (math.random() - 0.5) * particleSizeSpread + 1.0
particle.xv = 0
particle.yv = 0.1
particle.rv = math.random() * 2.0 - 1.0
particle.p = math.random() * math.pi * 2
particle.t = math.random(1, #psizes)
return particle
end
local function renderParticles(deltaTime)
local alpha = 0.3 + 0.5 * background.GetClearTransition()
for i,p in ipairs(particles) do
p.x = p.x + p.xv * deltaTime
p.y = p.y + p.yv * deltaTime
p.r = p.r + p.rv * deltaTime
p.p = (p.p + deltaTime) % (math.pi * 2)
p.xv = 0.5 - ((p.x * 2) % 1) + (0.5 * sign(p.x - 0.5))
p.xv = math.max(math.abs(p.xv * 2) - 1, 0) * sign(p.xv)
p.xv = p.xv * p.y
p.xv = p.xv + math.sin(p.p) * 0.01
gfx.Save()
gfx.ResetTransform()
gfx.Translate(p.x * resx, p.y * resy)
gfx.Rotate(p.r)
gfx.Scale(p.s * scale, p.s * scale)
gfx.BeginPath()
gfx.GlobalCompositeOperation(gfx.BLEND_OP_LIGHTER)
gfx.ImageRect(-psizes[p.t]/2, -psizes[p.t]/2, psizes[p.t], psizes[p.t], particleTextures[p.t], alpha, 0)
gfx.Restore()
if p.y > 1.1 then
particles[i] = initializeParticle(false)
end
end
gfx.ForceRender()
end
local function getRandomItemFromArray(array, seed)
if #array == 1 then return array[1] end
local weightedArray = {}
for i, value in ipairs(array) do
local weight = value.weight or 1
for j = 1, weight do
weightedArray[#weightedArray+1] = value
end
end
math.randomseed(stringToNumber(seed))
return weightedArray[math.random(#weightedArray)]
end
local function getImageDimensions(imagePath)
return gfx.ImageSize( gfx.CreateImage(background.GetPath().."textures/"..imagePath, 0) )
end
local function filterArray(array, propertyToRemove)
local newArray = {}
for i, v in ipairs(array) do
if not v[propertyToRemove] then newArray[#newArray+1] = v end
end
return newArray
end
local function filterTable(table, propertyToRemove)
local newTable = {}
for k, v in pairs(table) do
if not v[propertyToRemove] then newTable[k] = v end
end
return newTable
end
local function loadTextures(prefix, tex, subFolder, checkAnim, noAnimCallback, setNormalVersion)
local texture
if type(tex) == "string" then
texture = {tex}
elseif type(tex[1]) == "string" then
texture = tex
else
if dark then tex = filterArray(tex, "bright") end
if bgNestedIndices and bgNestedIndices[prefix] then
texture = tex[bgNestedIndices[prefix]]
else
texture = getRandomItemFromArray(tex, prefix..gameplay.title..gameplay.artist) -- todo: improve seeding
end
end
if texture[1] == 0 then
return false
end
if texture[1] then
if setNormalVersion then
setUniform(prefix.."NormalVersion", true)
end
background.LoadTexture(prefix.."Tex", "textures/"..subFolder.."/"..texture[1])
end
if texture[2] then
setUniform(prefix.."ClearVersion", true)
background.LoadTexture(prefix.."ClearTex", "textures/"..subFolder.."/"..texture[2])
end
if checkAnim and texture[1] then
local w, h = getImageDimensions(subFolder.."/"..texture[1])
if w / h > 2 then
setUniform(prefix.."Anim", true)
setUniform(prefix.."AnimFramesCount", math.floor(w / 600))
elseif noAnimCallback then
noAnimCallback(w, h)
end
end
if texture.u then
for k,v in pairs(texture.u) do
delayedOperations.u[k] = v
end
end
if texture.speed then delayedOperations.speed = texture.speed end
return true
end
local function setUniformsRaw(uniforms)
for k,v in pairs(uniforms) do setUniform(k, v) end
end
local function setUniforms(prefix, uniforms, subFolder, checkAnim, noAnimCallback)
for k, v in pairs(uniforms) do
if k == "Tex" then
loadTextures(prefix, v, subFolder, checkAnim, noAnimCallback)
else
setUniform(prefix..k, v)
end
end
end
local function loadPart(prefix, part, subFolder, checkAnim, setNormalVersion)
local loaded
if part.Tex then
loaded = loadTextures(prefix, part.Tex, subFolder, checkAnim, nil, setNormalVersion)
else
loaded = true
end
if loaded then
setUniform(prefix, true)
end
if part.u then
setUniforms(prefix, part.u, subFolder)
end
end
local function randomItemFromTable(table)
local keys = {}
for key, value in pairs(table) do
local weight = value.weight or 1
for i = 1, weight do
keys[#keys+1] = key
end
end
local index = keys[math.random(#keys)]
return table[index], index
end
local function processDelayedOperations()
setUniformsRaw(delayedOperations.u)
if delayedOperations.speed then background.SetSpeedMult(delayedOperations.speed) end
end
local function loadBackground(bg)
if bg.Bg then
local part = bg.Bg
local prefix = "Bg"
loadPart(prefix, part, "background")
if part.Base then
setUniform(prefix.."Base", true)
setUniforms(prefix.."Base", part.Base, "background", true, function(w,h) setUniform(prefix.."Base".."AR", w / h) end)
end
if part.Overlay then
setUniform(prefix.."Overlay", true)
setUniforms(prefix.."Overlay", part.Overlay, "background")
end
if part.Layer then
setUniform(prefix.."Layer", true)
setUniforms(prefix.."Layer", part.Layer, "layer", true)
end
end
if bg.Center then
local part = bg.Center
local prefix = "Center"
loadPart(prefix, part, "center", true, true)
if part.LayerEffect then
setUniform(prefix.."LayerEffect", true)
setUniforms(prefix.."LayerEffect", part.LayerEffect, "center")
end
end
if bg.Tunnel then
local part = bg.Tunnel
local prefix = "Tunnel"
loadPart(prefix, part, "tunnel")
end
if bg.Particle then
local part = bg.Particle
local prefix = "Particle"
loadPart(prefix, part, "particle")
end
background.SetSpeedMult(bg.speed or 1.0)
processDelayedOperations()
if bg.luaParticleEffect then
shouldRenderParticles = true
for i, p in ipairs(bg.luaParticleEffect.particles) do
particleTextures[i] = gfx.CreateImage(background.GetPath().."textures/luaparticle/" .. p[1], 0)
psizes[i] = p[2]
end
for i=1,particleCount do
particles[i] = initializeParticle(true)
end
end
end
if dark then
bgs = filterTable(bgs, "bright")
end
math.randomseed(stringToNumber(gameplay.title))
local bg, k = randomItemFromTable(bgs)
game.Log("bg:", 0)
game.Log(tostring(k), 0)
if bgTrumpcard then bg = bgTrumpcard end
loadBackground(bg)
function render_bg(deltaTime)
background.DrawShader()
if shouldRenderParticles then renderParticles(deltaTime) end
end

View File

@ -0,0 +1,86 @@
local newFormatTemplate = {
{
Bg={
Base={
Tex={{"",""}},
Tilt=false,
OffsetY=0.17,
Anim=true,
ScaleSoft=false,
ClampTiling=false,
},
Overlay={ -- is meant to be displayed overtop Base
Tex="",
Float=true,
FloatFactor=2.0,
OffsetY=0.12,
FlashEffect=true,
Tilt=true,
},
Layer={
Tex={{"",""}},
ScaleHard=false,
Brighten=0.6,
},
u={
Pivot=0.36
},
},
Center={
Tex={{"",""}},
u={
Scale=2.8,
Pulse=true,
Float=true,
FloatFactor=0.5,
FloatXFactor=0,
FloatRotationFactor=0,
FadeEffect=true,
Tilt=false,
Anim=true,
OffsetY=-0.1,
Glow=false,
Rotate=false,
},
LayerEffect={
Tex="",
Fade=true,
Rotate=true,
RotateSpeed=-2.0,
DodgeBlend=true,
Glow=true,
Alpha=0.7,
Scale=0.5,
},
},
Tunnel={ -- todo: give option to do sth with blend mode
Tex={{"",""}},
u={
Stretch=0.3,
ScaleX=0.8,
ScaleY=0.9,
Fog=10.0,
FlashEffect=true,
VortexEffect=false,
VortexFactor=1.0,
DodgeBlend=false
}
},
Particle={
Tex={{"",""}},
u={
Speed=0.3,
OffsetY=-0.02,
Amount=3,
Scale=1.0,
ExtraRotation=0.125
},
},
luaParticleEffect={
particles={
{"star-particle.png", 32}
}
},
speed=0.6,
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Some files were not shown because too many files have changed in this diff Show More