summaryrefslogtreecommitdiff
path: root/src/engine/objects/CheepCheep.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-11-09 19:07:44 -0700
committerGitHub <noreply@github.com>2025-11-09 19:07:44 -0700
commitde9c5d510175bba11ab8704e67be3a3a94f9149e (patch)
tree34c42dbfe9f2a6eb5fbce5f6a31b532ff2a3f243 /src/engine/objects/CheepCheep.cpp
parent760fa3bf5226c2a6052a5d4d53fd0e27f2911e60 (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/CheepCheep.cpp')
-rw-r--r--src/engine/objects/CheepCheep.cpp61
1 files changed, 51 insertions, 10 deletions
diff --git a/src/engine/objects/CheepCheep.cpp b/src/engine/objects/CheepCheep.cpp
index ed489dc88..a2432f57e 100644
--- a/src/engine/objects/CheepCheep.cpp
+++ b/src/engine/objects/CheepCheep.cpp
@@ -1,8 +1,10 @@
#include "CheepCheep.h"
+#include "port/Game.h"
#include "assets/banshee_boardwalk_data.h"
#include "assets/common_data.h"
+
extern "C" {
#include "math_util.h"
#include "math_util_2.h"
@@ -17,17 +19,22 @@ extern Vec3s D_800E634C[];
extern Lights1 D_800E45C0[];
}
-OCheepCheep::OCheepCheep(const FVector& pos, CheepType type, IPathSpan span) {
+OCheepCheep::OCheepCheep(const SpawnParams& params) : OObject(params) {
Name = "Cheep Cheep";
- _type = type;
- _spawnPos = pos;
- _span = span;
+ ResourceName = "mk:cheep_cheep";
+ _behaviour = static_cast<Behaviour>(params.Behaviour.value_or(0));
+}
+
+void OCheepCheep::SetSpawnParams(SpawnParams& params) {
+ OObject::SetSpawnParams(params);
+ params.Behaviour = static_cast<int16_t>(_behaviour);
+ params.PathSpan = ActivationPoints;
}
void OCheepCheep::Tick() { // update_cheep_cheep
s32 objectIndex;
- switch (_type) {
- case CheepType::RACE:
+ switch (_behaviour) {
+ case Behaviour::RACE:
UNUSED s32 pad;
OCheepCheep::func_8007BD04(0);
@@ -35,7 +42,7 @@ void OCheepCheep::Tick() { // update_cheep_cheep
OCheepCheep::func_8007BBBC(objectIndex);
object_calculate_new_pos_offset(objectIndex);
break;
- case CheepType::PODIUM_CEREMONY:
+ case Behaviour::PODIUM_CEREMONY:
objectIndex = indexObjectList2[0];
if (D_801658BC == 1) {
D_801658BC = 0;
@@ -115,9 +122,11 @@ void OCheepCheep::func_8007BD04(s32 playerId) {
objectIndex = indexObjectList2[0];
if (gObjectList[objectIndex].state == 0) {
- if (((s32) gNearestPathPointByPlayerId[playerId] >= _span.Start) &&
- ((s32) gNearestPathPointByPlayerId[playerId] <= _span.End)) {
- set_obj_origin_pos(objectIndex, xOrientation * _spawnPos.x, _spawnPos.y, _spawnPos.z);
+ IPathSpan span = ActivationPoints;
+ if (((s32) gNearestPathPointByPlayerId[playerId] >= span.Start) &&
+ ((s32) gNearestPathPointByPlayerId[playerId] <= span.End)) {
+ FVector pos = SpawnPos;
+ set_obj_origin_pos(objectIndex, xOrientation * pos.x, pos.y, pos.z);
init_object(objectIndex, 1);
}
}
@@ -242,3 +251,35 @@ void OCheepCheep::func_8007BFB0(s32 objectIndex) {
object_add_velocity_offset_y(objectIndex);
object_calculate_new_pos_offset(objectIndex);
}
+
+void OCheepCheep::DrawEditorProperties() {
+ Object* obj = &gObjectList[_objectIndex];
+
+ ImGui::Text("Location");
+ ImGui::SameLine();
+ FVector location = FVector(obj->pos[0], obj->pos[1], obj->pos[2]);
+ if (ImGui::DragFloat3("##Location", (float*)&location)) {
+ Translate(location);
+ gEditor.eObjectPicker.eGizmo.Pos = location;
+ }
+
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetPos")) {
+ FVector location = FVector(0, 0, 0);
+ Translate(location);
+ gEditor.eObjectPicker.eGizmo.Pos = location;
+ }
+
+ IPathSpan span = ActivationPoints;
+
+ ImGui::Text("Path Span");
+ ImGui::SameLine();
+
+ if (ImGui::DragInt2("##PathSpan", (int*)&span)) {
+ ActivationPoints = span;
+ }
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetPathSpan")) {
+ ActivationPoints = IPathSpan(0.0f, 0.0f);
+ }
+}