ManaPlus
Macros | Functions
actorsprite.cpp File Reference

(986a3bf)

#include "being/actorsprite.h"
#include "configuration.h"
#include "statuseffect.h"
#include "being/localplayer.h"
#include "const/utils/timer.h"
#include "gui/theme.h"
#include "listeners/debugmessagelistener.h"
#include "particle/particle.h"
#include "resources/db/statuseffectdb.h"
#include "resources/loaders/imageloader.h"
#include "resources/sprite/animatedsprite.h"
#include "resources/sprite/imagesprite.h"
#include "resources/sprite/spritereference.h"
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/foreach.h"
#include "utils/timer.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define for_each_cursors()
 
#define end_foreach   }
 

Functions

static void applyEffectByOption (ActorSprite *const actor, uint32_t option, const char *const name, const OptionsMap &options)
 
static void applyEffectByOption1 (ActorSprite *const actor, uint32_t option, const char *const name, const OptionsMap &options)
 
static const char * cursorType (const TargetCursorTypeT type)
 
static const char * cursorSize (const TargetCursorSizeT size)
 

Macro Definition Documentation

◆ end_foreach

#define end_foreach   }

Definition at line 62 of file actorsprite.cpp.

◆ for_each_cursors

#define for_each_cursors ( )
Value:

Definition at line 53 of file actorsprite.cpp.

Function Documentation

◆ applyEffectByOption()

static void applyEffectByOption ( ActorSprite *const  actor,
uint32_t  option,
const char *const  name,
const OptionsMap options 
)
static

Definition at line 219 of file actorsprite.cpp.

223 {
224  FOR_EACH (OptionsMapCIter, it, options)
225  {
226  const uint32_t opt = (*it).first;
227  const int32_t id = (*it).second;
228  const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false;
229  option |= opt;
230  option ^= opt;
231  actor->setStatusEffect(id,
232  enable,
233  IsStart_false);
234  }
235  if (option != 0U &&
236  config.getBoolValue("unimplimentedLog"))
237  {
238  const std::string str = strprintf(
239  "Error: unknown effect by %s. "
240  "Left value: %u",
241  name,
242  option);
243  logger->log(str);
245  }
246 }
void setStatusEffect(const int32_t index, const Enable active, const IsStart start)
bool getBoolValue(const std::string &key) const
static void distributeEvent(const std::string &msg)
void log(const char *const log_text,...)
Definition: logger.cpp:269
Configuration config
bool Enable
Definition: enable.h:30
const bool Enable_true
Definition: enable.h:30
const bool Enable_false
Definition: enable.h:30
#define FOR_EACH(type, iter, array)
Definition: foreach.h:25
const bool IsStart_false
Definition: isstart.h:30
Logger * logger
Definition: logger.cpp:89
OptionsMap::const_iterator OptionsMapCIter
std::string strprintf(const char *const format,...)

References config, DebugMessageListener::distributeEvent(), Enable_false, Enable_true, FOR_EACH, Configuration::getBoolValue(), IsStart_false, Logger::log(), logger, ActorSprite::setStatusEffect(), and strprintf().

Referenced by ActorSprite::setStatusEffectOpiton0(), and ActorSprite::setStatusEffectOpitons().

◆ applyEffectByOption1()

static void applyEffectByOption1 ( ActorSprite *const  actor,
uint32_t  option,
const char *const  name,
const OptionsMap options 
)
static

Definition at line 248 of file actorsprite.cpp.

252 {
253  FOR_EACH (OptionsMapCIter, it, options)
254  {
255  const uint32_t opt = (*it).first;
256  const int32_t id = (*it).second;
257  if (opt == option)
258  {
259  actor->setStatusEffect(id,
260  Enable_true,
261  IsStart_false);
262  option = 0U;
263  }
264  else
265  {
266  actor->setStatusEffect(id,
267  Enable_false,
268  IsStart_false);
269  }
270  }
271  if (option != 0 &&
272  config.getBoolValue("unimplimentedLog"))
273  {
274  const std::string str = strprintf(
275  "Error: unknown effect by %s. "
276  "Left value: %u",
277  name,
278  option);
279  logger->log(str);
281  }
282 }

References config, DebugMessageListener::distributeEvent(), Enable_false, Enable_true, FOR_EACH, Configuration::getBoolValue(), IsStart_false, Logger::log(), logger, ActorSprite::setStatusEffect(), and strprintf().

Referenced by ActorSprite::setStatusEffectOpitons().

◆ cursorSize()

static const char* cursorSize ( const TargetCursorSizeT  size)
static

Definition at line 479 of file actorsprite.cpp.

480 {
481  switch (size)
482  {
484  return "l";
486  return "m";
487  default:
490  return "s";
491  }
492 }

References TargetCursorSize::LARGE, TargetCursorSize::MEDIUM, TargetCursorSize::NUM_TC, EmoteDB::size(), and TargetCursorSize::SMALL.

Referenced by ActorSprite::initTargetCursor().

◆ cursorType()

static const char* cursorType ( const TargetCursorTypeT  type)
static

Definition at line 465 of file actorsprite.cpp.

466 {
467  switch (type)
468  {
470  return "in-range";
471  default:
475  return "normal";
476  }
477 }

References TargetCursorType::IN_RANGE, TargetCursorType::NONE, TargetCursorType::NORMAL, and TargetCursorType::NUM_TCT.

Referenced by ActorSprite::initTargetCursor().