Skip to content

Commit 9108f12

Browse files
committed
Handle speed changes semi-properly
There are still grievances I have with having this manually tuned x-pos stuff, but whatever
1 parent 833d73c commit 9108f12

File tree

9 files changed

+252
-16
lines changed

9 files changed

+252
-16
lines changed

CloneDash/Compatibility/MuseDash/MuseDashCompatibility.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ public static ChartSheet ConvertStageInfoToDashSheet(ChartSong song, StageInfo M
271271
press.Damage = s.noteData.damage;
272272
press.Length = (double)s.configData.length;
273273
press.Score = s.noteData.score;
274+
press.Speed = s.noteData.speed;
274275

275276
press.RelatedToBoss = false;
276277
press.DebuggingInfo = $"ib.code: {ib.code}";
@@ -304,6 +305,16 @@ or IBMSCode.BossAttack1 or IBMSCode.BossAttack2_1 or IBMSCode.BossAttack2_2
304305

305306
IBMSCode.BossHide => EventType.BossHide,
306307

308+
IBMSCode.AirSpeed1 => EventType.AirSpeed1,
309+
IBMSCode.AirSpeed2 => EventType.AirSpeed2,
310+
IBMSCode.AirSpeed3 => EventType.AirSpeed3,
311+
IBMSCode.RoadSpeed1 => EventType.GroundSpeed1,
312+
IBMSCode.RoadSpeed2 => EventType.GroundSpeed2,
313+
IBMSCode.RoadSpeed3 => EventType.GroundSpeed3,
314+
IBMSCode.DoubleSpeed1 => EventType.DoubleSpeed1,
315+
IBMSCode.DoubleSpeed2 => EventType.DoubleSpeed2,
316+
IBMSCode.DoubleSpeed3 => EventType.DoubleSpeed3,
317+
307318
_ => EventType.NotApplicable
308319
};
309320

@@ -391,6 +402,7 @@ or IBMSCode.BossAttack1 or IBMSCode.BossAttack2_1 or IBMSCode.BossAttack2_2
391402

