- implement ProcessCarModelLump, buildNewCars

- implement NewProcessRoadMapLump
This commit is contained in:
Ilya Shurumov 2020-04-09 21:36:53 +06:00
parent 1489b3a2cb
commit 0f4666ae39
8 changed files with 256 additions and 206 deletions

View File

@ -1,6 +1,7 @@
#include "THISDUST.H" #include "THISDUST.H"
#include "CARS.H" #include "CARS.H"
#include "TEXTURE.H" #include "TEXTURE.H"
#include "OVERMAP.H"
SVECTOR day_vectors[4] = SVECTOR day_vectors[4] =
{ {
@ -1817,23 +1818,37 @@ void ComputeCarLightingLevels(_CAR_DATA *cp, char detail)
/* WARNING: Unknown calling convention yet parameter storage is locked */ /* WARNING: Unknown calling convention yet parameter storage is locked */
CAR_MODEL NewCarModel[5];
CAR_MODEL NewLowCarModel[5];
MODEL* gCarLowModelPtr[5];
MODEL* gCarDamModelPtr[5];
MODEL* gCarCleanModelPtr[5];
int whichCP = 0;
int baseSpecCP = 0;
CAR_POLY carPolyBuffer[2001];
// [D]
void buildNewCars(void) void buildNewCars(void)
{ {
UNIMPLEMENTED(); buildNewCarFromModel(&NewCarModel[0], gCarCleanModelPtr[0], 1);
/* buildNewCarFromModel(&NewLowCarModel[0], gCarLowModelPtr[0], 0);
buildNewCarFromModel(&NewCarModel, gCarCleanModelPtr5[0], 1);
buildNewCarFromModel(&NewLowCarModel, gCarLowModelPtr5[0], 0); buildNewCarFromModel(&NewCarModel[1], gCarCleanModelPtr[1], 0);
buildNewCarFromModel(&CAR_MODEL_000acb88, gCarCleanModelPtr5[1], 0); buildNewCarFromModel(&NewLowCarModel[1], gCarLowModelPtr[1], 0);
buildNewCarFromModel(&CAR_MODEL_000b87e0, gCarLowModelPtr5[1], 0);
buildNewCarFromModel(&CAR_MODEL_000acba8, gCarCleanModelPtr5[2], 0); buildNewCarFromModel(&NewCarModel[2], gCarCleanModelPtr[2], 0);
buildNewCarFromModel(&CAR_MODEL_000b8800, gCarLowModelPtr5[2], 0); buildNewCarFromModel(&NewLowCarModel[2], gCarLowModelPtr[2], 0);
buildNewCarFromModel(&CAR_MODEL_000acbc8, gCarCleanModelPtr5[3], 0);
buildNewCarFromModel(&CAR_MODEL_000b8820, gCarLowModelPtr5[3], 0); buildNewCarFromModel(&NewCarModel[3], gCarCleanModelPtr[3], 0);
buildNewCarFromModel(&NewLowCarModel[3], gCarLowModelPtr[3], 0);
// build special car
baseSpecCP = whichCP; baseSpecCP = whichCP;
buildNewCarFromModel(&CAR_MODEL_000acbe8, gCarCleanModelPtr5[4], 0); buildNewCarFromModel(NewCarModel + 4, gCarCleanModelPtr[4], 0);
buildNewCarFromModel(&CAR_MODEL_000b8840, gCarLowModelPtr5[4], 0); buildNewCarFromModel(NewLowCarModel + 4, gCarLowModelPtr[4], 0);
return;
*/
} }
@ -1971,17 +1986,17 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
/* /*
byte bVar1; char bVar1;
byte bVar2; char bVar2;
byte bVar3; char bVar3;
byte bVar4; char bVar4;
ushort uVar5; ushort uVar5;
char cVar6; char cVar6;
undefined3 extraout_var; //undefined3 extraout_var;
undefined3 extraout_var_00; //undefined3 extraout_var_00;
uint uVar7; uint uVar7;
int iVar8; int iVar8;
byte *pbVar9; char *pbVar9;
CAR_POLY *pCVar10; CAR_POLY *pCVar10;
int iVar11; int iVar11;
int iVar12; int iVar12;
@ -1993,190 +2008,189 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first)
if (first != 0) { if (first != 0) {
whichCP = 0; whichCP = 0;
} }
if ((model == (MODEL *)0x0) || (0x800000 < ((uint)model & 0xfffffff))) { if ((model == NULL) || (0x800000 < ((uint)model & 0xfffffff)))
{
car->numGT3 = 0; car->numGT3 = 0;
car->numFT3 = 0; car->numFT3 = 0;
car->numB3 = 0; car->numB3 = 0;
} }
else { else
{
car->vlist = (SVECTOR *)model->vertices; car->vlist = (SVECTOR *)model->vertices;
car->nlist = (SVECTOR *)model->point_normals; car->nlist = (SVECTOR *)model->point_normals;
iVar15 = 0; iVar15 = 0;
do { do {
iVar11 = whichCP; iVar11 = whichCP;
pbVar9 = (byte *)model->poly_block; pbVar9 = (char *)model->poly_block;
if (iVar15 == 1) { if (iVar15 == 1) {
car->pFT3 = &pbf + whichCP; car->pFT3 = carPolyBuffer + whichCP;
} }
else { else if (iVar15 == 0) {
if (iVar15 < 2) { car->pGT3 = carPolyBuffer + whichCP;
if (iVar15 == 0) {
car->pGT3 = &pbf + whichCP;
}
}
else {
if (iVar15 == 2) {
car->pB3 = &pbf + whichCP;
}
}
} }
else if (iVar15 == 2) {
car->pB3 = carPolyBuffer + whichCP;
}
iVar14 = 0; iVar14 = 0;
iVar16 = iVar15 + 1; iVar16 = iVar15 + 1;
iVar12 = iVar11; iVar12 = iVar11;
if ((iVar11 < 2000) && (model->num_polys != 0)) {
if ((iVar11 < 2000) && (model->num_polys != 0))
{
do { do {
bVar1 = *pbVar9; bVar1 = *pbVar9;
pCVar10 = &pbf + iVar11; pCVar10 = carPolyBuffer + iVar11;
sVar13 = (short)iVar14;
iVar12 = iVar11; iVar12 = iVar11;
switch ((uint)bVar1 & 0x1f) {
case 0: if (true)
case 0x12: {
if (iVar15 == 2) { sVar13 = (short)iVar14;
bVar2 = pbVar9[1]; switch ((uint)bVar1 & 0x1f)
bVar3 = pbVar9[2]; {
bVar4 = pbVar9[3]; case 0:
iVar12 = iVar11 + 1; case 0x12:
(&pbf)[iVar11].originalindex = sVar13; if (iVar15 == 2)
pCVar10->vindices = (uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100; {
} bVar2 = pbVar9[1];
break; bVar3 = pbVar9[2];
case 1: bVar4 = pbVar9[3];
case 0x13: iVar12 = iVar11 + 1;
if (iVar15 == 2) { carPolyBuffer[iVar11].originalindex = sVar13;
bVar2 = pbVar9[4]; pCVar10->vindices = (uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100;
bVar3 = pbVar9[5]; }
bVar4 = pbVar9[6]; break;
iVar12 = iVar11 + 2; case 1:
(&pbf)[iVar11].originalindex = sVar13; case 0x13:
pCVar10->vindices = (uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100; if (iVar15 == 2)
bVar2 = pbVar9[4]; {
bVar3 = pbVar9[6]; bVar2 = pbVar9[4];
bVar4 = pbVar9[7]; bVar3 = pbVar9[5];
CAR_POLY_ARRAY_000acc40[iVar11].originalindex = sVar13; bVar4 = pbVar9[6];
CAR_POLY_ARRAY_000acc40[iVar11].vindices = iVar12 = iVar11 + 2;
(uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100; carPolyBuffer[iVar11].originalindex = sVar13;
} pCVar10->vindices = (uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100;
break; bVar2 = pbVar9[4];
case 0x14: bVar3 = pbVar9[6];
if (iVar15 == 1) { bVar4 = pbVar9[7];
pCVar10->vindices = carPolyBuffer[iVar11 + 1].originalindex = sVar13;
(uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100; carPolyBuffer[iVar11 + 1].vindices = (uint)bVar2 + ((uint)bVar3 + (uint)bVar4 * 0x100) * 0x100;
(&pbf)[iVar11].clut_uv0 = }
CONCAT22((&texture_cluts)[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], break;
*(undefined2 *)(pbVar9 + 8)); case 0x14:
(&pbf)[iVar11].tpage_uv1 = if (iVar15 == 1)
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 10)); {
uVar7 = (uint)*(ushort *)(pbVar9 + 0xc); pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
iVar12 = iVar11 + 1;
LAB_00022fd4: carPolyBuffer[iVar11].clut_uv0 = CONCAT22(texture_cluts[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], *(ushort *)(pbVar9 + 8));
pCVar10->originalindex = sVar13; carPolyBuffer[iVar11].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 10));
LAB_00022fd8:
pCVar10->uv3_uv2 = uVar7; uVar7 = (uint)*(ushort *)(pbVar9 + 0xc);
} iVar12 = iVar11 + 1;
break; LAB_00022fd4:
case 0x15: pCVar10->originalindex = sVar13;
if (iVar15 == 1) { LAB_00022fd8:
pCVar10->vindices = pCVar10->uv3_uv2 = uVar7;
(uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100; }
(&pbf)[iVar11].clut_uv0 = break;
CONCAT22((&texture_cluts)[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], case 0x15:
*(undefined2 *)(pbVar9 + 8)); if (iVar15 == 1)
(&pbf)[iVar11].tpage_uv1 = {
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 10)); pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
uVar5 = *(ushort *)(pbVar9 + 0xc);
(&pbf)[iVar11].originalindex = sVar13; carPolyBuffer[iVar11].clut_uv0 = CONCAT22(texture_cluts[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], *(ushort *)(pbVar9 + 8));
(&pbf)[iVar11].uv3_uv2 = (uint)uVar5; carPolyBuffer[iVar11].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 10));
pCVar10 = CAR_POLY_ARRAY_000acc40 + iVar11;
pCVar10->vindices = uVar5 = *(ushort *)(pbVar9 + 0xc);
(uint)pbVar9[4] + ((uint)pbVar9[6] + (uint)pbVar9[7] * 0x100) * 0x100; carPolyBuffer[iVar11].originalindex = sVar13;
CAR_POLY_ARRAY_000acc40[iVar11].clut_uv0 = carPolyBuffer[iVar11].uv3_uv2 = (uint)uVar5;
CONCAT22((&texture_cluts)[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], pCVar10 = carPolyBuffer + iVar11 + 1;
*(undefined2 *)(pbVar9 + 8)); pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[6] + (uint)pbVar9[7] * 0x100) * 0x100;
CAR_POLY_ARRAY_000acc40[iVar11].tpage_uv1 =
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 0xc)); carPolyBuffer[iVar11 + 1].clut_uv0 = CONCAT22(texture_cluts[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]], *(ushort *)(pbVar9 + 8));
uVar7 = (uint)*(ushort *)(pbVar9 + 0xe); carPolyBuffer[iVar11 + 1].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 0xc));
iVar12 = iVar11 + 2;
goto LAB_00022fd4; uVar7 = (uint)*(ushort *)(pbVar9 + 0xe);
} iVar12 = iVar11 + 2;
break; goto LAB_00022fd4;
case 0x16: }
if (iVar15 == 0) { break;
iVar12 = iVar11 + 1; case 0x16:
cVar6 = GetCarPalIndex((uint)pbVar9[1]); if (iVar15 == 0)
civ_clut[CONCAT31(extraout_var, cVar6) * 0xc0 + (uint)pbVar9[2] * 6] = {
(&texture_cluts)[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]]; iVar12 = iVar11 + 1;
pCVar10->vindices = cVar6 = GetCarPalIndex((uint)pbVar9[1]);
(uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
(&pbf)[iVar11].nindices = civ_clut[cVar6 * 0xc0 + (uint)pbVar9[2] * 6] = texture_cluts[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]];
(uint)pbVar9[8] + ((uint)pbVar9[9] + (uint)pbVar9[10] * 0x100) * 0x100; pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
(&pbf)[iVar11].clut_uv0 =
((int)(CONCAT31(extraout_var, cVar6) * 0x180 + (uint)pbVar9[2] * 0xc + -0x180) >> carPolyBuffer[iVar11].nindices = (uint)pbVar9[8] + ((uint)pbVar9[9] + (uint)pbVar9[10] * 0x100) * 0x100;
1) << 0x10 | (uint)*(ushort *)(pbVar9 + 0xc); carPolyBuffer[iVar11].clut_uv0 = ((int)(cVar6 * 0x180 + (uint)pbVar9[2] * 0xc + -0x180) >> 1) << 0x10 | (uint)*(ushort *)(pbVar9 + 0xc);
(&pbf)[iVar11].tpage_uv1 = carPolyBuffer[iVar11].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 0xe));
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 0xe));
uVar7 = (uint)*(ushort *)(pbVar9 + 0x10); uVar7 = (uint)*(ushort *)(pbVar9 + 0x10);
(&pbf)[iVar11].originalindex = sVar13; carPolyBuffer[iVar11].originalindex = sVar13;
goto LAB_00022fd8; goto LAB_00022fd8;
} }
break; break;
case 0x17: case 0x17:
if (iVar15 == 0) { if (iVar15 == 0)
iVar12 = iVar11 + 2; {
cVar6 = GetCarPalIndex((uint)pbVar9[1]); iVar12 = iVar11 + 2;
iVar8 = CONCAT31(extraout_var_00, cVar6) * 0x180; cVar6 = GetCarPalIndex((uint)pbVar9[1]);
civ_clut[CONCAT31(extraout_var_00, cVar6) * 0xc0 + (uint)pbVar9[2] * 6] = iVar8 = cVar6 * 0x180;
(&texture_cluts)[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]];
pCVar10->vindices = civ_clut[cVar6 * 0xc0 + (uint)pbVar9[2] * 6] = texture_cluts[(uint)pbVar9[1] * 0x20 + (uint)pbVar9[2]];
(uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
(&pbf)[iVar11].nindices = pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[5] + (uint)pbVar9[6] * 0x100) * 0x100;
(uint)pbVar9[8] + ((uint)pbVar9[9] + (uint)pbVar9[10] * 0x100) * 0x100;
(&pbf)[iVar11].clut_uv0 = carPolyBuffer[iVar11].nindices = (uint)pbVar9[8] + ((uint)pbVar9[9] + (uint)pbVar9[10] * 0x100) * 0x100;
((int)(iVar8 + (uint)pbVar9[2] * 0xc + -0x180) >> 1) << 0x10 | carPolyBuffer[iVar11].clut_uv0 = ((int)(iVar8 + (uint)pbVar9[2] * 0xc + -0x180) >> 1) << 0x10 | (uint)*(ushort *)(pbVar9 + 0xc);
(uint)*(ushort *)(pbVar9 + 0xc); carPolyBuffer[iVar11].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 0xe));
(&pbf)[iVar11].tpage_uv1 =
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 0xe)); uVar5 = *(ushort *)(pbVar9 + 0x10);
uVar5 = *(ushort *)(pbVar9 + 0x10); carPolyBuffer[iVar11].originalindex = sVar13;
(&pbf)[iVar11].originalindex = sVar13; carPolyBuffer[iVar11].uv3_uv2 = (uint)uVar5;
(&pbf)[iVar11].uv3_uv2 = (uint)uVar5; pCVar10 = carPolyBuffer + iVar11 + 1;
pCVar10 = CAR_POLY_ARRAY_000acc40 + iVar11; pCVar10->vindices = (uint)pbVar9[4] + ((uint)pbVar9[6] + (uint)pbVar9[7] * 0x100) * 0x100;
pCVar10->vindices =
(uint)pbVar9[4] + ((uint)pbVar9[6] + (uint)pbVar9[7] * 0x100) * 0x100; carPolyBuffer[iVar11 + 1].nindices = (uint)pbVar9[8] + ((uint)pbVar9[10] + (uint)pbVar9[0xb] * 0x100) * 0x100;
CAR_POLY_ARRAY_000acc40[iVar11].nindices = carPolyBuffer[iVar11 + 1].clut_uv0 = ((int)(iVar8 + (uint)pbVar9[2] * 0xc + -0x180) >> 1) << 0x10 | (uint)*(ushort *)(pbVar9 + 0xc);
(uint)pbVar9[8] + ((uint)pbVar9[10] + (uint)pbVar9[0xb] * 0x100) * 0x100; carPolyBuffer[iVar11 + 1].tpage_uv1 = CONCAT22(texture_pages[pbVar9[1]], *(ushort *)(pbVar9 + 0x10));
CAR_POLY_ARRAY_000acc40[iVar11].clut_uv0 =
((int)(iVar8 + (uint)pbVar9[2] * 0xc + -0x180) >> 1) << 0x10 | uVar7 = (uint)*(ushort *)(pbVar9 + 0x12);
(uint)*(ushort *)(pbVar9 + 0xc); goto LAB_00022fd4;
CAR_POLY_ARRAY_000acc40[iVar11].tpage_uv1 = }
CONCAT22((&texture_pages)[pbVar9[1]], *(undefined2 *)(pbVar9 + 0x10));
uVar7 = (uint)*(ushort *)(pbVar9 + 0x12);
goto LAB_00022fd4;
} }
} }
iVar14 = iVar14 + 1; iVar14 = iVar14 + 1;
pbVar9 = pbVar9 + PolySizes[(uint)bVar1 & 0x1f]; pbVar9 = pbVar9 + PolySizes[(uint)bVar1 & 0x1f];
} while ((iVar12 < 2000) && (iVar11 = iVar12, iVar14 < (int)(uint)model->num_polys)); } while ((iVar12 < 2000) && (iVar11 = iVar12, iVar14 < (int)(uint)model->num_polys));
} }
if (iVar15 == 1) {
if (iVar15 == 1)
{
car->numFT3 = iVar12 - whichCP; car->numFT3 = iVar12 - whichCP;
} }
else { if (iVar15 == 0)
if (iVar15 < 2) { {
if (iVar15 == 0) { car->numGT3 = iVar12 - whichCP;
car->numGT3 = iVar12 - whichCP;
}
}
else {
if (iVar15 == 2) {
car->numB3 = iVar12 - whichCP;
}
}
} }
else if (iVar15 == 2)
{
car->numB3 = iVar12 - whichCP;
}
iVar15 = iVar16; iVar15 = iVar16;
whichCP = iVar12; whichCP = iVar12;
} while (iVar16 < 3); } while (iVar16 < 3);
} }
return;*/ */
} }

