Skip to content

Commit 28a4b14

Browse files
authored
Merge branch 'master' into restore_light_sources_trigger
2 parents 40b5a23 + 99332cd commit 28a4b14

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module SpringCollab2020NegativeSummitCheckpoint
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/NegativeSummitCheckpoint" NegativeSummitCheckpoint(x::Integer, y::Integer, number::Integer=0)
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Negative Summit Checkpoint (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
NegativeSummitCheckpoint
10+
)
11+
)
12+
13+
baseSprite = "scenery/summitcheckpoints/base02.png"
14+
15+
function Ahorn.selection(entity::NegativeSummitCheckpoint)
16+
x, y = Ahorn.position(entity)
17+
18+
return Ahorn.getSpriteRectangle(baseSprite, x, y)
19+
end
20+
21+
function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NegativeSummitCheckpoint, room::Maple.Room)
22+
checkpointIndex = get(entity.data, "number", 0)
23+
24+
if checkpointIndex < 0
25+
digit1 = "10"
26+
digit2 = "0$(- checkpointIndex)"
27+
else
28+
digit1 = "0$(floor(Int, checkpointIndex % 100 / 10))"
29+
digit2 = "0$(checkpointIndex % 10)"
30+
end
31+
32+
Ahorn.drawSprite(ctx, baseSprite, 0, 0)
33+
Ahorn.drawSprite(ctx, "scenery/summitcheckpoints/numberbg$digit1.png", -2, 4)
34+
Ahorn.drawSprite(ctx, "scenery/summitcheckpoints/number$digit1.png", -2, 4)
35+
Ahorn.drawSprite(ctx, "scenery/summitcheckpoints/numberbg$digit2.png", 2, 4)
36+
Ahorn.drawSprite(ctx, "scenery/summitcheckpoints/number$digit2.png", 2, 4)
37+
end
38+
39+
end

Ahorn/lang/en_gb.lang

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ placements.entities.SpringCollab2020/FlagToggleStarRotateSpinner.tooltips.invert
241241
placements.triggers.SpringCollab2020/StrawberryCollectionField.tooltips.delayBetweenBerries=Whether there should be a 0.3 second delay between each berry collection (like when berries are collected on the ground).
242242
placements.triggers.SpringCollab2020/StrawberryCollectionField.tooltips.includeGoldens=Whether this trigger should collect golden strawberries and other berries that block normal collection.
243243

244+
# Negative Summit Checkpoint
245+
placements.entities.SpringCollab2020/NegativeSummitCheckpoint.tooltips.number=Changes the number on the checkpoint card. (Between -9 and 99 inclusive.)
246+
244247
# Remove Light Sources Trigger
245248
placements.triggers.SpringCollab2020/RemoveLightSourcesTrigger.tooltips.enableLightSources=If checked, this trigger will re-enable light sources instead of disabling them.
246249
placements.triggers.SpringCollab2020/RemoveLightSourcesTrigger.tooltips.fade=If checked, the lights will fade in or out.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Celeste.Mod.Entities;
2+
using Microsoft.Xna.Framework;
3+
using MonoMod.Utils;
4+
5+
namespace Celeste.Mod.SpringCollab2020.Entities {
6+
[CustomEntity("SpringCollab2020/NegativeSummitCheckpoint")]
7+
class NegativeSummitCheckpoint : SummitCheckpoint {
8+
public NegativeSummitCheckpoint(EntityData data, Vector2 offset) : base(data, offset) {
9+
// convert the checkpoint number to string. the minus sign is replaced by :, because this is the character after 9 in the chartable.
10+
// so, : will render the number10.png sprite, which is a minus sign.
11+
string numberString = Number.ToString().Replace("-", ":");
12+
13+
// add leading zeroes
14+
while (numberString.Length < 2) {
15+
numberString = $"0{numberString}";
16+
}
17+
18+
// replace the vanilla number string, which will be rendered.
19+
new DynData<SummitCheckpoint>(this)["numberString"] = numberString;
20+
}
21+
}
22+
}
141 Bytes
Loading
128 Bytes
Loading

0 commit comments

Comments
 (0)