Merge branch 'develop-SoapyMan' into pre_d2

This commit is contained in:
InspirationByte 2022-03-12 10:19:23 +03:00
commit eac26636b4
9 changed files with 161 additions and 144 deletions

View File

@ -879,7 +879,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
Start3DSoundVolPitch(chan, SOUND_BANK_SFX, match->sound,
collisionResult.hit.vx, -collisionResult.hit.vy, collisionResult.hit.vz,
match->volume, match->pitch + (((velocity.vx ^ velocity.vz) * (collisionResult.hit.vx ^ collisionResult.hit.vz) & 0x3ff) - 0x200));
match->volume, match->pitch + (((velocity.vx ^ velocity.vz) * (collisionResult.hit.vx ^ collisionResult.hit.vz) & 1023) - 512));
}
cp->hd.where.t[0] = tempwhere.vx;

View File

@ -592,9 +592,9 @@ void PlaceCameraInCar(PLAYER *lp, int BumperCam)
// [A] handle REDRIVER2 dedicated look back button
if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED))
camera_angle.vy = 2048 - baseDir & 0xfff;
camera_angle.vy = 2048 - baseDir & 4095;
else
camera_angle.vy = (lp->headPos >> 16) - baseDir & 0xfff;
camera_angle.vy = (lp->headPos >> 16) - baseDir & 4095;
if (cp)
{
@ -632,13 +632,18 @@ void PlaceCameraInCar(PLAYER *lp, int BumperCam)
}
else
{
LPPEDESTRIAN pPlayerPed;
pPlayerPed = lp->pPed;
camera_angle.vx = -tannerLookAngle.vx;
// pedestrian camera is much simpler
BuildWorldMatrix();
viewer_position.vy += lp->pPed->head_pos - 25;
//viewer_position.vz += 45;
if (pPlayerPed)
{
// apply pedestrian bobbing
viewer_position.vy += pPlayerPed->head_pos - 25;
}
angle = -baseDir;

View File

@ -815,26 +815,26 @@ void InitDebrisNames(void)
GetTextureDetails("FOREARM1", &forearm1_texture);
GetTextureDetails("CHEST1", &chest1_texture);
GetTextureDetails("LOWHEAD", &head1_texture);
GetTextureDetails("ADDCAM", &addcam);
GetTextureDetails("FRAMEADV", &frameadv);
GetTextureDetails("AUTO", &autocam);
GetTextureDetails("CHASEC", &chasecar);
GetTextureDetails("CHOOSECA", &choosecar);
GetTextureDetails("CLOCK", &clock);
GetTextureDetails("DELCAM", &delcam);
GetTextureDetails("EDITCAM", &editcam);
GetTextureDetails("FIXEDCA", &fixedcam);
GetTextureDetails("INCAR", &incar);
GetTextureDetails("LENSCHA", &lenschan);
GetTextureDetails("LOOKCAR", &lookcar);
GetTextureDetails("MOVECMP", &movecam);
GetTextureDetails("MOVECAM", &movecampos);
GetTextureDetails("OK", &ok);
GetTextureDetails("PAUSE", &pause);
GetTextureDetails("PLAYCAM", &playcam);
GetTextureDetails("PLAYPAU", &playpause);
GetTextureDetails("SAVE2CA", &save2card);
GetTextureDetails("RESTREP", &restart);
GetTextureDetails("ADDCAM", &icon_addcam);
GetTextureDetails("FRAMEADV", &icon_frameadv);
GetTextureDetails("AUTO", &icon_autocam);
GetTextureDetails("CHASEC", &icon_chasecar);
GetTextureDetails("CHOOSECA", &icon_choosecar);
GetTextureDetails("CLOCK", &icon_clock);
GetTextureDetails("DELCAM", &icon_delcam);
GetTextureDetails("EDITCAM", &icon_editcam);
GetTextureDetails("FIXEDCA", &icon_fixedcam);
GetTextureDetails("INCAR", &icon_incar);
GetTextureDetails("LENSCHA", &icon_lenschan);
GetTextureDetails("LOOKCAR", &icon_lookcar);
GetTextureDetails("MOVECMP", &icon_movecam);
GetTextureDetails("MOVECAM", &icon_movecampos);
GetTextureDetails("OK", &icon_ok);
GetTextureDetails("PAUSE", &icon_pause);
GetTextureDetails("PLAYCAM", &icon_playcam);
GetTextureDetails("PLAYPAU", &icon_playpause);
GetTextureDetails("SAVE2CA", &icon_save2card);
GetTextureDetails("RESTREP", &icon_restart);
GetTextureDetails("HEAD1", &texturePedHead);
GetTextureDetails("TSHADOW", &tannerShadow_texture);

View File

@ -27,52 +27,52 @@ struct REPLAY_ICON
short tx, ty;
};
TEXTURE_DETAILS delcam; // address 0xC0EE0
TEXTURE_DETAILS incar; // address 0xBF950
TEXTURE_DETAILS lenschan; // address 0xC1DB0
TEXTURE_DETAILS lookcar; // address 0xC1CB0
TEXTURE_DETAILS movecam; // address 0xC1C18
TEXTURE_DETAILS movecampos; // address 0xC08C0
TEXTURE_DETAILS ok; // address 0xC1BD8
TEXTURE_DETAILS pause; // address 0xBF970
TEXTURE_DETAILS playpause; // address 0xC2A28
TEXTURE_DETAILS clock; // address 0xBF940
TEXTURE_DETAILS choosecar; // address 0xC2A08
TEXTURE_DETAILS chasecar; // address 0xC1D60
TEXTURE_DETAILS addcam; // address 0xC0A50
TEXTURE_DETAILS autocam; // address 0xC1CA0
TEXTURE_DETAILS playcam; // address 0xC1C08
TEXTURE_DETAILS restart; // address 0xC1CD0
TEXTURE_DETAILS save2card; // address 0xC1F40
TEXTURE_DETAILS editcam; // address 0xC1BE8
TEXTURE_DETAILS fixedcam; // address 0xC1D70
TEXTURE_DETAILS frameadv; // address 0xC1D80
TEXTURE_DETAILS icon_delcam; // address 0xC0EE0
TEXTURE_DETAILS icon_incar; // address 0xBF950
TEXTURE_DETAILS icon_lenschan; // address 0xC1DB0
TEXTURE_DETAILS icon_lookcar; // address 0xC1CB0
TEXTURE_DETAILS icon_movecam; // address 0xC1C18
TEXTURE_DETAILS icon_movecampos; // address 0xC08C0
TEXTURE_DETAILS icon_ok; // address 0xC1BD8
TEXTURE_DETAILS icon_pause; // address 0xBF970
TEXTURE_DETAILS icon_playpause; // address 0xC2A28
TEXTURE_DETAILS icon_clock; // address 0xBF940
TEXTURE_DETAILS icon_choosecar; // address 0xC2A08
TEXTURE_DETAILS icon_chasecar; // address 0xC1D60
TEXTURE_DETAILS icon_addcam; // address 0xC0A50
TEXTURE_DETAILS icon_autocam; // address 0xC1CA0
TEXTURE_DETAILS icon_playcam; // address 0xC1C08
TEXTURE_DETAILS icon_restart; // address 0xC1CD0
TEXTURE_DETAILS icon_save2card; // address 0xC1F40
TEXTURE_DETAILS icon_editcam; // address 0xC1BE8
TEXTURE_DETAILS icon_fixedcam; // address 0xC1D70
TEXTURE_DETAILS icon_frameadv; // address 0xC1D80
REPLAY_ICON replay_icons[] =
{
{ 20, 26, &pause, G_LTXT_ID(GTXT_Pause), 20, 48 },
{ 20, 26, &playpause, G_LTXT_ID(GTXT_Play), 20, 48 },
{ 44, 26, &autocam, G_LTXT_ID(GTXT_AutoDirector), 44, 48 },
{ 68, 26, &playcam, G_LTXT_ID(GTXT_FastForward), 68, 48 },
{ 92, 26, &frameadv, G_LTXT_ID(GTXT_FrameAdvance), 92, 48 },
{ 116, 26, &restart, G_LTXT_ID(GTXT_Rewindtobeginning), 116, 48 },
{ 140, 26, &addcam, G_LTXT_ID(GTXT_AddCamera), 140, 48 },
{ 164, 26, &editcam, G_LTXT_ID(GTXT_EditCamera), 164, 48 },
{ 188, 26, &save2card, G_LTXT_ID(GTXT_SaveReplay), 188, 48 },
{ 212, 26, &ok, G_LTXT_ID(GTXT_Exit), 212, 48 },
{ 140, 50, &incar, G_LTXT_ID(GTXT_InCar), 164, 48 },
{ 140, 74, &chasecar, G_LTXT_ID(GTXT_ChaseCamera), 164, 72 },
{ 140, 98, &fixedcam, G_LTXT_ID(GTXT_TripodCamera), 164, 96 },
{ 140, 122, &ok, G_LTXT_ID(GTXT_Accept), 164, 120 },
{ 140, 122, &clock, G_LTXT_ID(GTXT_MoveCameraStart), 164, 120 },
{ 140, 146, &delcam, G_LTXT_ID(GTXT_DeleteCamera), 164, 144 },
{ 140, 170, &ok, G_LTXT_ID(GTXT_Accept), 164, 168 },
{ 164, 50, &choosecar, G_LTXT_ID(GTXT_YouorPursuer), 164, 72 },
{ 164, 74, &movecampos, G_LTXT_ID(GTXT_MoveCamera), 164, 96 },
{ 164, 98, &movecampos, G_LTXT_ID(GTXT_MoveCamera), 164, 120 },
{ 188, 98, &lookcar, G_LTXT_ID(GTXT_LocktoCar), 188, 120 },
{ 212, 98, &movecam, G_LTXT_ID(GTXT_Rotate), 212, 120 },
{ 236, 98, &lenschan, G_LTXT_ID(GTXT_Zoom), 236, 120 }
{ 20, 26, &icon_pause, G_LTXT_ID(GTXT_Pause), 20, 48 },
{ 20, 26, &icon_playpause, G_LTXT_ID(GTXT_Play), 20, 48 },
{ 44, 26, &icon_autocam, G_LTXT_ID(GTXT_AutoDirector), 44, 48 },
{ 68, 26, &icon_playcam, G_LTXT_ID(GTXT_FastForward), 68, 48 },
{ 92, 26, &icon_frameadv, G_LTXT_ID(GTXT_FrameAdvance), 92, 48 },
{ 116, 26, &icon_restart, G_LTXT_ID(GTXT_Rewindtobeginning), 116, 48 },
{ 140, 26, &icon_addcam, G_LTXT_ID(GTXT_AddCamera), 140, 48 },
{ 164, 26, &icon_editcam, G_LTXT_ID(GTXT_EditCamera), 164, 48 },
{ 188, 26, &icon_save2card, G_LTXT_ID(GTXT_SaveReplay), 188, 48 },
{ 212, 26, &icon_ok, G_LTXT_ID(GTXT_Exit), 212, 48 },
{ 140, 50, &icon_incar, G_LTXT_ID(GTXT_InCar), 164, 48 },
{ 140, 74, &icon_chasecar, G_LTXT_ID(GTXT_ChaseCamera), 164, 72 },
{ 140, 98, &icon_fixedcam, G_LTXT_ID(GTXT_TripodCamera), 164, 96 },
{ 140, 122, &icon_ok, G_LTXT_ID(GTXT_Accept), 164, 120 },
{ 140, 122, &icon_clock, G_LTXT_ID(GTXT_MoveCameraStart), 164, 120 },
{ 140, 146, &icon_delcam, G_LTXT_ID(GTXT_DeleteCamera), 164, 144 },
{ 140, 170, &icon_ok, G_LTXT_ID(GTXT_Accept), 164, 168 },
{ 164, 50, &icon_choosecar, G_LTXT_ID(GTXT_YouorPursuer), 164, 72 },
{ 164, 74, &icon_movecampos, G_LTXT_ID(GTXT_MoveCamera), 164, 96 },
{ 164, 98, &icon_movecampos, G_LTXT_ID(GTXT_MoveCamera), 164, 120 },
{ 188, 98, &icon_lookcar, G_LTXT_ID(GTXT_LocktoCar), 188, 120 },
{ 212, 98, &icon_movecam, G_LTXT_ID(GTXT_Rotate), 212, 120 },
{ 236, 98, &icon_lenschan, G_LTXT_ID(GTXT_Zoom), 236, 120 }
};
unsigned char menu0[] = { 0, 0xFF };

