Move get anim utils to shared
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user