Skip to content

Commit

Permalink
- work towars x64 support on GCC/Clang: converted all necessary longs…
Browse files Browse the repository at this point in the history
… to int
  • Loading branch information
SoapyMan committed Feb 14, 2024
1 parent 4fcd4af commit 6d7370a
Show file tree
Hide file tree
Showing 35 changed files with 191 additions and 187 deletions.
6 changes: 3 additions & 3 deletions src_rebuild/Game/ASM/rnc_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct RNCheader
*/

/*____________________________________________________________________________*/
short testRNC(unsigned long firstLong)
short testRNC(unsigned int firstLong)
{
int method = 0;
method = (firstLong & 0xFF000000) >> 24; //get low byte
Expand Down Expand Up @@ -113,8 +113,8 @@ unsigned short get_offset(unsigned char** byteStreamPtr)
/*____________________________________________________________________________*/
//RNC2 unpack

int RNCunpack2(unsigned char* packed, unsigned long srcSize,
unsigned char* unpacked, unsigned long dstSize)
int RNCunpack2(unsigned char* packed, unsigned int srcSize,
unsigned char* unpacked, unsigned int dstSize)
{
unsigned char* src = packed;
unsigned char* dst = unpacked;
Expand Down
20 changes: 10 additions & 10 deletions src_rebuild/Game/C/E3stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ void FadeInHiresScreen(char *filename)
PutDrawEnv(&draw);

LoadfileSeg(filename, (char*)_overlay_buffer, 20, 0x4ff80);
LoadClut((u_long*)_overlay_buffer, 640, 511);
LoadClut((u_int*)_overlay_buffer, 640, 511);

DrawSync(0);
setRECT(&rect, 640, 0, 320, 511);

LoadImage(&rect, (u_long*)&_overlay_buffer[524]);
LoadImage(&rect, (u_int*)&_overlay_buffer[524]);

DrawSync(0);
SetDispMask(1);
Expand All @@ -143,7 +143,7 @@ void FadeInHiresScreen(char *filename)
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
ClearOTagR((u_long*)&ot, 1);
ClearOTagR((u_int*)&ot, 1);

poly = nulls;
prim = prims;
Expand All @@ -164,7 +164,7 @@ void FadeInHiresScreen(char *filename)
poly++; prim++;
}

DrawOTag((u_long*)&ot);
DrawOTag((u_int*)&ot);

#ifndef PSX
PsyX_EndScene();
Expand Down Expand Up @@ -255,12 +255,12 @@ void ShowBonusGallery()
sprintf(filename, "GFX\\GAL\\IMG%d.TIM", currentImage-1);

LoadfileSeg(filename, (char*)_other_buffer, 20, 0x4ff80);
LoadClut((u_long*)_other_buffer, 640, 511);
LoadClut((u_int*)_other_buffer, 640, 511);

DrawSync(0);
setRECT(&rect, 640, 0, 320, 511);

LoadImage(&rect, (u_long*)&_other_buffer[524]);
LoadImage(&rect, (u_int*)&_other_buffer[524]);

DrawSync(0);
SetDispMask(1);
Expand All @@ -272,7 +272,7 @@ void ShowBonusGallery()
PutDispEnv(&disp);
PutDrawEnv(&draw);

ClearOTagR((u_long*)&ot, 1);
ClearOTagR((u_int*)&ot, 1);

poly = nulls;
prim = prims;
Expand All @@ -286,7 +286,7 @@ void ShowBonusGallery()
poly++; prim++;
}

DrawOTag((u_long*)&ot);
DrawOTag((u_int*)&ot);

#ifndef PSX
PsyX_EndScene();
Expand Down Expand Up @@ -396,7 +396,7 @@ void FadeOutHiresScreen(void)
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
ClearOTagR((u_long*)&ot, 1);
ClearOTagR((u_int*)&ot, 1);

poly = nulls;
prim = prims;
Expand All @@ -412,7 +412,7 @@ void FadeOutHiresScreen(void)
poly++; prim++;
}

