mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 03:42:34 +01:00
- PSX bug fixes again
- fix drawing issues caused by some previous commits
This commit is contained in:
parent
f5925b889a
commit
59751a9295
@ -583,8 +583,8 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
|
||||
int buildingHeightY;
|
||||
|
||||
#if 0 //def PSX
|
||||
CDATA2D* cd = (CDATA2D*)getScratchAddr(0);
|
||||
CRET2D& collisionResult = *(CRET2D*)(getScratchAddr(0) + sizeof(CDATA2D) * 2);
|
||||
CDATA2D* cd = (CDATA2D*)(u_char*)getScratchAddr(0);
|
||||
CRET2D& collisionResult = *(CRET2D*)((u_char*)getScratchAddr(0) + sizeof(CDATA2D) * 2);
|
||||
|
||||
memset((u_char*)cd, 0, sizeof(CDATA2D));
|
||||
memset((u_char*)&collisionResult, 0, sizeof(CRET2D));
|
||||
|
@ -344,7 +344,7 @@ void restoreLightingMatrices(void)
|
||||
// [D] [T]
|
||||
void ComputeCarLightingLevels(CAR_DATA* cp, char detail)
|
||||
{
|
||||
MATRIX& scratchPadMat = *(MATRIX*)(getScratchAddr(0) + 0x344);
|
||||
MATRIX& scratchPadMat = *(MATRIX*)((u_char*)getScratchAddr(0) + 0x344);
|
||||
|
||||
int doLight;
|
||||
int orW;
|
||||
@ -565,10 +565,10 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip)
|
||||
MODEL *WheelModelFront;
|
||||
|
||||
#ifdef PSX
|
||||
MATRIX& FrontMatrix = *(MATRIX*)getScratchAddr(0);
|
||||
MATRIX& SteerMatrix = *(MATRIX*)(getScratchAddr(0) + sizeof(MATRIX));
|
||||
VECTOR& WheelPos = *(VECTOR*)(getScratchAddr(0) + sizeof(MATRIX) * 2);
|
||||
SVECTOR& sWheelPos = *(SVECTOR*)(getScratchAddr(0) + sizeof(MATRIX) * 2 + sizeof(VECTOR));
|
||||
MATRIX& FrontMatrix = *(MATRIX*)(u_char*)getScratchAddr(0);
|
||||
MATRIX& SteerMatrix = *(MATRIX*)((u_char*)getScratchAddr(0) + sizeof(MATRIX));
|
||||
VECTOR& WheelPos = *(VECTOR*)((u_char*)getScratchAddr(0) + sizeof(MATRIX) * 2);
|
||||
SVECTOR& sWheelPos = *(SVECTOR*)((u_char*)getScratchAddr(0) + sizeof(MATRIX) * 2 + sizeof(VECTOR));
|
||||
#else
|
||||
MATRIX FrontMatrix;
|
||||
MATRIX SteerMatrix;
|
||||
@ -786,7 +786,7 @@ void PlayerCarFX(CAR_DATA *cp)
|
||||
void plotNewCarModel(CAR_MODEL* car, int palette)
|
||||
{
|
||||
#ifdef PSX
|
||||
plotCarGlobals& _pg = *(plotCarGlobals*)getScratchAddr(0);
|
||||
plotCarGlobals& _pg = *(plotCarGlobals*)(u_char*)getScratchAddr(0);
|
||||
#else
|
||||
plotCarGlobals _pg;
|
||||
#endif
|
||||
@ -1233,7 +1233,7 @@ void DrawCarObject(CAR_MODEL* car, MATRIX* matrix, VECTOR* pos, int palette, CAR
|
||||
|
||||
gte_SetTransVector(&modelLocation);
|
||||
|
||||
savedSP = SetSp((u_long)(getScratchAddr(0) + 0x308));
|
||||
savedSP = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x308));
|
||||
|
||||
plotNewCarModel(car, palette);
|
||||
|
||||
|
@ -112,7 +112,7 @@ int setupYet = 0;
|
||||
|
||||
int gDrawDistance = 441;
|
||||
|
||||
_pct& plotContext = *(_pct*)(getScratchAddr(0) + 1024 - sizeof(_pct)); // orig offset: 0x1f800020
|
||||
_pct& plotContext = *(_pct*)((u_char*)getScratchAddr(0) + 1024 - sizeof(_pct)); // orig offset: 0x1f800020
|
||||
|
||||
// [D] [T] [A]
|
||||
void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z)
|
||||
@ -122,7 +122,7 @@ void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z)
|
||||
m = 4;
|
||||
|
||||
#ifdef PSX
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)getScratchAddr(0);
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
|
||||
#else
|
||||
MVERTEX5x5 subdiVerts;
|
||||
#endif
|
||||
@ -173,7 +173,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound)
|
||||
int count;
|
||||
|
||||
#ifdef PSX
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)getScratchAddr(0);
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
|
||||
#else
|
||||
MVERTEX5x5 subdiVerts;
|
||||
#endif
|
||||
@ -379,9 +379,11 @@ void SetupDrawMapPSX(void)
|
||||
int region_z1;
|
||||
int current_barrel_region_x1;
|
||||
int current_barrel_region_z1;
|
||||
|
||||
int theta;
|
||||
|
||||
if (setupYet != 0)
|
||||
return;
|
||||
|
||||
current_cell_x = (camera_position.vx + units_across_halved) / MAP_CELL_SIZE;
|
||||
current_cell_z = (camera_position.vz + units_down_halved) / MAP_CELL_SIZE;
|
||||
|
||||
@ -397,7 +399,6 @@ void SetupDrawMapPSX(void)
|
||||
(current_cell_z % MAP_REGION_SIZE) * MAP_REGION_SIZE + (current_cell_x % MAP_REGION_SIZE),
|
||||
CurrentPVS);
|
||||
|
||||
|
||||
for (theta = 0; theta < 64; theta++)
|
||||
MulMatrix0(&inv_camera_matrix, (MATRIX*)&matrixtable[theta], (MATRIX*)&CompoundMatrix[theta]);
|
||||
|
||||
@ -774,7 +775,7 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
|
||||
int combo;
|
||||
|
||||
#ifdef PSX
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)getScratchAddr(0);
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
|
||||
#else
|
||||
MVERTEX5x5 subdiVerts;
|
||||
#endif
|
||||
@ -1035,7 +1036,7 @@ void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n)
|
||||
int combo;
|
||||
|
||||
#ifdef PSX
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)getScratchAddr(0);
|
||||
MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0);
|
||||
#else
|
||||
MVERTEX5x5 subdiVerts;
|
||||
#endif
|
||||
@ -1309,9 +1310,9 @@ void DrawMapPSX(int* comp_val)
|
||||
int vloop;
|
||||
|
||||
#ifdef PSX
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)getScratchAddr(0);
|
||||
MATRIX& mRotStore = *(MATRIX*)(getScratchAddr(0) + sizeof(CELL_ITERATOR));
|
||||
DrawMapData& drawData = *(DrawMapData*)(getScratchAddr(0) + sizeof(CELL_ITERATOR) + sizeof(MATRIX));
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)(u_char*)getScratchAddr(0);
|
||||
MATRIX& mRotStore = *(MATRIX*)((u_char*)getScratchAddr(0) + sizeof(CELL_ITERATOR));
|
||||
DrawMapData& drawData = *(DrawMapData*)((u_char*)getScratchAddr(0) + sizeof(CELL_ITERATOR) + sizeof(MATRIX));
|
||||
#else
|
||||
CELL_ITERATOR ci;
|
||||
MATRIX mRotStore;
|
||||
@ -1324,8 +1325,7 @@ void DrawMapPSX(int* comp_val)
|
||||
static int treecount = 0;
|
||||
static int alleycount = 0;
|
||||
|
||||
if (setupYet == 0)
|
||||
SetupDrawMapPSX();
|
||||
SetupDrawMapPSX();
|
||||
|
||||
// clean cell cache
|
||||
ClearCopUsage();
|
||||
|
@ -55,6 +55,8 @@ extern int pvs_square;
|
||||
extern int pvs_square_sq;
|
||||
extern int PolySizes[56];
|
||||
|
||||
extern int setupYet;
|
||||
|
||||
extern int combointensity;
|
||||
|
||||
extern int gForceLowDetailCars;
|
||||
|
@ -876,7 +876,7 @@ void StepSim(void)
|
||||
pauseflag = 1;
|
||||
}
|
||||
|
||||
oldsp = SetSp(0x1f8003e8); // i don't know what this does
|
||||
oldsp = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x3e8)); // i don't know what this does
|
||||
|
||||
lead_pad = (u_int)controller_bits;
|
||||
|
||||
@ -2285,10 +2285,11 @@ void RenderGame2(int view)
|
||||
FrAng = ratan2(160, scr_z);
|
||||
#endif
|
||||
|
||||
//Set_Inv_CameraMatrix();
|
||||
//SetCameraVector();
|
||||
Set_Inv_CameraMatrix();
|
||||
SetCameraVector();
|
||||
|
||||
//SetupDrawMapPSX();
|
||||
SetupDrawMapPSX();
|
||||
setupYet = 0;
|
||||
|
||||
if (gLoadedMotionCapture != 0)
|
||||
DrawAllPedestrians();
|
||||
@ -2303,7 +2304,8 @@ void RenderGame2(int view)
|
||||
Set_Inv_CameraMatrix();
|
||||
SetCameraVector();
|
||||
|
||||
//SetupDrawMapPSX();
|
||||
SetupDrawMapPSX();
|
||||
|
||||
DrawDrivingGames();
|
||||
DrawThrownBombs();
|
||||
AddGroundDebris();
|
||||
|
@ -927,7 +927,7 @@ void SetupTannerSkeleton(PEDESTRIAN* pDrawingPed)
|
||||
}
|
||||
|
||||
#ifdef PSX
|
||||
store = (SVECTOR*)(getScratchAddr(0) + 0x200);
|
||||
store = (SVECTOR*)((u_char*)getScratchAddr(0) + 0x200);
|
||||
#else
|
||||
SVECTOR scratchVectors[64];
|
||||
store = scratchVectors;
|
||||
|
@ -33,7 +33,7 @@ char CellEmpty(VECTOR *pPosition, int radius)
|
||||
int type;
|
||||
|
||||
#if 0
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)(getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
#else
|
||||
CELL_ITERATOR ci;
|
||||
#endif
|
||||
@ -337,7 +337,7 @@ char lineClear(VECTOR *v1, VECTOR *v2)
|
||||
int zd; // $v1
|
||||
|
||||
#ifdef PSX
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)(getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
#else
|
||||
CELL_ITERATOR ci;
|
||||
#endif
|
||||
@ -531,7 +531,7 @@ void CollisionCopList(XZPAIR* pos, int* count)
|
||||
int type;
|
||||
|
||||
#if 0
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)(getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
CELL_ITERATOR& ci = *(CELL_ITERATOR*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR));
|
||||
#else
|
||||
CELL_ITERATOR ci;
|
||||
#endif
|
||||
@ -810,7 +810,7 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra)
|
||||
int dx, dz;
|
||||
|
||||
#if 0
|
||||
CDATA2D* cd = (CDATA2D*)(getScratchAddr(0) + 1024 - sizeof(CDATA2D) * 2);
|
||||
CDATA2D* cd = (CDATA2D*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CDATA2D) * 2);
|
||||
#else
|
||||
CDATA2D cd[2] = { 0 };
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user