Skip to content

Commit f665347

Browse files
authored
Merge pull request #9 from CommunalHelper/bigkahuna443/sync-kevin-versions
Sync Kevin reskin features
2 parents cc94fe6 + 9bb0eef commit f665347

8 files changed

Lines changed: 260 additions & 186 deletions

File tree

Code/Entities/NonReturnCrushBlock.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,23 @@ public NonReturnCrushBlock(EntityData data, Vector2 offset) : base(data.Position
1616
axes = data.Enum("axes", Axes.Both);
1717
chillOut = data.Bool("chillOut", false);
1818

19-
// Backwards compatibility for toggled texture
20-
altTexture = data.Bool("altTexture", true);
21-
if (altTexture)
22-
{
19+
if (data.Bool("reskinnable")) {
20+
P_Crushing = new ParticleType(P_Crushing) {
21+
Color = Calc.HexToColor(data.Attr("crushParticleColor1", "ff66e2")),
22+
Color2 = Calc.HexToColor(data.Attr("crushParticleColor2", "68fcff")),
23+
};
24+
25+
P_Activate = new ParticleType(P_Activate) {
26+
Color = Calc.HexToColor(data.Attr("activateParticleColor1", "5fcde4")),
27+
Color2 = Calc.HexToColor(data.Attr("activateParticleColor2", "ffffff")),
28+
};
29+
2330
spriteDirectory = data.Attr("spriteDirectory", "objects/noReturnKevin");
2431
fill = Calc.HexToColor(data.Attr("fillColor", "242262"));
25-
}
26-
else
27-
{
32+
} else if (data.Bool("altTexture", true)) {
33+
spriteDirectory = data.Attr("spriteDirectory", "objects/noReturnKevin");
34+
fill = Calc.HexToColor(data.Attr("fillColor", "242262"));
35+
} else {
2836
spriteDirectory = "objects/crushblock";
2937
fill = Calc.HexToColor("62222b");
3038
}
@@ -466,7 +474,7 @@ private void ActivateParticles(Vector2 dir)
466474
}
467475
}
468476
num += 2;
469-
this.level.Particles.Emit(CrushBlock.P_Activate, num, position, positionRange, direction);
477+
this.level.Particles.Emit(P_Activate, num, position, positionRange, direction);
470478
}
471479

472480
private IEnumerator AttackSequence()

