diff --git a/docs/tr1/COMMANDS.md b/docs/tr1/COMMANDS.md index 5a71ad981..40bf4c9a4 100644 --- a/docs/tr1/COMMANDS.md +++ b/docs/tr1/COMMANDS.md @@ -24,7 +24,9 @@ Currently supported commands: - `/flood` `/drain` - Floods or drains the current room at will. For when drowning is preferable to puzzles! +- `/flood {room_num}` + `/drain {room_num}` + Floods or drains the chosen room at will. For when drowning is preferable to puzzles! - `/give {item_name}` `/give {num} {item_name}` diff --git a/docs/tr2/COMMANDS.md b/docs/tr2/COMMANDS.md index 6bd7bd120..b1f1d67db 100644 --- a/docs/tr2/COMMANDS.md +++ b/docs/tr2/COMMANDS.md @@ -23,7 +23,9 @@ Currently supported commands: - `/flood` `/drain` - Floods or drains the current room at will. For when drowning is preferable to puzzles! +- `/flood {room_num}` + `/drain {room_num}` + Floods or drains the chosen room at will. For when drowning is preferable to puzzles! - `/give {item_name}` `/give {num} {item_name}` diff --git a/src/libtrx/game/console/cmd/flood.c b/src/libtrx/game/console/cmd/flood.c index 2fb68ab2e..65f73b8d7 100644 --- a/src/libtrx/game/console/cmd/flood.c +++ b/src/libtrx/game/console/cmd/flood.c @@ -7,19 +7,23 @@ static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *ctx); static COMMAND_RESULT M_Entrypoint(const COMMAND_CONTEXT *const ctx) { - if (!String_IsEmpty(ctx->args)) { - return CR_BAD_INVOCATION; - } + int32_t room_num; + if (!String_ParseInteger(ctx->args, &room_num)) { + if (!String_IsEmpty(ctx->args)) { + return CR_BAD_INVOCATION; + } - ITEM *const lara_item = Lara_GetItem(); - if (lara_item == nullptr) { - return CR_UNAVAILABLE; + ITEM *const lara_item = Lara_GetItem(); + if (lara_item == nullptr) { + return CR_UNAVAILABLE; + } + room_num = lara_item->room_num; } if (String_Equivalent(ctx->prefix, "flood")) { - Room_Get(lara_item->room_num)->flags |= RF_UNDERWATER; + Room_Get(room_num)->flags |= RF_UNDERWATER; } else if (String_Equivalent(ctx->prefix, "drain")) { - Room_Get(lara_item->room_num)->flags &= ~RF_UNDERWATER; + Room_Get(room_num)->flags &= ~RF_UNDERWATER; } else { return CR_UNAVAILABLE; }