Skip to content

Commit 42c78c6

Browse files
committed
- apply few simplifications to code
1 parent cc7d5d6 commit 42c78c6

6 files changed

Lines changed: 348 additions & 394 deletions

File tree

src_rebuild/Game/C/bcollide.c

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -958,34 +958,13 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
958958
// angular impulse calculation and modifiers
959959
if (cp->controlType != CONTROL_TYPE_LEAD_AI)
960960
{
961-
int temp;
962-
temp = FIXEDH(lever[1] * reaction[2]);
961+
int reduction;
962+
reduction = (cp->controlType == CONTROL_TYPE_PURSUER_AI);
963963

964-
if (cp->controlType == CONTROL_TYPE_PURSUER_AI)
965-
temp >>= 1;
966-
967-
cp->hd.aacc[0] += temp;
968-
969-
temp = FIXEDH(lever[2] * reaction[1]);
970-
971-
if (cp->controlType == CONTROL_TYPE_PURSUER_AI)
972-
temp >>= 1;
973-
974-
cp->hd.aacc[0] -= temp;
975-
976-
temp = FIXEDH(lever[0] * reaction[1]);
977-
978-
if (cp->controlType == CONTROL_TYPE_PURSUER_AI)
979-
temp >>= 1;
980-
981-
cp->hd.aacc[2] += temp;
982-
983-
temp = FIXEDH(lever[1] * reaction[0]);
984-
985-
if (cp->controlType == CONTROL_TYPE_PURSUER_AI)
986-
temp >>= 1;
987-
988-
cp->hd.aacc[2] -= temp;
964+
cp->hd.aacc[0] += FIXEDH(lever[1] * reaction[2]) >> reduction;
965+
cp->hd.aacc[0] -= FIXEDH(lever[2] * reaction[1]) >> reduction;
966+
cp->hd.aacc[2] += FIXEDH(lever[0] * reaction[1]) >> reduction;
967+
cp->hd.aacc[2] -= FIXEDH(lever[1] * reaction[0]) >> reduction;
989968

990969
cp->st.n.linearVelocity[1] += reaction[1];
991970
}

src_rebuild/Game/C/cars.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ MODEL* gCleanWheelModelPtr;
6666
MODEL* gFastWheelModelPtr;
6767
MODEL* gDamWheelModelPtr;
6868

69-
// active carsg
69+
// active cars
7070
CAR_DATA* active_car_list[MAX_CARS];
71-
BOUND_BOX bbox[MAX_CARS];
71+
7272
u_char lightsOnDelay[MAX_CARS];
7373
short FrontWheelRotation[MAX_CARS]; // offset 0x0
7474
short BackWheelRotation[MAX_CARS]; // offset 0x30

src_rebuild/Game/C/cars.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern CAR_DATA car_data[MAX_CARS + 2]; // all cars + Tanner cbox + Camera cbox
1111

1212
// active cars
1313
extern CAR_DATA* active_car_list[MAX_CARS];
14-
extern BOUND_BOX bbox[MAX_CARS];
1514
extern unsigned char lightsOnDelay[MAX_CARS];
1615

1716
extern CAR_MODEL NewCarModel[MAX_CAR_MODELS];

0 commit comments

Comments
 (0)