OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
hud_options_test Namespace Reference

Functions

 differing (path_a, path_b)
 flipped (path)
 with_objective (gsc, objective, team)
 run (binary, game_dir, home, cfg, extra, log_path)
 main ()

Variables

 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'

Detailed Description

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).

Function Documentation

◆ differing()

hud_options_test.differing ( path_a,
path_b )
The set of (x, y) where two screenshots differ, in file order, and their size. Only compared with each other.

◆ flipped()

hud_options_test.flipped ( path)

◆ main()

hud_options_test.main ( )

◆ run()

hud_options_test.run ( binary,
game_dir,
home,
cfg,
extra,
log_path )

◆ with_objective()

hud_options_test.with_objective ( gsc,
objective,
team )

Variable Documentation

◆ MIN_GOAL_PIXELS

int hud_options_test.MIN_GOAL_PIXELS = 20

◆ MIN_PIXELS

int hud_options_test.MIN_PIXELS = 200

◆ MIN_WHITE_PIXELS

int hud_options_test.MIN_WHITE_PIXELS = 100

◆ MOVED

str hud_options_test.MOVED = f'cg_drawCompass 1\ncg_hudCompassOffsetX {OFFSET[0]}\ncg_hudCompassOffsetY {OFFSET[1]}\nwait 40\nscreenshot opt_moved\nwait 40\nquit\n'

◆ NO_WRITE

str hud_options_test.NO_WRITE = 'wait 100\ncg_hudCompassOffsetX 5\nwait 60\nwriteconfig probe\nwait 5\nquit\n'

◆ OBJECTIVE

str hud_options_test.OBJECTIVE = 'wait 300\ncg_drawGun 0\nwait 40\nscreenshot opt_goal\nwait 40\nquit\n'

◆ OBJECTIVES

dict hud_options_test.OBJECTIVES = {'none': None, 'right': '(2901, 2438, 80)', 'left': '(3201, 1918, 80), "white"', 'ahead': '(2791, 2028, 80)'}

◆ OFFSET

tuple hud_options_test.OFFSET = (100, -100)

◆ ROOT

hud_options_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

◆ SECONDS

int hud_options_test.SECONDS = 180

◆ START

str hud_options_test.START = 'wait 300\ncg_drawGun 0\nwait 40\nscreenshot opt_on\nwait 40\ncg_drawCompass 0\nwait 40\nscreenshot opt_off\nwait 40\n'