diff options
| author | MegaMech <7255464+MegaMech@users.noreply.github.com> | 2024-12-11 20:58:18 -0700 |
|---|---|---|
| committer | MegaMech <7255464+MegaMech@users.noreply.github.com> | 2024-12-11 20:58:18 -0700 |
| commit | 95b8cca50025f7fa10e47ca24ac5f71f9813a2e3 (patch) | |
| tree | dcb7bc04eb38b8f98b6348f4b15a46124aa51faf /src/engine/World.cpp | |
| parent | a4890f9dfcc993f3001d491395294f6836cdc0dc (diff) | |
Reimplementing objects
Diffstat (limited to 'src/engine/World.cpp')
| -rw-r--r-- | src/engine/World.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp index ecaad485d..ead375a24 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -9,11 +9,11 @@ #include "vehicles/Bus.h" #include "vehicles/TankerTruck.h" #include "vehicles/Car.h" -#include "objects/OBombKart.h" -#include "objects/OPenguin.h" +#include "objects/BombKart.h" +#include "objects/Penguin.h" #include "TrainCrossing.h" #include <memory> -//#include "objects/GameObject.h" +#include "objects/GameObject.h" extern "C" { #include "camera.h" @@ -49,6 +49,7 @@ static size_t cars; static size_t boats; static size_t thwomps; static size_t penguins; +static size_t seagulls; /** * Note that you can only remove the tender if there are no carriages @@ -113,6 +114,13 @@ std::shared_ptr<OPenguin> World::AddPenguin(Vec3f pos, u16 direction, OPenguin:: return penguin; } +std::shared_ptr<OSeagull> World::AddSeagull(Vec3f pos) { + auto seagull = std::make_shared<OSeagull>(seagulls, pos); + Seagulls.push_back(seagull); + seagulls++; + return seagull; +} + u32 World::GetCupIndex() { return this->CupIndex; } @@ -185,12 +193,6 @@ void World::PreviousCourse() { gWorldInstance.CurrentCourse = Courses[CourseIndex]; } -// Object* World::AddObject(std::unique_ptr<GameObject> object) { -// GameObject* rawPtr = object.get(); -// GameObjects.push_back(std::move(object)); -// return &rawPtr->o; -// } - AActor* World::AddActor(AActor* actor) { Actors.push_back(actor); return Actors.back(); @@ -240,16 +242,21 @@ void RemoveExpiredActors() { // Actors.end()); } +GameObject* World::AddObject(GameObject* object) { + Objects.push_back(object); + return Objects.back(); +} + void World::TickObjects() { - //for (const auto& object : this->GameObjects) { - // object->Tick(); - //} + for (const auto& object : Objects) { + object->Tick(); + } } void World::DrawObjects(Camera *camera) { - //for (const auto& object : this->GameObjects) { - // object->Draw(camera); - //} + for (const auto& object : Objects) { + object->Draw(camera); + } } void World::ExpiredObjects() { |
