Skip to content

Commit 448d1ae

Browse files
committed
Move berry sprites to Graphics/Sprites.xml to make them reskinnable
1 parent d91344b commit 448d1ae

File tree

11 files changed

+87
-109
lines changed

11 files changed

+87
-109
lines changed

CollabModule.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ private void onModAssetUpdate(ModAsset oldAsset, ModAsset newAsset) {
8787
}
8888

8989
public override void LoadContent(bool firstLoad) {
90-
SilverBerry.LoadContent();
91-
RainbowBerry.LoadContent();
92-
SpeedBerry.LoadContent();
93-
9490
reloadCrystalHeartSwapSpriteBanks();
9591
}
9692

Entities/HoloRainbowBerry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public HoloRainbowBerry(Vector2 position, int currentBerries, int totalBerries)
3333
}
3434

3535
// create the sprites, overlap them, and give them transparency.
36-
sprite = RainbowBerry.SpriteBank.Create("holoRainbowBerry");
37-
desaturatedSprite = RainbowBerry.SpriteBank.Create("desaturatedHoloRainbowBerry");
36+
sprite = GFX.SpriteBank.Create("CollabUtils2_holoRainbowBerry");
37+
desaturatedSprite = GFX.SpriteBank.Create("CollabUtils2_desaturatedHoloRainbowBerry");
3838

3939
sprite.Color *= (transparencyProgress * saturationProgress);
4040
desaturatedSprite.Color *= transparencyProgress * (1 - saturationProgress);

Entities/RainbowBerry.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ namespace Celeste.Mod.CollabUtils2.Entities {
1111
[CustomEntity("CollabUtils2/RainbowBerry")]
1212
[RegisterStrawberry(tracked: false, blocksCollection: false)]
1313
class RainbowBerry : Strawberry {
14-
public static SpriteBank SpriteBank;
15-
1614
private string levelSet;
1715

1816
internal HoloRainbowBerry HologramForCutscene;
1917
internal int CutsceneTotalBerries;
2018

21-
public static void LoadContent() {
22-
SpriteBank = new SpriteBank(GFX.Game, "Graphics/CollabUtils2/RainbowBerry.xml");
23-
}
24-
2519
public RainbowBerry(EntityData data, Vector2 offset, EntityID gid) : base(data, offset, gid) {
2620
levelSet = data.Attr("levelSet");
2721
}

Entities/RainbowBerryPerfectEffect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public RainbowBerryPerfectEffect(Vector2 position)
99

1010
Sprite sprite;
1111
Depth = -1000000;
12-
Add(sprite = RainbowBerry.SpriteBank.Create("perfectAnimation"));
12+
Add(sprite = GFX.SpriteBank.Create("CollabUtils2_perfectAnimation"));
1313
sprite.OnLastFrame = delegate {
1414
RemoveSelf();
1515
};

Entities/SilverBerry.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@ namespace Celeste.Mod.CollabUtils2.Entities {
1010
[CustomEntity("CollabUtils2/SilverBerry")]
1111
[RegisterStrawberry(tracked: false, blocksCollection: true)]
1212
class SilverBerry : Strawberry {
13-
public static SpriteBank SpriteBank;
14-
1513
private static ParticleType P_SilverGlow;
1614
private static ParticleType P_OrigGoldGlow;
1715
private static ParticleType P_SilverGhostGlow;
1816
private static ParticleType P_OrigGhostGlow;
1917

20-
public static void LoadContent() {
21-
SpriteBank = new SpriteBank(GFX.Game, "Graphics/CollabUtils2/SilverBerry.xml");
22-
}
23-
2418
private bool spawnedThroughGiveSilver = false;
2519

2620
public SilverBerry(EntityData data, Vector2 offset, EntityID gid) : base(data, offset, gid) {

Entities/SpeedBerry.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ namespace Celeste.Mod.CollabUtils2.Entities {
1414
[CustomEntity("CollabUtils2/SpeedBerry")]
1515
[Tracked]
1616
public class SpeedBerry : Strawberry {
17-
18-
public static SpriteBank SpriteBank;
19-
2017
public EntityData EntityData;
2118
public float BronzeTime;
2219
public float SilverTime;
@@ -64,10 +61,6 @@ private static void onTransitionEnd(On.Celeste.Player.orig_OnTransition orig, Pl
6461
if (speedBerry != null) {
6562
speedBerry.TimerDisplay?.StartTimer();
6663
}
67-
}
68-
69-
public static void LoadContent() {
70-
SpriteBank = new SpriteBank(GFX.Game, "Graphics/CollabUtils2/SpeedBerry.xml");
7164
}
7265

7366
public SpeedBerry(EntityData data, Vector2 offset, EntityID id, bool restored) : base(data, offset, id) {
@@ -211,7 +204,7 @@ public override void Update() {
211204
private static void playAnimationSpeedrunToolSafe(Sprite sprite, string animation) {
212205
if (sprite.Texture?.AtlasPath?.StartsWith("collectables/speedrun_tool_goldberry/") ?? false) {
213206
// this means Speedrun Tool replaced the sprite, so replace it again or we are going to crash.
214-
SpriteBank.CreateOn(sprite, "speedBerry");
207+
GFX.SpriteBank.CreateOn(sprite, "CollabUtils2_speedBerry");
215208
}
216209
sprite.Play(animation);
217210
}
@@ -232,7 +225,7 @@ private void dissolve() {
232225

233226
private class SpeedBerryExplosionAnimation : Entity {
234227
public SpeedBerryExplosionAnimation(Vector2 position) : base(position) {
235-
Add(SpriteBank.Create("speedBerryExplosion"));
228+
Add(GFX.SpriteBank.Create("CollabUtils2_speedBerryExplosion"));
236229
Depth = -1000000;
237230
}
238231
}

Entities/StrawberryHooks.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,21 @@ private static void modStrawberrySprite(ILContext il) {
107107
// this method determines the strawberry sprite. "orig" is the original sprite, "self" is the strawberry.
108108
if (self is SilverBerry) {
109109
if (SaveData.Instance.CheckStrawberry(self.ID)) {
110-
return SilverBerry.SpriteBank.Create("ghostSilverBerry");
110+
return GFX.SpriteBank.Create("CollabUtils2_ghostSilverBerry");
111111
}
112-
return SilverBerry.SpriteBank.Create("silverBerry");
112+
return GFX.SpriteBank.Create("CollabUtils2_silverBerry");
113113
}
114114
if (self is RainbowBerry) {
115115
if (SaveData.Instance.CheckStrawberry(self.ID)) {
116-
return RainbowBerry.SpriteBank.Create("ghostRainbowBerry");
116+
return GFX.SpriteBank.Create("CollabUtils2_ghostRainbowBerry");
117117
}
118-
return RainbowBerry.SpriteBank.Create("rainbowBerry");
118+
return GFX.SpriteBank.Create("CollabUtils2_rainbowBerry");
119119
}
120120
if (self is SpeedBerry) {
121121
if (SaveData.Instance.CheckStrawberry(self.ID)) {
122-
return SpeedBerry.SpriteBank.Create("ghostSpeedBerry");
122+
return GFX.SpriteBank.Create("CollabUtils2_ghostSpeedBerry");
123123
}
124-
return SpeedBerry.SpriteBank.Create("speedBerry");
124+
return GFX.SpriteBank.Create("CollabUtils2_speedBerry");
125125
}
126126
return orig;
127127
});

Graphics/CollabUtils2/RainbowBerry.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

Graphics/CollabUtils2/SilverBerry.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Graphics/CollabUtils2/SpeedBerry.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)