MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Load

Method Load

apps/tetris/Tetris/NotebookScene.cpp:56–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54NotebookScene::~NotebookScene() = default;
55
56bool NotebookScene::Load()
57{
58 RString modelPath = FindShape(RString(kNotebookModel));
59 if (modelPath.GetLength() == 0)
60 {
61 LOG_ERROR(Core, "NotebookScene: cannot find model {}", kNotebookModel);
62 return false;
63 }
64
65 _shape = Shapes.New(modelPath, false, false);
66 if (!_shape || _shape->NLevels() <= 0)
67 {
68 LOG_ERROR(Core, "NotebookScene: shape {} failed to load", (const char*)modelPath);
69 return false;
70 }
71
72 // Match ControlObject + ControlObjectContainerAnim setup so the
73 // engine treats this exactly like the options menu notebook.
74 _shape->LevelOpaque(0)->MakeCockpit();
75 _shape->OrSpecial(BestMipmap | NoDropdown | DisableSun);
76 _shape->SetAutoCenter(false);
77 _shape->CalculateBoundingSphere();
78 _shape->AllowAnimation();
79
80 // Build skeleton + open animation.
81 _skeleton = new Skeleton();
82 AnimationRTName name;
83 name.name = GetAnimationName(RString(kNotebookAnim));
84 name.skeleton = _skeleton;
85 _animation = new AnimationRT(name, false);
86 _animation->Prepare(_shape, _skeleton, _weights, false);
87
88 // Static frame transform — OptTplNotebook's direction/up vectors.
89 SetPosition(NotebookFarPosition());
90 SetOrient(Vector3(0.0f, kSin30, kCos30), Vector3(0.0f, kCos30, -kSin30));
91 SetScale(1.0f);
92
93 _loaded = true;
94 LOG_INFO(Core, "NotebookScene: loaded {} + {}", kNotebookModel, kNotebookAnim);
95 return true;
96}
97
98void NotebookScene::Tick(float deltaT)
99{

Callers 5

scanFilesThreadMethod · 0.45
SetupMethod · 0.45
LLVMFuzzerTestOneInputFunction · 0.45

Calls 15

FindShapeFunction · 0.85
GetAnimationNameFunction · 0.85
NotebookFarPositionFunction · 0.85
NLevelsMethod · 0.80
MakeCockpitMethod · 0.80
LevelOpaqueMethod · 0.80
SetAutoCenterMethod · 0.80
AllowAnimationMethod · 0.80
RStringClass · 0.50
Vector3Class · 0.50
GetLengthMethod · 0.45

Tested by

no test coverage detected