Minor fixes and cleanup

This commit is contained in:
Phillip Stephens 2019-08-03 17:02:53 -07:00
parent 9d2cbf61ed
commit ff83dbc676
12 changed files with 96 additions and 13 deletions

View File

@ -1650,7 +1650,7 @@ TXTR::Meta TXTR::GetMetaData(DataSpec::PAKEntryReadStream& rs) {
atUint16 palHeight = rs.readUint16Big(); atUint16 palHeight = rs.readUint16Big();
palMeta.elementCount = palWidth * palHeight; palMeta.elementCount = palWidth * palHeight;
atUint32 palSize = atUint32(palWidth * palHeight * 2); atUint32 palSize = atUint32(palWidth * palHeight * 2);
if (palMeta.format == 4) if (format == 8)
textureSize /= 2; textureSize /= 2;
std::unique_ptr<u8[]> palData(new u8[palSize]); std::unique_ptr<u8[]> palData(new u8[palSize]);
rs.readUBytesToBuf(palData.get(), palSize); rs.readUBytesToBuf(palData.get(), palSize);

View File

@ -454,6 +454,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
out.format(fmt("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx); out.format(fmt("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
out << "new_material.use_fake_user = True\n" out << "new_material.use_fake_user = True\n"
"new_material.use_nodes = True\n" "new_material.use_nodes = True\n"
"new_material.use_backface_culling = True\n"
"new_nodetree = new_material.node_tree\n" "new_nodetree = new_material.node_tree\n"
"for n in new_nodetree.nodes:\n" "for n in new_nodetree.nodes:\n"
" new_nodetree.nodes.remove(n)\n" " new_nodetree.nodes.remove(n)\n"

View File

@ -7,7 +7,7 @@ namespace DataSpec::DNAMP1 {
struct CTweakGame final : ITweakGame { struct CTweakGame final : ITweakGame {
AT_DECL_DNA_YAML AT_DECL_DNA_YAML
String<-1> x4_worldPrefix; String<-1> x4_worldPrefix;
String<-1> x14_ruinsArea; // ???? String<-1> x14_defaultRoom;
Value<float> x24_fov; Value<float> x24_fov;
Value<bool> x28_unknown1; Value<bool> x28_unknown1;
Value<bool> x29_unknown2; Value<bool> x29_unknown2;
@ -30,6 +30,7 @@ struct CTweakGame final : ITweakGame {
Value<float> x64_hardmodeWeaponMult; Value<float> x64_hardmodeWeaponMult;
std::string_view GetWorldPrefix() const { return x4_worldPrefix; } std::string_view GetWorldPrefix() const { return x4_worldPrefix; }
std::string_view GetDefaultRoom() const { return x14_defaultRoom; }
bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; } bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; }
float GetFirstPersonFOV() const { return x24_fov; } float GetFirstPersonFOV() const { return x24_fov; }
float GetPressStartDelay() const { return x30_pressStartDelay; } float GetPressStartDelay() const { return x30_pressStartDelay; }

View File

@ -2295,7 +2295,7 @@ DIRECTORY_GRAPH = YES
# The default value is: png. # The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
DOT_IMAGE_FORMAT = png DOT_IMAGE_FORMAT = svg
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning. # enable generation of interactive SVG images that allow zooming and panning.
@ -2307,7 +2307,7 @@ DOT_IMAGE_FORMAT = png
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
INTERACTIVE_SVG = NO INTERACTIVE_SVG = YES
# The DOT_PATH tag can be used to specify the path where the dot tool can be # The DOT_PATH tag can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path. # found. If left blank, it is assumed the dot tool can be found in the path.
@ -2381,7 +2381,7 @@ MAX_DOT_GRAPH_DEPTH = 0
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
DOT_TRANSPARENT = NO DOT_TRANSPARENT = YES
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This # files in one run (i.e. multiple -o and -T options on the command line). This
@ -2390,7 +2390,7 @@ DOT_TRANSPARENT = NO
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
DOT_MULTI_TARGETS = NO DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated # explaining the meaning of the various boxes and arrows in the dot generated

View File

@ -82,7 +82,7 @@ void CMapArea::PostConstruct() {
for (u32 i = 0; i < x28_mappableObjCount; ++i) { for (u32 i = 0; i < x28_mappableObjCount; ++i) {
CMappableObject& mapObj = m_mappableObjects[i]; CMappableObject& mapObj = m_mappableObjects[i];
if (CMappableObject::IsDoorType(mapObj.GetType())) if (CMappableObject::IsDoorType(mapObj.GetType()))
mapObj.m_doorSurface.emplace(ctx); mapObj.CreateDoorSurface(ctx);
} }
return true; return true;
} BooTrace); } BooTrace);

View File

@ -13,7 +13,6 @@ class CStateManager;
class CMapWorldInfo; class CMapWorldInfo;
class CMappableObject { class CMappableObject {
friend class CMapArea;
static boo::ObjToken<boo::IGraphicsBufferS> g_doorVbo; static boo::ObjToken<boo::IGraphicsBufferS> g_doorVbo;
static boo::ObjToken<boo::IGraphicsBufferS> g_doorIbo; static boo::ObjToken<boo::IGraphicsBufferS> g_doorIbo;
@ -83,6 +82,7 @@ public:
bool IsDoorConnectedToVisitedArea(const CStateManager&) const; bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
bool IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo& mwInfo) const; bool IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo& mwInfo) const;
bool GetIsSeen() const; bool GetIsSeen() const;
void CreateDoorSurface(boo::IGraphicsDataFactory::Context& ctx) { m_doorSurface.emplace(ctx); }
static void ReadAutoMapperTweaks(const ITweakAutoMapper&); static void ReadAutoMapperTweaks(const ITweakAutoMapper&);
static bool GetTweakIsMapVisibilityCheat(); static bool GetTweakIsMapVisibilityCheat();

View File

@ -31,6 +31,7 @@ private:
boo::ObjToken<boo::ITexture> m_paletteTex; boo::ObjToken<boo::ITexture> m_paletteTex;
std::unique_ptr<u8[]> m_otex; std::unique_ptr<u8[]> m_otex;
EFontType m_ftype = EFontType::None; EFontType m_ftype = EFontType::None;
std::string m_dolphinName;
size_t ComputeMippedTexelCount(); size_t ComputeMippedTexelCount();
size_t ComputeMippedBlockCountDXT1(); size_t ComputeMippedBlockCountDXT1();
@ -67,6 +68,9 @@ public:
const boo::ObjToken<boo::ITexture>& GetPaletteTexture() const { return m_paletteTex; } const boo::ObjToken<boo::ITexture>& GetPaletteTexture() const { return m_paletteTex; }
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut, std::unique_ptr<u8[]>& paletteOut) const; std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut, std::unique_ptr<u8[]>& paletteOut) const;
const boo::ObjToken<boo::ITexture>& GetFontTexture(EFontType tp); const boo::ObjToken<boo::ITexture>& GetFontTexture(EFontType tp);
std::string_view GetDolphinName() const { return m_dolphinName; }
bool HasDolphinName() const { return !m_dolphinName.empty(); }
}; };
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len, CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,

