This replaces the previous "MAGIC MEAT" hardcoding.
ASCII character used to represent the object visually on the map, the fourth
value is the number of hitpoints the object starts with (items are dead and
start with zero hitpoints, anything else moves), the fifth is the string that
-names the object in the game log. Finally, the same delimiter as for the map
-object action definitions file follows. Note that the only valid item use so
-far, consuming "magic meat" to gain hitpoints, is so far hard-coded (this should
-change in the future).
+names the object in the game log, the sixth defines if the object is consumable
+(it is if it is non-zero) and how many hitpoints are gained if it is. Finally,
+the same delimiter as for the map object action definitions file follows.
All source files are thoroughly documented to explain more details of
plomrogue's internals. The ./roguelike-server executable can be run with a -v
- for game continuation, replace re-playing of whole record files with loading
game state snapshots / save files
+- rename confserver/defs to confserver/map_objects
+
CLIENT:
- enable toggling of window borders
0
5
@
-5
+105
HUMAN
+0
%%
1
4
a
1
ANT
+0
%%
2
5
z
3
ZOMBIE
+0
%%
3
6
S
9
SHOGGOTH
+0
%%
4
4
#
0
DIRT
+0
%%
5
4
%
0
SKELETON
+0
%%
6
4
m
0
MAGIC MEAT
+5
%%
struct MapObj * selected = mo->owns;
for (; i != select; i++, selected = selected->next);
struct MapObjDef * mod = get_map_object_def(selected->type);
- if (!strcmp("MAGIC MEAT", mod->name))
+ if (mod->consumable)
{
wrong_object = 0;
struct MapObj * next = selected->next;
{
mo->owns = next;
}
- mo->lifepoints++;
+ mo->lifepoints = mo->lifepoints + mod->consumable;
}
}
if (mo == get_player())
extern void actor_pick(struct MapObj * mo);
/* Actor "mo" tries to use inventory object indexed by number mo->args.
- * (Currently the only valid use is consuming an item named "MAGIC MEAT",
- * which increments the actors lifepoints.)
+ * (Currently the only valid use is consuming items defined as consumable.)
*/
extern void actor_use(struct MapObj * mo);
line[strlen(line) - 1] = '\0';
mod->name = try_malloc(strlen(line) + 1, f_name);
memcpy(mod->name, line, strlen(line) + 1);
+ err_try_fgets(line, linemax, file, context, "0nfi");
+ err_line(atoi(line) > UINT8_MAX, line, context, err_toolarge);
+ mod->consumable = atoi(line);
* last_mod_ptr_ptr = mod;
last_mod_ptr_ptr = &mod->next;
err_try_fgets(line, linemax, file, context, "d");
uint8_t id; /* map object definition identifier / sets .type */
uint8_t corpse_id; /* type to change map object into upon destruction */
uint8_t lifepoints; /* default start value for map object's .lifepoints */
+ uint8_t consumable; /* can be eaten if !0, for so much hitpoint win */
};