mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-08 22:49:49 +03:00
Compatibility fix for Bx commands
These commands accept 0-127 as valid window numbers, which were 1-128 before this change. To maintain savedata compatibility, window positions are saved in the order 1,...,127,0.
This commit is contained in:
+17
-17
@@ -47,7 +47,7 @@ void commandB0() {
|
||||
}
|
||||
|
||||
void commandB1() {
|
||||
int num = getCaliValue() - 1;
|
||||
int num = getCaliValue();
|
||||
int X1 = getCaliValue();
|
||||
int Y1 = getCaliValue();
|
||||
int X2 = getCaliValue();
|
||||
@@ -64,7 +64,7 @@ void commandB1() {
|
||||
nact->sel.wininfo[num].height = Y2;
|
||||
nact->sel.wininfo[num].save = (V == 0) ? false : true;
|
||||
|
||||
DEBUG_COMMAND("B1 %d,%d,%d,%d,%d,%d:", num + 1, X1, Y1, X2, Y2, V);
|
||||
DEBUG_COMMAND("B1 %d,%d,%d,%d,%d,%d:", num, X1, Y1, X2, Y2, V);
|
||||
}
|
||||
|
||||
void commandB2() {
|
||||
@@ -75,13 +75,13 @@ void commandB2() {
|
||||
int C3 = getCaliValue();
|
||||
int dot = getCaliValue();
|
||||
|
||||
if (num < 1 || num - 1 >= SELWINMAX) {
|
||||
if (num < 0 || num >= SELWINMAX) {
|
||||
WARNING("commandB2(): Window number is out of range %d", num);
|
||||
return;
|
||||
}
|
||||
|
||||
nact->sel.winno = num;
|
||||
nact->sel.win = &nact->sel.wininfo[num - 1];
|
||||
nact->sel.win = &nact->sel.wininfo[num];
|
||||
|
||||
nact->sel.WindowFrameType = W;
|
||||
nact->sel.FrameCgNoTop = C1;
|
||||
@@ -93,7 +93,7 @@ void commandB2() {
|
||||
}
|
||||
|
||||
void commandB3() {
|
||||
int num = getCaliValue() - 1;
|
||||
int num = getCaliValue();
|
||||
int X1 = getCaliValue();
|
||||
int Y1 = getCaliValue();
|
||||
int X2 = getCaliValue();
|
||||
@@ -110,7 +110,7 @@ void commandB3() {
|
||||
nact->msg.wininfo[num].height = Y2;
|
||||
nact->msg.wininfo[num].save = (V == 0) ? FALSE : TRUE;
|
||||
|
||||
DEBUG_COMMAND("B3 %d,%d,%d,%d,%d,%d:", num + 1, X1, Y1, X2, Y2, V);
|
||||
DEBUG_COMMAND("B3 %d,%d,%d,%d,%d,%d:", num, X1, Y1, X2, Y2, V);
|
||||
}
|
||||
|
||||
void commandB4() {
|
||||
@@ -121,13 +121,13 @@ void commandB4() {
|
||||
int N = getCaliValue();
|
||||
int M = getCaliValue();
|
||||
|
||||
if (num < 1 || num - 1 >= MSGWINMAX) {
|
||||
if (num < 0 || num >= MSGWINMAX) {
|
||||
WARNING("commandB4(): Window number is out of range %d", num);
|
||||
num = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
nact->msg.winno = num;
|
||||
nact->msg.win = &nact->msg.wininfo[num - 1];
|
||||
nact->msg.win = &nact->msg.wininfo[num];
|
||||
msg_openWindow(W, C1, C2, N, M);
|
||||
|
||||
DEBUG_COMMAND("B4 %d,%d,%d,%d,%d,%d:", num, W, C1, C2, N, M);
|
||||
@@ -225,8 +225,8 @@ void commandB31() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = nact->sel.wininfo[no - 1].x;
|
||||
*y_var = nact->sel.wininfo[no - 1].y;
|
||||
*x_var = nact->sel.wininfo[no].x;
|
||||
*y_var = nact->sel.wininfo[no].y;
|
||||
|
||||
DEBUG_COMMAND("B31 %d,%d,%d:", no, *x_var, *y_var);
|
||||
}
|
||||
@@ -236,8 +236,8 @@ void commandB32() {
|
||||
int *x_var_size = getCaliVariable();
|
||||
int *y_var_size = getCaliVariable();
|
||||
|
||||
*x_var_size = nact->sel.wininfo[no - 1].width;
|
||||
*y_var_size = nact->sel.wininfo[no - 1].height;
|
||||
*x_var_size = nact->sel.wininfo[no].width;
|
||||
*y_var_size = nact->sel.wininfo[no].height;
|
||||
|
||||
DEBUG_COMMAND("B32 %d,%d,%d:", no, *x_var_size, *y_var_size);
|
||||
}
|
||||
@@ -247,8 +247,8 @@ void commandB33() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = nact->msg.wininfo[no - 1].x;
|
||||
*y_var = nact->msg.wininfo[no - 1].y;
|
||||
*x_var = nact->msg.wininfo[no].x;
|
||||
*y_var = nact->msg.wininfo[no].y;
|
||||
DEBUG_COMMAND("B33 %d,%d,%d:", no, *x_var, *y_var);
|
||||
}
|
||||
|
||||
@@ -257,8 +257,8 @@ void commandB34() {
|
||||
int *x_var_size = getCaliVariable();
|
||||
int *y_var_size = getCaliVariable();
|
||||
|
||||
*x_var_size = nact->msg.wininfo[no - 1].width;
|
||||
*y_var_size = nact->msg.wininfo[no - 1].height;
|
||||
*x_var_size = nact->msg.wininfo[no].width;
|
||||
*y_var_size = nact->msg.wininfo[no].height;
|
||||
DEBUG_COMMAND("B34 %d,%d,%d:", no, *x_var_size, *y_var_size);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -94,12 +94,12 @@ void msg_init() {
|
||||
memset(msg.wininfo, 0, sizeof(msg.wininfo));
|
||||
|
||||
msg.winno = 1;
|
||||
msg.win = &msg.wininfo[0];
|
||||
msg.wininfo[0].x = 8;
|
||||
msg.wininfo[0].y = 311;
|
||||
msg.wininfo[0].width = 616;
|
||||
msg.wininfo[0].height = 80;
|
||||
msg.wininfo[0].save = TRUE;
|
||||
msg.win = &msg.wininfo[1];
|
||||
msg.wininfo[1].x = 8;
|
||||
msg.wininfo[1].y = 311;
|
||||
msg.wininfo[1].width = 616;
|
||||
msg.wininfo[1].height = 80;
|
||||
msg.wininfo[1].save = TRUE;
|
||||
|
||||
// Private variables
|
||||
msgDecorateColor = 0;
|
||||
|
||||
+20
-16
@@ -396,17 +396,19 @@ int save_loadAll(int no) {
|
||||
sl_jmpFar2(save_base->scoPage, save_base->scoIndex);
|
||||
|
||||
for (i = 0; i < SELWINMAX; i++) {
|
||||
nact->sel.wininfo[i].x = save_base->selWinInfo[i].x;
|
||||
nact->sel.wininfo[i].y = save_base->selWinInfo[i].y;
|
||||
nact->sel.wininfo[i].width = save_base->selWinInfo[i].width;
|
||||
nact->sel.wininfo[i].height = save_base->selWinInfo[i].height;
|
||||
int j = (i + 1) % SELWINMAX; // For savedata compatibility
|
||||
nact->sel.wininfo[j].x = save_base->selWinInfo[i].x;
|
||||
nact->sel.wininfo[j].y = save_base->selWinInfo[i].y;
|
||||
nact->sel.wininfo[j].width = save_base->selWinInfo[i].width;
|
||||
nact->sel.wininfo[j].height = save_base->selWinInfo[i].height;
|
||||
// nact->sel.wininfo[i].save = TRUE;
|
||||
}
|
||||
for (i = 0; i < MSGWINMAX; i++) {
|
||||
nact->msg.wininfo[i].x = save_base->msgWinInfo[i].x;
|
||||
nact->msg.wininfo[i].y = save_base->msgWinInfo[i].y;
|
||||
nact->msg.wininfo[i].width = save_base->msgWinInfo[i].width;
|
||||
nact->msg.wininfo[i].height = save_base->msgWinInfo[i].height;
|
||||
int j = (i + 1) % MSGWINMAX; // For savedata compatibility
|
||||
nact->msg.wininfo[j].x = save_base->msgWinInfo[i].x;
|
||||
nact->msg.wininfo[j].y = save_base->msgWinInfo[i].y;
|
||||
nact->msg.wininfo[j].width = save_base->msgWinInfo[i].width;
|
||||
nact->msg.wininfo[j].height = save_base->msgWinInfo[i].height;
|
||||
// nact->msg.wininfo[i].savedImage = NULL;
|
||||
// nact->msg.wininfo[i].save = FALSE;
|
||||
}
|
||||
@@ -472,17 +474,19 @@ int save_saveAll(int no) {
|
||||
save_base->scoIndex = sl_getIndex();
|
||||
|
||||
for (i = 0; i < SELWINMAX; i++) {
|
||||
save_base->selWinInfo[i].x = (uint16_t)nact->sel.wininfo[i].x;
|
||||
save_base->selWinInfo[i].y = (uint16_t)nact->sel.wininfo[i].y;
|
||||
save_base->selWinInfo[i].width = (uint16_t)nact->sel.wininfo[i].width;
|
||||
save_base->selWinInfo[i].height = (uint16_t)nact->sel.wininfo[i].height;
|
||||
int j = (i + 1) % SELWINMAX; // For savedata compatibility
|
||||
save_base->selWinInfo[i].x = (uint16_t)nact->sel.wininfo[j].x;
|
||||
save_base->selWinInfo[i].y = (uint16_t)nact->sel.wininfo[j].y;
|
||||
save_base->selWinInfo[i].width = (uint16_t)nact->sel.wininfo[j].width;
|
||||
save_base->selWinInfo[i].height = (uint16_t)nact->sel.wininfo[j].height;
|
||||
}
|
||||
|
||||
for (i = 0; i < MSGWINMAX; i++) {
|
||||
save_base->msgWinInfo[i].x = (uint16_t)nact->msg.wininfo[i].x;
|
||||
save_base->msgWinInfo[i].y = (uint16_t)nact->msg.wininfo[i].y;
|
||||
save_base->msgWinInfo[i].width = (uint16_t)nact->msg.wininfo[i].width;
|
||||
save_base->msgWinInfo[i].height = (uint16_t)nact->msg.wininfo[i].height;
|
||||
int j = (i + 1) % MSGWINMAX; // For savedata compatibility
|
||||
save_base->msgWinInfo[i].x = (uint16_t)nact->msg.wininfo[j].x;
|
||||
save_base->msgWinInfo[i].y = (uint16_t)nact->msg.wininfo[j].y;
|
||||
save_base->msgWinInfo[i].width = (uint16_t)nact->msg.wininfo[j].width;
|
||||
save_base->msgWinInfo[i].height = (uint16_t)nact->msg.wininfo[j].height;
|
||||
}
|
||||
|
||||
fseek(fp, sizeof(Ald_baseHdr), SEEK_SET);
|
||||
|
||||
+6
-6
@@ -117,12 +117,12 @@ void sel_init() {
|
||||
memset(sel.wininfo, 0, sizeof(sel.wininfo));
|
||||
|
||||
sel.winno = 1;
|
||||
sel.win = &sel.wininfo[0];
|
||||
sel.wininfo[0].x = 464;
|
||||
sel.wininfo[0].y = 80;
|
||||
sel.wininfo[0].width = 160;
|
||||
sel.wininfo[0].height = 160;
|
||||
sel.wininfo[0].save = TRUE;
|
||||
sel.win = &sel.wininfo[1];
|
||||
sel.wininfo[1].x = 464;
|
||||
sel.wininfo[1].y = 80;
|
||||
sel.wininfo[1].width = 160;
|
||||
sel.wininfo[1].height = 160;
|
||||
sel.wininfo[1].save = TRUE;
|
||||
|
||||
/* 選択肢を登録中 */
|
||||
sel.in_setting = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user