diff options
Diffstat (limited to 'src/engine/World.cpp')
| -rw-r--r-- | src/engine/World.cpp | 76 |
1 files changed, 4 insertions, 72 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp index 5cd85213b..ded60a262 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -3,14 +3,7 @@ #include "Cup.h" #include "courses/Course.h" #include "vehicles/Vehicle.h" -#include "vehicles/Train.h" -#include "vehicles/Boat.h" -#include "vehicles/Truck.h" -#include "vehicles/Bus.h" -#include "vehicles/TankerTruck.h" -#include "vehicles/Car.h" #include "objects/BombKart.h" -#include "objects/Penguin.h" #include "TrainCrossing.h" #include <memory> #include "objects/Object.h" @@ -40,53 +33,13 @@ void World::SetCourseFromCup() { CurrentCourse = CurrentCup->GetCourse(); } -// Required for spawning vehicles in divisions across path points -static size_t trains; -static size_t trucks; -static size_t busses; -static size_t tankerTrucks; -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 - * @arg waypoint initial waypoint to spawn at. - */ -void World::AddTrain(ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ATrain>(trains, tender, numCarriages, speed, waypoint)); - trains++; -} - -void World::AddBoat(f32 speed, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ABoat>(boats, speed, waypoint)); - boats++; -} - -void World::AddTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ATruck>(trucks, speedA, speedB, path, waypoint)); - trucks++; -} - -void World::AddBus(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ABus>(busses, speedA, speedB, path, waypoint)); - busses++; -} - -void World::AddTankerTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ATankerTruck>(tankerTrucks, speedA, speedB, path, waypoint)); - tankerTrucks++; -} - -void World::AddCar(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint) { - Vehicles.push_back(std::make_unique<ACar>(cars, speedA, speedB, path, waypoint)); - cars++; +AVehicle* World::AddVehicle(AVehicle* vehicle) { + Vehicles.push_back(vehicle); + return Vehicles.back(); } void World::ClearVehicles(void) { - trains = trucks = busses = tankerTrucks = cars = boats = thwomps = 0; Vehicles.clear(); } @@ -97,28 +50,7 @@ TrainCrossing* World::AddCrossing(Vec3f position, u32 waypointMin, u32 waypointM } void World::AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C) { - BombKarts.push_back(std::make_unique<OBombKart>(pos, waypoint, waypointIndex, state, unk_3C)); -} - -void World::AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) { - Thwomps.push_back( - std::make_unique<OThwomp>(thwomps, x, z, direction, scale, behaviour, primAlpha, boundingBoxSize)); - thwomps++; - gNumActiveThwomps = thwomps; -} - -std::shared_ptr<OPenguin> World::AddPenguin(Vec3f pos, u16 direction, OPenguin::PenguinType type, OPenguin::Behaviour behaviour) { - auto penguin = std::make_shared<OPenguin>(penguins, pos, direction, type, behaviour); - Penguins.push_back(penguin); - penguins++; - 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; + BombKarts.push_back(new OBombKart(pos, waypoint, waypointIndex, state, unk_3C)); } u32 World::GetCupIndex() { |
