コード例 #1
0
CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* resPool)
    : x30_RNGE(50.f), x34_FOFF(0.2f)
{
    x0.resize(94);
    x10.resize(94);
    x20.resize(94);
    FourCC clsId = CPF::GetClassID(in);
    if (clsId == SBIG('CRSM'))
    {
        CRandom16 rand{99};
        CGlobalRandom gr(rand);

        while (clsId != SBIG('_END'))
        {
            clsId = CPF::GetClassID(in);
            if (CheckAndAddResourceToResponse(clsId, in, resPool))
                continue;

            if (clsId == SBIG('RNGE'))
            {
                CPF::GetClassID(in);
                x30_RNGE = CPF::GetReal(in);
            }
            else if (clsId == SBIG('FOFF'))
            {
                CPF::GetClassID(in);
                x34_FOFF = CPF::GetReal(in);
            }
        }
    }
}
コード例 #2
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void EmitterElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('SETR'):
        m_elem.reset(new struct EESimpleEmitterTR);
        break;
    case SBIG('SEMR'):
        m_elem.reset(new struct EESimpleEmitter);
        break;
    case SBIG('SPHE'):
        m_elem.reset(new struct VESphere);
        break;
    case SBIG('ASPH'):
        m_elem.reset(new struct VEAngleSphere);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #3
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void EmitterElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('SETR'):
        m_elem.reset(new struct EESimpleEmitterTR);
        break;
    case SBIG('SEMR'):
        m_elem.reset(new struct EESimpleEmitter);
        break;
    case SBIG('SPHE'):
        m_elem.reset(new struct VESphere);
        break;
    case SBIG('ASPH'):
        m_elem.reset(new struct VEAngleSphere);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #4
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void ColorElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct CEKeyframeEmitter);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct CEConstant);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct CETimeChain);
        break;
    case SBIG('CFDE'):
        m_elem.reset(new struct CEFadeEnd);
        break;
    case SBIG('FADE'):
        m_elem.reset(new struct CEFade);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct CEPulse);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #5
