|
| | ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| int | SECONDS = 180 |
| tuple | OFFSET = (100, -100) |
| int | MIN_PIXELS = 200 |
| int | MIN_GOAL_PIXELS = 20 |
| str | START = 'wait 300\ncg_drawGun 0\nwait 40\nscreenshot opt_on\nwait 40\ncg_drawCompass 0\nwait 40\nscreenshot opt_off\nwait 40\n' |
| str | MOVED = f'cg_drawCompass 1\ncg_hudCompassOffsetX {OFFSET[0]}\ncg_hudCompassOffsetY {OFFSET[1]}\nwait 40\nscreenshot opt_moved\nwait 40\nquit\n' |
| str | OBJECTIVE = 'wait 300\ncg_drawGun 0\nwait 40\nscreenshot opt_goal\nwait 40\nquit\n' |
| dict | OBJECTIVES = {'none': None, 'right': '(2901, 2438, 80)', 'left': '(3201, 1918, 80), "white"', 'ahead': '(2791, 2028, 80)'} |
| int | MIN_WHITE_PIXELS = 100 |
| str | NO_WRITE = 'wait 100\ncg_hudCompassOffsetX 5\nwait 60\nwriteconfig probe\nwait 5\nquit\n' |
The client's own HUD and config options work.
python3 scripts/hud_options_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--keep DIR]
Starts a client (cod2_linux) on its own game of mp_toujane, in the gametype of
hud_align_test.py, looking up at the sky, and takes three screenshots (TGA):
as it starts, with cg_drawCompass 0, and with the compass back at
cg_hudCompassOffsetX and Y. What the first two differ by in the screen's lower
left corner is the compass; the third has to differ from the second OFFSET
away instead of there. A second game with +set com_writeConfig 0 changes a dvar
and leaves no config_mp.cfg, where the first game wrote one. Four more games: no
objective, one to the right of the view, one to the left with a white icon of
its own, which has to show white, and one ahead for a player on a team; each has
to appear on that side of the compass. Exits with 0 when
all of that holds and the client leaves no crash report. --keep copies the
screenshots and the logs to DIR. The client opens a window and needs a CD key
in ~/.cod2/preferences; without one the test is skipped (exit 0).