View File

@ -762,6 +762,8 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
Log.report(logvisor::Fatal, fmt("invalid texture type {} for boo"), int(x0_fmt)); Log.report(logvisor::Fatal, fmt("invalid texture type {} for boo"), int(x0_fmt));
} }
if (r.readBool())
m_dolphinName = r.readString();
if (otex) if (otex)
m_otex = std::move(owned); m_otex = std::move(owned);
} }

View File

@ -372,7 +372,11 @@ void CMain::MemoryCardInitializePump() {
} }
} }
void CMain::FillInAssetIDs() {} void CMain::FillInAssetIDs() {
if (const SObjectTag* tag = g_ResFactory->GetResourceIdByName(g_tweakGame->GetDefaultRoom())) {
g_GameState->SetCurrentWorldId(tag->id);
}
}
bool CMain::LoadAudio() { bool CMain::LoadAudio() {
if (x164_archSupport) if (x164_archSupport)

View File

@ -24,5 +24,21 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo
const CBehaveChance& chance3, u16 sId1, float f5, u16 sId2, u16 sId3, u32 w1, float f6, u32 w2, const CBehaveChance& chance3, u16 sId1, float f5, u16 sId2, u16 sId3, u32 w1, float f6, u32 w2,
float f7, CAssetId partId, s16 sId4, float f8, float f9, u32 w3, u32 w4) float f7, CAssetId partId, s16 sId4, float f8, float f9, u32 w3, u32 w4)
: CPatterned(ECharacter::ChozoGhost, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, : CPatterned(ECharacter::ChozoGhost, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::Zero, EBodyType::BiPedal, actParms, EKnockBackVariant::Medium) {} EMovementType::Flyer, EColliderType::Zero, EBodyType::BiPedal, actParms, EKnockBackVariant::Medium)
, x568_(f1)
, x56c_(f2)
, x570_(f3)
, x574_(f4)
, x578_(wpsc1, dInfo1)
, x5a0_(wpsc2, dInfo2)
, x5c8_(chance1)
, x5e8_(chance2)
, x608_(chance3)
, x628_(sId1)
, x62c_(f5)
, x630_(sId2)
, x632_(sId3)
, x634_(f6)
, x638_(f7)
, x63c_(w2) {}
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "World/CPatterned.hpp" #include "World/CPatterned.hpp"
#include "Weapon/CProjectileInfo.hpp"
#include "Character/CBoneTracking.hpp"
namespace urde::MP1 { namespace urde::MP1 {
class CChozoGhost : public CPatterned { class CChozoGhost : public CPatterned {
@ -20,6 +22,60 @@ public:
}; };
private: private:
float x568_;
float x56c_;
float x570_;
float x574_;
CProjectileInfo x578_;
CProjectileInfo x5a0_;
CBehaveChance x5c8_;
CBehaveChance x5e8_;
CBehaveChance x608_;
s16 x628_;
float x62c_;
s16 x630_;
s16 x632_;
float x634_;
float x638_;
u32 x63c_;
TLockedToken<CGenDescription> x640_;
s16 x650_;
float x654_;
float x658_;
u32 x65c_;
u32 x660_;
union {
struct {
bool x664_24_ : 1;
bool x664_25_ : 1;
bool x664_26_ : 1;
bool x664_27_ : 1;
bool x664_28_ : 1;
bool x664_29_ : 1;
bool x664_30_ : 1;
bool x664_31_ : 1;
bool x665_24_ : 1;
bool x665_25_ : 1;
bool x665_26_ : 1;
bool x665_27_ : 1;
bool x665_28_ : 1;
bool x665_29_ : 1;
};
u32 _dummy = 0;
};
float x668_ = 0.f;
float x66c_ = 0.f;
float x670_ = 0.f;
TUniqueId x674_ = kInvalidUniqueId;
u32 x67c_ = -1;
u32 x680_;
float x684_ = 1.f;
CSteeringBehaviors x688_;
//CBoneTracking x68c_boneTracking;
TUniqueId x6c4_ = kInvalidUniqueId;
float x6c8_ = 0.f;
zeus::CVector3f x6cc_;
u32 x6d8_ = 1;
public: public:
DEFINE_PATTERNED(ChozoGhost) DEFINE_PATTERNED(ChozoGhost)

View File

@ -163,8 +163,7 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
CDamageInfo contactDamage = GetContactDamage(); CDamageInfo contactDamage = GetContactDamage();
if (x7a8_ == 4) if (x7a8_ == 4)
contactDamage = x7dc_; contactDamage = x7dc_;
else if (!sub801ae670())
if (!sub801ae670())
contactDamage.SetDamage(0.5f * contactDamage.GetDamage()); contactDamage.SetDamage(0.5f * contactDamage.GetDamage());
if (x788_ >= 2) if (x788_ >= 2)
@ -188,7 +187,7 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) { if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
if (x780_ != 3) if (x780_ != 3)
break; break;
if (IsDizzy(mgr, 0.f) && !x450_bodyController->HasBodyState(pas::EAnimationState::LoopReaction)) { if (!IsDizzy(mgr, 0.f) && x450_bodyController->HasBodyState(pas::EAnimationState::LoopReaction)) {
TakeDamage({}, 0.f); TakeDamage({}, 0.f);
if ((x56c_.x140_ - proj->GetDamageInfo().GetDamage()) >= x810_) { if ((x56c_.x140_ - proj->GetDamageInfo().GetDamage()) >= x810_) {