Commit ba80b14

Nick committed on
Fixes for gbt import
commit ba80b1431d3fe0945018fba9ce9002bdc1df3424 parent 98ddcb2
1 changed files +16−7
Modifiedmodimport.pas +16−7
@@ -104,7 +104,7 @@ begin
104 Result := EnsureRange(Instr, 0, 15); 104 Result := EnsureRange(Instr, 0, 15);
105 end; 105 end;
106 106
107 procedure ConvertEffect(Code, Params: Integer; out OutCode: Integer; out OutParams: TEffectParams); 107 procedure ConvertEffect(Code, Params: Byte; out OutCode: Integer; out OutParams: TEffectParams);
108 var 108 var
109 EP: TEffectParams absolute Params; 109 EP: TEffectParams absolute Params;
110 label IdentityEffect; 110 label IdentityEffect;
@@ -117,11 +117,17 @@ begin
117 case Code of 117 case Code of
118 $9: begin 118 $9: begin
119 OutCode := $C; 119 OutCode := $C;
120 OutParams.Value := Swap(Params); 120 OutParams.Param1 := Lo(Params);
121 OutParams.Param2 := Hi(Params);
121 end; 122 end;
122 $C: begin 123 $C: begin
123 OutCode := $C; 124 if Params <> 0 then begin
124 OutParams.Value := Trunc((Params / $40)*$F); 125 OutCode := $C;
126 OutParams.Value := Trunc((Params / $40)*$F);
127 end else begin
128 OutCode := $E;
129 OutParams.Value := 0;
130 end;
125 end; 131 end;
126 $E: begin 132 $E: begin
127 if EP.Param1 = $C then begin 133 if EP.Param1 = $C then begin
@@ -157,9 +163,12 @@ begin
157 for I := Low(MP) to High(MP) do begin 163 for I := Low(MP) to High(MP) do begin
158 Pat^[I] := ConvertCell(MP[I, Column]); 164 Pat^[I] := ConvertCell(MP[I, Column]);
159 165
160 if (Pat^[I].EffectCode = $C) and (Pat^[I].Note = NO_NOTE) then begin 166 if (Pat^[I].EffectCode = $C) then begin
161 Pat^[I].Note := LastPlayedNote; 167 if (Pat^[I].Instrument = 0) then
162 Pat^[I].Instrument := LastPlayedInstrument; 168 Pat^[I].Instrument := LastPlayedInstrument;
169
170 if (Pat^[I].Note = NO_NOTE) then
171 Pat^[I].Note := LastPlayedNote;
163 end; 172 end;
164 173
165 if (Pat^[I].Note <> NO_NOTE) then LastPlayedNote := Pat^[I].Note; 174 if (Pat^[I].Note <> NO_NOTE) then LastPlayedNote := Pat^[I].Note;