DrawOTag((u_long*)&ot);
DrawOTag((u_int*)&ot);

#ifndef PSX
PsyX_EndScene();
Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/cars.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ void ProcessPalletLump(char *lump_ptr, int lump_size)
if (clut_number == -1)
{
// store clut
LoadImage(&clutpos, (u_long*)buffPtr);
LoadImage(&clutpos, (u_int*)buffPtr);
buffPtr += 8;

clutValue = GetClut(clutpos.x, clutpos.y);
Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/civ_ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ int CreateCivCarWotDrivesABitThenStops(int direction, LONGVECTOR4* startPos, LON
}

// [D] [T]
int CreateStationaryCivCar(int direction, long orientX, long orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags)
int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags)
{
unsigned char* slot;
CAR_DATA* newCar;
Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/civ_ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern void SetUpTrafficLightPhase(); // 0x0002D220
extern int TrafficLightCycle(int exit); // 0x0002CF18

extern int CreateCivCarWotDrivesABitThenStops(int direction, LONGVECTOR4* startPos, LONGVECTOR4* stopPos, unsigned char internalModel, int palette); // 0x000286E0
extern int CreateStationaryCivCar(int direction, long orientX, long orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags); // 0x00028960
extern int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags); // 0x00028960

extern int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distAlongSegment, CAR_DATA* cp, int tryToPark); // 0x00026F20
extern int NotTravellingAlongCurve(int x, int z, int dir, DRIVER2_CURVE* cv);
Expand Down
4 changes: 2 additions & 2 deletions src_rebuild/Game/C/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ void StepFromToEvent(EVENT* ev)
{
int df;
int md;
long* curr;
int* curr;
int* to;
int direction;
int d, d2;
Expand Down Expand Up @@ -1838,7 +1838,7 @@ void StepPathEvent(EVENT* ev)
int* to;
Station station;
int direction;
long* curr;
int* curr;
int dir;
int turn[4];
XZPAIR centre;
Expand Down
4 changes: 2 additions & 2 deletions src_rebuild/Game/C/glaunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ void ReInitFrontend(int returnToMain)
DrawSync(0);
VSync(0);

ClearOTagR((u_long*)MPBuff[0][0].ot, OTSIZE);
ClearOTagR((u_long*)MPBuff[0][1].ot, OTSIZE);
ClearOTagR((u_int*)MPBuff[0][0].ot, OTSIZE);
ClearOTagR((u_int*)MPBuff[0][1].ot, OTSIZE);

SetDispMask(1);

Expand Down
4 changes: 2 additions & 2 deletions src_rebuild/Game/C/handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void GlobalTimeStep(void)
continue;
}

long* orient = st->n.orientation; // LONGQUATERNION
int* orient = st->n.orientation; // LONGQUATERNION

st->n.fposition[0] += st->n.linearVelocity[0] >> 8;
st->n.fposition[1] += st->n.linearVelocity[1] >> 8;
Expand Down Expand Up @@ -422,7 +422,7 @@ void GlobalTimeStep(void)
thisDelta = _d1;
}

long* orient = thisState_i->n.orientation; // LONGQUATERNION
int* orient = thisState_i->n.orientation; // LONGQUATERNION

thisDelta[i].n.fposition[0] = thisState_i->n.linearVelocity[0] >> 8;
thisDelta[i].n.fposition[1] = thisState_i->n.linearVelocity[1] >> 8;
Expand Down
4 changes: 2 additions & 2 deletions src_rebuild/Game/C/loadview.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps)
PutDrawEnv(&load_draw);

Loadfile(screen_name, (char*)_other_buffer);
LoadClut((u_long*)&_other_buffer[20], 320, 511);
LoadClut((u_int*)&_other_buffer[20], 320, 511);

DrawSync(0);

setRECT(&dest, 320, 0, 160, 511);
LoadImage(&dest, (u_long *)&_other_buffer[544]);
LoadImage(&dest, (u_int*)&_other_buffer[544]);