0
bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
    int i = 0;
    for (const FourCC& type : DecalTypes)
    {
        if (type == clsId)
        {
            FourCC cls = CPF::GetClassID(in);
            if (cls == SBIG('NONE'))
                return true;

            TResId id = CPF::GetInt(in);
            if (!id)
                return true;

            x20[i].first = std::move(resPool->GetObj({FOURCC('DPSC'), id}));
            if (x0[i].first)
                x0[i].second = true;

            return true;
        }
        i++;
    }
    return false;
}
コード例 #6
0
ファイル: CGuiModel.cpp プロジェクト: AxioDL/urde
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
: CGuiWidget(parms), xc8_modelId(modelId), xcc_lightMask(lightMask) {
  if (!flag || !modelId.IsValid() || parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two)
    return;

  xb8_model = sp->GetObj({SBIG('CMDL'), modelId});
}
コード例 #7
0
bool CCollisionResponseData::CheckAndAddSoundFXToResponse(FourCC clsId, CInputStream& in)
{
    int i = 0;
    for (const FourCC& type : SFXTypes)
    {
        if (type == clsId)
        {
            FourCC cls = CPF::GetClassID(in);
            if (cls == SBIG('NONE'))
                return true;

            x10[i] = CPF::GetInt(in);
            return true;
        }
        i++;
    }

    return false;
}
コード例 #8
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void ColorElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct CEKeyframeEmitter);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct CEConstant);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct CETimeChain);
        break;
    case SBIG('CFDE'):
        m_elem.reset(new struct CEFadeEnd);
        break;
    case SBIG('FADE'):
        m_elem.reset(new struct CEFade);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct CEPulse);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #9
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void ModVectorElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('IMPL'):
        m_elem.reset(new struct MVEImplosion);
        break;
    case SBIG('EMPL'):
        m_elem.reset(new struct MVEExponentialImplosion);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct MVETimeChain);
        break;
    case SBIG('BNCE'):
        m_elem.reset(new struct MVEBounce);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct MVEConstant);
        break;
    case SBIG('GRAV'):
        m_elem.reset(new struct MVEGravity);
        break;
    case SBIG('EXPL'):
        m_elem.reset(new struct MVEExplode);
        break;
    case SBIG('SPOS'):
        m_elem.reset(new struct MVESetPosition);
        break;
    case SBIG('LMPL'):
        m_elem.reset(new struct MVELinearImplosion);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct MVEPulse);
        break;
    case SBIG('WIND'):
        m_elem.reset(new struct MVEWind);
        break;
    case SBIG('SWRL'):
        m_elem.reset(new struct MVESwirl);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #10
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void VectorElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('CONE'):
        m_elem.reset(new struct VECone);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct VETimeChain);
        break;
    case SBIG('ANGC'):
        m_elem.reset(new struct VEAngleCone);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct VEAdd);
        break;
    case SBIG('CCLU'):
        m_elem.reset(new struct VECircleCluster);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct VEConstant);
        break;
    case SBIG('CIRC'):
        m_elem.reset(new struct VECircle);
        break;
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct VEKeyframeEmitter);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct VEMultiply);
        break;
    case SBIG('RTOV'):
        m_elem.reset(new struct VERealToVector);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct VEPulse);
        break;
    case SBIG('PVEL'):
        m_elem.reset(new struct VEParticleVelocity);
        break;
    case SBIG('SPOS'):
        m_elem.reset(new struct VESPOS);
        break;
    case SBIG('PLCO'):
        m_elem.reset(new struct VEPLCO);
        break;
    case SBIG('PLOC'):
        m_elem.reset(new struct VEPLOC);
        break;
    case SBIG('PSOR'):
        m_elem.reset(new struct VEPSOR);
        break;
    case SBIG('PSOF'):
        m_elem.reset(new struct VEPSOF);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #11
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void VectorElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('CONE'):
        m_elem.reset(new struct VECone);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct VETimeChain);
        break;
    case SBIG('ANGC'):
        m_elem.reset(new struct VEAngleCone);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct VEAdd);
        break;
    case SBIG('CCLU'):
        m_elem.reset(new struct VECircleCluster);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct VEConstant);
        break;
    case SBIG('CIRC'):
        m_elem.reset(new struct VECircle);
        break;
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct VEKeyframeEmitter);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct VEMultiply);
        break;
    case SBIG('RTOV'):
        m_elem.reset(new struct VERealToVector);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct VEPulse);
        break;
    case SBIG('PVEL'):
        m_elem.reset(new struct VEParticleVelocity);
        break;
    case SBIG('SPOS'):
        m_elem.reset(new struct VESPOS);
        break;
    case SBIG('PLCO'):
        m_elem.reset(new struct VEPLCO);
        break;
    case SBIG('PLOC'):
        m_elem.reset(new struct VEPLOC);
        break;
    case SBIG('PSOR'):
        m_elem.reset(new struct VEPSOR);
        break;
    case SBIG('PSOF'):
        m_elem.reset(new struct VEPSOF);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #12
