mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-09-06 19:31:06 -04:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user