| 1 | #include "Library/LiveActor/ActorAnimFunction.h" |
| 2 | |
| 3 | #include <basis/seadTypes.h> |
| 4 | #include <nn/g3d/ResSkeleton.h> |
| 5 | |
| 6 | #include "Library/Anim/SklAnimRetargettingInfo.h" |
| 7 | #include "Library/Base/StringUtil.h" |
| 8 | #include "Library/Execute/ExecuteTableHolderUpdate.h" |
| 9 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 10 | #include "Library/LiveActor/LiveActor.h" |
| 11 | #include "Project/Anim/AnimPlayerVisual.h" |
| 12 | |
| 13 | namespace al { |
| 14 | void startSklAnim(LiveActor* actor, const char* animName) { |
| 15 | startSklAnimBlendInterpole(actor, nullptr, animName, nullptr, nullptr, nullptr, nullptr, |
| 16 | nullptr); |
| 17 | } |
| 18 | |
| 19 | void startSklAnimInterpole(LiveActor* actor, const char* animName0, const char* animName1) { |
| 20 | startSklAnimBlendInterpole(actor, animName1, animName0, nullptr, nullptr, nullptr, nullptr, |
| 21 | nullptr); |
| 22 | } |
| 23 | |
| 24 | bool tryStartSklAnimIfExist(LiveActor* actor, const char* animName) { |
| 25 | if (!isSklAnimExist(actor) || !getSkl(actor)->isSklAnimExist(animName)) |
| 26 | return false; |
| 27 | startSklAnim(actor, animName); |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | bool isSklAnimExist(const LiveActor* actor, const char* animName) { |
| 32 | return isSklAnimExist(actor) && getSkl(actor)->isSklAnimExist(animName); |
| 33 | } |
| 34 | |
| 35 | bool tryStartSklAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 36 | if (isSklAnimPlaying(actor, animName, 0)) |
| 37 | return false; |
| 38 | startSklAnim(actor, animName); |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | bool isSklAnimPlaying(const LiveActor* actor, const char* animName, s32 index) { |
| 43 | const char* playingName = getPlayingSklAnimName(actor, index); |
| 44 | return playingName && isEqualString(str1: animName, str2: playingName); |
| 45 | } |
| 46 | |
| 47 | void startSklAnimBlend(LiveActor* actor, const char* animName0, const char* animName1, |
| 48 | const char* animName2, const char* animName3, const char* animName4, |
| 49 | const char* animName5) { |
| 50 | startSklAnimBlendInterpole(actor, nullptr, animName0, animName1, animName2, animName3, |
| 51 | animName4, animName5); |
| 52 | } |
| 53 | |
| 54 | void startSklAnimBlendInterpole(LiveActor* actor, const char* animName0, const char* animName1, |
| 55 | const char* animName2, const char* animName3, const char* animName4, |
| 56 | const char* animName5, const char* animName6) { |
| 57 | getSkl(actor)->startSklAnim(animName0, animName1, animName2, animName3, animName4, animName5, |
| 58 | animName6); |
| 59 | } |
| 60 | |
| 61 | void clearSklAnimInterpole(LiveActor* actor) { |
| 62 | getSkl(actor)->reset(); |
| 63 | } |
| 64 | |
| 65 | bool isSklAnimExist(const LiveActor* actor) { |
| 66 | return getSkl(actor) != nullptr; |
| 67 | } |
| 68 | |
| 69 | bool isSklAnimEnd(const LiveActor* actor, s32 index) { |
| 70 | return getSkl(actor)->isSklAnimEnd(index); |
| 71 | } |
| 72 | |
| 73 | bool isSklAnimOneTime(const LiveActor* actor, const char* animName) { |
| 74 | return getSkl(actor)->isSklAnimOneTime(animName); |
| 75 | } |
| 76 | |
| 77 | bool isSklAnimOneTime(const LiveActor* actor, s32 index) { |
| 78 | return getSkl(actor)->isSklAnimOneTime(index); |
| 79 | } |
| 80 | |
| 81 | bool isSklAnimPlaying(const LiveActor* actor, s32 index) { |
| 82 | return getSkl(actor)->isSklAnimPlaying(index); |
| 83 | } |
| 84 | |
| 85 | const char* getPlayingSklAnimName(const LiveActor* actor, s32 index) { |
| 86 | return getSkl(actor)->getPlayingSklAnimName(index); |
| 87 | } |
| 88 | |
| 89 | f32 getSklAnimFrame(const LiveActor* actor, s32 index) { |
| 90 | return getSkl(actor)->getSklAnimFrame(index); |
| 91 | } |
| 92 | |
| 93 | f32 getSklAnimFrameRate(const LiveActor* actor, s32 index) { |
| 94 | return getSkl(actor)->getSklAnimFrameRate(index); |
| 95 | } |
| 96 | |
| 97 | f32 getSklAnimFrameMax(const LiveActor* actor, s32 index) { |
| 98 | return getSkl(actor)->getSklAnimFrameMax(index); |
| 99 | } |
| 100 | |
| 101 | f32 getSklAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 102 | return getSkl(actor)->getSklAnimFrameMax(animName); |
| 103 | } |
| 104 | |
| 105 | void setSklAnimFrame(LiveActor* actor, f32 frame, s32 index) { |
| 106 | getSkl(actor)->setSklAnimFrame(index, frame); |
| 107 | } |
| 108 | |
| 109 | void setSklAnimFrameRate(LiveActor* actor, f32 frameRate, s32 index) { |
| 110 | getSkl(actor)->setSklAnimFrameRate(index, frameRate); |
| 111 | } |
| 112 | |
| 113 | void setSklAnimFrameAndStop(LiveActor* actor, f32 frame, s32 index) { |
| 114 | setSklAnimFrame(actor, frame, index); |
| 115 | setSklAnimFrameRate(actor, frameRate: 0.0, index); |
| 116 | } |
| 117 | |
| 118 | s32 getSklAnimBlendNum(const LiveActor* actor) { |
| 119 | return getSkl(actor)->getSklAnimBlendNum(); |
| 120 | } |
| 121 | |
| 122 | f32 getSklAnimBlendWeight(const LiveActor* actor, s32 index) { |
| 123 | return getSkl(actor)->getSklAnimBlendWeight(index); |
| 124 | } |
| 125 | |
| 126 | void setSklAnimBlendWeight(LiveActor* actor, f32 weight, s32 index) { |
| 127 | setSklBlendWeight(actor, index, weight); |
| 128 | getSkl(actor)->calcSklAnim(); |
| 129 | } |
| 130 | |
| 131 | void setSklAnimBlendWeightDouble(LiveActor* actor, f32 weight) { |
| 132 | setSklBlendWeight(actor, index: 0, weight); |
| 133 | setSklBlendWeight(actor, index: 1, weight: 1 - weight); |
| 134 | getSkl(actor)->calcSklAnim(); |
| 135 | } |
| 136 | |
| 137 | void setSklAnimBlendWeightDouble(LiveActor* actor, f32 weight0, f32 weight1) { |
| 138 | setSklBlendWeight(actor, index: 0, weight: weight0); |
| 139 | setSklBlendWeight(actor, index: 1, weight: weight1); |
| 140 | getSkl(actor)->calcSklAnim(); |
| 141 | } |
| 142 | |
| 143 | void setSklAnimBlendWeightTriple(LiveActor* actor, f32 weight0, f32 weight1, f32 weight2) { |
| 144 | setSklBlendWeight(actor, index: 0, weight: weight0); |
| 145 | setSklBlendWeight(actor, index: 1, weight: weight1); |
| 146 | setSklBlendWeight(actor, index: 2, weight: weight2); |
| 147 | getSkl(actor)->calcSklAnim(); |
| 148 | } |
| 149 | |
| 150 | void setSklAnimBlendWeightQuad(LiveActor* actor, f32 weight0, f32 weight1, f32 weight2, |
| 151 | f32 weight3) { |
| 152 | setSklBlendWeight(actor, index: 0, weight: weight0); |
| 153 | setSklBlendWeight(actor, index: 1, weight: weight1); |
| 154 | setSklBlendWeight(actor, index: 2, weight: weight2); |
| 155 | setSklBlendWeight(actor, index: 3, weight: weight3); |
| 156 | getSkl(actor)->calcSklAnim(); |
| 157 | } |
| 158 | |
| 159 | void setSklAnimBlendWeightFivefold(LiveActor* actor, f32 weight0, f32 weight1, f32 weight2, |
| 160 | f32 weight3, f32 weight4) { |
| 161 | setSklBlendWeight(actor, index: 0, weight: weight0); |
| 162 | setSklBlendWeight(actor, index: 1, weight: weight1); |
| 163 | setSklBlendWeight(actor, index: 2, weight: weight2); |
| 164 | setSklBlendWeight(actor, index: 3, weight: weight3); |
| 165 | setSklBlendWeight(actor, index: 4, weight: weight4); |
| 166 | getSkl(actor)->calcSklAnim(); |
| 167 | } |
| 168 | |
| 169 | void setSklAnimBlendWeightSixfold(LiveActor* actor, f32 weight0, f32 weight1, f32 weight2, |
| 170 | f32 weight3, f32 weight4, f32 weight5) { |
| 171 | setSklBlendWeight(actor, index: 0, weight: weight0); |
| 172 | setSklBlendWeight(actor, index: 1, weight: weight1); |
| 173 | setSklBlendWeight(actor, index: 2, weight: weight2); |
| 174 | setSklBlendWeight(actor, index: 3, weight: weight3); |
| 175 | setSklBlendWeight(actor, index: 4, weight: weight4); |
| 176 | setSklBlendWeight(actor, index: 5, weight: weight5); |
| 177 | getSkl(actor)->calcSklAnim(); |
| 178 | } |
| 179 | |
| 180 | void setSklAnimBlendFrameAll(LiveActor* actor, f32 frame, bool isSync) { |
| 181 | AnimPlayerSkl* sklAnim = getSkl(actor); |
| 182 | |
| 183 | sklAnim->setSklAnimFrame(0, frame); |
| 184 | if (isSync) { |
| 185 | f32 frameMax0 = sklAnim->getSklAnimFrameMax(0); |
| 186 | for (s32 i = 1; i < sklAnim->getSklAnimBlendNum(); i++) { |
| 187 | if (getSkl(actor)->isSklAnimPlaying(i)) { |
| 188 | f32 frameCalc = (frame / frameMax0) * sklAnim->getSklAnimFrameMax(i); |
| 189 | getSkl(actor)->setSklAnimFrame(i, frameCalc); |
| 190 | } |
| 191 | } |
| 192 | } else { |
| 193 | for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++) |
| 194 | if (getSkl(actor)->isSklAnimPlaying(j)) |
| 195 | getSkl(actor)->setSklAnimFrame(j, frame); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | void setSklAnimBlendFrameRateAll(LiveActor* actor, f32 frameRate, bool isSync) { |
| 200 | AnimPlayerSkl* sklAnim = getSkl(actor); |
| 201 | |
| 202 | sklAnim->setSklAnimFrameRate(0, frameRate); |
| 203 | if (isSync) { |
| 204 | f32 frameMax0 = sklAnim->getSklAnimFrameMax(0); |
| 205 | for (s32 i = 1; i < sklAnim->getSklAnimBlendNum(); i++) { |
| 206 | if (getSkl(actor)->isSklAnimPlaying(i)) { |
| 207 | f32 frameCalc = (frameRate / frameMax0) * sklAnim->getSklAnimFrameMax(i); |
| 208 | getSkl(actor)->setSklAnimFrameRate(i, frameCalc); |
| 209 | } |
| 210 | } |
| 211 | } else { |
| 212 | for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++) |
| 213 | if (getSkl(actor)->isSklAnimPlaying(j)) |
| 214 | getSkl(actor)->setSklAnimFrameRate(j, frameRate); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | void startMtpAnim(LiveActor* actor, const char* animName) { |
| 219 | getMtp(actor)->startAnim(animName); |
| 220 | updateModelDraw(actor); |
| 221 | } |
| 222 | |
| 223 | void startMtpAnimAndSetFrameAndStop(LiveActor* actor, const char* animName, f32 frame) { |
| 224 | startMtpAnim(actor, animName); |
| 225 | setMtpAnimFrame(actor, frame); |
| 226 | setMtpAnimFrameRate(actor, 0.0); |
| 227 | } |
| 228 | |
| 229 | void setMtpAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 230 | getMtp(actor)->setAnimFrameRate(frameRate); |
| 231 | } |
| 232 | |
| 233 | void setMtpAnimFrame(LiveActor* actor, f32 frame) { |
| 234 | getMtp(actor)->setAnimFrame(frame); |
| 235 | updateModelDraw(actor); |
| 236 | } |
| 237 | |
| 238 | bool tryStartMtpAnimIfExist(LiveActor* actor, const char* animName) { |
| 239 | if (!isMtpAnimExist(actor) || !getMtp(actor)->isAnimExist(animName)) |
| 240 | return false; |
| 241 | startMtpAnim(actor, animName); |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | bool isMtpAnimExist(const LiveActor* actor, const char* animName) { |
| 246 | return getMtp(actor) && getMtp(actor)->isAnimExist(animName); |
| 247 | } |
| 248 | |
| 249 | bool tryStartMtpAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 250 | if (isMtpAnimPlaying(actor, animName)) |
| 251 | return false; |
| 252 | startMtpAnim(actor, animName); |
| 253 | return true; |
| 254 | } |
| 255 | |
| 256 | bool isMtpAnimPlaying(const LiveActor* actor, const char* animName) { |
| 257 | return isEqualString(str1: animName, str2: getPlayingMtpAnimName(actor)); |
| 258 | } |
| 259 | |
| 260 | void clearMtpAnim(LiveActor* actor) { |
| 261 | getMtp(actor)->clearAnim(); |
| 262 | updateModelDraw(actor); |
| 263 | } |
| 264 | |
| 265 | bool isMtpAnimExist(const LiveActor* actor) { |
| 266 | return getMtp(actor) != nullptr; |
| 267 | } |
| 268 | |
| 269 | bool isMtpAnimEnd(const LiveActor* actor) { |
| 270 | return getMtp(actor)->isAnimEnd(); |
| 271 | } |
| 272 | |
| 273 | bool isMtpAnimOneTime(const LiveActor* actor, const char* animName) { |
| 274 | return getMtp(actor)->isAnimOneTime(animName); |
| 275 | } |
| 276 | |
| 277 | bool isMtpAnimOneTime(const LiveActor* actor) { |
| 278 | return getMtp(actor)->isAnimOneTime(); |
| 279 | } |
| 280 | |
| 281 | const char* getPlayingMtpAnimName(const LiveActor* actor) { |
| 282 | return getMtp(actor)->getPlayingAnimName(); |
| 283 | } |
| 284 | |
| 285 | bool isMtpAnimPlaying(const LiveActor* actor) { |
| 286 | return isMtpAnimExist(actor) && getMtp(actor)->isAnimPlaying(); |
| 287 | } |
| 288 | |
| 289 | f32 getMtpAnimFrame(const LiveActor* actor) { |
| 290 | return getMtp(actor)->getAnimFrame(); |
| 291 | } |
| 292 | |
| 293 | f32 getMtpAnimFrameRate(const LiveActor* actor) { |
| 294 | return getMtp(actor)->getAnimFrameRate(); |
| 295 | } |
| 296 | |
| 297 | f32 getMtpAnimFrameMax(const LiveActor* actor) { |
| 298 | return getMtp(actor)->getAnimFrameMax(); |
| 299 | } |
| 300 | |
| 301 | f32 getMtpAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 302 | return getMtp(actor)->getAnimFrameMax(animName); |
| 303 | } |
| 304 | |
| 305 | void setMtpAnimFrameAndStop(LiveActor* actor, f32 frame) { |
| 306 | setMtpAnimFrame(actor, frame); |
| 307 | setMtpAnimFrameRate(actor, frameRate: 0.0); |
| 308 | } |
| 309 | |
| 310 | void setMtpAnimFrameAndStopEnd(LiveActor* actor) { |
| 311 | setMtpAnimFrameAndStop(actor, frame: getMtpAnimFrameMax(actor)); |
| 312 | } |
| 313 | |
| 314 | void startMclAnim(LiveActor* actor, const char* animName) { |
| 315 | getMcl(actor)->startAnim(animName); |
| 316 | } |
| 317 | |
| 318 | bool isMclAnimExist(const LiveActor* actor) { |
| 319 | return getMcl(actor) != nullptr; |
| 320 | } |
| 321 | |
| 322 | bool isMclAnimExist(const LiveActor* actor, const char* animName) { |
| 323 | return isMclAnimExist(actor) && getMcl(actor)->isAnimExist(animName); |
| 324 | } |
| 325 | |
| 326 | bool tryStartMclAnimIfExist(LiveActor* actor, const char* animName) { |
| 327 | if (!isMclAnimExist(actor) || !getMcl(actor)->isAnimExist(animName)) |
| 328 | return false; |
| 329 | startMclAnim(actor, animName); |
| 330 | return true; |
| 331 | } |
| 332 | |
| 333 | bool tryStartMclAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 334 | if (isMclAnimPlaying(actor, animName)) |
| 335 | return false; |
| 336 | startMclAnim(actor, animName); |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | bool isMclAnimPlaying(const LiveActor* actor, const char* animName) { |
| 341 | return isEqualString(str1: animName, str2: getPlayingMclAnimName(actor)); |
| 342 | } |
| 343 | |
| 344 | void clearMclAnim(LiveActor* actor) { |
| 345 | getMcl(actor)->clearAnim(); |
| 346 | } |
| 347 | |
| 348 | bool isMclAnimEnd(const LiveActor* actor) { |
| 349 | return getMcl(actor)->isAnimEnd(); |
| 350 | } |
| 351 | |
| 352 | bool isMclAnimOneTime(const LiveActor* actor, const char* animName) { |
| 353 | return getMcl(actor)->isAnimOneTime(animName); |
| 354 | } |
| 355 | |
| 356 | bool isMclAnimOneTime(const LiveActor* actor) { |
| 357 | return getMcl(actor)->isAnimOneTime(); |
| 358 | } |
| 359 | |
| 360 | const char* getPlayingMclAnimName(const LiveActor* actor) { |
| 361 | return getMcl(actor)->getPlayingAnimName(); |
| 362 | } |
| 363 | |
| 364 | bool isMclAnimPlaying(const LiveActor* actor) { |
| 365 | return isMclAnimExist(actor) && getMcl(actor)->isAnimPlaying(); |
| 366 | } |
| 367 | |
| 368 | f32 getMclAnimFrame(const LiveActor* actor) { |
| 369 | return getMcl(actor)->getAnimFrame(); |
| 370 | } |
| 371 | |
| 372 | f32 getMclAnimFrameRate(const LiveActor* actor) { |
| 373 | return getMcl(actor)->getAnimFrameRate(); |
| 374 | } |
| 375 | |
| 376 | f32 getMclAnimFrameMax(const LiveActor* actor) { |
| 377 | return getMcl(actor)->getAnimFrameMax(); |
| 378 | } |
| 379 | |
| 380 | f32 getMclAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 381 | return getMcl(actor)->getAnimFrameMax(animName); |
| 382 | } |
| 383 | |
| 384 | void setMclAnimFrame(LiveActor* actor, f32 frame) { |
| 385 | getMcl(actor)->setAnimFrame(frame); |
| 386 | } |
| 387 | |
| 388 | void setMclAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 389 | getMcl(actor)->setAnimFrameRate(frameRate); |
| 390 | } |
| 391 | |
| 392 | void startMclAnimAndSetFrameAndStop(LiveActor* actor, const char* animName, f32 frame) { |
| 393 | startMclAnim(actor, animName); |
| 394 | setMclAnimFrame(actor, frame); |
| 395 | setMclAnimFrameRate(actor, frameRate: 0.0); |
| 396 | } |
| 397 | |
| 398 | void setMclAnimFrameAndStop(LiveActor* actor, f32 frame) { |
| 399 | setMclAnimFrame(actor, frame); |
| 400 | setMclAnimFrameRate(actor, frameRate: 0.0); |
| 401 | } |
| 402 | |
| 403 | void setMclAnimNormalFrameAndStop(LiveActor* actor, f32 frame) { |
| 404 | setMclAnimFrame(actor, frame: frame * getMclAnimFrameMax(actor)); |
| 405 | setMclAnimFrameRate(actor, frameRate: 0.0); |
| 406 | } |
| 407 | |
| 408 | void setMclAnimFrameAndStopEnd(LiveActor* actor) { |
| 409 | setMclAnimFrame(actor, frame: getMclAnimFrameMax(actor)); |
| 410 | setMclAnimFrameRate(actor, frameRate: 0.0); |
| 411 | } |
| 412 | |
| 413 | void startMtsAnim(LiveActor* actor, const char* animName) { |
| 414 | getMts(actor)->startAnim(animName); |
| 415 | } |
| 416 | |
| 417 | void startMtsAnimAndSetFrameAndStop(LiveActor* actor, const char* animName, f32 frame) { |
| 418 | startMtsAnim(actor, animName); |
| 419 | setMtsAnimFrame(actor, frame); |
| 420 | setMtsAnimFrameRate(actor, 0.0); |
| 421 | } |
| 422 | |
| 423 | void setMtsAnimFrame(LiveActor* actor, f32 frame) { |
| 424 | getMts(actor)->setAnimFrame(frame); |
| 425 | } |
| 426 | |
| 427 | void setMtsAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 428 | getMts(actor)->setAnimFrameRate(frameRate); |
| 429 | } |
| 430 | |
| 431 | bool tryStartMtsAnimIfExist(LiveActor* actor, const char* animName) { |
| 432 | if (!isMtsAnimExist(actor) || !getMts(actor)->isAnimExist(animName)) |
| 433 | return false; |
| 434 | startMtsAnim(actor, animName); |
| 435 | return true; |
| 436 | } |
| 437 | |
| 438 | bool isMtsAnimExist(const LiveActor* actor, const char* animName) { |
| 439 | return isMtsAnimExist(actor) && getMts(actor)->isAnimExist(animName); |
| 440 | } |
| 441 | |
| 442 | bool tryStartMtsAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 443 | if (isMtsAnimPlaying(actor, animName)) |
| 444 | return false; |
| 445 | startMtsAnim(actor, animName); |
| 446 | return true; |
| 447 | } |
| 448 | |
| 449 | bool isMtsAnimPlaying(const LiveActor* actor, const char* animName) { |
| 450 | return isEqualString(str1: animName, str2: getPlayingMtsAnimName(actor)); |
| 451 | } |
| 452 | |
| 453 | void clearMtsAnim(LiveActor* actor) { |
| 454 | getMts(actor)->clearAnim(); |
| 455 | } |
| 456 | |
| 457 | bool isMtsAnimExist(const LiveActor* actor) { |
| 458 | return getMts(actor) != nullptr; |
| 459 | } |
| 460 | |
| 461 | bool isMtsAnimEnd(const LiveActor* actor) { |
| 462 | return getMts(actor)->isAnimEnd(); |
| 463 | } |
| 464 | |
| 465 | bool isMtsAnimOneTime(const LiveActor* actor, const char* animName) { |
| 466 | return getMts(actor)->isAnimOneTime(animName); |
| 467 | } |
| 468 | |
| 469 | bool isMtsAnimOneTime(const LiveActor* actor) { |
| 470 | return getMts(actor)->isAnimOneTime(); |
| 471 | } |
| 472 | |
| 473 | const char* getPlayingMtsAnimName(const LiveActor* actor) { |
| 474 | return getMts(actor)->getPlayingAnimName(); |
| 475 | } |
| 476 | |
| 477 | bool isMtsAnimPlaying(const LiveActor* actor) { |
| 478 | return isMtsAnimExist(actor) && getMts(actor)->isAnimPlaying(); |
| 479 | } |
| 480 | |
| 481 | f32 getMtsAnimFrame(const LiveActor* actor) { |
| 482 | return getMts(actor)->getAnimFrame(); |
| 483 | } |
| 484 | |
| 485 | f32 getMtsAnimFrameRate(const LiveActor* actor) { |
| 486 | return getMts(actor)->getAnimFrameRate(); |
| 487 | } |
| 488 | |
| 489 | f32 getMtsAnimFrameMax(const LiveActor* actor) { |
| 490 | return getMts(actor)->getAnimFrameMax(); |
| 491 | } |
| 492 | |
| 493 | f32 getMtsAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 494 | return getMts(actor)->getAnimFrameMax(animName); |
| 495 | } |
| 496 | |
| 497 | void setMtsAnimFrameAndStop(LiveActor* actor, f32 frame) { |
| 498 | setMtsAnimFrame(actor, frame); |
| 499 | setMtsAnimFrameRate(actor, frameRate: 0.0); |
| 500 | } |
| 501 | |
| 502 | void setMtsAnimFrameAndStopEnd(LiveActor* actor) { |
| 503 | setMtsAnimFrame(actor, frame: getMtsAnimFrameMax(actor)); |
| 504 | setMtsAnimFrameRate(actor, frameRate: 0.0); |
| 505 | } |
| 506 | |
| 507 | void createMatAnimSlotForMcl(LiveActor* actor) { |
| 508 | createMat(actor, programType: 0); |
| 509 | } |
| 510 | |
| 511 | void createMatAnimSlotForMtp(LiveActor* actor) { |
| 512 | createMat(actor, programType: 1); |
| 513 | } |
| 514 | |
| 515 | void createMatAnimSlotForMts(LiveActor* actor) { |
| 516 | createMat(actor, programType: 2); |
| 517 | } |
| 518 | |
| 519 | void startMatAnim(LiveActor* actor, const char* animName) { |
| 520 | getMat(actor)->startAnim(animName); |
| 521 | updateModelDraw(actor); |
| 522 | } |
| 523 | |
| 524 | void startMatAnimAndSetFrameAndStop(LiveActor* actor, const char* animName, f32 frame) { |
| 525 | startMatAnim(actor, animName); |
| 526 | setMatAnimFrame(actor, frame); |
| 527 | setMatAnimFrameRate(actor, 0.0); |
| 528 | } |
| 529 | |
| 530 | void setMatAnimFrame(LiveActor* actor, f32 frame) { |
| 531 | getMat(actor)->setAnimFrame(frame); |
| 532 | } |
| 533 | |
| 534 | void setMatAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 535 | getMat(actor)->setAnimFrameRate(frameRate); |
| 536 | } |
| 537 | |
| 538 | bool tryStartMatAnimIfExist(LiveActor* actor, const char* animName) { |
| 539 | if (!isMatAnimExist(actor) || !getMat(actor)->isAnimExist(animName)) |
| 540 | return false; |
| 541 | startMatAnim(actor, animName); |
| 542 | return true; |
| 543 | } |
| 544 | |
| 545 | bool isMatAnimExist(const LiveActor* actor, const char* animName) { |
| 546 | return isMatAnimExist(actor) && getMat(actor)->isAnimExist(animName); |
| 547 | } |
| 548 | |
| 549 | bool tryStartMatAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 550 | if (isMatAnimPlaying(actor, animName)) |
| 551 | return false; |
| 552 | startMatAnim(actor, animName); |
| 553 | return true; |
| 554 | } |
| 555 | |
| 556 | bool isMatAnimPlaying(const LiveActor* actor, const char* animName) { |
| 557 | return isEqualString(str1: animName, str2: getPlayingMatAnimName(actor)); |
| 558 | } |
| 559 | |
| 560 | void clearMatAnim(LiveActor* actor) { |
| 561 | getMat(actor)->clearAnim(); |
| 562 | updateModelDraw(actor); |
| 563 | } |
| 564 | |
| 565 | bool isMatAnimExist(const LiveActor* actor) { |
| 566 | return getMat(actor) != nullptr; |
| 567 | } |
| 568 | |
| 569 | bool isMatAnimEnd(const LiveActor* actor) { |
| 570 | return getMat(actor)->isAnimEnd(); |
| 571 | } |
| 572 | |
| 573 | bool isMatAnimOneTime(const LiveActor* actor, const char* animName) { |
| 574 | return getMat(actor)->isAnimOneTime(animName); |
| 575 | } |
| 576 | |
| 577 | bool isMatAnimOneTime(const LiveActor* actor) { |
| 578 | return getMat(actor)->isAnimOneTime(); |
| 579 | } |
| 580 | |
| 581 | const char* getPlayingMatAnimName(const LiveActor* actor) { |
| 582 | return getMat(actor)->getPlayingAnimName(); |
| 583 | } |
| 584 | |
| 585 | bool isMatAnimPlaying(const LiveActor* actor) { |
| 586 | return isMatAnimExist(actor) && getMat(actor)->isAnimPlaying(); |
| 587 | } |
| 588 | |
| 589 | f32 getMatAnimFrame(const LiveActor* actor) { |
| 590 | return getMat(actor)->getAnimFrame(); |
| 591 | } |
| 592 | |
| 593 | f32 getMatAnimFrameRate(const LiveActor* actor) { |
| 594 | return getMat(actor)->getAnimFrameRate(); |
| 595 | } |
| 596 | |
| 597 | f32 getMatAnimFrameMax(const LiveActor* actor) { |
| 598 | return getMat(actor)->getAnimFrameMax(); |
| 599 | } |
| 600 | |
| 601 | f32 getMatAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 602 | return getMat(actor)->getAnimFrameMax(animName); |
| 603 | } |
| 604 | |
| 605 | void setMatAnimFrameAndStop(LiveActor* actor, f32 frame) { |
| 606 | setMatAnimFrame(actor, frame); |
| 607 | setMatAnimFrameRate(actor, frameRate: 0.0); |
| 608 | } |
| 609 | |
| 610 | void setMatAnimFrameAndStopEnd(LiveActor* actor) { |
| 611 | setMatAnimFrame(actor, frame: getMatAnimFrameMax(actor)); |
| 612 | setMatAnimFrameRate(actor, frameRate: 0.0); |
| 613 | } |
| 614 | |
| 615 | void startVisAnim(LiveActor* actor, const char* animName) { |
| 616 | getVis(actor)->startAnim(animName); |
| 617 | updateActorSystem(actor); |
| 618 | } |
| 619 | |
| 620 | bool tryStartVisAnimIfExist(LiveActor* actor, const char* animName) { |
| 621 | if (!isVisAnimExist(actor) || !getVis(actor)->isAnimExist(animName)) |
| 622 | return false; |
| 623 | startVisAnim(actor, animName); |
| 624 | return true; |
| 625 | } |
| 626 | |
| 627 | bool isVisAnimExist(const LiveActor* actor, const char* animName) { |
| 628 | return getVis(actor) && getVis(actor)->isAnimExist(animName); |
| 629 | } |
| 630 | |
| 631 | bool tryStartVisAnimIfNotPlaying(LiveActor* actor, const char* animName) { |
| 632 | if (isVisAnimPlaying(actor, animName)) |
| 633 | return false; |
| 634 | startVisAnim(actor, animName); |
| 635 | return true; |
| 636 | } |
| 637 | |
| 638 | bool isVisAnimPlaying(const LiveActor* actor, const char* animName) { |
| 639 | return isEqualString(str1: animName, str2: getPlayingVisAnimName(actor)); |
| 640 | } |
| 641 | |
| 642 | void clearVisAnim(LiveActor* actor) { |
| 643 | getVis(actor)->clearAnim(); |
| 644 | alActorSystemFunction::updateExecutorDraw(actor); |
| 645 | } |
| 646 | |
| 647 | bool isVisAnimExist(const LiveActor* actor) { |
| 648 | return getVis(actor) != nullptr; |
| 649 | } |
| 650 | |
| 651 | bool isVisAnimEnd(const LiveActor* actor) { |
| 652 | return getVis(actor)->isAnimEnd(); |
| 653 | } |
| 654 | |
| 655 | bool isVisAnimOneTime(const LiveActor* actor, const char* animName) { |
| 656 | return getVis(actor)->isAnimOneTime(animName); |
| 657 | } |
| 658 | |
| 659 | bool isVisAnimOneTime(const LiveActor* actor) { |
| 660 | return getVis(actor)->isAnimOneTime(); |
| 661 | } |
| 662 | |
| 663 | const char* getPlayingVisAnimName(const LiveActor* actor) { |
| 664 | return getVis(actor)->getPlayingAnimName(); |
| 665 | } |
| 666 | |
| 667 | bool isVisAnimPlaying(const LiveActor* actor) { |
| 668 | return isVisAnimExist(actor) && getVis(actor)->isAnimPlaying(); |
| 669 | } |
| 670 | |
| 671 | f32 getVisAnimFrame(const LiveActor* actor) { |
| 672 | return getVis(actor)->getAnimFrame(); |
| 673 | } |
| 674 | |
| 675 | f32 getVisAnimFrameRate(const LiveActor* actor) { |
| 676 | return getVis(actor)->getAnimFrameRate(); |
| 677 | } |
| 678 | |
| 679 | f32 getVisAnimFrameMax(const LiveActor* actor) { |
| 680 | return getVis(actor)->getAnimFrameMax(); |
| 681 | } |
| 682 | |
| 683 | f32 getVisAnimFrameMax(const LiveActor* actor, const char* animName) { |
| 684 | return getVis(actor)->getAnimFrameMax(animName); |
| 685 | } |
| 686 | |
| 687 | void setVisAnimFrame(LiveActor* actor, f32 frame) { |
| 688 | getVis(actor)->setAnimFrame(frame); |
| 689 | updateActorSystem(actor); |
| 690 | } |
| 691 | |
| 692 | void setVisAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 693 | getVis(actor)->setAnimFrameRate(frameRate); |
| 694 | } |
| 695 | |
| 696 | void setVisAnimFrameAndStop(LiveActor* actor, f32 frame) { |
| 697 | setVisAnimFrame(actor, frame); |
| 698 | setVisAnimFrameRate(actor, frameRate: 0.0); |
| 699 | } |
| 700 | |
| 701 | void setVisAnimFrameAndStopEnd(LiveActor* actor) { |
| 702 | setVisAnimFrame(actor, frame: getVisAnimFrameMax(actor)); |
| 703 | setVisAnimFrameRate(actor, frameRate: 0.0); |
| 704 | } |
| 705 | |
| 706 | void startVisAnimAndSetFrameAndStop(LiveActor* actor, const char* animName, f32 frame) { |
| 707 | startVisAnim(actor, animName); |
| 708 | setVisAnimFrame(actor, frame); |
| 709 | setVisAnimFrameRate(actor, frameRate: 0.0); |
| 710 | } |
| 711 | |
| 712 | void startVisAnimForAction(LiveActor* actor, const char* animName) { |
| 713 | getVisForAction(actor)->startAnim(animName); |
| 714 | updateActorSystem(actor); |
| 715 | } |
| 716 | |
| 717 | bool tryStartVisAnimIfExistForAction(LiveActor* actor, const char* animName) { |
| 718 | if (!isVisAnimExist(actor) || !getVis(actor)->isAnimExist(animName)) |
| 719 | return false; |
| 720 | startVisAnimForAction(actor, animName); |
| 721 | return true; |
| 722 | } |
| 723 | |
| 724 | bool tryStartVisAnimIfNotPlayingForAction(LiveActor* actor, const char* animName) { |
| 725 | if (isVisAnimPlayingForAction(actor, animName)) |
| 726 | return false; |
| 727 | startVisAnimForAction(actor, animName); |
| 728 | return true; |
| 729 | } |
| 730 | |
| 731 | bool isVisAnimPlayingForAction(const LiveActor* actor, const char* animName) { |
| 732 | return isEqualString(str1: animName, str2: getPlayingVisAnimNameForAction(actor)); |
| 733 | } |
| 734 | |
| 735 | void clearVisAnimForAction(LiveActor* actor) { |
| 736 | getVisForAction(actor)->clearAnim(); |
| 737 | alActorSystemFunction::updateExecutorDraw(actor); |
| 738 | } |
| 739 | |
| 740 | bool isVisAnimEndForAction(const LiveActor* actor) { |
| 741 | return getVisForAction(actor)->isAnimEnd(); |
| 742 | } |
| 743 | |
| 744 | bool isVisAnimOneTimeForAction(const LiveActor* actor, const char* animName) { |
| 745 | return getVisForAction(actor)->isAnimOneTime(animName); |
| 746 | } |
| 747 | |
| 748 | bool isVisAnimOneTimeForAction(const LiveActor* actor) { |
| 749 | return getVisForAction(actor)->isAnimOneTime(); |
| 750 | } |
| 751 | |
| 752 | const char* getPlayingVisAnimNameForAction(const LiveActor* actor) { |
| 753 | return getVisForAction(actor)->getPlayingAnimName(); |
| 754 | } |
| 755 | |
| 756 | bool isVisAnimPlayingForAction(const LiveActor* actor) { |
| 757 | return getVisForAction(actor) && getVisForAction(actor)->isAnimPlaying(); |
| 758 | } |
| 759 | |
| 760 | f32 getVisAnimFrameForAction(const LiveActor* actor) { |
| 761 | return getVisForAction(actor)->getAnimFrame(); |
| 762 | } |
| 763 | |
| 764 | f32 getVisAnimFrameRateForAction(const LiveActor* actor) { |
| 765 | return getVisForAction(actor)->getAnimFrameRate(); |
| 766 | } |
| 767 | |
| 768 | f32 getVisAnimFrameMaxForAction(const LiveActor* actor) { |
| 769 | return getVisForAction(actor)->getAnimFrameMax(); |
| 770 | } |
| 771 | |
| 772 | void setVisAnimFrameForAction(LiveActor* actor, f32 frame) { |
| 773 | getVisForAction(actor)->setAnimFrame(frame); |
| 774 | updateActorSystem(actor); |
| 775 | } |
| 776 | |
| 777 | void setVisAnimFrameRateForAction(LiveActor* actor, f32 frameRate) { |
| 778 | getVisForAction(actor)->setAnimFrameRate(frameRate); |
| 779 | } |
| 780 | |
| 781 | void setVisAnimFrameAndStopForAction(LiveActor* actor, f32 frame) { |
| 782 | setVisAnimFrameForAction(actor, frame); |
| 783 | setVisAnimFrameRateForAction(actor, frameRate: 0.0); |
| 784 | } |
| 785 | |
| 786 | void setVisAnimFrameAndStopEndForAction(LiveActor* actor) { |
| 787 | setVisAnimFrameForAction(actor, frame: getVisAnimFrameMaxForAction(actor)); |
| 788 | setVisAnimFrameRateForAction(actor, frameRate: 0.0); |
| 789 | } |
| 790 | |
| 791 | void startVisAnimAndSetFrameAndStopForAction(LiveActor* actor, const char* animName, f32 frame) { |
| 792 | startVisAnimForAction(actor, animName); |
| 793 | setVisAnimFrameForAction(actor, frame); |
| 794 | setVisAnimFrameRateForAction(actor, frameRate: 0.0); |
| 795 | } |
| 796 | |
| 797 | void setAllAnimFrame(LiveActor* actor, f32 frame) { |
| 798 | if (isSklAnimExist(actor)) |
| 799 | setSklAnimFrame(actor, frame, index: 0); |
| 800 | if (isMtpAnimExist(actor)) |
| 801 | setMtpAnimFrame(actor, frame); |
| 802 | if (isMclAnimExist(actor)) |
| 803 | setMclAnimFrame(actor, frame); |
| 804 | if (isMtsAnimExist(actor)) |
| 805 | setMtsAnimFrame(actor, frame); |
| 806 | if (isVisAnimExist(actor)) |
| 807 | setVisAnimFrame(actor, frame); |
| 808 | } |
| 809 | |
| 810 | void setAllAnimFrameRate(LiveActor* actor, f32 frameRate) { |
| 811 | if (isSklAnimExist(actor)) |
| 812 | setSklAnimFrameRate(actor, frameRate, index: 0); |
| 813 | if (isMtpAnimExist(actor)) |
| 814 | setMtpAnimFrameRate(actor, frameRate); |
| 815 | if (isMclAnimExist(actor)) |
| 816 | setMclAnimFrameRate(actor, frameRate); |
| 817 | if (isMtsAnimExist(actor)) |
| 818 | setMtsAnimFrameRate(actor, frameRate); |
| 819 | if (isVisAnimExist(actor)) |
| 820 | setVisAnimFrameRate(actor, frameRate); |
| 821 | } |
| 822 | |
| 823 | void startPartialSklAnim(LiveActor* actor, const char* animName, s32 partCount, s32 value, |
| 824 | const SklAnimRetargettingInfo* info) { |
| 825 | getSkl(actor)->startPartialAnim(animName, partCount, value, info); |
| 826 | } |
| 827 | |
| 828 | void startPartialSklAnimWithInterpolate(LiveActor* actor, const char* animName, s32 partCount, |
| 829 | s32 value, s32 interpol, |
| 830 | const SklAnimRetargettingInfo* info) { |
| 831 | AnimPlayerSkl* sklAnim = getSkl(actor); |
| 832 | startPartialSklAnim(actor, animName, partCount, value, info); |
| 833 | sklAnim->prepareAnimInterpDirect(interpol); |
| 834 | } |
| 835 | |
| 836 | void clearPartialSklAnim(LiveActor* actor, s32 index) { |
| 837 | getSkl(actor)->clearPartialAnim(index); |
| 838 | } |
| 839 | |
| 840 | void clearPartialSklAnimWithInterpolate(LiveActor* actor, s32 partIndex, s32 interpol) { |
| 841 | AnimPlayerSkl* sklAnim = getSkl(actor); |
| 842 | clearPartialSklAnim(actor, index: partIndex); |
| 843 | sklAnim->prepareAnimInterpDirect(interpol); |
| 844 | } |
| 845 | |
| 846 | bool isPartialSklAnimEnd(const LiveActor* actor, s32 index) { |
| 847 | return getSkl(actor)->isPartialAnimEnd(index); |
| 848 | } |
| 849 | |
| 850 | bool isPartialSklAnimOneTime(const LiveActor* actor, s32 index) { |
| 851 | return getSkl(actor)->isPartialAnimOneTime(index); |
| 852 | } |
| 853 | |
| 854 | bool isPartialSklAnimAttached(const LiveActor* actor, s32 index) { |
| 855 | return getSkl(actor)->isPartialAnimAttached(index); |
| 856 | } |
| 857 | |
| 858 | bool isPartialSklAnimPlaying(const LiveActor* actor, const char* partsName, s32 index) { |
| 859 | return isPartialSklAnimAttached(actor, index) && |
| 860 | isEqualString(str1: partsName, str2: getPlayingPartialSklAnimName(actor, index)); |
| 861 | } |
| 862 | |
| 863 | const char* getPlayingPartialSklAnimName(const LiveActor* actor, s32 index) { |
| 864 | return getSkl(actor)->getPlayingPartialSklAnimName(index); |
| 865 | } |
| 866 | |
| 867 | f32 getPartialSklAnimFrame(const LiveActor* actor, s32 index) { |
| 868 | return getSkl(actor)->getPartialAnimFrame(index); |
| 869 | } |
| 870 | |
| 871 | void setPartialSklAnimFrame(LiveActor* actor, s32 index, f32 frame) { |
| 872 | getSkl(actor)->setPartialAnimFrame(index, frame); |
| 873 | } |
| 874 | |
| 875 | f32 getPartialSklAnimFrameRate(const LiveActor* actor, s32 index) { |
| 876 | return getSkl(actor)->getPartialAnimFrameRate(index); |
| 877 | } |
| 878 | |
| 879 | void setPartialSklAnimFrameRate(LiveActor* actor, s32 index, f32 frameRate) { |
| 880 | getSkl(actor)->setPartialAnimFrameRate(index, frameRate); |
| 881 | } |
| 882 | |
| 883 | void setBaseMtxAndCalcAnim(LiveActor* actor, const sead::Matrix34f& matrix, |
| 884 | const sead::Vector3f& vector) { |
| 885 | return actor->getModelKeeper()->calc(matrix, vector); |
| 886 | } |
| 887 | } // namespace al |
| 888 | |