0
namespace urde
{
static const std::vector<FourCC> SFXTypes =
{
    SBIG('DSFX'),SBIG('CSFX'),SBIG('MSFX'),SBIG('GRFX'),
    SBIG('ICFX'),SBIG('GOFX'),SBIG('WSFX'),SBIG('WTFX'),
    SBIG('2MUD'),SBIG('2LAV'),SBIG('2SAN'),SBIG('2PRJ'),
    SBIG('DCFX'),SBIG('DSFX'),SBIG('DSHX'),SBIG('DEFX'),
    SBIG('ESFX'),SBIG('SHFX'),SBIG('BEFX'),SBIG('WWFX'),
    SBIG('TAFX'),SBIG('GTFX'),SBIG('SPFX'),SBIG('FPFX'),
    SBIG('FFFX'),SBIG('PAFX'),SBIG('BMFX'),SBIG('BFFX'),
    SBIG('PBFX'),SBIG('IBFX'),SBIG('4SVA'),SBIG('4RPR'),
    SBIG('4MTR'),SBIG('4PDS'),SBIG('4FLB'),SBIG('4DRN'),
    SBIG('4MRE'),SBIG('CZFX'),SBIG('JZAS'),SBIG('2ISE'),
    SBIG('2BSE'),SBIG('2ATB'),SBIG('2ATA'),SBIG('BSFX'),
    SBIG('WSFX'),SBIG('TSFX'),SBIG('GSFX'),SBIG('SSFX'),
    SBIG('FSFX'),SBIG('SFFX'),SBIG('PSFX'),SBIG('MSFX'),
    SBIG('SBFX'),SBIG('PBSX'),SBIG('IBSX'),SBIG('5SVA'),
    SBIG('5RPR'),SBIG('5MTR'),SBIG('5PDS'),SBIG('5FLB'),
    SBIG('5DRN'),SBIG('5MRE'),SBIG('CSFX'),SBIG('JZPS'),
    SBIG('4ISE'),SBIG('4BSE'),SBIG('4ATB'),SBIG('4ATA'),
    SBIG('BHFX'),SBIG('WHFX'),SBIG('THFX'),SBIG('GHFX'),
    SBIG('SHFX'),SBIG('FHFX'),SBIG('HFFX'),SBIG('PHFX'),
    SBIG('MHFX'),SBIG('HBFX'),SBIG('PBHX'),SBIG('IBHX'),
    SBIG('6SVA'),SBIG('6RPR'),SBIG('6MTR'),SBIG('6PDS'),
    SBIG('6FLB'),SBIG('6DRN'),SBIG('6MRE'),SBIG('CHFX'),
    SBIG('JZHS'),SBIG('6ISE'),SBIG('6BSE'),SBIG('6ATB'),
    SBIG('6ATA')
};
static const std::vector<FourCC> GeneratorTypes =
{
    SBIG('DEFS'),SBIG('CRTS'),SBIG('MTLS'),SBIG('GRAS'),
    SBIG('ICEE'),SBIG('GOOO'),SBIG('WODS'),SBIG('WATR'),
    SBIG('1MUD'),SBIG('1LAV'),SBIG('1SAN'),SBIG('1PRJ'),
    SBIG('DCHR'),SBIG('DCHS'),SBIG('DCSH'),SBIG('DENM'),
    SBIG('DESP'),SBIG('DESH'),SBIG('BTLE'),SBIG('WASP'),
    SBIG('TALP'),SBIG('PTGM'),SBIG('SPIR'),SBIG('FPIR'),
    SBIG('FFLE'),SBIG('PARA'),SBIG('BMON'),SBIG('BFLR'),
    SBIG('PBOS'),SBIG('IBOS'),SBIG('1SVA'),SBIG('1RPR'),
    SBIG('1MTR'),SBIG('1PDS'),SBIG('1FLB'),SBIG('1DRN'),
    SBIG('1MRE'),SBIG('CHOZ'),SBIG('JZAP'),SBIG('1ISE'),
    SBIG('1BSE'),SBIG('1ATB'),SBIG('1ATA'),SBIG('BTSP'),
    SBIG('WWSP'),SBIG('TASP'),SBIG('TGSP'),SBIG('SPSP'),
    SBIG('FPSP'),SBIG('FFSP'),SBIG('PSSP'),SBIG('BMSP'),
    SBIG('BFSP'),SBIG('PBSP'),SBIG('IBSP'),SBIG('2SVA'),
    SBIG('2RPR'),SBIG('2MTR'),SBIG('2PDS'),SBIG('2FLB'),
    SBIG('2DRN'),SBIG('2MRE'),SBIG('CHSP'),SBIG('JZSP'),
    SBIG('3ISE'),SBIG('3BSE'),SBIG('3ATB'),SBIG('3ATA'),
    SBIG('BTSH'),SBIG('WWSH'),SBIG('TASH'),SBIG('TGSH'),
    SBIG('SPSH'),SBIG('FPSH'),SBIG('FFSH'),SBIG('PSSH'),
    SBIG('BMSH'),SBIG('BFSH'),SBIG('PBSH'),SBIG('IBSH'),
    SBIG('3SVA'),SBIG('3RPR'),SBIG('3MTR'),SBIG('3PDS'),
    SBIG('3FLB'),SBIG('3DRN'),SBIG('3MRE'),SBIG('CHSH'),
    SBIG('JZSH'),SBIG('5ISE'),SBIG('5BSE'),SBIG('5ATB'),
    SBIG('5ATA'),
};
static const std::vector<FourCC> DecalTypes =
{
    SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
    SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
    SBIG('WTDL'),SBIG('3MUD'),SBIG('3LAV'),SBIG('3SAN'),
    SBIG('CHDL'),SBIG('ENDL')
};

using CPF = CParticleDataFactory;

void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionResponseTypes type, CInputStream &in, CSimplePool *resPool)
{
    int i = int(type);
    std::vector<TResId> tracker;
    tracker.resize(8);
    x0[i].first = std::move(CPF::GetChildGeneratorDesc(in, resPool, tracker).m_token);
    if (x0[i].first)
        x0[i].second = true;
}

bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
    int i = 0;
    for (const FourCC& type : DecalTypes)
    {
        if (type == clsId)
        {
            FourCC cls = CPF::GetClassID(in);
            if (cls == SBIG('NONE'))
                return true;

            TResId id = CPF::GetInt(in);
            if (!id)
                return true;

            x20[i].first = std::move(resPool->GetObj({FOURCC('DPSC'), id}));
            if (x0[i].first)
                x0[i].second = true;

            return true;
        }
        i++;
    }
    return false;
}

bool CCollisionResponseData::CheckAndAddSoundFXToResponse(FourCC clsId, CInputStream& in)
{
    int i = 0;
    for (const FourCC& type : SFXTypes)
    {
        if (type == clsId)
        {
            FourCC cls = CPF::GetClassID(in);
            if (cls == SBIG('NONE'))
                return true;

            x10[i] = CPF::GetInt(in);
            return true;
        }
        i++;
    }

    return false;
}

bool CCollisionResponseData::CheckAndAddParticleSystemToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
    int i = 0;
    for (const FourCC& type : GeneratorTypes)
    {
        if (type == clsId)
        {
            AddParticleSystemToResponse(EWeaponCollisionResponseTypes(i), in, resPool);
            return true;
        }
    }
    return false;
}

bool CCollisionResponseData::CheckAndAddResourceToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
    if (CheckAndAddParticleSystemToResponse(clsId, in, resPool))
        return true;
    if (CheckAndAddSoundFXToResponse(clsId, in))
        return true;
    if (CheckAndAddDecalToResponse(clsId, in, resPool))
        return true;

    return false;
}

CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* resPool)
    : x30_RNGE(50.f), x34_FOFF(0.2f)
{
    x0.resize(94);
    x10.resize(94);
    x20.resize(94);
    FourCC clsId = CPF::GetClassID(in);
    if (clsId == SBIG('CRSM'))
    {
        CRandom16 rand{99};
        CGlobalRandom gr(rand);

        while (clsId != SBIG('_END'))
        {
            clsId = CPF::GetClassID(in);
            if (CheckAndAddResourceToResponse(clsId, in, resPool))
                continue;

            if (clsId == SBIG('RNGE'))
            {
                CPF::GetClassID(in);
                x30_RNGE = CPF::GetReal(in);
            }
            else if (clsId == SBIG('FOFF'))
            {
                CPF::GetClassID(in);
                x34_FOFF = CPF::GetReal(in);
            }
        }
    }
}

std::unique_ptr<IObj> FCollisionResponseDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)
{
    CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());
    return TToken<CCollisionResponseData>::GetIObjObjectFor(std::unique_ptr<CCollisionResponseData>(new CCollisionResponseData(in, sp)));
}

}
コード例 #13
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void IntElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct IEKeyframeEmitter);
        break;
    case SBIG('DETH'):
        m_elem.reset(new struct IEDeath);
        break;
    case SBIG('CLMP'):
        m_elem.reset(new struct IEClamp);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct IETimeChain);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct IEAdd);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct IEConstant);
        break;
    case SBIG('IMPL'):
        m_elem.reset(new struct IEImpulse);
        break;
    case SBIG('ILPT'):
        m_elem.reset(new struct IELifetimePercent);
        break;
    case SBIG('IRND'):
        m_elem.reset(new struct IEInitialRandom);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct IEPulse);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct IEMultiply);
        break;
    case SBIG('SPAH'):
        m_elem.reset(new struct IESampleAndHold);
        break;
    case SBIG('RAND'):
        m_elem.reset(new struct IERandom);
        break;
    case SBIG('TSCL'):
        m_elem.reset(new struct IETimeScale);
        break;
    case SBIG('GTCP'):
        m_elem.reset(new struct IEGTCP);
        break;
    case SBIG('MODU'):
        m_elem.reset(new struct IEModulo);
        break;
    case SBIG('SUB_'):
        m_elem.reset(new struct IESubtract);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #14
