Fire and PlayerSkin fix

This commit is contained in:
Sergeanur 2020-03-29 08:51:30 +03:00
parent 7242d8a440
commit db92864fe2
2 changed files with 41 additions and 39 deletions

View File

@ -113,7 +113,7 @@ CFire::ProcessFire(void)
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.0125f, 0.1f) * m_fStrength), CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.0125f, 0.1f) * m_fStrength),
0, m_fStrength, 0, 0, 0, 0); 0, m_fStrength, 0, 0, 0, 0);
rand(); rand(); rand(); /* unsure why these three rands are called */ CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); /* unsure why these three rands are called */
CParticle::AddParticle(PARTICLE_CARFLAME_SMOKE, firePos, CParticle::AddParticle(PARTICLE_CARFLAME_SMOKE, firePos,
CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
@ -129,8 +129,10 @@ CFire::ProcessFire(void)
if (!m_pEntity) { if (!m_pEntity) {
CShadows::StoreStaticShadow((uint32)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, CShadows::StoreStaticShadow((uint32)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos,
7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2, nRandNumber / 2, 7.0f, 0.0f, 0.0f, -7.0f,
0, 10.0f, 1.0f, 40.0f, 0, 0.0f); 255, // this is 0 on PC which results in no shadow
nRandNumber / 2, nRandNumber / 2, 0,
10.0f, 1.0f, 40.0f, 0, 0.0f);
} }
fGreen = nRandNumber / 128; fGreen = nRandNumber / 128;
fRed = nRandNumber / 128; fRed = nRandNumber / 128;

View File

@ -1,22 +1,22 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "main.h" #include "main.h"
#include "PlayerSkin.h" #include "PlayerSkin.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "rtbmp.h" #include "rtbmp.h"
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "World.h" #include "World.h"
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "CdStream.h" #include "CdStream.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "Directory.h" #include "Directory.h"
#include "RwHelper.h" #include "RwHelper.h"
#include "Timer.h" #include "Timer.h"
#include "Lights.h" #include "Lights.h"
int CPlayerSkin::m_txdSlot; int CPlayerSkin::m_txdSlot;
void void
FindPlayerDff(uint32 &offset, uint32 &size) FindPlayerDff(uint32 &offset, uint32 &size)
{ {
@ -32,8 +32,8 @@ FindPlayerDff(uint32 &offset, uint32 &size)
offset = info.offset; offset = info.offset;
size = info.size; size = info.size;
} }
void void
LoadPlayerDff(void) LoadPlayerDff(void)
{ {
@ -65,22 +65,22 @@ LoadPlayerDff(void)
if (streamWasAdded) if (streamWasAdded)
CdStreamRemoveImages(); CdStreamRemoveImages();
} }
void void
CPlayerSkin::Initialise(void) CPlayerSkin::Initialise(void)
{ {
m_txdSlot = CTxdStore::AddTxdSlot("skin"); m_txdSlot = CTxdStore::AddTxdSlot("skin");
CTxdStore::Create(m_txdSlot); CTxdStore::Create(m_txdSlot);
CTxdStore::AddRef(m_txdSlot); CTxdStore::AddRef(m_txdSlot);
} }
void void
CPlayerSkin::Shutdown(void) CPlayerSkin::Shutdown(void)
{ {
CTxdStore::RemoveTxdSlot(m_txdSlot); CTxdStore::RemoveTxdSlot(m_txdSlot);
} }
RwTexture * RwTexture *
CPlayerSkin::GetSkinTexture(const char *texName) CPlayerSkin::GetSkinTexture(const char *texName)
{ {
@ -112,8 +112,8 @@ CPlayerSkin::GetSkinTexture(const char *texName)
RwImageDestroy(image); RwImageDestroy(image);
} }
return tex; return tex;
} }
void void
CPlayerSkin::BeginFrontendSkinEdit(void) CPlayerSkin::BeginFrontendSkinEdit(void)
{ {
@ -163,11 +163,11 @@ CPlayerSkin::RenderFrontendSkinEdit(void)
RpClumpRender(gpPlayerClump); RpClumpRender(gpPlayerClump);
} }
STARTPATCHES STARTPATCHES
InjectHook(0x59B9B0, &CPlayerSkin::Initialise, PATCH_JUMP); InjectHook(0x59B9B0, &CPlayerSkin::Initialise, PATCH_JUMP);
InjectHook(0x59B9E0, &CPlayerSkin::Shutdown, PATCH_JUMP); InjectHook(0x59B9E0, &CPlayerSkin::Shutdown, PATCH_JUMP);
InjectHook(0x59B9F0, &CPlayerSkin::GetSkinTexture, PATCH_JUMP); InjectHook(0x59B9F0, &CPlayerSkin::GetSkinTexture, PATCH_JUMP);
InjectHook(0x59BC70, &CPlayerSkin::BeginFrontendSkinEdit, PATCH_JUMP); InjectHook(0x59BC70, &CPlayerSkin::BeginFrontendSkinEdit, PATCH_JUMP);
InjectHook(0x59BCB0, &CPlayerSkin::EndFrontendSkinEdit, PATCH_JUMP); InjectHook(0x59BCB0, &CPlayerSkin::EndFrontendSkinEdit, PATCH_JUMP);
InjectHook(0x59BCE0, &CPlayerSkin::RenderFrontendSkinEdit, PATCH_JUMP); InjectHook(0x59BCE0, &CPlayerSkin::RenderFrontendSkinEdit, PATCH_JUMP);
ENDPATCHES ENDPATCHES