diff options
Diffstat (limited to '')
-rw-r--r-- | src/entities/Entity.cpp | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index fac7f17f..d562ced5 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -632,7 +632,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; else lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>1 ^ m_randomSeed) & 3) + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) lightOn = true; break; case LIGHT_FLICKER_NIGHT: @@ -641,7 +641,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; else lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>1 ^ m_randomSeed) & 3) + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3) lightOn = true; } break; @@ -680,7 +680,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; else lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>1 ^ m_randomSeed*8) & 3) + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) lightOn = true; } break; @@ -693,7 +693,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; else lightFlickering = true; - if((CTimer::GetTimeInMilliseconds()>>1 ^ m_randomSeed*8) & 3) + if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3) lightOn = true; } } @@ -815,8 +815,8 @@ CEntity::ModifyMatrixForTreeInWind(void) strength = 0.005f; } - mat.GetUp()->x = strength * flutter; - mat.GetUp()->y = mat.GetUp()->x; + mat.GetUp().x = strength * flutter; + mat.GetUp().y = mat.GetUp().x; mat.UpdateRW(); UpdateRwFrame(); @@ -847,7 +847,7 @@ CEntity::ModifyMatrixForBannerInWind(void) else strength = 0.66f; - t = ((int)(GetMatrix().GetPosition()->x + GetMatrix().GetPosition()->y) << 10) + 16*CTimer::GetTimeInMilliseconds(); + t = ((int)(GetMatrix().GetPosition().x + GetMatrix().GetPosition().y) << 10) + 16*CTimer::GetTimeInMilliseconds(); f = (t & 0x7FF)/(float)0x800; flutter = f * BannerWindTabel[(t>>11)+1 & 0x1F] + (1.0f - f) * BannerWindTabel[(t>>11) & 0x1F]; @@ -865,10 +865,35 @@ CEntity::ModifyMatrixForBannerInWind(void) UpdateRwFrame(); } +class CEntity_ : public CEntity +{ +public: + CEntity *ctor(void) { return ::new (this) CEntity(); } + void dtor(void) { this->CEntity::~CEntity(); } + void Add_(void) { CEntity::Add(); } + void Remove_(void) { CEntity::Remove(); } + void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); } + void CreateRwObject_(void) { CEntity::CreateRwObject(); } + void DeleteRwObject_(void) { CEntity::DeleteRwObject(); } + CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); } + void PreRender_(void) { CEntity::PreRender(); } + void Render_(void) { CEntity::Render(); } + bool SetupLighting_(void) { return CEntity::SetupLighting(); } +}; + STARTPATCHES - InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP); - InjectHook(0x473E40, &CEntity::dtor, PATCH_JUMP); - InjectHook(0x473E70, &CEntity::SetModelIndex_, PATCH_JUMP); + InjectHook(0x473C30, &CEntity_::ctor, PATCH_JUMP); + InjectHook(0x473E40, &CEntity_::dtor, PATCH_JUMP); + InjectHook(0x473E70, &CEntity_::SetModelIndex_, PATCH_JUMP); + InjectHook(0x475080, &CEntity_::Add_, PATCH_JUMP); + InjectHook(0x475310, &CEntity_::Remove_, PATCH_JUMP); + InjectHook(0x473EA0, &CEntity_::CreateRwObject_, PATCH_JUMP); + InjectHook(0x473F90, &CEntity_::DeleteRwObject_, PATCH_JUMP); + InjectHook(0x474000, &CEntity_::GetBoundRect_, PATCH_JUMP); + InjectHook(0x474350, &CEntity_::PreRender_, PATCH_JUMP); + InjectHook(0x474BD0, &CEntity_::Render_, PATCH_JUMP); + InjectHook(0x4A7C60, &CEntity_::SetupLighting_, PATCH_JUMP); + InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP); InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP); InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP); @@ -889,13 +914,4 @@ STARTPATCHES InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP); InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP); InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP); - - InjectHook(0x475080, &CEntity::Add_, PATCH_JUMP); - InjectHook(0x475310, &CEntity::Remove_, PATCH_JUMP); - InjectHook(0x473EA0, &CEntity::CreateRwObject_, PATCH_JUMP); - InjectHook(0x473F90, &CEntity::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x474000, &CEntity::GetBoundRect_, PATCH_JUMP); - InjectHook(0x474350, &CEntity::PreRender_, PATCH_JUMP); - InjectHook(0x474BD0, &CEntity::Render_, PATCH_JUMP); - InjectHook(0x4A7C60, &CEntity::SetupLighting_, PATCH_JUMP); ENDPATCHES |