View File

@ -1,26 +1,26 @@
#ifndef DIRECTOR_H
#define DIRECTOR_H
extern TEXTURE_DETAILS addcam;
extern TEXTURE_DETAILS frameadv;
extern TEXTURE_DETAILS autocam;
extern TEXTURE_DETAILS chasecar;
extern TEXTURE_DETAILS choosecar;
extern TEXTURE_DETAILS clock;
extern TEXTURE_DETAILS delcam;
extern TEXTURE_DETAILS editcam;
extern TEXTURE_DETAILS fixedcam;
extern TEXTURE_DETAILS incar;
extern TEXTURE_DETAILS lenschan;
extern TEXTURE_DETAILS lookcar;
extern TEXTURE_DETAILS movecam;
extern TEXTURE_DETAILS movecampos;
extern TEXTURE_DETAILS ok;
extern TEXTURE_DETAILS pause;
extern TEXTURE_DETAILS playcam;
extern TEXTURE_DETAILS playpause;
extern TEXTURE_DETAILS save2card;
extern TEXTURE_DETAILS restart;
extern TEXTURE_DETAILS icon_addcam;
extern TEXTURE_DETAILS icon_frameadv;
extern TEXTURE_DETAILS icon_autocam;
extern TEXTURE_DETAILS icon_chasecar;
extern TEXTURE_DETAILS icon_choosecar;
extern TEXTURE_DETAILS icon_clock;
extern TEXTURE_DETAILS icon_delcam;
extern TEXTURE_DETAILS icon_editcam;
extern TEXTURE_DETAILS icon_fixedcam;
extern TEXTURE_DETAILS icon_incar;
extern TEXTURE_DETAILS icon_lenschan;
extern TEXTURE_DETAILS icon_lookcar;
extern TEXTURE_DETAILS icon_movecam;
extern TEXTURE_DETAILS icon_movecampos;
extern TEXTURE_DETAILS icon_ok;
extern TEXTURE_DETAILS icon_pause;
extern TEXTURE_DETAILS icon_playcam;
extern TEXTURE_DETAILS icon_playpause;
extern TEXTURE_DETAILS icon_save2card;
extern TEXTURE_DETAILS icon_restart;
extern int FastForward;
extern int EditMode;

