Skip to content

Commit

Permalink
Merge pull request #1600 from mouzedrift/fix
Browse files Browse the repository at this point in the history
a couple fixes
  • Loading branch information
mouzedrift authored Mar 19, 2023
2 parents 1c6fc25 + c242b6b commit 6c9b4c8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
3 changes: 3 additions & 0 deletions Source/AliveLibAO/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ s16 Animation::Init_402D20(s32 frameTableOffset, DynamicArray* /*animList*/, Bas

if (!ppAnimData)
{
LOG_WARNING("Animation init failed because the resource wasn't loaded!");
return 0;
}

Expand Down Expand Up @@ -870,6 +871,7 @@ s16 Animation::Init_402D20(s32 frameTableOffset, DynamicArray* /*animList*/, Bas
const bool bOk = bVramAllocOK && bPalAllocOK;
if (!bOk)
{
LOG_WARNING("Animation init failed because the vram or pal alloc failed!");
return 0;
}

Expand All @@ -881,6 +883,7 @@ s16 Animation::Init_402D20(s32 frameTableOffset, DynamicArray* /*animList*/, Bas
field_24_dbuf = ResourceManager::Alloc_New_Resource_454F20(ResourceManager::Resource_DecompressionBuffer, id, field_28_dbuf_size);
if (!field_24_dbuf)
{
LOG_WARNING("Animation init failed because it couldn't alloc a new resource!");
return 0;
}
}
Expand Down
6 changes: 6 additions & 0 deletions Source/AliveLibAO/BaseAnimatedWithPhysicsGameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Particle.hpp"
#include "Sfx.hpp"
#include "Math.hpp"
#include "../AliveLibCommon/BaseGameAutoPlayer.hpp"

namespace AO {

Expand Down Expand Up @@ -92,6 +93,11 @@ void BaseAnimatedWithPhysicsGameObject::Animation_Init_417FD0(s32 frameTableOffs
}
else
{
if (GetGameAutoPlayer().IsPlaying() || GetGameAutoPlayer().IsRecording())
{
std::string errMsg = "Animation init failed! frame table offset " + std::to_string(frameTableOffset);
ALIVE_FATAL(errMsg.c_str());
}
field_6_flags.Set(Options::eListAddFailed_Bit1);
field_6_flags.Set(Options::eDead_Bit3);
}
Expand Down
27 changes: 6 additions & 21 deletions Source/AliveLibAO/ChimeLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,22 @@ BaseGameObject* ChimeLock::dtor_40AE60()
if (field_114_left_bell)
{
field_114_left_bell->field_6_flags.Set(Options::eDead_Bit3);
field_114_left_bell->field_C_refCount--;
field_114_left_bell = nullptr;
}

if (field_118_center_bell)
{
field_118_center_bell->field_6_flags.Set(Options::eDead_Bit3);
field_118_center_bell->field_C_refCount--;
field_118_center_bell = nullptr;
}

if (field_11C_right_bell)
{
field_11C_right_bell->field_6_flags.Set(Options::eDead_Bit3);
field_11C_right_bell->field_C_refCount--;
field_11C_right_bell = nullptr;
}

gMap_507BA8.TLV_Reset_446870(field_10C_tlvInfo, -1, 0, 0);
Expand All @@ -182,27 +188,6 @@ void ChimeLock::VScreenChanged()

void ChimeLock::VScreenChanged_40BCD0()
{
if (field_114_left_bell)
{
field_114_left_bell->field_6_flags.Set(Options::eDead_Bit3);
field_114_left_bell->field_C_refCount--;
field_114_left_bell = nullptr;
}

if (field_118_center_bell)
{
field_118_center_bell->field_6_flags.Set(Options::eDead_Bit3);
field_118_center_bell->field_C_refCount--;
field_118_center_bell = nullptr;
}

if (field_11C_right_bell)
{
field_11C_right_bell->field_6_flags.Set(Options::eDead_Bit3);
field_11C_right_bell->field_C_refCount--;
field_11C_right_bell = nullptr;
}

field_6_flags.Set(Options::eDead_Bit3);
}

Expand Down
12 changes: 12 additions & 0 deletions Source/AliveLibAO/Dove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Dove* Dove::ctor_40EE50(s32 frameTableOffset, s32 maxW, s32 maxH, s32 resourceID
SetVTable(this, 0x4BA858);
field_4_typeId = Types::eBird_22;
u8** ppRes = ResourceManager::GetLoadedResource_4554F0(ResourceManager::Resource_Animation, resourceID, 1, 0);
if (!ppRes)
{
LOG_WARNING("hack loading dove resources");
ResourceManager::LoadResourceFile_455270("DOVBASIC.BAN", nullptr);
ppRes = ResourceManager::GetLoadedResource_4554F0(ResourceManager::Resource_Animation, resourceID, 1, 0);
}
Animation_Init_417FD0(
frameTableOffset,
maxW,
Expand Down Expand Up @@ -114,6 +120,12 @@ Dove* Dove::ctor_40EFF0(s32 frameTableOffset, s32 maxW, s32 maxH, s32 resourceID
field_4_typeId = Types::eBird_22;

u8** ppRes = ResourceManager::GetLoadedResource_4554F0(ResourceManager::Resource_Animation, resourceID, 1, 0);
if (!ppRes)
{
LOG_WARNING("hack loading dove resources");
ResourceManager::LoadResourceFile_455270("DOVBASIC.BAN", nullptr);
ppRes = ResourceManager::GetLoadedResource_4554F0(ResourceManager::Resource_Animation, resourceID, 1, 0);
}
Animation_Init_417FD0(
frameTableOffset,
maxW,
Expand Down
4 changes: 2 additions & 2 deletions Source/AliveLibAO/Elum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3720,7 +3720,7 @@ void Elum::VUpdate_4102A0()
{
if (GetGameAutoPlayer().IsPlaying() || GetGameAutoPlayer().IsRecording())
{
ResourceManager::LoadResourceFile_455270("ELMRIDE.BAN", nullptr),
ResourceManager::LoadResourceFile_455270("ELMRIDE.BAN", nullptr);
ResourceManager::LoadResourceFile_455270("ELMPDMNT.BAN", nullptr);
VLoadMountedResources_411300();
ppRes = GetResBlock_410D00(field_E4_previous_motion);
Expand Down Expand Up @@ -3755,7 +3755,7 @@ void Elum::VUpdate_4102A0()
{
if (GetGameAutoPlayer().IsPlaying() || GetGameAutoPlayer().IsRecording())
{
ResourceManager::LoadResourceFile_455270("ELMRIDE.BAN", nullptr),
ResourceManager::LoadResourceFile_455270("ELMRIDE.BAN", nullptr);
ResourceManager::LoadResourceFile_455270("ELMPDMNT.BAN", nullptr);
VLoadMountedResources_411300();
ppRes = GetResBlock_410D00(field_FC_current_motion);
Expand Down

0 comments on commit 6c9b4c8

Please sign in to comment.