Skip to content

Commit d829145

Browse files
committed
- work towars x64 support on GCC/Clang: converted all necessary longs to int
1 parent 4fcd4af commit d829145

30 files changed

+138
-134
lines changed

src_rebuild/Game/ASM/rnc_2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct RNCheader
2828
*/
2929

3030
/*____________________________________________________________________________*/
31-
short testRNC(unsigned long firstLong)
31+
short testRNC(unsigned int firstLong)
3232
{
3333
int method = 0;
3434
method = (firstLong & 0xFF000000) >> 24; //get low byte
@@ -113,8 +113,8 @@ unsigned short get_offset(unsigned char** byteStreamPtr)
113113
/*____________________________________________________________________________*/
114114
//RNC2 unpack
115115

116-
int RNCunpack2(unsigned char* packed, unsigned long srcSize,
117-
unsigned char* unpacked, unsigned long dstSize)
116+
int RNCunpack2(unsigned char* packed, unsigned int srcSize,
117+
unsigned char* unpacked, unsigned int dstSize)
118118
{
119119
unsigned char* src = packed;
120120
unsigned char* dst = unpacked;

src_rebuild/Game/C/civ_ai.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ int CreateCivCarWotDrivesABitThenStops(int direction, LONGVECTOR4* startPos, LON
17811781
}
17821782

17831783
// [D] [T]
1784-
int CreateStationaryCivCar(int direction, long orientX, long orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags)
1784+
int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags)
17851785
{
17861786
unsigned char* slot;
17871787
CAR_DATA* newCar;

src_rebuild/Game/C/civ_ai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern void SetUpTrafficLightPhase(); // 0x0002D220
4646
extern int TrafficLightCycle(int exit); // 0x0002CF18
4747

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

5151
extern int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distAlongSegment, CAR_DATA* cp, int tryToPark); // 0x00026F20
5252
extern int NotTravellingAlongCurve(int x, int z, int dir, DRIVER2_CURVE* cv);

src_rebuild/Game/C/event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ void StepFromToEvent(EVENT* ev)
17461746
{
17471747
int df;
17481748
int md;
1749-
long* curr;
1749+
decltype(VECTOR::vx)* curr;
17501750
int* to;
17511751
int direction;
17521752
int d, d2;
@@ -1838,7 +1838,7 @@ void StepPathEvent(EVENT* ev)
18381838
int* to;
18391839
Station station;
18401840
int direction;
1841-
long* curr;
1841+
decltype(VECTOR::vx)* curr;
18421842
int dir;
18431843
int turn[4];
18441844
XZPAIR centre;

src_rebuild/Game/C/handling.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void GlobalTimeStep(void)
365365
continue;
366366
}
367367

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

370370
st->n.fposition[0] += st->n.linearVelocity[0] >> 8;
371371
st->n.fposition[1] += st->n.linearVelocity[1] >> 8;
@@ -422,7 +422,7 @@ void GlobalTimeStep(void)
422422
thisDelta = _d1;
423423
}
424424

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

427427
thisDelta[i].n.fposition[0] = thisState_i->n.linearVelocity[0] >> 8;
428428
thisDelta[i].n.fposition[1] = thisState_i->n.linearVelocity[1] >> 8;

src_rebuild/Game/C/loadview.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps)
177177
DrawSync(0);
178178

179179
setRECT(&dest, 320, 0, 160, 511);
180-
LoadImage(&dest, (u_long *)&_other_buffer[544]);
180+
LoadImage(&dest, (u_long*)&_other_buffer[544]);
181181

182182
DrawSync(0);
183183

@@ -418,8 +418,8 @@ void DrawFadePoly(void)
418418
setRGB2(fl_g4, fadeVal, fadeVal, fadeVal);
419419
setRGB3(fl_g4, fadeVal, fadeVal, fadeVal);
420420

421-
addPrim(&current->ot[1], fl_g4);
422-
addPrim(&current->ot[1], &fade_gt4[current->id]);
421+
addPrim(current->ot + 1, fl_g4);
422+
addPrim(current->ot + 1, &fade_gt4[current->id]);
423423
}
424424

425425
// [D] [T]

