Files
fallout2-ce/sfall_testing/gl_test_misc.ssl
Mike Klaas a7a7f0b63c Implement sfall signal_close_game (#364)
* Implement sfall `signal_close_game`

Used by Et tu, but might be useful for LLMs too to quit the game after running a test case.

Also added enum for `_user_wants_to_quit`, and did minor reformatting of SFALL_COMPATIBILITY.md
2026-04-10 05:07:43 +00:00

38 lines
1.1 KiB
Plaintext

#include "test_utils.h"
#include "sfall.h"
#include "dik.h"
variable signal_close_game_test_done := false;
procedure keypress_handler begin
variable pressed := get_sfall_arg_at(0);
variable key := get_sfall_arg_at(1);
if (not pressed) then return;
if (key != DIK_J) then return;
if (signal_close_game_test_done) then begin
display_msg("signal_close_game test already triggered");
return;
end
signal_close_game_test_done := true;
display_msg("signal_close_game test triggered");
signal_close_game;
end
procedure start begin
// TODO: move this to a more suitable place, once we have more functions implemented
// These are in the "Other" category in the sfall documentation
display_msg("Testing misc functions...");
variable hand := active_hand;
toggle_active_hand;
call assertEquals("active_hand toggled", active_hand, 1 - hand);
toggle_active_hand;
call assertEquals("active_hand toggled", active_hand, hand);
call report_test_results("misc");
display_msg("signal_close_game manual test ready: press J");
register_hook_proc(HOOK_KEYPRESS, keypress_handler);
end