S3M/IT import: fix reuse of curOrder variable

This commit is contained in:
tildearrow 2024-07-02 03:39:31 -05:00
parent bb4d6c2a55
commit 18a3a34427
2 changed files with 9 additions and 6 deletions

View file

@ -305,11 +305,12 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
logD("reading orders..."); logD("reading orders...");
size_t curSubSong=0; size_t curSubSong=0;
int curOrder1=0;
ds.subsong[curSubSong]->ordersLen=0; ds.subsong[curSubSong]->ordersLen=0;
bool subSongIncreased=false; bool subSongIncreased=false;
for (int i=0; i<ordersLen; i++) { for (int i=0; i<ordersLen; i++) {
unsigned char nextOrder=reader.readC(); unsigned char nextOrder=reader.readC();
orders[i]=curOrder; orders[i]=curOrder1;
// skip +++ order // skip +++ order
if (nextOrder==254) { if (nextOrder==254) {
@ -323,7 +324,7 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
curSubSong++; curSubSong++;
subSongIncreased=true; subSongIncreased=true;
} }
curOrder=0; curOrder1=0;
continue; continue;
} }
subSongIncreased=false; subSongIncreased=false;
@ -337,7 +338,7 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
ds.subsong[curSubSong]->orders.ord[j][ds.subsong[curSubSong]->ordersLen]=nextOrder; ds.subsong[curSubSong]->orders.ord[j][ds.subsong[curSubSong]->ordersLen]=nextOrder;
} }
ds.subsong[curSubSong]->ordersLen++; ds.subsong[curSubSong]->ordersLen++;
curOrder++; curOrder1++;
} }
for (int i=0; i<ds.insLen; i++) { for (int i=0; i<ds.insLen; i++) {

View file

@ -205,11 +205,12 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
logD("reading orders..."); logD("reading orders...");
size_t curSubSong=0; size_t curSubSong=0;
int curOrder1=0;
ds.subsong[curSubSong]->ordersLen=0; ds.subsong[curSubSong]->ordersLen=0;
bool subSongIncreased=false; bool subSongIncreased=false;
for (int i=0; i<ordersLen; i++) { for (int i=0; i<ordersLen; i++) {
unsigned char nextOrder=reader.readC(); unsigned char nextOrder=reader.readC();
orders[i]=curOrder; orders[i]=curOrder1;
// skip +++ order // skip +++ order
if (nextOrder==254) { if (nextOrder==254) {
@ -223,7 +224,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
curSubSong++; curSubSong++;
subSongIncreased=true; subSongIncreased=true;
} }
curOrder=0; curOrder1=0;
continue; continue;
} }
subSongIncreased=false; subSongIncreased=false;
@ -237,7 +238,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
ds.subsong[curSubSong]->orders.ord[j][ds.subsong[curSubSong]->ordersLen]=nextOrder; ds.subsong[curSubSong]->orders.ord[j][ds.subsong[curSubSong]->ordersLen]=nextOrder;
} }
ds.subsong[curSubSong]->ordersLen++; ds.subsong[curSubSong]->ordersLen++;
curOrder++; curOrder1++;
} }
logD("reading ins pointers..."); logD("reading ins pointers...");
@ -887,6 +888,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
break; break;
case 'B': // go to order case 'B': // go to order
p->data[curRow][effectCol[chan]++]=0x0b; p->data[curRow][effectCol[chan]++]=0x0b;
logD("0B: %x %x",effectVal,orders[effectVal]);
p->data[curRow][effectCol[chan]++]=orders[effectVal]; p->data[curRow][effectCol[chan]++]=orders[effectVal];
break; break;
case 'C': // next order case 'C': // next order