Spawn wave instruction

This commit is contained in:
Anuken
2022-04-25 18:52:33 -04:00
parent 1ac7317986
commit aab6c3a9df
9 changed files with 82 additions and 16 deletions

View File

@@ -8,6 +8,6 @@ varying vec2 v_texCoords;
void main(){ void main(){
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity; vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity; vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
original = original * (vec4(1.0) - bloom); original = original * (vec4(1.0) - vec4(bloom.rgb, 0.0));
gl_FragColor = original + bloom; gl_FragColor = original + bloom;
} }

View File

@@ -17,9 +17,9 @@ void main(){
+ far * texture2D(u_texture, v_texCoords4); + far * texture2D(u_texture, v_texCoords4);
//TODO this is broken. //TODO this is broken (too bright)
/*
/*
vec4 vec4
v1 = texture2D(u_texture, v_texCoords0), v1 = texture2D(u_texture, v_texCoords0),
v2 = texture2D(u_texture, v_texCoords1), v2 = texture2D(u_texture, v_texCoords1),
@@ -34,14 +34,13 @@ void main(){
a4 = v4.a * close, a4 = v4.a * close,
a5 = v5.a * far; a5 = v5.a * far;
//far close center close far
//TODO figure this out
//RGB values should be weighted by their respective alpha values.
gl_FragColor = vec4( gl_FragColor = vec4(
//RGB values are weighed by their alpha values and their base weight (less alpha -> less contribution)
(v1.rgb * a1 + v2.rgb * a2 + v3.rgb * a3 + v4.rgb * a4 + v5.rgb * a5) / (v1.rgb * a1 + v2.rgb * a2 + v3.rgb * a3 + v4.rgb * a4 + v5.rgb * a5) /
max(a1 + a2 + a3 + a4 + a5, 0.0001), //RGB must be weighed by the sum of all alpha processed. if a pixel contributes less weight, the multiplication is higher //RGB must then be weighed by the sum of all alpha processed. don't allow divide by zero
a1 + a2 + a3 + a4 + a5); //alpha is just the weighed sum max(a1 + a2 + a3 + a4 + a5, 0.0001),
//alpha is just the weighed sum
a1 + a2 + a3 + a4 + a5);*/
*/
} }

View File

@@ -951,7 +951,7 @@ setting.difficulty.insane = Insane
setting.difficulty.name = Difficulty: setting.difficulty.name = Difficulty:
setting.screenshake.name = Screen Shake setting.screenshake.name = Screen Shake
setting.bloomintensity.name = Bloom Intensity setting.bloomintensity.name = Bloom Intensity
setting.bloomblur.name = Bloom Blurs setting.bloomblur.name = Bloom Blur
setting.effects.name = Display Effects setting.effects.name = Display Effects
setting.destroyedblocks.name = Display Destroyed Blocks setting.destroyedblocks.name = Display Destroyed Blocks
setting.blockstatus.name = Display Block Status setting.blockstatus.name = Display Block Status

View File

@@ -2781,8 +2781,8 @@ public class UnitTypes{
float life = lifetime / Mathf.lerp(fin, 1f, 0.5f); float life = lifetime / Mathf.lerp(fin, 1f, 0.5f);
spawnBullets.add(new BasicBulletType(spd * fin, 45){{ spawnBullets.add(new BasicBulletType(spd * fin, 45){{
drag = 0.002f; drag = 0.002f;
width = 8f; width = 12f;
height = 10f; height = 11f;
lifetime = life + 5f; lifetime = life + 5f;
weaveRandom = false; weaveRandom = false;
hitSize = 5f; hitSize = 5f;

View File

@@ -1340,6 +1340,7 @@ public class LExecutor{
public void run(LExecutor exec){ public void run(LExecutor exec){
switch(rule){ switch(rule){
case waveTimer -> state.rules.waveTimer = exec.bool(value); case waveTimer -> state.rules.waveTimer = exec.bool(value);
case wave -> state.wave = exec.numi(value);
case currentWaveTime -> state.wavetime = exec.numf(value) * 60f; case currentWaveTime -> state.wavetime = exec.numf(value) * 60f;
case waves -> state.rules.waves = exec.bool(value); case waves -> state.rules.waves = exec.bool(value);
case attackMode -> state.rules.attackMode = exec.bool(value); case attackMode -> state.rules.attackMode = exec.bool(value);
@@ -1562,5 +1563,40 @@ public class LExecutor{
} }
} }
public static class SpawnWaveI implements LInstruction{
public int x, y;
public SpawnWaveI(){
}
public SpawnWaveI(int x, int y){
this.x = x;
this.y = y;
}
@Override
public void run(LExecutor exec){
float
spawnX = World.unconv(exec.numf(x)),
spawnY = World.unconv(exec.numf(y));
int packed = Point2.pack(exec.numi(x), exec.numi(y));
for(SpawnGroup group : state.rules.spawns){
if(group.type == null || (group.spawn != -1 && group.spawn != packed)) continue;
int spawned = group.getSpawned(state.wave - 1);
float spread = tilesize * 2;
for(int i = 0; i < spawned; i++){
Tmp.v1.rnd(spread);
Unit unit = group.createUnit(state.rules.waveTeam, state.wave - 1);
unit.set(spawnX + Tmp.v1.x, spawnY + Tmp.v1.y);
Vars.spawner.spawnEffect(unit);
}
}
}
}
//endregion //endregion
} }

View File

@@ -1234,6 +1234,36 @@ public class LStatements{
} }
} }
@RegisterStatement("spawnwave")
public static class SpawnWaveStatement extends LStatement{
public String x = "10", y = "10";
@Override
public void build(Table table){
table.add("x ");
fields(table, x, str -> x = str);
table.add(" y ");
fields(table, y, str -> y = str);
}
@Override
public boolean privileged(){
return true;
}
@Override
public Color color(){
return Pal.logicWorld;
}
@Override
public LInstruction build(LAssembler builder){
return new SpawnWaveI(builder.var(x), builder.var(y));
}
}
@RegisterStatement("setrule") @RegisterStatement("setrule")
public static class SetRuleStatement extends LStatement{ public static class SetRuleStatement extends LStatement{
public LogicRule rule = LogicRule.waveSpacing; public LogicRule rule = LogicRule.waveSpacing;

View File

@@ -4,6 +4,7 @@ public enum LogicRule{
currentWaveTime, currentWaveTime,
waveTimer, waveTimer,
waves, waves,
wave,
waveSpacing, waveSpacing,
attackMode, attackMode,
enemyCoreBuildRadius, enemyCoreBuildRadius,

View File

@@ -162,7 +162,7 @@ public class Floor extends Block{
} }
PixmapRegion image = Core.atlas.getPixmap(icons()[0]); PixmapRegion image = Core.atlas.getPixmap(icons()[0]);
PixmapRegion edge = Core.atlas.getPixmap("edge-stencil"); PixmapRegion edge = Core.atlas.getPixmap(Core.atlas.find(name + "-edge-stencil", "edge-stencil"));
Pixmap result = new Pixmap(edge.width, edge.height); Pixmap result = new Pixmap(edge.width, edge.height);
for(int x = 0; x < edge.width; x++){ for(int x = 0; x < edge.width; x++){

View File

@@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=871de12b14 archash=a625ec1c93