From 39223901bf459e0548605f64ae030e89fedb9949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 17 Aug 2019 22:03:57 +0300 Subject: AnimViewer messages, Particle fix, Peds --- src/core/AnimViewer.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++---- src/core/Stats.cpp | 2 +- src/core/Stats.h | 2 +- src/core/World.cpp | 6 +++++- src/core/config.h | 1 + src/core/main.cpp | 3 +++ 6 files changed, 54 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 30773889..86b22ec5 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -34,6 +34,8 @@ #include "Timecycle.h" #include "RpAnimBlend.h" #include "Shadows.h" +#include "Radar.h" +#include "Hud.h" int CAnimViewer::animTxdSlot = 0; CEntity *CAnimViewer::pTarget = nil; @@ -70,7 +72,8 @@ CAnimViewer::Initialise(void) { } gbModelViewer = true; - + CHud::m_Wants_To_Draw_Hud = false; + ThePaths.Init(); ThePaths.AllocatePathFindInfoMem(4500); CCollision::Init(); @@ -90,6 +93,8 @@ CAnimViewer::Initialise(void) { CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE); CStreaming::LoadAllRequestedModels(false); CRenderer::Init(); + CRadar::Initialise(); + CRadar::LoadTextures(); CVehicleModelInfo::LoadVehicleColours(); CAnimManager::LoadAnimFiles(); CWorld::PlayerInFocus = 0; @@ -297,10 +302,15 @@ CAnimViewer::Update(void) if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { nextModelId = LastPedModelId(modelId); + AsciiToUnicode("Switched to peds", gUString); + CMessages::AddMessage(gUString, 1000, 0); } else { // Start in mobile - if (pad->NewState.Square && !pad->OldState.Square) + if (pad->NewState.Square && !pad->OldState.Square) { CVehicleModelInfo::LoadVehicleColours(); + AsciiToUnicode("Carcols.dat reloaded", gUString); + CMessages::AddMessage(gUString, 1000, 0); + } } } } else { @@ -309,12 +319,18 @@ CAnimViewer::Update(void) // Triangle in mobile if (pad->NewState.Square && !pad->OldState.Square) { reloadIFP = 1; + AsciiToUnicode("IFP reloaded", gUString); + CMessages::AddMessage(gUString, 1000, 0); } else if (pad->NewState.Cross && !pad->OldState.Cross) { PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); + AsciiToUnicode("Animation restarted", gUString); + CMessages::AddMessage(gUString, 1000, 0); } else if (pad->NewState.Circle && !pad->OldState.Circle) { PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE); + AsciiToUnicode("Idle animation playing", gUString); + CMessages::AddMessage(gUString, 1000, 0); } else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) { animId--; @@ -323,19 +339,33 @@ CAnimViewer::Update(void) } PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); + sprintf(gString, "Current anim: %d", animId); + AsciiToUnicode(gString, gUString); + CMessages::AddMessage(gUString, 1000, 0); + } else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) { animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1); PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); + sprintf(gString, "Current anim: %d", animId); + AsciiToUnicode(gString, gUString); + CMessages::AddMessage(gUString, 1000, 0); + } else { if (pad->NewState.Start && !pad->OldState.Start) { } else { if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { nextModelId = LastVehicleModelId(modelId); + AsciiToUnicode("Switched to vehicles", gUString); + CMessages::AddMessage(gUString, 1000, 0); } else { -// if (CPad::GetPad(1)->NewState.LeftShoulder2) -// CPedModelInfo::AnimatePedColModelSkinned(CModelInfo::ms_modelInfoPtrs[(pTarget + 96)], pTarget->GetClump())); + // Originally it was GetPad(1)->LeftShoulder2 + if (pad->NewState.Triangle) { + CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump())); + AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); + CMessages::AddMessage(gUString, 100, 0); + } } } } @@ -344,8 +374,17 @@ CAnimViewer::Update(void) if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) { nextModelId = FindMeAModelID(modelId, -1); + + sprintf(gString, "Current model ID: %d", nextModelId); + AsciiToUnicode(gString, gUString); + CMessages::AddMessage(gUString, 1000, 0); + } else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) { nextModelId = FindMeAModelID(modelId, 1); + + sprintf(gString, "Current model ID: %d", nextModelId); + AsciiToUnicode(gString, gUString); + CMessages::AddMessage(gUString, 1000, 0); } // There were extra codes here to let us change model id by 50, but xbox CPad struct is different, so I couldn't port. diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 9d0e7df1..d4d91dac 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -2,7 +2,7 @@ #include "Stats.h" int32 &CStats::DaysPassed = *(int32*)0x8F2BB8; -int32 &CStats::HeadShots = *(int32*)0x8F647C; +int32 &CStats::HeadsPopped = *(int32*)0x8F647C; bool& CStats::CommercialPassed = *(bool*)0x8F4334; bool& CStats::IndustrialPassed = *(bool*)0x8E2A68; int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C; diff --git a/src/core/Stats.h b/src/core/Stats.h index 90db25e8..53c40ca3 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -4,7 +4,7 @@ class CStats { public: static int32 &DaysPassed; - static int32 &HeadShots; + static int32 &HeadsPopped; static bool& CommercialPassed; static bool& IndustrialPassed; static int32 &NumberKillFrenziesPassed; diff --git a/src/core/World.cpp b/src/core/World.cpp index 9c3aafcf..150e87d5 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -294,10 +294,14 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP if(e->IsPed()){ if(e->bUsesCollision || deadPeds && ((CPed*)e)->m_nPedState == PED_DEAD){ - if(((CPed*)e)->UseGroundColModel()) + if (((CPed*)e)->UseGroundColModel()) colmodel = &CTempColModels::ms_colModelPedGroundHit; else +#ifdef ANIMATE_PED_COL_MODEL + colmodel = CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(), RpClumpGetFrame(e->GetClump())); +#else colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(); +#endif }else colmodel = nil; }else if(e->bUsesCollision) diff --git a/src/core/config.h b/src/core/config.h index 8eda6187..de89f7c3 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -130,3 +130,4 @@ enum Config { #define ASPECT_RATIO_SCALE #define USE_DEBUG_SCRIPT_LOADER #define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher +#define ANIMATE_PED_COL_MODEL diff --git a/src/core/main.cpp b/src/core/main.cpp index 7d60291c..50494ef3 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -121,9 +121,12 @@ TheModelViewer(void) CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255); + CSprite2d::InitPerFrame(); + CFont::InitPerFrame(); DefinedState(); CVisibilityPlugins::InitAlphaEntityList(); CAnimViewer::Render(); + Render2dStuff(); DoRWStuffEndOfFrame(); } #endif -- cgit v1.2.3