Add define for Effect column, Add description for defines

This commit is contained in:
cam900 2022-12-09 15:03:06 +09:00
parent 2e85e47c48
commit f57bcf7b9c
6 changed files with 15 additions and 7 deletions

View File

@ -20,11 +20,19 @@
#ifndef _DEFINES_H
#define _DEFINES_H
// global
#define DIV_MAX_CHIPS 32
#define DIV_MAX_CHANS 128
#define DIV_MAX_PATTERNS 256
// in-pattern
#define DIV_MAX_ROWS 256
#define DIV_MAX_COLS 32
#define DIV_MAX_EFFECTS 8
// sample related
#define DIV_MAX_SAMPLE_TYPE 4
typedef unsigned char ORDERTYPE;
#endif

View File

@ -2000,7 +2000,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
for (int i=0; i<tchans; i++) {
subSong->pat[i].effectCols=reader.readC();
if (subSong->pat[i].effectCols<1 || subSong->pat[i].effectCols>8) {
if (subSong->pat[i].effectCols<1 || subSong->pat[i].effectCols>DIV_MAX_EFFECTS) {
logE("channel %d has zero or too many effect columns! (%d)",i,subSong->pat[i].effectCols);
lastError=fmt::sprintf("channel %d has too many effect columns! (%d)",i,subSong->pat[i].effectCols);
delete[] file;

View File

@ -21,7 +21,7 @@
#define _ORDERS_H
struct DivOrders {
unsigned char ord[DIV_MAX_CHANS][DIV_MAX_PATTERNS];
ORDERTYPE ord[DIV_MAX_CHANS][DIV_MAX_PATTERNS];
DivOrders() {
memset(ord,0,DIV_MAX_CHANS*DIV_MAX_PATTERNS);

View File

@ -522,7 +522,7 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_PAT_INCREASE_COLUMNS:
if (cursor.xCoarse<0 || cursor.xCoarse>=e->getTotalChannelCount()) break;
e->curPat[cursor.xCoarse].effectCols++;
if (e->curPat[cursor.xCoarse].effectCols>8) e->curPat[cursor.xCoarse].effectCols=8;
if (e->curPat[cursor.xCoarse].effectCols>DIV_MAX_EFFECTS) e->curPat[cursor.xCoarse].effectCols=DIV_MAX_EFFECTS;
break;
case GUI_ACTION_PAT_DECREASE_COLUMNS:
if (cursor.xCoarse<0 || cursor.xCoarse>=e->getTotalChannelCount()) break;

View File

@ -177,10 +177,10 @@ void FurnaceGUI::drawOrders() {
e->lockSave([this,i,j]() {
if (changeAllOrders) {
for (int k=0; k<e->getTotalChannelCount(); k++) {
if (e->curOrders->ord[k][i]<0xff) e->curOrders->ord[k][i]++;
if (e->curOrders->ord[k][i]<(ORDERTYPE)(DIV_MAX_PATTERNS-1)) e->curOrders->ord[k][i]++;
}
} else {
if (e->curOrders->ord[j][i]<0xff) e->curOrders->ord[j][i]++;
if (e->curOrders->ord[j][i]<(ORDERTYPE)(DIV_MAX_PATTERNS-1)) e->curOrders->ord[j][i]++;
}
});
e->walkSong(loopOrder,loopRow,loopEnd);

View File

@ -875,11 +875,11 @@ void FurnaceGUI::drawPattern() {
}
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(e->curPat[i].effectCols>=8);
ImGui::BeginDisabled(e->curPat[i].effectCols>=DIV_MAX_EFFECTS);
snprintf(chanID,2048,">##_RCH%d",i);
if (ImGui::SmallButton(chanID)) {
e->curPat[i].effectCols++;
if (e->curPat[i].effectCols>8) e->curPat[i].effectCols=8;
if (e->curPat[i].effectCols>DIV_MAX_EFFECTS) e->curPat[i].effectCols=DIV_MAX_EFFECTS;
}
ImGui::EndDisabled();
}