0
ファイル: CGuiTextSupport.cpp プロジェクト: KalDragon/urde
CGuiTextSupport::CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
                                 const zeus::CColor& col1, const zeus::CColor& col2,
                                 const zeus::CColor& col3, int, int, CSimplePool* store)
{
    store->GetObj({SBIG('FONT'), fontId});
}
コード例 #15
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void RealElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('LFTW'):
        m_elem.reset(new struct RELifetimeTween);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct REConstant);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct RETimeChain);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct REAdd);
        break;
    case SBIG('CLMP'):
        m_elem.reset(new struct REClamp);
        break;
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct REKeyframeEmitter);
        break;
    case SBIG('IRND'):
        m_elem.reset(new struct REInitialRandom);
        break;
    case SBIG('RAND'):
        m_elem.reset(new struct RERandom);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct REMultiply);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct REPulse);
        break;
    case SBIG('SCAL'):
        m_elem.reset(new struct RETimeScale);
        break;
    case SBIG('RLPT'):
        m_elem.reset(new struct RELifetimePercent);
        break;
    case SBIG('SINE'):
        m_elem.reset(new struct RESineWave);
        break;
    case SBIG('ISWT'):
        m_elem.reset(new struct REInitialSwitch);
        break;
    case SBIG('CLTN'):
        m_elem.reset(new struct RECompareLessThan);
        break;
    case SBIG('CEQL'):
        m_elem.reset(new struct RECompareEquals);
        break;
    case SBIG('PAP1'):
        m_elem.reset(new struct REParticleAdvanceParam1);
        break;
    case SBIG('PAP2'):
        m_elem.reset(new struct REParticleAdvanceParam2);
        break;
    case SBIG('PAP3'):
        m_elem.reset(new struct REParticleAdvanceParam3);
        break;
    case SBIG('PAP4'):
        m_elem.reset(new struct REParticleAdvanceParam4);
        break;
    case SBIG('PAP5'):
        m_elem.reset(new struct REParticleAdvanceParam5);
        break;
    case SBIG('PAP6'):
        m_elem.reset(new struct REParticleAdvanceParam6);
        break;
    case SBIG('PAP7'):
        m_elem.reset(new struct REParticleAdvanceParam7);
        break;
    case SBIG('PAP8'):
        m_elem.reset(new struct REParticleAdvanceParam8);
        break;
    case SBIG('PSLL'):
        m_elem.reset(new struct REParticleSizeOrLineLength);
        break;
    case SBIG('PRLW'):
        m_elem.reset(new struct REParticleRotationOrLineWidth);
        break;
    case SBIG('SUB_'):
        m_elem.reset(new struct RESubtract);
        break;
    case SBIG('VMAG'):
        m_elem.reset(new struct REVectorMagnitude);
        break;
    case SBIG('VXTR'):
        m_elem.reset(new struct REVectorXToReal);
        break;
    case SBIG('VYTR'):
        m_elem.reset(new struct REVectorYToReal);
        break;
    case SBIG('VZTR'):
        m_elem.reset(new struct REVectorZToReal);
        break;
    case SBIG('CEXT'):
        m_elem.reset(new struct RECEXT);
        break;
    case SBIG('ITRL'):
        m_elem.reset(new struct REIntTimesReal);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #16
