home · contact · privacy
Added primitive inventory system. Any objects may now own/contain/carry other objects.
[plomrogue] / src / map_object_actions.h
index d67e8bb5d595c75a74b05d71d35f979627578daf..30bbae39f1a3b344401df31ff9620c930d377180 100644 (file)
@@ -1,15 +1,58 @@
+/* map_object_actions.h
+ *
+ * Routines for the actions available to map objects.
+ */
+
 #ifndef MAP_OBJECT_ACTIONS_H
 #define MAP_OBJECT_ACTIONS_H
 
-#include "yx_uint16.h"
 
+
+#include "yx_uint16.h" /* for yx_uint16 coordinates */
 struct World;
 struct Map;
-struct Monster;
+struct MapObj;
+
+
+
+/* Try to move "actor" one step in direction "d" and handle the consequences:
+ * either the move succeeds, or another actor is encountered and hit (which leads
+ * to its lifepoint decreasing by one and potentially its death), or the target
+ * square is not passable and the move fails.
+ */
+extern uint8_t move_actor(struct World * world, struct MapObj * actor,
+                          enum dir d);
+
+
+
+/* Wrapper for using move_actor() on the MapObj representing the player; updates
+ * the game log with appropriate messages on the move attempt and its results;
+ * turns over to turn_over() when finished.
+ */
+extern void move_player(struct World * world, enum dir d);
+
+
+
+/* Make player wait one turn, i.e. only update_log with a "you wait" message
+ * and turn control over to the enemy.
+ */
+extern void player_wait(struct World * world);
+
+
+
+/* Check if coordinate pos on (or beyond) map is accessible to map object
+ * movement.
+ */
+extern char is_passable(struct Map * map, struct yx_uint16 pos);
+
+
+
+/* Make player drop to ground map ojbect indexed by world.inventory_select. */
+extern void player_drop(struct World * world);
+
+/* Make player pick up map object from ground. */
+extern void player_pick(struct World * world);
+
 
-extern char is_passable (struct Map *, struct yx_uint16);
-extern void move_monster (struct World *, struct Monster *);
-extern void move_player (struct World *, char);
-extern void player_wait(struct World *);
 
 #endif