diff options
author | erorcun <erayorcunus@gmail.com> | 2020-12-03 11:06:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 11:06:55 +0100 |
commit | a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4 (patch) | |
tree | b0e7d42629563fe847a199cfd7f3253f59d173a9 /src/core | |
parent | Merge pull request #861 from erorcun/miami (diff) | |
parent | AnimViewer done, comment cleanup (diff) | |
download | re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar.gz re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar.bz2 re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar.lz re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar.xz re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.tar.zst re3-a37ce3ee9f405e3a05bbcde73c56d3bf82004ab4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/AnimViewer.cpp | 49 | ||||
-rw-r--r-- | src/core/main.cpp | 30 |
2 files changed, 50 insertions, 29 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index d39be754..2b45ce02 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -18,6 +18,7 @@ #include "World.h" #include "Renderer.h" #include "AnimManager.h" +#include "AnimBlendAssocGroup.h" #include "AnimViewer.h" #include "PlayerPed.h" #include "Pools.h" @@ -60,11 +61,14 @@ CAnimViewer::Render(void) { void CAnimViewer::Initialise(void) { - LoadingScreen("Loading the ModelViewer", "", GetRandomSplashScreen()); - animTxdSlot = CTxdStore::AddTxdSlot("generic"); - CTxdStore::Create(animTxdSlot); + + // we need messages, messages needs hud, hud needs those int hudSlot = CTxdStore::AddTxdSlot("hud"); CTxdStore::LoadTxd(hudSlot, "MODELS/HUD.TXD"); + CHud::m_Wants_To_Draw_Hud = false; + + animTxdSlot = CTxdStore::AddTxdSlot("generic"); + CTxdStore::Create(animTxdSlot); int particleSlot = CTxdStore::AddTxdSlot("particle"); CTxdStore::LoadTxd(particleSlot, "MODELS/PARTICLE.TXD"); CTxdStore::SetCurrentTxd(animTxdSlot); @@ -73,10 +77,6 @@ CAnimViewer::Initialise(void) { TheCamera.Init(); TheCamera.SetRwCamera(Scene.camera); TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f; - - gbModelViewer = true; - CHud::m_Wants_To_Draw_Hud = false; - ThePaths.Init(); ThePaths.AllocatePathFindInfoMem(4500); CCollision::Init(); @@ -138,6 +138,25 @@ CAnimViewer::Initialise(void) { } else { // TODO? maybe request some special models here so the thing doesn't crash } + + // From LCS. idk if needed + int vanBlock = CAnimManager::GetAnimationBlockIndex("van"); + int bikesBlock = CAnimManager::GetAnimationBlockIndex("bikes"); + int bikevBlock = CAnimManager::GetAnimationBlockIndex("bikev"); + int bikehBlock = CAnimManager::GetAnimationBlockIndex("bikeh"); + int bikedBlock = CAnimManager::GetAnimationBlockIndex("biked"); + CStreaming::FlushRequestList(); + CStreaming::RequestAnim(vanBlock, STREAMFLAGS_DEPENDENCY); + CStreaming::RequestAnim(bikesBlock, STREAMFLAGS_DEPENDENCY); + CStreaming::RequestAnim(bikevBlock, STREAMFLAGS_DEPENDENCY); + CStreaming::RequestAnim(bikehBlock, STREAMFLAGS_DEPENDENCY); + CStreaming::RequestAnim(bikedBlock, STREAMFLAGS_DEPENDENCY); + CStreaming::LoadAllRequestedModels(false); + CAnimManager::AddAnimBlockRef(vanBlock); + CAnimManager::AddAnimBlockRef(bikesBlock); + CAnimManager::AddAnimBlockRef(bikevBlock); + CAnimManager::AddAnimBlockRef(bikehBlock); + CAnimManager::AddAnimBlockRef(bikedBlock); } int @@ -215,8 +234,7 @@ CAnimViewer::Update(void) { static int modelId = 0; static int animId = 0; - // Please don't make this bool, static bool's are problematic on my side. - static int reloadIFP = 0; + static bool reloadIFP = false; AssocGroupId animGroup = ASSOCGRP_STD; int nextModelId = modelId; @@ -241,7 +259,7 @@ CAnimViewer::Update(void) CAnimManager::Initialise(); CAnimManager::LoadAnimFiles(); - reloadIFP = 0; + reloadIFP = false; } } else { animGroup = ASSOCGRP_STD; @@ -299,7 +317,7 @@ CAnimViewer::Update(void) // Triangle in mobile if (pad->GetSquareJustDown()) { - reloadIFP = 1; + reloadIFP = true; AsciiToUnicode("IFP reloaded", gUString); CMessages::AddMessage(gUString, 1000, 0); @@ -316,7 +334,7 @@ CAnimViewer::Update(void) } else if (pad->GetDPadUpJustDown()) { animId--; if (animId < 0) { - animId = NUM_ANIMS - 1; + animId = NUM_STD_ANIMS - 1; } PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); @@ -325,7 +343,7 @@ CAnimViewer::Update(void) CMessages::AddMessage(gUString, 1000, 0); } else if (pad->GetDPadDownJustDown()) { - animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1); + animId = (animId == (NUM_STD_ANIMS - 1) ? 0 : animId + 1); PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); sprintf(gString, "Current anim: %d", animId); @@ -344,6 +362,11 @@ CAnimViewer::Update(void) AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); CMessages::AddMessage(gUString, 100, 0); } + + // From LCS + if (CAnimManager::GetAnimAssocGroups()[animGroup].numAssociations <= animId) + animId = 0; + } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) { if (pad->GetLeftShoulder1JustDown()) { diff --git a/src/core/main.cpp b/src/core/main.cpp index ef40777f..7fb07fff 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -599,8 +599,10 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) AsciiToUnicode(str1, tmpstr); CFont::PrintString(hpos, top, tmpstr); top += 22*yscale; - AsciiToUnicode(str2, tmpstr); - CFont::PrintString(hpos, top, tmpstr); + if (str2) { + AsciiToUnicode(str2, tmpstr); + CFont::PrintString(hpos, top, tmpstr); + } #endif } @@ -1424,15 +1426,6 @@ AppEventHandler(RsEvent event, void *param) return rsEVENTPROCESSED; } -#ifndef MASTER - case rsANIMVIEWER: - { - TheModelViewer(); - - return rsEVENTPROCESSED; - } -#endif - default: { return rsEVENTNOTPROCESSED; @@ -1448,22 +1441,27 @@ TheModelViewer(void) //TODO #else - CDraw::CalculateAspectRatio(); + // This is not original. Because; + // 1- We want 2D things to be initalized, whereas original AnimViewer doesn't use them. my additions marked with X + // 2- VC Mobile code run it like main function(as opposed to III and LCS), so it has it's own loop inside it, but our func. already called in a loop. + + CDraw::CalculateAspectRatio(); // X CAnimViewer::Update(); - CTimer::Update(); SetLightsWithTimeOfDayColour(Scene.world); CRenderer::ConstructRenderList(); DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed()*0.5f, CTimeCycle::GetSkyTopGreen()*0.5f, CTimeCycle::GetSkyTopBlue()*0.5f, CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255); - CSprite2d::InitPerFrame(); - CFont::InitPerFrame(); + CSprite2d::SetRecipNearClip(); // X + CSprite2d::InitPerFrame(); // X + CFont::InitPerFrame(); // X DefinedState(); CVisibilityPlugins::InitAlphaEntityList(); CAnimViewer::Render(); - Render2dStuff(); + Render2dStuff(); // X DoRWStuffEndOfFrame(); + CTimer::Update(); #endif } #endif |