0
ファイル: CRasterFont.cpp プロジェクト: KalDragon/urde
CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
{
    u32 magic;
    in.readBytesToBuf(&magic, 4);
    if (magic != SBIG('FONT'))
        return;

    u32 version = in.readUint32Big();
    x4_monoWidth = in.readUint32Big();
    x8_monoHeight = in.readUint32Big();

    if (version >= 1)
        x8c_baseline = in.readUint32Big();
    else
        x8c_baseline = x8_monoHeight;

    if (version >= 2)
        x90_lineMargin = in.readUint32Big();

    bool tmp1 = in.readBool();
    bool tmp2 = in.readBool();

    u32 tmp3 = in.readUint32Big();
    u32 tmp4 = in.readUint32Big();
    std::string name= in.readString();
    u32 txtrId = in.readUint32Big();
    x30_fontInfo = CFontInfo(tmp1, tmp2, tmp3, tmp4, name.c_str());
    x80_texture = store.GetObj({'TXTR', txtrId});
    EColorType mode = EColorType(in.readUint32Big());
    /* TODO: Make an enum */
    if (mode == EColorType::One)
        x2c_mode = EColorType::One;
    else if (mode == EColorType::Zero)
        x2c_mode = EColorType::Zero;

    u32 glyphCount = in.readUint32Big();
    xc_glyphs.reserve(glyphCount);

    for (u32 i = 0 ; i < glyphCount ; ++i)
    {
        wchar_t chr = in.readUint16Big();
        float startU = in.readFloatBig();
        float startV = in.readFloatBig();
        float endU = in.readFloatBig();
        float endV = in.readFloatBig();
        s32 a = in.readInt32Big();
        s32 b = in.readInt32Big();
        s32 c = in.readInt32Big();
        s32 cellWidth = in.readInt32Big();
        s32 cellHeight = in.readInt32Big();
        s32 baseline = in.readInt32Big();
        s32 kernStart = in.readInt32Big();
        xc_glyphs[i] = std::make_pair(chr, CGlyph(a, b, c, startU, startV, endU, endV,
                                                  cellWidth, cellHeight, baseline, kernStart));
    }

    std::sort(xc_glyphs.begin(), xc_glyphs.end(), [=](auto& a, auto& b) -> bool{
        return a.first < b.first;
    });

    u32 kernCount = in.readUint32Big();
    x1c_kerning.reserve(kernCount);

    for (u32 i = 0 ; i < kernCount ; ++i)
    {
        wchar_t first = in.readUint16Big();
        wchar_t second = in.readUint16Big();
        s32 howMuch = in.readUint32Big();
        x1c_kerning[i] = CKernPair(first, second, howMuch);
    }
}
コード例 #17
0
ファイル: CAssetFactory.cpp プロジェクト: AxioDL/urde
CFactoryFnReturn CCharacterFactoryBuilder::CDummyFactory::Build(const SObjectTag& tag, const CVParamTransfer&,
                                                                CObjectReference* selfRef) {
  TLockedToken<CAnimCharacterSet> ancs = g_SimplePool->GetObj({SBIG('ANCS'), tag.id});
  return TToken<CCharacterFactory>::GetIObjObjectFor(
      std::make_unique<CCharacterFactory>(*g_SimplePool, *ancs.GetObj(), tag.id));
}
コード例 #18
0
ファイル: CAssetFactory.cpp プロジェクト: AxioDL/urde
TToken<CCharacterFactory> CCharacterFactoryBuilder::GetFactory(const CAnimRes& res) {
  return x4_dummyStore.GetObj({SBIG('ANCS'), res.GetId()});
}
コード例 #19
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void ModVectorElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('IMPL'):
        m_elem.reset(new struct MVEImplosion);
        break;
    case SBIG('EMPL'):
        m_elem.reset(new struct MVEExponentialImplosion);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct MVETimeChain);
        break;
    case SBIG('BNCE'):
        m_elem.reset(new struct MVEBounce);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct MVEConstant);
        break;
    case SBIG('GRAV'):
        m_elem.reset(new struct MVEGravity);
        break;
    case SBIG('EXPL'):
        m_elem.reset(new struct MVEExplode);
        break;
    case SBIG('SPOS'):
        m_elem.reset(new struct MVESetPosition);
        break;
    case SBIG('LMPL'):
        m_elem.reset(new struct MVELinearImplosion);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct MVEPulse);
        break;
    case SBIG('WIND'):
        m_elem.reset(new struct MVEWind);
        break;
    case SBIG('SWRL'):
        m_elem.reset(new struct MVESwirl);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #20
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void RealElementFactory::read(athena::io::IStreamReader& r)
{
    uint32_t clsId;
    r.readBytesToBuf(&clsId, 4);
    switch (clsId)
    {
    case SBIG('LFTW'):
        m_elem.reset(new struct RELifetimeTween);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct REConstant);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct RETimeChain);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct REAdd);
        break;
    case SBIG('CLMP'):
        m_elem.reset(new struct REClamp);
        break;
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct REKeyframeEmitter);
        break;
    case SBIG('IRND'):
        m_elem.reset(new struct REInitialRandom);
        break;
    case SBIG('RAND'):
        m_elem.reset(new struct RERandom);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct REMultiply);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct REPulse);
        break;
    case SBIG('SCAL'):
        m_elem.reset(new struct RETimeScale);
        break;
    case SBIG('RLPT'):
        m_elem.reset(new struct RELifetimePercent);
        break;
    case SBIG('SINE'):
        m_elem.reset(new struct RESineWave);
        break;
    case SBIG('ISWT'):
        m_elem.reset(new struct REInitialSwitch);
        break;
    case SBIG('CLTN'):
        m_elem.reset(new struct RECompareLessThan);
        break;
    case SBIG('CEQL'):
        m_elem.reset(new struct RECompareEquals);
        break;
    case SBIG('PAP1'):
        m_elem.reset(new struct REParticleAdvanceParam1);
        break;
    case SBIG('PAP2'):
        m_elem.reset(new struct REParticleAdvanceParam2);
        break;
    case SBIG('PAP3'):
        m_elem.reset(new struct REParticleAdvanceParam3);
        break;
    case SBIG('PAP4'):
        m_elem.reset(new struct REParticleAdvanceParam4);
        break;
    case SBIG('PAP5'):
        m_elem.reset(new struct REParticleAdvanceParam5);
        break;
    case SBIG('PAP6'):
        m_elem.reset(new struct REParticleAdvanceParam6);
        break;
    case SBIG('PAP7'):
        m_elem.reset(new struct REParticleAdvanceParam7);
        break;
    case SBIG('PAP8'):
        m_elem.reset(new struct REParticleAdvanceParam8);
        break;
    case SBIG('PSLL'):
        m_elem.reset(new struct REParticleSizeOrLineLength);
        break;
    case SBIG('PRLW'):
        m_elem.reset(new struct REParticleRotationOrLineWidth);
        break;
    case SBIG('SUB_'):
        m_elem.reset(new struct RESubtract);
        break;
    case SBIG('VMAG'):
        m_elem.reset(new struct REVectorMagnitude);
        break;
    case SBIG('VXTR'):
        m_elem.reset(new struct REVectorXToReal);
        break;
    case SBIG('VYTR'):
        m_elem.reset(new struct REVectorYToReal);
        break;
    case SBIG('VZTR'):
        m_elem.reset(new struct REVectorZToReal);
        break;
    case SBIG('CEXT'):
        m_elem.reset(new struct RECEXT);
        break;
    case SBIG('ITRL'):
        m_elem.reset(new struct REIntTimesReal);
        break;
    case SBIG('NONE'):
        m_elem.reset();
        return;
    default:
        m_elem.reset();
        LogModule.report(logvisor::Fatal, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
        return;
    }
    m_elem->read(r);
}
コード例 #21
0
ファイル: ParticleCommon.cpp プロジェクト: KalDragon/urde
void IntElementFactory::read(athena::io::YAMLDocReader& r)
{
    const auto& mapChildren = r.getCurNode()->m_mapChildren;
    if (mapChildren.empty())
    {
        m_elem.reset();
        return;
    }

    const auto& elem = mapChildren[0];
    if (elem.first.size() < 4)
        LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());

    switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
    {
    case SBIG('KEYE'):
    case SBIG('KEYP'):
        m_elem.reset(new struct IEKeyframeEmitter);
        break;
    case SBIG('DETH'):
        m_elem.reset(new struct IEDeath);
        break;
    case SBIG('CLMP'):
        m_elem.reset(new struct IEClamp);
        break;
    case SBIG('CHAN'):
        m_elem.reset(new struct IETimeChain);
        break;
    case SBIG('ADD_'):
        m_elem.reset(new struct IEAdd);
        break;
    case SBIG('CNST'):
        m_elem.reset(new struct IEConstant);
        break;
    case SBIG('IMPL'):
        m_elem.reset(new struct IEImpulse);
        break;
    case SBIG('ILPT'):
        m_elem.reset(new struct IELifetimePercent);
        break;
    case SBIG('IRND'):
        m_elem.reset(new struct IEInitialRandom);
        break;
    case SBIG('PULS'):
        m_elem.reset(new struct IEPulse);
        break;
    case SBIG('MULT'):
        m_elem.reset(new struct IEMultiply);
        break;
    case SBIG('SPAH'):
        m_elem.reset(new struct IESampleAndHold);
        break;
    case SBIG('RAND'):
        m_elem.reset(new struct IERandom);
        break;
    case SBIG('TSCL'):
        m_elem.reset(new struct IETimeScale);
        break;
    case SBIG('GTCP'):
        m_elem.reset(new struct IEGTCP);
        break;
    case SBIG('MODU'):
        m_elem.reset(new struct IEModulo);
        break;
    case SBIG('SUB_'):
        m_elem.reset(new struct IESubtract);
        break;
    default:
        m_elem.reset();
        return;
    }
    r.enterSubRecord(elem.first.c_str());
    m_elem->read(r);
    r.leaveSubRecord();
}
コード例 #22
0
ファイル: CCollidableAABox.cpp プロジェクト: AxioDL/urde
FourCC CCollidableAABox::GetPrimType() const { return SBIG('AABX'); }