View File

@ -243,10 +243,12 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
model = modelpointers[modelnumber];
plotContext.colour = spriteColour;
#ifndef PSX
if ((pco->value & 0x3f) == 63 || (gTimeOfDay == 3 && modelnumber == 945)) // [A] Vegas tree fix
if ((pco->value & 63) == 63 ||
(gTimeOfDay == 3 && modelnumber != 1223 && (!(model->flags2 & MODEL_FLAG_TREE) || modelnumber == 945 || modelnumber == 497))) // [A] multiple sprites lighting fixes
{
plotContext.colour = 0x2c808080;
#endif
}
plotContext.scribble[0] = pco->pos.vx;
plotContext.scribble[1] = (pco->pos.vy << 0x10) >> 0x11;
plotContext.scribble[2] = pco->pos.vz;

View File

@ -78,7 +78,7 @@ CYCLE_OBJECT* Lev_CycleObjPtrs[] = {
Lev3
};
int Num_LevCycleObjs[] = { 2, 0, 12, 0 };
int Num_LevCycleObjs[] = { numberOf(Lev0), 0, numberOf(Lev2), 0 };
ANIMATED_OBJECT Lev0AnimObjects[9] =
{
@ -220,7 +220,9 @@ void ColourCycle(void)
RECT16 vram;
if (!num_cycle_obj)
{
return;
}
if (LoadingArea != 0)
{
@ -228,66 +230,76 @@ void ColourCycle(void)
return;
}
if (FrameCnt & 1) // [A]
{
return;
}
vram.w = 16;
vram.h = 1;
cyc = Lev_CycleObjPtrs[GameLevel];
for (i = 0; i < num_cycle_obj; i++)
for (i = 0; i < num_cycle_obj; i++, cyc++)
{
TEXTURE_DETAILS* cycTex = &cycle_tex[i];
bufaddr = (u_short*)cyclecluts[i].p;
if (tpageloaded[cycle_tex[i].texture_page] != 0)
if (tpageloaded[cycTex->texture_page] == 0)
{
if (cycle_phase == 0)
{
// initialize
temp = texture_cluts[cycle_tex[i].texture_page][cycle_tex[i].texture_number];
cyc->vx = vram.x = (temp & 0x3f) << 4;
cyc->vy = vram.y = (temp >> 6);
StoreImage(&vram, (u_long*)bufaddr);
}
else
{
if ((cycle_timer & cyc->speed1) == 0)
{
if (cyc->start1 != -1)
{
temp = bufaddr[cyc->start1];
memmove((u_char*)(bufaddr + cyc->start1), (u_char*)(bufaddr + cyc->start1 + 1), (cyc->stop1 - cyc->start1) << 1);
bufaddr[cyc->stop1] = temp;
}
}
if ((cycle_timer & cyc->speed2) == 0)
{
if (cyc->start2 != -1)
{
temp = bufaddr[cyc->start2];
memmove((u_char*)(bufaddr + cyc->start2), (u_char*)(bufaddr + cyc->start2 + 1), (cyc->stop2 - cyc->start2) << 1);
bufaddr[cyc->stop2] = temp;
}
}
vram.x = cyc->vx;
vram.y = cyc->vy;
SetDrawLoad(&cyclecluts[i], &vram);
addPrim(current->ot, &cyclecluts[i]);
}
continue;
}
cyc++;
if (cycle_phase == 0)
{
// initialize clut data from VRAM
temp = texture_cluts[cycTex->texture_page][cycTex->texture_number];
cyc->vx = vram.x = (temp & 63) << 4;
cyc->vy = vram.y = (temp >> 6);
StoreImage(&vram, (u_long*)bufaddr);
}
else
{
if ((cycle_timer & cyc->speed1) == 0)
{
if (cyc->start1 != -1)
{
temp = bufaddr[cyc->start1];
memmove((u_char*)(bufaddr + cyc->start1), (u_char*)(bufaddr + cyc->start1 + 1), (cyc->stop1 - cyc->start1) * sizeof(ushort));
bufaddr[cyc->stop1] = temp;
}
}
if ((cycle_timer & cyc->speed2) == 0)
{
if (cyc->start2 != -1)
{
temp = bufaddr[cyc->start2];
memmove((u_char*)(bufaddr + cyc->start2), (u_char*)(bufaddr + cyc->start2 + 1), (cyc->stop2 - cyc->start2) * sizeof(ushort));
bufaddr[cyc->stop2] = temp;
}
}
vram.x = cyc->vx;
vram.y = cyc->vy;
SetDrawLoad(&cyclecluts[i], &vram);
addPrim(current->ot, &cyclecluts[i]);
}
}
if (cycle_phase != 0)
{
cycle_timer++;
cycle_phase ^= 1;
}
else
{
cycle_phase = 1;
}
}