View File

@ -1,6 +1,9 @@
#ifndef CARS_H #ifndef CARS_H
#define CARS_H #define CARS_H
extern MODEL* gCarLowModelPtr[5];
extern MODEL* gCarDamModelPtr[5];
extern MODEL* gCarCleanModelPtr[5];
extern void plotNewCarModel(CAR_MODEL *car, int palette); // 0x00020C94 extern void plotNewCarModel(CAR_MODEL *car, int palette); // 0x00020C94

View File

@ -2,6 +2,7 @@
#include "MAP.H" #include "MAP.H"
#include "SYSTEM.H" #include "SYSTEM.H"
#include "SPOOL.H" #include "SPOOL.H"
#include "CONVERT.H"
char *map_lump = NULL; char *map_lump = NULL;
@ -26,18 +27,15 @@ char *map_lump = NULL;
/* end block 3 */ /* end block 3 */
// End Line: 475 // End Line: 475
// [D]
void NewProcessRoadMapLump(ROAD_MAP_LUMP_DATA *pRoadMapLumpData, char *pLumpFile) void NewProcessRoadMapLump(ROAD_MAP_LUMP_DATA *pRoadMapLumpData, char *pLumpFile)
{ {
UNIMPLEMENTED(); Getlong((char*)&pRoadMapLumpData->width, pLumpFile);
/* Getlong((char*)&pRoadMapLumpData->height, pLumpFile + 4);
Getlong((char *)pRoadMapLumpData, pLumpFile);
Getlong((char *)&pRoadMapLumpData->height, pLumpFile + 4);
pRoadMapLumpData->unitXMid = (pRoadMapLumpData->width + 1) * 0x200;
pRoadMapLumpData->unitZMid = pRoadMapLumpData->height << 9;
return;
*/
}
pRoadMapLumpData->unitXMid = (pRoadMapLumpData->width + 1) * 512;
pRoadMapLumpData->unitZMid = pRoadMapLumpData->height * 512;
}
// decompiled code // decompiled code

