You can move around a player and meet a number of different enemies. They move
randomly and will only accidentally hit you. You have 5 hitpoints to lose before
death; they have either 1, 3 or 9. Your score grows by killing enemies, to the
-amount of hitpoints each killed enemy started with.
+amount of hitpoints each killed enemy started with. Dead enemies become dirt,
+skeletons or "magic meat"--such objects can be collected, and "magic meat" can
+be consumed to gain hitpoints.
The map gets generated randomly, too.
48 pick pick up object from ground
49 inv_d inventory selection down
50 inv_u inventory selection up
+51 use use selected inventory object
0 5 @ 5 HUMAN
1 4 a 1 ANT
2 5 z 3 ZOMBIE
-3 5 S 9 SHOGGOTH
+3 6 S 9 SHOGGOTH
4 4 # 0 DIRT
5 4 % 0 SKELETON
+6 4 m 0 MAGIC MEAT
100 drop
259 inv_u
258 inv_d
+117 use
if ( try_cmd_0args('i', action, "wait", player_wait)
|| try_cmd_0args('i', action, "drop", player_drop)
|| try_cmd_0args('i', action, "pick", player_pick)
+ || try_cmd_0args('i', action, "use", player_use)
|| try_cmd_1args('i', action, "player_u", move_player, 'N')
|| try_cmd_1args('i', action, "player_d", move_player, 'S')
|| try_cmd_1args('i', action, "player_r", move_player, 'E')
{
break;
}
- if (is_command_id_shortdsc(action, "drop"))
+ if ( is_command_id_shortdsc(action, "drop")
+ || is_command_id_shortdsc(action, "use"))
{
world.inventory_select = getc(file);
}
action = getc(file);
if (EOF != action)
{
- if (is_command_id_shortdsc(action, "drop"))
+ if ( is_command_id_shortdsc(action, "drop")
+ || is_command_id_shortdsc(action, "use"))
{
world.inventory_select = getc(file);
}
}
turn_over(get_command_id("pick"));
}
+
+
+
+extern void player_use()
+{
+ struct MapObj * player = get_player();
+ if (NULL == player->owns)
+ {
+ update_log("\nYou try to use an object, but you own none.");
+ world.old_inventory_select = 0;
+ }
+ else
+ {
+ uint8_t i = 0;
+ struct MapObj * selected = player->owns;
+ for (; i != world.inventory_select; i++, selected = selected->next);
+ struct MapObjDef * mod = get_map_object_def(selected->type);
+ if (!strcmp("MAGIC MEAT", mod->name))
+ {
+ struct MapObj * next = selected->next;
+ free(selected);
+ if (0 < world.inventory_select)
+ {
+ world.old_inventory_select = world.inventory_select;
+ world.inventory_select--;
+ for (i = 0, selected = player->owns;
+ i != world.inventory_select;
+ i++, selected = selected->next);
+ selected->next = next;
+ }
+ else
+ {
+ player->owns = next;
+ }
+ player->lifepoints++;
+ update_log("\nYou consume MAGIC MEAT.");
+ }
+ else
+ {
+ update_log("\nYou try to use this object, but fail.");
+ }
+ }
+ turn_over(get_command_id("use"));
+}
/* Make player pick up map object from ground. */
extern void player_pick();
+/* Make player use object indexed by world.inventory_select. */
+extern void player_use();
+
#endif
}
try_fclose(file_old, f_name);
exit_err(write_uint8(action, file_new), err_write);
- if (is_command_id_shortdsc(action, "drop"))
+ if ( is_command_id_shortdsc(action, "drop")
+ || is_command_id_shortdsc(action, "use"))
{
uint8_t inventory_select = world.old_inventory_select;
exit_err(write_uint8(inventory_select, file_new), err_write);