Merge pull request #19 from SoapyMan/develop-SoapyMan

Develop soapy man
This commit is contained in:
Ilya 2020-09-02 23:05:51 +06:00 committed by GitHub
commit d43d0053f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1003 additions and 881 deletions

View File

@ -172,6 +172,19 @@ extern int cursorX, cursorY, cursorOldX, cursorOldY;
extern VECTOR lis_pos; extern VECTOR lis_pos;
void BuildFreeCameraMatrix()
{
if (g_FreeCameraEnabled == 0)
return;
player[0].cameraPos = g_FreeCameraPosition;
camera_position = g_FreeCameraPosition;
camera_angle = g_FreeCameraRotation;
lis_pos = camera_position;
BuildWorldMatrix();
}
void DoFreeCamera() void DoFreeCamera()
{ {
if (g_FreeCameraEnabled == 0) if (g_FreeCameraEnabled == 0)
@ -184,11 +197,7 @@ void DoFreeCamera()
return; return;
} }
camera_position = g_FreeCameraPosition; BuildFreeCameraMatrix();
camera_angle = g_FreeCameraRotation;
lis_pos = camera_position;
BuildWorldMatrix();
g_FreeCameraPosition.vx += FIXED(g_FreeCameraVelocity.vx); g_FreeCameraPosition.vx += FIXED(g_FreeCameraVelocity.vx);
g_FreeCameraPosition.vy += FIXED(g_FreeCameraVelocity.vy); g_FreeCameraPosition.vy += FIXED(g_FreeCameraVelocity.vy);

View File

@ -603,12 +603,60 @@ long SpuSetReverb(long on_off)
return 0; return 0;
} }
unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit) long SpuGetReverb(void)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0; return 0;
} }
long SpuSetReverbModeParam(SpuReverbAttr* attr)
{
UNIMPLEMENTED();
return 0;
}
void SpuGetReverbModeParam(SpuReverbAttr* attr)
{
UNIMPLEMENTED();
}
long SpuSetReverbDepth(SpuReverbAttr* attr)
{
UNIMPLEMENTED();
return 0;
}
long SpuReserveReverbWorkArea(long on_off)
{
UNIMPLEMENTED();
return 0;
}
long SpuIsReverbWorkAreaReserved(long on_off)
{
UNIMPLEMENTED();
return 0;
}
unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit)
{
//UNIMPLEMENTED();
return 0;
}
unsigned long SpuGetReverbVoice(void)
{
UNIMPLEMENTED();
return 0;
}
long SpuClearReverbWorkArea(long mode)
{
UNIMPLEMENTED();
return 0;
}
void SpuSetCommonAttr(SpuCommonAttr* attr) void SpuSetCommonAttr(SpuCommonAttr* attr)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();

View File

@ -222,6 +222,11 @@ void InitCamera(_PLAYER *lp)
{ {
BuildWorldMatrix(); BuildWorldMatrix();
} }
#ifndef PSX
extern void BuildFreeCameraMatrix();
BuildFreeCameraMatrix();
#endif
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@ extern char phrase_top;
extern char force_idle[8]; extern char force_idle[8];
extern char force_siren[8]; extern char force_siren[8];
extern SPEECH_QUEUE gSpeechQueue;
extern void LoadBankFromLump(int bank, int lump); // 0x00052460 extern void LoadBankFromLump(int bank, int lump); // 0x00052460
extern int CarHasSiren(int index); // 0x000522EC extern int CarHasSiren(int index); // 0x000522EC

View File

@ -2926,7 +2926,6 @@ void RenderGame2(int view)
aspect.m[2][2] = 4096; aspect.m[2][2] = 4096;
extern void DoFreeCamera(); extern void DoFreeCamera();
DoFreeCamera(); DoFreeCamera();
#else #else
FrAng = ratan2(160, scr_z); FrAng = ratan2(160, scr_z);

View File

