thing.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef thing_H_INCLUDED
  2. #define thing_H_INCLUDED
  3. #include "camera.h"
  4. #include "bump.h"
  5. #include "sprite.h"
  6. typedef struct Thing_ Thing;
  7. /* Thing types. Generally speaking, there are
  8. things that can move and those that cannot.
  9. Chipmunks treats them differently in the sense that
  10. static things will all use a single (or one of
  11. a few) static bodies, which does not need to be
  12. freed when the thing isn't needed anymore.
  13. */
  14. #define THING_UNUSED -1
  15. #define THING_WALL 1
  16. #define THING_WATER 2
  17. #define THING_STAIR 3
  18. #define THING_ACTOR 4
  19. #define THING_MOBILE 5
  20. #define THING_ZONE 6
  21. #define THING_SEARCH 10
  22. #define THING_ATTACK 11
  23. #define THING_EFFECT 12
  24. #define THING_LINKED_MAX 16
  25. enum Thingflags_ {
  26. THING_FLAGS_OWNBODY = 1,
  27. THING_FLAGS_OWNSHAPE = 2,
  28. /* Thing doesn't change direction even when moving. */
  29. THING_FLAGS_LOCK_DIRECTION = 4,
  30. /* Persistent things are to be copied from one map to the next.
  31. Especially useful (and automatcical) for PCs. */
  32. THING_FLAGS_PERSISTENT = 8,
  33. THING_FLAGS_NO_SHADOW = 16, /* > Thing does not cast a shadow. */
  34. };
  35. int thing_id(Thing * thing);
  36. int thing_id_(Thing * thing, int newid);
  37. Thing * thing_z_(Thing * self, int z);
  38. int thing_setflag(Thing * self, int flag);
  39. int thing_unsetflag(Thing * self, int flag);
  40. int thing_flag_(Thing * self, int flag, int set);
  41. int thing_flag(Thing * self, int flag);
  42. Thing * thing_done(Thing * self);
  43. Thing * thing_free(Thing * self);
  44. Thing * thing_alloc();
  45. Sprite * thing_sprite_(Thing * thing, Sprite * sprite);
  46. Sprite * thing_sprite(Thing * thing);
  47. int thing_pose_(Thing * thing, int pose);
  48. int thing_direction_(Thing * thing, int direction);
  49. int thing_static_p(Thing * self);
  50. BeVec thing_p(Thing * self);
  51. int thing_x(Thing * self);
  52. int thing_y(Thing * self);
  53. int thing_w(Thing * self);
  54. int thing_h(Thing * self);
  55. int thing_cx(Thing * self);
  56. int thing_cy(Thing * self);
  57. int thing_z(Thing * self);
  58. BeVec thing_v(Thing * self);
  59. int thing_vx(Thing * self);
  60. int thing_vy(Thing * self);
  61. void thing_v_(Thing * self, BeVec v);
  62. void thing_vxy_(Thing * self, int vx, int vy);
  63. void thing_vx_(Thing * self, int vx);
  64. void thing_vy_(Thing * self, int vy);
  65. void thing_p_(Thing * self, BeVec p);
  66. void thing_deltap(Thing * self, BeVec delta);
  67. void thing_pxy_(Thing * self, int x, int y);
  68. void thing_x_(Thing * self, int x);
  69. void thing_y_(Thing * self, int y);
  70. void thing_applyforce(Thing * thing, const BeVec f);
  71. void thing_applyimpulse(Thing * thing, const BeVec f);
  72. void thing_resetforces(Thing * thing);
  73. BeVec thing_sdp(Thing * self);
  74. void thing_draw(Thing * self, Camera * camera);
  75. int thing_direction(Thing * self);
  76. int thing_pose(Thing * self);
  77. int thing_poseifold_(Thing * self, int oldpose, int newpose);
  78. void thing_update(Thing * self, double dt);
  79. int thing_compare_for_drawing(const void * p1, const void * p2);
  80. int thing_tint_layer(Thing * me, int layer_index, Color color);
  81. int thing_hide_layer(Thing * me, int layer, int hidden);
  82. int thing_is_layer_hidden(Thing * me, int layer);
  83. int thing_set_action_loop(Thing * me, int action, int loopmode);
  84. int thing_get_action_loop(Thing * me, int action);
  85. int thing_is_action_done(Thing * me, int action);
  86. int thing_set_pose_direction_loop(Thing * me, int pose, int direction, int loopmode);
  87. int thing_get_pose_direction_loop(Thing * me, int pose, int direction);
  88. /* This is declared here to avoid a cyclical dependency. */
  89. Thing * camera_track_ (Camera * self , Thing * track );
  90. BumpHull * thing_add_hull(Thing * me, int kind, int x, int y, int z, int w, int h);
  91. int thing_set_hull_flag(Thing * me, int flag);
  92. int thing_unset_hull_flag(Thing * me, int flag);
  93. int thing_hull_flags_(Thing * me, int flags);
  94. int thing_hull_flags(Thing * me);
  95. int thing_hull_group(Thing * me);
  96. int thing_hull_group_(Thing * me, int group);
  97. #endif