@@ -75,7 +75,7 @@ object MegamixFunctions : Functions() {
75
75
SpecialOnlyFunction (0x12 , " unrest" ),
76
76
SpecialOnlyFunction (0x14 , " label" ),
77
77
SpecialOnlyFunction (0x15 , " goto" ),
78
- SpecialOnlyFunction (0x1A , " case" ),
78
+ SpecialOnlyFunction (0x1A , " case" , indentChange = 1 ),
79
79
SpecialOnlyFunction (0xB8 , " random" ),
80
80
SpecificSpecialFunction (0x1 , 0 , " get_async" , 2 .. 2 ),
81
81
SpecificSpecialFunction (0x1 , 1 , " set_func" , 2 .. 2 ),
@@ -152,8 +152,8 @@ object MegamixFunctions : Functions() {
152
152
- 1 ), // current adjust pushes the else back an indent
153
153
alias(0x18 , " endif" , 0 .. 0 , - 1 , - 1 ), // same here
154
154
alias(0x19 , " switch" , 0 .. 0 , 1 ),
155
- alias(0x1B , " break" , 0 .. 0 ),
156
- alias(0x1C , " default" , 0 .. 0 ),
155
+ alias(0x1B , " break" , 0 .. 0 , - 1 ),
156
+ alias(0x1C , " default" , 0 .. 0 , 1 ),
157
157
alias(0x1D , " endswitch" , 0 .. 0 , - 1 , - 1 ),
158
158
alias(0x24 , " speed" , 1 .. 1 ),
159
159
alias(0x25 , " speed_relative" , 3 .. 3 ),
@@ -305,7 +305,9 @@ class OldMacroFunction: OptionalArgumentsFunction(0, "macro", 3, 0, 2000)
305
305
@DeprecatedFunction(" set_async is deprecated, use set_func instead" )
306
306
class OldSetFunction : SpecificSpecialFunction (0x1 , 1 , " set_async" , 2 ..2 )
307
307
308
- open class SpecialOnlyFunction (opcode : Long , alias : String ) : Function(opcode, alias, 1 ..1 ) {
308
+ open class SpecialOnlyFunction (opcode : Long , alias : String , val indentChange : Int = 0 ,
309
+ val currentAdjust : Int = 0 )
310
+ : Function (opcode, alias, 1 .. 1 ) {
309
311
override fun acceptOp (op : Long ): Boolean {
310
312
val opcode = op and 0x3FF
311
313
val args = (op and 0x3C00 ) ushr 10
@@ -314,6 +316,8 @@ open class SpecialOnlyFunction(opcode: Long, alias: String) : Function(opcode, a
314
316
315
317
override fun produceTickflow (state : DecompilerState , opcode : Long , specialArg : Long , args : LongArray ,
316
318
comments : CommentType , specialArgStrings : Map <Int , String >): String {
319
+ state.nextIndentLevel + = indentChange
320
+ state.currentAdjust = currentAdjust
317
321
return " ${this .name} ${getHex(specialArg)} "
318
322
}
319
323
0 commit comments