Compare commits
13 Commits
ph3nom/tex
...
ph3nom/upd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
282b639a4c | ||
|
|
69f9bbcf7b | ||
|
|
40f212e131 | ||
|
|
43c0e99ebf | ||
|
|
42647ddc6b | ||
|
|
b3ccf1f900 | ||
|
|
baf7612fcf | ||
|
|
33b9dd1c8a | ||
|
|
5786eeecb8 | ||
|
|
20864fdac6 | ||
|
|
1587d707a8 | ||
|
|
911b93bd0f | ||
|
|
e86fb27a48 |
@@ -140,7 +140,7 @@ CAnimBlendNode::GetCurrentTranslation(CVector &trans, float weight)
|
||||
float blend = association->GetBlendAmount(weight);
|
||||
if(blend > 0.0f){
|
||||
auto kfAdt = sequence->GetDeltaTime(frameA);
|
||||
float t = (kfAdt - remainingTime)/kfAdt;
|
||||
float t = kfAdt == 0.0f ? 0.0f : (kfAdt - remainingTime)/kfAdt;
|
||||
if(sequence->type & CAnimBlendSequence::KF_TRANS){
|
||||
auto kfAt = sequence->GetTranslation(frameA);
|
||||
auto kfBt = sequence->GetTranslation(frameB);
|
||||
|
||||
@@ -3789,6 +3789,10 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms)
|
||||
if (iSound > 60)
|
||||
iSound = 21;
|
||||
}
|
||||
// In some cases the left and right channels have different loop points
|
||||
// This looks like a data file issue where the left and right channels have different loop points
|
||||
// This is a hot fix to always have the correct loop point for each channel individually
|
||||
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,8 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
debugf("StartStreamedFile(%d, %d, %d)\n", nFile, nPos, nStream);
|
||||
uint32_t seek_aligned = 0;
|
||||
if (nPos) {
|
||||
uint32 seek_bytes = nPos * streams[nStream].rate / (streams[nStream].stereo ? 1000: 2000);
|
||||
uint64_t seek_bytes = (uint64_t)nPos * streams[nStream].rate / (streams[nStream].stereo ? 1000: 2000);
|
||||
assert(seek_bytes <= INT32_MAX);
|
||||
seek_aligned = seek_bytes & ~(streams[nStream].stereo ? (STREAM_STAGING_READ_SIZE_STEREO-1) : (STREAM_STAGING_READ_SIZE_MONO-1));
|
||||
}
|
||||
PreloadStreamedFile(nFile, nStream, seek_aligned);
|
||||
@@ -1164,7 +1165,9 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream)
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
int32 rv = 0;
|
||||
|
||||
return streams[nStream].played_samples * 1000 / streams[nStream].rate;
|
||||
int64_t rv64 = (int64_t)streams[nStream].played_samples * 1000 / streams[nStream].rate;
|
||||
assert(rv64 <= INT32_MAX);
|
||||
rv = (int32)rv64;
|
||||
// if(streams[nStream].fd >= 0) {
|
||||
// rv = fs_tell(streams[nStream].fd);
|
||||
// }
|
||||
@@ -1207,7 +1210,10 @@ cSampleManager::GetStreamedFileLength(uint8 nFile)
|
||||
WavHeader hdr;
|
||||
assert(fs_read(fd, &hdr, sizeof(hdr)) == sizeof(hdr));
|
||||
|
||||
rv = hdr.dataSize * 2000 / hdr.numOfChan / hdr.samplesPerSec;
|
||||
uint64_t rv64 = (uint64_t)hdr.dataSize * 2000 / hdr.numOfChan / hdr.samplesPerSec;
|
||||
|
||||
assert(rv64 <= INT32_MAX);
|
||||
rv = (int32)rv64;
|
||||
|
||||
fs_close(fd);
|
||||
|
||||
|
||||
@@ -1721,8 +1721,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||
return 0;
|
||||
int attempts;
|
||||
int model = -1;
|
||||
int index = CGeneral::GetRandomNumberInRange(0, 50);
|
||||
for (attempts = 0; attempts < 50; attempts++) {
|
||||
int index = CGeneral::GetRandomNumberInRange(0, MAXVEHICLESLOADED);
|
||||
for (attempts = 0; attempts < MAXVEHICLESLOADED; attempts++) {
|
||||
if (model != -1)
|
||||
break;
|
||||
model = CStreaming::ms_vehiclesLoaded[index];
|
||||
|
||||
@@ -2785,22 +2785,22 @@ bool CPad::WeaponJustDown(void)
|
||||
case 0: //Xbox Mode
|
||||
if (CPad::GetPad(0)->IsDualAnalog)
|
||||
{
|
||||
if (NewState.RightTrigger > 128)
|
||||
if (NewState.RightTrigger > 128 && !(OldState.RightTrigger > 128))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NewState.RightTrigger > 128)
|
||||
if (NewState.RightTrigger > 128 && !(OldState.RightTrigger > 128))
|
||||
return true;
|
||||
}
|
||||
case 1: //PS2 Mode
|
||||
if (CPad::GetPad(0)->IsDualAnalog)
|
||||
{
|
||||
return NewState.B;
|
||||
return NewState.B && !OldState.B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NewState.B;
|
||||
return NewState.B && !OldState.B;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ CEntity::~CEntity(void)
|
||||
ResolveReferences();
|
||||
}
|
||||
|
||||
bool
|
||||
CEntity::IsFence(void) {
|
||||
return IsObject() && ::IsFence(static_cast<CObject *>(this)->GetModelIndex());
|
||||
}
|
||||
|
||||
void
|
||||
CEntity::SetModelIndex(uint32 id)
|
||||
{
|
||||
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
bool IsPed(void) { return m_type == ENTITY_TYPE_PED; }
|
||||
bool IsObject(void) { return m_type == ENTITY_TYPE_OBJECT; }
|
||||
bool IsDummy(void) { return m_type == ENTITY_TYPE_DUMMY; }
|
||||
bool IsFence(void);
|
||||
|
||||
RpAtomic *GetAtomic(void) {
|
||||
assert(RwObjectGetType(m_rwObject) == rpATOMIC);
|
||||
|
||||
@@ -59,7 +59,7 @@ CPhysical::CPhysical(void)
|
||||
bInfiniteMass = false;
|
||||
bIsInWater = false;
|
||||
bHitByTrain = false;
|
||||
bSkipLineCol = false;
|
||||
bSkipLineCol = IsFence();
|
||||
|
||||
m_fDistanceTravelled = 0.0f;
|
||||
m_treadable[PATH_CAR] = nil;
|
||||
@@ -1461,6 +1461,10 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||
skipCollision = false;
|
||||
altcollision = false;
|
||||
|
||||
if(A->IsFence() && B->IsFence()) {
|
||||
skipCollision = true;
|
||||
A->bSkipLineCol = true;
|
||||
}
|
||||
if(B->IsBuilding())
|
||||
skipCollision = false;
|
||||
else if(IsStreetLight(A->GetModelIndex()) &&
|
||||
@@ -1922,12 +1926,12 @@ CPhysical::ProcessCollision(void)
|
||||
n = NUMSTEPS(0.09f);
|
||||
step = savedTimeStep / n;
|
||||
}
|
||||
}else if(responsecase == COLLRESPONSE_SMALLBOX || responsecase == COLLRESPONSE_FENCEPART){
|
||||
}else if(responsecase == COLLRESPONSE_SMALLBOX){
|
||||
if(distSq >= sq(0.15f)){
|
||||
n = NUMSTEPS(0.15f);
|
||||
step = savedTimeStep / n;
|
||||
}
|
||||
}else{
|
||||
}else if(responsecase != COLLRESPONSE_FENCEPART){
|
||||
if(distSq >= sq(0.3f)){
|
||||
n = NUMSTEPS(0.3f);
|
||||
step = savedTimeStep / n;
|
||||
|
||||
20
vendor/librw/src/dc/rwdc.cpp
vendored
20
vendor/librw/src/dc/rwdc.cpp
vendored
@@ -174,6 +174,7 @@ static pvr_dr_state_t drState;
|
||||
#include <kos/dbglog.h>
|
||||
|
||||
#if !defined(DC_TEXCONV) && !defined(DC_SIM)
|
||||
#include "Timecycle.h"
|
||||
#include <kos.h>
|
||||
|
||||
#define VIDEO_MODE_WIDTH vid_mode->width
|
||||
@@ -305,6 +306,7 @@ void rw_mat_load_4x4(rw::Matrix* mtx) {
|
||||
#define mat_identity(a)
|
||||
#define pvr_fog_table_color(a,r,g,b)
|
||||
#define pvr_fog_table_linear(s,e)
|
||||
#define pvr_fog_table_exp(d)
|
||||
#endif
|
||||
|
||||
#define mat_trans_single3_nomod(x_, y_, z_, x2, y2, z2) do { \
|
||||
@@ -1098,6 +1100,7 @@ static bool doAlphaTest;
|
||||
|
||||
static uint8_t fogFuncPvr = PVR_FOG_DISABLE;
|
||||
static uint32_t fogColor = 0;
|
||||
static float fogStart = 0.0f;
|
||||
static uint32 cullModePvr;
|
||||
|
||||
static inline unsigned pvrCullMode(uint32_t cullMode) {
|
||||
@@ -1198,8 +1201,9 @@ setRenderState(int32 state, void *pvalue)
|
||||
fogFuncPvr = value ? PVR_FOG_TABLE : PVR_FOG_DISABLE;
|
||||
break;
|
||||
case FOGCOLOR:
|
||||
#if !defined(DC_TEXCONV)
|
||||
// Set fog color when state changes
|
||||
if(fogColor != value) {
|
||||
if(fogColor != value || fogStart != CTimeCycle::GetFogStart()) {
|
||||
fogColor = value;
|
||||
RGBA c;
|
||||
c.red = value;
|
||||
@@ -1207,9 +1211,21 @@ setRenderState(int32 state, void *pvalue)
|
||||
c.blue = value>>16;
|
||||
c.alpha = value>>24;
|
||||
pvr_fog_table_color(c.alpha / 255.0f, c.red / 255.0f, c.green / 255.0f, c.blue / 255.0f);
|
||||
pvr_fog_table_linear(50.0f, 450.0f);
|
||||
|
||||
fogStart = CTimeCycle::GetFogStart();
|
||||
//pvr_fog_table_linear(fogStart + 200.0f, fogStart + 450.0f);
|
||||
|
||||
// Fog ranges between -200 (Most Fog) and +100 (least fog) (these are loaded from TIMECYC.DAT)
|
||||
// This formula will transform these values into a density between 0 and 0.02f
|
||||
const float MAX_DENSITY = 0.02f;
|
||||
const float FOG_RANGE = 300.0f;
|
||||
const float FOG_OFFSET = 200.0f;
|
||||
float density = ((FOG_RANGE - (fogStart + FOG_OFFSET)) / FOG_RANGE) * MAX_DENSITY;
|
||||
pvr_fog_table_exp(density);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
// case CULLMODE:
|
||||
// if(rwStateCache.cullmode != value){
|
||||
// rwStateCache.cullmode = value;
|
||||
|
||||
Reference in New Issue
Block a user