GUI: fix a couple pattern refactor bugs

effect description in status bar *still* being wrong
randomize resulting in invalid notes
This commit is contained in:
tildearrow 2025-11-07 05:02:59 -05:00
parent 78cb4b4afd
commit e11cde755c
3 changed files with 23 additions and 4 deletions

View file

@ -1582,8 +1582,11 @@ void FurnaceGUI::doRandomize(int bottom, int top, bool mode, bool eff, int effVa
value=MIN(absoluteTop,bottom);
value2=MIN(absoluteTop,bottom);
} else {
value=MIN(absoluteTop,bottom+(rand()%(top-bottom+1)));
value2=MIN(absoluteTop,bottom+(rand()%(top-bottom+1)));
// HACK: MIN will call rand() twice....
int randVal=rand();
value=MIN(absoluteTop,bottom+(randVal%(top-bottom+1)));
randVal=rand();
value2=MIN(absoluteTop,bottom+(randVal%(top-bottom+1)));
}
if (mode) {
value&=15;

View file

@ -5001,7 +5001,7 @@ bool FurnaceGUI::loop() {
break;
default: // effect
if (cursor.xFine<DIV_MAX_COLS) {
if (p->newData[cursor.y][cursor.xFine]>-1) {
if (p->newData[cursor.y][(cursor.xFine-1)|1]>-1) {
info=e->getEffectDesc(p->newData[cursor.y][(cursor.xFine-1)|1],cursor.xCoarse,true);
hasInfo=true;
}

View file

@ -4703,9 +4703,9 @@ void FurnaceGUI::drawSettings() {
// "Debug" - toggles mobile UI
// "Nice Amiga cover of the song!" - enables hidden systems (YMU759/Dummy)
// "42 63" - enables all instrument types
// "4-bit FDS" - enables partial pitch linearity option
// "Power of the Chip" - enables options for multi-threaded audio
// "btcdbcb" - use modern UI padding
// "6-7" - OH PLEASE NO
// "????" - enables stuff
CONFIG_SECTION(_("Cheat Codes")) {
// SUBSECTION ENTER CODE:
@ -4748,6 +4748,22 @@ void FurnaceGUI::drawSettings() {
sty.ItemInnerSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale);
settingsOpen=false;
}
if (checker==0x2222225c && checker1==0x2d2) {
mmlString[30]=_("Oh my god... Kill me now so I don't have to go through that again!");
for (int i=0; i<e->getTotalChannelCount(); i++) {
for (int j=0; j<DIV_MAX_PATTERNS; j++) {
if (e->curSubSong->pat[i].data[j]!=NULL) {
DivPattern* p=e->curSubSong->pat[i].data[j];
for (int k=0; k<DIV_MAX_ROWS; k++) {
if (p->newData[k][DIV_PAT_NOTE]>=0 && p->newData[k][DIV_PAT_NOTE]<180) {
int newNote=p->newData[k][DIV_PAT_NOTE]+(rand()%40)-18;
p->newData[k][DIV_PAT_NOTE]=CLAMP(newNote,60,179);
}
}
}
}
}
}
mmlString[31]="";
}