定制 andach/php-doom-wad-analysis 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andach/php-doom-wad-analysis

最新稳定版本:v0.0.2

Composer 安装命令:

composer require andach/php-doom-wad-analysis

包简介

A set of PHP classes to analyse and parse DOOM wads.

README 文档

README

This is a PHP class to analyse DOOM wads. It is currently in development.

Installation

composer install andach/php-doom-wad-analysis

Usage

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');

Testing

.\vendor\bin\phpunit.bat --coverage-html coverage

Output

Calling $analyser->analyse() returns a deeply structured array that breaks down the contents of the WAD file. This output is intended for developers or tools that need to introspect, validate, visualize, or modify DOOM WAD data.

Top-Level Structure

[
    '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,
            ],
        ],
        ...
    ]
]

Maps Structure

Things

Entities such as players, monsters, items, decorations, etc.

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

Linedefs

Defines the walls and logic lines between points.

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

Sidedefs

Texture information for each side of a wall (linedef).

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

Vertexes

2D points used by linedefs to form geometry.

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

Sectors

Defines vertical space areas with floor/ceiling properties and lighting.

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

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-20