mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-23 02:42:38 +01:00
Merge pull request #23 from SoapyMan/develop-Fireboyd78
Develop fireboyd78
This commit is contained in:
commit
801906cca1
@ -2614,12 +2614,8 @@ int DrawAllBuildings(CELL_OBJECT **objects, int num_buildings, DB *disp)
|
||||
// [D]
|
||||
void RenderModel(MODEL *model, MATRIX *matrix, VECTOR *pos, int zBias, int flags, int subdiv)
|
||||
{
|
||||
int i;
|
||||
int zbias;
|
||||
OTTYPE* savedOT;
|
||||
OTTYPE* savedOT = current->ot;
|
||||
|
||||
savedOT = current->ot;
|
||||
|
||||
if (matrix != NULL)
|
||||
{
|
||||
MATRIX comb;
|
||||
@ -2629,14 +2625,13 @@ void RenderModel(MODEL *model, MATRIX *matrix, VECTOR *pos, int zBias, int flags
|
||||
SetRotMatrix(&comb);
|
||||
}
|
||||
|
||||
zbias = (zBias >> 3) + (model->zBias - 64);
|
||||
zBias /= 8;
|
||||
zBias += (model->zBias - 64);
|
||||
|
||||
if (zbias < 0)
|
||||
zbias = 0;
|
||||
|
||||
current->ot += (zbias * 4);
|
||||
if (zBias > 0)
|
||||
current->ot += (zBias * 4);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
plotContext.f4colourTable[i * 4 + 0] = planeColours[i] | 0x2C000000;
|
||||
plotContext.f4colourTable[i * 4 + 1] = planeColours[0] | 0x2C000000;
|
||||
|
@ -208,6 +208,10 @@ void FadeGameScreen(int flag, int speed)
|
||||
|
||||
DrawPrim(&p);
|
||||
DrawPrim(&poly);
|
||||
|
||||
#ifndef PSX
|
||||
Emulator_EndScene();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2187,7 +2187,8 @@ void DrawGame(void)
|
||||
}
|
||||
|
||||
#ifndef PSX
|
||||
Emulator_EndScene();
|
||||
if (!FadingScreen)
|
||||
Emulator_EndScene();
|
||||
#endif
|
||||
|
||||
FrameCnt++;
|
||||
|
@ -730,7 +730,6 @@ void DoMissionSound(void)
|
||||
int x;
|
||||
int y_00;
|
||||
int z_00;
|
||||
long lVar5;
|
||||
int x_00;
|
||||
long lVar6;
|
||||
long lVar7;
|
||||
@ -738,51 +737,52 @@ void DoMissionSound(void)
|
||||
long V[3];
|
||||
static int channel;
|
||||
|
||||
lVar5 = Mission.timer[0].count;
|
||||
z_00 = bodgevar;
|
||||
|
||||
switch (gCurrentMissionNumber)
|
||||
{
|
||||
case 0xb:
|
||||
case 0xd:
|
||||
case 0x14:
|
||||
case 11:
|
||||
case 13:
|
||||
case 20:
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
cVar1 = GetMissionSound('\v');
|
||||
z_00 = cVar1;
|
||||
goto LAB_0005ed9c;
|
||||
cVar1 = GetMissionSound(11);
|
||||
Start3DSoundVolPitch(channel, 5, cVar1, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
bodgevar = 2;
|
||||
}
|
||||
goto LAB_0005e0d0;
|
||||
case 0x15:
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
bodgevar = 4;
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
cVar1 = GetMissionSound('\v');
|
||||
cVar1 = GetMissionSound(11);
|
||||
Start3DSoundVolPitch(channel, 5, cVar1, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
GetMissionSound('\v');
|
||||
bodgevar = 2;
|
||||
return;
|
||||
}
|
||||
goto LAB_0005e0d0;
|
||||
case 0x17:
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
bodgevar = 4;
|
||||
}
|
||||
break;
|
||||
case 23:
|
||||
if (holdall == -1)
|
||||
{
|
||||
if (MissionTargets->data[0] == 2)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
holdall = MissionTargets->data[6];
|
||||
}
|
||||
else
|
||||
{
|
||||
z_00 = 1;
|
||||
do {
|
||||
if (0xf < z_00) {
|
||||
return;
|
||||
}
|
||||
p_Var4 = MissionTargets + z_00;
|
||||
z_00 = z_00 + 1;
|
||||
} while (p_Var4->data[0] != 2);
|
||||
holdall = p_Var4->data[6];
|
||||
if (MissionTargets[i].data[0] == 2)
|
||||
{
|
||||
holdall = MissionTargets[i].data[6];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -795,30 +795,29 @@ void DoMissionSound(void)
|
||||
x = GetFreeChannel();
|
||||
cVar1 = GetMissionSound(20);
|
||||
StartSound(x, 5, cVar1, -0x5dc, 0x1000);
|
||||
SetChannelPosition3(x, (VECTOR*)car_data[z_00].hd.where.t, car_data[z_00].st.n.linearVelocity, -0x5dc, 0x1000 - lVar5 / 0x2ee, 0);
|
||||
SetChannelPosition3(x, (VECTOR*)car_data[z_00].hd.where.t, car_data[z_00].st.n.linearVelocity, -0x5dc, 0x1000 - Mission.timer[0].count / 0x2ee, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x19:
|
||||
case 25:
|
||||
if (bodgevar == 1) {
|
||||
channel = GetFreeChannel();
|
||||
cVar1 = GetMissionSound('\v');
|
||||
cVar1 = GetMissionSound(11);
|
||||
Start3DSoundVolPitch(channel, 5, cVar1, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
holdall = holdall + 1;
|
||||
holdall++;
|
||||
bodgevar = 2;
|
||||
return;
|
||||
}
|
||||
LAB_0005e0d0:
|
||||
if (bodgevar != 3)
|
||||
return;
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
StopChannel(channel);
|
||||
|
||||
bodgevar = 4;
|
||||
bodgevar = 4;
|
||||
}
|
||||
break;
|
||||
case 0x1e:
|
||||
if (bodgevar - 1U < 3)
|
||||
case 30:
|
||||
if ((bodgevar > 0) && (bodgevar < 4))
|
||||
{
|
||||
VECTOR Q[4] = {
|
||||
{0xFFFFD005,0xFFFFFEED,0xCD61B},
|
||||
@ -826,97 +825,80 @@ void DoMissionSound(void)
|
||||
{0xFFFFC7D4,0xFFFFFEEC,0xCD383},
|
||||
};
|
||||
|
||||
z_00 = bodgevar + -1;
|
||||
x = Q[z_00].vx;
|
||||
y_00 = Q[z_00].vy;
|
||||
z_00 = Q[z_00].vz;
|
||||
cVar1 = GetMissionSound('\"');
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, x, y_00, z_00, -1000, 0x1000);
|
||||
bodgevar = bodgevar + 4;
|
||||
VECTOR *P = &Q[bodgevar - 1];
|
||||
|
||||
cVar1 = GetMissionSound(34);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, P->vx, P->vy, P->vz, -1000, 0x1000);
|
||||
|
||||
bodgevar += 4;
|
||||
}
|
||||
z_00 = Mission.timer[0].count;
|
||||
|
||||
if (bodgevar < 4)
|
||||
return;
|
||||
|
||||
if (bodgevar == 6)
|
||||
else if (bodgevar == 5)
|
||||
{
|
||||
LAB_0005e4e8:
|
||||
if ((z_00 / 3000) * 3000 == z_00 + -800)
|
||||
{
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, -0x34aa, -0xfa, 0xcd5e0, -0x5dc,
|
||||
0x1000 - z_00 / 0x2ee);
|
||||
}
|
||||
x = (int)(((long long)Mission.timer[0].count * 0x57619f1) >> 0x20);
|
||||
|
||||
if ((Mission.timer[0].count / 3000) * 3000 != Mission.timer[0].count + -100)
|
||||
return;
|
||||
|
||||
cVar1 = GetMissionSound(29);
|
||||
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, -0x382c, -0x114, 0xcd383, -0x5dc, 0x1000 - ((x >> 4) - (Mission.timer[0].count >> 0x1f)));
|
||||
}
|
||||
else
|
||||
else if (bodgevar < 8) // [A] capture 6 and 7
|
||||
{
|
||||
if (6 < bodgevar)
|
||||
if (bodgevar == 7)
|
||||
{
|
||||
if (bodgevar != 7)
|
||||
return;
|
||||
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -0x514)
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -0x514)
|
||||
{
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, -0x2ffb, -0x113, 0xcd61b, -0x5dc,
|
||||
0x1000 - z_00 / 0x2ee);
|
||||
0x1000 - Mission.timer[0].count / 0x2ee);
|
||||
}
|
||||
goto LAB_0005e4e8;
|
||||
}
|
||||
|
||||
if (bodgevar != 5)
|
||||
return;
|
||||
// bodgevar 6 & 7 (is this a bug?)
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -800)
|
||||
{
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, -0x34aa, -0xfa, 0xcd5e0, -0x5dc,
|
||||
0x1000 - Mission.timer[0].count / 0x2ee);
|
||||
}
|
||||
}
|
||||
x = (int)(((long long)z_00 * 0x57619f1) >> 0x20);
|
||||
|
||||
if ((z_00 / 3000) * 3000 != z_00 + -100)
|
||||
return;
|
||||
|
||||
cVar1 = GetMissionSound(29);
|
||||
y_00 = cVar1;
|
||||
z = 0xcd383;
|
||||
x_00 = -0x382c;
|
||||
y = -0x114;
|
||||
goto LAB_0005e990;
|
||||
|
||||
case 0x20:
|
||||
break;
|
||||
case 32:
|
||||
if (holdall == -1)
|
||||
{
|
||||
holdall = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bodgevar == 1)
|
||||
else
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
cVar1 = GetMissionSound('\v');
|
||||
z_00 = cVar1;
|
||||
goto LAB_0005ed9c;
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
cVar1 = GetMissionSound(11);
|
||||
Start3DSoundVolPitch(channel, 5, cVar1, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
bodgevar = 2;
|
||||
}
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
if (++holdall == 2)
|
||||
SetEnvSndVol(rio_alarm, 3000);
|
||||
|
||||
bodgevar = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (bodgevar != 3)
|
||||
return;
|
||||
|
||||
if (-1 < channel)
|
||||
StopChannel(channel);
|
||||
|
||||
holdall = holdall + 1;
|
||||
if (holdall == 2)
|
||||
{
|
||||
SetEnvSndVol(rio_alarm, 3000);
|
||||
}
|
||||
bodgevar = 4;
|
||||
break;
|
||||
case 0x21:
|
||||
case 33:
|
||||
if (holdall == -1)
|
||||
{
|
||||
StartSound(2, 2, 0, -10000, 0x81);
|
||||
holdall = 0;
|
||||
}
|
||||
break;
|
||||
case 0x23:
|
||||
if (bodgevar - 1U < 3)
|
||||
case 35:
|
||||
if ((bodgevar > 0) && (bodgevar < 4))
|
||||
{
|
||||
VECTOR Q[3] = {
|
||||
{0x31330, 0xFFFFFF4F, 0x5E0E0},
|
||||
@ -924,85 +906,57 @@ void DoMissionSound(void)
|
||||
{0x30AD0, 0xFFFFFF4F, 0x5F050}
|
||||
};
|
||||
|
||||
z_00 = bodgevar + -1;
|
||||
x = Q[z_00].vx;
|
||||
y_00 = Q[z_00].vy;
|
||||
z_00 = Q[z_00].vz;
|
||||
cVar1 = GetMissionSound('\"');
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, x, y_00, z_00, -1000, 0x1000);
|
||||
bodgevar = bodgevar + 4;
|
||||
VECTOR *P = &Q[bodgevar - 1];
|
||||
|
||||
cVar1 = GetMissionSound(34);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, P->vx, P->vy, P->vz, -1000, 0x1000);
|
||||
|
||||
bodgevar += 4;
|
||||
}
|
||||
z_00 = Mission.timer[0].count;
|
||||
|
||||
if (bodgevar < 4)
|
||||
return;
|
||||
|
||||
if (bodgevar == 6)
|
||||
else if (bodgevar == 5)
|
||||
{
|
||||
LAB_0005e894:
|
||||
if ((z_00 / 3000) * 3000 == z_00 + -800)
|
||||
{
|
||||
x = (int)(((long long)Mission.timer[0].count * 0x57619f1) >> 0x20);
|
||||
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -300) {
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, 0x312b0, -0xb1, 0x5f050, -0x5dc,
|
||||
0x1000 - z_00 / 0x2ee);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, 0x31330, -0xb1, 0x5e0e0, -0x5dc, 0x1000 - ((x >> 4) - (Mission.timer[0].count >> 0x1f)));
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (bodgevar < 8) // [A] capture 6 and 7
|
||||
{
|
||||
if (6 < bodgevar)
|
||||
if (bodgevar == 7)
|
||||
{
|
||||
if (bodgevar != 7)
|
||||
return;
|
||||
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -0x514)
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -0x514)
|
||||
{
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, 0x30ad0, -0xb1, 0x5f050, -0x5dc, 0x1000 - z_00 / 0x2ee);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, 0x30ad0, -0xb1, 0x5f050, -0x5dc, 0x1000 - Mission.timer[0].count / 0x2ee);
|
||||
}
|
||||
|
||||
goto LAB_0005e894;
|
||||
}
|
||||
|
||||
if (bodgevar != 5)
|
||||
// bodgevar 6 & 7 (is this a bug?)
|
||||
if ((Mission.timer[0].count / 3000) * 3000 == Mission.timer[0].count + -800)
|
||||
{
|
||||
return;
|
||||
cVar1 = GetMissionSound(20);
|
||||
Start3DSoundVolPitch(-1, 5, cVar1, 0x312b0, -0xb1, 0x5f050, -0x5dc, 0x1000 - Mission.timer[0].count / 0x2ee);
|
||||
}
|
||||
}
|
||||
x = (int)(((long long)z_00 * 0x57619f1) >> 0x20);
|
||||
if ((z_00 / 3000) * 3000 != z_00 + -300) {
|
||||
return;
|
||||
}
|
||||
cVar1 = GetMissionSound(20);
|
||||
y_00 = cVar1;
|
||||
z = 0x5e0e0;
|
||||
x_00 = 0x31330;
|
||||
y = -0xb1;
|
||||
LAB_0005e990:
|
||||
Start3DSoundVolPitch(-1, 5, y_00, x_00, y, z, -0x5dc, 0x1000 - ((x >> 4) - (z_00 >> 0x1f)));
|
||||
break;
|
||||
|
||||
case 0x27:
|
||||
case 39:
|
||||
if (holdall == -1)
|
||||
{
|
||||
z_00 = 0;
|
||||
p_Var4 = MissionTargets;
|
||||
|
||||
while (z_00 < 0x10)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (p_Var4->data[0] == 2)
|
||||
if (MissionTargets[i].data[0] == 2)
|
||||
{
|
||||
if (holdall == -1)
|
||||
if (holdall == -1)
|
||||
{
|
||||
holdall = 0x14;
|
||||
holdall = 20;
|
||||
}
|
||||
else if (holdall == 0x14)
|
||||
else if (holdall == 20)
|
||||
{
|
||||
holdall = p_Var4->data[6];
|
||||
return;
|
||||
holdall = MissionTargets[i].data[6];
|
||||
}
|
||||
}
|
||||
p_Var4 = p_Var4 + 1;
|
||||
z_00 = z_00 + 1;
|
||||
}
|
||||
}
|
||||
else if (player[0].playerCarId == holdall)
|
||||
@ -1098,8 +1052,9 @@ void DoMissionSound(void)
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
break;
|
||||
case 0x34:
|
||||
case 0x35:
|
||||
// Havana sounds
|
||||
case 52:
|
||||
case 53:
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
@ -1113,8 +1068,10 @@ void DoMissionSound(void)
|
||||
|
||||
bodgevar = 4;
|
||||
}
|
||||
case 0x36:
|
||||
case 0x37:
|
||||
break;
|
||||
// Vegas sounds
|
||||
case 54:
|
||||
case 55:
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
@ -1123,35 +1080,33 @@ void DoMissionSound(void)
|
||||
}
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (-1 < channel)
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
bodgevar = 4;
|
||||
}
|
||||
else if (bodgevar == 5)
|
||||
{
|
||||
// Vegas special garage door
|
||||
Start3DSoundVolPitch(-1, 5, 0, -0x26868, -0xfa, 0x9d274, -1000, 0x1000);
|
||||
bodgevar = 6;
|
||||
}
|
||||
// Rio sounds
|
||||
case 56:
|
||||
case 57:
|
||||
if (bodgevar == 1)
|
||||
{
|
||||
channel = GetFreeChannel();
|
||||
z_00 = 0;
|
||||
LAB_0005ed9c:
|
||||
Start3DSoundVolPitch(channel, 5, z_00, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
Start3DSoundVolPitch(channel, 5, 0, pos[0], pos[1], pos[2], -1000, 0x1000);
|
||||
bodgevar = 2;
|
||||
return;
|
||||
}
|
||||
else if (bodgevar == 3)
|
||||
{
|
||||
if (channel > -1)
|
||||
StopChannel(channel);
|
||||
|
||||
if (bodgevar != 3)
|
||||
return;
|
||||
|
||||
if (-1 < channel)
|
||||
StopChannel(channel);
|
||||
|
||||
bodgevar = 4;
|
||||
bodgevar = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -110,6 +110,11 @@ void ToggleSecretCarFun(int direction)
|
||||
FixCarCos(&car_cosmetics[4], 12);
|
||||
}
|
||||
|
||||
void ToggleJerichoMode(int direction)
|
||||
{
|
||||
ActiveCheats.cheat12 ^= 1;
|
||||
}
|
||||
|
||||
extern void LoadSky(void);
|
||||
|
||||
void DebugTimeOfDayDay(int direction)
|
||||
@ -174,6 +179,7 @@ MENU_ITEM DebugOptionsItems[] =
|
||||
{ "Invincible", 3, 2, ToggleInvincible, MENU_QUIT_NONE, NULL},
|
||||
{ "Immunity", 3, 2, ToggleImmune, MENU_QUIT_NONE, NULL },
|
||||
{ "Secret Car Fun", 3, 2, ToggleSecretCarFun, MENU_QUIT_RESTART, NULL },
|
||||
{ "Jericho mode", 3, 2, ToggleJerichoMode, MENU_QUIT_RESTART, NULL },
|
||||
{ "Ghost mode", 3, 2, TogglePlayerGhost, MENU_QUIT_NONE, NULL },
|
||||
{ "Next mission", 1, 2, NULL, MENU_QUIT_NEXTMISSION, NULL },
|
||||
{ NULL, 128u, 0u, NULL, MENU_QUIT_NONE, NULL }
|
||||
|
@ -50,11 +50,23 @@ void CopStand(PEDESTRIAN *pPed);
|
||||
void CivGetIn(PEDESTRIAN *pPed);
|
||||
|
||||
pedFunc fpPedPersonalityFunctions[] = {
|
||||
PedDoNothing, PedUserWalker, PedUserRunner,
|
||||
PedGetInCar, PedGetOutCar,
|
||||
PedDoNothing,
|
||||
PedUserWalker,
|
||||
PedUserRunner,
|
||||
PedGetInCar,
|
||||
PedGetOutCar,
|
||||
PedCarryOutAnimation,
|
||||
CivPedDoNothing, CivPedWalk, CivPedSit, CivPedJump,
|
||||
PedPressButton, TannerSitDown, CopStand, CivGetIn
|
||||
|
||||
CivPedDoNothing,
|
||||
CivPedWalk,
|
||||
CivPedSit,
|
||||
CivPedJump,
|
||||
|
||||
PedPressButton,
|
||||
TannerSitDown,
|
||||
|
||||
CopStand,
|
||||
CivGetIn,
|
||||
};
|
||||
|
||||
VECTOR tannerLookAngle = { 0, 0, 0, 0 };
|
||||
@ -63,7 +75,7 @@ int tannerTurnMax = 16;
|
||||
int tannerTurnStep = 4;
|
||||
|
||||
long force[4] = { 0x9000, 0, 0, 0 };
|
||||
long point[4] = { 0, 0, 0x5A, 0 };
|
||||
long point[4] = { 0, 0, 90, 0 };
|
||||
|
||||
int bKillTanner = 0;
|
||||
|
||||
@ -74,7 +86,8 @@ static int numTannerPeds = 0;
|
||||
static int numCopPeds = 0;
|
||||
int pinginPedAngle = 0;
|
||||
|
||||
PEDESTRIAN pedestrians[28];
|
||||
PEDESTRIAN pedestrians[MAX_PEDESTRIANS];
|
||||
|
||||
PEDESTRIAN *pUsedPeds = NULL; // linked list of pedestrians
|
||||
PEDESTRIAN *pFreePeds = NULL;
|
||||
PEDESTRIAN *pHold = NULL;
|
||||
@ -246,99 +259,145 @@ void ProcessTannerPad(PEDESTRIAN *pPed, ulong pad, char PadSteer, char use_analo
|
||||
int iVar2;
|
||||
int iVar3;
|
||||
int iVar4;
|
||||
_sdPlane *p_Var5;
|
||||
short sVar7;
|
||||
_sdPlane *SurfacePtr;
|
||||
short surface;
|
||||
uint uVar8;
|
||||
VECTOR vec;
|
||||
VECTOR normal;
|
||||
VECTOR out;
|
||||
VECTOR tVec;
|
||||
_sdPlane *SurfacePtr;
|
||||
_sdPlane *plane;
|
||||
|
||||
SurfacePtr = NULL;
|
||||
plane = NULL;
|
||||
tannerPad = pad;
|
||||
|
||||
if (use_analogue)
|
||||
{
|
||||
tannerPad = pad;
|
||||
|
||||
if (PadSteer < 0)
|
||||
tannerPad = pad | 0x8000;
|
||||
else if (PadSteer > 0)
|
||||
tannerPad = tannerPad | 0x2000;
|
||||
if (PadSteer != 0)
|
||||
tannerPad |= (PadSteer < 0) ? 0x8000 : 0x2000;
|
||||
}
|
||||
|
||||
IHaveThePower(); // process Havana easter egg near the entrance cemetery
|
||||
|
||||
vec.vx = pPed->position.vx;
|
||||
vec.vz = pPed->position.vz;
|
||||
vec.vy = -pPed->position.vy;
|
||||
iVar2 = MapHeight(&vec);
|
||||
vec.vz = pPed->position.vz;
|
||||
|
||||
uVar8 = (int)pPed->dir.vy - 0x800U & 0xfff;
|
||||
tVec.vy = vec.vy;
|
||||
tVec.pad = vec.pad;
|
||||
iVar2 = -0x82 - iVar2;
|
||||
bStopTanner = 0;
|
||||
|
||||
tVec.vx = vec.vx + (rcossin_tbl[uVar8 * 2] * 5 >> 9);
|
||||
tVec.vy = vec.vy;
|
||||
tVec.vz = vec.vz + (rcossin_tbl[uVar8 * 2 + 1] * 5 >> 9);
|
||||
iVar3 = MapHeight(&tVec);
|
||||
iVar4 = (-0x82 - iVar3) - iVar2;
|
||||
|
||||
if (iVar4 < 0)
|
||||
iVar4 = iVar2 - (-0x82 - iVar3);
|
||||
bStopTanner = 0;
|
||||
|
||||
if (iVar4 < 1011)
|
||||
int mapheight[2];
|
||||
|
||||
mapheight[0] = -130 - MapHeight(&vec);
|
||||
mapheight[1] = -130 - MapHeight(&tVec);
|
||||
|
||||
int dist = mapheight[1] - mapheight[0];
|
||||
|
||||
if (dist < 0)
|
||||
dist = mapheight[0] - mapheight[1];
|
||||
|
||||
if (dist < 1011)
|
||||
{
|
||||
p_Var5 = sdGetCell(&tVec);
|
||||
sVar7 = -0x20;
|
||||
SurfacePtr = sdGetCell(&tVec);
|
||||
surface = -32;
|
||||
|
||||
if (p_Var5 != NULL)
|
||||
sVar7 = p_Var5->surface;
|
||||
if (SurfacePtr != NULL)
|
||||
{
|
||||
surface = SurfacePtr->surface;
|
||||
|
||||
uVar8 = ((int)((uint)(ushort)p_Var5->b << 0x10) >> 0x12) - 0x800U & 0xfff;
|
||||
iVar3 = uVar8 - 0x800;
|
||||
uVar8 = ((int)((uint)(ushort)SurfacePtr->b << 0x10) >> 0x12) - 2048 & 0xfff;
|
||||
dist = uVar8 - 2048;
|
||||
|
||||
if (iVar3 < 0)
|
||||
iVar3 = 0x800 - uVar8;
|
||||
if (dist < 0)
|
||||
dist = 2048 - uVar8;
|
||||
|
||||
if ((((iVar3 < 0x44d) && (sVar7 != 6)) && (sVar7 != 9)) && (sVar7 != -0x20))
|
||||
goto LAB_0006e104;
|
||||
if (dist < 1101)
|
||||
{
|
||||
switch (surface)
|
||||
{
|
||||
case -32:
|
||||
case 6:
|
||||
case 9:
|
||||
break;
|
||||
default:
|
||||
dist = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bStopTanner = 1;
|
||||
LAB_0006e104:
|
||||
|
||||
if ((pPed->type != PED_ACTION_SIT) && (bStopTanner == 0))
|
||||
pPed->position.vy = iVar2;
|
||||
if (dist != -1)
|
||||
bStopTanner = 1;
|
||||
|
||||
if ((gInGameCutsceneActive == 0 || gCurrentMissionNumber != 0x17) ||
|
||||
((gInGameCutsceneID != 0 || (CameraCnt != 0x1cb || (pPed->pedType == TANNER_MODEL)))))
|
||||
if ((pPed->type != PED_ACTION_SIT) && !bStopTanner)
|
||||
pPed->position.vy = mapheight[0];
|
||||
|
||||
if ((gInGameCutsceneActive == 0 || gCurrentMissionNumber != 23) ||
|
||||
((gInGameCutsceneID != 0 || (CameraCnt != 0x1cb || ((pPed->pedType == TANNER_MODEL) || (ActiveCheats.cheat12 && (pPed->pedType == OTHER_MODEL)))))))
|
||||
{
|
||||
if ((tannerPad & 0x10) != 0)
|
||||
{
|
||||
if (pPed->type != PED_ACTION_GETINCAR && pPed->type != PED_ACTION_GETOUTCAR && gCantDrive == 0)
|
||||
if (gTannerActionNeeded)
|
||||
{
|
||||
DeActivatePlayerPedestrian(pPed);
|
||||
// attempt to push a button
|
||||
switch (pPed->type)
|
||||
{
|
||||
case PED_ACTION_GETINCAR:
|
||||
case PED_ACTION_GETOUTCAR:
|
||||
// do not attempt
|
||||
break;
|
||||
default:
|
||||
// hey, wait -- TANNER!
|
||||
SetupPressButton(pPed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PVar1 = pPed->type;
|
||||
|
||||
if ((tannerPad & 0x10) != 0 && PVar1 != PED_ACTION_GETINCAR && PVar1 != PED_ACTION_GETOUTCAR && PVar1 != PED_ACTION_SIT && FindTannerASeat(pPed) != NULL)
|
||||
else
|
||||
{
|
||||
SetupTannerSitDown(pPed);
|
||||
}
|
||||
}
|
||||
// attempt to get into a car
|
||||
switch (pPed->type)
|
||||
{
|
||||
case PED_ACTION_GETINCAR:
|
||||
case PED_ACTION_GETOUTCAR:
|
||||
// do not attempt
|
||||
break;
|
||||
default:
|
||||
// enter the nearest car if possible
|
||||
if (!gCantDrive)
|
||||
DeActivatePlayerPedestrian(pPed);
|
||||
break;
|
||||
}
|
||||
|
||||
if (gTannerActionNeeded != 0 && (tannerPad & 0x10) != 0 && pPed->type != PED_ACTION_GETINCAR && pPed->type != PED_ACTION_GETOUTCAR)
|
||||
{
|
||||
SetupPressButton(pPed);
|
||||
// attempt to sit down
|
||||
switch (pPed->type)
|
||||
{
|
||||
case PED_ACTION_GETINCAR:
|
||||
case PED_ACTION_GETOUTCAR:
|
||||
case PED_ACTION_SIT:
|
||||
// do not attempt
|
||||
break;
|
||||
default:
|
||||
// sit his ass down
|
||||
if (FindTannerASeat(pPed) != NULL)
|
||||
SetupTannerSitDown(pPed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pPed != NULL)
|
||||
{
|
||||
if (pPed->fpAgitatedState == NULL)
|
||||
(*pPed->fpRestState)(pPed);
|
||||
else
|
||||
if (pPed->fpAgitatedState != NULL)
|
||||
(*pPed->fpAgitatedState)(pPed);
|
||||
else
|
||||
(*pPed->fpRestState)(pPed);
|
||||
|
||||
if (player[0].cameraView == 2 && pPed->type != PED_ACTION_GETINCAR)
|
||||
{
|
||||
@ -355,11 +414,12 @@ LAB_0006e104:
|
||||
oldCamView = player[0].cameraView;
|
||||
TannerCollision(pPed);
|
||||
|
||||
// sloped surfaces in chicago?
|
||||
if (GameLevel == 0)
|
||||
{
|
||||
FindSurfaceD2((VECTOR *)player, &normal, &out, &SurfacePtr);
|
||||
FindSurfaceD2((VECTOR *)player, &normal, &out, &plane);
|
||||
|
||||
if (SurfacePtr->surface != -1 && SurfacePtr->surface < 0x20 && (SurfacePtr->surface & 0x10U) != 0)
|
||||
if (plane->surface != -1 && plane->surface < 0x20 && (plane->surface & 0x10U) != 0)
|
||||
{
|
||||
pPed->position.vx += (normal.vx >> 6);
|
||||
pPed->position.vz += (normal.vz >> 6);
|
||||
@ -375,6 +435,7 @@ LAB_0006e104:
|
||||
|
||||
player[iVar2].pPed = NULL;
|
||||
player[iVar2].playerType = 0;
|
||||
|
||||
DestroyPedestrian(pPed);
|
||||
}
|
||||
}
|
||||
@ -483,7 +544,7 @@ void SetTannerPosition(VECTOR *pVec)
|
||||
pPed = pUsedPeds;
|
||||
while(pPed)
|
||||
{
|
||||
if (pPed->pedType == TANNER_MODEL)
|
||||
if ((pPed->pedType == TANNER_MODEL) || (ActiveCheats.cheat12 && (pPed->pedType == OTHER_MODEL)))
|
||||
{
|
||||
pPed->position.vx = pVec->vx;
|
||||
pPed->position.vy = -pVec->vy;
|
||||
@ -539,48 +600,37 @@ void SetTannerPosition(VECTOR *pVec)
|
||||
void InitPedestrians(void)
|
||||
{
|
||||
short sVar1;
|
||||
PEDESTRIAN *pPVar3;
|
||||
PEDESTRIAN *pPVar5;
|
||||
PEDESTRIAN *pPVar6;
|
||||
|
||||
int loop;
|
||||
|
||||
SEATED_PEDESTRIANS *seatedptr;
|
||||
|
||||
memset(pedestrians, 0, sizeof(pedestrians));
|
||||
DestroyPedestrians();
|
||||
|
||||
loop = 25;
|
||||
pedestrians[0].pNext = &pedestrians[1];
|
||||
PEDESTRIAN *lastPed = &pedestrians[0];
|
||||
|
||||
pPVar5 = pedestrians + 2;
|
||||
pPVar3 = pedestrians;
|
||||
pPVar6 = pedestrians;
|
||||
lastPed->pPrev = NULL;
|
||||
|
||||
do {
|
||||
|
||||
pPVar3->pPrev = pPVar6++;
|
||||
pPVar3->pNext = pPVar5++;
|
||||
for (int loop = 1; loop < MAX_PEDESTRIANS; loop++)
|
||||
{
|
||||
PEDESTRIAN *currPed = &pedestrians[loop];
|
||||
|
||||
pPVar3++;
|
||||
loop--;
|
||||
|
||||
} while (-1 < loop);
|
||||
lastPed->pNext = currPed;
|
||||
currPed->pPrev = lastPed++;
|
||||
}
|
||||
|
||||
lastPed->pNext = NULL;
|
||||
|
||||
pedestrians[27].pNext = NULL;
|
||||
pedestrians[27].pPrev = &pedestrians[26];
|
||||
pUsedPeds = NULL;
|
||||
|
||||
pFreePeds = pedestrians;
|
||||
|
||||
seated_count = 0;
|
||||
|
||||
seatedptr = seated_pedestrian;
|
||||
if (seatedptr != NULL)
|
||||
{
|
||||
sVar1 = seatedptr->rotation;
|
||||
while (sVar1 != 9999)
|
||||
while (seatedptr->rotation != 9999)
|
||||
{
|
||||
seatedptr->index = 0;
|
||||
sVar1 = seatedptr[1].rotation;
|
||||
|
||||
seated_count++;
|
||||
seatedptr++;
|
||||
@ -630,7 +680,7 @@ void DestroyPedestrians(void)
|
||||
{
|
||||
while (pUsedPeds)
|
||||
{
|
||||
if (pUsedPeds->pedType == TANNER_MODEL)
|
||||
if ((pUsedPeds->pedType == TANNER_MODEL) || (ActiveCheats.cheat12 && (pUsedPeds->pedType == OTHER_MODEL)))
|
||||
numTannerPeds--;
|
||||
|
||||
DestroyPedestrian(pUsedPeds);
|
||||
@ -1013,7 +1063,7 @@ int ActivatePlayerPedestrian(_CAR_DATA *pCar, char *padId, int direction, long(*
|
||||
pedptr->frame1 = 0;
|
||||
pedptr->speed = 0;
|
||||
|
||||
if (playerType == 2)
|
||||
if (playerType == OTHER_SPRITE)
|
||||
{
|
||||
if (gCurrentMissionNumber == 9)
|
||||
{
|
||||
@ -1049,7 +1099,7 @@ int ActivatePlayerPedestrian(_CAR_DATA *pCar, char *padId, int direction, long(*
|
||||
bKillTanner = 0;
|
||||
bKilled = 0;
|
||||
|
||||
if (gCurrentMissionNumber == 23 && playerType != 0)
|
||||
if (gCurrentMissionNumber == 23 && playerType != TANNER_MODEL)
|
||||
{
|
||||
pedptr->doing_turn = 16;
|
||||
pedptr->dir.vy = (pedptr->dir.vy - (tannerTurnMax + 16) * tannerTurnStep) + 294;
|
||||
@ -1410,6 +1460,33 @@ LAB_0006f100:
|
||||
|
||||
/* WARNING: Unknown calling convention yet parameter storage is locked */
|
||||
|
||||
int PedVisible(PEDESTRIAN *pPed, int bounding_sphere)
|
||||
{
|
||||
VECTOR *pos = (VECTOR *)&pPed->position;
|
||||
|
||||
if (PositionVisible(pos) && FrustrumCheck(pos, bounding_sphere) != -1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DrawPedestrian(PEDESTRIAN *pPed)
|
||||
{
|
||||
switch (pPed->type)
|
||||
{
|
||||
case PED_ACTION_CIVWALK:
|
||||
case PED_ACTION_CIVRUN:
|
||||
case PED_ACTION_JUMP:
|
||||
case PED_ACTION_CIVSIT:
|
||||
case PED_ACTION_COPSTAND:
|
||||
case PED_ACTION_COPCROUCH:
|
||||
DrawCiv(pPed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return DrawCharacter(pPed);
|
||||
}
|
||||
|
||||
// [D]
|
||||
void DrawAllPedestrians(void)
|
||||
{
|
||||
@ -1421,15 +1498,8 @@ void DrawAllPedestrians(void)
|
||||
pPed = pUsedPeds;
|
||||
while (pPed != NULL)
|
||||
{
|
||||
if ((uint)pPed->pedType - 2 < 2 && // ???
|
||||
PositionVisible((VECTOR *)&pPed->position) != 0 &&
|
||||
FrustrumCheck((VECTOR *)&pPed->position, 60) != -1)
|
||||
{
|
||||
if ((uint)pPed->type - 8 < 6)
|
||||
DrawCiv(pPed);
|
||||
else
|
||||
DrawCharacter(pPed);
|
||||
}
|
||||
if (pPed->pedType > OTHER_MODEL && PedVisible(pPed, 60))
|
||||
DrawPedestrian(pPed);
|
||||
|
||||
pPed = pPed->pNext;
|
||||
}
|
||||
@ -1439,12 +1509,10 @@ void DrawAllPedestrians(void)
|
||||
pPed = pUsedPeds;
|
||||
while (pPed != NULL)
|
||||
{
|
||||
if (pPed->pedType < OTHER_SPRITE &&
|
||||
PositionVisible((VECTOR *)&pPed->position) != 0 &&
|
||||
FrustrumCheck((VECTOR *)&pPed->position, 60) != -1 &&
|
||||
!bKillTanner)
|
||||
if (pPed->pedType < OTHER_SPRITE && PedVisible(pPed, 60))
|
||||
{
|
||||
DrawTanner(pPed);
|
||||
if (!bKillTanner)
|
||||
DrawTanner(pPed);
|
||||
}
|
||||
|
||||
pPed = pPed->pNext;
|
||||
@ -2928,7 +2996,7 @@ void AnimatePed(PEDESTRIAN *pPed)
|
||||
pPed->frame1--;
|
||||
}
|
||||
|
||||
if (pPed->pedType == TANNER_MODEL && pPed->type < PED_ACTION_BACK)
|
||||
if ((pPed->pedType == TANNER_MODEL || (ActiveCheats.cheat12 && (pPed->pedType == OTHER_MODEL))) && pPed->type < PED_ACTION_BACK)
|
||||
{
|
||||
iVar5 = PedSurfaceType((VECTOR *)&pPed->position);
|
||||
|
||||
@ -5057,54 +5125,42 @@ int basic_car_interest;
|
||||
// [D]
|
||||
void CalculatePedestrianInterest(PEDESTRIAN *pPed)
|
||||
{
|
||||
int y;
|
||||
int iVar1;
|
||||
long lVar2;
|
||||
int x;
|
||||
uint uVar3;
|
||||
int iVar4;
|
||||
int interest;
|
||||
VECTOR v1;
|
||||
VECTOR v2;
|
||||
|
||||
iVar4 = (int)player[0].playerCarId;
|
||||
int carId = (int)player[0].playerCarId;
|
||||
|
||||
if (iVar4 == -1) // [A] ASan bug fix
|
||||
if (carId == -1) // [A] ASan bug fix
|
||||
return;
|
||||
|
||||
basic_car_interest = (car_data[iVar4].hd.wheel_speed >> 10) + (uint)car_data[iVar4].totalDamage;
|
||||
x = (pPed->position).vx - car_data[iVar4].hd.where.t[0];
|
||||
y = (pPed->position).vz - car_data[iVar4].hd.where.t[2];
|
||||
_CAR_DATA *pCar = &car_data[carId];
|
||||
|
||||
iVar4 = x;
|
||||
basic_car_interest = (pCar->hd.wheel_speed >> 10) + (int)pCar->totalDamage;
|
||||
|
||||
if (x < 0)
|
||||
iVar4 = -x;
|
||||
v1.vx = pPed->position.vx - pCar->hd.where.t[0];
|
||||
v1.vy = pPed->position.vz - pCar->hd.where.t[2];
|
||||
|
||||
iVar1 = y;
|
||||
if (y < 0)
|
||||
iVar1 = -y;
|
||||
v2.vx = (v1.vx < 0) ? -v1.vx : v1.vx;
|
||||
v2.vy = (v1.vy < 0) ? -v1.vy : v1.vy;
|
||||
|
||||
if (iVar4 + iVar1 < 0x1771)
|
||||
interest = (int)(6000 - (iVar4 + iVar1));
|
||||
else
|
||||
interest = 0;
|
||||
int interest = basic_car_interest;
|
||||
int dist = (int)(v2.vx + v2.vy);
|
||||
|
||||
if (dist < 6001)
|
||||
interest += (int)(6000 - dist);
|
||||
|
||||
if (pPed->type == PED_ACTION_JUMP)
|
||||
{
|
||||
lVar2 = ratan2(y, x);
|
||||
pPed->head_rot = pPed->dir.vy + lVar2 + 0xc00U & 0xfff;
|
||||
pPed->head_rot = pPed->dir.vy + (short)(ratan2(v1.vy, v1.vx) + 0xc00 & 0xfff);
|
||||
}
|
||||
else if (2999 < (interest + basic_car_interest))
|
||||
else if (interest > 2999)
|
||||
{
|
||||
pPed->interest = (short)(interest + basic_car_interest);
|
||||
lVar2 = ratan2(y, x);
|
||||
uVar3 = (uint)pPed->dir.vy + lVar2 + 0xc00 & 0xfff;
|
||||
pPed->head_rot = (short)uVar3;
|
||||
|
||||
if (0x8fe < uVar3 - 0x381)
|
||||
return;
|
||||
|
||||
pPed->interest = (short)interest;
|
||||
pPed->head_rot = pPed->dir.vy + (short)(ratan2(v1.vy, v1.vx) + 0xc00 & 0xfff);
|
||||
}
|
||||
pPed->head_rot = 0;
|
||||
|
||||
if ((pPed->head_rot - 897) < 2302)
|
||||
pPed->head_rot = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef PEDEST_H
|
||||
#define PEDEST_H
|
||||
|
||||
#define MAX_PEDESTRIANS 28
|
||||
|
||||
extern MODEL* pmTannerModels[17];;
|
||||
extern MODEL* pmJerichoModels[6];
|
||||
|
||||
|
@ -33,17 +33,17 @@ SXYPAIR tpagepos[20] =
|
||||
};
|
||||
|
||||
char specTpages[4][12] = {
|
||||
{ 0x36, 0x37, 0x42, 0x43, 0x38, 0x39, 0x44, 0x45, 0x3D, 0x40, 0x3D, 0x40},
|
||||
{ 0x26, 0x27, 0x26, 0x27, 0x2A, 0x2B, 0x2C, 0x2D, 0x30, 0x31, 0x30, 0x31},
|
||||
{ 0x12, 0x13, 0x41, 0x42, 0x43, 0x44, 0xB, 0xC, 0x3F, 0x40, 0x3F, 0x40},
|
||||
{ 0x42, 0x43, 0x4D, 0x4E, 0x49, 0x4A, 0x4B, 0x4C, 0x45, 0x46, 0x47, 0x48}
|
||||
{ 54, 55, 66, 67, 56, 57, 68, 69, 61, 64, 61, 64 },
|
||||
{ 38, 39, 38, 39, 42, 43, 44, 45, 48, 49, 48, 49 },
|
||||
{ 18, 19, 65, 66, 67, 68, 11, 12, 63, 64, 63, 64 },
|
||||
{ 66, 67, 77, 78, 73, 74, 75, 76, 69, 70, 71, 72 }
|
||||
};
|
||||
|
||||
char carTpages[4][8] = {
|
||||
{1, 0x41, 0x3E, 0x32, 0x3F, 0x3A, 0x36, 0x37},
|
||||
{0xA, 0x23, 0x14, 0x25, 0x33, 0x24, 0x26, 0x27},
|
||||
{0x29, 0x36, 0x3E, 0x11, 0x20, 0x3B, 0x12, 0},
|
||||
{0x37, 0x39, 0x44, 0x3A, 0x3C, 0x3B, 0x42, 0x43}
|
||||
{ 01, 65, 62, 50, 63, 58, 54, 55 },
|
||||
{ 10, 35, 20, 37, 51, 36, 38, 39 },
|
||||
{ 41, 54, 62, 17, 32, 59, 18, 00 },
|
||||
{ 55, 57, 68, 58, 60, 59, 66, 67 }
|
||||
};
|
||||
|
||||
char *palette_lump;
|
||||
@ -136,30 +136,37 @@ void IncrementClutNum(RECT16 *clut)
|
||||
/* end block 3 */
|
||||
// End Line: 256
|
||||
|
||||
// [D]
|
||||
// [D] [T]
|
||||
void IncrementTPageNum(RECT16 *tpage)
|
||||
{
|
||||
int i;
|
||||
i = 1;
|
||||
int i = 0;
|
||||
|
||||
while (true)
|
||||
while (++i)
|
||||
{
|
||||
if (tpage->x == tpagepos[i-1].x && // proper tpage position
|
||||
tpage->y == tpagepos[i-1].y ||
|
||||
tpagepos[i].x == -1) // or out of tpages?
|
||||
// proper tpage position?
|
||||
if ((tpage->x == tpagepos[i - 1].x) && (tpage->y == tpagepos[i - 1].y))
|
||||
{
|
||||
if (tpagepos[i].x == -1)
|
||||
{
|
||||
// out of tpages
|
||||
NoTextureMemory = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
// increment the tpage
|
||||
tpage->x = tpagepos[i].x;
|
||||
tpage->y = tpagepos[i].y;
|
||||
}
|
||||
|
||||
// bust 'outta here, real fly
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
tpage->x = tpagepos[i].x;
|
||||
tpage->y = tpagepos[i].y;
|
||||
|
||||
if (tpagepos[i].x == -1)
|
||||
{
|
||||
NoTextureMemory = 100;
|
||||
|
||||
tpage->x = tpagepos[i-1].x;
|
||||
tpage->y = tpagepos[i-1].y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// last tpage?
|
||||
if (tpagepos[i].x == -1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,46 +191,30 @@ void IncrementTPageNum(RECT16 *tpage)
|
||||
/* end block 2 */
|
||||
// End Line: 1244
|
||||
|
||||
// [D]
|
||||
// [D] [T]
|
||||
// Originally ASM function
|
||||
char* unpackTexture(char *dest, char *src)
|
||||
char * unpackTexture(char *dest, char *src)
|
||||
{
|
||||
bool bVar1;
|
||||
char cVar2;
|
||||
char *pcVar3;
|
||||
char *pcVar4;
|
||||
uint uVar5;
|
||||
char *ptr = dest + 0x7fff;
|
||||
|
||||
pcVar4 = dest + 0x7fff;
|
||||
do {
|
||||
uVar5 = (*src);
|
||||
pcVar3 = src + 1;
|
||||
cVar2 = *pcVar3;
|
||||
if ((uVar5 & 0x80) == 0) {
|
||||
while (true) {
|
||||
pcVar3 = pcVar3 + 1;
|
||||
*pcVar4 = cVar2;
|
||||
pcVar4 = pcVar4 + -1;
|
||||
bVar1 = uVar5 == 0;
|
||||
uVar5 = uVar5 - 1;
|
||||
if (bVar1) break;
|
||||
cVar2 = *pcVar3;
|
||||
}
|
||||
char pix = *src++;
|
||||
|
||||
if ((pix & 0x80) != 0)
|
||||
{
|
||||
char p = *src++;
|
||||
|
||||
do (*ptr-- = p);
|
||||
while (pix++ <= 0);
|
||||
}
|
||||
else {
|
||||
pcVar3 = src + 2;
|
||||
*pcVar4 = cVar2;
|
||||
pcVar4 = pcVar4 + -1;
|
||||
do {
|
||||
*pcVar4 = cVar2;
|
||||
pcVar4 = pcVar4 + -1;
|
||||
bVar1 = uVar5 != 0;
|
||||
uVar5 = uVar5 + 1;
|
||||
} while (bVar1);
|
||||
else
|
||||
{
|
||||
do (*ptr-- = *src++);
|
||||
while (pix-- != 0);
|
||||
}
|
||||
src = pcVar3;
|
||||
} while (dest <= pcVar4);
|
||||
return pcVar3;
|
||||
} while (ptr >= dest);
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
// [D] [A]
|
||||
@ -398,58 +389,31 @@ int Find_TexID(MODEL *model, int t_id)
|
||||
/* end block 4 */
|
||||
// End Line: 1491
|
||||
|
||||
//[D]
|
||||
// [D] [T]
|
||||
TEXINF * GetTEXINFName(char *name, int *tpagenum, int *texturenum)
|
||||
{
|
||||
char *pcVar1;
|
||||
int iVar2;
|
||||
TEXINF *pTVar3;
|
||||
int iVar4;
|
||||
int iVar5;
|
||||
TEXINF *pTVar6;
|
||||
int iVar7;
|
||||
int *piVar8;
|
||||
TEXINF **ppTVar9;
|
||||
char *nametable = texturename_buffer;
|
||||
|
||||
pcVar1 = texturename_buffer;
|
||||
iVar7 = 0;
|
||||
pTVar6 = NULL;
|
||||
|
||||
if (0 < tpage_amount)
|
||||
for (int i = 0; i < tpage_amount; i++)
|
||||
{
|
||||
ppTVar9 = tpage_ids;
|
||||
piVar8 = tpage_texamts;
|
||||
int texamt = tpage_texamts[i];
|
||||
TEXINF *texinf = tpage_ids[i];
|
||||
|
||||
do {
|
||||
iVar5 = *piVar8;
|
||||
pTVar6 = *ppTVar9;
|
||||
iVar4 = 0;
|
||||
pTVar3 = pTVar6;
|
||||
|
||||
if (0 < iVar5)
|
||||
for (int j = 0; j < texamt; j++)
|
||||
{
|
||||
if (!strcmp(nametable + texinf->nameoffset, name))
|
||||
{
|
||||
do {
|
||||
iVar2 = strcmp(pcVar1 + pTVar3->nameoffset, name);
|
||||
*tpagenum = i;
|
||||
*texturenum = j;
|
||||
|
||||
if (iVar2 == 0)
|
||||
{
|
||||
*tpagenum = iVar7;
|
||||
*texturenum = iVar4;
|
||||
return pTVar3;
|
||||
}
|
||||
|
||||
iVar4 = iVar4 + 1;
|
||||
pTVar3 = pTVar3 + 1;
|
||||
} while (iVar4 < iVar5);
|
||||
return texinf;
|
||||
}
|
||||
|
||||
ppTVar9 = ppTVar9 + 1;
|
||||
iVar7 = iVar7 + 1;
|
||||
piVar8 = piVar8 + 1;
|
||||
|
||||
} while (iVar7 < tpage_amount);
|
||||
texinf++;
|
||||
}
|
||||
}
|
||||
return pTVar6;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -627,58 +591,20 @@ extern char g_CurrentLevelFileName[64];
|
||||
// [D]
|
||||
void LoadPermanentTPages(int *sector)
|
||||
{
|
||||
int page1;
|
||||
int page2;
|
||||
|
||||
bool bVar3;
|
||||
short sVar5;
|
||||
short sVar6;
|
||||
short sVar7;
|
||||
short sVar8;
|
||||
u_short uVar9;
|
||||
int nsectors;
|
||||
int iVar10;
|
||||
unsigned char *puVar11;
|
||||
int *addr;
|
||||
int *piVar12;
|
||||
int iVar13;
|
||||
ushort *psVar14;
|
||||
u_short *puVar15;
|
||||
int tpageId;
|
||||
DVECTOR *pDVar16;
|
||||
int nsectors_00;
|
||||
int iVar17;
|
||||
uint uVar18;
|
||||
char *tpageaddress;
|
||||
DVECTOR *pDVar19;
|
||||
char *tpagebuffer;
|
||||
|
||||
// init tpage and cluts
|
||||
psVar14 = texture_pages;
|
||||
nsectors_00 = 127;
|
||||
MaxSpecCluts = 0;
|
||||
do {
|
||||
*psVar14 = GetTPage(0, 0, 960, 0);
|
||||
nsectors_00--;
|
||||
psVar14++;
|
||||
} while (-1 < nsectors_00);
|
||||
|
||||
nsectors_00 = 0;
|
||||
iVar17 = 1;
|
||||
for (int tloop = 0; tloop < 128; tloop++)
|
||||
texture_pages[tloop] = GetTPage(0, 0, 960, 0);
|
||||
|
||||
do {
|
||||
puVar15 = texture_cluts[nsectors_00];
|
||||
|
||||
nsectors_00 = 31;
|
||||
do {
|
||||
*puVar15 = GetClut(960, 16);
|
||||
nsectors_00--;
|
||||
puVar15++;
|
||||
} while (-1 < nsectors_00);
|
||||
|
||||
bVar3 = iVar17 < 128;
|
||||
nsectors_00 = iVar17;
|
||||
iVar17++;
|
||||
} while (bVar3);
|
||||
for (int tloop = 0; tloop < 128; tloop++)
|
||||
{
|
||||
for (int tset = 0; tset < 32; tset++)
|
||||
texture_cluts[tloop][tset] = GetClut(960, 16);
|
||||
}
|
||||
|
||||
slotsused = 0;
|
||||
memset(tpageloaded, 0, sizeof(tpageloaded));
|
||||
@ -688,9 +614,6 @@ void LoadPermanentTPages(int *sector)
|
||||
clutpos.w = 16;
|
||||
clutpos.h = 1;
|
||||
|
||||
tpage.w = 64;
|
||||
tpage.h = 256;
|
||||
|
||||
mapclutpos.x = 960;
|
||||
mapclutpos.y = 256;
|
||||
mapclutpos.w = 16;
|
||||
@ -698,170 +621,130 @@ void LoadPermanentTPages(int *sector)
|
||||
|
||||
tpage.x = tpagepos[0].x;
|
||||
tpage.y = tpagepos[0].y;
|
||||
nsectors_00 = 0;
|
||||
tpage.w = 64;
|
||||
tpage.h = 256;
|
||||
|
||||
IncrementClutNum(&clutpos);
|
||||
fontclutpos.x = clutpos.x;
|
||||
fontclutpos.y = clutpos.y;
|
||||
fontclutpos.w = clutpos.w;
|
||||
fontclutpos.h = clutpos.h;
|
||||
|
||||
fontclutpos = clutpos;
|
||||
|
||||
IncrementClutNum(&clutpos);
|
||||
ProcessPalletLump(palette_lump, 0);
|
||||
|
||||
load_civ_palettes(&clutpos);
|
||||
|
||||
tpageaddress = mallocptr;
|
||||
if (0 < nperms)
|
||||
{
|
||||
XYPAIR* perm = permlist;
|
||||
iVar17 = nperms;
|
||||
tpagebuffer = mallocptr;
|
||||
nsectors = 0;
|
||||
|
||||
do {
|
||||
nsectors_00 += (perm->y + 2047) / CDSECTOR_SIZE;
|
||||
iVar17--;
|
||||
perm++;
|
||||
} while (iVar17 != 0);
|
||||
}
|
||||
for (int i = 0; i < nperms; i++)
|
||||
nsectors += (permlist[i].y + 2047) / CDSECTOR_SIZE;
|
||||
|
||||
#ifdef PSX
|
||||
loadsectors(tpageaddress, *sector, nsectors_00);
|
||||
loadsectors(tpagebuffer, *sector, nsectors_00);
|
||||
#else
|
||||
loadsectorsPC(g_CurrentLevelFileName, tpageaddress, *sector, nsectors_00);
|
||||
loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors);
|
||||
#endif // PSX
|
||||
|
||||
*sector += nsectors_00;
|
||||
*sector += nsectors;
|
||||
|
||||
nsectors_00 = 0;
|
||||
if (0 < nperms)
|
||||
for (int i = 0; i < nperms; i++)
|
||||
{
|
||||
do {
|
||||
nsectors = nsectors_00 + 1;
|
||||
iVar17 = permlist[nsectors_00].y;
|
||||
nsectors_00 = permlist[nsectors_00].x;
|
||||
int tp = permlist[i].x;
|
||||
|
||||
update_slotinfo(nsectors_00, slotsused, &tpage);
|
||||
update_slotinfo(tp, slotsused, &tpage);
|
||||
|
||||
LoadTPageAndCluts(&tpage, &clutpos, nsectors_00, tpageaddress);
|
||||
slotsused++;
|
||||
LoadTPageAndCluts(&tpage, &clutpos, tp, tpagebuffer);
|
||||
slotsused++;
|
||||
|
||||
tpageaddress += (iVar17 + 0x7ffU & 0xfffff800);
|
||||
nsectors_00 = nsectors;
|
||||
} while (nsectors < nperms);
|
||||
tpagebuffer += (permlist[i].y + 2047) & -CDSECTOR_SIZE;
|
||||
}
|
||||
|
||||
addr = (int *)mallocptr;
|
||||
|
||||
tpagebuffer = mallocptr;
|
||||
|
||||
slot_clutpos[slotsused].vx = clutpos.x;
|
||||
slot_clutpos[slotsused].vy = clutpos.y;
|
||||
|
||||
iVar13 = (MissionHeader->residentModels[4] - 8) * 2; // int specmodel
|
||||
int specmodel = (MissionHeader->residentModels[4] - 8) * 2;
|
||||
specialSlot = (short)slotsused;
|
||||
|
||||
page1 = specTpages[GameLevel][iVar13];
|
||||
page2 = specTpages[GameLevel][iVar13 + 1];
|
||||
int page1 = specTpages[GameLevel][specmodel];
|
||||
int page2 = specTpages[GameLevel][specmodel + 1];
|
||||
|
||||
carTpages[GameLevel][6] = page1;
|
||||
carTpages[GameLevel][7] = page2;
|
||||
|
||||
if (nspecpages != 0)
|
||||
{
|
||||
iVar13 = 0;
|
||||
nsectors_00 = 0;
|
||||
int temp = 0;
|
||||
int clutsloaded = 0;
|
||||
|
||||
nsectors = 0;
|
||||
|
||||
iVar17 = nspecpages;
|
||||
|
||||
if (0 < iVar17)
|
||||
{
|
||||
XYPAIR* spec = speclist;
|
||||
do {
|
||||
nsectors += ((spec->y + 0x7ff) / 2048);
|
||||
iVar17--;
|
||||
spec++;
|
||||
} while (iVar17 != 0);
|
||||
}
|
||||
for (int i = 0; i < nspecpages; i++)
|
||||
nsectors += (speclist[i].y + 2047) / CDSECTOR_SIZE;
|
||||
|
||||
#ifdef PSX
|
||||
loadsectors((char *)addr, *sector, nsectors);
|
||||
loadsectors(tpagebuffer, *sector, nsectors);
|
||||
#else
|
||||
loadsectorsPC(g_CurrentLevelFileName, (char *)addr, *sector, nsectors);
|
||||
loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors);
|
||||
#endif // PSX
|
||||
|
||||
|
||||
*sector += nsectors;
|
||||
uVar18 = 0;
|
||||
|
||||
if (0 < nspecpages)
|
||||
|
||||
for (int i = 0; i < nspecpages; i++)
|
||||
{
|
||||
do {
|
||||
iVar13 += *addr;
|
||||
int npalettes = *(int *)tpagebuffer;
|
||||
|
||||
iVar17 = speclist[uVar18].y; // must be size
|
||||
tpageId = speclist[uVar18].x;
|
||||
temp += npalettes;
|
||||
|
||||
if ((uVar18 & 1) != 0)
|
||||
{
|
||||
if (iVar13 > MaxSpecCluts)
|
||||
MaxSpecCluts = iVar13;
|
||||
if ((i & 1) != 0)
|
||||
{
|
||||
if (temp > MaxSpecCluts)
|
||||
MaxSpecCluts = temp;
|
||||
|
||||
iVar13 = 0;
|
||||
}
|
||||
temp = 0;
|
||||
}
|
||||
|
||||
// find a special car TPAGEs
|
||||
if (page1 == tpageId || page2 == tpageId)
|
||||
{
|
||||
update_slotinfo(tpageId, slotsused, &tpage);
|
||||
LoadTPageAndCluts(&tpage, &clutpos, tpageId, (char *)addr);
|
||||
int tp = speclist[i].x;
|
||||
|
||||
nsectors_00 += *addr;
|
||||
slotsused++;
|
||||
}
|
||||
// find a special car TPAGEs
|
||||
if (page1 == tp || page2 == tp)
|
||||
{
|
||||
update_slotinfo(tp, slotsused, &tpage);
|
||||
LoadTPageAndCluts(&tpage, &clutpos, tp, tpagebuffer);
|
||||
|
||||
uVar18++;
|
||||
addr = (int *)((int)addr + (iVar17 + 0x7ffU & 0xfffff800)); // [A] don't touch this sphaget for now
|
||||
clutsloaded += npalettes;
|
||||
slotsused++;
|
||||
}
|
||||
|
||||
} while (uVar18 < nspecpages);
|
||||
tpagebuffer += (speclist[i].y + 2047) & -CDSECTOR_SIZE;
|
||||
}
|
||||
|
||||
if (nsectors_00 < MaxSpecCluts)
|
||||
while (clutsloaded < MaxSpecCluts)
|
||||
{
|
||||
do {
|
||||
nsectors_00++;
|
||||
IncrementClutNum(&clutpos);
|
||||
} while (nsectors_00 < MaxSpecCluts);
|
||||
IncrementClutNum(&clutpos);
|
||||
clutsloaded++;
|
||||
}
|
||||
}
|
||||
|
||||
if (clutpos.x != 960)
|
||||
{
|
||||
clutpos.y++;
|
||||
clutpos.x = 960;
|
||||
clutpos.y++;
|
||||
}
|
||||
|
||||
if (slotsused < 19)
|
||||
for (int i = slotsused; i < 19; i++)
|
||||
{
|
||||
pDVar19 = &slot_tpagepos[slotsused];
|
||||
pDVar16 = &slot_clutpos[slotsused];
|
||||
tpageslots[i] = 0xFF;
|
||||
|
||||
nsectors_00 = slotsused;
|
||||
slot_clutpos[i].vx = clutpos.x;
|
||||
slot_clutpos[i].vy = clutpos.y;
|
||||
|
||||
do {
|
||||
tpageslots[nsectors_00] = 0xFF;
|
||||
slot_tpagepos[i].vx = tpage.x;
|
||||
slot_tpagepos[i].vy = tpage.y;
|
||||
|
||||
pDVar16->vx = clutpos.x;
|
||||
pDVar16->vy = clutpos.y;
|
||||
pDVar19->vx = tpage.x;
|
||||
pDVar19->vy = tpage.y;
|
||||
|
||||
IncrementTPageNum(&tpage);
|
||||
clutpos.y += 8;
|
||||
|
||||
pDVar19++;
|
||||
pDVar16++;
|
||||
|
||||
nsectors_00++;
|
||||
} while (nsectors_00 < 19);
|
||||
IncrementTPageNum(&tpage);
|
||||
clutpos.y += 8;
|
||||
}
|
||||
|
||||
//Emulator_SaveVRAM("VRAM_CLUTS_TPAGES.TGA", 0, 0, VRAM_WIDTH, VRAM_HEIGHT, TRUE);
|
||||
@ -949,68 +832,36 @@ void ReloadIcons(void)
|
||||
|
||||
int environmenttpage = 0;
|
||||
|
||||
// [D]
|
||||
// [D] [T]
|
||||
void GetTextureDetails(char *name, TEXTURE_DETAILS *info)
|
||||
{
|
||||
ushort uVar1;
|
||||
char *pcVar2;
|
||||
int iVar3;
|
||||
TEXINF *pTVar4;
|
||||
TEXINF **ppTVar5;
|
||||
int iVar6;
|
||||
int iVar7;
|
||||
int iVar8;
|
||||
unsigned short *psVar9;
|
||||
int *piVar10;
|
||||
char *nametable = texturename_buffer;
|
||||
|
||||
pcVar2 = texturename_buffer;
|
||||
iVar7 = 0;
|
||||
|
||||
if (0 < tpage_amount)
|
||||
for (int i = 0; i < tpage_amount; i++)
|
||||
{
|
||||
ppTVar5 = tpage_ids;
|
||||
piVar10 = tpage_texamts;
|
||||
psVar9 = texture_pages;
|
||||
int texamt = tpage_texamts[i];
|
||||
TEXINF *texinf = tpage_ids[i];
|
||||
|
||||
do {
|
||||
iVar8 = *piVar10;
|
||||
pTVar4 = *ppTVar5;
|
||||
iVar6 = 0;
|
||||
|
||||
if (0 < iVar8)
|
||||
for (int j = 0; j < texamt; j++)
|
||||
{
|
||||
if (!strcmp(nametable + texinf->nameoffset, name))
|
||||
{
|
||||
do {
|
||||
iVar3 = strcmp(pcVar2 + pTVar4->nameoffset, name);
|
||||
if (!texture_is_icon || (i == environmenttpage))
|
||||
{
|
||||
info->tpageid = texture_pages[i];
|
||||
info->clutid = texture_cluts[i][j];
|
||||
info->texture_number = (char)j;
|
||||
info->texture_page = (char)i;
|
||||
|
||||
if ((iVar3 == 0) && ((texture_is_icon == 0 || (iVar7 == environmenttpage))))
|
||||
{
|
||||
info->tpageid = *psVar9;
|
||||
uVar1 = texture_cluts[iVar7][iVar6];
|
||||
info->texture_number = (char)iVar6;
|
||||
info->texture_page = (char)iVar7;
|
||||
info->clutid = uVar1;
|
||||
(info->coords).u0 = pTVar4->x;
|
||||
(info->coords).v0 = pTVar4->y;
|
||||
(info->coords).u1 = pTVar4->x + pTVar4->width + -1;
|
||||
(info->coords).v1 = pTVar4->y;
|
||||
(info->coords).u2 = pTVar4->x;
|
||||
(info->coords).v2 = pTVar4->y + pTVar4->height + -1;
|
||||
(info->coords).u3 = pTVar4->x + pTVar4->width + -1;
|
||||
(info->coords).v3 = pTVar4->y + pTVar4->height + -1;
|
||||
return;
|
||||
}
|
||||
setUVWH(&info->coords, texinf->x, texinf->y, texinf->width - 1, texinf->height - 1);
|
||||
|
||||
iVar6 = iVar6 + 1;
|
||||
pTVar4 = pTVar4 + 1;
|
||||
} while (iVar6 < iVar8);
|
||||
// bust 'outta here, real fly
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ppTVar5 = ppTVar5 + 1;
|
||||
piVar10 = piVar10 + 1;
|
||||
iVar7 = iVar7 + 1;
|
||||
psVar9++;
|
||||
|
||||
} while (iVar7 < tpage_amount);
|
||||
texinf++;
|
||||
}
|
||||
}
|
||||
|
||||
texture_is_icon = 0;
|
||||
|
@ -19102,9 +19102,13 @@ struct ACTIVE_CHEATS // hashcode: 0x2127EFE8 (dec: 556265448)
|
||||
unsigned char cheat9 : 1; // size=1, offset=8
|
||||
unsigned char cheat10 : 1; // size=1, offset=9
|
||||
unsigned char cheat11 : 1; // size=1, offset=10
|
||||
unsigned char reserved1 : 5; // size=5, offset=11
|
||||
unsigned char reserved2; // size=0, offset=2
|
||||
unsigned char reserved3; // size=0, offset=3
|
||||
unsigned char cheat12 : 1; // size=1, offset=11
|
||||
unsigned char cheat13 : 1; // size=1, offset=12
|
||||
unsigned char cheat14 : 1; // size=1, offset=13
|
||||
unsigned char cheat15 : 1; // size=1, offset=14
|
||||
unsigned char cheat16 : 1; // size=1, offset=15
|
||||
unsigned char reserved1; // size=0, offset=2
|
||||
unsigned char reserved2; // size=0, offset=3
|
||||
};
|
||||
|
||||
struct STREAM_SOURCE // hashcode: 0x81E93B6E (dec: -2115421330)
|
||||
|
Loading…
Reference in New Issue
Block a user