danoniplus 40.7.4 → 40.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/js/danoni_main.js +62 -26
  2. package/package.json +1 -1
package/js/danoni_main.js CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Source by tickle
6
6
  * Created : 2018/10/08
7
- * Revised : 2025/06/20
7
+ * Revised : 2025/08/25
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 40.7.4`;
12
- const g_revisedDate = `2025/06/20`;
11
+ const g_version = `Ver 40.7.6`;
12
+ const g_revisedDate = `2025/08/25`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -713,6 +713,21 @@ const padArray = (_array, _baseArray) => {
713
713
  return _baseArray;
714
714
  };
715
715
 
716
+ /**
717
+ * ベース配列(_baseArray)の空要素のみ、別配列(_array)の対応要素で補完する(既存値は上書きしない)
718
+ * @param {string[]|number[]} _array 補完元(ソース)
719
+ * @param {string[]|number[]} _baseArray ベース(既存値を優先)
720
+ * @returns {string[]|number[]}
721
+ */
722
+ const fillMissingArrayElem = (_array = [], _baseArray = []) => {
723
+ const maxLen = Math.max(_baseArray.length, _array.length);
724
+ const res = _baseArray.slice();
725
+ for (let j = 0; j < maxLen; j++) {
726
+ if (!hasVal(res[j]) && hasVal(_array[j])) res[j] = _array[j];
727
+ }
728
+ return res;
729
+ };
730
+
716
731
  /**
717
732
  * 配列から上位N番目までに一致する位置を取得
718
733
  *
@@ -2581,6 +2596,9 @@ const initialControl = async () => {
2581
2596
  g_stateObj.dosDivideFlg = setBoolVal(document.getElementById(`externalDosDivide`)?.value ?? getQueryParamVal(`dosDivide`));
2582
2597
  g_stateObj.scoreLockFlg = setBoolVal(document.getElementById(`externalDosLock`)?.value ?? getQueryParamVal(`dosLock`));
2583
2598
 
2599
+ // 非分割時は resetGaugeSetting が全難易度を一括構築するため、初回のみで十分
2600
+ const loopCount = g_stateObj.dosDivideFlg ? g_headerObj.keyLabels.length : 1;
2601
+
2584
2602
  for (let j = 0; j < g_headerObj.keyLabels.length; j++) {
2585
2603
 
2586
2604
  // 譜面ファイルが分割されている場合、譜面詳細情報取得のために譜面をロード
@@ -2589,10 +2607,10 @@ const initialControl = async () => {
2589
2607
  resetColorSetting(j);
2590
2608
  }
2591
2609
  getScoreDetailData(j);
2592
- }
2593
- const loopCount = g_stateObj.dosDivideFlg ? g_headerObj.keyLabels.length : 1;
2594
- for (let j = 0; j < loopCount; j++) {
2595
- resetGaugeSetting(j);
2610
+ if (j < loopCount) {
2611
+ // 分割時は各譜面ごとに上書き・補完、非分割時は初回のみ実行
2612
+ resetGaugeSetting(j);
2613
+ }
2596
2614
  }
2597
2615
  }
2598
2616
  g_customJsObj.preTitle.forEach(func => func());
@@ -4278,7 +4296,9 @@ const getGaugeSetting = (_dosObj, _name, _difLength, { scoreId = 0 } = {}) => {
4278
4296
  obj.lifeInits[_scoreId] = _gaugeDetails[3];
4279
4297
 
4280
4298
  if (gaugeUpdateFlg && hasVal(g_gaugeOptionObj[`gauge${_name}s`])) {
4281
- Object.keys(obj).forEach(key => Object.assign(g_gaugeOptionObj[`gauge${_name}s`][key] || [], obj[key]));
4299
+ // ゲージ上書き時は_gaugeDetails(obj)の値を優先し、デフォルト値で穴埋めする
4300
+ Object.keys(obj).forEach(key => g_gaugeOptionObj[`gauge${_name}s`][key] =
4301
+ fillMissingArrayElem(g_gaugeOptionObj[`gauge${_name}s`][key] || [], obj[key]));
4282
4302
  return false;
4283
4303
  }
4284
4304
  return true;
@@ -4292,9 +4312,12 @@ const getGaugeSetting = (_dosObj, _name, _difLength, { scoreId = 0 } = {}) => {
4292
4312
  */
4293
4313
  const getGaugeDetailList = (_scoreId, _defaultGaugeList) => {
4294
4314
  if (_scoreId > 0) {
4295
- const headerName = `gauge${_name}${setScoreIdHeader(_scoreId, g_stateObj.scoreLockFlg)}`;
4315
+ const idHeader = setScoreIdHeader(_scoreId, g_stateObj.scoreLockFlg);
4316
+ const dosId = (idHeader || 0) - 1;
4317
+ const headerName = `gauge${_name}${idHeader}`;
4296
4318
  if (hasVal(_dosObj[headerName])) {
4297
- return _dosObj[headerName].split(`,`);
4319
+ const gauges = splitLF2(_dosObj[headerName]);
4320
+ return (gauges[dosId] || gauges[0])?.split(`,`);
4298
4321
  }
4299
4322
  }
4300
4323
  return _defaultGaugeList;
@@ -4302,12 +4325,12 @@ const getGaugeSetting = (_dosObj, _name, _difLength, { scoreId = 0 } = {}) => {
4302
4325
 
4303
4326
  if (hasVal(_dosObj[`gauge${_name}`])) {
4304
4327
 
4328
+ const gauges = splitLF2(_dosObj[`gauge${_name}`]);
4305
4329
  if (gaugeUpdateFlg) {
4306
- gaugeCreateFlg = setGaugeDetails(scoreId, _dosObj[`gauge${_name}`].split(`,`));
4330
+ gaugeCreateFlg = setGaugeDetails(scoreId, (gauges[scoreId] || gauges[0])?.split(`,`));
4307
4331
  } else {
4308
- const gauges = splitLF2(_dosObj[`gauge${_name}`]);
4309
4332
  for (let j = 0; j < _difLength; j++) {
4310
- gaugeCreateFlg = setGaugeDetails(j, getGaugeDetailList(j, (gauges[j] ?? gauges[0]).split(`,`)));
4333
+ gaugeCreateFlg = setGaugeDetails(j, getGaugeDetailList(j, (gauges[j] || gauges[0]).split(`,`)));
4311
4334
  }
4312
4335
  }
4313
4336
 
@@ -10456,20 +10479,33 @@ const getArrowSettings = () => {
10456
10479
  g_workObj.dividePos[j] = baseLayer * 2 + ((posj <= divideCnt ? 0 : 1) + (scrollDirOptions[j] === 1 ? 0 : 1) + (g_stateObj.reverse === C_FLG_OFF ? 0 : 1)) % 2;
10457
10480
  g_workObj.scrollDir[j] = (posj <= divideCnt ? 1 : -1) * scrollDirOptions[j] * (g_stateObj.reverse === C_FLG_OFF ? 1 : -1);
10458
10481
 
10459
- eachOrAll.forEach(type => {
10460
- g_workObj[`arrowColors${type}`][j] = g_headerObj.setColor[colorj];
10461
- g_workObj[`dummyArrowColors${type}`][j] = g_headerObj.setDummyColor[colorj];
10462
- g_workObj[`arrowShadowColors${type}`][j] = g_headerObj.setShadowColor[colorj] || ``;
10463
- g_workObj[`dummyArrowShadowColors${type}`][j] = g_headerObj.setDummyColor[colorj] || ``;
10464
-
10465
- g_typeLists.frzColor.forEach((frzType, k) => {
10466
- g_workObj[`frz${frzType}Colors${type}`][j] = g_headerObj.frzColor[colorj][k] || ``;
10467
- g_workObj[`dummyFrz${frzType}Colors${type}`][j] =
10468
- frzType.includes(`Shadow`) ? `` : g_headerObj.setDummyColor[colorj] || ``;
10469
- });
10470
- g_workObj[`frzNormalShadowColors${type}`][j] = g_headerObj.frzShadowColor[colorj][0] || ``;
10471
- g_workObj[`frzHitShadowColors${type}`][j] = g_headerObj.frzShadowColor[colorj][1] || ``;
10482
+ // 個別色設定
10483
+ g_workObj.arrowColors[j] = g_headerObj.setColor[colorj];
10484
+ g_workObj.dummyArrowColors[j] = g_headerObj.setDummyColor[colorj];
10485
+ g_workObj.arrowShadowColors[j] = g_headerObj.setShadowColor[colorj] || ``;
10486
+ g_workObj.dummyArrowShadowColors[j] = g_headerObj.setDummyColor[colorj] || ``;
10487
+
10488
+ g_typeLists.frzColor.forEach((frzType, k) => {
10489
+ g_workObj[`frz${frzType}Colors`][j] = g_headerObj.frzColor[colorj][k] || ``;
10490
+ g_workObj[`dummyFrz${frzType}Colors`][j] =
10491
+ frzType.includes(`Shadow`) ? `` : g_headerObj.setDummyColor[colorj] || ``;
10472
10492
  });
10493
+ g_workObj.frzNormalShadowColors[j] = g_headerObj.frzShadowColor[colorj][0] || ``;
10494
+ g_workObj.frzHitShadowColors[j] = g_headerObj.frzShadowColor[colorj][1] || ``;
10495
+
10496
+ // 全体色設定
10497
+ g_workObj.arrowColorsAll[j] = ``;
10498
+ g_workObj.dummyArrowColorsAll[j] = ``;
10499
+ g_workObj.arrowShadowColorsAll[j] = ``;
10500
+ g_workObj.dummyArrowShadowColorsAll[j] = ``;
10501
+
10502
+ g_typeLists.frzColor.forEach((frzType, k) => {
10503
+ g_workObj[`frz${frzType}ColorsAll`][j] = ``;
10504
+ g_workObj[`dummyFrz${frzType}ColorsAll`][j] = ``;
10505
+ });
10506
+ g_workObj.frzNormalShadowColorsAll[j] = ``;
10507
+ g_workObj.frzHitShadowColorsAll[j] = ``;
10508
+
10473
10509
  }
10474
10510
  g_workObj.orgFlatFlg = g_workObj.dividePos.every(v => v === g_workObj.dividePos[0]);
10475
10511
  if (g_stateObj.stepArea === `X-Flower` || (g_stateObj.stepArea.includes(`Mismatched`) && g_workObj.orgFlatFlg)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "40.7.4",
3
+ "version": "40.7.6",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {