4 #include "lvl_base_object.h"
5 #include <data_configs/obj_npc.h>
7 #include <common_features/npc_animator.h>
8 #include <common_features/event_queue.h>
9 #include <common_features/pointf.h>
10 #include "npc_detectors/lvl_base_detector.h"
11 #include "npc_detectors/lvl_dtc_player_pos.h"
12 #include "npc_detectors/lvl_dtc_contact.h"
13 #include "npc_detectors/lvl_dtc_inarea.h"
15 #include <luabind/luabind.hpp>
16 #include <lua_inclues/lua.hpp>
35 void setDirection(
int dir);
41 bool is_shared_animation;
42 bool keep_position_on_despawn;
54 DAMAGE_BY_PLAYER_ATTACK,
61 void doHarm(
int damageReason);
62 void harm(
int damage=1,
int damageReason = DAMAGE_NOREASON);
66 void kill(
int damageReason);
70 int taskToTransform_t;
71 void transformTo(
long id,
int type=0);
72 void transformTo_x(
long id);
74 void update(
float tickTime);
75 void render(
double camX,
double camY);
80 void updateCollisions();
93 QHash<int, PGE_Phys_Object*> contacted_blocks;
94 QHash<int, PGE_Phys_Object*> contacted_bgos;
95 QHash<int, PGE_Phys_Object*> contacted_npc;
96 QHash<int, PGE_Phys_Object*> contacted_players;
98 typedef QHash<int, PGE_Phys_Object*> PlayerColliders;
99 QHash<int, PGE_Phys_Object*> collided_top;
100 QHash<int, PGE_Phys_Object*> collided_left;
101 QHash<int, PGE_Phys_Object*> collided_right;
102 QHash<int, PGE_Phys_Object*> collided_bottom;
103 QHash<int, PGE_Phys_Object*> collided_center;
104 bool disableBlockCollision;
105 bool disableNpcCollision;
113 QHash<int, int > environments_map;
116 int last_environment;
123 bool offSectionDeactivate;
124 int activationTimeout;
151 void setSpriteWarp(
float depth, WarpingSide _direction=WARP_BOTTOM,
bool resizedBody=
false);
152 void resetSpriteWarp();
155 bool warpResizedBody;
156 float warpSpriteOffset;
169 float generatorTimeLeft;
171 int generatorDirection;
172 void updateGenerator(
float tickTime);
176 void resetThrowned();
177 void setThrownedByNpc(
long npcID,
LVL_Npc *npcObj);
178 void setThrownedByPlayer(
long playerID,
LVL_Player *npcObj);
179 long thrownedByNpc();
181 long thrownedByPlayer();
183 long throwned_by_npc;
185 long throwned_by_player;
191 void buildBuddieGroup();
192 void updateBuddies(
float tickTime);
193 void buildLeaf(QList<LVL_Npc*> &needtochec, QList<LVL_Npc*> *&list,
LVL_Npc *leader);
194 QList<LVL_Npc*> *buddies_list;
195 bool buddies_updated;
236 virtual void lua_onActivated() {}
237 virtual void lua_onLoop(
float) {}
238 virtual void lua_onInit() {}
239 virtual void lua_onKill(
int) {}
240 virtual void lua_onHarm(
int,
int) {}
241 virtual void lua_onTransform(
long) {}
244 void lua_setSequenceLeft(luabind::object frames);
245 void lua_setSequenceRight(luabind::object frames);
246 void lua_setSequence(luabind::object frames);
247 void lua_setOnceAnimation(
bool en);
248 bool lua_animationIsFinished();
249 int lua_frameDelay();
250 void lua_setFrameDelay(
int ms);
251 int lua_activate_neighbours();
252 LVL_Npc *lua_spawnNPC(
int npcID,
int sp_type,
int sp_dir,
bool reSpawnable=
false);
254 inline bool not_movable() {
return data.
nomove; }
255 inline void setNot_movable(
bool n) { data.
nomove=n; }
257 inline void setSpecial1(
long s) { data.
special_data=s; }
260 inline bool isBoss() {
return data.
is_boss; }
261 inline int getID() {
return data.
id; }
262 inline long getHealth() {
return health; }
263 inline void setHealth(
int _health) { health=_health; }
264 inline bool getCollideWithBlocks() {
return !disableBlockCollision; }
265 inline void setCollideWithBlocks(
bool blkcol) { disableBlockCollision=!blkcol; }
void setWarpSpawn(WarpingSide side=WARP_TOP)
Definition: lvl_npc_spritewarp.cpp:39
QVector< BasicDetector * > detectors
Detects contacted elements.
Definition: lvl_npc.h:135
Definition: lvl_dtc_inarea.h:8
long special_data2
User-data integer #2 used for configuring some NPC-AI's (kept for SMBX64)
Definition: lvl_filedata.h:202
InAreaDetector * lua_installInAreaDetector(float left, float top, float right, float bottom, luabind::adl::object filters)
Is player touches selected relative area;.
Definition: lvl_npc_lua.cpp:127
void unregister()
In-Game destroying of NPC with triggering of specific events.
Definition: lvl_npc_kill.cpp:145
bool nomove
NPC will stay idle and will always keep look to the playable character.
Definition: lvl_filedata.h:209
bool forceCollideCenter
collide with invizible blocks at center
Definition: lvl_npc.h:82
void show()
Definition: lvl_npc.cpp:88
void setSpriteWarp(float depth, WarpingSide _direction=WARP_BOTTOM, bool resizedBody=false)
setSpriteWarp Changes warping state of a sprite
Definition: lvl_npc_spritewarp.cpp:23
Definition: npc_animator.h:33
bool is_boss
Enables some boss-specific NPC-AI features (Used by NPC-AI)
Definition: lvl_filedata.h:210
Definition: lvl_npc.h:216
Level specific NPC entry structure. Defines preferences of each NPC.
Definition: lvl_filedata.h:195
QList< BasicDetector > detectors_dummy
dummy detectors made directly from a base class, for a some tests
Definition: lvl_npc.h:127
long special_data
User-data integer #1 used for configuring some NPC-AI's (kept for SMBX64)
Definition: lvl_filedata.h:201
QList< InAreaDetector > detectors_inarea
Detects position and direction of nearest player.
Definition: lvl_npc.h:130
Definition: lvl_npc.h:199
Definition: lvl_dtc_player_pos.h:9
PlayerPosDetector * lua_installPlayerPosDetector()
Player position detectors (should have alone copy!)
Definition: lvl_npc_lua.cpp:119
void Activate()
Definition: lvl_npc_activate.cpp:22
Definition: lvl_player.h:39
QHash< int, int > foot_sl_contacts_map
Slipery surfaces.
Definition: lvl_npc.h:91
unsigned long id
ID of NPC type defined in the lvl_npc.ini.
Definition: lvl_filedata.h:200
QHash< int, int > foot_contacts_map
staying on ground surfaces
Definition: lvl_npc.h:90
The PGE_Phys_Object class.
Definition: lvl_base_object.h:51
int taskToTransform
Sielent destroying of NPC without triggering of the events.
Definition: lvl_npc.h:69
QList< ContactDetector > detectors_contact
Detects is player(s) are enters into specific area relative to NPC's center.
Definition: lvl_npc.h:132