New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ready] Garages #480

Merged
merged 3 commits into from May 24, 2018

Conversation

Projects
None yet
4 participants
@husho
Copy link
Contributor

husho commented May 20, 2018

#107

This PR todo list:

  • Garage controller
  • Rename garage type 11
  • Get rid of unused types
  • Cranes are not garages = fix opcodes
  • Resprays (basic stuff opening/closing)
  • Bomb shops (basic stuff opening/closing)
  • Hideout garages (basic stuff opening/closing)
  • Calculate distance to the closest door object in the world properly
  • Calculate distance between garage and player properly for hideout garages
  • Fix: some garages have incorrect min/max boundaries

Garages todo overall:

  • Free resprays
  • Bomb shops charge money
  • Bomb shops arm cars
  • Free bomb shops
  • Resprays fix cars
  • Resprays repaint cars
  • Resprays check for disallowed cars
  • Resprays charge money
  • Hideout garages store cars
  • Import/export garages
  • Import/export garages store cars
  • Special garage type 11 for missions
  • Special garage type 14 for missions
  • Special garage type 19 for missions
  • Special garage type 20 for missions
  • Special garage type 21 for missions
  • Restore from savefiles
@@ -249,6 +249,44 @@ class SimpleModelInfo : public BaseModelInfo {
return related_;
}

static bool isDoorModel(std::string m) {
if (m == "oddjgaragdoor") return true;

This comment has been minimized.

@danhedron

danhedron May 22, 2018

Member

As a way to separate the data here, the list of names can be std::(unordered_)set.

This comment has been minimized.

@husho

husho May 22, 2018

Contributor

Will do

@@ -76,6 +76,10 @@ GameWorld::~GameWorld() {
for (auto& p : allObjects) {
delete p;
}

for (auto& p : garageControllers) {
delete p;

This comment has been minimized.

@danhedron

danhedron May 22, 2018

Member

Storing each controller in a unique_ptr would give you this for free.

o->getModelInfo<BaseModelInfo>()->name))
continue;

garageMidpoint.x = (coord0.x + coord1.x) / 2;

This comment has been minimized.

@danhedron

danhedron May 22, 2018

Member

This doesn't need to be calculated inside the loop

@@ -45,6 +45,13 @@ InstanceObject::InstanceObject(GameWorld* engine, const glm::vec3& pos,
engine->aigraph.createPathNodes(position, rot, path);
}
}

// @todo this is temporary, remove when physics gets fixed

This comment has been minimized.

@danhedron

danhedron May 22, 2018

Member

What needs to be fixed about the doors?

This comment has been minimized.

@husho

husho May 22, 2018

Contributor

This is related to #450, I want to replace this code later with setStatic

This comment has been minimized.

@husho

husho May 23, 2018

Contributor

Resolved

@husho husho changed the title [WIP] Garages [Ready] Garages May 22, 2018

husho added some commits May 22, 2018

@@ -114,6 +115,20 @@ class BaseModelInfo {
using ModelInfoTable =
std::unordered_map<ModelID, std::unique_ptr<BaseModelInfo>>;

static std::unordered_set<std::string> doorModels = {

This comment has been minimized.

@ShFil119

ShFil119 May 23, 2018

Member

const?

This comment has been minimized.

@dracc

dracc May 23, 2018

Contributor

One could think it would be const by default, as changing an unordered_set is not allowed (to my understanding). Weird.

// Create controller
std::unique_ptr<GarageController> garageController(
new GarageController(this, info, door));
garageControllers.push_back(std::move(garageController));

This comment has been minimized.

@ShFil119

ShFil119 May 23, 2018

Member

Maybe it's better to create when "inserting". I think about push_back(std::make_unique(...)).

return false;
}

case GarageType::BombShop1:

This comment has been minimized.

@ShFil119

ShFil119 May 23, 2018

Member

I think you should add in "empty cases" break;.

This comment has been minimized.

@husho

husho May 23, 2018

Contributor

It's not empty, it falls through

This comment has been minimized.

@ShFil119

ShFil119 May 23, 2018

Member

So it is intentional?

This comment has been minimized.

@husho

husho May 23, 2018

Contributor

Yes

This comment has been minimized.

@husho

husho May 23, 2018

Contributor

Bombshops and resprays logic is different though, so this is incorrect anyway. But I was advised not to add more logic as there is a lot of code already.

husho

@danhedron danhedron merged commit 2b096eb into rwengine:master May 24, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@husho husho deleted the husho:garages branch May 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment