diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-11-09 19:07:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-09 19:07:44 -0700 |
| commit | de9c5d510175bba11ab8704e67be3a3a94f9149e (patch) | |
| tree | 34c42dbfe9f2a6eb5fbce5f6a31b532ff2a3f243 /src/engine/objects/Flagpole.cpp | |
| parent | 760fa3bf5226c2a6052a5d4d53fd0e27f2911e60 (diff) | |
Implement SpawnParams struct (#536)
* Impl SpawnParams
* Added json submodule
* Update json
* Update
* Works
* Remove comment
* Works refactor
* Snowman and thwomp working
* Impl hot air balloon
* More progress
* All OObjects are done
* cleanup
* Refactor 2Dpath to normal path
* Update nlohmann json & fix compile
* Rest of actors
* MORE CHANGES
* Finish actors
* Done PR, some fix to collision viewer
* Impl falling rocks
* Add const
* wip editor refactor
* Property work
* continue
* Overridable editor properties
* Actor saving/loading works now
* Fix light alignment
* Clarification
* Impl penguin
* params impl signs
* properties impl falling rock
* More property impls
* impl air balloon
* Add spawnParams to OObject Translate
* Snowman translate better
* impl hedgehog properly
* properties impl trophy
* thwomp progress
* Finish impl properties
* Fix compile
* Fix cursor collisions
* Move registered actors
* Rename pathPoint XYZ to xyz
* Fix editor pause bug
* Clean up
* Review comments
* Remove SpawnParams struct from actor classes
* Rename
* Player Label First Iteration
* Work now
* Working 3d text
* Fix boo bug
* Finish AText actor
* Fix spawnparams compile
* Register AText
* Finish Text Actor
* Fix thwomp interpolation
* Fix compile
* Fix crab and hedgehog
* Fix loading flagpole
* Fix Hot Air Balloon
* Turn zbuffer on for AText
* Update
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/engine/objects/Flagpole.cpp')
| -rw-r--r-- | src/engine/objects/Flagpole.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/engine/objects/Flagpole.cpp b/src/engine/objects/Flagpole.cpp index acd74ba2b..58581e3c9 100644 --- a/src/engine/objects/Flagpole.cpp +++ b/src/engine/objects/Flagpole.cpp @@ -15,16 +15,24 @@ extern "C" { size_t OFlagpole::_count = 0; -OFlagpole::OFlagpole(const FVector& pos, s16 direction) { +OFlagpole::OFlagpole(const SpawnParams& params) : OObject(params) { Name = "Flagpole"; + ResourceName = "mk:flagpole"; _idx = _count; - _pos = pos; - _direction = direction; find_unused_obj_index(&_objectIndex); - init_object(_objectIndex, 0); + SpawnPos = params.Location.value_or(FVector(0, 0, 0)); + gObjectList[_objectIndex].pos[0] = SpawnPos.x; + gObjectList[_objectIndex].pos[1] = SpawnPos.y; + gObjectList[_objectIndex].pos[2] = SpawnPos.z; + + SpawnRot = params.Rotation.value_or(IRotator(0, 0, 0)); + gObjectList[_objectIndex].orientation[0] = SpawnRot.pitch; + gObjectList[_objectIndex].orientation[1] = SpawnRot.yaw; + gObjectList[_objectIndex].orientation[2] = SpawnRot.roll; + _count++; } @@ -49,7 +57,7 @@ void OFlagpole::Draw(s32 cameraId) { // func_80055228 void OFlagpole::func_80055164(s32 objectIndex) { // func_80055164 if (gObjectList[objectIndex].state >= 2) { gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0077A0); - rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].direction_angle, + rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling); if (gIsGamePaused == 0) { gObjectList[objectIndex].unk_0A2 = render_animated_model((Armature*) gObjectList[objectIndex].model, @@ -67,9 +75,11 @@ void OFlagpole::func_80082F1C(s32 objectIndex) { gObjectList[objectIndex].vertex = (Vtx*) d_course_yoshi_valley_unk4; gObjectList[objectIndex].sizeScaling = 0.027f; object_next_state(objectIndex); - set_obj_origin_pos(objectIndex, _pos.x * xOrientation, _pos.y, _pos.z); + FVector pos = SpawnPos; + set_obj_origin_pos(objectIndex, pos.x * xOrientation, pos.y, pos.z); set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - set_obj_direction_angle(objectIndex, 0U, _direction, 0U); + IRotator rot = SpawnRot; + set_obj_orientation(objectIndex, rot.pitch, rot.yaw, rot.roll); // changed from directional_angle to orientation for editor support } void OFlagpole::func_80083018(s32 objectIndex) { |
