Merge pull request #1 from OpenDriver2/develop-SoapyMan

Develop soapy man
This commit is contained in:
VinnyVynce 2021-01-16 19:27:09 -05:00 committed by GitHub
commit deba1190f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1126 additions and 1722 deletions

View File

@ -607,7 +607,12 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
model = modelpointers[cop->type]; model = modelpointers[cop->type];
player_id = GetPlayerId(cp); player_id = GetPlayerId(cp);
cd[1].isCameraOrTanner = (cp->controlType == CONTROL_TYPE_TANNERCOLLIDER || cp->controlType == CONTROL_TYPE_CAMERACOLLIDER); cd[0].isCameraOrTanner = (cp->controlType == CONTROL_TYPE_TANNERCOLLIDER || cp->controlType == CONTROL_TYPE_CAMERACOLLIDER);
if (cp->controlType == CONTROL_TYPE_TANNERCOLLIDER)
cd[0].isCameraOrTanner += 2;
cd[1].isCameraOrTanner = (flags & CollisionCheckFlag_MightBeABarrier) == 0;
boxDiffY = cp->hd.oBox.location.vy + building->pos.vy; boxDiffY = cp->hd.oBox.location.vy + building->pos.vy;
boxDiffY = ABS(boxDiffY); boxDiffY = ABS(boxDiffY);
@ -838,7 +843,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
pointVel[1] = FIXEDH(cp->st.n.angularVelocity[2] * lever[0] - cp->st.n.angularVelocity[0] * lever[2]) + cp->st.n.linearVelocity[1]; pointVel[1] = FIXEDH(cp->st.n.angularVelocity[2] * lever[0] - cp->st.n.angularVelocity[0] * lever[2]) + cp->st.n.linearVelocity[1];
pointVel[2] = FIXEDH(cp->st.n.angularVelocity[0] * lever[1] - cp->st.n.angularVelocity[1] * lever[0]) + cp->st.n.linearVelocity[2]; pointVel[2] = FIXEDH(cp->st.n.angularVelocity[0] * lever[1] - cp->st.n.angularVelocity[1] * lever[0]) + cp->st.n.linearVelocity[2];
if (flags & 0x2) // [A] Vegas train velocity - added here if (flags & CollisionCheckFlag_IsVegasMovingTrain) // [A] Vegas train velocity - added here
{ {
pointVel[2] += 700000; pointVel[2] += 700000;
} }

View File

@ -1,6 +1,12 @@
#ifndef BCOLLIDE_H #ifndef BCOLLIDE_H
#define BCOLLIDE_H #define BCOLLIDE_H
enum CollisionCheckFlags
{
CollisionCheckFlag_MightBeABarrier = 0x1,
CollisionCheckFlag_IsVegasMovingTrain = 0x2,
};
extern int bcollided2d(CDATA2D *body, int* boxOverlap = NULL); // 0x0001C51C extern int bcollided2d(CDATA2D *body, int* boxOverlap = NULL); // 0x0001C51C
extern void bFindCollisionPoint(CDATA2D *body, CRET2D *collisionResult); // 0x0001C8C0 extern void bFindCollisionPoint(CDATA2D *body, CRET2D *collisionResult); // 0x0001C8C0

View File

