Skip to content

Commit

Permalink
Merge pull request #1225 from cwtickle/develop
Browse files Browse the repository at this point in the history
[ver26.1.0] 推定Adjの計算方法変更、密度グラフの表記拡張 他
  • Loading branch information
cwtickle committed Feb 5, 2022
2 parents fb5e036 + 761c337 commit adf2fd5
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 28 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -15,6 +15,7 @@
|MFV2|[@MFV2](https://github.com/MFV2)|[@MFV2_](https://twitter.com/MFV2_)|コーディング、機能提案、不具合報告、事象解析|
|natu||[@natu_ame_](https://twitter.com/natu_ame_)|機能提案|
|SKB|[@superkuppabros](https://github.com/superkuppabros)|[@superkuppabros](https://twitter.com/superkuppabros)|機能提案、不具合報告|
|Tarwil||[@Tarwil1503](https://twitter.com/Tarwil1503)|コーディング、機能提案|
|蒼宮野あいすかぁびぃ4号||[@icekirby4](https://twitter.com/icekirby4)|機能提案|
|さつき|[@satsukizzz](https://github.com/satsukizzz)|[@satsukizzz](https://twitter.com/satsukizzz)|機能提案、不具合報告|
|ショウタ||[@sssyouta](https://twitter.com/sssyouta)|機能提案、不具合報告|
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Expand Up @@ -15,8 +15,8 @@ v19, v25の対応終了時期はv28リリース開始時を予定しています

| Version | Supported | Latest Version | Logs | First Release | End of Support |
| ------- | ------------------ |----------------|------|---------------|----------------|
| v26 | :heavy_check_mark: |[v26.0.0](https://github.com/cwtickle/danoniplus/releases/tag/v26.0.0) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v26)|2022-01-30|-|
| v25 | :heavy_check_mark: |[v25.5.3](https://github.com/cwtickle/danoniplus/releases/tag/v25.5.3) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v25)|2022-01-04|(At Release v28)|
| v26 | :heavy_check_mark: |[v26.1.0](https://github.com/cwtickle/danoniplus/releases/tag/v26.1.0) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v26)|2022-01-30|-|
| v25 | :heavy_check_mark: |[v25.5.4](https://github.com/cwtickle/danoniplus/releases/tag/v25.5.4) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v25)|2022-01-04|(At Release v28)|
| v24 | :heavy_check_mark: |[v24.6.3](https://github.com/cwtickle/danoniplus/releases/tag/v24.6.3) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v24)|2021-10-24|(At Release v33)|
| v23 | :x: |[v23.5.6 (final)](https://github.com/cwtickle/danoniplus/releases/tag/v23.5.6) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v23)|2021-09-04|2022-01-30|
| v22 | :x: |[v22.5.6 (final)](https://github.com/cwtickle/danoniplus/releases/tag/v22.5.6) |[:memo:](https://github.com/cwtickle/danoniplus/wiki/Changelog-v22)|2021-04-28|2022-01-04|
Expand Down
121 changes: 97 additions & 24 deletions js/danoni_main.js
Expand Up @@ -4,12 +4,12 @@
*
* Source by tickle
* Created : 2018/10/08
* Revised : 2022/01/30
* Revised : 2022/02/05
*
* https://github.com/cwtickle/danoniplus
*/
const g_version = `Ver 26.0.0`;
const g_revisedDate = `2022/01/30`;
const g_version = `Ver 26.1.0`;
const g_revisedDate = `2022/02/05`;
const g_alphaVersion = ``;

// カスタム用バージョン (danoni_custom.js 等で指定可)
Expand Down Expand Up @@ -125,7 +125,14 @@ const g_detailObj = {
arrowCnt: [],
frzCnt: [],
maxDensity: [],
maxDensity2Push: [],
maxDensity3Push: [],
densityData: [],
density2PushData: [],
density3PushData: [],
densityDiff: [],
density2PushDiff: [],
density3PushDiff: [],
startFrame: [],
playingFrame: [],
playingFrameWithBlank: [],
Expand Down Expand Up @@ -1607,6 +1614,7 @@ function storeBaseData(_scoreId, _scoreObj, _keyCtrlPtn) {
let allData = 0;

const types = [`arrow`, `frz`];
let fullData = [];
for (let j = 0; j < keyNum; j++) {
noteCnt.arrow[j] = 0;
noteCnt.frz[j] = 0;
Expand All @@ -1625,17 +1633,53 @@ function storeBaseData(_scoreId, _scoreObj, _keyCtrlPtn) {
}
})
});
fullData = fullData.concat(..._scoreObj.arrowData[j], ...tmpFrzData);
}

fullData = fullData.filter(val => !isNaN(parseFloat(val))).sort((a, b) => a - b);
let pushCnt = 0;
const density2PushData = [...Array(C_LEN_DENSITY_DIVISION)].fill(0);
const density3PushData = [...Array(C_LEN_DENSITY_DIVISION)].fill(0);
fullData.forEach((note, j) => {
if (fullData[j] === fullData[j + 1]) {
pushCnt++;
} else {
const point = Math.floor((note - firstArrowFrame) / playingFrame * C_LEN_DENSITY_DIVISION);
if (point >= 0) {
if (pushCnt > 2) {
density3PushData[point] += pushCnt;
}
density2PushData[point] += pushCnt;
}
pushCnt = 0;
}
});

g_detailObj.toolDif[_scoreId] = calcLevel(_scoreObj);
g_detailObj.speedData[_scoreId] = _scoreObj.speedData.concat();
g_detailObj.boostData[_scoreId] = _scoreObj.boostData.concat();

g_detailObj.maxDensity[_scoreId] = densityData.indexOf(Math.max.apply(null, densityData));
g_detailObj.densityData[_scoreId] = [];
for (let j = 0; j < C_LEN_DENSITY_DIVISION; j++) {
g_detailObj.densityData[_scoreId].push(Math.round(densityData[j] / allData * C_LEN_DENSITY_DIVISION * 10000) / 100);
const storeDensity = _densityData => {
const dataList = [];
for (let j = 0; j < C_LEN_DENSITY_DIVISION; j++) {
dataList.push(allData === 0 ? 0 : Math.round(_densityData[j] / allData * C_LEN_DENSITY_DIVISION * 10000) / 100);
}
return dataList;
}
const diffArray = (_array1, _array2) => {
const list = [];
_array1.forEach((val, j) => list.push(_array1[j] - _array2[j]));
return list;
};
g_detailObj.densityData[_scoreId] = storeDensity(densityData);
g_detailObj.density2PushData[_scoreId] = storeDensity(density2PushData);
g_detailObj.density3PushData[_scoreId] = storeDensity(density3PushData);

g_detailObj.densityDiff[_scoreId] = diffArray(g_detailObj.densityData[_scoreId], g_detailObj.density2PushData[_scoreId]);
g_detailObj.density2PushDiff[_scoreId] = diffArray(g_detailObj.density2PushData[_scoreId], g_detailObj.density3PushData[_scoreId]);
g_detailObj.density3PushDiff[_scoreId] = g_detailObj.density3PushData[_scoreId].concat();

g_detailObj.maxDensity[_scoreId] = densityData.indexOf(Math.max.apply(null, densityData));

g_detailObj.arrowCnt[_scoreId] = noteCnt.arrow.concat();
g_detailObj.frzCnt[_scoreId] = noteCnt.frz.concat();
Expand Down Expand Up @@ -2562,15 +2606,23 @@ function titleInit() {

// コメントエリア作成
if (g_headerObj.commentVal !== ``) {

// コメント文の加工
const comments = g_headerObj.commentVal.split(`}`).join(`{`).split(`{`);
let convCommentVal = ``;
for (let j = 0; j < comments.length; j += 2) {
convCommentVal += escapeHtmlForEnabledTag(comments[j]);
convCommentVal += setVal(comments[j + 1], ``, C_TYP_CALC);
}

if (g_headerObj.commentExternal) {
if (document.querySelector(`#commentArea`) !== null) {
commentArea.innerHTML = g_headerObj.commentVal;
commentArea.innerHTML = convCommentVal;
}
} else {
let tmpComment = g_headerObj.commentVal;
multiAppend(divRoot,

createDivCss2Label(`lblComment`, tmpComment, {
createDivCss2Label(`lblComment`, convCommentVal, {
x: 0, y: 70, w: g_sWidth, h: g_sHeight - 180, siz: C_SIZ_DIFSELECTOR, align: C_ALIGN_LEFT,
overflow: `auto`, background: `#222222`, color: `#cccccc`, display: C_DIS_NONE,
}),
Expand All @@ -2579,10 +2631,11 @@ function titleInit() {
const lblCommentDef = lblComment.style.display;
lblComment.style.display = (lblCommentDef === C_DIS_NONE ? C_DIS_INHERIT : C_DIS_NONE);
}, {
x: g_sWidth - 180, y: (g_sHeight / 2) + 150, w: 150, h: 50, siz: 20, border: `solid 1px #999999`,
x: g_sWidth - 160, y: (g_sHeight / 2) + 150, w: 140, h: 50, siz: 20, border: `solid 1px #999999`,
}, g_cssObj.button_Default),

);
setUserSelect(lblComment.style, `text`);
}
}

Expand Down Expand Up @@ -3396,7 +3449,7 @@ function headerConvert(_dosObj) {
const newlineTag = setVal(_dosObj.commentAutoBr, true, C_TYP_BOOLEAN) ? `<br>` : ``;
let tmpComment = setVal(_dosObj[`commentVal${g_localeObj.val}`] || _dosObj.commentVal, ``, C_TYP_STRING);
tmpComment = tmpComment.split(`\r\n`).join(`\n`);
obj.commentVal = escapeHtmlForEnabledTag(tmpComment.split(`\n`).join(newlineTag));
obj.commentVal = tmpComment.split(`\n`).join(newlineTag);

// クレジット表示
if (document.querySelector(`#webMusicTitle`) !== null) {
Expand Down Expand Up @@ -4441,13 +4494,30 @@ function createOptionWindow(_sprite) {
drawBaseLine(context);
for (let j = 0; j < C_LEN_DENSITY_DIVISION; j++) {
context.beginPath();
context.fillStyle = (j === g_detailObj.maxDensity[_scoreId] ? C_CLR_DENSITY_MAX : C_CLR_DENSITY_DEFAULT);
context.fillRect(16 * j * 16 / C_LEN_DENSITY_DIVISION + 30, 195 - 9 * g_detailObj.densityData[_scoreId][j] / 10,
15.5 * 16 / C_LEN_DENSITY_DIVISION, 9 * g_detailObj.densityData[_scoreId][j] / 10
);
[``, `2Push`, `3Push`].forEach(val => {
context.fillStyle = (j === g_detailObj.maxDensity[_scoreId] ? g_graphColorObj[`max${val}`] : g_graphColorObj[`default${val}`]);
context.fillRect(16 * j * 16 / C_LEN_DENSITY_DIVISION + 30, 195 - 9 * g_detailObj[`density${val}Data`][_scoreId][j] / 10,
15.5 * 16 / C_LEN_DENSITY_DIVISION, 9 * g_detailObj[`density${val}Diff`][_scoreId][j] / 10
);
});
context.stroke();
}

const lineNames = [`1Push`, `2Push`, `3Push+`];
Object.keys(g_graphColorObj).filter(val => val.indexOf(`max`) !== -1).forEach((val, j) => {
const lineX = 70 + j * 70;

context.beginPath();
context.lineWidth = 3;
context.fillStyle = g_rankObj.rankColorAllPerfect;
context.strokeStyle = g_graphColorObj[val];
context.moveTo(lineX, 215);
context.lineTo(lineX + 20, 215);
context.stroke();
context.font = `${C_SIZ_DIFSELECTOR}px ${getBasicFont()}`;
context.fillText(lineNames[j], lineX + 20, 218);
});

const obj = getScoreBaseData(_scoreId);
updateScoreDetailLabel(`Density`, g_lblNameObj.s_apm, obj.apm, 0);
updateScoreDetailLabel(`Density`, g_lblNameObj.s_time, obj.playingTime, 1);
Expand Down Expand Up @@ -9079,12 +9149,7 @@ function MainInit() {
g_timeoutEvtId = setTimeout(_ => flowTimeline(), 1000 / g_fps - buffTime);
}
}
if (typeof skinMainInit === C_TYP_FUNCTION) {
skinMainInit();
if (typeof skinMainInit2 === C_TYP_FUNCTION) {
skinMainInit2();
}
}
g_skinJsObj.main.forEach(func => func());

g_audio.currentTime = firstFrame / g_fps * g_headerObj.playbackRate;
g_audio.playbackRate = g_headerObj.playbackRate;
Expand Down Expand Up @@ -9641,8 +9706,16 @@ function resultInit() {
// diffListから適正Adjを算出(20個以下の場合は算出しない)
const getSign = _val => (_val > 0 ? `+` : ``);
const getDiffFrame = _val => `${getSign(_val)}${_val}${g_lblNameObj.frame}`;
const estimatedAdj = (g_workObj.diffList.length <= 20 ?
`` : Math.round((g_stateObj.adjustment - g_workObj.diffList.reduce((x, y) => x + y, 0) / g_workObj.diffList.length) * 10) / 10);
const diffLength = g_workObj.diffList.length;
const bayesFunc = (_offset, _length) => {
let result = 0;
for (let j = _offset; j < _length; j++) {
result += (_length - j) * (j + 1) * g_workObj.diffList[j];
}
return result;
};
const bayesExVal = 3 * bayesFunc(0, diffLength) / (diffLength * (diffLength + 1) * (diffLength + 2));
const estimatedAdj = (diffLength <= 20 ? `` : Math.round((g_stateObj.adjustment - bayesExVal) * 10) / 10);

// 背景スプライトを作成
createMultipleSprite(`backResultSprite`, g_headerObj.backResultMaxDepth);
Expand Down
13 changes: 11 additions & 2 deletions js/lib/danoni_constants.js
Expand Up @@ -5,7 +5,7 @@
*
* Source by tickle
* Created : 2019/11/19
* Revised : 2022/01/26 (v25.5.1)
* Revised : 2022/02/05 (v26.1.0)
*
* https://github.com/cwtickle/danoniplus
*/
Expand Down Expand Up @@ -245,6 +245,15 @@ const C_CLR_DENSITY_MAX = `#990000cc`;
const C_CLR_DENSITY_DEFAULT = `#999999cc`;
const C_LEN_DENSITY_DIVISION = 16;

const g_graphColorObj = {
max: `#993333cc`,
default: `#999999cc`,
max2Push: `#9933cccc`,
default2Push: `#777777cc`,
max3Push: `#003399cc`,
default3Push: `#555555cc`,
};

const g_settingBtnObj = {
chara: {
L: `<`,
Expand Down Expand Up @@ -2389,7 +2398,7 @@ const g_escapeStr = {
escapeTag: [
[`*amp*`, `&amp;`], [`*pipe*`, `|`], [`*dollar*`, `$`], [`*rsquo*`, `&rsquo;`],
[`*quot*`, `&quot;`], [`*comma*`, `&sbquo;`], [`*squo*`, `&#39;`], [`*bkquo*`, `&#96;`],
[`*lt*`, `&lt;`], [`*gt*`, `&gt;`],
[`*lt*`, `&lt;`], [`*gt*`, `&gt;`], [`*lbrace*`, `{`], [`*rbrace*`, `}`],
],
unEscapeTag: [
[`&amp;`, `&`], [`&rsquo;`, `’`], [`&quot;`, `"`], [`&sbquo;`, `,`],
Expand Down

0 comments on commit adf2fd5

Please sign in to comment.