| 1 | #pragma once |
| 2 | |
| 3 | #include <math/seadMatrix.h> |
| 4 | #include <math/seadVector.h> |
| 5 | |
| 6 | #include "Library/Anim/AnimPlayerSkl.h" |
| 7 | #include "Library/Execute/ExecuteTableHolderUpdate.h" |
| 8 | #include "Library/LiveActor/LiveActor.h" |
| 9 | #include "Library/Model/ModelCtrl.h" |
| 10 | #include "Library/Model/ModelKeeper.h" |
| 11 | |
| 12 | namespace al { |
| 13 | class AnimPlayerMat; |
| 14 | class LiveActor; |
| 15 | struct SklAnimRetargettingInfo; |
| 16 | |
| 17 | // Inlined |
| 18 | |
| 19 | inline AnimPlayerSkl* getSkl(const LiveActor* actor) { |
| 20 | return actor->getModelKeeper()->getAnimSkl(); |
| 21 | } |
| 22 | |
| 23 | inline AnimPlayerMat* getMtp(const LiveActor* actor) { |
| 24 | return actor->getModelKeeper()->getAnimMtp(); |
| 25 | } |
| 26 | |
| 27 | inline AnimPlayerMat* getMcl(const LiveActor* actor) { |
| 28 | return actor->getModelKeeper()->getAnimMcl(); |
| 29 | } |
| 30 | |
| 31 | inline AnimPlayerMat* getMts(const LiveActor* actor) { |
| 32 | return actor->getModelKeeper()->getAnimMts(); |
| 33 | } |
| 34 | |
| 35 | inline AnimPlayerMat* getMat(const LiveActor* actor) { |
| 36 | return actor->getModelKeeper()->getAnimMat(); |
| 37 | } |
| 38 | |
| 39 | inline AnimPlayerVis* getVis(const LiveActor* actor) { |
| 40 | return actor->getModelKeeper()->getAnimVis(); |
| 41 | } |
| 42 | |
| 43 | inline AnimPlayerVis* getVisForAction(const LiveActor* actor) { |
| 44 | return actor->getModelKeeper()->getAnimVisForAction(); |
| 45 | } |
| 46 | |
| 47 | inline void updateModelDraw(const LiveActor* actor) { |
| 48 | actor->getModelKeeper()->getModelCtrl()->recreateDisplayList(); |
| 49 | } |
| 50 | |
| 51 | inline void updateActorSystem(LiveActor* actor) { |
| 52 | alActorSystemFunction::updateExecutorDraw(actor); |
| 53 | } |
| 54 | |
| 55 | inline void setSklBlendWeight(const LiveActor* actor, u32 index, f32 weight) { |
| 56 | getSkl(actor)->setSklAnimBlendWeight(index, weight); |
| 57 | } |
| 58 | |
| 59 | inline void createMat(const LiveActor* actor, s32 programType) { |
| 60 | actor->getModelKeeper()->createMatAnimForProgram(programType); |
| 61 | } |
| 62 | |
| 63 | // All |
| 64 | |
| 65 | void setAllAnimFrame(LiveActor*, f32); |
| 66 | void setAllAnimFrameRate(LiveActor* f32); |
| 67 | |
| 68 | // Skl |
| 69 | |
| 70 | bool tryStartSklAnimIfExist(LiveActor*, const char*); |
| 71 | bool tryStartSklAnimIfNotPlaying(LiveActor*, const char*); |
| 72 | |
| 73 | void startSklAnim(LiveActor*, const char*); |
| 74 | void startSklAnimInterpole(LiveActor*, const char*, const char*); |
| 75 | void startSklAnimBlend(LiveActor*, const char*, const char*, const char*, const char*, const char*, |
| 76 | const char*); |
| 77 | void startSklAnimBlendInterpole(LiveActor*, const char*, const char*, const char*, const char*, |
| 78 | const char*, const char*, const char*); |
| 79 | |
| 80 | void clearSklAnimInterpole(LiveActor*); |
| 81 | void validateSklAnimRetargetting(const LiveActor*); |
| 82 | void invalidateSklAnimRetargetting(const LiveActor*); |
| 83 | void copySklAnim(LiveActor*, const LiveActor*); |
| 84 | |
| 85 | void setSklAnimFrame(LiveActor*, f32, s32); |
| 86 | void setSklAnimFrameRate(LiveActor*, f32, s32); |
| 87 | void setSklAnimFrameAndStop(LiveActor*, f32, s32); |
| 88 | void setSklAnimBlendWeight(LiveActor*, f32, s32); |
| 89 | void setSklAnimBlendWeightDouble(LiveActor*, f32); |
| 90 | void setSklAnimBlendWeightDouble(LiveActor*, f32, f32); |
| 91 | void setSklAnimBlendWeightTriple(LiveActor*, f32, f32, f32); |
| 92 | void setSklAnimBlendWeightQuad(LiveActor*, f32, f32, f32, f32); |
| 93 | void setSklAnimBlendWeightFivefold(LiveActor*, f32, f32, f32, f32, f32); |
| 94 | void setSklAnimBlendWeightSixfold(LiveActor*, f32, f32, f32, f32, f32); |
| 95 | void setSklAnimBlendFrameAll(LiveActor*, f32, bool); |
| 96 | void setSklAnimBlendFrameRateAll(LiveActor*, f32, bool); |
| 97 | |
| 98 | const char* getPlayingSklAnimName(const LiveActor*, s32); |
| 99 | f32 getSklAnimFrame(const LiveActor*, s32); |
| 100 | f32 getSklAnimFrameRate(const LiveActor*, s32); |
| 101 | f32 getSklAnimFrameMax(const LiveActor*, s32); |
| 102 | f32 getSklAnimFrameMax(const LiveActor*, const char*); |
| 103 | s32 getSklAnimBlendNum(const LiveActor*); |
| 104 | f32 getSklAnimBlendWeight(const LiveActor*, s32); |
| 105 | |
| 106 | bool isSklAnimExist(const LiveActor*, const char*); |
| 107 | bool isSklAnimPlaying(const LiveActor*, const char*, s32); |
| 108 | bool isExistSklAnimRetargetting(const LiveActor*); |
| 109 | bool isSklAnimRetargettingValid(const LiveActor*); |
| 110 | bool isSklAnimExist(const LiveActor*); |
| 111 | bool isSklAnimEnd(const LiveActor*, s32); |
| 112 | bool isSklAnimOneTime(const LiveActor*, const char*); |
| 113 | bool isSklAnimOneTime(const LiveActor*, s32); |
| 114 | bool isSklAnimPlaying(const LiveActor*, s32); |
| 115 | |
| 116 | // Mtp |
| 117 | |
| 118 | bool tryStartMtpAnimIfExist(LiveActor*, const char*); |
| 119 | bool tryStartMtpAnimIfNotPlaying(LiveActor*, const char*); |
| 120 | |
| 121 | void startMtpAnim(LiveActor*, const char*); |
| 122 | void startMtpAnimAndSetFrameAndStop(LiveActor*, const char*, f32); |
| 123 | |
| 124 | void clearMtpAnim(LiveActor*); |
| 125 | |
| 126 | void setMtpAnimFrame(LiveActor*, f32); |
| 127 | void setMtpAnimFrameRate(LiveActor*, f32); |
| 128 | void setMtpAnimFrameAndStop(LiveActor*, f32); |
| 129 | void setMtpAnimFrameAndStopEnd(LiveActor*); |
| 130 | |
| 131 | const char* getPlayingMtpAnimName(const LiveActor*); |
| 132 | f32 getMtpAnimFrame(const LiveActor*); |
| 133 | f32 getMtpAnimFrameRate(const LiveActor*); |
| 134 | f32 getMtpAnimFrameMax(const LiveActor*); |
| 135 | f32 getMtpAnimFrameMax(const LiveActor*, const char*); |
| 136 | |
| 137 | bool isMtpAnimExist(const LiveActor*, const char*); |
| 138 | bool isMtpAnimPlaying(const LiveActor*, const char*); |
| 139 | bool isMtpAnimExist(const LiveActor*); |
| 140 | bool isMtpAnimEnd(const LiveActor*); |
| 141 | bool isMtpAnimOneTime(const LiveActor*, const char*); |
| 142 | bool isMtpAnimOneTime(const LiveActor*); |
| 143 | bool isMtpAnimPlaying(const LiveActor*); |
| 144 | |
| 145 | // Mcl |
| 146 | |
| 147 | bool tryStartMclAnimIfExist(LiveActor*, const char*); |
| 148 | bool tryStartMclAnimIfNotPlaying(LiveActor*, const char*); |
| 149 | |
| 150 | void startMclAnim(LiveActor*, const char*); |
| 151 | void startMclAnimAndSetFrameAndStop(LiveActor*, const char*, f32); |
| 152 | |
| 153 | void clearMclAnim(LiveActor*); |
| 154 | |
| 155 | void setMclAnimFrame(LiveActor*, f32); |
| 156 | void setMclAnimFrameRate(LiveActor*, f32); |
| 157 | void setMclAnimFrameAndStop(LiveActor*, f32); |
| 158 | void setMclAnimNormalFrameAndStop(LiveActor*, f32); |
| 159 | void setMclAnimFrameAndStopEnd(LiveActor*); |
| 160 | |
| 161 | const char* getPlayingMclAnimName(const LiveActor*); |
| 162 | f32 getMclAnimFrame(const LiveActor*); |
| 163 | f32 getMclAnimFrameRate(const LiveActor*); |
| 164 | f32 getMclAnimFrameMax(const LiveActor*); |
| 165 | f32 getMclAnimFrameMax(const LiveActor*, const char*); |
| 166 | |
| 167 | bool isMclAnimExist(const LiveActor*, const char*); |
| 168 | bool isMclAnimPlaying(const LiveActor*, const char*); |
| 169 | bool isMclAnimExist(const LiveActor*); |
| 170 | bool isMclAnimEnd(const LiveActor*); |
| 171 | bool isMclAnimOneTime(const LiveActor*, const char*); |
| 172 | bool isMclAnimOneTime(const LiveActor*); |
| 173 | bool isMclAnimPlaying(const LiveActor*); |
| 174 | |
| 175 | // Mts |
| 176 | |
| 177 | bool tryStartMtsAnimIfExist(LiveActor*, const char*); |
| 178 | bool tryStartMtsAnimIfNotPlaying(LiveActor*, const char*); |
| 179 | |
| 180 | void startMtsAnim(LiveActor*, const char*); |
| 181 | void startMtsAnimAndSetFrameAndStop(LiveActor*, const char*, f32); |
| 182 | |
| 183 | void clearMtsAnim(LiveActor*); |
| 184 | |
| 185 | void setMtsAnimFrame(LiveActor*, f32); |
| 186 | void setMtsAnimFrameRate(LiveActor*, f32); |
| 187 | void setMtsAnimFrameAndStop(LiveActor*, f32); |
| 188 | void setMtsAnimFrameAndStopEnd(LiveActor*); |
| 189 | |
| 190 | const char* getPlayingMtsAnimName(const LiveActor*); |
| 191 | f32 getMtsAnimFrame(const LiveActor*); |
| 192 | f32 getMtsAnimFrameRate(const LiveActor*); |
| 193 | f32 getMtsAnimFrameMax(const LiveActor*); |
| 194 | f32 getMtsAnimFrameMax(const LiveActor*, const char*); |
| 195 | |
| 196 | bool isMtsAnimExist(const LiveActor*, const char*); |
| 197 | bool isMtsAnimPlaying(const LiveActor*, const char*); |
| 198 | bool isMtsAnimExist(const LiveActor*); |
| 199 | bool isMtsAnimEnd(const LiveActor*); |
| 200 | bool isMtsAnimOneTime(const LiveActor*, const char*); |
| 201 | bool isMtsAnimOneTime(const LiveActor*); |
| 202 | bool isMtsAnimPlaying(const LiveActor*); |
| 203 | |
| 204 | // Mat |
| 205 | |
| 206 | bool tryStartMatAnimIfExist(LiveActor*, const char*); |
| 207 | bool tryStartMatAnimIfNotPlaying(LiveActor*, const char*); |
| 208 | |
| 209 | void createMatAnimSlotForMcl(LiveActor*); |
| 210 | void createMatAnimSlotForMtp(LiveActor*); |
| 211 | void createMatAnimSlotForMts(LiveActor*); |
| 212 | |
| 213 | void startMatAnim(LiveActor, const char*); |
| 214 | void startMatAnimAndSetFrameAndStop(LiveActor, const char*, f32); |
| 215 | void clearMatAnim(LiveActor*); |
| 216 | |
| 217 | void setMatAnimFrame(LiveActor*, f32); |
| 218 | void setMatAnimFrameRate(LiveActor*, f32); |
| 219 | void setMatAnimFrameAndStop(LiveActor*, f32); |
| 220 | void setMatAnimFrameAndStopEnd(LiveActor*); |
| 221 | |
| 222 | const char* getPlayingMatAnimName(const LiveActor*); |
| 223 | f32 getMatAnimFrame(const LiveActor*); |
| 224 | f32 getMatAnimFrameRate(const LiveActor*); |
| 225 | f32 getMatAnimFrameMax(const LiveActor*); |
| 226 | f32 getMatAnimFrameMax(const LiveActor*, const char*); |
| 227 | |
| 228 | bool isMatAnimExist(const LiveActor*, const char*); |
| 229 | bool isMatAnimPlaying(const LiveActor*, const char*); |
| 230 | bool isMatAnimExist(const LiveActor*); |
| 231 | bool isMatAnimEnd(const LiveActor*); |
| 232 | bool isMatAnimOneTime(const LiveActor*, const char*); |
| 233 | bool isMatAnimOneTime(const LiveActor*); |
| 234 | bool isMatAnimPlaying(const LiveActor*); |
| 235 | |
| 236 | // Vis |
| 237 | |
| 238 | bool tryStartVisAnimIfExist(LiveActor*, const char*); |
| 239 | bool tryStartVisAnimIfNotPlaying(LiveActor*, const char*); |
| 240 | |
| 241 | void startVisAnim(LiveActor*, const char*); |
| 242 | void startVisAnimAndSetFrameAndStop(LiveActor*, const char*, f32); |
| 243 | |
| 244 | void clearVisAnim(LiveActor*); |
| 245 | |
| 246 | void setVisAnimFrame(LiveActor*, f32); |
| 247 | void setVisAnimFrameRate(LiveActor*, f32); |
| 248 | void setVisAnimFrameAndStop(LiveActor*, f32); |
| 249 | void setVisAnimFrameAndStopEnd(LiveActor*); |
| 250 | |
| 251 | const char* getPlayingVisAnimName(const LiveActor*); |
| 252 | f32 getVisAnimFrame(const LiveActor*); |
| 253 | f32 getVisAnimFrameRate(const LiveActor*); |
| 254 | f32 getVisAnimFrameMax(const LiveActor*); |
| 255 | f32 getVisAnimFrameMax(const LiveActor*, const char*); |
| 256 | |
| 257 | bool isVisAnimExist(const LiveActor*, const char*); |
| 258 | bool isVisAnimPlaying(const LiveActor*, const char*); |
| 259 | bool isVisAnimExist(const LiveActor*); |
| 260 | bool isVisAnimEnd(const LiveActor*); |
| 261 | bool isVisAnimOneTime(const LiveActor*, const char*); |
| 262 | bool isVisAnimOneTime(const LiveActor*); |
| 263 | bool isVisAnimPlaying(const LiveActor*); |
| 264 | |
| 265 | // Vis for Action |
| 266 | |
| 267 | bool tryStartVisAnimIfExistForAction(LiveActor*, const char*); |
| 268 | bool tryStartVisAnimIfNotPlayingForAction(LiveActor*, const char*); |
| 269 | |
| 270 | void startVisAnimForAction(LiveActor*, const char*); |
| 271 | void startVisAnimAndSetFrameAndStopForAction(LiveActor*, const char*, f32); |
| 272 | |
| 273 | void clearVisAnimForAction(LiveActor*); |
| 274 | |
| 275 | void setVisAnimFrameForAction(LiveActor*, f32); |
| 276 | void setVisAnimFrameRateForAction(LiveActor*, f32); |
| 277 | void setVisAnimFrameAndStopForAction(LiveActor*, f32); |
| 278 | void setVisAnimFrameAndStopEndForAction(LiveActor*); |
| 279 | |
| 280 | const char* getPlayingVisAnimNameForAction(const LiveActor*); |
| 281 | f32 getVisAnimFrameForAction(const LiveActor*); |
| 282 | f32 getVisAnimFrameRateForAction(const LiveActor*); |
| 283 | f32 getVisAnimFrameMaxForAction(const LiveActor*); |
| 284 | f32 getVisAnimFrameMaxForAction(const LiveActor*, const char*); |
| 285 | |
| 286 | bool isVisAnimExistForAction(const LiveActor*, const char*); |
| 287 | bool isVisAnimPlayingForAction(const LiveActor*, const char*); |
| 288 | bool isVisAnimExistForAction(const LiveActor*); |
| 289 | bool isVisAnimEndForAction(const LiveActor*); |
| 290 | bool isVisAnimOneTimeForAction(const LiveActor*, const char*); |
| 291 | bool isVisAnimOneTimeForAction(const LiveActor*); |
| 292 | bool isVisAnimPlayingForAction(const LiveActor*); |
| 293 | |
| 294 | // Skl Retargetting |
| 295 | |
| 296 | void initAndBindSklAnimRetargetting(LiveActor*, const char*, const sead::Vector3f&); |
| 297 | SklAnimRetargettingInfo* createSklAnimRetargetting(const LiveActor*, const char*, |
| 298 | const sead::Vector3f&); |
| 299 | void bindSklAnimRetargetting(const LiveActor*, const SklAnimRetargettingInfo*); |
| 300 | SklAnimRetargettingInfo* createSklAnimRetargetting(const LiveActor*, const LiveActor*, |
| 301 | const sead::Vector3f&); |
| 302 | void unbindSklAnimRetargetting(const LiveActor*); |
| 303 | |
| 304 | // Partial Skl |
| 305 | |
| 306 | void startPartialSklAnim(LiveActor*, const char*, s32, s32, const SklAnimRetargettingInfo*); |
| 307 | void startPartialSklAnimWithInterpolate(LiveActor*, const char*, s32, s32, s32, |
| 308 | const SklAnimRetargettingInfo*); |
| 309 | void initPartialSklAnim(LiveActor*, s32, s32, s32); |
| 310 | void clearPartialSklAnim(LiveActor*, s32); |
| 311 | void clearPartialSklAnimWithInterpolate(LiveActor*, s32, s32); |
| 312 | |
| 313 | void addPartialSklAnimPartsList(LiveActor*, const char*, const char*, s32); |
| 314 | void addPartialSklAnimPartsListRecursive(LiveActor*, const char*, s32); |
| 315 | void setPartialSklAnimFrame(LiveActor*, s32, f32); |
| 316 | void setPartialSklAnimFrameRate(LiveActor*, s32, f32); |
| 317 | void setBaseMtxAndCalcAnim(LiveActor*, const sead::Matrix34f&, const sead::Vector3f&); |
| 318 | |
| 319 | const char* getPlayingPartialSklAnimName(const LiveActor*, s32); |
| 320 | f32 getPartialSklAnimFrame(const LiveActor*, s32); |
| 321 | f32 getPartialSklAnimFrameRate(const LiveActor*, s32); |
| 322 | s32 getPartialSklAnimSlotNum(LiveActor*); |
| 323 | s32 calcJoitsAmountFromJoint(LiveActor*, const char*); |
| 324 | |
| 325 | bool isPartialSklAnimEnd(const LiveActor*, s32); |
| 326 | bool isPartialSklAnimOneTime(const LiveActor*, s32); |
| 327 | bool isPartialSklAnimAttached(const LiveActor*, s32); |
| 328 | bool isPartialAnimPlaying(const LiveActor*, s32); |
| 329 | |
| 330 | } // namespace al |
| 331 | |
| 332 | namespace alAnimFunction { |
| 333 | bool isAllAnimEnd(const al::LiveActor*, s32); |
| 334 | f32 getAllAnimFrame(const al::LiveActor*, s32); |
| 335 | f32 getAllAnimFrameMax(const al::LiveActor*, const char*, s32); |
| 336 | f32 getAllAnimFrameRate(const al::LiveActor*, s32); |
| 337 | const char* getAllAnimName(const al::LiveActor*); |
| 338 | } // namespace alAnimFunction |
| 339 | |