|
OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
|
Functions | |
| game_log (home) | |
| parse (text) | |
| still (frame) | |
| landings (frames) | |
| check_damage_kick (text, check) | |
| check_view_bob (text, check) | |
| check_view_animation (text, check) | |
| check_jump_speed (frames, check) | |
| check_perturb (text, check) | |
| shock_start (text) | |
| check_trace (frames, check) | |
| main () | |
Variables | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| dict | DEFAULT_CLIENT = {115: 'build/check-linux-10/cod2_linux', 118: 'build/check-linux/cod2_linux'} |
| dict | DEFAULT_SERVER = {115: 'build/check-linux-10/cod2_lnxded', 118: 'build/check-linux/cod2_lnxded'} |
| str | WEAPON = 'kar98k_mp' |
| str | GAMETYPE |
| str | CONFIG |
| LINE | |
| KICK = re.compile(r'\[viewdamage\] t=(-?\d+) dmg=(-?\d+) delta=(-?\d+) pitch=(\S+) roll=(\S+) kick=(\S+) (\S+)') | |
| BOB = re.compile(r'\[viewbob\] hbob=(\S+) fwd=(\S+) right=(\S+)') | |
| ANIM = re.compile(r'\[viewanim\] t=(-?\d+) turn=(\S+) move=(\S+) (\S+) (\S+)') | |
| PERTURB = re.compile(r'\[perturb\] t=(-?\d+) det=(\S+) delta=(\S+) (\S+)') | |
A client leans, crouches, jumps, walks, fires and is hit; its view and view weapon move as 1.3's.
python3 scripts/view_weapon_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--server PATH]
Runs the dedicated server with a mod that spawns each player with a rifle,
and a real client (cod2_linux) with COD2_TRACE_VIEWWEAPON set and a config
that loops: lean right, lean left, crouch, stand, jump. The client prints the
view weapon's offset from the eye along the view axis each frame; the test
reads it. 1.3's CG_CalculateWeaponPosition (0x4d5970) moves the weapon
sideways while leaning, to the weapon's stance offset while crouched, and
down by landChange * 0.25 at most after a landing (150 ms down, 300 ms back).
The mod also hurts the player every few seconds; with COD2_TRACE_VIEWDAMAGE
the client prints the angles the view adds after each hit. 1.3 times that
kick from cg->damageTime minus ps->deltaTime (0x4cee35): it eases to
v_dmg_pitch and v_dmg_roll in 100 ms and back in 400 and never goes past them.
Walking, the eye bobs sideways along the view's right (COD2_TRACE_VIEWBOB).
Firing, reloading and melee move the camera by the view weapon's tag_camera
bone (0x4cf730, COD2_TRACE_VIEWANIM). After 30 s the mod shellshocks the
player; the perturbed view must stay a rotation (0x4d2320, COD2_TRACE_PERTURB);
the view weapon checks read the frames before it.
The client opens a window and needs a CD key in ~/.cod2/preferences; without
one the test is skipped (exit 0). Exits with 0 when all of that holds.
| view_weapon_test.check_damage_kick | ( | text, | |
| check ) |
The view's damage kick never goes past v_dmg_pitch and v_dmg_roll (the idle sway adds well under a degree), and a hit is felt.
| view_weapon_test.check_jump_speed | ( | frames, | |
| check ) |
1.3's xyspeed (0x4cfa44) is the horizontal speed only: a jump in place leaves it near 0 in the 300 ms before the landing.
| view_weapon_test.check_perturb | ( | text, | |
| check ) |
A shellshock turns the view (0x4d2320) by a rotation: the axis stays right-handed and orthonormal.
| view_weapon_test.check_trace | ( | frames, | |
| check ) |
| view_weapon_test.check_view_animation | ( | text, | |
| check ) |
1.3 moves the camera by the view weapon's tag_camera bone (0x4cf730): firing, reloading and melee animate it.
| view_weapon_test.check_view_bob | ( | text, | |
| check ) |
1.3 moves the eye by the horizontal bob along the view's right (0x4cef6c), not forward.
| view_weapon_test.game_log | ( | home | ) |
| view_weapon_test.landings | ( | frames | ) |
[(reference u, [(land, u)])] for each landing: the frames 0..450 ms after it.
| view_weapon_test.main | ( | ) |
| view_weapon_test.parse | ( | text | ) |
The trace's frames, in order, as dicts.
| view_weapon_test.shock_start | ( | text | ) |
The time of the first shellshocked frame, or None.
| view_weapon_test.still | ( | frame | ) |
Not moving, not aiming, not in a landing.
| view_weapon_test.ANIM = re.compile(r'\[viewanim\] t=(-?\d+) turn=(\S+) move=(\S+) (\S+) (\S+)') |
| view_weapon_test.BOB = re.compile(r'\[viewbob\] hbob=(\S+) fwd=(\S+) right=(\S+)') |
| str view_weapon_test.CONFIG |
| dict view_weapon_test.DEFAULT_CLIENT = {115: 'build/check-linux-10/cod2_linux', 118: 'build/check-linux/cod2_linux'} |
| dict view_weapon_test.DEFAULT_SERVER = {115: 'build/check-linux-10/cod2_lnxded', 118: 'build/check-linux/cod2_lnxded'} |
| str view_weapon_test.GAMETYPE |
| view_weapon_test.KICK = re.compile(r'\[viewdamage\] t=(-?\d+) dmg=(-?\d+) delta=(-?\d+) pitch=(\S+) roll=(\S+) kick=(\S+) (\S+)') |
| view_weapon_test.LINE |
| view_weapon_test.PERTURB = re.compile(r'\[perturb\] t=(-?\d+) det=(\S+) delta=(\S+) (\S+)') |
| view_weapon_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| str view_weapon_test.WEAPON = 'kar98k_mp' |