Code/Entities/NonReturnSokoban.cs

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,48 @@ namespace Celeste.Mod.CherryHelper
1111
public class NonReturnSokoban : Solid
1212
{
1313

14-
public NonReturnSokoban(Vector2 position, float width, float height, Axes axes, bool chillOut = false, bool altTexture = false) : base(position, width, height, false)
15-
{
16-
this.altTexture = altTexture;
17-
this.fill = altTexture ? Calc.HexToColor("C38A06"): Calc.HexToColor("242262");
18-
altTextureString = (altTexture ? "objects/noReturnSokoban/" : "objects/noReturnSokobanAlt/");
14+
private string spriteDirectory;
15+
public NonReturnSokoban(EntityData data, Vector2 offset) : base(data.Position + offset, data.Width, data.Height, false) {
16+
axes = data.Enum("axes", Axes.Both);
17+
chillOut = data.Bool("chillOut", false);
18+
19+
if (data.Bool("reskinnable")) {
20+
P_Crushing = new ParticleType(P_Crushing) {
21+
Color = Calc.HexToColor(data.Attr("crushParticleColor1", "ff66e2")),
22+
Color2 = Calc.HexToColor(data.Attr("crushParticleColor2", "68fcff")),
23+
};
24+
25+
P_Activate = new ParticleType(P_Activate) {
26+
Color = Calc.HexToColor(data.Attr("activateParticleColor1", "5fcde4")),
27+
Color2 = Calc.HexToColor(data.Attr("activateParticleColor2", "ffffff")),
28+
};
29+
30+
spriteDirectory = data.Attr("spriteDirectory", "objects/noReturnSokobanAlt");
31+
fill = Calc.HexToColor(data.Attr("fillColor", "242262"));
32+
} else if (data.Bool("altTexture", true)) {
33+
spriteDirectory = data.Attr("spriteDirectory", "objects/noReturnSokobanAlt");
34+
fill = Calc.HexToColor(data.Attr("fillColor", "242262"));
35+
} else {
36+
spriteDirectory = "objects/noReturnSokoban";
37+
fill = Calc.HexToColor("c38a06");
38+
}
39+
40+
1941
this.idleImages = new List<Image>();
2042
this.activeTopImages = new List<Image>();
2143
this.activeRightImages = new List<Image>();
2244
this.activeLeftImages = new List<Image>();
2345
this.activeBottomImages = new List<Image>();
2446
this.OnDashCollide = new DashCollision(this.OnDashed);
2547
this.returnStack = new List<NonReturnSokoban.MoveState>();
26-
this.chillOut = chillOut;
2748
this.giant = (Width >= 48f && Height >= 48f && chillOut);
2849
this.canActivate = true;
2950
this.attackCoroutine = new Coroutine(true);
3051
this.attackCoroutine.RemoveOnComplete = false;
3152
Add(this.attackCoroutine);
32-
List<MTexture> atlasSubtextures = GFX.Game.GetAtlasSubtextures(altTextureString + "block");
53+
List<MTexture> atlasSubtextures = GFX.Game.GetAtlasSubtextures(spriteDirectory + "/block");
3354
MTexture idle;
34-
switch (axes)
35-
{
55+
switch (axes) {
3656
default:
3757
idle = atlasSubtextures[3];
3858
this.canMoveHorizontally = (this.canMoveVertically = true);
@@ -48,21 +68,43 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
4868
this.canMoveVertically = true;
4969
break;
5070
}
51-
if (!altTexture)
52-
{
53-
Add(this.face = GFX.SpriteBank.Create("NoReturnSokobanAlt_face"));
54-
}
55-
else
56-
{
57-
Add(this.face = GFX.SpriteBank.Create("NoReturnSokoban_face"));
58-
}
59-
this.face.Position = new Vector2(Width, Height) / 2f;
60-
this.face.Play("idle", false, false);
61-
this.face.OnLastFrame = delegate (string f)
62-
{
71+
Add(face = new Sprite(GFX.Game, spriteDirectory + "/"));
72+
face.Position = new Vector2(Width, Height) / 2f;
73+
if (giant) {
74+
/*
75+
<Loop id="idle" path="giant_block" frames="0" delay="0.08"/>
76+
<Anim id="hurt" path="giant_block" frames="8-12" delay="0.08" goto="idle"/>
77+
<Anim id="hit" path="giant_block" frames="0-5" delay="0.08"/>
78+
<Loop id="right" path="giant_block" frames="6,7" delay="0.08"/>
79+
*/
80+
face.AddLoop("idle", "giant_block", 0.08f, 0);
81+
face.Add("hurt", "giant_block", 0.08f, "idle", 8, 9, 10, 11, 12);
82+
face.Add("hit", "giant_block", 0.08f, 0, 1, 2, 3, 4, 5);
83+
face.AddLoop("right", "giant_block", 0.08f, 6, 7);
84+
} else {
85+
/*
86+
<Loop id="idle" path="idle_face" delay="0.08"/>
87+
<Anim id="hurt" path="hurt" frames="3-12" delay="0.08" goto="idle"/>
88+
<Anim id="hit" path="hit" delay="0.08"/>
89+
<Loop id="left" path="hit_left" delay="0.08"/>
90+
<Loop id="right" path="hit_right" delay="0.08"/>
91+
<Loop id="up" path="hit_up" delay="0.08"/>
92+
<Loop id="down" path="hit_down" delay="0.08"/>
93+
*/
94+
95+
face.AddLoop("idle", "idle_face", 0.08f);
96+
face.Add("hurt", "hurt", 0.08f, "idle", 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
97+
face.Add("hit", "hit", 0.08f);
98+
face.AddLoop("left", "hit_left", 0.08f);
99+
face.AddLoop("right", "hit_right", 0.08f);
100+
face.AddLoop("up", "hit_up", 0.08f);
101+
face.AddLoop("down", "hit_down", 0.08f);
102+
}
103+
face.CenterOrigin();
104+
face.Play("idle");
105+
this.face.OnLastFrame = delegate (string f) {
63106
bool flag = f == "hit";
64-
if (flag)
65-
{
107+
if (flag) {
66108
this.face.Play(this.nextFaceDirection, false, false);
67109
}
68110
};
@@ -72,13 +114,11 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
72114
this.AddImage(idle, num, 0, 3, 0, 1, -1);
73115
this.AddImage(idle, 0, num2, 0, 3, -1, 1);
74116
this.AddImage(idle, num, num2, 3, 3, 1, 1);
75-
for (int i = 1; i < num; i++)
76-
{
117+
for (int i = 1; i < num; i++) {
77118
this.AddImage(idle, i, 0, Calc.Random.Choose(1, 2), 0, 0, -1);
78119
this.AddImage(idle, i, num2, Calc.Random.Choose(1, 2), 3, 0, 1);
79120
}
80-
for (int j = 1; j < num2; j++)
81-
{
121+
for (int j = 1; j < num2; j++) {
82122
this.AddImage(idle, 0, j, 0, Calc.Random.Choose(1, 2), -1, 0);
83123
this.AddImage(idle, num, j, 3, Calc.Random.Choose(1, 2), 1, 0);
84124
}
@@ -87,10 +127,6 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
87127
Add(new WaterInteraction(() => this.crushDir != Vector2.Zero));
88128
}
89129

90-
public NonReturnSokoban(EntityData data, Vector2 offset) : this(data.Position + offset, (float)data.Width, (float)data.Height, data.Enum<NonReturnSokoban.Axes>("axes", Axes.Both), data.Bool("chillout", false), data.Bool("altTexture", false))
91-
{
92-
}
93-
94130
public override void Added(Scene scene)
95131
{
96132
base.Added(scene);
@@ -191,7 +227,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
191227
bool flag4 = borderX < 0;
192228
if (flag4)
193229
{
194-
Image image2 = new Image(GFX.Game[altTextureString + "lit_left"].GetSubtexture(0, ty * 8, 8, 8, null));
230+
Image image2 = new Image(GFX.Game[spriteDirectory + "/lit_left"].GetSubtexture(0, ty * 8, 8, 8, null));
195231
this.activeLeftImages.Add(image2);
196232
image2.Position = vector;
197233
image2.Visible = false;
@@ -202,7 +238,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
202238
bool flag5 = borderX > 0;
203239
if (flag5)
204240
{
205-
Image image3 = new Image(GFX.Game[altTextureString + "lit_right"].GetSubtexture(0, ty * 8, 8, 8, null));
241+
Image image3 = new Image(GFX.Game[spriteDirectory + "/lit_right"].GetSubtexture(0, ty * 8, 8, 8, null));
206242
this.activeRightImages.Add(image3);
207243
image3.Position = vector;
208244
image3.Visible = false;
@@ -212,7 +248,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
212248
bool flag6 = borderY < 0;
213249
if (flag6)
214250
{
215-
Image image4 = new Image(GFX.Game[altTextureString + "lit_top"].GetSubtexture(tx * 8, 0, 8, 8, null));
251+
Image image4 = new Image(GFX.Game[spriteDirectory + "/lit_top"].GetSubtexture(tx * 8, 0, 8, 8, null));
216252
this.activeTopImages.Add(image4);
217253
image4.Position = vector;
218254
image4.Visible = false;
@@ -223,7 +259,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
223259
bool flag7 = borderY > 0;
224260
if (flag7)
225261
{
226-
Image image5 = new Image(GFX.Game[altTextureString + "lit_bottom"].GetSubtexture(tx * 8, 0, 8, 8, null));
262+
Image image5 = new Image(GFX.Game[spriteDirectory + "/lit_bottom"].GetSubtexture(tx * 8, 0, 8, 8, null));
227263
this.activeBottomImages.Add(image5);
228264
image5.Position = vector;
229265
image5.Visible = false;
@@ -431,7 +467,7 @@ private void ActivateParticles(Vector2 dir)
431467
}
432468
}
433469
num += 2;
434-
this.level.Particles.Emit(CrushBlock.P_Activate, num, position, positionRange, direction);
470+
this.level.Particles.Emit(P_Activate, num, position, positionRange, direction);
435471
}
436472

437473
private IEnumerator AttackSequence()
@@ -647,7 +683,7 @@ private IEnumerator AttackSequence()
647683
}, Alarm.AlarmMode.Oneshot);
648684
this.crushDir = Vector2.Zero;
649685
this.TurnOffImages();
650-
this.face.Play("hurt", false, false);
686+
yield return this.face.PlayRoutine("hurt", false);
651687
this.face.Play("idle", false, false);
652688
yield break;
653689
}
@@ -767,8 +803,8 @@ private bool MoveVCheck(float amount)
767803

768804
// Token: 0x040007F0 RID: 2032
769805
public Color fill;
806+
public Axes axes;
770807
private bool altTexture;
771-
public string altTextureString;
772808

773809
// Token: 0x040007F1 RID: 2033
774810
private Level level;

Code/Entities/UninterruptedNRCB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ private IEnumerator AttackSequence()
687687
}, Alarm.AlarmMode.Oneshot);
688688
this.crushDir = Vector2.Zero;
689689
this.TurnOffImages();
690-
this.face.Play("hurt", false, false);
690+
yield return this.face.PlayRoutine("hurt", false);
691691
this.face.Play("idle", false, false);
692692
yield break;
693693
}

Graphics/Sprites.xml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<Sprites>
3-
<NoReturnSokoban_face path="objects/noReturnSokoban/" start="idle">
4-
<Center/>
5-
<Loop id="idle" path="idle_face" delay="0.08"/>
6-
<Anim id="hurt" path="hurt" frames="3-12" delay="0.08" goto="idle"/>
7-
<Anim id="hit" path="hit" delay="0.08"/>
8-
<Loop id="left" path="hit_left" delay="0.08"/>
9-
<Loop id="right" path="hit_right" delay="0.08"/>
10-
<Loop id="up" path="hit_up" delay="0.08"/>
11-
<Loop id="down" path="hit_down" delay="0.08"/>
12-
</NoReturnSokoban_face>
13-
<NoReturnSokobanAlt_face path="objects/noReturnSokobanAlt/" start="idle">
14-
<Center/>
15-
<Loop id="idle" path="idle_face" delay="0.08"/>
16-
<Anim id="hurt" path="hurt" frames="3-12" delay="0.08" goto="idle"/>
17-
<Anim id="hit" path="hit" delay="0.08"/>
18-
<Loop id="left" path="hit_left" delay="0.08"/>
19-
<Loop id="right" path="hit_right" delay="0.08"/>
20-
<Loop id="up" path="hit_up" delay="0.08"/>
21-
<Loop id="down" path="hit_down" delay="0.08"/>
22-
</NoReturnSokobanAlt_face>
233
<hat path="kidshat/" start="hat">
244
<Justify x=".5" y="1" />
255
<Loop id="hat" path="hat" delay="0.8"/>

0 commit comments

Comments
 (0)