@ -707,9 +707,6 @@ void DrawBodySprite(PEDESTRIAN *pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYP
prims->b0 = combointensity & 0xFF; prims->b0 = combointensity & 0xFF;
} }
current = current;
if (bDoingShadow == 0) if (bDoingShadow == 0)
{ {
x = sz + sy >> 4; x = sz + sy >> 4;
@ -2268,14 +2265,14 @@ void DrawTanner(PEDESTRIAN *pPed)
cV.b = 12; cV.b = 12;
cV.g = 12; cV.g = 12;
cV.r = 12; cV.r = 12;
TannerShadow(&v, moon_position + GameLevel, &cV, pPed->dir.vy); TannerShadow(pPed, &v, moon_position + GameLevel, &cV, pPed->dir.vy);
} }
else else
{ {
cV.b = 32; cV.b = 32;
cV.g = 32; cV.g = 32;
cV.r = 32; cV.r = 32;
TannerShadow(&v, sun_position + GameLevel, &cV, pPed->dir.vy); TannerShadow(pPed, &v, sun_position + GameLevel, &cV, pPed->dir.vy);
} }
} }
bDoingShadow = 0; bDoingShadow = 0;
@ -2371,14 +2368,14 @@ int DrawCharacter(PEDESTRIAN *pPed)
cV.b = 12; cV.b = 12;
cV.g = 12; cV.g = 12;
cV.r = 12; cV.r = 12;
TannerShadow(&v, moon_position + GameLevel, &cV, (pPed->dir).vy); TannerShadow(pPed, &v, moon_position + GameLevel, &cV, (pPed->dir).vy);
} }
else else
{ {
cV.b = 32; cV.b = 32;
cV.g = 32; cV.g = 32;
cV.r = 32; cV.r = 32;
TannerShadow(&v, sun_position + GameLevel, &cV, (pPed->dir).vy); TannerShadow(pPed, &v, sun_position + GameLevel, &cV, (pPed->dir).vy);
} }
bDoingShadow = 0; bDoingShadow = 0;
@ -2487,8 +2484,8 @@ void InitTannerShadow(void)
do { do {
rectTannerWindow.w = 0x40; rectTannerWindow.w = 64;
rectTannerWindow.h = 0x80; rectTannerWindow.h = 128;
rectTannerWindow.x = uVar1; rectTannerWindow.x = uVar1;
rectTannerWindow.y = uVar2; rectTannerWindow.y = uVar2;
@ -2581,246 +2578,173 @@ void InitTannerShadow(void)
/* WARNING: Could not reconcile some variable overlaps */ /* WARNING: Could not reconcile some variable overlaps */
void TannerShadow(VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle) // [D]
void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle)
{ {
UNIMPLEMENTED(); char cVar9;
/* DR_ENV* dr_env;
short sVar1; SVECTOR vert[4];
short sVar2; VECTOR d;
short sVar3; DRAWENV drEnv;
short sVar4; VECTOR cp;
ushort uVar5; SVECTOR ca;
ushort uVar6; VECTOR v1;
undefined4 uVar7; VECTOR myVector;
char cVar8; int z0;
DB *pDVar9; int z1;
long *plVar10; int z2;
undefined4 in_zero; int z3;
undefined4 in_at; SVECTOR* local_2c;
int iVar11; static int Tangle = 0;
int iVar12; int i;
int iVar13; int cn, sn;
int iVar14; int vx, vz;
long z0;
long z1;
long z2;
long z3;
uint uVar15;
ulong *puVar16;
undefined4 *puVar17;
uint *puVar18;
undefined4 *puVar19;
int iVar20;
undefined4 local_110;
undefined4 local_10c;
undefined4 local_108;
undefined4 local_104;
undefined4 local_100;
undefined4 local_fc;
short local_f8;
short local_f6;
short local_f4;
undefined4 local_f0;
undefined4 local_ec;
undefined4 local_e8;
undefined auStack224[96];
long local_80;
long local_7c;
long local_78;
long local_74;
undefined4 local_70;
undefined4 local_6c;
int local_68;
int local_64;
int local_60;
VECTOR local_58;
long local_48;
long local_44;
int local_40;
long local_3c;
long *local_38;
long *local_34;
long *local_30;
undefined4 *local_2c;
memset(&local_f0, 0, 0x10); // [A] not supported by emulator
memset(&local_58, 0, 0x10); // proposed change: double buffering of VRAM (one used as render target, second as texture)
SetDefDrawEnv(auStack224, 0, (int)(current->draw).clip.y, 0x140, 0x100); return;
puVar18 = (uint *)current->primptr;
SetDrawEnv(puVar18, auStack224); memset(&d, 0, sizeof(VECTOR));
pDVar9 = current; memset(&myVector, 0, sizeof(VECTOR));
*puVar18 = *puVar18 & 0xff000000 | current->ot[0x107f] & 0xffffff;
pDVar9->ot[0x107f] = pDVar9->ot[0x107f] & 0xff000000 | (uint)puVar18 & 0xffffff; SetDefDrawEnv(&drEnv, 0, current->draw.clip.y, 320, 256);
iVar20 = 3;
pDVar9->primptr = pDVar9->primptr + 0x40; dr_env = (DR_ENV*)current->primptr;
Tangle = ratan2(-(int)pLightPos->vx, (int)pLightPos->vz); SetDrawEnv(dr_env, &drEnv);
local_38 = &local_48;
local_34 = &local_44; addPrim(current->ot + 0x107f, dr_env);
local_2c = (undefined4 *)&local_f8; current->primptr += sizeof(DR_ENV);
local_30 = &local_3c;
puVar19 = &local_10c; Tangle = ratan2(-pLightPos->vx, pLightPos->vz);
puVar17 = &local_110;
local_fc._0_2_ = 0x12; vert[0].vx = -128;
local_f4 = 0x12; vert[0].vy = 0;
local_100 = 0xff80; vert[0].vz = -320;
local_f8 = 0x80;
local_f6 = 0; vert[1].vx = 128;
local_110 = 0xff80; vert[1].vy = 0;
local_10c._0_2_ = -0x140; vert[1].vz = -320;
local_108 = 0x80;
local_104 = CONCAT22(local_104._2_2_, 0xfec0); vert[2].vx = -128;
do { vert[2].vy = 0;
iVar20 = iVar20 + -1; vert[2].vz = 18;
iVar11 = rcos(Tangle);
iVar12 = rsin(Tangle); vert[3].vx = 128;
sVar1 = *(short *)puVar17; vert[3].vy = 0;
sVar2 = *(short *)puVar19; vert[3].vz = 18;
iVar13 = rsin(Tangle);
iVar14 = rcos(Tangle); for (i = 0; i < 4; i++)
sVar3 = *(short *)puVar17; {
sVar4 = *(short *)puVar19; cn = rcos(Tangle);
*(short *)puVar17 = sn = rsin(Tangle);
(short)((uint)(((sVar1 * iVar11 >> 0xc) - (sVar2 * iVar12 >> 0xc)) * 0x10000) >> 0x10);
puVar17 = puVar17 + 2; vx = vert[i].vx;
*(short *)puVar19 = (short)(sVar3 * iVar13 >> 0xc) + (short)(sVar4 * iVar14 >> 0xc); vz = vert[i].vz;
plVar10 = local_34;
puVar19 = puVar19 + 2; vert[i].vx = (vx * cn >> 0xc) - (vz * sn >> 0xc);
} while (-1 < iVar20); vert[i].vz = (vx * sn >> 0xc) + (vz * cn >> 0xc);
uVar5 = *(ushort *)&pPedPos->vx;
sVar1 = *(short *)&pPedPos->vy; vert[i].vx += pPedPos->vx;
local_100 = CONCAT22(local_100._2_2_ + sVar1, (short)local_100 + uVar5); vert[i].vy += pPedPos->vy;
uVar6 = *(ushort *)&pPedPos->vz; vert[i].vz += pPedPos->vz;
local_fc = CONCAT22(local_fc._2_2_, (short)local_fc + uVar6);
local_f8 = local_f8 + uVar5;
local_f6 = local_f6 + sVar1;
local_f4 = local_f4 + uVar6;
local_110 = CONCAT22(local_110._2_2_ + sVar1, (short)local_110 + uVar5);
local_10c = CONCAT22(local_10c._2_2_, (short)local_10c + uVar6);
uVar15 = (local_104 & 0xffff) + (uint)uVar6;
local_108 = CONCAT22(local_108._2_2_ + sVar1, (short)local_108 + uVar5);
local_104 = local_104 & 0xffff0000 | uVar15 & 0xffff;
setCopControlWord(2, 0, inv_camera_matrix.m[0]._0_4_);
setCopControlWord(2, 0x800, inv_camera_matrix.m._4_4_);
setCopControlWord(2, 0x1000, inv_camera_matrix.m[1]._2_4_);
setCopControlWord(2, 0x1800, inv_camera_matrix.m[2]._0_4_);
setCopControlWord(2, 0x2000, inv_camera_matrix._16_4_);
setCopControlWord(2, 0x2800, local_f0);
setCopControlWord(2, 0x3000, local_ec);
setCopControlWord(2, 0x3800, local_e8);
setCopReg(2, in_zero, local_110);
setCopReg(2, in_at, local_10c);
setCopReg(2, &local_f0, local_108);
setCopReg(2, uVar15, local_104);
setCopReg(2, (uint)uVar6, local_100);
setCopReg(2, (uint)uVar5, local_fc);
copFunction(2, 0x280030);
iVar20 = current->id;
uVar7 = getCopReg(2, 0xc);
*(undefined4 *)&ft4TannerShadow[iVar20].x0 = uVar7;
uVar7 = getCopReg(2, 0xd);
*(undefined4 *)&ft4TannerShadow[iVar20].x1 = uVar7;
uVar7 = getCopReg(2, 0xe);
*(undefined4 *)&ft4TannerShadow[iVar20].x2 = uVar7;
z0 = getCopReg(2, 0x11);
*local_38 = z0;
z0 = getCopReg(2, 0x12);
*plVar10 = z0;
local_40 = getCopReg(2, 0x13);
setCopReg(2, in_zero, *local_2c);
setCopReg(2, in_at, local_2c[1]);
copFunction(2, 0x180001);
uVar7 = getCopReg(2, 0xe);
*(undefined4 *)&ft4TannerShadow[current->id].x3 = uVar7;
z0 = getCopReg(2, 0x13);
*local_30 = z0;
if (local_48 < local_44) {
local_48 = (local_48 + local_44) / 2;
} }
else {
local_44 = (local_48 + local_44) / 2; gte_SetRotMatrix(&inv_camera_matrix);
} gte_SetTransVector(&d);
if (local_40 < local_3c) {
local_40 = (local_40 + local_3c) / 2; gte_ldv3(&vert[0], &vert[1], &vert[2]);
}
else { docop2(0x280030);
local_3c = (local_40 + local_3c) / 2;
} gte_stsxy3(&ft4TannerShadow[current->id].x0, &ft4TannerShadow[current->id].x1, &ft4TannerShadow[current->id].x2);
z0 = 8;
if (0x1c < local_48) { gte_stsz3(&z0, &z1, &z2);
z0 = local_48 + -0x14;
} gte_ldv0(&vert[3]);
z1 = 8;
if (0x1c < local_44) { docop2(0x180001);
z1 = local_44 + -0x14;
} gte_stsxy(&ft4TannerShadow[current->id].x3);
z2 = 8;
if (0x1c < local_40) { gte_stsz(&z3);
z2 = local_40 + -0x14;
} if (z0 < z1)
z3 = 8; z0 = (z0 + z1) / 2;
if (0x1c < local_3c) { else
z3 = local_3c + -0x14; z1 = (z0 + z1) / 2;
}
local_48 = z0; if (z2 < z3)
local_44 = z1; z2 = (z2 + z3) / 2;
local_40 = z2; else
local_3c = z3; z3 = (z2 + z3) / 2;
if (z0 > 28)
z0 = z0 - 20;
else
z0 = 8;
if (z1 > 28)
z1 = z1 - 20;
else
z1 = 8;
if (z2 > 28)
z2 = z2 - 20;
else
z2 = 8;
if (z3 > 28)
z3 = z3 - 20;
else
z3 = 8;
SubdivShadow(z0, z1, z2, z3, ft4TannerShadow + current->id); SubdivShadow(z0, z1, z2, z3, ft4TannerShadow + current->id);
local_68 = (int)pLightPos->vx * 0x6e >> 0xc;
local_7c = player.cameraPos.vy; cp = camera_position;
local_78 = player.cameraPos.vz; ca = camera_angle;
local_74 = player.cameraPos.pad;
local_80 = player.cameraPos.vx; camera_position.vx = pDrawingPed->position.vx + (pLightPos->vx * 110 >> 0xc);
local_70 = camera_angle._0_4_; camera_position.vy = pDrawingPed->position.vy + (pLightPos->vy * 110 >> 0xc);
local_6c = camera_angle._4_4_; camera_position.vz = pDrawingPed->position.vz + (pLightPos->vz * 110 >> 0xc);
local_64 = (int)pLightPos->vy * 0x6e >> 0xc;
local_60 = (int)pLightPos->vz * 0x6e >> 0xc; myVector.vx = player[0].pos[0];
camera_position.vx = (pDrawingPed->position).vx + local_68; myVector.vy = player[0].pos[1] - 172;
camera_position.vy = (pDrawingPed->position).vy + local_64; myVector.vz = player[0].pos[2];
camera_position.vz = (pDrawingPed->position).vz + local_60;
local_58.vx = player.pos[0]; player[0].cameraPos.vx = camera_position.vx;
local_58.vy = player.pos[1] + -0xac; player[0].cameraPos.vy = camera_position.vy;
local_58.vz = player.pos[2]; player[0].cameraPos.vz = camera_position.vz;
player.cameraPos.vx = camera_position.vx;
player.cameraPos.vy = camera_position.vy; SetBasePos(&myVector);
player.cameraPos.vz = camera_position.vz; cVar9 = tracking_car;
SetBasePos(&local_58);
cVar8 = tracking_car; setCopControlWord(2, 0xc000, 0x200000); // hmmmm?
setCopControlWord(2, 0xc000, 0x200000);
setCopControlWord(2, 0xc800, 0x800000); setCopControlWord(2, 0xc800, 0x800000);
tracking_car = '\x01';
PlaceCameraAtLocation(&player, 0); tracking_car = 1;
tracking_car = cVar8; PlaceCameraAtLocation(&player[0], 0);
newShowTanner(); tracking_car = cVar9;
pDVar9 = current;
camera_angle._0_4_ = local_70; newShowTanner(pDrawingPed);
camera_angle._4_4_ = local_6c;
player.cameraPos.vx = local_80; addPrim(current->ot + 0x107f, &tileTannerClear[current->id]);
player.cameraPos.vy = local_7c;
player.cameraPos.vz = local_78; camera_position = cp;
player.cameraPos.pad = local_74; camera_angle = ca;
camera_position.vx = local_80; player[0].cameraPos = cp;
camera_position.vy = local_7c;
camera_position.vz = local_78; // restore camera
camera_position.pad = local_74; InitCamera(&player[0]);
*(uint *)(&tileTannerClear + current->id * 0x10) =
*(uint *)(&tileTannerClear + current->id * 0x10) & 0xff000000 |
current->ot[0x107f] & 0xffffff;
puVar16 = pDVar9->ot;
puVar16[0x107f] =
puVar16[0x107f] & 0xff000000 | (uint)(&tileTannerClear + pDVar9->id * 0x10) & 0xffffff;
InitCamera(&player);
setCopControlWord(2, 0xc000, 0xa00000); setCopControlWord(2, 0xc000, 0xa00000);
setCopControlWord(2, 0xc800, 0x800000); setCopControlWord(2, 0xc800, 0x800000);
SetDefDrawEnv(auStack224, (int)rectTannerWindow.x, (int)rectTannerWindow.y, (int)rectTannerWindow.w,
(int)rectTannerWindow.h); SetDefDrawEnv(&drEnv, rectTannerWindow.x, rectTannerWindow.y, rectTannerWindow.w, rectTannerWindow.h);
puVar18 = (uint *)current->primptr; dr_env = (DR_ENV*)current->primptr;
SetDrawEnv(puVar18, auStack224); SetDrawEnv(dr_env, &drEnv);
pDVar9 = current;
*puVar18 = *puVar18 & 0xff000000 | current->ot[0x107f] & 0xffffff; addPrim(current->ot + 0x107f, dr_env);
pDVar9->ot[0x107f] = pDVar9->ot[0x107f] & 0xff000000 | (uint)puVar18 & 0xffffff; current->primptr += sizeof(DR_ENV);
pDVar9->primptr = pDVar9->primptr + 0x40;
return;*/
} }
@ -2999,6 +2923,7 @@ void DoCivHead(PEDESTRIAN *pPed, SVECTOR *vert1, SVECTOR *vert2)
/* end block 2 */ /* end block 2 */
// End Line: 6677 // End Line: 6677
// [A] - not needed anymore
void DrawObject(MODEL *model, MATRIX *matrix, VECTOR *pos, int z_correct) void DrawObject(MODEL *model, MATRIX *matrix, VECTOR *pos, int z_correct)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
@ -3202,6 +3127,7 @@ void DrawObject(MODEL *model, MATRIX *matrix, VECTOR *pos, int z_correct)
/* WARNING: Unknown calling convention yet parameter storage is locked */ /* WARNING: Unknown calling convention yet parameter storage is locked */
// [A] - not needed anymore
void wjmDraw3(void) void wjmDraw3(void)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();

View File

@ -32,7 +32,7 @@ extern int DrawCharacter(PEDESTRIAN *pPed); // 0x00067D44
extern void InitTannerShadow(); // 0x000681EC extern void InitTannerShadow(); // 0x000681EC
extern void TannerShadow(VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358 extern void TannerShadow(PEDESTRIAN *pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358
extern void DoCivHead(PEDESTRIAN *pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C extern void DoCivHead(PEDESTRIAN *pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C

View File

@ -11,7 +11,7 @@
short distanceCache[16384]; short distanceCache[16384];
char omap[128][16]; // obstacle map char omap[128][16]; // obstacle map
long dunyet[32][2]; long dunyet[32][2]; // scanned cell map
int pathIterations; int pathIterations;
int pathFrames; int pathFrames;
@ -79,6 +79,17 @@ PATHFIND_238fake dirs[6] = {
}, },
}; };
#define OMAP_V(cx, cz) omap[((cx) & 0x7f)][((cz) & 0x7f) >> 3]
#define OMAP_GETVALUE(cx, cz) (OMAP_V(cx,cz) >> ((cz) & 7) & 1)
// [A] sets obstacle map bit
inline void OMapSet(int cellX, int cellZ, int val)
{
unsigned char prev = OMAP_V(cellX, cellZ);
int bit = (1 << (cellZ & 7));
OMAP_V(cellX, cellZ) = prev ^ bit & (prev ^ (val ? 0xFF : 0));
}
// decompiled code // decompiled code
// original method signature: // original method signature:
// struct tNode /*$ra*/ popNode() // struct tNode /*$ra*/ popNode()
@ -248,7 +259,7 @@ void WunCell(VECTOR *pbase)
int iVar4; int iVar4;
int iVar5; int iVar5;
int uVar6; int uVar6;
unsigned char bVar7; unsigned char val;
int iVar8; int iVar8;
PATHFIND_237fake* pPVar9; PATHFIND_237fake* pPVar9;
int iVar10; int iVar10;
@ -281,16 +292,10 @@ void WunCell(VECTOR *pbase)
iVar4 = v[0].vx + v[1].vx; iVar4 = v[0].vx + v[1].vx;
iVar5 = v[0].vz + v[1].vz; iVar5 = v[0].vz + v[1].vz;
cVar2 = lineClear(&v[0], &v[1]); OMapSet(iVar4 >> 9, iVar5 >> 9, lineClear(&v[0], &v[1]) == 0);
bVar7 = 0; //bVar1 = omap[(iVar4 >> 9 & 0x7fU)][((iVar5 >> 9 & 0x7f) >> 3)];
uVar6 = iVar5 >> 9; //omap[(iVar4 >> 9 & 0x7fU)][((iVar5 >> 9 & 0x7f) >> 3)] = bVar1 ^ (1 << (iVar5 >> 9 & 7)) & (bVar1 ^ val);
if (cVar2 == 0)
bVar7 = 0xff;
bVar1 = omap[(iVar4 >> 9 & 0x7fU)][((uVar6 & 0x7f) >> 3)];
omap[(iVar4 >> 9 & 0x7fU)][((uVar6 & 0x7f) >> 3)] = bVar1 ^ (1 << (uVar6 & 7)) & (bVar1 ^ bVar7);
iVar8++; iVar8++;
} while (iVar8 < 6); } while (iVar8 < 6);
@ -663,16 +668,16 @@ int blocked(tNode *v1, tNode *v2)
int iVar5; int iVar5;
int iVar6; int iVar6;
int iVar7; int iVar7;
int uVar8; int res;
int uVar9; int uVar9;
unsigned char bVar10; unsigned char bVar10;
if (slowWallTests == 0) if (slowWallTests == 0)
{ {
int x = (v1->vx + v1->vx >> 9 & 0x7f); int x = (v1->vx + v1->vx >> 9 & 0x7f);
int z = (v1->vz + v2->vz >> 9 & 0x7f) >> 3; int z = (v1->vz + v2->vz >> 9 & 0x7f);
uVar8 = omap[x][z] >> (v1->vz + v2->vz >> 9 & 7) & 1; res = OMAP_GETVALUE(x,z); // omap[x][z] >> (v1->vz + v2->vz >> 9 & 7) & 1;
} }
else else
{ {
@ -682,7 +687,7 @@ int blocked(tNode *v1, tNode *v2)
cVar3 = lineClear((VECTOR*)v1, (VECTOR*)v2); cVar3 = lineClear((VECTOR*)v1, (VECTOR*)v2);
bVar10 = 0; bVar10 = 0;
bVar2 = cVar3 == 0; bVar2 = cVar3 == 0;
uVar8 = (uint)bVar2; res = (uint)bVar2;
if (bVar2) if (bVar2)
bVar10 = 0xff; bVar10 = 0xff;
@ -691,7 +696,7 @@ int blocked(tNode *v1, tNode *v2)
omap[x][z] = bVar1 ^ (1 << ((v1->vz + v2->vz >> 9) & 7)) & (bVar1 ^ bVar10); omap[x][z] = bVar1 ^ (1 << ((v1->vz + v2->vz >> 9) & 7)) & (bVar1 ^ bVar10);
} }
return uVar8; return res;
} }
@ -900,7 +905,7 @@ void iterate(void)
} }
else else
{ {
if ((int)(uint)uVar1 <= (int)((uint)itHere.dist - 0x120)) { if (uVar1 <= (int)(itHere.dist - 0x120)) {
v2->dist = 1; v2->dist = 1;
} }
} }
@ -966,12 +971,15 @@ void iterate(void)
if (numHeapEntries != 198) if (numHeapEntries != 198)
{ {
setDistance(tNode_ARRAY_1f800000 + iVar4 + 2, (ushort)uVar6); setDistance(tNode_ARRAY_1f800000 + iVar4 + 2, (ushort)uVar6);
uVar8 = numHeapEntries + 1; uVar8 = numHeapEntries + 1;
uVar7 = uVar8 >> 1; uVar7 = uVar8 >> 1;
iVar9 = uVar8 * 0x10; iVar9 = uVar8 * 0x10;
if ((uVar7 != 0) && (uVar6 < heap[uVar7].dist)) if ((uVar7 != 0) && (uVar6 < heap[uVar7].dist))
{ {
iVar9 = uVar8 * 0x10; iVar9 = uVar8 * 0x10;
do { do {
uVar8 = uVar7; uVar8 = uVar7;
*(int*)((int)&heap[0].vx + iVar9) = (&heap[0].vx)[uVar8 * 4]; *(int*)((int)&heap[0].vx + iVar9) = (&heap[0].vx)[uVar8 * 4];
@ -979,9 +987,13 @@ void iterate(void)
*(int*)((int)&heap[0].vz + iVar9) = (&heap[0].vz)[uVar8 * 4]; *(int*)((int)&heap[0].vz + iVar9) = (&heap[0].vz)[uVar8 * 4];
uVar7 = uVar8 >> 1; uVar7 = uVar8 >> 1;
*(uint*)((int)&heap[0].dist + iVar9) = *(uint*)(&heap[0].dist + uVar8 * 8); *(uint*)((int)&heap[0].dist + iVar9) = *(uint*)(&heap[0].dist + uVar8 * 8);
if (uVar7 == 0) break;
if (uVar7 == 0)
break;
iVar9 = uVar8 << 4; // * 16 iVar9 = uVar8 << 4; // * 16
} while (uVar6 < heap[uVar7].dist); } while (uVar6 < heap[uVar7].dist);
iVar9 = uVar8 << 4; // * 16 iVar9 = uVar8 << 4; // * 16
} }
*(int*)((int)&heap[0].vx + iVar9) = tNode_ARRAY_1f800000[iVar4 + 2].vx; *(int*)((int)&heap[0].vx + iVar9) = tNode_ARRAY_1f800000[iVar4 + 2].vx;
@ -1586,41 +1598,43 @@ int getInterpolatedDistance(VECTOR *pos)
// [D] // [D]
void addCivs(void) void addCivs(void)
{ {
unsigned char bVar1; unsigned char bits;
int uVar2; int uVar2;
int iVar3; int iVar3;
int uVar4; int uVar4;
int uVar5; int uVar5;
int iVar7;
int iVar6; int iVar6;
int uVar7; int uVar7;
int iVar8; int iVar8;
int uVar9; int uVar9;
int iVar10; int iVar10;
int iVar11; int iVar11;
int x, z, vx, vz;
_CAR_DATA* cp; _CAR_DATA* cp;
cp = car_data; cp = car_data;
do { do {
if (cp->controlType == 2) if (cp->controlType == 2)
{ {
iVar11 = cp->hd.oBox.radii[2].vx; iVar7 = cp->hd.oBox.radii[2].vx;
iVar6 = cp->hd.oBox.location.vx; x = cp->hd.oBox.location.vx;
iVar6 = cp->hd.oBox.radii[2].vz;
z = cp->hd.oBox.location.vz;
iVar10 = cp->hd.oBox.radii[2].vz; vx = x + iVar7 >> 8 & 0x7e;
iVar8 = cp->hd.oBox.location.vz; vz = z + iVar6 >> 8;
uVar4 = iVar6 + iVar11 >> 8 & 0x7e; iVar3 = (vz & 0x7e) >> 3;
uVar2 = iVar8 + iVar10 >> 8; bits = (3 << (vz & 6));
uVar5 = uVar2 & 0x7e;
iVar3 = (int)uVar5 >> 3;
bVar1 = (3 << (uVar2 & 6));
uVar7 = iVar6 - iVar11 >> 8 & 0x7e;
omap[uVar4][iVar3] = bVar1 ^ omap[uVar4][iVar3];
uVar9 = iVar8 - iVar10 >> 8;
omap[uVar4 + 1][iVar3] = bVar1 ^ omap[uVar4 + 1][iVar3];
uVar2 = uVar9 & 0x7e;
if ((uVar4 ^ uVar5 << 8) == uVar7) uVar4 = x - iVar7 >> 8 & 0x7e;
omap[vx][iVar3] = bits ^ omap[vx][iVar3];
uVar5 = z - iVar6 >> 8;
omap[(vx + 1)][iVar3] = bits ^ omap[(vx + 1)][iVar3];
uVar2 = uVar5 & 0x7e;
if ((vx ^ (vz & 0x7e) << 8) == uVar4)
{ {
if (uVar2 != 0) if (uVar2 != 0)
goto LAB_PATH__000e8310; goto LAB_PATH__000e8310;
@ -1628,9 +1642,9 @@ void addCivs(void)
else if (uVar2 << 8 != 1) else if (uVar2 << 8 != 1)
{ {
LAB_PATH__000e8310: LAB_PATH__000e8310:
bVar1 = (3 << (uVar9 & 6)); bits = (3 << (uVar5 & 6));
omap[uVar7][uVar2 >> 3] = bVar1 ^ omap[uVar7][uVar2 >> 3]; omap[uVar4][(uVar2 >> 3)] = bits ^ omap[uVar4][(uVar2 >> 3)];
omap[uVar7 + 1][uVar2 >> 3] = bVar1 ^ omap[uVar7 + 1][uVar2 >> 3]; omap[(uVar4 + 1)][(uVar2 >> 3)] = bits ^ omap[(uVar4 + 1)][(uVar2 >> 3)];
} }
} }
@ -2354,7 +2368,8 @@ void UpdateCopMap(void)
} }
else else
{ {
addCivs(); // add cars
addCivs();
iVar1 = cellsThisFrame << 2; iVar1 = cellsThisFrame << 2;
uVar2 = cellsThisFrame; uVar2 = cellsThisFrame;
@ -2383,8 +2398,10 @@ void UpdateCopMap(void)
iterate(); iterate();
} }
// remove cars
addCivs(); addCivs();
} }
LAB_PATH__000e8dfc: LAB_PATH__000e8dfc:
piVar5 = distanceReturnedLog; piVar5 = distanceReturnedLog;
iVar8 = 6; iVar8 = 6;
@ -2408,6 +2425,25 @@ LAB_PATH__000e8dfc:
iVar8 = searchTarget.vy - player[0].pos[1] >> 4; iVar8 = searchTarget.vy - player[0].pos[1] >> 4;
iVar1 = searchTarget.vz - player[0].pos[2] >> 4; iVar1 = searchTarget.vz - player[0].pos[2] >> 4;
playerTargetDistanceSq = iVar7 * iVar7 + iVar8 * iVar8 + iVar1 * iVar1; playerTargetDistanceSq = iVar7 * iVar7 + iVar8 * iVar8 + iVar1 * iVar1;
#if 0
printf("=========================\n");
for (int i = 0; i < 128; i++)
{
char line[130];
for (int j = 0; j < 128; j++)
{
if (OMAP_GETVALUE(i, j))
line[j] = 'O';
else
line[j] = '.';
}
line[128] = 0;
printf("%s\n", line);
}
printf("=========================\n");
#endif
} }

View File

@ -283,20 +283,19 @@ void SetReverbState(int on)
/* end block 3 */ /* end block 3 */
// End Line: 1821 // End Line: 1821
// [D]
void SetReverbInGameState(int on) void SetReverbInGameState(int on)
{ {
UNIMPLEMENTED(); long cl;
/*
uint uVar1;
uVar1 = 0xffff; cl = 0xffff;
gSpeechQueue.reverb = (char)on;
if ((on != 0) && (gSpeechQueue.is_playing != '\0')) { gSpeechQueue.reverb = on;
uVar1 = ~(1 << ((uint)(byte)gSpeechQueue.chan & 0x1f)) & 0xffff;
} if (on && gSpeechQueue.is_playing)
SpuSetReverbVoice(on, uVar1); cl = ~SPU_KEYCH(gSpeechQueue.chan);
return;
*/ SpuSetReverbVoice(on, cl);
} }
@ -325,19 +324,19 @@ void SetReverbInGameState(int on)
/* end block 3 */ /* end block 3 */
// End Line: 1861 // End Line: 1861
// [D]
int SetReverbChannelState(int ch, int on) int SetReverbChannelState(int ch, int on)
{ {
UNIMPLEMENTED(); long cl;
return 0; int prev;
/* cl = SPU_KEYCH(ch);
uint uVar1;
uint uVar2;
uVar2 = 1 << (ch & 0x1fU); prev = SpuGetReverbVoice();
uVar1 = SpuGetReverbVoice();
SpuSetReverbVoice(on, uVar2); SpuSetReverbVoice(on, cl);
return (uint)((uVar1 & uVar2) != 0);*/
return (prev & cl) != 0;
} }
@ -2311,29 +2310,22 @@ int CalculateVolume(int channel)
/* end block 2 */ /* end block 2 */
// End Line: 3990 // End Line: 3990
// [D]
void AllocateReverb(long mode, long depth) void AllocateReverb(long mode, long depth)
{ {
UNIMPLEMENTED(); SpuReverbAttr r_attr;
/* if (SpuReserveReverbWorkArea(1) == 1)
int iVar1; {
undefined4 local_28; r_attr.mode = mode | 0x100;
uint local_24; r_attr.mask = 7;
undefined2 local_20; r_attr.depth.left = depth;
undefined2 local_1e; r_attr.depth.right = r_attr.depth.left;
iVar1 = SpuReserveReverbWorkArea(1); SpuSetReverbModeParam(&r_attr);
if (iVar1 == 1) { SpuSetReverbDepth(&r_attr);
local_24 = mode | 0x100;
local_28 = 7;
local_20 = (undefined2)depth;
local_1e = local_20;
SpuSetReverbModeParam(&local_28);
SpuSetReverbDepth(&local_28);
SpuSetReverb(1); SpuSetReverb(1);
} }
return;
*/
} }