| 263 | } |
| 264 | |
| 265 | void CMapBlock::AddRender(CRenderWorldObject *item, int x, int y) |
| 266 | { |
| 267 | item->RemoveRender(); |
| 268 | int priorityZ = item->GetZ(); |
| 269 | if (item->IsLandObject()) |
| 270 | { |
| 271 | if (((CLandObject *)item)->IsStretched) |
| 272 | { |
| 273 | priorityZ = ((CLandObject *)item)->AverageZ - 1; |
| 274 | } |
| 275 | else |
| 276 | { |
| 277 | priorityZ--; |
| 278 | } |
| 279 | } |
| 280 | else if (item->IsStaticGroupObject()) |
| 281 | { |
| 282 | if (item->IsGameObject()) |
| 283 | { |
| 284 | //priorityZ++; |
| 285 | if (((CGameObject *)item)->NPC || ((CGameObject *)item)->IsCorpse()) |
| 286 | { |
| 287 | priorityZ++; |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | goto process_static; |
| 292 | } |
| 293 | } |
| 294 | else if ( |
| 295 | item->IsMultiObject() && |
| 296 | ((((CMultiObject *)item)->State & CHMOF_GENERIC_INTERNAL) != 0)) |
| 297 | { |
| 298 | priorityZ--; |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | process_static: |
| 303 | if (item->IsBackground()) |
| 304 | { |
| 305 | priorityZ--; |
| 306 | } |
| 307 | |
| 308 | if (((CRenderStaticObject *)item)->GetStaticHeight() != 0u) |
| 309 | { |
| 310 | priorityZ++; |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | else if (item->IsEffectObject()) |
| 315 | { |
| 316 | priorityZ += 2; |
| 317 | } |
| 318 | |
| 319 | item->PriorityZ = priorityZ; |
| 320 | CRenderWorldObject *obj = Block[x][y]; |
| 321 | if (obj == item) |
| 322 | { |
no test coverage detected