danoniplus 31.6.0 → 31.7.1

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.
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 : 2023/04/26
7
+ * Revised : 2023/05/04
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 31.6.0`;
12
- const g_revisedDate = `2023/04/26`;
11
+ const g_version = `Ver 31.7.1`;
12
+ const g_revisedDate = `2023/05/04`;
13
13
  const g_alphaVersion = ``;
14
14
 
15
15
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -2465,7 +2465,7 @@ const calcLevel = _scoreObj => {
2465
2465
  const push3Cnt = push3List.length;
2466
2466
  const calcArrowCnt = allCnt - push3Cnt - 3;
2467
2467
  const toDecimal2 = num => Math.round(num * 100) / 100;
2468
- const calcDifLevel = num => calcArrowCnt <= 0 ? 0 : toDecimal2(num / Math.sqrt(calcArrowCnt) * 4);
2468
+ const calcDifLevel = num => Math.max(toDecimal2(num / Math.sqrt(calcArrowCnt) * 4), 0);
2469
2469
 
2470
2470
  const baseDifLevel = calcDifLevel(levelcount);
2471
2471
  const difLevel = toDecimal2(baseDifLevel * (allCnt - 3) / calcArrowCnt);
@@ -2744,11 +2744,12 @@ const headerConvert = _dosObj => {
2744
2744
  obj.creatorNames = [obj.tuning];
2745
2745
  }
2746
2746
  const keyLists = makeDedupliArray(obj.keyLabels);
2747
+ obj.viewLists = [...Array(obj.keyLabels.length).keys()];
2747
2748
  obj.keyLists = keyLists.sort((a, b) => parseInt(a) - parseInt(b));
2748
2749
  obj.undefinedKeyLists = obj.keyLists.filter(key => g_keyObj[`${g_keyObj.defaultProp}${key}_0`] === undefined);
2749
2750
 
2750
2751
  // 譜面変更セレクターの利用有無
2751
- obj.difSelectorUse = (setBoolVal(_dosObj.difSelectorUse, obj.keyLabels.length > 5));
2752
+ obj.difSelectorUse = getDifSelectorUse(_dosObj.difSelectorUse, obj.viewLists);
2752
2753
 
2753
2754
  // 初期速度の設定
2754
2755
  g_stateObj.speed = obj.initSpeeds[g_stateObj.scoreId];
@@ -3153,6 +3154,14 @@ const headerConvert = _dosObj => {
3153
3154
  return obj;
3154
3155
  };
3155
3156
 
3157
+ /**
3158
+ * 譜面リスト作成有無の状態を取得
3159
+ * @param {boolean} _headerFlg
3160
+ * @param {array} _viewLists
3161
+ * @returns
3162
+ */
3163
+ const getDifSelectorUse = (_headerFlg, _viewLists = g_headerObj.viewLists) => setBoolVal(_headerFlg, _viewLists.length > 5);
3164
+
3156
3165
  /**
3157
3166
  * カラーセットの格納
3158
3167
  * @param {object} obj
@@ -4314,13 +4323,25 @@ const resetDifWindow = _ => {
4314
4323
  }
4315
4324
  };
4316
4325
 
4326
+ /**
4327
+ * 次の譜面番号を取得
4328
+ * @param {number} _scoreId
4329
+ * @param {number} _scrollNum
4330
+ * @returns
4331
+ */
4332
+ const getNextDifficulty = (_scoreId, _scrollNum) => {
4333
+ const currentPosIdx = g_headerObj.viewLists.findIndex(val => val === _scoreId);
4334
+ const nextPosIdx = (currentPosIdx === -1 ? 0 : nextPos(currentPosIdx, _scrollNum, g_headerObj.viewLists.length));
4335
+ return g_headerObj.viewLists[nextPosIdx];
4336
+ };
4337
+
4317
4338
  /**
4318
4339
  * 譜面選択処理
4319
4340
  * @param {number} _scrollNum
4320
4341
  */
4321
4342
  const nextDifficulty = (_scrollNum = 1) => {
4322
4343
  g_keyObj.prevKey = g_headerObj.keyLabels[g_stateObj.scoreId];
4323
- g_stateObj.scoreId = nextPos(g_stateObj.scoreId, _scrollNum, g_headerObj.keyLabels.length);
4344
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, _scrollNum);
4324
4345
  setDifficulty(true);
4325
4346
  resetDifWindow();
4326
4347
  };
@@ -4333,7 +4354,8 @@ const nextDifficulty = (_scrollNum = 1) => {
4333
4354
  const makeDifList = (_difList, _targetKey = ``) => {
4334
4355
  let k = 0;
4335
4356
  let pos = 0;
4336
- g_headerObj.keyLabels.forEach((keyLabel, j) => {
4357
+ g_headerObj.viewLists.forEach(j => {
4358
+ const keyLabel = g_headerObj.keyLabels[j];
4337
4359
  if (_targetKey === `` || keyLabel === _targetKey) {
4338
4360
  let text = `${getKeyName(keyLabel)} / ${g_headerObj.difLabels[j]}`;
4339
4361
  if (g_headerObj.makerView) {
@@ -4348,8 +4370,7 @@ const makeDifList = (_difList, _targetKey = ``) => {
4348
4370
  k++;
4349
4371
  }
4350
4372
  });
4351
- const overlength = pos * g_limitObj.setLblHeight - parseInt(_difList.style.height);
4352
- _difList.scrollTop = (overlength > 0 ? overlength : 0);
4373
+ _difList.scrollTop = Math.max(pos * g_limitObj.setLblHeight - parseInt(_difList.style.height), 0);
4353
4374
  };
4354
4375
 
4355
4376
  /**
@@ -4361,7 +4382,7 @@ const makeDifBtn = (_scrollNum = 1) => {
4361
4382
  const dir = _scrollNum === 1 ? `D` : `U`;
4362
4383
  return createCss2Button(`btnDif${dir}`, g_settingBtnObj.chara[dir], _ => {
4363
4384
  do {
4364
- g_stateObj.scoreId = nextPos(g_stateObj.scoreId, _scrollNum, g_headerObj.keyLabels.length);
4385
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, _scrollNum);
4365
4386
  } while (g_stateObj.filterKeys !== `` && g_stateObj.filterKeys !== g_headerObj.keyLabels[g_stateObj.scoreId]);
4366
4387
  setDifficulty(true);
4367
4388
  deleteChildspriteAll(`difList`);
@@ -4403,7 +4424,7 @@ const createDifWindow = (_key = ``) => {
4403
4424
 
4404
4425
  // キー別フィルタボタン作成
4405
4426
  let pos = 0;
4406
- g_headerObj.keyLists.forEach((targetKey, m) => {
4427
+ g_headerObj.viewKeyLists.forEach((targetKey, m) => {
4407
4428
  difCover.appendChild(
4408
4429
  makeDifLblCssButton(`keyFilter${m}`, `${getKeyName(targetKey)} ${getStgDetailName('key')}`, m + 2.5, _ => {
4409
4430
  resetDifWindow();
@@ -4415,8 +4436,7 @@ const createDifWindow = (_key = ``) => {
4415
4436
  pos = m + 9;
4416
4437
  }
4417
4438
  });
4418
- const overlength = pos * g_limitObj.setLblHeight - parseInt(difCover.style.height);
4419
- difCover.scrollTop = (overlength > 0 ? overlength : 0);
4439
+ difCover.scrollTop = Math.max(pos * g_limitObj.setLblHeight - parseInt(difCover.style.height), 0);
4420
4440
 
4421
4441
  multiAppend(optionsprite, makeDifBtn(-1), makeDifBtn());
4422
4442
  };
@@ -5141,6 +5161,12 @@ const createOptionWindow = _sprite => {
5141
5161
  // 縦位置: 12.5
5142
5162
  createGeneralSetting(spriteList.volume, `volume`, { unitName: g_lblNameObj.percent });
5143
5163
 
5164
+ // 譜面番号の再取得
5165
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, 0);
5166
+ const keyLists = makeDedupliArray(g_headerObj.viewLists.map(j => g_headerObj.keyLabels[j]));
5167
+ g_headerObj.viewKeyLists = keyLists.sort((a, b) => parseInt(a) - parseInt(b));
5168
+ g_headerObj.difSelectorUse = getDifSelectorUse(g_rootObj.difSelectorUse);
5169
+
5144
5170
  // 設定画面の一通りのオブジェクトを作成後に譜面・速度・ゲージ設定をまとめて行う
5145
5171
  setDifficulty(false);
5146
5172
  optionsprite.oncontextmenu = _ => false;
@@ -5262,11 +5288,9 @@ const setSetting = (_scrollNum, _settingName, _unitName = ``, _roundNum = 0) =>
5262
5288
  }
5263
5289
 
5264
5290
  if (_scrollNum > 0) {
5265
- settingNum = (settingNum === settingMax ?
5266
- 0 : (settingNum + _scrollNum > settingMax ? settingMax : settingNum + _scrollNum));
5291
+ settingNum = (settingNum === settingMax ? 0 : Math.min(settingNum + _scrollNum, settingMax));
5267
5292
  } else if (_scrollNum < 0) {
5268
- settingNum = (settingNum === 0 ?
5269
- settingMax : (settingNum + _scrollNum <= 0 ? 0 : settingNum + _scrollNum));
5293
+ settingNum = (settingNum === 0 ? settingMax : Math.max(settingNum + _scrollNum, 0));
5270
5294
  }
5271
5295
  g_stateObj[_settingName] = settingList[settingNum];
5272
5296
  g_settings[`${_settingName}Num`] = settingNum;
@@ -9535,11 +9559,9 @@ const mainInit = _ => {
9535
9559
  musicStartFlg = false;
9536
9560
  }
9537
9561
  if (musicStartFlg) {
9538
- const tmpVolume = (g_audio.volume + (3 * g_stateObj.volume / 100) / 1000);
9539
- g_audio.volume = (tmpVolume > 1 ? 1 : tmpVolume);
9562
+ g_audio.volume = Math.min((g_audio.volume + (3 * g_stateObj.volume / 100) / 1000), 1);
9540
9563
  } else if (isFadeOutArea) {
9541
- const tmpVolume = (g_audio.volume - (3 * g_stateObj.volume / 100 * C_FRM_AFTERFADE / g_scoreObj.fadeOutTerm) / 1000);
9542
- g_audio.volume = (tmpVolume < 0 ? 0 : tmpVolume);
9564
+ g_audio.volume = Math.max((g_audio.volume - (3 * g_stateObj.volume / 100 * C_FRM_AFTERFADE / g_scoreObj.fadeOutTerm) / 1000), 0);
9543
9565
  }
9544
9566
 
9545
9567
  // ユーザカスタムイベント(フレーム毎)
@@ -9917,8 +9939,10 @@ const changeStepY = (_frameNum) => {
9917
9939
  * フリーズアローヒット時の描画変更
9918
9940
  * @param {number} _j
9919
9941
  * @param {number} _k
9942
+ * @param {string} _name
9943
+ * @param {number} _difFrame
9920
9944
  */
9921
- const changeHitFrz = (_j, _k, _name) => {
9945
+ const changeHitFrz = (_j, _k, _name, _difFrame = 0) => {
9922
9946
  const frzNo = `${_j}_${_k}`;
9923
9947
  const frzName = `${_name}${frzNo}`;
9924
9948
  const currentFrz = g_attrObj[frzName];
@@ -9967,6 +9991,8 @@ const changeHitFrz = (_j, _k, _name) => {
9967
9991
  $id(`frzHitTop${_j}`).background = g_workObj.frzHitColors[_j];
9968
9992
  }
9969
9993
  }
9994
+
9995
+ g_customJsObj[`judg_${_name}Hit`].forEach(func => func(_difFrame));
9970
9996
  };
9971
9997
 
9972
9998
  /**
@@ -10053,7 +10079,7 @@ const judgeArrow = _j => {
10053
10079
  }
10054
10080
 
10055
10081
  if (_difCnt <= g_judgObj.frzJ[g_judgPosObj.sfsf]) {
10056
- changeHitFrz(_j, fcurrentNo, `frz`);
10082
+ changeHitFrz(_j, fcurrentNo, `frz`, _difFrame);
10057
10083
  } else {
10058
10084
  changeFailedFrz(_j, fcurrentNo);
10059
10085
  if (g_headerObj.frzStartjdgUse) {
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Source by tickle
7
7
  * Created : 2019/11/19
8
- * Revised : 2023/04/26 (v31.6.0)
8
+ * Revised : 2023/05/03 (v31.7.0)
9
9
  *
10
10
  * https://github.com/cwtickle/danoniplus
11
11
  */
@@ -2946,6 +2946,9 @@ const g_customJsObj = {
2946
2946
  judg_kita: [],
2947
2947
  judg_iknai: [],
2948
2948
 
2949
+ judg_frzHit: [],
2950
+ judg_dummyFrzHit: [],
2951
+
2949
2952
  mainEnterFrame: [],
2950
2953
  result: [],
2951
2954
  resultEnterFrame: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "31.6.0",
3
+ "version": "31.7.1",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "index.js",
6
6
  "scripts": {