DrawSync(0);

Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/mc_snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void DoMissionSound(void)
else
{
int dx, dz;
long* C = (long*)bodgevar; // Ahhh, Reflections... // LONGVECTOR3
int* C = (int*)bodgevar; // Ahhh, Reflections... // LONGVECTOR3

dx = C[0] - car_data[player[0].playerCarId].hd.where.t[0];
dz = C[2] - car_data[player[0].playerCarId].hd.where.t[2];
Expand Down
8 changes: 4 additions & 4 deletions src_rebuild/Game/C/mdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void DrawOverheadTarget(MS_TARGET *target)
break;
}
case Target_Event: // event target
tv = *target->s.event.eventPos;
tv = *(*(VECTOR**)&target->s.event.eventPos);
break;
default:
return;
Expand Down Expand Up @@ -194,7 +194,7 @@ void DrawFullscreenTarget(MS_TARGET *target)
break;
}
case Target_Event: // event target
tv = *target->s.event.eventPos;
tv = *(*(VECTOR**)&target->s.event.eventPos);
break;
default:
return;
Expand Down Expand Up @@ -297,7 +297,7 @@ void DrawWorldTarget(MS_TARGET *target)
}
case Target_Event:
{
tv = *target->s.event.eventPos;
tv = *(*(VECTOR**)&target->s.event.eventPos);
break;
}
default:
Expand Down Expand Up @@ -414,7 +414,7 @@ void DrawMultiplayerTarget(MS_TARGET *target)
}
case Target_Event:
{
tv = *target->s.event.eventPos;
tv = *(*(VECTOR**)&target->s.event.eventPos);
break;
}
default:
Expand Down
6 changes: 3 additions & 3 deletions src_rebuild/Game/C/mission.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void LoadMission(int missionnum)
LoadfileSeg(filename, (char *)MissionLoadAddress, offset, sizeof(MS_MISSION));

MissionHeader = MissionLoadAddress;
MissionTargets = (MS_TARGET *)((int)MissionLoadAddress + MissionLoadAddress->size);
MissionTargets = (MS_TARGET *)((int*)MissionLoadAddress + MissionLoadAddress->size);
MissionScript = (u_int *)(MissionTargets + MAX_MISSION_TARGETS);
MissionStrings = (char*)((int*)MissionScript + MissionLoadAddress->strings);

Expand Down Expand Up @@ -2567,7 +2567,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target)
if (target->s.target_flags & TARGET_FLAG_EVENT_TRIGGERED)
{
// [A] Ahhhh, 32 bit pointers... for future full-scale refactoring
if (target->s.event.loseMessage != -1 && Long2DDistance(target->s.event.eventPos, &pv) > 30000)
if (target->s.event.loseMessage != -1 && Long2DDistance((*(VECTOR**)&target->s.event.eventPos), &pv) > 30000)
{
message = MissionStrings + target->s.event.loseMessage;
SetPlayerMessage(thread->player, message, 2, 2);
Expand All @@ -2576,7 +2576,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target)
}
else
{
target->s.event.eventPos = TriggerEvent(target->s.event.eventId);
(*(VECTOR**)&target->s.event.eventPos) = TriggerEvent(target->s.event.eventId);
target->s.target_flags |= TARGET_FLAG_EVENT_TRIGGERED;
}

Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/objanim.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void ColourCycle(void)
cyc->vx = vram.x = (temp & 63) << 4;
cyc->vy = vram.y = (temp >> 6);

StoreImage(&vram, (u_long*)bufaddr);
StoreImage(&vram, (u_int*)bufaddr);
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions src_rebuild/Game/C/overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
poly->y2 = max_y;
poly->y3 = max_y;

addPrim((u_long*)(current->ot + 1), poly);
addPrim((u_int*)(current->ot + 1), poly);
current->primptr += sizeof(POLY_G4);
}

Expand Down Expand Up @@ -269,7 +269,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
poly2->y2 = max_y;
poly2->y3 = max_y;

addPrim((u_long*)(current->ot+1), poly2);
addPrim(current->ot+1, poly2);
current->primptr += sizeof(POLY_G4);

