PHP code example of andach / php-doom-wad-analysis

1. Go to this page and download the library: Download andach/php-doom-wad-analysis library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andach / php-doom-wad-analysis example snippets


[
    'type' => 'PWAD' | 'IWAD',
    'complevel'    => 21
    'has_playpal'  => true | false,
    'has_colormap' => true | false,
    'playpal'      => [...],    // Present only if has_playpal is true
    'colormap'     => [...],   // Present only if has_colormap is true
    'counts'   => [
        'maps'     => 32,
        'things'   => 1234,
        'linedefs' => 1234,
        'sidedefs' => 1234,
        'vertexes' => 1234,
        'sectors'  => 1234,
    ],
    'maps' => [
        'MAP01' => [
            'things'   => [...],
            'linedefs' => [...],
            'sidedefs' => [...],
            'vertexes' => [...],
            'sectors'  => [...],
            'counts'   => [
                'things'   => 1234,
                'linedefs' => 1234,
                'sidedefs' => 1234,
                'vertexes' => 1234,
                'sectors'  => 1234,
            ],
        ],
        ...
    ]
]

[
    [
        'x' => 128,
        'y' => 512,
        'angle' => 0,
        'type' => 1,
        'flags' => 7,
    ],
    ...
]

[
    [
        'start_vertex' => 0,
        'end_vertex' => 1,
        'flags' => 1,
        'special' => 0,
        'sector_tag' => 0,
        'right_sidedef' => 0,
        'left_sidedef' => -1,
    ],
    ...
]

[
    [
        'x_offset' => 0,
        'y_offset' => 0,
        'upper_texture' => 'BRICK1',
        'lower_texture' => 'BRICK2',
        'middle_texture' => 'BRICK3',
        'sector' => 1,
    ],
    ...
]

[
    [ 'x' => 128, 'y' => 64 ],
    ...
]

[
    [
        'floor_height' => 0,
        'ceiling_height' => 128,
        'floor_texture' => 'FLAT1',
        'ceiling_texture' => 'CEIL1',
        'light_level' => 160,
        'special' => 0,
        'tag' => 0,
    ],
    ...
]

composer install andach/php-doom-wad-analysis

use Andach\DoomWadAnalysis\WadAnalyser;

$settings = [
    'colormap' => true,
    'playpal'  => true,
    'maps' => [
        'images'   => true,
        'counts'   => true,
        'things'   => true,
        'linedefs' => true,
        'sidedefs' => true,
        'vertexes' => true,
        'textures' => true,
    ],
];

$analyser = new WadAnalyser($settings);
$result = $analyser->analyse('/path/to/file.wad');