- implement AddCopCarLight, fix ShowCarLight

- fix DrawSprites
- [EMU] zero GTE flag in NCLIP
This commit is contained in:
Ilya Shurumov 2020-05-24 13:41:26 +06:00
parent 13f89c2807
commit 75400561aa
6 changed files with 141 additions and 123 deletions

View File

@ -622,6 +622,7 @@ int docop2(int op) {
#else #else
MAC0 = int(F((long long)(SX0 * SY1) + (SX1 * SY2) + (SX2 * SY0) - (SX0 * SY2) - (SX1 * SY0) - (SX2 * SY1))); MAC0 = int(F((long long)(SX0 * SY1) + (SX1 * SY2) + (SX2 * SY0) - (SX0 * SY2) - (SX1 * SY0) - (SX2 * SY1)));
#endif #endif
FLAG = 0;
return 1; return 1;
case 0x0c: case 0x0c:

View File

@ -13,6 +13,7 @@ extern char tracking_car;
extern int CameraCnt; extern int CameraCnt;
extern int TargetCar; extern int TargetCar;
extern int CameraCar;
extern SVECTOR camera_angle; extern SVECTOR camera_angle;
extern int gCameraAngle; extern int gCameraAngle;

View File

@ -5,6 +5,10 @@
#include "HANDLING.H" #include "HANDLING.H"
#include "CARS.H" #include "CARS.H"
#include "DEBRIS.H" #include "DEBRIS.H"
#include "PAUSE.H"
#include "CAMERA.H"
#include "DIRECTOR.H"
#include "MAIN.H"
#include <string.h> #include <string.h>
@ -523,138 +527,143 @@ void AddBrakeLight(_CAR_DATA *cp)
/* end block 3 */ /* end block 3 */
// End Line: 1348 // End Line: 1348
int main_cop_light_pos = 0;
// [D]
void AddCopCarLight(_CAR_DATA *cp) void AddCopCarLight(_CAR_DATA *cp)
{ {
UNIMPLEMENTED(); static char xpos1[8] = {
/* 0x30, 0x20, 0x10, 0x0,
short sVar1; 0x0, 0x10, 0x20, 0x30
uint uVar2; };
CAR_COSMETICS *pCVar3;
int iVar4;
byte *pbVar5;
uint uVar6;
int iVar7;
SVECTOR local_58;
CVECTOR local_50[2];
int local_48;
int local_44;
_CAR_DATA *local_40;
int local_3c;
int local_38;
undefined **local_34;
undefined4 local_30;
int local_2c;
local_3c = 1; short sVar1;
pbVar5 = (byte *)&(cp->ap).coplife; short sVar2;
if (cp < car_data) { int iVar3;
int uVar4;
short sVar5;
char cVar6;
int iVar7;
CAR_COSMETICS *pCVar8;
char *coplife;
uint uVar10;
int iVar11;
SVECTOR v1;
CVECTOR col;
sVar5 = 1;
coplife = &cp->ap.coplife;
if (cp < car_data)
{
while (FrameCnt != 0x78654321) { while (FrameCnt != 0x78654321) {
trap(0x400); trap(0x400);
} }
} }
if ((CameraCar == (int)(cp[-0x503].ap.old_clock + 2) * -0x24ca58e9 >> 2) && (cameraview == 2)) {
if (CameraCar == CAR_INDEX(cp) && cameraview == 2)
return; return;
}
if (FastForward != 0) { if (FastForward != 0)
return; return;
}
if ((cp->hd).where.m[4] < 100) { if (cp->hd.where.m[1][1] < 100)
return; return;
}
pCVar3 = (cp->ap).carCos; pCVar8 = (cp->ap).carCos;
sVar1 = (pCVar3->cog).vx; sVar1 = (pCVar8->cog).vx;
if (GameLevel == 1) {
LAB_00030268: if (GameLevel == 1 || GameLevel == 3)
iVar7 = 1; {
local_2c = 2; iVar11 = 1;
uVar6 = 3;
local_30 = 0x30;
}
else {
if (GameLevel < 2) {
if (GameLevel == 0) {
iVar7 = 2; iVar7 = 2;
local_2c = 2; uVar10 = 3;
uVar6 = 3; cVar6 = 48;
local_30 = 0x10;
goto LAB_000302c4;
}
}
else {
if (GameLevel == 3) goto LAB_00030268;
} }
else if (GameLevel == 0)
{
iVar11 = 2;
iVar7 = 2; iVar7 = 2;
local_2c = 3; uVar10 = 3;
local_30 = 0x10; cVar6 = 16;
uVar6 = main_cop_light_pos + ((int)(cp[-0x503].ap.old_clock + 2) * -0x24ca58e9 >> 2) & 7;
} }
LAB_000302c4: else
if (iVar7 + -1 != -1) { {
local_38 = 2; iVar11 = 2;
local_40 = cp; iVar7 = 3;
iVar7 = iVar7 + -1; cVar6 = 16;
uVar10 = main_cop_light_pos + CAR_INDEX(cp) & 7;
}
do { do {
iVar4 = local_2c + -1; sVar2 = sVar5;
local_44 = iVar7 + -1; iVar11--;
local_48 = -local_3c;
if (iVar4 != -1) { if (iVar11 == -1)
local_34 = &PTR_DAT_0009c004; return;
do {
local_58.vx = sVar1; iVar3 = iVar7;
if ((GameLevel != 1) && (GameLevel != 3)) {
local_58.vx = sVar1 + ((ushort)*(byte *)(uVar6 + (int)local_34) + while (iVar3--, sVar5 = -sVar2, iVar3 != -1)
(pCVar3->policeLight).vx) * (short)local_3c; {
} v1.vx = sVar1;
local_50[0].g = 'Z';
local_58.vy = (pCVar3->policeLight).vy + (pCVar3->cog).vy; if (GameLevel != 1 && GameLevel != 3)
if (gNight != 0) { v1.vx = sVar1 + (xpos1[uVar10] + (pCVar8->policeLight).vx) * sVar2;
local_50[0].g = '2';
} col.g = 90;
if (((pauseflag == 0) && ((CameraCnt & 1U) != 0)) && (GameLevel == local_38)) { v1.vy = pCVar8->policeLight.vy + pCVar8->cog.vy;
uVar6 = uVar6 + 1;
} if (gNight != 0)
uVar6 = uVar6 & 7; col.g = 50;
local_58.vz = (pCVar3->policeLight).vz + (pCVar3->cog).vz;
if ((char)*pbVar5 < '\0') { if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == 2)
uVar2 = 0xff - (uint)*pbVar5; uVar10++;
}
else { uVar10 = uVar10 & 7;
uVar2 = (uint)*pbVar5; v1.vz = (pCVar8->policeLight).vz + (pCVar8->cog).vz;
}
if (GameLevel == 1) { uVar4 = *coplife;
// [A] too entangled...
if (GameLevel == 1)
{
LAB_00030434: LAB_00030434:
local_50[0].b = -1; col.b = -1;
local_50[0].r = local_50[0].g; col.r = col.g;
} }
else { else
if (1 < GameLevel) { {
if (GameLevel != 3) goto LAB_0003041c; if (1 < GameLevel)
{
if (GameLevel != 3)
goto LAB_0003041c;
goto LAB_00030434; goto LAB_00030434;
} }
if (GameLevel != 0) {
if (GameLevel != 0)
{
LAB_0003041c: LAB_0003041c:
if (iVar7 == 0) goto LAB_00030434; if (iVar11 == 0)
goto LAB_00030434;
} }
local_50[0].r = -1;
local_50[0].b = local_50[0].g; col.r = -1;
col.b = col.g;
} }
if (pauseflag == 0) {
*pbVar5 = *pbVar5 + (char)local_30; if (pauseflag == 0)
cp->ap.coplife += cVar6;
ShowCarlight(&v1, cp, &col, uVar4 >> 1, &light_texture, 0xff);
if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == 2)
uVar10++;
uVar10 = uVar10 & 7;
} }
ShowCarlight(&local_58, local_40, local_50, (short)((int)uVar2 >> 1), &light_texture, 0xff);
if (((pauseflag == 0) && ((CameraCnt & 1U) != 0)) && (GameLevel == local_38)) { } while (true);
uVar6 = uVar6 + 1;
}
iVar4 = iVar4 + -1;
uVar6 = uVar6 & 7;
} while (iVar4 != -1);
}
local_3c = local_48;
iVar7 = local_44;
} while (local_44 != -1);
}
return;
*/
} }

View File

@ -2588,7 +2588,7 @@ void ShowCarlight(SVECTOR *v1, _CAR_DATA *cp, CVECTOR *col, short size, TEXTURE_
iVar1 = 255; iVar1 = 255;
if (flag == -1) if (flag == 0xFF)
flag = 0; flag = 0;
else else

View File

@ -438,7 +438,8 @@ LAB_0003f0c4:
plotContext.scribble[2] = pco->pos.vz; plotContext.scribble[2] = pco->pos.vz;
z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)plotContext.scribble, (MATRIX2 *)&face_camera); z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)plotContext.scribble, (MATRIX2 *)&face_camera);
if(z < 0)//[A] (z < 1001) #if 0
if(z < 1001)
{ {
uVar11 = (uint)model->num_polys; uVar11 = (uint)model->num_polys;
iVar10 = model->poly_block; iVar10 = model->poly_block;
@ -475,10 +476,15 @@ LAB_0003f0c4:
} }
} }
else else
#else
if (z > 0)
#endif
{ {
plotContext.ot = plotContext.ot + -0x85; plotContext.ot -= 133;
Tile1x1(model); Tile1x1(model);
plotContext.ot = plotContext.ot + 0x85;
plotContext.ot += 133;
} }
local_2c--; local_2c--;

View File

@ -2,6 +2,7 @@
#define GAMESND_H #define GAMESND_H
extern int TimeSinceLastSpeech; extern int TimeSinceLastSpeech;
extern char force_siren[8];
extern void LoadBankFromLump(int bank, int lump); // 0x00052460 extern void LoadBankFromLump(int bank, int lump); // 0x00052460