danoniplus 31.1.0 → 31.2.0

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 +53 -31
  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 : 2023/03/25
7
+ * Revised : 2023/04/01
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 31.1.0`;
12
- const g_revisedDate = `2023/03/25`;
11
+ const g_version = `Ver 31.2.0`;
12
+ const g_revisedDate = `2023/04/01`;
13
13
  const g_alphaVersion = ``;
14
14
 
15
15
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -3217,15 +3217,22 @@ const resetBaseColorList = (_baseObj, _dosObj, { scoreId = `` } = {}) => {
3217
3217
 
3218
3218
  const obj = {};
3219
3219
  const scoreIdHeader = setScoreIdHeader(scoreId);
3220
+ const getRefData = (_header, _dataName) => {
3221
+ const data = _dosObj[`${_header}${_dataName}`];
3222
+ return data?.startsWith(_header) ? _dosObj[data] : data;
3223
+ }
3220
3224
 
3221
3225
  [``, `Shadow`].forEach(pattern => {
3222
- const _name = `set${pattern}Color${scoreIdHeader}`;
3223
- const _frzName = `frz${pattern}Color${scoreIdHeader}`;
3224
- const _arrowInit = `set${pattern}ColorInit`;
3225
- const _frzInit = `frz${pattern}ColorInit`;
3226
+ const _arrowCommon = `set${pattern}Color`;
3227
+ const _frzCommon = `frz${pattern}Color`;
3228
+
3229
+ const _name = `${_arrowCommon}${scoreIdHeader}`;
3230
+ const _frzName = `${_frzCommon}${scoreIdHeader}`;
3231
+ const _arrowInit = `${_arrowCommon}Init`;
3232
+ const _frzInit = `${_frzCommon}Init`;
3226
3233
 
3227
- const arrowColorTxt = _dosObj[_name] || _dosObj[`set${pattern}Color`];
3228
- const frzColorTxt = _dosObj[_frzName] || _dosObj[`frz${pattern}Color`];
3234
+ const arrowColorTxt = getRefData(_arrowCommon, scoreIdHeader) || _dosObj[_arrowCommon];
3235
+ const frzColorTxt = getRefData(_frzCommon, scoreIdHeader) || _dosObj[_frzCommon];
3229
3236
 
3230
3237
  // 矢印色
3231
3238
  Object.keys(_baseObj.dfColorgrdSet).forEach(type => {
@@ -7164,10 +7171,11 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7164
7171
  * @param {string} _footer
7165
7172
  */
7166
7173
  const setSpeedData = (_header, _scoreNo, _footer = `_data`) => {
7174
+ const dosSpeedData = getRefData(_header, `${_scoreNo}${_footer}`);
7167
7175
  const speedData = [];
7168
7176
 
7169
- if (hasVal(_dosObj[`${_header}${_scoreNo}${_footer}`]) && g_stateObj.d_speed === C_FLG_ON) {
7170
- const tmpArrayData = splitLF(_dosObj[`${_header}${_scoreNo}${_footer}`]);
7177
+ if (hasVal(dosSpeedData) && g_stateObj.d_speed === C_FLG_ON) {
7178
+ const tmpArrayData = splitLF(dosSpeedData);
7171
7179
 
7172
7180
  tmpArrayData.filter(data => hasVal(data)).forEach(tmpData => {
7173
7181
  const tmpSpeedData = tmpData.split(`,`);
@@ -7206,11 +7214,12 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7206
7214
  * @param {number} _scoreNo
7207
7215
  */
7208
7216
  const setColorData = (_header, _scoreNo) => {
7217
+ const dosColorData = getRefData(_header, `${_scoreNo}_data`);
7209
7218
  const colorData = [];
7210
7219
  const allFlg = (_header.charAt(0) === `a`);
7211
7220
 
7212
- if (hasVal(_dosObj[`${_header}${_scoreNo}_data`]) && g_stateObj.d_color === C_FLG_ON) {
7213
- const tmpArrayData = splitLF(_dosObj[`${_header}${_scoreNo}_data`]);
7221
+ if (hasVal(dosColorData) && g_stateObj.d_color === C_FLG_ON) {
7222
+ const tmpArrayData = splitLF(dosColorData);
7214
7223
 
7215
7224
  tmpArrayData.filter(data => hasVal(data)).forEach(tmpData => {
7216
7225
  const tmpColorData = tmpData.split(`,`);
@@ -7239,7 +7248,7 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7239
7248
  * @param {number} _scoreNo
7240
7249
  */
7241
7250
  const setCssMotionData = (_header, _scoreNo) => {
7242
- const dosCssMotionData = _dosObj[`${_header}Motion${_scoreNo}_data`] || _dosObj[`${_header}Motion_data`];
7251
+ const dosCssMotionData = getRefData(`${_header}Motion`, `${_scoreNo}_data`) || _dosObj[`${_header}Motion_data`];
7243
7252
  const cssMotionData = [];
7244
7253
 
7245
7254
  if (hasVal(dosCssMotionData) && g_stateObj.d_arroweffect === C_FLG_ON) {
@@ -7265,7 +7274,7 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7265
7274
  * @param {number} _scoreNo
7266
7275
  */
7267
7276
  const setScrollchData = (_scoreNo) => {
7268
- const dosScrollchData = _dosObj[`scrollch${_scoreNo}_data`] || _dosObj.scrollch_data;
7277
+ const dosScrollchData = getRefData(`scrollch`, `${_scoreNo}_data`) || _dosObj.scrollch_data;
7269
7278
  const scrollchData = [];
7270
7279
 
7271
7280
  if (hasVal(dosScrollchData)) {
@@ -7285,6 +7294,18 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7285
7294
  return [];
7286
7295
  };
7287
7296
 
7297
+ /**
7298
+ * 譜面データに別の関連名が含まれていた場合、関連名の変数を返す
7299
+ * 例) |backA2_data=back_data| -> back_dataで定義された値を使用
7300
+ * @param {string} _header
7301
+ * @param {string} _dataName
7302
+ * @returns
7303
+ */
7304
+ const getRefData = (_header, _dataName) => {
7305
+ const data = _dosObj[`${_header}${_dataName}`];
7306
+ return data?.startsWith(_header) ? _dosObj[data] : data;
7307
+ }
7308
+
7288
7309
  /**
7289
7310
  * 譜面データの優先順配列の取得
7290
7311
  * @param {string} _header
@@ -7293,10 +7314,10 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7293
7314
  * @returns
7294
7315
  */
7295
7316
  const getPriorityList = (_header, _type, _scoreNo) => [
7296
- _dosObj[`${_header}${_type}${g_localeObj.val}${_scoreNo}_data`],
7297
- _dosObj[`${_header}${_type}${g_localeObj.val}_data`],
7298
- _dosObj[`${_header}${_type}${_scoreNo}_data`],
7299
- _dosObj[`${_header}${_type}_data`]
7317
+ getRefData(_header, `${_type}${g_localeObj.val}${_scoreNo}_data`),
7318
+ getRefData(_header, `${_type}${g_localeObj.val}_data`),
7319
+ getRefData(_header, `${_type}${_scoreNo}_data`),
7320
+ getRefData(_header, `${_type}_data`)
7300
7321
  ];
7301
7322
 
7302
7323
  /**
@@ -7425,16 +7446,17 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7425
7446
 
7426
7447
  /**
7427
7448
  * リザルトモーションデータ(結果画面用背景・マスクデータ)の分解
7428
- * @param {string} _header
7429
- * @param {string} _scoreNo
7430
- * @param {string} _defaultHeader
7449
+ * @param {string} _header 背景、マスク (back, mask)
7450
+ * @param {string} _resultType リザルトモーションの種類 (result, failedB, failedS)
7451
+ * @param {string} _scoreNo 譜面番号
7452
+ * @param {string} _defaultType _resultTypeが無いときの代替名
7431
7453
  */
7432
- const makeBackgroundResultData = (_header, _scoreNo, _defaultHeader = ``) => {
7454
+ const makeBackgroundResultData = (_header, _resultType, _scoreNo, _defaultType = ``) => {
7433
7455
  const dataList = [];
7434
- const addResultDataList = _headerType => dataList.push(...getPriorityList(``, _headerType, _scoreNo));
7435
- addResultDataList(_header);
7436
- if (_defaultHeader !== ``) {
7437
- addResultDataList(_defaultHeader);
7456
+ const addDataList = (_type = ``) => dataList.push(...getPriorityList(_header, _type, _scoreNo));
7457
+ addDataList(_resultType);
7458
+ if (_defaultType !== ``) {
7459
+ addDataList(_defaultType);
7438
7460
  }
7439
7461
 
7440
7462
  const data = dataList.find((v) => v !== undefined);
@@ -7512,17 +7534,17 @@ const scoreConvert = (_dosObj, _scoreId, _preblankFrame, _dummyNo = ``,
7512
7534
  } else {
7513
7535
  g_animationData.forEach(sprite => {
7514
7536
  [g_headerObj[`${sprite}ResultData`], g_headerObj[`${sprite}ResultMaxDepth`]] =
7515
- makeBackgroundResultData(`${sprite}result`, scoreIdHeader);
7537
+ makeBackgroundResultData(sprite, `result`, scoreIdHeader);
7516
7538
  [g_headerObj[`${sprite}FailedData`], g_headerObj[`${sprite}FailedMaxDepth`]] =
7517
- makeBackgroundResultData(`${sprite}failed${g_stateObj.lifeMode.slice(0, 1)}`, scoreIdHeader, `${sprite}result`);
7539
+ makeBackgroundResultData(sprite, `failed${g_stateObj.lifeMode.slice(0, 1)}`, scoreIdHeader, `result`);
7518
7540
  });
7519
7541
  }
7520
7542
 
7521
7543
  // キー変化定義
7522
7544
  obj.keychFrames = [0];
7523
7545
  obj.keychTarget = [`0`];
7524
- if (hasVal(_dosObj[`keych${setScoreIdHeader(g_stateObj.scoreId, g_stateObj.scoreLockFlg)}_data`])) {
7525
- const keychdata = splitLF2(_dosObj[`keych${setScoreIdHeader(g_stateObj.scoreId, g_stateObj.scoreLockFlg)}_data`], `,`);
7546
+ if (hasVal(getRefData(`keych`, `${scoreIdHeader}_data`))) {
7547
+ const keychdata = splitLF2(getRefData(`keych`, `${scoreIdHeader}_data`), `,`);
7526
7548
  obj.keychFrames.push(...keychdata.filter((val, j) => j % 2 === 0));
7527
7549
  obj.keychTarget.push(...keychdata.filter((val, j) => j % 2 === 1));
7528
7550
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "31.1.0",
3
+ "version": "31.2.0",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "index.js",
6
6
  "scripts": {