| 1 | #include "Library/Scene/SceneUtil.h" |
| 2 | |
| 3 | #include <common/aglRenderBuffer.h> |
| 4 | #include <math/seadVector.h> |
| 5 | |
| 6 | #include "Library/Area/AreaInitInfo.h" |
| 7 | #include "Library/Area/AreaObjDirector.h" |
| 8 | #include "Library/Area/SwitchAreaDirector.h" |
| 9 | #include "Library/Audio/AudioDirector.h" |
| 10 | #include "Library/Audio/AudioDirectorInitInfo.h" |
| 11 | #include "Library/Audio/System/AudioKeeper.h" |
| 12 | #include "Library/Audio/System/AudioKeeperFunction.h" |
| 13 | #include "Library/Base/StringUtil.h" |
| 14 | #include "Library/Camera/CameraDirector.h" |
| 15 | #include "Library/Camera/CameraFlagCtrl.h" |
| 16 | #include "Library/Camera/CameraPoseUpdater.h" |
| 17 | #include "Library/Camera/CameraPoserSceneInfo.h" |
| 18 | #include "Library/Camera/CameraRequestParamHolder.h" |
| 19 | #include "Library/Camera/CameraResourceHolder.h" |
| 20 | #include "Library/Camera/CameraUtil.h" |
| 21 | #include "Library/Camera/CameraViewCtrlPause.h" |
| 22 | #include "Library/Camera/CameraViewCtrlScene.h" |
| 23 | #include "Library/Camera/SceneCameraInfo.h" |
| 24 | #include "Library/Controller/PadRumbleDirector.h" |
| 25 | #include "Library/Draw/GraphicsQualityController.h" |
| 26 | #include "Library/Draw/GraphicsSystemInfo.h" |
| 27 | #include "Library/Draw/ViewRenderer.h" |
| 28 | #include "Library/Effect/EffectKeeper.h" |
| 29 | #include "Library/Effect/EffectSystem.h" |
| 30 | #include "Library/Execute/ExecuteUtil.h" |
| 31 | #include "Library/File/FileUtil.h" |
| 32 | #include "Library/Layout/LayoutInitInfo.h" |
| 33 | #include "Library/Layout/LayoutSystem.h" |
| 34 | #include "Library/Layout/LayoutUtil.h" |
| 35 | #include "Library/LiveActor/ActorAreaFunction.h" |
| 36 | #include "Library/LiveActor/ActorInitUtil.h" |
| 37 | #include "Library/LiveActor/LiveActorGroup.h" |
| 38 | #include "Library/LiveActor/LiveActorKit.h" |
| 39 | #include "Library/Model/ModelDrawBufferUpdater.h" |
| 40 | #include "Library/Placement/PlacementFunction.h" |
| 41 | #include "Library/Placement/PlacementInfo.h" |
| 42 | #include "Library/Play/Camera/SimpleCameraPoserFactory.h" |
| 43 | #include "Library/PostProcessing/PostProcessingFilter.h" |
| 44 | #include "Library/Resource/ResourceHolder.h" |
| 45 | #include "Library/Scene/DemoDirector.h" |
| 46 | #include "Library/Scene/Scene.h" |
| 47 | #include "Library/Scene/SceneStopCtrl.h" |
| 48 | #include "Library/Screen/ScreenCoverCtrl.h" |
| 49 | #include "Library/Se/Function/SeDbFunction.h" |
| 50 | #include "Library/Se/SeFunction.h" |
| 51 | #include "Library/Stage/StageResourceKeeper.h" |
| 52 | #include "Library/Stage/StageResourceList.h" |
| 53 | #include "Library/System/GameSystemInfo.h" |
| 54 | #include "Library/Yaml/ByamlIter.h" |
| 55 | #include "Project/Clipping/ClippingDirector.h" |
| 56 | #include "Project/Gravity/GravityHolder.h" |
| 57 | #include "Project/LiveActor/ActorExecuteFunction.h" |
| 58 | |
| 59 | namespace al { |
| 60 | |
| 61 | s32 getStageInfoMapNum(const Scene* scene) { |
| 62 | if (!scene->getStageResourceKeeper()) |
| 63 | return 0; |
| 64 | |
| 65 | StageResourceList* resourceList = scene->getStageResourceKeeper()->getMapStageInfo(); |
| 66 | if (!resourceList) |
| 67 | return 0; |
| 68 | |
| 69 | return resourceList->getStageResourceNum(); |
| 70 | } |
| 71 | |
| 72 | s32 getStageInfoDesignNum(const Scene* scene) { |
| 73 | if (!scene->getStageResourceKeeper()) |
| 74 | return 0; |
| 75 | |
| 76 | StageResourceList* resourceList = scene->getStageResourceKeeper()->getDesignStageInfo(); |
| 77 | if (!resourceList) |
| 78 | return 0; |
| 79 | |
| 80 | return resourceList->getStageResourceNum(); |
| 81 | } |
| 82 | |
| 83 | s32 getStageInfoSoundNum(const Scene* scene) { |
| 84 | if (!scene->getStageResourceKeeper()) |
| 85 | return 0; |
| 86 | |
| 87 | StageResourceList* resourceList = scene->getStageResourceKeeper()->getSoundStageInfo(); |
| 88 | if (!resourceList) |
| 89 | return 0; |
| 90 | |
| 91 | return resourceList->getStageResourceNum(); |
| 92 | } |
| 93 | |
| 94 | StageInfo* getStageInfoMap(const Scene* scene, s32 index) { |
| 95 | return scene->getStageResourceKeeper()->getMapStageInfo()->getStageInfo(index); |
| 96 | } |
| 97 | |
| 98 | StageInfo* getStageInfoDesign(const Scene* scene, s32 index) { |
| 99 | return scene->getStageResourceKeeper()->getDesignStageInfo()->getStageInfo(index); |
| 100 | } |
| 101 | |
| 102 | StageInfo* getStageInfoSound(const Scene* scene, s32 index) { |
| 103 | return scene->getStageResourceKeeper()->getSoundStageInfo()->getStageInfo(index); |
| 104 | } |
| 105 | |
| 106 | Resource* getStageResourceMap(const Scene* scene, s32 index) { |
| 107 | return getStageInfoMap(scene, index)->getResource(); |
| 108 | } |
| 109 | |
| 110 | Resource* tryGetStageResourceDesign(const Scene* scene, s32 index) { |
| 111 | if (getStageInfoDesignNum(scene) == 0) |
| 112 | return nullptr; |
| 113 | return getStageInfoDesign(scene, index)->getResource(); |
| 114 | } |
| 115 | |
| 116 | Resource* tryGetStageResourceSound(const Scene* scene, s32 index) { |
| 117 | if (getStageInfoSoundNum(scene) == 0) |
| 118 | return nullptr; |
| 119 | return getStageInfoSound(scene, index)->getResource(); |
| 120 | } |
| 121 | |
| 122 | agl::RenderBuffer* getSceneFrameBufferMain(const Scene* scene) { |
| 123 | DrawSystemInfo* drawSystemInfo = scene->getDrawSystemInfo(); |
| 124 | return drawSystemInfo->isDocked ? drawSystemInfo->dockedRenderBuffer : |
| 125 | drawSystemInfo->handheldRenderBuffer; |
| 126 | } |
| 127 | |
| 128 | agl::DrawContext* getSceneDrawContext(const Scene* scene) { |
| 129 | return scene->getDrawSystemInfo()->drawContext; |
| 130 | } |
| 131 | |
| 132 | agl::RenderBuffer* getSceneFrameBufferConsole(const Scene* scene) { |
| 133 | return scene->getDrawSystemInfo()->dockedRenderBuffer; |
| 134 | } |
| 135 | |
| 136 | agl::RenderBuffer* getSceneFrameBufferHandheld(const Scene* scene) { |
| 137 | return scene->getDrawSystemInfo()->handheldRenderBuffer; |
| 138 | } |
| 139 | |
| 140 | f32 getSceneFrameBufferMainAspect(const Scene* scene) { |
| 141 | const sead::Vector2f& virtualSize = getSceneFrameBufferMain(scene)->getVirtualSize(); |
| 142 | |
| 143 | return virtualSize.x / virtualSize.y; |
| 144 | } |
| 145 | |
| 146 | bool isChangedGraphicsQualityMode(const Scene* scene) { |
| 147 | return scene->getLiveActorKit() |
| 148 | ->getGraphicsSystemInfo() |
| 149 | ->getGraphicsQualityController() |
| 150 | ->isChangedGraphicsQualityMode(); |
| 151 | } |
| 152 | |
| 153 | AreaObjDirector* getSceneAreaObjDirector(const Scene* scene) { |
| 154 | return scene->getLiveActorKit()->getAreaObjDirector(); |
| 155 | } |
| 156 | |
| 157 | ExecuteDirector* getSceneExecuteDirector(const Scene* scene) { |
| 158 | return scene->getLiveActorKit()->getExecuteDirector(); |
| 159 | } |
| 160 | |
| 161 | PlayerHolder* getScenePlayerHolder(const Scene* scene) { |
| 162 | return scene->getLiveActorKit()->getPlayerHolder(); |
| 163 | } |
| 164 | |
| 165 | ItemDirectorBase* getSceneItemDirector(const Scene* scene) { |
| 166 | return scene->getLiveActorKit()->getItemDirector(); |
| 167 | } |
| 168 | |
| 169 | void initActorInitInfo(ActorInitInfo* actorInitInfo, const Scene* scene, |
| 170 | const PlacementInfo* placementInfo, const LayoutInitInfo* layoutInfo, |
| 171 | const ActorFactory* actorFactory, SceneMsgCtrl* sceneMsgCtrl, |
| 172 | GameDataHolderBase* gameDataHolderBase) { |
| 173 | LiveActorKit* actorKit = scene->getLiveActorKit(); |
| 174 | |
| 175 | actorInitInfo->initNew( |
| 176 | placementInfo, layoutInfo, actorKit->getLiveActorGroupAllActors(), actorFactory, |
| 177 | actorKit->getActorResourceHolder(), actorKit->getAreaObjDirector(), |
| 178 | scene->getAudioDirector(), actorKit->getCameraDirector(), actorKit->getClippingDirector(), |
| 179 | actorKit->getCollisionDirector(), actorKit->getDemoDirector(), |
| 180 | actorKit->getEffectSystem() ? actorKit->getEffectSystem()->getEffectSystemInfo() : nullptr, |
| 181 | actorKit->getExecuteDirector(), gameDataHolderBase, actorKit->getGravityHolder(), |
| 182 | actorKit->getHitSensorDirector(), actorKit->getItemDirector(), |
| 183 | actorKit->getNatureDirector(), actorKit->getGamePadSystem(), |
| 184 | actorKit->getPadRumbleDirector(), actorKit->getPlayerHolder(), scene->getSceneObjHolder(), |
| 185 | sceneMsgCtrl, scene->getSceneStopCtrl(), scene->getScreenCoverCtrl(), |
| 186 | actorKit->getScreenPointDirector(), actorKit->getShadowDirector(), |
| 187 | actorKit->getStageSwitchDirector(), actorKit->getModelGroup(), |
| 188 | actorKit->getGraphicsSystemInfo(), actorKit->getModelDrawBufferCounter(), |
| 189 | actorKit->getDynamicDrawActorGroup()); |
| 190 | } |
| 191 | |
| 192 | void initLayoutInitInfo(LayoutInitInfo* layoutInfo, const Scene* scene, |
| 193 | const SceneInitInfo& sceneInfo) { |
| 194 | LiveActorKit* actorKit = scene->getLiveActorKit(); |
| 195 | LayoutKit* layoutKit = scene->getLayoutKit(); |
| 196 | |
| 197 | if (actorKit) { |
| 198 | layoutInfo->init( |
| 199 | actorKit->getExecuteDirector(), actorKit->getEffectSystem()->getEffectSystemInfo(), |
| 200 | scene->getSceneObjHolder(), scene->getAudioDirector(), actorKit->getCameraDirector(), |
| 201 | sceneInfo.gameSysInfo->layoutSystem, sceneInfo.gameSysInfo->messageSystem, |
| 202 | sceneInfo.gameSysInfo->gamePadSystem, actorKit->getPadRumbleDirector()); |
| 203 | } else { |
| 204 | layoutInfo->init(layoutKit->getExecuteDirector(), |
| 205 | layoutKit->getEffectSystem()->getEffectSystemInfo(), |
| 206 | scene->getSceneObjHolder(), scene->getAudioDirector(), nullptr, |
| 207 | sceneInfo.gameSysInfo->layoutSystem, sceneInfo.gameSysInfo->messageSystem, |
| 208 | sceneInfo.gameSysInfo->gamePadSystem, nullptr); |
| 209 | } |
| 210 | |
| 211 | layoutInfo->setDrawContext(scene->getDrawSystemInfo()->drawContext); |
| 212 | if (layoutKit) |
| 213 | layoutInfo->setDrawInfo(layoutKit->getDrawInfo()); |
| 214 | if (actorKit) { |
| 215 | layoutInfo->setOcclusionCullingJudge( |
| 216 | actorKit->getGraphicsSystemInfo()->getOcclusionCullingJudge()); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | // https://decomp.me/scratch/CBhyQ |
| 221 | // NON_MATCHING: Bad order of operations |
| 222 | void initPlacementAreaObj(Scene* scene, const ActorInitInfo& actorInfo) { |
| 223 | AreaInitInfo areaInitInfo[256]; |
| 224 | s32 entries = 0; |
| 225 | |
| 226 | for (s32 i = 0; i < getStageInfoMapNum(scene); i++) { |
| 227 | StageInfo* stageInfo = getStageInfoMap(scene, index: i); |
| 228 | PlacementInfo placementInfo; |
| 229 | if (tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key: "AreaList" )) { |
| 230 | initAreaInitInfo(areaInfo: &areaInitInfo[entries], placementInfo, actorInfo); |
| 231 | entries++; |
| 232 | } |
| 233 | } |
| 234 | for (s32 i = 0; i < getStageInfoDesignNum(scene); i++) { |
| 235 | StageInfo* stageInfo = getStageInfoDesign(scene, index: i); |
| 236 | PlacementInfo placementInfo; |
| 237 | if (tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key: "AreaList" )) { |
| 238 | initAreaInitInfo(areaInfo: &areaInitInfo[entries], placementInfo, actorInfo); |
| 239 | entries++; |
| 240 | } |
| 241 | } |
| 242 | for (s32 i = 0; i < getStageInfoSoundNum(scene); i++) { |
| 243 | StageInfo* stageInfo = getStageInfoSound(scene, index: i); |
| 244 | PlacementInfo placementInfo; |
| 245 | if (tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key: "AreaList" )) { |
| 246 | initAreaInitInfo(areaInfo: &areaInitInfo[entries], placementInfo, actorInfo); |
| 247 | entries++; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | actorInfo.actorSceneInfo.areaObjDirector->placement(initInfo: areaInitInfo, initInfoCount: entries); |
| 252 | } |
| 253 | |
| 254 | void initPlacementGravityObj(Scene* scene) { |
| 255 | PlacementInfo gravityList; |
| 256 | for (s32 i = 0; i < getStageInfoMapNum(scene); i++) { |
| 257 | StageInfo* stageInfo = getStageInfoMap(scene, index: i); |
| 258 | |
| 259 | s32 count; |
| 260 | if (tryGetPlacementInfoAndCount(outPlacementInfo: &gravityList, outCount: &count, stageInfo, key: "GravityList" )) { |
| 261 | for (s32 j = 0; j < count; j++) { |
| 262 | PlacementInfo gravityListEntry; |
| 263 | getPlacementInfoByIndex(outPlacementInfo: &gravityListEntry, placementInfo: gravityList, index: j); |
| 264 | if (isClassName(placementInfo: gravityListEntry, name: "GravityPoint" )) |
| 265 | scene->getLiveActorKit()->getGravityHolder()->createGravity(gravityListEntry); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | bool tryGetPlacementInfoAndCount(PlacementInfo* outPlacementInfo, s32* outCount, |
| 272 | const StageInfo* stageInfo, const char* key) { |
| 273 | if (!tryGetPlacementInfo(outPlacementInfo, stageInfo, key)) { |
| 274 | *outCount = 0; |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | *outCount = getCountPlacementInfo(placementInfo: *outPlacementInfo); |
| 279 | return true; |
| 280 | } |
| 281 | |
| 282 | void initPlacementObjectMap(Scene* scene, const ActorInitInfo& actorInfo, const char* name) { |
| 283 | s32 resourceNum = getStageInfoMapNum(scene); |
| 284 | for (s32 i = 0; i < resourceNum; i++) |
| 285 | initPlacementByStageInfo(stageInfo: getStageInfoMap(scene, index: i), key: name, actorInfo); |
| 286 | } |
| 287 | |
| 288 | void initPlacementByStageInfo(const StageInfo* stageInfo, const char* key, |
| 289 | const ActorInitInfo& actorInfo) { |
| 290 | PlacementInfo placementInfo; |
| 291 | s32 count; |
| 292 | if (!tryGetPlacementInfoAndCount(outPlacementInfo: &placementInfo, outCount: &count, stageInfo, key)) |
| 293 | return; |
| 294 | |
| 295 | for (s32 i = 0; i < count; i++) { |
| 296 | PlacementInfo placementInfo2; |
| 297 | getPlacementInfoByIndex(outPlacementInfo: &placementInfo2, placementInfo, index: i); |
| 298 | createPlacementActorFromFactory(initInfo: actorInfo, placementInfo: &placementInfo2); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | void initPlacementObjectDesign(Scene* scene, const ActorInitInfo& actorInfo, const char* name) { |
| 303 | s32 resourceNum = getStageInfoDesignNum(scene); |
| 304 | for (s32 i = 0; i < resourceNum; i++) |
| 305 | initPlacementByStageInfo(stageInfo: getStageInfoDesign(scene, index: i), key: name, actorInfo); |
| 306 | } |
| 307 | |
| 308 | void initPlacementObjectSound(Scene* scene, const ActorInitInfo& actorInfo, const char* name) { |
| 309 | s32 resourceNum = getStageInfoSoundNum(scene); |
| 310 | for (s32 i = 0; i < resourceNum; i++) |
| 311 | initPlacementByStageInfo(stageInfo: getStageInfoSound(scene, index: i), key: name, actorInfo); |
| 312 | } |
| 313 | |
| 314 | LiveActor* tryInitPlacementSingleObject(Scene* scene, const ActorInitInfo& actorInfo, |
| 315 | s32 resourceType, const char* key) { |
| 316 | if (!scene->getStageResourceKeeper()) |
| 317 | return nullptr; |
| 318 | |
| 319 | StageResourceList* resourceList = |
| 320 | scene->getStageResourceKeeper()->getStageResourceList(resourceType); |
| 321 | if (!resourceList) |
| 322 | return nullptr; |
| 323 | |
| 324 | s32 resourceNum = resourceList->getStageResourceNum(); |
| 325 | |
| 326 | LiveActor* actor = nullptr; |
| 327 | for (s32 i = 0; i < resourceNum; i++) { |
| 328 | PlacementInfo placementInfo; |
| 329 | StageInfo* stageInfo = |
| 330 | scene->getStageResourceKeeper()->getStageResourceList(resourceType)->getStageInfo(index: i); |
| 331 | |
| 332 | if (!tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key)) |
| 333 | continue; |
| 334 | |
| 335 | s32 count = getCountPlacementInfo(placementInfo); |
| 336 | for (s32 j = 0; j < count; j++) { |
| 337 | PlacementInfo newPlacementInfo; |
| 338 | getPlacementInfoByIndex(outPlacementInfo: &newPlacementInfo, placementInfo, index: j); |
| 339 | LiveActor* newActor = createPlacementActorFromFactory(initInfo: actorInfo, placementInfo: &newPlacementInfo); |
| 340 | if (newActor) |
| 341 | actor = newActor; |
| 342 | } |
| 343 | } |
| 344 | return actor; |
| 345 | } |
| 346 | |
| 347 | LiveActor* tryInitPlacementSingleObject(Scene* scene, const ActorInitInfo& actorInfo, |
| 348 | s32 resourceType, const char* key, const char* name) { |
| 349 | if (!scene->getStageResourceKeeper()) |
| 350 | return nullptr; |
| 351 | |
| 352 | StageResourceList* resourceList = |
| 353 | scene->getStageResourceKeeper()->getStageResourceList(resourceType); |
| 354 | if (!resourceList) |
| 355 | return nullptr; |
| 356 | |
| 357 | s32 resourceNum = resourceList->getStageResourceNum(); |
| 358 | |
| 359 | LiveActor* actor = nullptr; |
| 360 | for (s32 i = 0; i < resourceNum; i++) { |
| 361 | PlacementInfo placementInfo; |
| 362 | StageInfo* stageInfo = |
| 363 | scene->getStageResourceKeeper()->getStageResourceList(resourceType)->getStageInfo(index: i); |
| 364 | |
| 365 | if (!tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key)) |
| 366 | continue; |
| 367 | |
| 368 | s32 count = getCountPlacementInfo(placementInfo); |
| 369 | for (s32 j = 0; j < count; j++) { |
| 370 | PlacementInfo newPlacementInfo; |
| 371 | getPlacementInfoByIndex(outPlacementInfo: &newPlacementInfo, placementInfo, index: j); |
| 372 | const char* objName = nullptr; |
| 373 | getObjectName(name: &objName, placementInfo: newPlacementInfo); |
| 374 | |
| 375 | if (!isEqualString(str1: objName, str2: name)) |
| 376 | continue; |
| 377 | |
| 378 | LiveActor* newActor = createPlacementActorFromFactory(initInfo: actorInfo, placementInfo: &newPlacementInfo); |
| 379 | if (newActor) |
| 380 | actor = newActor; |
| 381 | } |
| 382 | } |
| 383 | return actor; |
| 384 | } |
| 385 | |
| 386 | bool tryInitPlacementActorGroup(LiveActorGroup* liveActorGroup, Scene* scene, |
| 387 | const ActorInitInfo& actorInfo, s32 resourceType, const char* key, |
| 388 | const char* name) { |
| 389 | if (!scene->getStageResourceKeeper()) |
| 390 | return false; |
| 391 | |
| 392 | StageResourceList* resourceList = |
| 393 | scene->getStageResourceKeeper()->getStageResourceList(resourceType); |
| 394 | if (!resourceList) |
| 395 | return false; |
| 396 | |
| 397 | s32 resourceNum = resourceList->getStageResourceNum(); |
| 398 | bool isRegistered = false; |
| 399 | for (s32 i = 0; i < resourceNum; i++) { |
| 400 | PlacementInfo placementInfo; |
| 401 | StageInfo* stageInfo = |
| 402 | scene->getStageResourceKeeper()->getStageResourceList(resourceType)->getStageInfo(index: i); |
| 403 | |
| 404 | if (!tryGetPlacementInfo(outPlacementInfo: &placementInfo, stageInfo, key)) |
| 405 | continue; |
| 406 | |
| 407 | s32 count = getCountPlacementInfo(placementInfo); |
| 408 | for (s32 j = 0; j < count; j++) { |
| 409 | PlacementInfo newPlacementInfo; |
| 410 | getPlacementInfoByIndex(outPlacementInfo: &newPlacementInfo, placementInfo, index: j); |
| 411 | const char* objName = nullptr; |
| 412 | getObjectName(name: &objName, placementInfo: newPlacementInfo); |
| 413 | |
| 414 | if (!isEqualString(str1: objName, str2: name)) |
| 415 | continue; |
| 416 | |
| 417 | LiveActor* actor = createPlacementActorFromFactory(initInfo: actorInfo, placementInfo: &newPlacementInfo); |
| 418 | if (actor) { |
| 419 | liveActorGroup->registerActor(actor); |
| 420 | isRegistered = true; |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | return isRegistered; |
| 425 | } |
| 426 | |
| 427 | void initPlacementByStageInfoSingle(const StageInfo* stageInfo, const char* key, |
| 428 | const ActorInitInfo& actorInfo) { |
| 429 | initPlacementByStageInfo(stageInfo, key, actorInfo); |
| 430 | } |
| 431 | |
| 432 | bool tryGetPlacementInfo(PlacementInfo* outPlacementInfo, const StageInfo* stageInfo, |
| 433 | const char* key) { |
| 434 | ByamlIter iter; |
| 435 | if (!stageInfo->getPlacementIter().tryGetIterByKey(iter: &iter, key)) |
| 436 | return false; |
| 437 | |
| 438 | outPlacementInfo->set(placement_iter: iter, zone_iter: stageInfo->getZoneIter()); |
| 439 | return true; |
| 440 | } |
| 441 | |
| 442 | void getPlacementInfo(PlacementInfo* outPlacementInfo, const StageInfo* stageInfo, |
| 443 | const char* key) { |
| 444 | ByamlIter iter; |
| 445 | stageInfo->getPlacementIter().tryGetIterByKey(iter: &iter, key); |
| 446 | |
| 447 | outPlacementInfo->set(placement_iter: iter, zone_iter: stageInfo->getZoneIter()); |
| 448 | } |
| 449 | |
| 450 | void getPlacementInfoAndCount(PlacementInfo* outPlacementInfo, s32* outCount, |
| 451 | const StageInfo* stageInfo, const char* key) { |
| 452 | getPlacementInfo(outPlacementInfo, stageInfo, key); |
| 453 | *outCount = getCountPlacementInfo(placementInfo: *outPlacementInfo); |
| 454 | } |
| 455 | |
| 456 | void initAreaObjDirector(Scene* scene, const AreaObjFactory* factory) { |
| 457 | scene->getLiveActorKit()->getAreaObjDirector()->init(factory); |
| 458 | } |
| 459 | |
| 460 | void initDemoDirector(Scene* scene, DemoDirector* demoDirector) { |
| 461 | scene->getLiveActorKit()->setDemoDirector(demoDirector); |
| 462 | } |
| 463 | |
| 464 | void initHitSensorDirector(Scene* scene) { |
| 465 | scene->getLiveActorKit()->initHitSensorDirector(); |
| 466 | } |
| 467 | |
| 468 | void initGravityHolder(Scene* scene) { |
| 469 | scene->getLiveActorKit()->initGravityHolder(); |
| 470 | } |
| 471 | |
| 472 | void initItemDirector(Scene* scene, ItemDirectorBase* itemDirector) { |
| 473 | scene->getLiveActorKit()->setItemDirector(itemDirector); |
| 474 | } |
| 475 | |
| 476 | void initNatureDirector(Scene* scene) { |
| 477 | scene->getLiveActorKit()->initNatureDirector(); |
| 478 | } |
| 479 | |
| 480 | void initSwitchAreaDirector(Scene* scene, s32 maxSwitchOnArea, s32 maxSwitchKeepOnArea) { |
| 481 | scene->getLiveActorKit()->initSwitchAreaDirector(maxSwitchOnArea, maxSwitchKeepOnArea); |
| 482 | } |
| 483 | |
| 484 | void registerSwitchOnAreaGroup(Scene* scene, SwitchOnAreaGroup* switchOnAreaGroup) { |
| 485 | scene->getLiveActorKit()->getSwitchAreaDirector()->registerSwitchOnAreaGroup(switchOnAreaGroup); |
| 486 | } |
| 487 | |
| 488 | void registerSwitchKeepOnAreaGroup(Scene* scene, SwitchKeepOnAreaGroup* switchKeepOnAreaGroup) { |
| 489 | scene->getLiveActorKit()->getSwitchAreaDirector()->registerSwitchKeepOnAreaGroup( |
| 490 | switchKeepOnAreaGroup); |
| 491 | } |
| 492 | |
| 493 | void initGraphicsSystemInfo(Scene* scene, const char* name, s32 index) { |
| 494 | if (index > 1) { |
| 495 | StringTmp<32> scenario{"Scenario%d" }; |
| 496 | GraphicsSystemInfo* systemInfo = scene->getLiveActorKit()->getGraphicsSystemInfo(); |
| 497 | |
| 498 | Resource* resource = nullptr; |
| 499 | if (getStageInfoDesignNum(scene) != 0) |
| 500 | resource = getStageInfoDesign(scene, index: 0)->getResource(); |
| 501 | systemInfo->initStageResource(resource, name, scenario.cstr()); |
| 502 | } else { |
| 503 | GraphicsSystemInfo* systemInfo = scene->getLiveActorKit()->getGraphicsSystemInfo(); |
| 504 | |
| 505 | Resource* resource = nullptr; |
| 506 | if (getStageInfoDesignNum(scene) != 0) |
| 507 | resource = getStageInfoDesign(scene, index: 0)->getResource(); |
| 508 | |
| 509 | systemInfo->initStageResource(resource, name, nullptr); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | void initCameraDirectorImpl(Scene* scene, const CameraPoserFactory* cameraPoserFactory) { |
| 514 | LiveActorKit* actorKit = scene->getLiveActorKit(); |
| 515 | |
| 516 | CameraPoserSceneInfo* sceneInfo = new CameraPoserSceneInfo(); |
| 517 | sceneInfo->init(areaObj: actorKit->getAreaObjDirector(), collision: actorKit->getCollisionDirector(), |
| 518 | audio: scene->getAudioDirector()); |
| 519 | |
| 520 | if (!cameraPoserFactory) |
| 521 | cameraPoserFactory = new SimpleCameraPoserFactory("カメラファクトリー" ); |
| 522 | |
| 523 | scene->getLiveActorKit()->getCameraDirector()->init(sceneInfo, cameraPoserFactory); |
| 524 | registerExecutorUser(user: scene->getLiveActorKit()->getCameraDirector(), |
| 525 | director: actorKit->getExecuteDirector(), listName: "カメラ" ); |
| 526 | } |
| 527 | |
| 528 | void initCameraDirector(Scene* scene, const char* name, s32 index, |
| 529 | const CameraPoserFactory* cameraPoserFactory) { |
| 530 | initCameraDirectorImpl(scene, cameraPoserFactory); |
| 531 | CameraDirector* cameraDirector = scene->getLiveActorKit()->getCameraDirector(); |
| 532 | |
| 533 | CameraResourceHolder* cameraResourceHolder = |
| 534 | new CameraResourceHolder(name, getStageInfoMapNum(scene)); |
| 535 | |
| 536 | for (s32 i = 0; i < getStageInfoMapNum(scene); i++) { |
| 537 | cameraResourceHolder->tryInitCameraResource(resource: getStageInfoMap(scene, index: i)->getResource(), |
| 538 | unused: i > 0 ? 1 : index); |
| 539 | } |
| 540 | |
| 541 | cameraDirector->initResourceHolder(resourceHolder: cameraResourceHolder); |
| 542 | cameraDirector->initAreaCameraSwitcherSingle(); |
| 543 | } |
| 544 | |
| 545 | void initCameraDirectorWithoutStageResource(Scene* scene, |
| 546 | const CameraPoserFactory* cameraPoserFactory) { |
| 547 | initCameraDirectorImpl(scene, cameraPoserFactory); |
| 548 | } |
| 549 | |
| 550 | void initCameraDirectorFix(Scene* scene, const sead::Vector3f& pos, const sead::Vector3f& lookAtPos, |
| 551 | const CameraPoserFactory* cameraPoserFactory) { |
| 552 | initCameraDirectorImpl(scene, cameraPoserFactory); |
| 553 | startCamera(user: scene, ticket: initFixCamera(user: scene, "Scene" , pos, lookAtPos)); |
| 554 | } |
| 555 | |
| 556 | void initSceneCameraFovyDegree(Scene* scene, f32 fovy) { |
| 557 | scene->getLiveActorKit()->getCameraDirector()->initSceneFovyDegree(fov: fovy); |
| 558 | } |
| 559 | |
| 560 | void initSnapShotCameraAudioKeeper(Scene* scene, IUseAudioKeeper* audioKeeper) { |
| 561 | scene->getLiveActorKit()->getCameraDirector()->initSnapShotCameraAudioKeeper(audioKeeper); |
| 562 | } |
| 563 | |
| 564 | void setCameraAspect(Scene* scene, f32 aspectA, f32 aspectB) { |
| 565 | scene->getLiveActorKit()->getCameraDirector()->getPoseUpdater(index: 0)->setAspect(aspectA); |
| 566 | if (aspectB != -1.0f) |
| 567 | scene->getLiveActorKit()->getCameraDirector()->getPoseUpdater(index: 1)->setAspect(aspectB); |
| 568 | } |
| 569 | |
| 570 | void resetSceneInitEntranceCamera(Scene* scene) { |
| 571 | scene->getLiveActorKit() |
| 572 | ->getCameraDirector() |
| 573 | ->getSceneCameraCtrl() |
| 574 | ->getSceneViewAt(idx: 0) |
| 575 | ->resetViewName(); |
| 576 | } |
| 577 | |
| 578 | void stopCameraByDeathPlayer(Scene* scene) { |
| 579 | scene->getLiveActorKit()->getCameraDirector()->stopByDeathPlayer(); |
| 580 | } |
| 581 | |
| 582 | void restartCameraByDeathPlayer(Scene* scene) { |
| 583 | scene->getLiveActorKit()->getCameraDirector()->restartByDeathPlayer(); |
| 584 | } |
| 585 | |
| 586 | void startInvalidCameraStopJudgeByDemo(Scene* scene) { |
| 587 | scene->getLiveActorKit()->getCameraDirector()->startInvalidStopJudgeByDemo(); |
| 588 | } |
| 589 | |
| 590 | void endInvalidCameraStopJudgeByDemo(Scene* scene) { |
| 591 | scene->getLiveActorKit()->getCameraDirector()->endInvalidStopJudgeByDemo(); |
| 592 | } |
| 593 | |
| 594 | void startCameraSnapShotMode(Scene* scene, bool useInterpole) { |
| 595 | scene->getLiveActorKit()->getCameraDirector()->startSnapShotMode(useInterpole); |
| 596 | } |
| 597 | |
| 598 | void endCameraSnapShotMode(Scene* scene) { |
| 599 | scene->getLiveActorKit()->getCameraDirector()->endSnapShotMode(); |
| 600 | } |
| 601 | |
| 602 | bool isCameraReverseInputH(const Scene* scene) { |
| 603 | return scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputH; |
| 604 | } |
| 605 | |
| 606 | void onCameraReverseInputH(Scene* scene) { |
| 607 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputH = true; |
| 608 | } |
| 609 | |
| 610 | void offCameraReverseInputH(Scene* scene) { |
| 611 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputH = false; |
| 612 | } |
| 613 | |
| 614 | bool isCameraReverseInputV(const Scene* scene) { |
| 615 | return scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputV; |
| 616 | } |
| 617 | |
| 618 | void onCameraReverseInputV(Scene* scene) { |
| 619 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputV = true; |
| 620 | } |
| 621 | |
| 622 | void offCameraReverseInputV(Scene* scene) { |
| 623 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isCameraReverseInputV = false; |
| 624 | } |
| 625 | |
| 626 | s32 getCameraStickSensitivityLevel(const Scene* scene) { |
| 627 | return scene->getLiveActorKit() |
| 628 | ->getCameraDirector() |
| 629 | ->getSceneCameraCtrl() |
| 630 | ->getRequestParamHolder() |
| 631 | ->getStickSensitivityLevel(); |
| 632 | } |
| 633 | |
| 634 | void setCameraStickSensitivityLevel(Scene* scene, s32 sensitivityLevel) { |
| 635 | scene->getLiveActorKit() |
| 636 | ->getCameraDirector() |
| 637 | ->getSceneCameraCtrl() |
| 638 | ->getRequestParamHolder() |
| 639 | ->setStickSensitivityLevel(sensitivityLevel); |
| 640 | } |
| 641 | |
| 642 | bool isValidCameraGyro(const Scene* scene) { |
| 643 | return !scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isInvalidCameraGyro; |
| 644 | } |
| 645 | |
| 646 | void validateCameraGyro(Scene* scene) { |
| 647 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isInvalidCameraGyro = false; |
| 648 | } |
| 649 | |
| 650 | void invalidateCameraGyro(Scene* scene) { |
| 651 | scene->getLiveActorKit()->getCameraDirector()->getFlagCtrl()->isInvalidCameraGyro = true; |
| 652 | } |
| 653 | |
| 654 | s32 getCameraGyroSensitivityLevel(const Scene* scene) { |
| 655 | return scene->getLiveActorKit() |
| 656 | ->getCameraDirector() |
| 657 | ->getSceneCameraCtrl() |
| 658 | ->getRequestParamHolder() |
| 659 | ->getGyroSensitivityLevel(); |
| 660 | } |
| 661 | |
| 662 | void setCameraGyroSensitivityLevel(Scene* scene, s32 sensitivityLevel) { |
| 663 | scene->getLiveActorKit() |
| 664 | ->getCameraDirector() |
| 665 | ->getSceneCameraCtrl() |
| 666 | ->getRequestParamHolder() |
| 667 | ->setGyroSensitivityLevel(sensitivityLevel); |
| 668 | } |
| 669 | |
| 670 | PauseCameraCtrl* initAndCreatePauseCameraCtrl(Scene* scene, f32 value) { |
| 671 | return scene->getLiveActorKit()->getCameraDirector()->initAndCreatePauseCameraCtrl(value); |
| 672 | } |
| 673 | |
| 674 | void startCameraPause(PauseCameraCtrl* pauseCameraCtrl) { |
| 675 | pauseCameraCtrl->startCameraPause(); |
| 676 | } |
| 677 | |
| 678 | void endCameraPause(PauseCameraCtrl* pauseCameraCtrl) { |
| 679 | pauseCameraCtrl->endCameraPause(); |
| 680 | } |
| 681 | |
| 682 | AudioDirector* initAudioDirectorImpl(Scene* scene, const SceneInitInfo& sceneInfo, |
| 683 | AudioDirectorInitInfo& audioDirectorInfo) { |
| 684 | audioDirectorInfo.audioSystemInfo = |
| 685 | sceneInfo.gameSysInfo->audioSystem ? |
| 686 | sceneInfo.gameSysInfo->audioSystem->getAudioSystemInfo() : |
| 687 | nullptr; |
| 688 | |
| 689 | if (!audioDirectorInfo.curStage) |
| 690 | audioDirectorInfo.curStage = sceneInfo.initStageName; |
| 691 | if (audioDirectorInfo.scenarioNo == 0) |
| 692 | audioDirectorInfo.scenarioNo = sceneInfo.scenarioNo; |
| 693 | if (audioDirectorInfo.seDirectorInitInfo.maxRequests < 1) |
| 694 | audioDirectorInfo.seDirectorInitInfo.maxRequests = 200; |
| 695 | if (audioDirectorInfo.seDirectorInitInfo.playerCount < 1) |
| 696 | audioDirectorInfo.seDirectorInitInfo.playerCount = 40; |
| 697 | |
| 698 | audioDirectorInfo.bgmDirectorInitInfo.field_0 = true; |
| 699 | audioDirectorInfo.bgmDirectorInitInfo.field_8 = "Scene" ; |
| 700 | audioDirectorInfo.duckingName = "DuckingForScene" ; |
| 701 | |
| 702 | AudioDirector* audioDirector = new AudioDirector(); |
| 703 | audioDirector->init(info: audioDirectorInfo); |
| 704 | scene->setAudioDirector(audioDirector); |
| 705 | audioDirector->setDependentModule(sceneInfo.audioDirector); |
| 706 | return audioDirector; |
| 707 | } |
| 708 | |
| 709 | void initAudioDirector2D(Scene* scene, const SceneInitInfo& sceneInfo, |
| 710 | AudioDirectorInitInfo& audioDirectorInfo) { |
| 711 | initAudioDirectorImpl(scene, sceneInfo, audioDirectorInfo); |
| 712 | } |
| 713 | |
| 714 | void initAudioDirector3D(Scene* scene, const SceneInitInfo& sceneInfo, |
| 715 | AudioDirectorInitInfo& audioDirectorInfo) { |
| 716 | initAudioDirector3D(scene, sceneInfo, audioDirectorInfo, lookAtCamera: &getLookAtCamera(user: scene, viewIdx: 0), |
| 717 | projection: &getProjection(user: scene, viewIdx: 0), areaObjDirector: scene->getLiveActorKit()->getAreaObjDirector()); |
| 718 | } |
| 719 | |
| 720 | void initAudioDirector3D(Scene* scene, const SceneInitInfo& sceneInfo, |
| 721 | AudioDirectorInitInfo& audioDirectorInfo, |
| 722 | const sead::LookAtCamera* lookAtCamera, const Projection* projection, |
| 723 | AreaObjDirector* areaObjDirector) { |
| 724 | if (!audioDirectorInfo.seDirectorInitInfo.cameraPos) |
| 725 | audioDirectorInfo.seDirectorInitInfo.cameraPos = &lookAtCamera->getPos(); |
| 726 | if (!audioDirectorInfo.seDirectorInitInfo.cameraMatrix) |
| 727 | audioDirectorInfo.seDirectorInitInfo.cameraMatrix = &lookAtCamera->getMatrix(); |
| 728 | if (!audioDirectorInfo.seDirectorInitInfo.cameraProjection) |
| 729 | audioDirectorInfo.seDirectorInitInfo.cameraProjection = projection; |
| 730 | if (!audioDirectorInfo.seDirectorInitInfo.cameraAt) |
| 731 | audioDirectorInfo.seDirectorInitInfo.cameraAt = &lookAtCamera->getAt(); |
| 732 | if (!audioDirectorInfo.areaObjDirector) |
| 733 | audioDirectorInfo.areaObjDirector = areaObjDirector; |
| 734 | if (!audioDirectorInfo.demoDirector) |
| 735 | audioDirectorInfo.demoDirector = scene->getLiveActorKit()->getDemoDirector(); |
| 736 | |
| 737 | initAudioDirectorImpl(scene, sceneInfo, audioDirectorInfo)->init3D(info: audioDirectorInfo); |
| 738 | } |
| 739 | |
| 740 | void initSceneAudioKeeper(Scene* scene, const SceneInitInfo& sceneInfo, const char* name) { |
| 741 | AudioSystemInfo* audioSystemInfo = nullptr; |
| 742 | if (sceneInfo.gameSysInfo->audioSystem) |
| 743 | audioSystemInfo = sceneInfo.gameSysInfo->audioSystem->getAudioSystemInfo(); |
| 744 | |
| 745 | const char* seUserName = alSeDbFunction::tryFindSceneSeUserName( |
| 746 | audioSystemInfo, sceneInfo.initStageName, sceneInfo.scenarioNo); |
| 747 | |
| 748 | if (seUserName) |
| 749 | name = seUserName; |
| 750 | |
| 751 | scene->setAudioKeeper( |
| 752 | alAudioKeeperFunction::createAudioKeeper(scene->getAudioDirector(), name, nullptr)); |
| 753 | } |
| 754 | |
| 755 | void setIsSafeFinalizingInParallelThread(Scene* scene, bool isSafe) { |
| 756 | if (scene->getAudioDirector()) |
| 757 | scene->getAudioDirector()->setIsSafeFinalizingInParallelThread(isSafe); |
| 758 | } |
| 759 | |
| 760 | void updateKit(Scene* scene) { |
| 761 | executeUpdate(scene->getLiveActorKit(), nullptr); |
| 762 | } |
| 763 | |
| 764 | void updateKitTable(Scene* scene, const char* name) { |
| 765 | executeUpdateTable(scene->getLiveActorKit(), name); |
| 766 | } |
| 767 | |
| 768 | void updateKitList(Scene* scene, const char* listName, const char* name) { |
| 769 | executeUpdateList(scene->getLiveActorKit(), listName, name); |
| 770 | } |
| 771 | |
| 772 | void updateKitList(Scene* scene, const char* name) { |
| 773 | updateKitList(scene, listName: "更新" , name); |
| 774 | } |
| 775 | |
| 776 | void updateLayoutKit(Scene* scene) { |
| 777 | executeUpdate(scene->getLayoutKit()); |
| 778 | } |
| 779 | |
| 780 | void updateEffect(Scene* scene) { |
| 781 | alExecuteFunction::updateEffect(director: scene->getLiveActorKit()->getExecuteDirector()); |
| 782 | } |
| 783 | |
| 784 | void updateEffectSystem(Scene* scene) { |
| 785 | alExecuteFunction::updateEffectSystem(director: scene->getLiveActorKit()->getExecuteDirector()); |
| 786 | } |
| 787 | |
| 788 | void updateEffectPlayer(Scene* scene) { |
| 789 | alExecuteFunction::updateEffectPlayer(director: scene->getLiveActorKit()->getExecuteDirector()); |
| 790 | } |
| 791 | |
| 792 | void updateEffectDemo(Scene* scene) { |
| 793 | alExecuteFunction::updateEffectDemo(director: scene->getLiveActorKit()->getExecuteDirector()); |
| 794 | } |
| 795 | |
| 796 | void updateEffectDemoWithPause(Scene* scene) { |
| 797 | updateKitList(scene, name: "エフェクト(前処理)" ); |
| 798 | updateKitList(scene, name: "エフェクト(プレイヤー)" ); |
| 799 | updateKitList(scene, name: "エフェクト(Zソート)" ); |
| 800 | updateKitList(scene, name: "エフェクト(カメラデモ)" ); |
| 801 | updateKitList(scene, name: "エフェクト(カメラ前エフェクト)" ); |
| 802 | updateKitList(scene, name: "エフェクト(ベース2D)" ); |
| 803 | updateKitList(scene, name: "エフェクト(2D)" ); |
| 804 | updateKitList(scene, name: "エフェクト(後処理)" ); |
| 805 | } |
| 806 | |
| 807 | void updateEffectLayout(Scene* scene) { |
| 808 | alExecuteFunction::updateEffectLayout(director: scene->getLiveActorKit()->getExecuteDirector()); |
| 809 | } |
| 810 | |
| 811 | void updateGraphicsPrev(Scene* scene) { |
| 812 | LiveActorKit* actorKit = scene->getLiveActorKit(); |
| 813 | if (actorKit && actorKit->getGraphicsSystemInfo() && actorKit->getCameraDirector()) |
| 814 | actorKit->preDrawGraphics(); |
| 815 | } |
| 816 | |
| 817 | void updateKitListPrev(Scene* scene) { |
| 818 | scene->getLiveActorKit()->clearGraphicsRequest(); |
| 819 | scene->getLiveActorKit()->getPadRumbleDirector()->update(); |
| 820 | } |
| 821 | |
| 822 | void updateKitListPost(Scene* scene) { |
| 823 | updateKitList(scene, name: "帽子装着位置更新" ); |
| 824 | updateEffect(scene); |
| 825 | } |
| 826 | |
| 827 | void updateKitListPostDemoWithPauseNormalEffect(Scene* scene) { |
| 828 | updateKitList(scene, name: "帽子装着位置更新" ); |
| 829 | updateEffectDemoWithPause(scene); |
| 830 | } |
| 831 | |
| 832 | void updateKitListPostOnNerveEnd(Scene* scene) { |
| 833 | scene->getLiveActorKit()->updateGraphics(); |
| 834 | updateGraphicsPrev(scene); |
| 835 | } |
| 836 | |
| 837 | void drawKit(const Scene* scene, const char* name) { |
| 838 | executeDraw(scene->getLiveActorKit(), name); |
| 839 | } |
| 840 | |
| 841 | void drawKitList(const Scene* scene, const char* listName, const char* name) { |
| 842 | executeDrawList(scene->getLiveActorKit(), listName, name); |
| 843 | } |
| 844 | |
| 845 | void drawLayoutKit(const Scene* scene, const char* name) { |
| 846 | executeDraw(scene->getLayoutKit(), name); |
| 847 | } |
| 848 | |
| 849 | void drawEffectDeferred(const Scene* scene, s32 index) { |
| 850 | SceneCameraInfo* cameraInfo = |
| 851 | scene->getLiveActorKit()->getCameraDirector()->getSceneCameraInfo(); |
| 852 | alEffectSystemFunction::drawEffectDeferred( |
| 853 | scene->getLiveActorKit()->getEffectSystem(), getProjectionMtx(info: cameraInfo, viewIdx: index), |
| 854 | getViewMtx(info: cameraInfo, viewIdx: index), getNear(info: cameraInfo, viewIdx: index), getFar(info: cameraInfo, viewIdx: index), |
| 855 | getFovy(info: cameraInfo, viewIdx: index)); |
| 856 | } |
| 857 | |
| 858 | void startForwardPlayerScreenFader(const Scene* scene, s32 a, s32 b, f32 c) { |
| 859 | scene->getLiveActorKit() |
| 860 | ->getGraphicsSystemInfo() |
| 861 | ->getViewRenderer() |
| 862 | ->startForwardPlayerScreenFader(a, b, c); |
| 863 | } |
| 864 | |
| 865 | void endForwardPlayerScreenFader(const Scene* scene, s32 a) { |
| 866 | scene->getLiveActorKit() |
| 867 | ->getGraphicsSystemInfo() |
| 868 | ->getViewRenderer() |
| 869 | ->endForwardPlayerScreenFader(a); |
| 870 | } |
| 871 | |
| 872 | bool isStopScene(const Scene* scene) { |
| 873 | return scene->getSceneStopCtrl()->isStop(); |
| 874 | } |
| 875 | |
| 876 | void startCheckViewCtrlByCameraPos(Scene* scene) { |
| 877 | scene->getLiveActorKit()->getClippingDirector()->startCheckViewCtrlByCameraPos(); |
| 878 | } |
| 879 | |
| 880 | void startCheckViewCtrlByLookAtPos(Scene* scene) { |
| 881 | scene->getLiveActorKit()->getClippingDirector()->startCheckViewCtrlByLookAtPos(); |
| 882 | } |
| 883 | |
| 884 | void startCheckViewCtrlByPlayerPos(Scene* scene) { |
| 885 | scene->getLiveActorKit()->getClippingDirector()->startCheckViewCtrlByPlayerPos(); |
| 886 | } |
| 887 | |
| 888 | bool isExistScreenCoverCtrl(const Scene* scene) { |
| 889 | return scene->getScreenCoverCtrl() != nullptr; |
| 890 | } |
| 891 | |
| 892 | bool isRequestCaptureScreenCover(const Scene* scene) { |
| 893 | return scene->getScreenCoverCtrl()->isRequestCapture(); |
| 894 | } |
| 895 | |
| 896 | void resetRequestCaptureScreenCover(const Scene* scene) { |
| 897 | scene->getScreenCoverCtrl()->resetRequestCapture(); |
| 898 | } |
| 899 | |
| 900 | bool isOffDrawScreenCover(const Scene* scene) { |
| 901 | return scene->getScreenCoverCtrl()->getCoverFrames() == 0; |
| 902 | } |
| 903 | |
| 904 | void resetCaptureScreenCover(const Scene* scene) { |
| 905 | scene->getScreenCoverCtrl()->resetCapture(); |
| 906 | } |
| 907 | |
| 908 | void validatePostProcessingFilter(const Scene* scene) { |
| 909 | scene->getLiveActorKit()->getGraphicsSystemInfo()->getPostProcessingFilter()->validate(); |
| 910 | } |
| 911 | |
| 912 | void invalidatePostProcessingFilter(const Scene* scene) { |
| 913 | scene->getLiveActorKit()->getGraphicsSystemInfo()->getPostProcessingFilter()->invalidate(); |
| 914 | } |
| 915 | |
| 916 | void incrementPostProcessingFilterPreset(const Scene* scene) { |
| 917 | scene->getLiveActorKit()->getGraphicsSystemInfo()->getPostProcessingFilter()->incrementPreset(); |
| 918 | } |
| 919 | |
| 920 | void decrementPostProcessingFilterPreset(const Scene* scene) { |
| 921 | scene->getLiveActorKit()->getGraphicsSystemInfo()->getPostProcessingFilter()->decrementPreset(); |
| 922 | } |
| 923 | |
| 924 | s32 getPostProcessingFilterPresetId(const Scene* scene) { |
| 925 | return scene->getLiveActorKit() |
| 926 | ->getGraphicsSystemInfo() |
| 927 | ->getPostProcessingFilter() |
| 928 | ->getPresetId(); |
| 929 | } |
| 930 | |
| 931 | bool isActiveDemo(const Scene* scene) { |
| 932 | return scene->getLiveActorKit()->getDemoDirector()->isActiveDemo(); |
| 933 | } |
| 934 | |
| 935 | const char* getActiveDemoName(const Scene* scene) { |
| 936 | return scene->getLiveActorKit()->getDemoDirector()->getActiveDemoName(); |
| 937 | } |
| 938 | |
| 939 | LiveActor** getDemoActorList(const Scene* scene) { |
| 940 | return scene->getLiveActorKit()->getDemoDirector()->getDemoActorList(); |
| 941 | } |
| 942 | |
| 943 | s32 getDemoActorNum(const Scene* scene) { |
| 944 | return scene->getLiveActorKit()->getDemoDirector()->getDemoActorNum(); |
| 945 | } |
| 946 | |
| 947 | void updateDemoActor(const Scene* scene) { |
| 948 | scene->getLiveActorKit()->getDemoDirector()->updateDemoActor(nullptr); |
| 949 | } |
| 950 | |
| 951 | void updateDemoActorForPauseEffect(const Scene* scene) { |
| 952 | EffectSystem* effectSystem = scene->getLiveActorKit()->getEffectSystem(); |
| 953 | scene->getLiveActorKit()->getDemoDirector()->updateDemoActor(effectSystem); |
| 954 | } |
| 955 | |
| 956 | void stopAllSe(const Scene* scene, u32 index) { |
| 957 | if (scene && scene->getAudioDirector()) |
| 958 | alSeFunction::stopAllSe(scene->getAudioDirector(), index); |
| 959 | } |
| 960 | |
| 961 | void initPadRumble(const Scene* scene, const SceneInitInfo& sceneInfo) { |
| 962 | WaveVibrationHolder* waveVibrationHolder = sceneInfo.gameSysInfo->waveVibrationHolder; |
| 963 | scene->getLiveActorKit()->getPadRumbleDirector()->setWaveVibrationHolder(waveVibrationHolder); |
| 964 | |
| 965 | alAudioSystemFunction::setPadRumbleDirectorForSe( |
| 966 | scene->getAudioDirector(), scene->getLiveActorKit()->getPadRumbleDirector()); |
| 967 | } |
| 968 | |
| 969 | void stopPadRumble(const Scene* scene) { |
| 970 | scene->getLiveActorKit()->getPadRumbleDirector()->stopAllRumble(); |
| 971 | } |
| 972 | |
| 973 | void pausePadRumble(const Scene* scene) { |
| 974 | scene->getLiveActorKit()->getPadRumbleDirector()->pause(); |
| 975 | } |
| 976 | |
| 977 | void endPausePadRumble(const Scene* scene) { |
| 978 | scene->getLiveActorKit()->getPadRumbleDirector()->endPause(); |
| 979 | } |
| 980 | |
| 981 | void validatePadRumble(Scene* scene) { |
| 982 | scene->getLiveActorKit()->getPadRumbleDirector()->validatePadRumble(); |
| 983 | } |
| 984 | |
| 985 | void invalidatePadRumble(Scene* scene) { |
| 986 | scene->getLiveActorKit()->getPadRumbleDirector()->invalidatePadRumble(); |
| 987 | } |
| 988 | |
| 989 | void setPadRumblePowerLevel(Scene* scene, s32 powerLevel) { |
| 990 | scene->getLiveActorKit()->getPadRumbleDirector()->setPowerLevel(powerLevel); |
| 991 | } |
| 992 | |
| 993 | const Resource* getPreLoadFileListArc() { |
| 994 | return findResource("SystemData/PreLoad" ); |
| 995 | } |
| 996 | |
| 997 | bool tryRequestPreLoadFile(const Scene* scene, const SceneInitInfo& sceneInfo, s32 index, |
| 998 | sead::Heap* heap) { |
| 999 | StringTmp<128> stageName{"%s%d" , sceneInfo.initStageName, index}; |
| 1000 | return tryRequestPreLoadFile(res: getPreLoadFileListArc(), fileName: stageName, heap, resLoader: nullptr); |
| 1001 | } |
| 1002 | |
| 1003 | } // namespace al |
| 1004 | |
| 1005 | namespace alSceneFunction { |
| 1006 | void initAreaCameraSwitcherMultiForPrototype(const al::Scene* scene) { |
| 1007 | scene->getLiveActorKit()->getCameraDirector()->initAreaCameraSwitcherMultiForPrototype( |
| 1008 | scene->getLiveActorKit()->getAreaObjDirector()); |
| 1009 | } |
| 1010 | } // namespace alSceneFunction |
| 1011 | |