- implement ProcessMotionLump, SetupPedMotionData, SetupPedestrian, StoreVertexLists, SetupSkelModelPointers

This commit is contained in:
Ilya Shurumov 2020-05-23 20:36:27 +06:00
parent 8f3c6156e6
commit d90c95ddb1

View File

@ -1,16 +1,8 @@
#include "THISDUST.H" #include "THISDUST.H"
#include "MOTION_C.H" #include "MOTION_C.H"
#include "PEDEST.H"
TEXTURE_DETAILS jeans_texture; #include "SYSTEM.H"
TEXTURE_DETAILS arm1_texture; #include "STRINGS.H"
TEXTURE_DETAILS forearm1_texture;
TEXTURE_DETAILS chest1_texture;
TEXTURE_DETAILS head1_texture;
MODEL* gPed1HeadModelPtr;
MODEL* gPed2HeadModelPtr;
MODEL* gPed3HeadModelPtr;
MODEL* gPed4HeadModelPtr;
LIMBS lRoutes[5][8] = { LIMBS lRoutes[5][8] = {
{ROOT, LOWERBACK, HIPS, LHIP, LKNEE, LFOOT, LTOE, ROOT}, {ROOT, LOWERBACK, HIPS, LHIP, LKNEE, LFOOT, LTOE, ROOT},
@ -47,7 +39,7 @@ PED_DATA MainPed[23] =
{ 2, 68u, &jeans_texture, JEANS_PAL } { 2, 68u, &jeans_texture, JEANS_PAL }
}; };
/*
// FIXME: could be incorrect // FIXME: could be incorrect
BONE Skel[23] = BONE Skel[23] =
{ {
@ -305,10 +297,24 @@ BONE Skel[23] =
NULL NULL
} }
}; };
*/
int boneIdvals[15] = { 2, 3, 4, 6, 7, 8, 0xA, 0xB, 0xC, 0xF, 0x10, 0x11, 0x13, 0x14, 0x15 }; int boneIdvals[15] = { 2, 3, 4, 6, 7, 8, 0xA, 0xB, 0xC, 0xF, 0x10, 0x11, 0x13, 0x14, 0x15 };
TEXTURE_DETAILS jeans_texture;
TEXTURE_DETAILS arm1_texture;
TEXTURE_DETAILS forearm1_texture;
TEXTURE_DETAILS chest1_texture;
TEXTURE_DETAILS head1_texture;
MODEL* gPed1HeadModelPtr;
MODEL* gPed2HeadModelPtr;
MODEL* gPed3HeadModelPtr;
MODEL* gPed4HeadModelPtr;
char* MotionCaptureData[24]; // [A] actually, pointers
int ThisMotion;
// decompiled code // decompiled code
// original method signature: // original method signature:
@ -328,18 +334,21 @@ int boneIdvals[15] = { 2, 3, 4, 6, 7, 8, 0xA, 0xB, 0xC, 0xF, 0x10, 0x11, 0x13, 0
// Start line: 5202 // Start line: 5202
/* end block 3 */ /* end block 3 */
// End Line: 5203 // End Line: 5203
// [D]
void ProcessMotionLump(char *lump_ptr, int lump_size) void ProcessMotionLump(char *lump_ptr, int lump_size)
{ {
UNIMPLEMENTED(); if (ThisMotion < 24)
/* {
if (ThisMotion < 0x18) { int size = (lump_size + 3U & 0xfffffffc);
memcpy(mallocptr, lump_ptr, lump_size);
*(char **)(MotionCaptureData + ThisMotion) = mallocptr; MALLOC_BEGIN();
mallocptr = mallocptr + (lump_size + 3U & 0xfffffffc); MotionCaptureData[ThisMotion] = D_MALLOC(size);
ThisMotion = ThisMotion + 1; MALLOC_END();
memcpy(MotionCaptureData[ThisMotion], lump_ptr, lump_size);
ThisMotion++;
} }
return;*/
} }
@ -358,12 +367,10 @@ void ProcessMotionLump(char *lump_ptr, int lump_size)
/* end block 2 */ /* end block 2 */
// End Line: 5390 // End Line: 5390
// [D]
void SetupPedMotionData(PEDESTRIAN *pPed) void SetupPedMotionData(PEDESTRIAN *pPed)
{ {
UNIMPLEMENTED(); pPed->motion = MotionCaptureData[pPed->type];
/*
pPed->motion = (char *)MotionCaptureData[pPed->type];
return;*/
} }
@ -392,19 +399,17 @@ void SetupPedMotionData(PEDESTRIAN *pPed)
/* end block 4 */ /* end block 4 */
// End Line: 6513 // End Line: 6513
// [D]
void SetupPedestrian(PEDESTRIAN *pedptr) void SetupPedestrian(PEDESTRIAN *pedptr)
{ {
/* pedptr->velocity.vy = 10;
PED_ACTION_TYPE PVar1; pedptr->speed = 10;
(pedptr->velocity).vy = 10; pedptr->dir.vx = 0;
pedptr->speed = '\n'; pedptr->dir.vz = 0;
PVar1 = pedptr->type;
(pedptr->dir).vx = 0; pedptr->frame1 = 0;
(pedptr->dir).vz = 0; pedptr->motion = MotionCaptureData[pedptr->type];
pedptr->frame1 = '\0';
pedptr->motion = (char *)MotionCaptureData[PVar1];
return;*/
} }
@ -674,86 +679,101 @@ LAB_000657dc:
// End Line: 2721 // End Line: 2721
/* WARNING: Unknown calling convention yet parameter storage is locked */ /* WARNING: Unknown calling convention yet parameter storage is locked */
int cTannerVNumbers[24];
SVECTOR vTannerList[210];
int cJerichoVNumbers[7];
SVECTOR vJerichoList[102];
int vStored = 0;
// [D]
void StoreVertexLists(void) void StoreVertexLists(void)
{ {
UNIMPLEMENTED(); short *psVar1;
/* BONE *pBVar2;
undefined2 *puVar1; SVECTOR *pSVar3;
short *psVar2; SVECTOR *local_a2_76;
BONE *pBVar3; SVECTOR *local_a2_308;
undefined2 *puVar4; int iVar4;
SVECTOR *pSVar5; MODEL *pMVar5;
undefined2 *puVar6; MODEL *local_t0_256;
short *psVar7; int iVar6;
int iVar7;
int iVar8; int iVar8;
MODEL *pMVar9;
int iVar10;
int iVar11;
int iVar12;
int iVar13;
iVar12 = 0; iVar7 = 0;
iVar13 = 0;
pBVar3 = &Skel;
iVar11 = 0x15;
do {
iVar8 = 0; iVar8 = 0;
if (pBVar3->pModel == (MODEL **)0x0) { pBVar2 = Skel;
*(undefined4 *)(&cTannerVNumbers + (uint)pBVar3->id * 4) = 0xffffffff; iVar6 = 21;
}
else {
pMVar9 = *pBVar3->pModel;
puVar6 = (undefined2 *)pMVar9->vertices;
*(int *)(&cTannerVNumbers + ((uint)pBVar3->id & 0x7f) * 4) = iVar13;
if (pMVar9->num_vertices != 0) {
puVar4 = &vTannerList + iVar12 * 4;
do { do {
iVar13 = iVar13 + 1; iVar4 = 0;
iVar8 = iVar8 + 1; if (pBVar2->pModel == NULL)
*puVar4 = *puVar6; {
iVar12 = iVar12 + 1; cTannerVNumbers[pBVar2->id] = -1;
puVar4[1] = puVar6[1];
puVar1 = puVar6 + 2;
puVar6 = puVar6 + 4;
puVar4[2] = *puVar1;
puVar4 = puVar4 + 4;
} while (iVar8 < (int)(uint)pMVar9->num_vertices);
} }
} else
pBVar3 = pBVar3 + 1; {
iVar11 = iVar11 + -1; pMVar5 = *pBVar2->pModel;
} while (-1 < iVar11); local_a2_76 = (SVECTOR *)pMVar5->vertices;
iVar8 = 0; cTannerVNumbers[(uint)pBVar2->id & 0x7f] = iVar8;
iVar13 = 0;
iVar12 = 0; if (pMVar5->num_vertices != 0)
iVar11 = 0; {
do { pSVar3 = vTannerList + iVar7;
iVar10 = *(int *)((int)&pmJerichoModels6 + iVar11);
iVar12 = iVar12 + 1;
if (iVar10 != 0) {
psVar7 = *(short **)(iVar10 + 0x10);
*(int *)((int)&cJerichoVNumbers + iVar11) = iVar8;
iVar11 = 0;
if (*(short *)(iVar10 + 0xc) != 0) {
pSVar5 = &vJerichoList + iVar13;
do { do {
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
iVar11 = iVar11 + 1; iVar4 = iVar4 + 1;
pSVar5->vx = *psVar7; pSVar3->vx = local_a2_76->vx;
iVar13 = iVar13 + 1; iVar7 = iVar7 + 1;
pSVar5->vy = psVar7[1]; pSVar3->vy = local_a2_76->vy;
psVar2 = psVar7 + 2; psVar1 = &local_a2_76->vz;
psVar7 = psVar7 + 4; local_a2_76 = local_a2_76 + 1;
pSVar5->vz = *psVar2; pSVar3->vz = *psVar1;
pSVar5 = pSVar5 + 1; pSVar3 = pSVar3 + 1;
} while (iVar11 < (int)(uint)*(ushort *)(iVar10 + 0xc)); } while (iVar4 < (int)(uint)pMVar5->num_vertices);
} }
} }
iVar11 = iVar12 * 4; pBVar2 = pBVar2 + 1;
} while (iVar12 < 6); iVar6 = iVar6 + -1;
} while (-1 < iVar6);
iVar4 = 0;
iVar8 = 0;
iVar7 = 0;
iVar6 = 0;
do {
local_t0_256 = *(MODEL **)((int)pmJerichoModels + iVar6);
iVar7 = iVar7 + 1;
if (local_t0_256 != NULL)
{
local_a2_308 = (SVECTOR *)local_t0_256->vertices;
*(int *)((int)cJerichoVNumbers + iVar6) = iVar4;
iVar6 = 0;
if (local_t0_256->num_vertices != 0)
{
pSVar3 = vJerichoList + iVar8;
do {
iVar4 = iVar4 + 1;
iVar6 = iVar6 + 1;
pSVar3->vx = local_a2_308->vx;
iVar8 = iVar8 + 1;
pSVar3->vy = local_a2_308->vy;
psVar1 = &local_a2_308->vz;
local_a2_308 = local_a2_308 + 1;
pSVar3->vz = *psVar1;
pSVar3 = pSVar3 + 1;
} while (iVar6 < (int)(uint)local_t0_256->num_vertices);
}
}
iVar6 = iVar7 * 4;
} while (iVar7 < 6);
vStored = 1; vStored = 1;
return;*/
} }
@ -797,9 +817,14 @@ void StoreVertexLists(void)
/* WARNING: Unknown calling convention yet parameter storage is locked */ /* WARNING: Unknown calling convention yet parameter storage is locked */
PEDESTRIAN *pDrawingPed = NULL;
void SetupTannerSkeleton(void) void SetupTannerSkeleton(void)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
/* /*
short sVar1; short sVar1;
SVECTOR *pSVar2; SVECTOR *pSVar2;
@ -2007,28 +2032,27 @@ void DrawCiv(PEDESTRIAN *pPed)
/* end block 2 */ /* end block 2 */
// End Line: 7525 // End Line: 7525
// [D]
void SetSkelModelPointers(int type) void SetSkelModelPointers(int type)
{ {
UNIMPLEMENTED();
/*
if (type == 1) { if (type == 1) {
BONE_000a0944.pModel = &pmJerichoModels6; Skel[2].pModel = &pmJerichoModels[0];
BONE_000a09cc.pModel = &PTR_000d95bc; Skel[4].pModel = &pmJerichoModels[1];
BONE_000a0a54.pModel = &PTR_000d95c0; Skel[6].pModel = &pmJerichoModels[2];
BONE_000a0a98.pModel = &PTR_000d95c4; Skel[7].pModel = &pmJerichoModels[3];
BONE_000a0b64.pModel = &PTR_000d95c8; Skel[10].pModel = &pmJerichoModels[4];
BONE_000a0ba8.pModel = &PTR_000d95cc; Skel[11].pModel = &pmJerichoModels[5];
BONE_000a0c74.pModel = (MODEL **)0x0; Skel[14].pModel = NULL;
return; return;
} }
BONE_000a0944.pModel = &pmTannerModels17;
BONE_000a09cc.pModel = &PTR_000d96e4; Skel[2].pModel = &pmTannerModels[0];
BONE_000a0a54.pModel = &PTR_000d9700; Skel[4].pModel = &pmTannerModels[1];
BONE_000a0a98.pModel = &PTR_000d9704; Skel[6].pModel = &pmTannerModels[8];
BONE_000a0b64.pModel = &PTR_000d96e8; Skel[7].pModel = &pmTannerModels[9];
BONE_000a0ba8.pModel = &PTR_000d96ec; Skel[10].pModel = &pmTannerModels[2];
BONE_000a0c74.pModel = &PTR_000d971c; Skel[11].pModel = &pmTannerModels[3];
return;*/ Skel[14].pModel = &pmTannerModels[15];
} }