// draw contours
Expand All @@ -291,7 +291,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
lineF4->y2 = max_y;
lineF4->y3 = max_y;

addPrim((u_long*)(current->ot + 1), lineF4);
addPrim((u_int*)(current->ot + 1), lineF4);
current->primptr += sizeof(LINE_F4);

LINE_F2* lineF2 = (LINE_F2*)current->primptr;
Expand All @@ -306,7 +306,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
lineF2->x1 = min_x - 1;
lineF2->y1 = max_y;

addPrim((u_long*)(current->ot + 1), lineF2);
addPrim((u_int*)(current->ot + 1), lineF2);
current->primptr += sizeof(LINE_F2);

TransparencyOn(current->ot + 1, 0x20);
Expand Down Expand Up @@ -439,7 +439,7 @@ void DrawProximityBar(PERCENTAGE_BAR *bar)
lineF4->y2 = max_y;
lineF4->y3 = max_y;

addPrim((u_long*)(current->ot + 1), lineF4);
addPrim((u_int*)(current->ot + 1), lineF4);
current->primptr += sizeof(LINE_F4);

LINE_F2* lineF2 = (LINE_F2*)current->primptr;
Expand All @@ -454,7 +454,7 @@ void DrawProximityBar(PERCENTAGE_BAR *bar)
lineF2->x1 = min_x - 1;
lineF2->y1 = max_y;

addPrim((u_long*)(current->ot + 1), lineF2);
addPrim((u_int*)(current->ot + 1), lineF2);
current->primptr += sizeof(LINE_F2);

TransparencyOn(current->ot + 1, 0x20);
Expand Down
16 changes: 8 additions & 8 deletions src_rebuild/Game/C/overmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size)
D_MALLOC_END();

// load CLUT
LoadImage(&mapclutpos, (u_long *)(MapBitMaps + 512));
LoadImage(&mapclutpos, (u_int *)(MapBitMaps + 512));
DrawSync(0);
}

Expand Down Expand Up @@ -437,10 +437,10 @@ void LoadMapTile(int tpage, int x, int y)

#ifdef PSX
DrawSync(0);
LoadImage(&MapSegment, (u_long*)MapBuffer);
LoadImage(&MapSegment, (u_int*)MapBuffer);
DrawSync(0);
#else
LoadImage(&MapSegment, (u_long*)MapBuffer);
LoadImage(&MapSegment, (u_int*)MapBuffer);
#endif
}

Expand Down Expand Up @@ -898,7 +898,7 @@ void InitMultiplayerMap(void)
rect.w = 16;
rect.h = 64;

LoadImage(&rect, (u_long *)MapBitMaps);
LoadImage(&rect, (u_int *)MapBitMaps);

DrawSync(0);
}
Expand Down Expand Up @@ -1090,7 +1090,7 @@ void DrawOverheadMap(void)
SVECTOR direction;
RECT16 clipped_size;
VECTOR vec;
long flag;
int flag;
int i, j;
int tw, th;
int x_mod, y_mod;
Expand Down Expand Up @@ -1485,7 +1485,7 @@ void DrawFullscreenMap(void)
VECTOR meshO[4];
VECTOR target;
VECTOR vec;
long flag;
int flag;
int width, height;
int ntiles, count;
int tw, th;
Expand Down Expand Up @@ -1865,7 +1865,7 @@ void WorldToOverheadMapPositions(VECTOR *pGlobalPosition, VECTOR *pOverheadMapPo
MATRIX tempMatrix;
SVECTOR tempVector;
XZPAIR playerPos;
long flag;
int flag;

cs = RCOS(player[0].dir);
sn = RSIN(player[0].dir);
Expand Down Expand Up @@ -1943,7 +1943,7 @@ void WorldToFullscreenMap(VECTOR *in, VECTOR *out)
void WorldToFullscreenMap2(VECTOR *in, VECTOR *out)
{
SVECTOR pos;
long flag;
int flag;
int scale;

scale = overlaidmaps[GameLevel].scale;
Expand Down
Loading

0 comments on commit 6d7370a

Please sign in to comment.