View File

@ -1,5 +1,9 @@
#include "THISDUST.H" #include "THISDUST.H"
#include "MODELS.H" #include "MODELS.H"
#include "SYSTEM.H"
#include "SPOOL.H"
#include "MISSION.H"
#include "CARS.H"
char* modelname_buffer = NULL; char* modelname_buffer = NULL;
char *car_models_lump = NULL; char *car_models_lump = NULL;
@ -170,11 +174,9 @@ void ProcessMDSLump(char *lump_file, int lump_size)
/* end block 5 */ /* end block 5 */
// End Line: 460 // End Line: 460
// [D]
int ProcessCarModelLump(char *lump_ptr, int lump_size) int ProcessCarModelLump(char *lump_ptr, int lump_size)
{ {
UNIMPLEMENTED();
return 0;
/*
MODEL *pMVar1; MODEL *pMVar1;
int iVar2; int iVar2;
int iVar3; int iVar3;
@ -192,87 +194,111 @@ int ProcessCarModelLump(char *lump_ptr, int lump_size)
iVar8 = 8; iVar8 = 8;
pcVar7 = lump_ptr + 4; pcVar7 = lump_ptr + 4;
piVar6 = (int *)(lump_ptr + 100); piVar6 = (int *)(lump_ptr + 100);
// compute size
do { do {
if (*piVar6 != -1) { if (*piVar6 != -1)
{
iVar2 = piVar6[1]; iVar2 = piVar6[1];
iVar4 = *(int *)(pcVar7 + *piVar6 + 0xb4); iVar4 = *(int *)(pcVar7 + *piVar6 + 0xb4);
if (iVar2 != -1) { if (iVar2 != -1) {
iVar4 = iVar4 + *(int *)(pcVar7 + iVar2 + 0xb8); iVar4 = iVar4 + *(int *)(pcVar7 + iVar2 + 0xb8);
} }
iVar3 = piVar6[2]; iVar3 = piVar6[2];
if (iVar3 != -1) { if (iVar3 != -1) {
iVar4 = iVar4 + *(int *)(pcVar7 + iVar3 + 0xb4); iVar4 = iVar4 + *(int *)(pcVar7 + iVar3 + 0xb4);
} }
uVar5 = (iVar4 + 0x800U & 0xfffff800) + 0x800; uVar5 = (iVar4 + 0x800U & 0xfffff800) + 0x800;
if ((int)uVar9 < (int)uVar5) { if ((int)uVar9 < (int)uVar5) {
uVar9 = uVar5; uVar9 = uVar5;
} }
uVar5 = (iVar2 - *piVar6) + 0x800U & 0xfffff800; uVar5 = (iVar2 - *piVar6) + 0x800U & 0xfffff800;
if ((int)uVar9 < (int)uVar5) { if ((int)uVar9 < (int)uVar5) {
uVar9 = uVar5; uVar9 = uVar5;
} }
uVar5 = (iVar3 - iVar2) + 0x800U & 0xfffff800; uVar5 = (iVar3 - iVar2) + 0x800U & 0xfffff800;
if ((int)uVar9 < (int)uVar5) { if ((int)uVar9 < (int)uVar5) {
uVar9 = uVar5; uVar9 = uVar5;
} }
if ((iVar8 != 0xb) && if ((iVar8 != 0xb) &&
(uVar5 = (piVar6[3] - iVar3) + 0x800U & 0xfffff800, (int)uVar9 < (int)uVar5)) { (uVar5 = (piVar6[3] - iVar3) + 0x800U & 0xfffff800, (int)uVar9 < (int)uVar5))
{
uVar9 = uVar5; uVar9 = uVar5;
} }
} }
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
piVar6 = piVar6 + 3; piVar6 = piVar6 + 3;
} while (iVar8 < 0xd); } while (iVar8 < 0xd);
iVar8 = 0; iVar8 = 0;
ppMVar12 = gCarLowModelPtr5;
ppMVar11 = gCarDamModelPtr5; ppMVar12 = gCarLowModelPtr;
ppMVar10 = gCarCleanModelPtr5; ppMVar11 = gCarDamModelPtr;
ppMVar10 = gCarCleanModelPtr;
iVar2 = 0; iVar2 = 0;
do { do {
*ppMVar10 = (MODEL *)0x0; *ppMVar10 = NULL;
*ppMVar11 = (MODEL *)0x0; *ppMVar11 = NULL;
*ppMVar12 = (MODEL *)0x0; *ppMVar12 = NULL;
if (iVar8 == 4) {
if (iVar8 == 4)
{
specmallocptr = mallocptr; specmallocptr = mallocptr;
} }
iVar4 = *(int *)((int)MissionHeader->residentModels + iVar2); iVar4 = *(int *)((int)MissionHeader->residentModels + iVar2);
if (iVar4 == 0xd) {
iVar4 = 10 - (MissionHeader->residentModels[0] + MissionHeader->residentModels[1] + if (iVar4 == 0xd)
MissionHeader->residentModels[2]); {
if (iVar4 < 1) { iVar4 = 10 - (MissionHeader->residentModels[0] + MissionHeader->residentModels[1] + MissionHeader->residentModels[2]);
if (iVar4 < 1)
{
iVar4 = 1; iVar4 = 1;
} }
else { else if (4 < iVar4)
if (4 < iVar4) { {
iVar4 = 4; iVar4 = 4;
}
} }
} }
if (iVar4 != -1) {
if (iVar4 != -1)
{
piVar6 = (int *)(pcVar7 + iVar4 * 0xc); piVar6 = (int *)(pcVar7 + iVar4 * 0xc);
if (*piVar6 != -1) { if (*piVar6 != -1) {
pMVar1 = GetCarModel(pcVar7 + *piVar6 + 0xa0, &mallocptr, 1); pMVar1 = GetCarModel(pcVar7 + *piVar6 + 0xa0, &mallocptr, 1);
*ppMVar10 = pMVar1; *ppMVar10 = pMVar1;
} }
if (piVar6[1] != -1) { if (piVar6[1] != -1) {
pMVar1 = GetCarModel(pcVar7 + piVar6[1] + 0xa0, &mallocptr, 0); pMVar1 = GetCarModel(pcVar7 + piVar6[1] + 0xa0, &mallocptr, 0);
*ppMVar11 = pMVar1; *ppMVar11 = pMVar1;
} }
if (piVar6[2] != -1) { if (piVar6[2] != -1) {
pMVar1 = GetCarModel(pcVar7 + piVar6[2] + 0xa0, &mallocptr, 1); pMVar1 = GetCarModel(pcVar7 + piVar6[2] + 0xa0, &mallocptr, 1);
*ppMVar12 = pMVar1; *ppMVar12 = pMVar1;
} }
} }
ppMVar12 = ppMVar12 + 1; ppMVar12 = ppMVar12 + 1;
ppMVar11 = ppMVar11 + 1; ppMVar11 = ppMVar11 + 1;
ppMVar10 = ppMVar10 + 1; ppMVar10 = ppMVar10 + 1;
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
iVar2 = iVar2 + 4; iVar2 = iVar2 + 4;
} while (iVar8 < 5); } while (iVar8 < 5);
mallocptr = specmallocptr + uVar9; mallocptr = specmallocptr + uVar9;
specLoadBuffer = mallocptr + -0x800; specLoadBuffer = mallocptr - 2048; // [A]
buildNewCars(); buildNewCars();
return 0;*/
} }

