Compare commits
6 Commits
skmp/miami
...
ph3nom/mia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80bad15904 | ||
|
|
4a453e3604 | ||
|
|
53261e57ed | ||
|
|
d79e4516a5 | ||
|
|
77530e641d | ||
|
|
ed540c8e00 |
@@ -1269,6 +1269,9 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
}
|
||||
|
||||
debug("Loading ANIMS %s\n", animBlock->name);
|
||||
|
||||
bool stub_out = strcmp(animBlock->name, "law_1b") == 0;
|
||||
|
||||
animBlock->isLoaded = true;
|
||||
|
||||
int animIndex = animBlock->firstIndex;
|
||||
@@ -1321,12 +1324,12 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
RwStreamRead(stream, &info, sizeof(info));
|
||||
if(strncmp(info.ident, "KRTS", 4) == 0){
|
||||
hasScale = true;
|
||||
seq->SetNumFrames(numFrames, true, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, true, compressHier);
|
||||
}else if(strncmp(info.ident, "KRT0", 4) == 0){
|
||||
hasTranslation = true;
|
||||
seq->SetNumFrames(numFrames, true, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, true, compressHier);
|
||||
}else if(strncmp(info.ident, "KR00", 4) == 0){
|
||||
seq->SetNumFrames(numFrames, false, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, false, compressHier);
|
||||
}
|
||||
if(strstr(seq->name, "L Toe"))
|
||||
debug("anim %s has toe keyframes\n", hier->name); // BUG: seq->name
|
||||
@@ -1339,9 +1342,10 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
|
||||
rot.Invert();
|
||||
CVector trans(fbuf[4], fbuf[5], fbuf[6]);
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
}
|
||||
// scaling ignored
|
||||
frameTimes[l] = fbuf[10]; // absolute time here
|
||||
}else if(hasTranslation){
|
||||
@@ -1350,15 +1354,18 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
rot.Invert();
|
||||
CVector trans(fbuf[4], fbuf[5], fbuf[6]);
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
}
|
||||
frameTimes[l] = fbuf[7]; // absolute time here
|
||||
}else{
|
||||
RwStreamRead(stream, buf, 0x14);
|
||||
CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
|
||||
rot.Invert();
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
}
|
||||
frameTimes[l] = fbuf[4]; // absolute time here
|
||||
}
|
||||
}
|
||||
@@ -1367,9 +1374,11 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
float running_sum = 0.0f;
|
||||
for (l = 0; l < numFrames; l++) {
|
||||
auto dt = frameTimes[l] - running_sum;
|
||||
seq->SetDeltaTime(l, dt);
|
||||
assert(seq->GetDeltaTime(l) <= dt);
|
||||
running_sum += seq->GetDeltaTime(l);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetDeltaTime(l, dt);
|
||||
assert(seq->GetDeltaTime(l) <= dt);
|
||||
running_sum += seq->GetDeltaTime(l);
|
||||
}
|
||||
// if (seq->GetDeltaTime(l) == 0.0f && dt != 0.0f) {
|
||||
// seq->SetDeltaTime(l, KF_MINDELTA);
|
||||
// }
|
||||
|
||||
@@ -1100,13 +1100,13 @@ CRadar::LoadTextures()
|
||||
WaypointSprite.SetTexture("radar_waypoint");
|
||||
if(!WaypointSprite.m_pTexture) {
|
||||
// create the texture if it's missing in TXD
|
||||
#define WAYPOINT_R (255)
|
||||
#define WAYPOINT_G (72)
|
||||
#define WAYPOINT_B (77)
|
||||
#define WAYPOINT_R (255>>4)
|
||||
#define WAYPOINT_G (72>>4)
|
||||
#define WAYPOINT_B (77>>4)
|
||||
|
||||
RwRaster *raster = RwRasterCreate(16, 16, 0, rwRASTERTYPETEXTURE | rwRASTERFORMAT8888);
|
||||
RwRaster *raster = RwRasterCreate(16, 16, 16, rwRASTERTYPETEXTURE | rwRASTERFORMAT4444);
|
||||
|
||||
RwUInt32 *pixels = (RwUInt32 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE);
|
||||
RwUInt16 *pixels = (RwUInt16 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE);
|
||||
for(int x = 0; x < 16; x++)
|
||||
for(int y = 0; y < 16; y++)
|
||||
{
|
||||
@@ -1117,13 +1117,9 @@ CRadar::LoadTextures()
|
||||
|| (x2 < 1 && y2 == 1)) // one pixel on each side of second to first/last line is transparent
|
||||
pixels[x + y * 16] = 0;
|
||||
else if((x2 == 2 && y2 >= 2)|| (y2 == 2 && x2 >= 2) )// colored square inside
|
||||
#ifdef RW_GL3
|
||||
pixels[x + y * 16] = WAYPOINT_R | (WAYPOINT_G << 8) | (WAYPOINT_B << 16) | (255 << 24);
|
||||
#else
|
||||
pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 8) | (WAYPOINT_R << 16) | (255 << 24);
|
||||
#endif
|
||||
pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 4) | (WAYPOINT_R << 8) | (255 << 12);
|
||||
else
|
||||
pixels[x + y * 16] = 0xFF000000; // black
|
||||
pixels[x + y * 16] = 0xF000; // black
|
||||
}
|
||||
RwRasterUnlock(raster);
|
||||
WaypointSprite.m_pTexture = RwTextureCreate(raster);
|
||||
|
||||
@@ -676,7 +676,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
if(ms_aInfoForModel[streamId].m_loadState != STREAMSTATE_STARTED){
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
if(streamId < STREAM_OFFSET_TXD) {
|
||||
if (streamId < STREAM_OFFSET_TXD || streamId >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("ConvertBufferToObject: Memory used: %d\n", ms_memoryUsed);
|
||||
}
|
||||
@@ -746,7 +746,7 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
|
||||
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
if(streamId < STREAM_OFFSET_TXD) {
|
||||
if (streamId < STREAM_OFFSET_TXD || streamId >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("FinishLoadingLargeFile: Memory used: %d\n", ms_memoryUsed);
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ CStreaming::RemoveModel(int32 id)
|
||||
assert(id < NUMSTREAMINFO);
|
||||
CAnimManager::RemoveAnimBlock(id - STREAM_OFFSET_ANIM);
|
||||
}
|
||||
if (id < STREAM_OFFSET_TXD) {
|
||||
if (id < STREAM_OFFSET_TXD || id >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("Remove Model: %d\n", ms_memoryUsed);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ CClouds::Render(void)
|
||||
CCoronas::SunBlockedByClouds = false;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
|
||||
@@ -194,6 +194,10 @@ char* casepath(char const* path, bool checkPathFirst)
|
||||
}
|
||||
|
||||
size_t l = strlen(path);
|
||||
if (l > 2 && path[0] == '.' && (path[1] == '/' || path[1] == '\\')) {
|
||||
// remove ./ from the start of the path
|
||||
path += 2;
|
||||
}
|
||||
char* p = (char*)alloca(l + 1);
|
||||
char* out = (char*)malloc(l + 3); // for extra ./
|
||||
strcpy(p, path);
|
||||
|
||||
@@ -136,31 +136,28 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
pPed->InflictDamage(pBullet->m_pSource, pBullet->m_eWeaponType, pBullet->m_nDamage, (ePedPieceTypes)point.pieceB, pPed->GetLocalDirection(pPed->GetPosition() - point.point));
|
||||
CEventList::RegisterEvent(pPed->m_nPedType == PEDTYPE_COP ? EVENT_SHOOT_COP : EVENT_SHOOT_PED, EVENT_ENTITY_PED, pPed, (CPed*)pBullet->m_pSource, 1000);
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
}
|
||||
if (CGame::nastyGame) {
|
||||
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
|
||||
vecParticleDirection.z = 0.01f;
|
||||
if (pPed->GetIsOnScreen()) {
|
||||
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
|
||||
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
|
||||
}
|
||||
if (pPed->GetPedState() == PED_DEAD) {
|
||||
CAnimBlendAssociation* pAnim;
|
||||
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
|
||||
else
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
|
||||
if (pAnim) {
|
||||
pAnim->SetCurrentTime(0.0f);
|
||||
pAnim->flags |= ASSOC_RUNNING;
|
||||
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
|
||||
|
||||
if (CGame::nastyGame) {
|
||||
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
|
||||
vecParticleDirection.z = 0.01f;
|
||||
if (pPed->GetIsOnScreen()) {
|
||||
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
|
||||
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
|
||||
}
|
||||
if (pPed->GetPedState() == PED_DEAD) {
|
||||
CAnimBlendAssociation* pAnim;
|
||||
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
|
||||
else
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
|
||||
if (pAnim) {
|
||||
pAnim->SetCurrentTime(0.0f);
|
||||
pAnim->flags |= ASSOC_RUNNING;
|
||||
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
|
||||
Reference in New Issue
Block a user