|
OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
|
Functions | |
| gametype () | |
| pixels (path, rgb) | |
| main () | |
Variables | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| int | SECONDS = 180 |
| float | TOLERANCE = 0.03 |
| int | MIN_PIXELS = 200 |
| list | BOXES |
| str | HUD |
| str | BOX |
A client places hud elements by their horzAlign and vertAlign.
python3 scripts/hud_align_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--keep DIR]
Starts a client (cod2_linux) on its own game of mp_toujane with a gametype
that spawns the player looking up at the sky and gives it three hud elements,
40x40 boxes of the white material in pure colors, whose horzAlign and
vertAlign differ (as the killcam's title, center_safearea and top): magenta
at center_safearea/top, cyan at right/bottom, yellow at left/middle. A
hudelem's alignScreen keeps horzAlign in bits 3-5 and vertAlign in bits 0-2;
read the other way round, the killcam's title went to the left edge and the
middle of the screen. Takes a screenshot (TGA) and finds each color's pixels:
exits with 0 when each box is there, its center within TOLERANCE of where
those alignments put it (a 4:3 window: 640x480 virtual units scale alike on
both axes), and the client leaves no crash report. --keep copies the
screenshot and the log to DIR. The client opens a window and needs a CD key
in ~/.cod2/preferences; without one the test is skipped (exit 0).
| hud_align_test.gametype | ( | ) |
| hud_align_test.main | ( | ) |
| hud_align_test.pixels | ( | path, | |
| rgb ) |
The (x, y) of the pixels of a TGA of exactly that color (0 or 255 a channel), top row 0.
| str hud_align_test.BOX |
| list hud_align_test.BOXES |
| str hud_align_test.HUD |
| int hud_align_test.MIN_PIXELS = 200 |
| hud_align_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| int hud_align_test.SECONDS = 180 |
| float hud_align_test.TOLERANCE = 0.03 |