@ -1776,7 +1776,7 @@ int CreateCivCarWotDrivesABitThenStops(int direction, LONGVECTOR4* startPos, LON
carCnt++; carCnt++;
slot++; slot++;
} while (carCnt < &car_data[MAX_TRAFFIC_CARS]); } while (carCnt < &car_data[MAX_CARS]);
if (pNewCar == NULL) if (pNewCar == NULL)
return -1; return -1;
@ -1869,7 +1869,7 @@ int CreateStationaryCivCar(int direction, long orientX, long orientZ, LONGVECTOR
carCnt++; carCnt++;
slot++; slot++;
} while (carCnt < &car_data[MAX_TRAFFIC_CARS]); } while (carCnt < &car_data[MAX_CARS]);
} }
if (newCar) if (newCar)
@ -2086,7 +2086,7 @@ int PingInCivCar(int minPingInDist)
carCnt++; carCnt++;
slot++; slot++;
} while (carCnt < &car_data[MAX_TRAFFIC_CARS]); } while (carCnt < &car_data[MAX_CARS]);
if (newCar == NULL) if (newCar == NULL)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -705,7 +705,7 @@ void CheckScenaryCollisions(CAR_DATA *cp)
{ {
if (count >= mdcount && cop->pad != 0) if (count >= mdcount && cop->pad != 0)
{ {
if (CarBuildingCollision(cp, &bbox, cop, 0) != 0) if (CarBuildingCollision(cp, &bbox, cop, 0))
{ {
if (!bKillTanner) if (!bKillTanner)
player[0].dying = 1; player[0].dying = 1;
@ -754,7 +754,7 @@ void CheckScenaryCollisions(CAR_DATA *cp)
{ {
cp->st.n.linearVelocity[2] = ExBoxDamage + cp->st.n.linearVelocity[2]; cp->st.n.linearVelocity[2] = ExBoxDamage + cp->st.n.linearVelocity[2];
if (CarBuildingCollision(cp, &bbox, cop, (cop->pad == 1) ? 0x2 : 0) != 0) if (CarBuildingCollision(cp, &bbox, cop, (cop->pad == 1) ? CollisionCheckFlag_IsVegasMovingTrain : 0))
{ {
cp->ap.needsDenting = 1; cp->ap.needsDenting = 1;
} }
@ -763,7 +763,7 @@ void CheckScenaryCollisions(CAR_DATA *cp)
} }
else else
{ {
if (CarBuildingCollision(cp, &bbox, cop, (model->flags2 >> 10) & 1) != 0) if (CarBuildingCollision(cp, &bbox, cop, (model->flags2 & MODEL_FLAG_BARRIER) ? CollisionCheckFlag_MightBeABarrier : 0))
cp->ap.needsDenting = 1; cp->ap.needsDenting = 1;
} }
} }

View File

@ -473,6 +473,12 @@ void DisplayMoon(DVECTOR* pos, CVECTOR* col, int flip)
} }
extern VECTOR dummy; extern VECTOR dummy;
RECT16 sun_source = {
1008,
456,
16,
10
};
// [D] [T] // [D] [T]
void DrawLensFlare(void) void DrawLensFlare(void)
@ -507,12 +513,7 @@ void DrawLensFlare(void)
RECT16 source; RECT16 source;
CVECTOR col; CVECTOR col;
source = { source = sun_source;
1008,
456,
16,
10
};
if (gWeather - 1U <= 1 || gTimeOfDay == 0 || gTimeOfDay == 2) if (gWeather - 1U <= 1 || gTimeOfDay == 0 || gTimeOfDay == 2)
return; return;
@ -675,11 +676,16 @@ void DrawLensFlare(void)
source.x = sun_pers_conv_position.vx; source.x = sun_pers_conv_position.vx;
source.y = sun_pers_conv_position.vy + last->disp.disp.y; source.y = sun_pers_conv_position.vy + last->disp.disp.y;
#if 1//def PSX
sample_sun = (DR_MOVE*)current->primptr; sample_sun = (DR_MOVE*)current->primptr;
SetDrawMove(sample_sun, &source, 1008, 456); SetDrawMove(sample_sun, &source, 1008, 456);
addPrim(current->ot + 0x20, sample_sun); addPrim(current->ot + 0x20, sample_sun);
current->primptr += sizeof(DR_MOVE); current->primptr += sizeof(DR_MOVE);
#else
// to avoid delays and uploads to GPU we're simply going to directly request from screen VRAM area
sun_source = source;
#endif
} }
else else
{ {

View File

@ -86,7 +86,12 @@ extern DB MPBuff[2][2];
extern DB* last; extern DB* last;
extern DB* current; extern DB* current;
#define OTSIZE 0x1080 /* ordering table size */ // ordering table size
#ifdef PSX
#define OTSIZE 0x1080
#else
#define OTSIZE 0x2000
#endif
#ifdef USE_EXTENDED_PRIM_POINTERS #ifdef USE_EXTENDED_PRIM_POINTERS
# define PRIMTAB_SIZE 0x50000 # define PRIMTAB_SIZE 0x50000

View File

@ -11,7 +11,6 @@
#define MAX_PEDESTRIANS 28 #define MAX_PEDESTRIANS 28
#define MAX_SEATED_PEDS 20 #define MAX_SEATED_PEDS 20
#define MAX_PLACED_PEDS 15 #define MAX_PLACED_PEDS 15
#define MAX_TRAFFIC_CARS 19
#define MAX_EXPLOSION_OBJECTS 5 #define MAX_EXPLOSION_OBJECTS 5
#define MAX_THROWN_BOMBS 5 #define MAX_THROWN_BOMBS 5
#define MAX_MOTION_CAPTURE 24 #define MAX_MOTION_CAPTURE 24

View File

@ -363,6 +363,7 @@ enum ModelFlags2
MODEL_FLAG_ALLEY = 0x80, MODEL_FLAG_ALLEY = 0x80,
MODEL_FLAG_HASROOF = 0x100, MODEL_FLAG_HASROOF = 0x100,
MODEL_FLAG_NOCOL_200 = 0x200, MODEL_FLAG_NOCOL_200 = 0x200,
MODEL_FLAG_BARRIER = 0x400,
MODEL_FLAG_SMASHABLE = 0x800, MODEL_FLAG_SMASHABLE = 0x800,
MODEL_FLAG_LAMP = 0x1000, MODEL_FLAG_LAMP = 0x1000,
MODEL_FLAG_TREE = 0x2000, MODEL_FLAG_TREE = 0x2000,

View File

@ -310,8 +310,8 @@ void GameDebugKeys(int nKey, bool down)
else if (nKey == SDL_SCANCODE_2) else if (nKey == SDL_SCANCODE_2)
{ {
gShowCollisionDebug++; gShowCollisionDebug++;
if (gShowCollisionDebug > 3) gShowCollisionDebug %= 5;
gShowCollisionDebug = 0;
printf("Collision debug: %d\n", gShowCollisionDebug); printf("Collision debug: %d\n", gShowCollisionDebug);
} }
else if (nKey == SDL_SCANCODE_3) else if (nKey == SDL_SCANCODE_3)