MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / create

Method create

src/OpenLoco/src/Effects/ExhaustEffect.cpp:120–157  ·  view source on GitHub ↗

0x0044080C

Source from the content-addressed store, hash-verified

118
119 // 0x0044080C
120 Exhaust* Exhaust::create(World::Pos3 loc, uint8_t type)
121 {
122 if (!World::validCoords(loc))
123 {
124 return nullptr;
125 }
126 auto surface = World::TileManager::get(loc.x & 0xFFE0, loc.y & 0xFFE0).surface();
127
128 if (surface == nullptr)
129 {
130 return nullptr;
131 }
132
133 if (loc.z <= surface->baseHeight())
134 {
135 return nullptr;
136 }
137
138 auto _exhaust = static_cast<Exhaust*>(EntityManager::createEntityMisc());
139
140 if (_exhaust != nullptr)
141 {
142 _exhaust->baseType = EntityBaseType::effect;
143 _exhaust->objectId = type;
144 const auto* obj = _exhaust->getObject();
145 _exhaust->spriteWidth = obj->spriteWidth;
146 _exhaust->spriteHeightNegative = obj->spriteHeightNegative;
147 _exhaust->spriteHeightPositive = obj->spriteHeightPositive;
148 _exhaust->setSubType(EffectType::exhaust);
149 _exhaust->frameNum = 0;
150 _exhaust->stationaryProgress = 0;
151 _exhaust->windProgress = 0;
152 _exhaust->var_34 = 0;
153 _exhaust->var_36 = 0;
154 _exhaust->moveTo(loc);
155 }
156 return _exhaust;
157 }
158}

Callers

nothing calls this directly

Calls 8

validCoordsFunction · 0.85
createEntityMiscFunction · 0.85
surfaceMethod · 0.80
baseHeightMethod · 0.80
moveToMethod · 0.80
getFunction · 0.50
getObjectMethod · 0.45
setSubTypeMethod · 0.45

Tested by

no test coverage detected