View File

@ -1,6 +1,7 @@
#ifndef OVERMAP_H #ifndef OVERMAP_H
#define OVERMAP_H #define OVERMAP_H
unsigned short civ_clut[8][32][6];
extern void DrawTargetBlip(VECTOR *pos, unsigned char r, unsigned char g, unsigned char b, unsigned long flags); // 0x00016280 extern void DrawTargetBlip(VECTOR *pos, unsigned char r, unsigned char g, unsigned char b, unsigned long flags); // 0x00016280

View File

@ -14,6 +14,9 @@ int SpecialByRegion[4][20] = {
{2, 5, 4, 1, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 3, 0, 0, 0, 0, 0}, {2, 5, 4, 1, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 3, 0, 0, 0, 0, 0},
}; };
char* specmallocptr;
char *specLoadBuffer;
// decompiled code // decompiled code
// original method signature: // original method signature:
// void /*$ra*/ test_changemode() // void /*$ra*/ test_changemode()

View File

@ -4,6 +4,8 @@
extern int cell_objects_add[5]; extern int cell_objects_add[5];
extern int cell_slots_add[5]; extern int cell_slots_add[5];
extern char* specmallocptr;
extern char *specLoadBuffer;
typedef void(*spooledFuncPtr)(); typedef void(*spooledFuncPtr)();

View File

@ -5,6 +5,9 @@ extern char carTpages[4][8];
extern char* texturename_buffer; extern char* texturename_buffer;
extern char* palette_lump; extern char* palette_lump;
extern short texture_pages[128];
extern short texture_cluts[128][32];
extern RECT16 clutpos; extern RECT16 clutpos;
extern RECT16 fontclutpos; extern RECT16 fontclutpos;