View File

@ -849,8 +849,7 @@ void DrawSightCone(COP_SIGHT_DATA *pCopSightData, VECTOR *pPosition, int directi
// [D] [T]
u_int Long2DDistance(VECTOR *pPoint1, VECTOR *pPoint2)
{
int tempTheta;
int theta;
int theta, tempTheta;
u_int result;
VECTOR delta;
@ -859,7 +858,7 @@ u_int Long2DDistance(VECTOR *pPoint1, VECTOR *pPoint2)
theta = ratan2(delta.vz, delta.vx);
if ((theta & 0x7ff) - 512U <= 1024)
if ((theta & 2047) - 512U <= 1024)
{
tempTheta = RSIN(theta);
result = delta.vz;
@ -870,7 +869,7 @@ u_int Long2DDistance(VECTOR *pPoint1, VECTOR *pPoint2)
result = delta.vx;
}
if (result < 0x80000)
if (result < 512 * 1024)
result = (result << 12) / tempTheta;
else
result = (result << 9) / tempTheta << 3;

View File

@ -29,7 +29,6 @@ extern short rcossin_tbl[8192];
// math constants
#define FixHalfRound(x, bits) (((x) + (1 << (bits-1))) >> bits)
#define FixFloorSigned(x, bits) ((x) / (1 << bits)) // in disassembly: ((int(x) < 0 ? int(x) + (1 << bits)-1 : int(x)) >> bits)
#define FIXEDH(a) FixHalfRound(a, ONE_BITS) // Fixed Half Round number
#define FIXED(a) ((a) >> ONE_BITS) // Fixed number (unsigned)