summaryrefslogtreecommitdiff
path: root/src/engine/objects/Crab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/objects/Crab.cpp')
-rw-r--r--src/engine/objects/Crab.cpp47
1 files changed, 40 insertions, 7 deletions
diff --git a/src/engine/objects/Crab.cpp b/src/engine/objects/Crab.cpp
index 98c781b5a..9e4e4687b 100644
--- a/src/engine/objects/Crab.cpp
+++ b/src/engine/objects/Crab.cpp
@@ -26,24 +26,31 @@ extern "C" {
size_t OCrab::_count = 0;
-OCrab::OCrab(const FVector2D& start, const FVector2D& end) {
+OCrab::OCrab(const SpawnParams& params) : OObject(params) {
Name = "Crab";
+ ResourceName = "mk:crab";
_idx = _count;
- _start = start;
- _end = end;
+ _start = params.PatrolStart.value_or(FVector2D(0, 0));
+ _end = params.PatrolEnd.value_or(FVector2D(0, 0));
find_unused_obj_index(&_objectIndex);
init_object(_objectIndex, 0);
- gObjectList[_objectIndex].pos[0] = gObjectList[_objectIndex].origin_pos[0] = start.x * xOrientation;
- gObjectList[_objectIndex].pos[2] = gObjectList[_objectIndex].origin_pos[2] = start.z;
+ gObjectList[_objectIndex].pos[0] = gObjectList[_objectIndex].origin_pos[0] = _start.x * xOrientation;
+ gObjectList[_objectIndex].pos[2] = gObjectList[_objectIndex].origin_pos[2] = _start.z;
- gObjectList[_objectIndex].unk_01C[0] = end.x * xOrientation;
- gObjectList[_objectIndex].unk_01C[2] = end.z;
+ gObjectList[_objectIndex].unk_01C[0] = _end.x * xOrientation;
+ gObjectList[_objectIndex].unk_01C[2] = _end.z;
_count++;
}
+void OCrab::SetSpawnParams(SpawnParams& params) {
+ params.Name = std::string(ResourceName);
+ params.PatrolStart = _start;
+ params.PatrolEnd = _end;
+}
+
void OCrab::Tick(void) {
s32 objectIndex = _objectIndex;
if (gObjectList[objectIndex].state != 0) {
@@ -189,3 +196,29 @@ void OCrab::func_80082E18(s32 objectIndex) {
func_80089F24(objectIndex);
}
}
+
+void OCrab::DrawEditorProperties() {
+ ImGui::Text("Start Location");
+ ImGui::SameLine();
+
+ if (ImGui::DragFloat2("##PathSpan", (float*)&_start)) {
+ }
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetPathSpan")) {
+ _start = FVector2D(0.0f, 0.0f);
+ gObjectList[_objectIndex].pos[0] = gObjectList[_objectIndex].origin_pos[0] = _start.x * xOrientation;
+ gObjectList[_objectIndex].pos[2] = gObjectList[_objectIndex].origin_pos[2] = _start.z;
+ }
+
+ ImGui::Text("Patrol Location");
+ ImGui::SameLine();
+
+ if (ImGui::DragFloat2("##PatrolLoc", (float*)&_end)) {
+ }
+ ImGui::SameLine();
+ if (ImGui::Button(ICON_FA_UNDO "##ResetPatrolLoc")) {
+ _end = FVector2D(0.0f, 0.0f);
+ gObjectList[_objectIndex].unk_01C[0] = _end.x * xOrientation;
+ gObjectList[_objectIndex].unk_01C[2] = _end.z;
+ }
+}