Otclient 1.0  14/8/2020
tile.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #include "tile.h"
25 #include "effect.h"
26 #include "game.h"
27 #include "item.h"
28 #include "lightview.h"
29 #include "localplayer.h"
30 #include "map.h"
31 #include "protocolgame.h"
32 #include "thingtypemanager.h"
33 
34  // Define 1 to render behind the first creature added.
35 #define RENDER_CREATURE_BEHIND 0
36 
37 Tile::Tile(const Position& position) :
38  m_position(position),
39  m_drawElevation(0),
40  m_minimapColor(0),
41  m_flags(0),
42  m_houseId(0),
43  m_localPlayer(nullptr)
44 {
45 }
46 
47 void Tile::drawGround(const Point& dest, float scaleFactor, int reDrawFlags, LightView* lightView)
48 {
49  m_drawElevation = 0;
50 
51  for(const auto& ground : m_ground) {
52  ground->draw(dest - m_drawElevation * scaleFactor, scaleFactor, true, reDrawFlags, lightView);
53  m_drawElevation += ground->getElevation();
54  if(m_drawElevation > Otc::MAX_ELEVATION)
55  m_drawElevation = Otc::MAX_ELEVATION;
56  }
57 }
58 
59 void Tile::drawBottom(const Point& dest, float scaleFactor, int reDrawFlags, LightView* lightView)
60 {
61  for(const auto& item : m_bottomItems) {
62  item->draw(dest - m_drawElevation * scaleFactor, scaleFactor, true, reDrawFlags, lightView);
63 
64  m_drawElevation += item->getElevation();
65  if(m_drawElevation > Otc::MAX_ELEVATION)
66  m_drawElevation = Otc::MAX_ELEVATION;
67  }
68 
69  for(auto it = m_commonItems.rbegin(); it != m_commonItems.rend(); ++it) {
70  const auto& item = *it;
71 
72  item->draw(dest - m_drawElevation * scaleFactor, scaleFactor, true, reDrawFlags, lightView);
73 
74  m_drawElevation += item->getElevation();
75  if(m_drawElevation > Otc::MAX_ELEVATION)
76  m_drawElevation = Otc::MAX_ELEVATION;
77  }
78 
79 #if RENDER_CREATURE_BEHIND == 1
80  for(const auto& creature : m_walkingCreatures) {
81  creature->draw(
82  Point(
83  dest.x + ((creature->getPosition().x - m_position.x) * Otc::TILE_PIXELS - m_drawElevation) * scaleFactor,
84  dest.y + ((creature->getPosition().y - m_position.y) * Otc::TILE_PIXELS - m_drawElevation) * scaleFactor
85  ), scaleFactor, reDrawFlags, lightView);
86  }
87 
88  for(auto it = m_creatures.rbegin(); it != m_creatures.rend(); ++it) {
89  const auto& creature = *it;
90  if(creature->isWalking()) continue;
91  creature->draw(dest - m_drawElevation * scaleFactor, scaleFactor, reDrawFlags, lightView);
92  }
93 #else
94  for(const auto& creature : m_creatures) {
95  if(creature->isWalking()) continue;
96  creature->draw(dest - m_drawElevation * scaleFactor, scaleFactor, reDrawFlags, lightView);
97  }
98 
99  for(const auto& creature : m_walkingCreatures) {
100  creature->draw(
101  Point(
102  dest.x + ((creature->getPosition().x - m_position.x) * Otc::TILE_PIXELS - m_drawElevation) * scaleFactor,
103  dest.y + ((creature->getPosition().y - m_position.y) * Otc::TILE_PIXELS - m_drawElevation) * scaleFactor
104  ), scaleFactor, reDrawFlags, lightView);
105  }
106 #endif
107 }
108 
109 void Tile::drawTop(const Point& dest, float scaleFactor, int reDrawFlags, LightView* lightView)
110 {
111  for(const auto& effect : m_effects) {
112  effect->drawEffect(dest - m_drawElevation * scaleFactor, scaleFactor, reDrawFlags, lightView);
113  }
114 
115  for(const auto& item : m_topItems) {
116  item->draw(dest, scaleFactor, true, reDrawFlags, lightView);
117  }
118 }
119 
120 void Tile::draw(const Point& dest, float scaleFactor, int reDrawFlags, LightView* lightView)
121 {
122  drawGround(dest, scaleFactor, reDrawFlags, lightView);
123  drawBottom(dest, scaleFactor, reDrawFlags, lightView);
124  drawTop(dest, scaleFactor, reDrawFlags, lightView);
125 }
126 
128 {
129  m_bottomItems.clear();
130  m_ground.clear();
131  m_topItems.clear();
132  m_commonItems.clear();
133  m_creatures.clear();
134  m_things.clear();
135 
137 }
138 
140 {
141  m_walkingCreatures.push_back(creature);
142 }
143 
145 {
146  const auto it = std::find(m_walkingCreatures.begin(), m_walkingCreatures.end(), creature);
147  if(it != m_walkingCreatures.end())
148  m_walkingCreatures.erase(it);
149 }
150 
151 // TODO: Need refactoring
152 // Redo Stack Position System
153 void Tile::addThing(const ThingPtr& thing, int stackPos)
154 {
155  if(!thing)
156  return;
157 
158  if(thing->isEffect()) {
159  const EffectPtr& effect = thing->static_self_cast<Effect>();
160 
161  // find the first effect equal and wait for it to finish.
162  for(const EffectPtr& firstEffect : m_effects) {
163  if(effect->getId() == firstEffect->getId()) {
164  effect->waitFor(firstEffect);
165  }
166  }
167 
168  if(effect->isTopEffect())
169  m_effects.insert(m_effects.begin(), effect);
170  else
171  m_effects.push_back(effect);
172 
173  analyzeThing(thing, true);
174  thing->setPosition(m_position);
175  thing->onAppear();
176  return;
177  }
178 
179  const uint8_t size = m_things.size();
180  uint8_t originalStack = stackPos;
181 
182  // priority 854
183  // 0 - ground, --> -->
184  // 1 - ground borders --> -->
185  // 2 - bottom (walls), --> -->
186  // 3 - on top (doors) --> -->
187  // 4 - creatures, from top to bottom <-- -->
188  // 5 - items, from top to bottom <-- <--
189  if(stackPos < 0 || stackPos == 255) {
190  const int priority = thing->getStackPriority();
191 
192  // -1 or 255 => auto detect position
193  // -2 => append
194 
195  bool append;
196  if(stackPos == -2)
197  append = true;
198  else {
199  append = priority <= 3;
200 
201  // newer protocols does not store creatures in reverse order
202  if(g_game.getClientVersion() >= 854 && priority == 4)
203  append = !append;
204  }
205 
206  for(stackPos = 0; stackPos < size; ++stackPos) {
207  const int otherPriority = m_things[stackPos]->getStackPriority();
208  if((append && otherPriority > priority) || (!append && otherPriority >= priority))
209  break;
210  }
211  } else if(stackPos > static_cast<int>(size))
212  stackPos = size;
213 
214  m_things.insert(m_things.begin() + stackPos, thing);
215 
216  if(thing->isCreature()) {
217  const CreaturePtr& creature = thing->static_self_cast<Creature>();
218  m_creatures.push_back(creature);
219  if(thing->isLocalPlayer()) m_localPlayer = creature;
220  } else {
221  const auto& item = thing->static_self_cast<Item>();
222 
223  if(item->hasAnimationPhases()) m_animatedItems.push_back(item);
224 
225  if(thing->isGroundBorder() || thing->isGround()) {
226  m_ground.push_back(item);
227  } else if(thing->isOnTop()) {
228  m_topItems.push_back(item);
229  } else if(thing->isOnBottom()) {
230  m_bottomItems.push_back(item);
231  } else {
232  originalStack -= m_ground.size() + m_bottomItems.size() + m_creatures.size();
233 
234  if(originalStack > m_commonItems.size()) {
235  m_commonItems.push_back(item);
236  } else {
237  m_commonItems.insert(m_commonItems.begin() + originalStack, item);
238  }
239  }
240  }
241 
242  analyzeThing(thing, true);
243 
244  if(m_things.size() > MAX_THINGS)
245  removeThing(m_things[MAX_THINGS]);
246 
247  thing->setPosition(m_position);
248  thing->onAppear();
249 
250  if(thing->isTranslucent())
251  checkTranslucentLight();
252 }
253 
254 // TODO: Need refactoring
255 bool Tile::removeThing(const ThingPtr& thing)
256 {
257  if(!thing) return false;
258 
259  if(thing->isEffect()) {
260  const EffectPtr& effect = thing->static_self_cast<Effect>();
261  const auto it = std::find(m_effects.begin(), m_effects.end(), effect);
262  if(it == m_effects.end())
263  return false;
264 
265  analyzeThing(thing, false);
266 
267  m_effects.erase(it);
268  return true;
269  }
270 
271  const auto it = std::find(m_things.begin(), m_things.end(), thing);
272  if(it == m_things.end())
273  return false;
274 
275  analyzeThing(thing, false);
276 
277  if(thing->isCreature()) {
278  const auto subIt = std::find(m_creatures.begin(), m_creatures.end(), thing->static_self_cast<Creature>());
279  if(subIt != m_creatures.end()) {
280  if(thing->isLocalPlayer()) m_localPlayer = nullptr;
281  m_creatures.erase(subIt);
282  }
283  } else {
284  const ItemPtr& item = thing->static_self_cast<Item>();
285 
286  if(item->hasAnimationPhases()) {
287  const auto& subIt = std::find(m_animatedItems.begin(), m_animatedItems.end(), item);
288  if(subIt != m_animatedItems.end()) m_animatedItems.erase(subIt);
289  }
290 
291  if(thing->isGroundBorder() || thing->isGround()) {
292  const auto& subIt = std::find(m_ground.begin(), m_ground.end(), item);
293  if(subIt != m_ground.end()) m_ground.erase(subIt);
294  } else if(thing->isOnTop()) {
295  const auto& subIt = std::find(m_topItems.begin(), m_topItems.end(), item);
296  if(subIt != m_topItems.end()) m_topItems.erase(subIt);
297  } else if(thing->isOnBottom()) {
298  const auto& subIt = std::find(m_bottomItems.begin(), m_bottomItems.end(), item);
299  if(subIt != m_bottomItems.end()) m_bottomItems.erase(subIt);
300  } else {
301  const auto& subIt = std::find(m_commonItems.begin(), m_commonItems.end(), item);
302  if(subIt != m_commonItems.end()) m_commonItems.erase(subIt);
303  }
304  }
305 
306  m_things.erase(it);
307 
308  thing->onDisappear();
309 
310  if(thing->isTranslucent())
311  checkTranslucentLight();
312 
313  return true;
314 }
315 
317 {
318  if(stackPos >= 0 && stackPos < static_cast<int>(m_things.size()))
319  return m_things[stackPos];
320 
321  return nullptr;
322 }
323 
325 {
326  for(int stackpos = -1, s = m_things.size(); ++stackpos < s;) {
327  if(thing == m_things[stackpos]) return stackpos;
328  }
329 
330  return -1;
331 }
332 
333 bool Tile::hasThing(const ThingPtr& thing)
334 {
335  return std::find(m_things.begin(), m_things.end(), thing) != m_things.end();
336 }
337 
339 {
340  if(isEmpty())
341  return nullptr;
342 
343  if(!m_commonItems.empty()) return m_commonItems.front();
344 
345  return m_things[m_things.size() - 1];
346 }
347 
348 std::vector<ItemPtr> Tile::getItems()
349 {
350  std::vector<ItemPtr> items;
351 
352  for(const ThingPtr& thing : m_things) {
353  if(thing->isItem())
354  items.push_back(thing->static_self_cast<Item>());
355  }
356 
357  return items;
358 }
359 
361 {
362  if(m_ground.empty()) return nullptr;
363 
364  return m_ground.front();
365 }
366 
368 {
369  for(const EffectPtr& effect : m_effects)
370  if(effect->getId() == id)
371  return effect;
372 
373  return nullptr;
374 }
375 
377 {
378  if(const ItemPtr& ground = getGround())
379  return ground->getGroundSpeed();
380 
381  return 100;
382 }
383 
385 {
386  if(m_minimapColor != 0)
387  return m_minimapColor;
388 
389  if(!m_topItems.empty()) {
390  const uint8 c = m_topItems.back()->getMinimapColor();
391  if(c != 0) return c;
392  }
393 
394  if(!m_bottomItems.empty()) {
395  const uint8 c = m_bottomItems.back()->getMinimapColor();
396  if(c != 0) return c;
397  }
398 
399  const auto& ground = getGround();
400  if(ground) {
401  const uint8 c = ground->getMinimapColor();
402  if(c != 0) return c;
403  }
404 
405  return 255; // alpha
406 }
407 
409 {
410  if(isEmpty()) return nullptr;
411 
412  for(auto it = m_topItems.rbegin(); it != m_topItems.rend(); ++it) {
413  const ItemPtr& item = *it;
414  if(!item->isIgnoreLook()) return item;
415  }
416 
417  if(!m_creatures.empty()) return m_creatures.back();
418 
419  for(const auto& item : m_commonItems) {
420  if(!item->isIgnoreLook()) return item;
421  }
422 
423  for(auto it = m_bottomItems.rbegin(); it != m_bottomItems.rend(); ++it) {
424  const ItemPtr& item = *it;
425  if(!item->isIgnoreLook()) return item;
426  }
427 
428  for(auto it = m_ground.rbegin(); it != m_ground.rend(); ++it) {
429  const ItemPtr& item = *it;
430  if(!item->isIgnoreLook()) return item;
431  }
432 
433  return nullptr;
434 }
435 
437 {
438  if(isEmpty()) return nullptr;
439 
440  for(const auto& item : m_commonItems) {
441  if(item->isForceUse()) return item;
442  }
443 
444  for(auto it = m_bottomItems.rbegin(); it != m_bottomItems.rend(); ++it) {
445  const ItemPtr& item = *it;
446  if(item->isForceUse()) return item;
447  }
448 
449  for(auto it = m_ground.rbegin(); it != m_ground.rend(); ++it) {
450  const ItemPtr& item = *it;
451  if(item->isForceUse()) return item;
452  }
453 
454  if(!m_topItems.empty()) return m_topItems.back();
455  if(!m_commonItems.empty()) return m_commonItems.front();
456  if(!m_bottomItems.empty()) return m_bottomItems.back();
457 
458  return m_ground.front();
459 }
460 
462 {
463  const CreaturePtr creature;
464  if(!m_creatures.empty())
465  return m_creatures.back();
466 
467  if(!m_walkingCreatures.empty())
468  return m_walkingCreatures.back();
469 
470  // check for walking creatures in tiles around
471  if(!creature) {
472  for(int xi = -1; xi <= 1; ++xi) {
473  for(int yi = -1; yi <= 1; ++yi) {
474  Position pos = m_position.translated(xi, yi);
475  if(pos == m_position)
476  continue;
477 
478  const TilePtr& tile = g_map.getTile(pos);
479  if(tile) {
480  for(const CreaturePtr& c : tile->getCreatures()) {
481  if(c->isWalking() && c->getLastStepFromPosition() == m_position && c->getStepProgress() < 0.75f) {
482  return c;
483  }
484  }
485  }
486  }
487  }
488  }
489  return nullptr;
490 }
491 
493 {
494  if(isEmpty())
495  return nullptr;
496 
497  for(const ThingPtr& thing : m_commonItems) {
498  if(!thing->isNotMoveable()) return thing;
499  }
500 
501  if(hasCreature()) return m_creatures.back();
502 
503  return nullptr;
504 }
505 
507 {
508  if(isEmpty()) return nullptr;
509 
510  if(CreaturePtr topCreature = getTopCreature())
511  return topCreature;
512 
513  for(const ThingPtr& thing : m_commonItems) {
514  if(thing->isForceUse()) return thing;
515  }
516 
517  for(auto it = m_bottomItems.rbegin(); it != m_bottomItems.rend(); ++it) {
518  const ItemPtr& thing = *it;
519  if(thing->isForceUse()) return thing;
520  }
521 
522  if(!m_commonItems.empty()) return m_commonItems.front();
523  if(!m_bottomItems.empty()) return m_bottomItems.back();
524 
525  return m_ground.front();
526 }
527 
528 bool Tile::isWalkable(bool ignoreCreatures)
529 {
530  if(m_countFlag.notWalkable > 0 || m_ground.empty()) {
531  return false;
532  }
533 
534  if(!ignoreCreatures) {
535  for(const CreaturePtr& creature : m_creatures) {
536  if(!creature->isPassable() && creature->canBeSeen())
537  return false;
538  }
539  }
540 
541  return true;
542 }
543 
545 {
546  return m_countFlag.notPathable == 0;
547 }
548 
550 {
551  return m_countFlag.fullGround > 0;
552 }
553 
555 {
556  return isFullGround() || m_countFlag.opaque > 0;
557 }
558 
560 {
561  return m_countFlag.notSingleDimension == 0 && m_walkingCreatures.empty();
562 }
563 
565 {
566  return m_countFlag.blockProjectile == 0;
567 }
568 
570 {
571  return getTopLookThing() && (!m_ground.empty() || !m_bottomItems.empty());
572 }
573 
575 {
576  return m_things.empty();
577 }
578 
580 {
581  return m_walkingCreatures.empty() && m_effects.empty() && isEmpty() && m_flags == 0 && m_minimapColor == 0;
582 }
583 
585 {
586  return !isEmpty() || !m_walkingCreatures.empty() || !m_effects.empty();
587 }
588 
590 {
591  for(const ItemPtr& thing : m_bottomItems)
592  if(thing->isHookEast())
593  return true;
594 
595  return false;
596 }
597 
599 {
600  for(const ItemPtr& thing : m_bottomItems)
601  if(thing->isHookSouth())
602  return true;
603 
604  return false;
605 }
606 
608 {
609  return !m_creatures.empty();
610 }
611 
612 bool Tile::limitsFloorsView(bool isFreeView)
613 {
614  // ground and walls limits the view
615  const ThingPtr& firstThing = getThing(0);
616  return firstThing && (firstThing->isGround() || (isFreeView ? firstThing->isOnBottom() && firstThing->blockProjectile() : firstThing->isOnBottom()));
617 }
618 
620 {
621  return m_countFlag.elevation;
622 }
623 
624 bool Tile::hasElevation(int elevation)
625 {
626  return getElevation() >= elevation;
627 }
628 
630 {
631  return m_countFlag.hasLight > 0;
632 }
633 
634 void Tile::checkTranslucentLight()
635 {
636  if(m_position.z != Otc::SEA_FLOOR)
637  return;
638 
639  Position downPos = m_position;
640  if(!downPos.down()) return;
641 
642  TilePtr tile = g_map.getOrCreateTile(downPos);
643  if(!tile)
644  return;
645 
646  for(const ThingPtr& thing : m_things) {
647  if(thing->isTranslucent() || thing->hasLensHelp()) {
648  tile->m_flags |= TILESTATE_TRANSLUECENT_LIGHT;
649  return;
650  }
651  }
652 
653  tile->m_flags &= ~TILESTATE_TRANSLUECENT_LIGHT;
654 }
655 
657 {
658  if(m_animatedItems.empty()) return;
659 
660  for(const ItemPtr& item : m_animatedItems)
661  item->cancelListenerPainter();
662 
663  m_animatedItems.clear();
664 }
665 
666 void Tile::analyzeThing(const ThingPtr& thing, bool add)
667 {
668  const int value = add ? 1 : -1;
669 
670  if(thing->hasLight())
671  m_countFlag.hasLight += value;
672 
673  if(thing->hasDisplacement())
674  m_countFlag.hasDisplacement += value;
675 
676  if(thing->isEffect()) return;
677 
678  // Creatures and items
679 
680  if(thing->getRealSize() > Otc::TILE_PIXELS)
681  m_countFlag.notSingleDimension += value;
682 
683  if(thing->hasLight())
684  m_countFlag.hasLight += value;
685 
686  if(!thing->isItem()) return;
687 
688  if(thing->isNotWalkable())
689  m_countFlag.notWalkable += value;
690 
691  if(thing->isNotPathable())
692  m_countFlag.notPathable += value;
693 
694  if(thing->blockProjectile())
695  m_countFlag.blockProjectile += value;
696 
697  if(thing->isHookEast())
698  m_countFlag.mustHookEast += value;
699 
700  if(thing->isHookSouth())
701  m_countFlag.mustHookSouth += value;
702 
703  m_countFlag.totalElevation += thing->getElevation() * value;
704 
705  if(thing->isFullGround())
706  m_countFlag.fullGround += value;
707 
708  if(thing->hasElevation())
709  m_countFlag.elevation += value;
710 
711  if(thing->isOpaque())
712  m_countFlag.opaque += value;
713 
714  // Check that the item is opaque, so that it does not draw anything that is less than or equal below it.
715  if(thing->isOpaque() && !thing->isOnTop() && !thing->isGround() && !thing->isGroundBorder()) {
716  const int commonSize = m_commonItems.size();
717  if(m_countFlag.elevation > (add ? 3 : 2) && commonSize > 2) {
718  const ItemPtr& subItem = m_commonItems[1];
719  subItem->canDraw(!add);
720  } else {
721  const ItemPtr& item = thing->static_self_cast<Item>();
722 
723  if(!thing->isOnBottom()) {
724  for(const ItemPtr& subItem : m_commonItems) {
725  if(subItem != item) {
726  if(subItem->hasElevation() || subItem->isOpaque()) return;
727 
728  if(subItem->getWidth() == 1 && subItem->getHeight() == 1) {
729  subItem->canDraw(!add);
730  }
731  }
732  }
733  }
734 
735  for(auto it = m_bottomItems.rbegin(); it != m_bottomItems.rend(); ++it) {
736  const ItemPtr& subItem = *it;
737  if(subItem != item) {
738  if(subItem->hasElevation() || subItem->isOpaque()) return;
739 
740  if(subItem->getWidth() == 1 && subItem->getHeight() == 1) {
741  subItem->canDraw(!add);
742  }
743  }
744  }
745 
746  for(const ItemPtr& subItem : m_ground) {
747  if(subItem->hasElevation()) return;
748 
749  if(subItem->getWidth() == 1 && subItem->getHeight() == 1) {
750  subItem->canDraw(!add);
751  }
752  }
753  }
754  }
755 }
thingtypemanager.h
Otc::TILE_PIXELS
@ TILE_PIXELS
Definition: const.h:33
lightview.h
Tile::getTopMultiUseThing
ThingPtr getTopMultiUseThing()
Definition: tile.cpp:506
Thing::hasElevation
bool hasElevation()
Definition: thing.h:116
g_map
Map g_map
Definition: map.cpp:36
Tile::analyzeThing
void analyzeThing(const ThingPtr &thing, bool add)
Definition: tile.cpp:666
Tile::isClickable
bool isClickable()
Definition: tile.cpp:569
Tile::getGroundSpeed
int getGroundSpeed()
Definition: tile.cpp:376
Item::canDraw
void canDraw(bool canDraw)
Definition: item.h:151
Thing::isIgnoreLook
bool isIgnoreLook()
Definition: thing.h:122
TPoint::y
T y
Definition: point.h:83
Tile::removeThing
bool removeThing(const ThingPtr &thing)
Definition: tile.cpp:255
Tile::drawGround
void drawGround(const Point &dest, float scaleFactor, int reDrawFlags, LightView *lightView=nullptr)
Definition: tile.cpp:47
Tile::isDrawable
bool isDrawable()
Definition: tile.cpp:584
Position::x
int x
Definition: position.h:265
Effect
Definition: effect.h:31
Tile::hasLight
bool hasLight()
Definition: tile.cpp:629
Tile::isWalkable
bool isWalkable(bool ignoreCreatures=false)
Definition: tile.cpp:528
Tile::mustHookEast
bool mustHookEast()
Definition: tile.cpp:589
Tile::getTopLookThing
ThingPtr getTopLookThing()
Definition: tile.cpp:408
Tile::addThing
void addThing(const ThingPtr &thing, int stackPos)
Definition: tile.cpp:153
Tile::getTopCreature
CreaturePtr getTopCreature()
Definition: tile.cpp:461
Creature
Definition: creature.h:37
Tile::getItems
std::vector< ItemPtr > getItems()
Definition: tile.cpp:348
Tile::clean
void clean()
Definition: tile.cpp:127
Tile::getGround
ItemPtr getGround()
Definition: tile.cpp:360
Tile::limitsFloorsView
bool limitsFloorsView(bool isFreeView=false)
Definition: tile.cpp:612
Thing::isOpaque
bool isOpaque()
Definition: thing.h:129
Game::getClientVersion
int getClientVersion()
Definition: game.h:318
Map::getTile
const TilePtr & getTile(const Position &pos)
Definition: map.cpp:358
Otc::MAX_ELEVATION
@ MAX_ELEVATION
Definition: const.h:34
Tile::mustHookSouth
bool mustHookSouth()
Definition: tile.cpp:598
Tile::addWalkingCreature
void addWalkingCreature(const CreaturePtr &creature)
Definition: tile.cpp:139
Tile::MAX_THINGS
@ MAX_THINGS
Definition: tile.h:60
Otc::SEA_FLOOR
@ SEA_FLOOR
Definition: const.h:36
g_game
Game g_game
Definition: game.cpp:37
Tile::getThing
ThingPtr getThing(int stackPos)
Definition: tile.cpp:316
Point
TPoint< int > Point
Definition: point.h:86
Position::y
int y
Definition: position.h:266
Tile::getThingStackPos
int getThingStackPos(const ThingPtr &thing)
Definition: tile.cpp:324
Tile::drawTop
void drawTop(const Point &dest, float scaleFactor, int reDrawFlags, LightView *lightView)
Definition: tile.cpp:109
Tile::getMinimapColorByte
uint8 getMinimapColorByte()
Definition: tile.cpp:384
Tile::removeWalkingCreature
void removeWalkingCreature(const CreaturePtr &creature)
Definition: tile.cpp:144
LightView
Definition: lightview.h:37
Tile::canErase
bool canErase()
Definition: tile.cpp:579
Position::z
short z
Definition: position.h:267
uint16
uint16_t uint16
Definition: types.h:36
localplayer.h
Position::translated
Position translated(int dx, int dy, short dz=0) const
Definition: position.h:201
Tile::getCreatures
std::vector< CreaturePtr > getCreatures()
Definition: tile.h:94
TILESTATE_TRANSLUECENT_LIGHT
@ TILESTATE_TRANSLUECENT_LIGHT
Definition: tile.h:51
Tile::draw
void draw(const Point &dest, float scaleFactor, int reDrawFlags, LightView *lightView=nullptr)
Definition: tile.cpp:120
Position
Definition: position.h:33
Tile::getElevation
int getElevation() const
Definition: tile.cpp:619
Tile::getTopUseThing
ThingPtr getTopUseThing()
Definition: tile.cpp:436
Tile::Tile
Tile(const Position &position)
Definition: tile.cpp:37
Tile::isSingleDimension
bool isSingleDimension()
Definition: tile.cpp:559
Tile::isFullGround
bool isFullGround()
Definition: tile.cpp:549
map.h
TPoint::x
T x
Definition: point.h:83
Tile::hasElevation
bool hasElevation(int elevation=1)
Definition: tile.cpp:624
Thing::hasAnimationPhases
bool hasAnimationPhases()
Definition: thing.h:79
Map::getOrCreateTile
const TilePtr & getOrCreateTile(const Position &pos)
Definition: map.cpp:337
Tile::hasThing
bool hasThing(const ThingPtr &thing)
Definition: tile.cpp:333
Tile::isFullyOpaque
bool isFullyOpaque()
Definition: tile.cpp:554
Item
Definition: item.h:76
fontmanager.h
Tile::cancelListenerPainter
void cancelListenerPainter()
Definition: tile.cpp:656
Tile::getTopThing
ThingPtr getTopThing()
Definition: tile.cpp:338
Position::down
bool down(int n=1)
Definition: position.h:232
effect.h
stdext::shared_object_ptr< Creature >
Tile::hasCreature
bool hasCreature()
Definition: tile.cpp:607
Tile::getEffect
EffectPtr getEffect(uint16 id)
Definition: tile.cpp:367
Tile::isPathable
bool isPathable()
Definition: tile.cpp:544
game.h
Thing::getHeight
int getHeight()
Definition: thing.h:68
Thing::isForceUse
bool isForceUse()
Definition: thing.h:96
protocolgame.h
TPoint< int >
Thing::getWidth
int getWidth()
Definition: thing.h:67
tile.h
Tile::getTopMoveThing
ThingPtr getTopMoveThing()
Definition: tile.cpp:492
Tile::isEmpty
bool isEmpty()
Definition: tile.cpp:574
Tile::drawBottom
void drawBottom(const Point &dest, float scaleFactor, int reDrawFlags, LightView *lightView=nullptr)
Definition: tile.cpp:59
uint8
uint8_t uint8
Definition: types.h:37
Tile::isLookPossible
bool isLookPossible()
Definition: tile.cpp:564
item.h