src_rebuild/Game/C/mc_snd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ void DoMissionSound(void)
665665
else
666666
{
667667
int dx, dz;
668-
long* C = (long*)bodgevar; // Ahhh, Reflections... // LONGVECTOR3
668+
int* C = (int*)bodgevar; // Ahhh, Reflections... // LONGVECTOR3
669669

670670
dx = C[0] - car_data[player[0].playerCarId].hd.where.t[0];
671671
dz = C[2] - car_data[player[0].playerCarId].hd.where.t[2];

src_rebuild/Game/C/mdraw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void DrawOverheadTarget(MS_TARGET *target)
159159
break;
160160
}
161161
case Target_Event: // event target
162-
tv = *target->s.event.eventPos;
162+
tv = *(*(VECTOR**)&target->s.event.eventPos);
163163
break;
164164
default:
165165
return;
@@ -194,7 +194,7 @@ void DrawFullscreenTarget(MS_TARGET *target)
194194
break;
195195
}
196196
case Target_Event: // event target
197-
tv = *target->s.event.eventPos;
197+
tv = *(*(VECTOR**)&target->s.event.eventPos);
198198
break;
199199
default:
200200
return;
@@ -297,7 +297,7 @@ void DrawWorldTarget(MS_TARGET *target)
297297
}
298298
case Target_Event:
299299
{
300-
tv = *target->s.event.eventPos;
300+
tv = *(*(VECTOR**)&target->s.event.eventPos);
301301
break;
302302
}
303303
default:
@@ -414,7 +414,7 @@ void DrawMultiplayerTarget(MS_TARGET *target)
414414
}
415415
case Target_Event:
416416
{
417-
tv = *target->s.event.eventPos;
417+
tv = *(*(VECTOR**)&target->s.event.eventPos);
418418
break;
419419
}
420420
default:

src_rebuild/Game/C/mission.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,12 @@ void LoadMission(int missionnum)
436436
LoadfileSeg(filename, (char *)MissionLoadAddress, offset, sizeof(MS_MISSION));
437437

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

443443
if (MissionLoadAddress->route && !NewLevel)
444-
loadsize = (int)MissionStrings + (MissionLoadAddress->route - (int)MissionLoadAddress);
444+
loadsize = (u_int)((char*)MissionStrings + ((char*)MissionLoadAddress->route - (char*)MissionLoadAddress));
445445
else
446446
loadsize = length;
447447

@@ -2567,7 +2567,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target)
25672567
if (target->s.target_flags & TARGET_FLAG_EVENT_TRIGGERED)
25682568
{
25692569
// [A] Ahhhh, 32 bit pointers... for future full-scale refactoring
2570-
if (target->s.event.loseMessage != -1 && Long2DDistance(target->s.event.eventPos, &pv) > 30000)
2570+
if (target->s.event.loseMessage != -1 && Long2DDistance((*(VECTOR**)&target->s.event.eventPos), &pv) > 30000)
25712571
{
25722572
message = MissionStrings + target->s.event.loseMessage;
25732573
SetPlayerMessage(thread->player, message, 2, 2);
@@ -2576,7 +2576,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target)
25762576
}
25772577
else
25782578
{
2579-
target->s.event.eventPos = TriggerEvent(target->s.event.eventId);
2579+
(*(VECTOR**)&target->s.event.eventPos) = TriggerEvent(target->s.event.eventId);
25802580
target->s.target_flags |= TARGET_FLAG_EVENT_TRIGGERED;
25812581
}
25822582

src_rebuild/Game/C/overlay.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
236236
poly->y2 = max_y;
237237
poly->y3 = max_y;
238238

239-
addPrim((u_long*)(current->ot + 1), poly);
239+
addPrim(current->ot + 1, poly);
240240
current->primptr += sizeof(POLY_G4);
241241
}
242242

@@ -269,7 +269,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
269269
poly2->y2 = max_y;
270270
poly2->y3 = max_y;
271271

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

275275
// draw contours
@@ -291,7 +291,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar)
291291
lineF4->y2 = max_y;
292292
lineF4->y3 = max_y;
293293

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

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

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

312312
TransparencyOn(current->ot + 1, 0x20);
@@ -439,7 +439,7 @@ void DrawProximityBar(PERCENTAGE_BAR *bar)
439439
lineF4->y2 = max_y;
440440
lineF4->y3 = max_y;
441441

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

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

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

460460
TransparencyOn(current->ot + 1, 0x20);

0 commit comments

Comments
 (0)