Move get anim utils to shared

This commit is contained in:
Vortrex
2022-06-30 16:32:28 -05:00
parent defee4c76e
commit 72562688e7
3 changed files with 57 additions and 67 deletions

View File

@@ -2857,4 +2857,33 @@ function removeBitFlag(allFlags, flagValue) {
return allFlags ^ flagValue;
}
// ===========================================================================
function getAnimationFromParams(params) {
let animations = getGameConfig().animations[getGame()];
if (isNaN(params)) {
for (let i in animations) {
if (toLowerCase(animations[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if (typeof getGameConfig().animations[getGame()][params] != "undefined") {
return toInteger(params);
}
}
return -1;
}
// ===========================================================================
/**
* @param {number} animationSlot - The slot index of the animation
* @return {AnimationData} The animation's data (array)
*/
function getAnimationData(animationSlot, gameId = getGame()) {
return getGameConfig().animations[gameId][animationSlot];
}
// ===========================================================================