Die4Ever / build-engine-randomizer

Build Engine Randomizer (Duke Nukem 3D, Shadow Warrior, Ion Fury, Blood, PowerSlave)
https://discord.gg/QwjnYWhKsY
GNU Affero General Public License v3.0
21 stars 1 forks source link

support Blood #21

Closed Die4Ever closed 2 years ago

Die4Ever commented 2 years ago

Blood doesn't use a GRP file, it uses RFF https://moddingwiki.shikadi.net/wiki/RFF_Format

but Cryptic Passage uses plain MAP files

neither one seems to use CON files

https://github.com/nukeykt/NBlood/blob/master/source/blood/src/resource.h

struct RFFHeader
{
    char sign[4];
    short version;
    short pad1;
    unsigned int offset;
    unsigned int filenum;
    int pad2[4];
};

https://github.com/nukeykt/NBlood/blob/master/source/blood/src/resource.cpp#L85

void Resource::Init(const char *filename)
{
    RFFHeader header;
#ifdef USE_QHEAP
    dassert(heap != NULL);
#endif

    if (filename)
    {
        handle = kopen4loadfrommod(filename, 0);
        if (handle != -1)
        {
            int nFileLength = kfilelength(handle);
            dassert(nFileLength != -1);
            if (kread(handle, &header, sizeof(RFFHeader)) != sizeof(RFFHeader)
                || memcmp(header.sign, "RFF\x1a", 4))
            {
                ThrowError("RFF header corrupted");
            }
#if B_BIG_ENDIAN == 1
            header.version = B_LITTLE16(header.version);
            header.offset = B_LITTLE32(header.offset);
            header.filenum = B_LITTLE32(header.filenum);
#endif
            switch (header.version & 0xff00)
            {
            case 0x200:
                crypt = 0;
                break;
            case 0x300:
                crypt = 1;
                break;
            default:
                ThrowError("Unknown RFF version");
                break;
            }
Die4Ever commented 2 years ago

Blood shareware http://files.deathmask.net/shareware/blood_sw_1.11.exe

Die4Ever commented 2 years ago

map file format https://github.com/nukeykt/NBlood/blob/4715800cd1a74b4500ebc34b61a342a9db7efbda/source/blood/src/db.h#L245-L272

https://github.com/nukeykt/NBlood/blob/1833d891c3957bb6020940d40f0a53bd6142c84d/source/blood/src/db.cpp#L791-L825

https://github.com/Die4Ever/build-engine-randomizer/commit/6633b7a1798c9b99a3ec9dc10a7f8a910a3fd4de list files inside RffFile

Die4Ever commented 2 years ago

image image image image image

Die4Ever commented 2 years ago

image image image image

Die4Ever commented 2 years ago

https://blood-wiki.org/index.php?title=Category:Items

https://blood-wiki.org/index.php?title=Category:Weapons

Die4Ever commented 2 years ago

https://github.com/thomasrogers03/bloom/blob/master/bloom/resources/sprite_types.yaml

blood = {'swappableItems':{}, 'swappableEnemies':{}, 'keyItems':{}, 'traps':{}, 'switches':{}}
import json
blood_sprites = json.load(open('blood_sprites.json'))

def add_sprite(k, spritenum, v):
    d = dict(name=v['name'], category=v['category'], lowtag=k)
    if 'repeats' in v:
        d.update(xrepeat=v['repeats']['x'], yrepeat=v['repeats']['y'])
    if d['category'] in ['weapons', 'ammo', 'items']:
        blood['swappableItems'][spritenum] = d
    elif d['category'] == 'keys':
        blood['keyItems'][spritenum] = d
    elif d['category'] == 'monsters':
        blood['swappableEnemies'][spritenum] = d
    elif d['category'] == 'traps':
        blood['traps'][spritenum] = d
    elif d['category'] == 'switches':
        blood['switches'][spritenum] = d

for k,v in blood_sprites.items():
    if 'tile_config' not in v:
        continue
    if 'tile' in v['tile_config']:
        spritenum = v['tile_config']['tile']
        add_sprite(k, spritenum, v)
    elif 'tiles' in v['tile_config']:
        for t in v['tile_config']['tiles']:
            spritenum = t
            add_sprite(k, spritenum, v)

for k in blood:
    print('\n', k)
    sprites = list(blood[k].keys())
    sprites.sort()
    for i in sprites:
        s = blood[k][i]
        data = 'SpriteInfo(\'' + s['name'] + '\', \'' + s['category'] + '\', lowtag=' + str(s['lowtag'])
        if 'xrepeat' in s:
            data += ', xrepeat=' + str(s['xrepeat']) + ', yrepeat=' + str(s['yrepeat'])
        data += '),'
        print(str(i) +': ', data, sep='')
    print('')