assert(gc);
assert(scope);
- if (!list_p(args)) {
- return wrong_argument_type(gc, "listp", args);
- }
-
- if (length_of_list(args) != 1) {
- return wrong_number_of_arguments(gc, length_of_list(args));
- }
+ Level * const level = (Level*)param;
+ const char *goal_id = NULL;
- if (!string_p(CAR(args))) {
- return wrong_argument_type(gc, "stringp", args);
+ struct EvalResult result = unpack_args(gc, "s", args, &goal_id);
+ if (result.is_error) {
+ return result;
}
- const char * const goal_id = CAR(args).atom->str;
- Level * const level = (Level*)param;
-
level_show_goal(level, goal_id);
return eval_success(NIL(gc));
return eval_success(NIL(gc));
}
+struct EvalResult
+hide_label(void *param, Gc *gc, struct Scope *scope, struct Expr args)
+{
+ assert(param);
+ assert(gc);
+ assert(scope);
+ (void) args;
+
+ /* TODO: hide-label is not implemented */
+
+ return not_implemented(gc);
+}
+
+struct EvalResult
+show_label(void *param, Gc *gc, struct Scope *scope, struct Expr args)
+{
+ assert(param);
+ assert(gc);
+ assert(scope);
+ (void) args;
+
+ /* TODO: show-label is not implemented */
+
+ return not_implemented(gc);
+}
+
+struct EvalResult
+get_player_jump_count(void *param, Gc *gc, struct Scope *scope, struct Expr args)
+{
+ assert(param);
+ assert(gc);
+ assert(scope);
+ (void) args;
+
+ /* TODO: get-player-jump-count is not implemented */
+
+ return not_implemented(gc);
+}
+
void load_level_library(Gc *gc, struct Scope *scope, Level *level)
{
set_scope_value(
scope,
SYMBOL(gc, "show-goal"),
NATIVE(gc, show_goal, level));
+ set_scope_value(
+ gc,
+ scope,
+ SYMBOL(gc, "show-label"),
+ NATIVE(gc, show_label, level));
+ set_scope_value(
+ gc,
+ scope,
+ SYMBOL(gc, "hide-label"),
+ NATIVE(gc, hide_label, level));
+ set_scope_value(
+ gc,
+ scope,
+ SYMBOL(gc, "get-player-jump-count"),
+ NATIVE(gc, get_player_jump_count, level));
}