summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-06-08 13:00:45 +0200
committeraap <aap@papnet.eu>2020-06-08 13:01:23 +0200
commitd5515c9d0efd57348d50e450f5632cdf0ffeca73 (patch)
treece4ee23891a5167e5de15bb5d8fda1d1d5eab480 /src/core
parentMerge branch 'master' into miami (diff)
downloadre3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.gz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.bz2
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.lz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.xz
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.tar.zst
re3-d5515c9d0efd57348d50e450f5632cdf0ffeca73.zip
Diffstat (limited to '')
-rw-r--r--src/core/AnimViewer.cpp171
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/main.cpp2
-rw-r--r--src/core/re3.cpp1
4 files changed, 80 insertions, 98 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 35106a6b..f71f5f87 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -12,6 +12,7 @@
#include "General.h"
#include "Camera.h"
#include "Vehicle.h"
+#include "Bike.h"
#include "PlayerSkin.h"
#include "PlayerInfo.h"
#include "World.h"
@@ -47,6 +48,10 @@ CAnimViewer::Render(void) {
if (pTarget) {
// pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
if (pTarget) {
+#ifdef FIX_BUGS
+ if(pTarget->IsPed())
+ ((CPed*)pTarget)->UpdateRpHAnim();
+#endif
pTarget->Render();
CRenderer::RenderOneNonRoad(pTarget);
}
@@ -67,11 +72,7 @@ CAnimViewer::Initialise(void) {
CReferences::Init();
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
-
- // I didn't get which camera og code selects.
- for (int i = 0; i < 3; i++) {
- TheCamera.Cams[i].Distance = 5.0f;
- }
+ TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f;
gbModelViewer = true;
CHud::m_Wants_To_Draw_Hud = false;
@@ -89,19 +90,20 @@ CAnimViewer::Initialise(void) {
CPedStats::Initialise();
CMessages::Init();
CdStreamAddImage("MODELS\\GTA3.IMG");
+ CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
CFileLoader::LoadLevel("DATA\\ANIMVIEWER.DAT");
CStreaming::Init();
+ for(int i = 0; i < MODELINFOSIZE; i++)
+ if(CModelInfo::GetModelInfo(i))
+ CModelInfo::GetModelInfo(i)->ConvertAnimFileIndex();
CStreaming::LoadInitialPeds();
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
CRenderer::Init();
- CRadar::Initialise();
- CRadar::LoadTextures();
CVehicleModelInfo::LoadVehicleColours();
CAnimManager::LoadAnimFiles();
CWorld::PlayerInFocus = 0;
CWeapon::InitialiseWeapons();
- CShadows::Init();
CPed::Initialise();
CTimer::Initialise();
CClock::Initialise(60000);
@@ -134,11 +136,7 @@ CAnimViewer::Initialise(void) {
}
CFileMgr::CloseFile(fd);
} else {
- // From xbox
- CStreaming::RequestSpecialChar(0, "luigi", STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestSpecialChar(1, "joey", STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestSpecialChar(2, "tony", STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestSpecialChar(3, "curly", STREAMFLAGS_DONT_REMOVE);
+ // TODO? maybe request some special models here so the thing doesn't crash
}
}
@@ -146,30 +144,33 @@ int
LastPedModelId(int modelId)
{
CBaseModelInfo *model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_PED)
- return i;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_PED)
+ break;
+ modelId--;
}
return modelId;
}
int
-LastVehicleModelId(int modelId)
+FirstCarModelId(int modelId)
{
- CBaseModelInfo* model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_VEHICLE)
- return i;
+ CBaseModelInfo *model;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_VEHICLE)
+ break;
+ modelId++;
}
return modelId;
}
-// It's me that named this.
int
-FindMeAModelID(int modelId, int wantedChange)
+NextModelId(int modelId, int wantedChange)
{
// Max. 2 trials wasn't here, it's me that added it.
@@ -213,14 +214,13 @@ void
CAnimViewer::Update(void)
{
static int modelId = 0;
- static int animId = 0;
+ static int animId = 17; ////////////////////////////0;
// Please don't make this bool, static bool's are problematic on my side.
static int reloadIFP = 0;
AssocGroupId animGroup = ASSOCGRP_STD;
int nextModelId = modelId;
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
- CEntity *newEntity = nil;
if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
@@ -261,40 +261,32 @@ CAnimViewer::Update(void)
if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
- if (veh->m_vehicleType != VEHICLE_TYPE_CAR) {
- // Not ready yet
-/* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT)
- {
- v33 = (CBoat*)CVehicle::operator new((CVehicle*)0x488, v6);
- CBoat::CBoat(v33, modelId, 1u);
- newEntity = (int)v33;
- pTarget = (int)v33;
- }
- else
- {
-*/ newEntity = pTarget = new CObject(modelId, true);
- if (!modelInfo->GetColModel()) {
- modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
- }
-// }
+ if (veh->m_vehicleType == VEHICLE_TYPE_CAR) {
+ pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
+ } else if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) {
+ pTarget = new CBoat(modelId, RANDOM_VEHICLE);
+ } else if (veh->m_vehicleType == VEHICLE_TYPE_BIKE) {
+ pTarget = new CBike(modelId, RANDOM_VEHICLE);
} else {
- newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
- newEntity->SetStatus(STATUS_ABANDONED);
+ pTarget = new CObject(modelId, true);
+ if (!modelInfo->GetColModel()) {
+ modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
+ }
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
} else if (modelInfo->GetModelType() == MITYPE_PED) {
- pTarget = newEntity = new CPed(PEDTYPE_CIVMALE);
- newEntity->SetModelIndex(modelId);
+ pTarget = new CPed(PEDTYPE_CIVMALE);
+ pTarget->SetModelIndex(modelId);
} else {
- newEntity = pTarget = new CObject(modelId, true);
+ pTarget = new CObject(modelId, true);
if (!modelInfo->GetColModel())
{
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
}
- newEntity->SetPosition(0.0f, 0.0f, 0.0f);
- CWorld::Add(newEntity);
+ pTarget->SetPosition(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pTarget);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
@@ -302,43 +294,26 @@ CAnimViewer::Update(void)
}
pTarget->GetMatrix().GetPosition().z = 0.0f;
- if (modelInfo->GetModelType() != MITYPE_PED) {
-
- if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
-
- 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) {
- CVehicleModelInfo::LoadVehicleColours();
- AsciiToUnicode("Carcols.dat reloaded", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- }
- }
- }
- } else {
+ if (modelInfo->GetModelType() == MITYPE_PED) {
((CPed*)pTarget)->bKindaStayInSamePlace = true;
// Triangle in mobile
- if (pad->NewState.Square && !pad->OldState.Square) {
+ if (pad->GetSquareJustDown()) {
reloadIFP = 1;
AsciiToUnicode("IFP reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Cross && !pad->OldState.Cross) {
+ } else if (pad->GetCrossJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
AsciiToUnicode("Animation restarted", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Circle && !pad->OldState.Circle) {
+ } else if (pad->GetCircleJustDown()) {
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) {
+ } else if (pad->GetDPadUpJustDown()) {
animId--;
if (animId < 0) {
animId = NUM_ANIMS - 1;
@@ -349,7 +324,7 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) {
+ } else if (pad->GetDPadDownJustDown()) {
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
@@ -357,36 +332,42 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else {
- if (pad->NewState.Start && !pad->OldState.Start) {
+ } else if (pad->GetStartJustDown()) {
- } else {
- if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
- nextModelId = LastVehicleModelId(modelId);
- AsciiToUnicode("Switched to vehicles", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- } else {
- // Originally it was GetPad(1)->LeftShoulder2
- if (pad->NewState.Triangle) {
- ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
- AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
- CMessages::AddMessage(gUString, 100, 0);
- }
- }
- }
+ } else if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = FirstCarModelId(modelId);
+ AsciiToUnicode("Switched to vehicles", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Originally it was GetPad(1)->LeftShoulder2
+ } else if (pad->NewState.Triangle) {
+ ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
+ AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
+ CMessages::AddMessage(gUString, 100, 0);
+ }
+ } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
+
+ if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = LastPedModelId(modelId);
+ AsciiToUnicode("Switched to peds", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Start in mobile
+ } else if (pad->GetSquareJustDown()) {
+ CVehicleModelInfo::LoadVehicleColours();
+ AsciiToUnicode("Carcols.dat reloaded", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
}
}
}
- if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) {
- nextModelId = FindMeAModelID(modelId, -1);
+ if (pad->GetDPadLeftJustDown()) {
+ nextModelId = NextModelId(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);
+ } else if (pad->GetDPadRightJustDown()) {
+ nextModelId = NextModelId(modelId, 1);
sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 204d9a18..f38e48f0 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -1274,8 +1274,8 @@ void CPad::UpdatePads(void)
GetPad(0)->UpdateMouse();
#ifdef XINPUT
- GetPad(0)->AffectFromXinput(0);
- GetPad(1)->AffectFromXinput(1);
+ GetPad(0)->AffectFromXinput(m_bMapPadOneToPadTwo ? 1 : 0);
+ GetPad(1)->AffectFromXinput(m_bMapPadOneToPadTwo ? 0 : 1);
#else
CapturePad(0);
#endif
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 2ea15589..d6837ba9 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1240,7 +1240,7 @@ TheModelViewer(void)
CTimer::Update();
SetLightsWithTimeOfDayColour(Scene.world);
CRenderer::ConstructRenderList();
- DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
+ DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed()*0.5f, CTimeCycle::GetSkyTopGreen()*0.5f, CTimeCycle::GetSkyTopBlue()*0.5f,
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
255);
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 77c387b3..13db1f6a 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -485,6 +485,7 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
+ DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);