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

Functions

 tga (path)
 changed (a, b)
 config (effects)
 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'}
str EFFECTS = 'fx/misc/missing_fx,fx/impacts/default_hit,fx/explosions/grenadeExp_water,fx/impacts/minefield,fx/explosions/large_vehicle_explosion,fx/explosions/tank_explosion'
tuple MISSING = ('fx/impacts/fluff1.efx', 'fx/impacts/dirthit_mortar.efx')
str SPOT = '3051 2178 80 210'
int PITCH = -45
str GAMETYPE
int DIFF = 40
int MIN_PIXELS = 500
int SECONDS = 420

Detailed Description

A client draws effects: each one changes the picture where it plays.

    python3 scripts/fx_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--effects FX,...] [--spot 'X Y Z YAW'] [--keep DIR]

Starts a client (cod2_linux) on its own game of mp_toujane with a gametype
that spawns the player at a fixed spot as it connects, looking up at the sky,
hides the HUD and the gun, and takes screenshots (TGA) by a config file. For
each effect it takes two shots without it, 12 frames apart, to measure how
much the picture changes by itself (the last effect's smoke drifting by), then
one 12 frames after fxTest started playing the effect again and again in
front of the player (fxSetTestPosition). Counts the pixels of a shot that
differ from the one before it by more than DIFF in some channel. Exits with 0
when every effect changes over MIN_PIXELS pixels more than the picture does
by itself, every effect loads (an effect that fails plays the placeholder
instead), every material loads, and the client still runs and leaves no
crash report. --keep copies the screenshots, the log and any crash report 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

◆ changed()

fx_test.changed ( a,
b )
The pixels of b that differ from a by more than DIFF in some channel.

◆ config()

fx_test.config ( effects)

◆ main()

fx_test.main ( )

◆ tga()

fx_test.tga ( path)
(width, height, rows of bytes) of an uncompressed 24 or 32 bit TGA.

Variable Documentation

◆ DEFAULT_CLIENT

dict fx_test.DEFAULT_CLIENT = {115: 'build/check-linux-10/cod2_linux', 118: 'build/check-linux/cod2_linux'}

◆ DIFF

int fx_test.DIFF = 40

◆ EFFECTS

str fx_test.EFFECTS = 'fx/misc/missing_fx,fx/impacts/default_hit,fx/explosions/grenadeExp_water,fx/impacts/minefield,fx/explosions/large_vehicle_explosion,fx/explosions/tank_explosion'

◆ GAMETYPE

str fx_test.GAMETYPE
Initial value:
1= '''main()
2{
3 maps\\mp\\gametypes\\_callbacksetup::SetupCallbacks();
4 level.callbackStartGameType = ::blank;
5 level.callbackPlayerConnect = ::Callback_PlayerConnect;
6 level.callbackPlayerDisconnect = ::blank;
7 level.callbackPlayerDamage = ::blank;
8 level.callbackPlayerKilled = ::blank;
9}
10
11blank(a, b, c, d, e, f, g, h, i, j)
12{
13}
14
15Callback_PlayerConnect()
16{
17 self.sessionteam = "none";
18 self.sessionstate = "playing";
19 self.spectatorclient = -1;
20 self.archivetime = 0;
21 self.psoffsettime = 0;
22 self.statusicon = "";
23 self.maxhealth = 100;
24 self.health = self.maxhealth;
25 self spawn((%(x)s, %(y)s, %(z)s), (%(pitch)s, %(yaw)s, 0));
26}
27'''

◆ MIN_PIXELS

int fx_test.MIN_PIXELS = 500

◆ MISSING

tuple fx_test.MISSING = ('fx/impacts/fluff1.efx', 'fx/impacts/dirthit_mortar.efx')

◆ PITCH

int fx_test.PITCH = -45

◆ ROOT

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

◆ SECONDS

int fx_test.SECONDS = 420

◆ SPOT

str fx_test.SPOT = '3051 2178 80 210'