392403
ent.RelatedToBoss = isBoss;
393404
ent.DebuggingInfo = $"ib.code: {ib.code}";
405+
394406
sheet.Entities.Add(ent);
395407
}
396408
else if (WarnedIBMSPresses.Add(s.noteData.ibms_id)) {
@@ -1444,7 +1456,7 @@ private static Skin MD_ReadSkin(MemoryStream skeleton, ModelData nucleusModelDat
14441456
var color = skeleton.MD_ReadColor();
14451457
var skinname = skeleton.MD_ReadRefString(refStrings);
14461458
var parent = skeleton.MD_ReadRefString(refStrings);
1447-
var deform = skeleton.MD_ReadBoolean();
1459+
var deform = skeleton.MD_ReadBoolean();
14481460
float width = 0;
14491461
float height = 0;
14501462
if (nonessential) {

CloneDash/Data/EventType.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,31 @@ public enum EventType
66

77
BossIn,
88
BossOut,
9+
910
BossSingleHit,
11+
1012
BossMasher,
1113
BossMasherEnd,
14+
1215
BossFar1Start,
1316
BossFar1End,
1417
BossFar1To2,
1518
BossFar2Start,
1619
BossFar2End,
1720
BossFar2To1,
21+
22+
AirSpeed1,
23+
AirSpeed2,
24+
AirSpeed3,
25+
26+
GroundSpeed1,
27+
GroundSpeed2,
28+
GroundSpeed3,
29+
30+
DoubleSpeed1,
31+
DoubleSpeed2,
32+
DoubleSpeed3,
33+
1834
BossHide
1935
}
2036
}

CloneDash/Game/Enemies/Base/DashModelEntity.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,19 @@ public double XPosFromTimeOffset(float timeOffset = 0) {
298298
var current = level.Conductor.Time - timeOffset;
299299
var tickHit = this.GetVisualHitTime();
300300
var tickShow = this.GetVisualShowTime();
301-
var thisPos = NMath.Remap(current, (float)tickHit, (float)tickShow, level.XPos, 1200);
301+
var thisPos = NMath.Remap(current, (float)tickHit, (float)tickShow, level.XPos, GetXPosTimeSpeedBase());
302302
return thisPos;
303303
}
304304

305+
private double GetXPosTimeSpeedBase() {
306+
switch (Speed) {
307+
case 1: return 1200;
308+
case 2: return 1430;
309+
case 3: return 1780;
310+
default: goto case 1;
311+
}
312+
}
313+
305314
public bool Shown { get; protected set; } = false;
306315

307316
public bool CheckVisTest(FrameState frameState) {

CloneDash/Game/Events/Base/DashEvent.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ public static DashEvent CreateFromType(DashGameLevel game, EventType type) {
5555
case EventType.BossFar2End: return new BossFar2End(game);
5656
case EventType.BossFar2To1: return new BossFar2To1(game);
5757
case EventType.BossHide: return new BossHide(game);
58+
59+
case EventType.AirSpeed1: return new SpeedChange(game, PathwaySide.Top, 1);
60+
case EventType.AirSpeed2: return new SpeedChange(game, PathwaySide.Top, 2);
61+
case EventType.AirSpeed3: return new SpeedChange(game, PathwaySide.Top, 3);
62+
63+
case EventType.GroundSpeed1: return new SpeedChange(game, PathwaySide.Bottom, 1);
64+
case EventType.GroundSpeed2: return new SpeedChange(game, PathwaySide.Bottom, 2);
65+
case EventType.GroundSpeed3: return new SpeedChange(game, PathwaySide.Bottom, 3);
66+
67+
case EventType.DoubleSpeed1: return new SpeedChange(game, PathwaySide.Both, 1);
68+
case EventType.DoubleSpeed2: return new SpeedChange(game, PathwaySide.Both, 2);
69+
case EventType.DoubleSpeed3: return new SpeedChange(game, PathwaySide.Both, 3);
70+
5871
default: throw new Exception();
5972
}
6073
}

CloneDash/Game/Events/BossHide.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
namespace CloneDash.Game.Events;
2-
32
public class BossHide(DashGameLevel game) : DashEvent(game)
43
{
54
public override void Activate() {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace CloneDash.Game.Events;
2+
3+
public class SpeedChange(DashGameLevel game, PathwaySide side, int speed) : DashEvent(game){
4+
public PathwaySide Side => side;
5+
public int Speed => speed;
6+
7+
public override void Activate() {
8+
base.Activate();
9+
Game.SetPathwaySpeed(Side, Speed);
10+
}
11+
}

CloneDash/Levels/DashGameLevel.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public void SeekTo(double time) {
152152
}
153153

154154
Boss.Reset();
155+
ResetPathwaySpeeds();
155156

156157
Combo = 0;
157158
Health = (float)Character.GetDefaultHP();
@@ -474,6 +475,8 @@ public void PlayerAnim_ExitSustain() {
474475
ShaderInstance hologramShader;
475476

476477
public override void Initialize(params object[] args) {
478+
ResetPathwaySpeeds();
479+
477480
Stats = new(Sheet);
478481
using (StaticSequentialProfiler.StartStackFrame("CD_GameLevel.RichPresenceUpdate")) {
479482
RichPresenceSystem.SetPresence(new() {
@@ -1136,6 +1139,25 @@ public void LoadEvent(ChartEvent ChartEvent) {
11361139
Events.Add(ev);
11371140
}
11381141

1142+
public int CurrentAirSpeed;
1143+
public int CurrentGroundSpeed;
1144+
1145+
public void ResetPathwaySpeeds(){
1146+
CurrentAirSpeed = 1;
1147+
CurrentGroundSpeed = 1;
1148+
}
1149+
1150+
public void SetPathwaySpeed(PathwaySide pathway, int speed){
1151+
System.Diagnostics.Debug.Assert(speed >= 1);
1152+
System.Diagnostics.Debug.Assert(speed <= 3);
1153+
1154+
if ((pathway & PathwaySide.Top) != 0)
1155+
CurrentAirSpeed = speed;
1156+
1157+
if ((pathway & PathwaySide.Bottom) != 0)
1158+
CurrentGroundSpeed = speed;
1159+
}
1160+
11391161
/// <summary>
11401162
/// Loads an entity from a <see cref="ChartEntity"/> representation, builds a <see cref="MapEntity"/> out of it, and adds it to <see cref="GameplayManager.Entities"/>.
11411163
/// </summary>

TestCharts/test1-alltypes-labeled/map2.bms

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,20 @@
135135
*---------------------- MAIN DATA FIELD
136136

137137

138-
#00013:0000000H
139-
#00014:000H0000
140138

141-
#00113:0000000H
142-
#00114:000H0000
143-
#00153:0F00000F00000000
144-
#00154:000000000F00000F
139+
#00112:0O
140+
#00113:0101
141+
#00154:0F0F
145142

146-
#00213:000H000H
147-
#00214:000H0H00
148-
#00251:0F0000000000000F
149-
#00252:0F0000000000000F
143+
#00212:0P
144+
#00213:0101
145+
#00254:0F0F
150146

151-
#00353:0F00000000000F000F0000000000000F
152-
#00354:00000F0F000F0F0F
147+
#00312:0Q00000000000000000000000000000O
148+
#00313:0101
149+
#00354:0F0F
153150

154-
#00454:0F
151+
#00413:0101
152+
#00454:0F0F
155153

156154

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+

2+
*---------------------- HEADER FIELD
3+
4+
#PLAYER 3
5+
#GENRE scene_01
6+
#TITLE Test 1 - All Types
7+
#ARTIST March
8+
#LEVELDESIGN March
9+
#BPM 120
10+
#PLAYLEVEL 1
11+
#RANK 1
12+
13+
14+
#LNTYPE 1
15+
16+
#WAV01 Small
17+
#WAV02 Small (Up)
18+
#WAV03 Small (Down)
19+
#WAV04 Medium 1
20+
#WAV05 Medium 1 (Up)
21+
#WAV06 Medium 1 (Down)
22+
#WAV07 Medium 2
23+
#WAV08 Medium 2 (Up)
24+
#WAV09 Medium 2 (Down)
25+
#WAV0A Large 1
26+
#WAV0B Large 2
27+
#WAV0C Raider
28+
#WAV0D Hammer
29+
#WAV0E Gemini
30+
#WAV0F Hold
31+
#WAV0G Masher
32+
#WAV0H Gear
33+
#WAV0I Raider (Upside-down)
34+
#WAV0J Hammer (Upside-down)
35+
#WAV0O Speed 1 (Both)
36+
#WAV0P Speed 2 (Both)
37+
#WAV0Q Speed 3 (Both)
38+
#WAV0R Speed 1 (Low)
39+
#WAV0S Speed 2 (Low)
40+
#WAV0T Speed 3 (Low)
41+
#WAV0U Speed 1 (High)
42+
#WAV0V Speed 2 (High)
43+
#WAV0W Speed 3 (High)
44+
#WAV10 music
45+
#WAV11 Boss Melee 1
46+
#WAV12 Boss Melee 2
47+
#WAV13 Boss Projectile 1
48+
#WAV14 Boss Projectile 2
49+
#WAV15 Boss Projectile 3
50+
#WAV16 Boss Masher 1
51+
#WAV17 Boss Masher 2
52+
#WAV18 Boss Gear
53+
#WAV1A Boss Entrance
54+
#WAV1B Boss Exit
55+
#WAV1C Boss Ready Phase 1
56+
#WAV1D Boss End Phase 1
57+
#WAV1E Boss Ready Phase 2
58+
#WAV1F Boss End Phase 2
59+
#WAV1G Boss Swap Phase 1-2
60+
#WAV1H Boss Swap Phase 2-1
61+
#WAV1J Hide Notes
62+
#WAV1K Unhide Notes
63+
#WAV1L Hide Boss
64+
#WAV1M Unhide boss
65+
#WAV1O Scene Switch (Space Station)
66+
#WAV1P Scene Switch (Retrocity)
67+
#WAV1Q Scene Switch (Castle)
68+
#WAV1R Scene Switch (Rainy Night)
69+
#WAV1S Scene Switch (Candyland)
70+
#WAV1T Scene Switch (Oriental)
71+
#WAV1U Scene Switch (Groove Coaster)
72+
#WAV1V Scene Switch (Touhou)
73+
#WAV1W Scene Switch (DJMAX)
74+
#WAV1X Scene Switch (Miku)
75+
#WAV20 P Item
76+
#WAV21 Ghost
77+
#WAV22 Heart
78+
#WAV23 Note
79+
#WAV25 Hide Background
80+
#WAV26 Unhide Background
81+
#WAV27 Screen Scroll UP
82+
#WAV28 Screen Scroll DOWN
83+
#WAV29 Screen Scroll OFF
84+
#WAV2A Scanline Ripples ON
85+
#WAV2B Scanline Ripples OFF
86+
#WAV2C Chromatic Aberration ON
87+
#WAV2D Chromatic Aberration OFF
88+
#WAV2E Vignette ON
89+
#WAV2F Vignette OFF
90+
#WAV2G TV Static ON
91+
#WAV2H TV Static OFF
92+
#WAV2I Flashbang START
93+
#WAV2J Flashbang MID
94+
#WAV2K Flashbang END
95+
#WAV2N BG Stop ON
96+
#WAV2O BG Stop OFF
97+
#WAV2P Mosaic ON
98+
#WAV2Q Mosaic OFF
99+
#WAV2R Sepia ON
100+
#WAV2S Sepia OFF
101+
#WAV2T Focus Lines BLACK
102+
#WAV2U Focus Lines WHITE
103+
#WAV2V Focus Lines OFF
104+
#WAV2W Film Grain ON
105+
#WAV2X Film Grain OFF
106+
#WAV2Y Autoplay ON
107+
#WAV2Z Autoplay OFF
108+
#WAV30 Medium Bullet
109+
#WAV31 Medium Bullet (Up)
110+
#WAV32 Medium Bullet (Down)
111+
#WAV33 Medium Bullet (Laneshift)
112+
#WAV34 Small Bullet
113+
#WAV35 Small Bullet (Up)
114+
#WAV36 Small Bullet (Down)
115+
#WAV37 Small Bullet (Laneshift)
116+
#WAV38 Large Bullet
117+
#WAV39 Large Bullet (Up)
118+
#WAV3A Large Bullet (Down)
119+
#WAV3B Large Bullet (Laneshift)
120+
#WAV3C Boss Bullet 1
121+
#WAV3D Boss Bullet 1 (Laneshift)
122+
#WAV3E Boss Bullet 2
123+
#WAV3F Boss Bullet 2 (Laneshift)
124+
#WAVCM Flashbang Color (White)
125+
#WAVCN Flashbang Color (Black)
126+
#WAVCO Flashbang Color (Red)
127+
#WAVCP Flashbang Color (Green)
128+
#WAVCQ Flashbang Color (Blue)
129+
#WAVCR Flashbang Color (Cyan)
130+
#WAVCS Flashbang Color (Magenta)
131+
#WAVCT Flashbang Color (Yellow)
132+
133+
134+
135+
*---------------------- MAIN DATA FIELD
136+
137+
138+
#00013:0000000H
139+
#00014:000H0000
140+
141+
#00113:0000000H
142+
#00114:000H0000
143+
#00153:0F00000F00000000
144+
#00154:000000000F00000F
145+
146+
#00213:000H000H
147+
#00214:000H0H00
148+
#00251:0F0000000000000F
149+
#00252:0F0000000000000F
150+
151+
#00353:0F00000000000F000F0000000000000F
152+
#00354:00000F0F000F0F0F
153+
154+
#00454:0F
155+
156+

0 commit comments

Comments
 (0)