Various formatting fixes (#225)
* Remove magic numbers from CalculateFrameRate * Move conditionals in MungeCarGraphics a bit * Move code around in LoadCar + less magic numbers * Tweak conditionals of ReallocExtraPathSections * Use BrVector3Copy in PointVisibleFromHere * tCar_spec->gear is an int * Re-use variable in SearchForSection * Use floats in CalcGetNearPlayerRoute * Use floats in ControlBoundFunkGroovePlus * Align pointers to multiple of pointer size in ShiftBoundGrooveFunks * Change conditionals in AddProximities + assign the_face at start of iteration * Move conditionals around in AddGroovidelics * Move code around in GrooveThisDelic * Assign the_groove each loop iteration in GrooveThoseDelics * Compare against NULL in MungeWindscreen * No need to check for pCount <= 0 in GetALineAndInterpretCommand
This commit is contained in:
parent
531403a18a
commit
0dc0c55dc8
|
@ -4191,7 +4191,7 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
br_actor* oily_actor;
|
||||
LOG_TRACE("(%d)", pFrame_period);
|
||||
|
||||
if (gNet_mode
|
||||
if (gNet_mode != eNet_mode_none
|
||||
&& ((gCurrent_net_game->type == eNet_game_type_foxy && gThis_net_player_index == gIt_or_fox)
|
||||
|| (gCurrent_net_game->type == eNet_game_type_tag && gThis_net_player_index != gIt_or_fox))) {
|
||||
gProgram_state.current_car.power_up_levels[1] = 0;
|
||||
|
@ -4205,31 +4205,31 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
|
||||
the_time = PDGetTotalTime();
|
||||
for (cat = eVehicle_self; cat <= eVehicle_rozzer; cat++) {
|
||||
if (cat) {
|
||||
car_count = GetCarCount(cat);
|
||||
} else {
|
||||
if (cat == eVehicle_self) {
|
||||
car_count = 1;
|
||||
} else {
|
||||
car_count = GetCarCount(cat);
|
||||
}
|
||||
for (car = 0; car_count > car; car++) {
|
||||
if (cat) {
|
||||
the_car = GetCarSpec(cat, car);
|
||||
} else {
|
||||
for (car = 0; car < car_count; car++) {
|
||||
if (cat == eVehicle_self) {
|
||||
the_car = &gProgram_state.current_car;
|
||||
} else {
|
||||
the_car = GetCarSpec(cat, car);
|
||||
}
|
||||
the_car->car_master_actor->render_style = (the_car->driver != eDriver_local_human) && PointOutOfSight(&the_car->pos, gYon_squared);
|
||||
the_car->car_master_actor->render_style = (the_car->driver == eDriver_local_human || !PointOutOfSight(&the_car->pos, gYon_squared)) ? BR_RSTYLE_DEFAULT : BR_RSTYLE_NONE;
|
||||
}
|
||||
}
|
||||
for (car = 0; car < gNum_active_cars; car++) {
|
||||
the_car = gActive_car_list[car];
|
||||
if (the_car->car_master_actor->render_style != BR_RSTYLE_NONE) {
|
||||
car_x = the_car->car_master_actor->t.t.mat.m[3][0];
|
||||
car_z = the_car->car_master_actor->t.t.mat.m[3][2];
|
||||
car_x = the_car->car_master_actor->t.t.translate.t.v[0];
|
||||
car_z = the_car->car_master_actor->t.t.translate.t.v[2];
|
||||
the_car->shadow_intersection_flags = 0;
|
||||
oily_count = GetOilSpillCount();
|
||||
for (i = 0; i < oily_count; i++) {
|
||||
GetOilSpillDetails(i, &oily_actor, &oily_size);
|
||||
if (oily_actor) {
|
||||
car_radius = the_car->bounds[1].max.v[2] / WORLD_SCALE * 1.5;
|
||||
if (oily_actor != NULL) {
|
||||
car_radius = the_car->bounds[1].max.v[2] / WORLD_SCALE * 1.5f;
|
||||
if (oily_actor->t.t.mat.m[3][0] - oily_size < car_x + car_radius
|
||||
&& oily_actor->t.t.mat.m[3][0] + oily_size > car_x - car_radius
|
||||
&& oily_actor->t.t.mat.m[3][2] - oily_size < car_z + car_radius
|
||||
|
@ -4305,19 +4305,17 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
abs_omega_z = (fabs(the_car->I.v[2]) + 0.44) / 2.0 * fabs(the_car->omega.v[2]);
|
||||
spinning_wildly = abs_omega_x > 26.4 || abs_omega_y > 49.98 || abs_omega_z > 3.52;
|
||||
if (spinning_wildly && the_time - gLast_cunning_stunt > 10000) {
|
||||
if (gWild_start
|
||||
&& (!the_car->last_special_volume || the_car->last_special_volume->gravity_multiplier == 1.0)) {
|
||||
if (the_time - gWild_start >= 500) {
|
||||
DoFancyHeadup(kFancyHeadupCunningStuntBonus);
|
||||
EarnCredits(gCunning_stunt_bonus[gProgram_state.skill_level]);
|
||||
gLast_cunning_stunt = the_time;
|
||||
gOn_me_wheels_start = 0;
|
||||
gQuite_wild_end = 0;
|
||||
gQuite_wild_start = 0;
|
||||
gWoz_upside_down_at_all = 0;
|
||||
}
|
||||
} else {
|
||||
if (!gWild_start
|
||||
|| (the_car->last_special_volume != NULL && the_car->last_special_volume->gravity_multiplier != 1.f)) {
|
||||
gWild_start = the_time;
|
||||
} else if (the_time - gWild_start >= 500) {
|
||||
DoFancyHeadup(kFancyHeadupCunningStuntBonus);
|
||||
EarnCredits(gCunning_stunt_bonus[gProgram_state.skill_level]);
|
||||
gLast_cunning_stunt = the_time;
|
||||
gOn_me_wheels_start = 0;
|
||||
gQuite_wild_end = 0;
|
||||
gQuite_wild_start = 0;
|
||||
gWoz_upside_down_at_all = 0;
|
||||
}
|
||||
} else {
|
||||
gWild_start = 0;
|
||||
|
@ -4330,7 +4328,7 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
if (!gQuite_wild_start) {
|
||||
gQuite_wild_start = the_time;
|
||||
}
|
||||
if (the_car->car_master_actor->t.t.mat.m[1][1] < -0.80000001) {
|
||||
if (the_car->car_master_actor->t.t.mat.m[1][1] < -0.8f) {
|
||||
gWoz_upside_down_at_all = the_time;
|
||||
}
|
||||
}
|
||||
|
@ -4338,28 +4336,24 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
if (!gQuite_wild_end) {
|
||||
gQuite_wild_end = the_time;
|
||||
}
|
||||
if (gQuite_wild_start
|
||||
&& the_time - gLast_cunning_stunt > 10000
|
||||
&& gQuite_wild_end - gQuite_wild_start >= 2000
|
||||
&& gWoz_upside_down_at_all >= gQuite_wild_start
|
||||
&& gWoz_upside_down_at_all <= gQuite_wild_end
|
||||
&& (gOn_me_wheels_start || the_time - gQuite_wild_end < 300)) {
|
||||
if (gOn_me_wheels_start) {
|
||||
if (the_time - gOn_me_wheels_start > 500
|
||||
&& (!the_car->last_special_volume
|
||||
|| the_car->last_special_volume->gravity_multiplier == 1.0)) {
|
||||
DoFancyHeadup(kFancyHeadupCunningStuntBonus);
|
||||
EarnCredits(gCunning_stunt_bonus[gProgram_state.skill_level]);
|
||||
gLast_cunning_stunt = PDGetTotalTime();
|
||||
gQuite_wild_end = 0;
|
||||
gQuite_wild_start = 0;
|
||||
gOn_me_wheels_start = 0;
|
||||
gWoz_upside_down_at_all = 0;
|
||||
}
|
||||
} else {
|
||||
gOn_me_wheels_start = the_time;
|
||||
}
|
||||
} else {
|
||||
if (!gQuite_wild_start
|
||||
|| the_time - gLast_cunning_stunt <= 10000
|
||||
|| gQuite_wild_end - gQuite_wild_start < 2000
|
||||
|| gWoz_upside_down_at_all < gQuite_wild_start
|
||||
|| gWoz_upside_down_at_all > gQuite_wild_end
|
||||
|| (!gOn_me_wheels_start && the_time - gQuite_wild_end >= 300)) {
|
||||
gQuite_wild_end = 0;
|
||||
gQuite_wild_start = 0;
|
||||
gOn_me_wheels_start = 0;
|
||||
gWoz_upside_down_at_all = 0;
|
||||
} else if (!gOn_me_wheels_start) {
|
||||
gOn_me_wheels_start = the_time;
|
||||
} else if (the_time - gOn_me_wheels_start > 500
|
||||
&& (the_car->last_special_volume == NULL
|
||||
|| the_car->last_special_volume->gravity_multiplier == 1.0f)) {
|
||||
DoFancyHeadup(kFancyHeadupCunningStuntBonus);
|
||||
EarnCredits(gCunning_stunt_bonus[gProgram_state.skill_level]);
|
||||
gLast_cunning_stunt = PDGetTotalTime();
|
||||
gQuite_wild_end = 0;
|
||||
gQuite_wild_start = 0;
|
||||
gOn_me_wheels_start = 0;
|
||||
|
@ -4369,47 +4363,41 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
}
|
||||
}
|
||||
if (the_car->driver != eDriver_local_human && the_car->car_model_variable) {
|
||||
distance_from_camera = (car_x - gCamera_to_world.m[3][0])
|
||||
* (car_x - gCamera_to_world.m[3][0])
|
||||
+ (car_z - gCamera_to_world.m[3][2])
|
||||
* (car_z - gCamera_to_world.m[3][2])
|
||||
+ (the_car->car_master_actor->t.t.mat.m[3][1] - gCamera_to_world.m[3][1])
|
||||
* (the_car->car_master_actor->t.t.mat.m[3][1] - gCamera_to_world.m[3][1]);
|
||||
|
||||
distance_from_camera = distance_from_camera / gCar_simplification_factor[gGraf_spec_index][gCar_simplification_level];
|
||||
if (gNet_mode && gNet_players[gIt_or_fox].car == the_car) {
|
||||
distance_from_camera = 0.0;
|
||||
distance_from_camera = Vector3DistanceSquared(&the_car->car_master_actor->t.t.translate.t,
|
||||
(br_vector3*)gCamera_to_world.m[3]) / gCar_simplification_factor[gGraf_spec_index][gCar_simplification_level];
|
||||
if (gNet_mode != eNet_mode_none && gNet_players[gIt_or_fox].car == the_car) {
|
||||
distance_from_camera = 0.f;
|
||||
}
|
||||
for (i = 0; the_car->car_actor_count > i; i++) {
|
||||
for (i = 0; i < the_car->car_actor_count; i++) {
|
||||
if (the_car->car_model_actors[i].min_distance_squared <= distance_from_camera) {
|
||||
SwitchCarActor(the_car, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (the_car->screen_material) {
|
||||
if (the_car->screen_material != NULL) {
|
||||
the_material = NULL;
|
||||
if (the_car->last_special_volume && the_car->last_special_volume->screen_material) {
|
||||
if (gAction_replay_mode && the_car->last_special_volume == gDefault_water_spec_vol) {
|
||||
if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) {
|
||||
the_material = gProgram_state.standard_screen_fog;
|
||||
} else if (gProgram_state.current_depth_effect.sky_texture) {
|
||||
the_material = gProgram_state.standard_screen;
|
||||
} else {
|
||||
the_material = gProgram_state.standard_screen_dark;
|
||||
}
|
||||
} else {
|
||||
if (the_car->last_special_volume != NULL && the_car->last_special_volume->screen_material != NULL) {
|
||||
if (!gAction_replay_mode && the_car->last_special_volume != gDefault_water_spec_vol) {
|
||||
the_material = the_car->last_special_volume->screen_material;
|
||||
} else if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) {
|
||||
the_material = gProgram_state.standard_screen_fog;
|
||||
} else if (gProgram_state.current_depth_effect.sky_texture != NULL) {
|
||||
the_material = gProgram_state.standard_screen;
|
||||
} else {
|
||||
the_material = gProgram_state.standard_screen_dark;
|
||||
}
|
||||
} else if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) {
|
||||
the_material = gProgram_state.standard_screen_fog;
|
||||
} else if (gProgram_state.current_depth_effect.sky_texture) {
|
||||
the_material = gProgram_state.standard_screen;
|
||||
} else {
|
||||
the_material = gProgram_state.standard_screen_dark;
|
||||
if (gProgram_state.current_depth_effect.type == eDepth_effect_fog) {
|
||||
the_material = gProgram_state.standard_screen_fog;
|
||||
} else if (gProgram_state.current_depth_effect.sky_texture != NULL) {
|
||||
the_material = gProgram_state.standard_screen;
|
||||
} else {
|
||||
the_material = gProgram_state.standard_screen_dark;
|
||||
}
|
||||
}
|
||||
update_mat = 0;
|
||||
if (the_material && the_car->screen_material_source != the_material) {
|
||||
if (the_material != NULL && the_car->screen_material_source != the_material) {
|
||||
the_car->screen_material->flags = the_material->flags;
|
||||
the_car->screen_material->ka = the_material->ka;
|
||||
the_car->screen_material->kd = the_material->kd;
|
||||
|
@ -4424,15 +4412,15 @@ void MungeCarGraphics(tU32 pFrame_period) {
|
|||
the_car->screen_material_source = the_material;
|
||||
update_mat = 1;
|
||||
}
|
||||
if (the_car->screen_material->colour_map) {
|
||||
the_car->screen_material->map_transform.m[2][0] = fmod(car_x, 1.0);
|
||||
the_car->screen_material->map_transform.m[2][1] = fmod(car_z, 1.0);
|
||||
if (the_car->screen_material->colour_map != NULL) {
|
||||
the_car->screen_material->map_transform.m[2][0] = fmodf(car_x, 1.f);
|
||||
the_car->screen_material->map_transform.m[2][1] = fmodf(car_z, 1.f);
|
||||
if (!update_mat) {
|
||||
BrMaterialUpdate(the_car->screen_material, 1u);
|
||||
BrMaterialUpdate(the_car->screen_material, BR_MATU_MAP_TRANSFORM);
|
||||
}
|
||||
}
|
||||
if (update_mat) {
|
||||
BrMaterialUpdate(the_car->screen_material, 0x7FFFu);
|
||||
BrMaterialUpdate(the_car->screen_material, BR_MATU_ALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1673,7 +1673,7 @@ void MungeWindscreen(br_model* pModel) {
|
|||
for (i = 0; i < pModel->nfaces; i++) {
|
||||
if (!face->material
|
||||
|| (face->material->identifier
|
||||
&& gSource_screen_mat && !strcmp(face->material->identifier, gSource_screen_mat->identifier))) {
|
||||
&& gSource_screen_mat != NULL && !strcmp(face->material->identifier, gSource_screen_mat->identifier))) {
|
||||
face->material = gDestn_screen_mat;
|
||||
}
|
||||
face++;
|
||||
|
@ -1730,9 +1730,9 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
LOG_TRACE("(\"%s\", %d, %p, %d, \"%s\", %p)", pCar_name, pDriver, pCar_spec, pOwner, pDriver_name, pStorage_space);
|
||||
|
||||
if (pDriver == eDriver_local_human) {
|
||||
if (!strcmp(gProgram_state.car_name, pCar_name))
|
||||
if (strcmp(gProgram_state.car_name, pCar_name) == 0)
|
||||
return;
|
||||
if (gProgram_state.car_name[0]) {
|
||||
if (gProgram_state.car_name[0] != '\0') {
|
||||
DisposeCar(&gProgram_state.current_car, gProgram_state.current_car.index);
|
||||
ClearOutStorageSpace(&gOur_car_storage_space);
|
||||
}
|
||||
|
@ -1780,19 +1780,20 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
PathCat(the_path, the_path, "CARS");
|
||||
PathCat(the_path, the_path, gBasic_car_names[0]);
|
||||
g = DRfopen(the_path, "rt");
|
||||
if (g == NULL)
|
||||
if (g == NULL) {
|
||||
FatalError(kFatalError_OpenResolutionDependentFile);
|
||||
}
|
||||
}
|
||||
GetAString(f, s);
|
||||
strcpy(pCar_spec->name, s);
|
||||
if (strcmp(s, pCar_name) != 0)
|
||||
if (strcmp(s, pCar_name) != 0) {
|
||||
FatalError(kFatalError_FileCorrupt_S, pCar_name);
|
||||
}
|
||||
if (*pDriver_name != '\0') {
|
||||
strncpy(pCar_spec->driver_name, pDriver_name, sizeof(pCar_spec->driver_name));
|
||||
pCar_spec->driver_name[31] = 0;
|
||||
memcpy(pCar_spec->driver_name, pDriver_name, sizeof(pCar_spec->driver_name));
|
||||
pCar_spec->driver_name[sizeof(pCar_spec->driver_name) - 1] = '\0';
|
||||
} else {
|
||||
pCar_spec->driver_name[0] = 'X';
|
||||
pCar_spec->driver_name[1] = 0;
|
||||
strcpy(pCar_spec->driver_name, "X");
|
||||
}
|
||||
pCar_spec->can_be_stolen = 0;
|
||||
pCar_spec->has_been_stolen = 0;
|
||||
|
@ -1810,7 +1811,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
GetALineAndDontArgue(g, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
if (gAusterity_mode) {
|
||||
pCar_spec->cockpit_images[j] = 0;
|
||||
pCar_spec->cockpit_images[j] = NULL;
|
||||
} else {
|
||||
the_image = LoadPixelmap(str);
|
||||
if (the_image == NULL)
|
||||
|
@ -1923,8 +1924,8 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
pCar_spec->prat_cam_bottom = LoadPixelmap(str);
|
||||
PossibleService();
|
||||
for (j = 0; j < COUNT_OF(pCar_spec->damage_units); ++j) {
|
||||
if (j == 2) {
|
||||
pCar_spec->damage_units[2].images = 0;
|
||||
if (j == eDamage_driver) {
|
||||
pCar_spec->damage_units[eDamage_driver].images = NULL;
|
||||
} else {
|
||||
GetALineAndDontArgue(g, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
|
@ -1987,14 +1988,14 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
GetALineAndDontArgue(h, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%d", &pCar_spec->power_ups[i].number_of_parts);
|
||||
for (j = 0; pCar_spec->power_ups[i].number_of_parts > j; ++j) {
|
||||
for (j = 0; j < pCar_spec->power_ups[i].number_of_parts; j++) {
|
||||
GetALineAndDontArgue(h, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%d", &pCar_spec->power_ups[i].info[j].rank_required);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
strcpy(pCar_spec->power_ups[i].info[j].part_name, str);
|
||||
pCar_spec->power_ups[i].info[j].data_ptr = NULL;
|
||||
for (k = 0; k < 3; ++k) {
|
||||
for (k = 0; k < COUNT_OF(pCar_spec->power_ups[i].info[j].prices); k++) {
|
||||
str = strtok(NULL, "\t ,/");
|
||||
sscanf(str, "%d", &pCar_spec->power_ups[i].info[j].prices[k]);
|
||||
}
|
||||
|
@ -2017,15 +2018,15 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
pCar_spec->red_line = 8000;
|
||||
}
|
||||
PossibleService();
|
||||
GetThreeInts(f, pCar_spec->engine_noises, &pCar_spec->engine_noises[1], &pCar_spec->engine_noises[2]);
|
||||
GetThreeInts(f, &pCar_spec->engine_noises[0], &pCar_spec->engine_noises[1], &pCar_spec->engine_noises[2]);
|
||||
GetAString(f, s);
|
||||
pCar_spec->can_be_stolen = strcmp(s, "stealworthy") == 0;
|
||||
GetDamageProgram(f, pCar_spec, 0);
|
||||
GetDamageProgram(f, pCar_spec, 1);
|
||||
GetDamageProgram(f, pCar_spec, 2);
|
||||
GetDamageProgram(f, pCar_spec, 3);
|
||||
GetDamageProgram(f, pCar_spec, 4);
|
||||
GetDamageProgram(f, pCar_spec, 5);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_top);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_bottom);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_left);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_right);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_front);
|
||||
GetDamageProgram(f, pCar_spec, eImpact_back);
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
strcpy(pCar_spec->grid_icon_names[0], str);
|
||||
|
@ -2033,7 +2034,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
strcpy(pCar_spec->grid_icon_names[1], str);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
strcpy(pCar_spec->grid_icon_names[2], str);
|
||||
pCar_spec->grid_icon_image = 0;
|
||||
pCar_spec->grid_icon_image = NULL;
|
||||
if (gAusterity_mode) {
|
||||
LoadSomePixelmaps(pStorage_space, f);
|
||||
SkipNLines(f);
|
||||
|
@ -2065,12 +2066,12 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
|
||||
number_of_floorpans = 5;
|
||||
for (i = old_material_count; i < pStorage_space->materials_count; i++) {
|
||||
if (pStorage_space->materials[i] && pStorage_space->materials[i]->colour_map) {
|
||||
pStorage_space->materials[i]->flags |= (BR_MATF_LIGHT | BR_MATF_PRELIT | BR_MATF_SMOOTH);
|
||||
if (pStorage_space->materials[i] != NULL && pStorage_space->materials[i]->colour_map != NULL) {
|
||||
pStorage_space->materials[i]->flags |= BR_MATF_LIGHT | BR_MATF_PRELIT | BR_MATF_SMOOTH;
|
||||
if (pStorage_space->materials[i]->flags & BR_MATF_TWO_SIDED) {
|
||||
its_a_floorpan = 0;
|
||||
for (j = 0; j < number_of_floorpans; j++) {
|
||||
if (!strcmp(gFloorpan_names[j], pStorage_space->materials[i]->identifier)) {
|
||||
if (strcmp(gFloorpan_names[j], pStorage_space->materials[i]->identifier) == 0) {
|
||||
its_a_floorpan = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -2078,7 +2079,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
if (!its_a_floorpan) {
|
||||
pStorage_space->materials[i]->user = DOUBLESIDED_USER_FLAG;
|
||||
}
|
||||
pStorage_space->materials[i]->flags &= 0xFFFFEFFF;
|
||||
pStorage_space->materials[i]->flags &= ~BR_MATF_TWO_SIDED;
|
||||
}
|
||||
pStorage_space->materials[i]->index_shade = gShade_list[0];
|
||||
BrMaterialUpdate(pStorage_space->materials[i], BR_MATU_ALL);
|
||||
|
@ -2090,7 +2091,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
if (pDriver == eDriver_local_human) {
|
||||
pCar_spec->car_master_actor = gSelf;
|
||||
} else {
|
||||
pCar_spec->car_master_actor = BrActorAllocate(0, NULL);
|
||||
pCar_spec->car_master_actor = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
BrActorAdd(gNon_track_actor, pCar_spec->car_master_actor);
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
|
@ -2102,20 +2103,21 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%f", &temp_float);
|
||||
if (temp_float < 0.0 && pDriver != eDriver_local_human) {
|
||||
if (temp_float < 0.f && pDriver != eDriver_local_human) {
|
||||
FreeUpBonnetModels(&pStorage_space->models[old_model_count], pStorage_space->models_count - old_model_count);
|
||||
pCar_spec->car_actor_count--;
|
||||
break;
|
||||
}
|
||||
if (temp_float >= 1.0)
|
||||
if (temp_float >= 1.f) {
|
||||
pCar_spec->car_model_actors[i].min_distance_squared = temp_float * temp_float;
|
||||
else
|
||||
} else {
|
||||
pCar_spec->car_model_actors[i].min_distance_squared = temp_float;
|
||||
}
|
||||
str = strtok(NULL, "\t ,/");
|
||||
PathCat(the_path, gApplication_path, "ACTORS");
|
||||
PathCat(the_path, the_path, str);
|
||||
pCar_spec->car_model_actors[i].actor = BrActorLoad(the_path);
|
||||
if (!pCar_spec->car_model_actors[i].actor) {
|
||||
if (pCar_spec->car_model_actors[i].actor == NULL) {
|
||||
FatalError(kFatalError_LoadCarActor);
|
||||
}
|
||||
LinkModelsToActor(
|
||||
|
@ -2127,18 +2129,18 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
SetModelFlags(pStorage_space->models[j], pOwner);
|
||||
}
|
||||
BrActorAdd(pCar_spec->car_master_actor, pCar_spec->car_model_actors[i].actor);
|
||||
if (pCar_spec->car_model_actors[i].min_distance_squared == 0.0) {
|
||||
if (pCar_spec->car_model_actors[i].min_distance_squared == 0.f) {
|
||||
pCar_spec->principal_car_actor = i;
|
||||
}
|
||||
}
|
||||
if (pDriver != eDriver_local_human && pCar_spec->car_model_actors[pCar_spec->car_actor_count - 1].min_distance_squared < 0.0) {
|
||||
if (pDriver != eDriver_local_human && pCar_spec->car_model_actors[pCar_spec->car_actor_count - 1].min_distance_squared < 0.f) {
|
||||
SwitchCarActor(pCar_spec, pCar_spec->car_actor_count - 2);
|
||||
} else {
|
||||
SwitchCarActor(pCar_spec, pCar_spec->car_actor_count - 1);
|
||||
}
|
||||
GetAString(f, s);
|
||||
pCar_spec->screen_material = BrMaterialFind(s);
|
||||
if (pCar_spec->screen_material) {
|
||||
if (pCar_spec->screen_material != NULL) {
|
||||
gSource_screen_mat = pCar_spec->screen_material;
|
||||
pCar_spec->screen_material = DRMaterialClone(pCar_spec->screen_material);
|
||||
gDestn_screen_mat = pCar_spec->screen_material;
|
||||
|
@ -2147,12 +2149,13 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
gDestn_screen_mat = NULL;
|
||||
}
|
||||
pCar_spec->screen_material_source = NULL;
|
||||
if (gDestn_screen_mat)
|
||||
if (gDestn_screen_mat != NULL) {
|
||||
MungeWindscreen(pCar_spec->car_model_actors[pCar_spec->principal_car_actor].actor->model);
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%d", &pCar_spec->number_of_steerable_wheels);
|
||||
for (i = 0; pCar_spec->number_of_steerable_wheels > i; ++i) {
|
||||
for (i = 0; i < pCar_spec->number_of_steerable_wheels; i++) {
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%d", &pCar_spec->steering_ref[i]);
|
||||
|
@ -2160,7 +2163,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (i = 0; i < COUNT_OF(pCar_spec->lf_sus_ref); i++) {
|
||||
sscanf(str, "%d", &pCar_spec->lf_sus_ref[i]);
|
||||
AddRefOffset(&pCar_spec->lf_sus_ref[i]);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
|
@ -2168,21 +2171,21 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
PossibleService();
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (i = 0; i < COUNT_OF(pCar_spec->rf_sus_ref); i++) {
|
||||
sscanf(str, "%d", &pCar_spec->rf_sus_ref[i]);
|
||||
AddRefOffset(&pCar_spec->rf_sus_ref[i]);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (i = 0; i < COUNT_OF(pCar_spec->lr_sus_ref); i++) {
|
||||
sscanf(str, "%d", &pCar_spec->lr_sus_ref[i]);
|
||||
AddRefOffset(&pCar_spec->lr_sus_ref[i]);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (i = 0; i < COUNT_OF(pCar_spec->rr_sus_ref); i++) {
|
||||
sscanf(str, "%d", &pCar_spec->rr_sus_ref[i]);
|
||||
AddRefOffset(&pCar_spec->rr_sus_ref[i]);
|
||||
str = strtok(NULL, "\t ,/");
|
||||
|
@ -2216,7 +2219,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%f", &temp_float);
|
||||
pCar_spec->non_driven_wheels_circum = temp_float * 2.0 * 3.141592653589793;
|
||||
pCar_spec->car_model_variable = pDriver != 4;
|
||||
pCar_spec->car_model_variable = pDriver != eDriver_local_human;
|
||||
PossibleService();
|
||||
GetALineAndDontArgue(f, s);
|
||||
AddFunkotronics(f, pOwner, gGroove_funk_offset);
|
||||
|
@ -2226,9 +2229,8 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
PossibleService();
|
||||
// Jeff: Bug? pOwner will never be 3. Probably this was supposed to be "pDriver == eDriver_net_human"?
|
||||
if (pOwner == 3 || gAusterity_mode) {
|
||||
temp_float = SkipCrushData(f);
|
||||
pCar_spec->car_model_actors[i].crush_data.softness_factor = temp_float;
|
||||
pCar_spec->car_model_actors[i].crush_data.crush_points = 0;
|
||||
pCar_spec->car_model_actors[i].crush_data.softness_factor = SkipCrushData(f);
|
||||
pCar_spec->car_model_actors[i].crush_data.crush_points = NULL;
|
||||
pCar_spec->car_model_actors[i].crush_data.number_of_crush_points = 0;
|
||||
} else {
|
||||
ReadCrushData(f, &pCar_spec->car_model_actors[i].crush_data);
|
||||
|
@ -2249,7 +2251,7 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
SkipCrushData(f);
|
||||
}
|
||||
PossibleService();
|
||||
for (i = 0; i < COUNT_OF(gWheel_actor_names); ++i) {
|
||||
for (i = 0; i < COUNT_OF(gWheel_actor_names); i++) {
|
||||
pCar_spec->wheel_actors[i] = DRActorFindRecurse(pCar_spec->car_master_actor, gWheel_actor_names[i]);
|
||||
}
|
||||
PossibleService();
|
||||
|
@ -2268,8 +2270,9 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
|
|||
} else {
|
||||
initial_vertex = GetAnInt(f);
|
||||
pCar_spec->fire_vertex[i] = initial_vertex;
|
||||
if (pCar_spec->fire_vertex[i] >= vertex_total)
|
||||
if (pCar_spec->fire_vertex[i] >= vertex_total) {
|
||||
pCar_spec->fire_vertex[i] = 0;
|
||||
}
|
||||
v_num = 0;
|
||||
for (group = 0; group < V11MODEL(model)->ngroups; group++) {
|
||||
for (v = 0; v < V11MODEL(model)->groups[group].nvertices; v++) {
|
||||
|
@ -2845,9 +2848,6 @@ int GetALineAndInterpretCommand(FILE* pF, char** pString_list, int pCount) {
|
|||
GetALineAndDontArgue(pF, s);
|
||||
|
||||
str = strtok(s, "\t ,/");
|
||||
if (pCount <= 0) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < pCount; i++) {
|
||||
if (strcmp(str, pString_list[i]) == 0) {
|
||||
return i;
|
||||
|
|
|
@ -86,11 +86,11 @@ void CalculateFrameRate() {
|
|||
if (new_time != last_time) {
|
||||
new_rate = 10000u / (new_time - last_time);
|
||||
gFrame_rate = new_rate;
|
||||
for (i = 0; i < 30; ++i) {
|
||||
for (i = 0; i < COUNT_OF(last_rates); ++i) {
|
||||
gFrame_rate += last_rates[i];
|
||||
}
|
||||
gFrame_rate /= 31;
|
||||
for (i = 0; i < 29; i++) {
|
||||
gFrame_rate /= COUNT_OF(last_rates) + 1;
|
||||
for (i = 0; i < COUNT_OF(last_rates) - 1; i++) {
|
||||
last_rates[i] = last_rates[i + 1];
|
||||
}
|
||||
last_rates[29] = new_rate;
|
||||
|
|
|
@ -172,11 +172,11 @@ tS16 ReallocExtraPathSections(int pHow_many_then) {
|
|||
LOG_TRACE("(%d)", pHow_many_then);
|
||||
|
||||
first_new_section = -1;
|
||||
if (pHow_many_then) {
|
||||
if (pHow_many_then != 0) {
|
||||
first_new_section = gProgram_state.AI_vehicles.number_of_path_sections;
|
||||
new_sections = BrMemAllocate(sizeof(tPath_section) * (pHow_many_then + gProgram_state.AI_vehicles.number_of_path_sections), kMem_oppo_new_sections);
|
||||
memcpy(new_sections, gProgram_state.AI_vehicles.path_sections, sizeof(tPath_section) * gProgram_state.AI_vehicles.number_of_path_sections);
|
||||
if (gProgram_state.AI_vehicles.path_sections) {
|
||||
if (gProgram_state.AI_vehicles.path_sections != NULL) {
|
||||
BrMemFree(gProgram_state.AI_vehicles.path_sections);
|
||||
}
|
||||
gProgram_state.AI_vehicles.number_of_path_sections += pHow_many_then;
|
||||
|
@ -199,7 +199,7 @@ int PointVisibleFromHere(br_vector3* pFrom, br_vector3* pTo) {
|
|||
LOG_TRACE("(%p, %p)", pFrom, pTo);
|
||||
|
||||
BrVector3Sub(&dir, pTo, pFrom);
|
||||
from = *pFrom;
|
||||
BrVector3Copy(&from, pFrom);
|
||||
from.v[1] += 0.15f;
|
||||
dir.v[1] += 0.15f;
|
||||
FindFace(&from, &dir, &norm, &t, &material);
|
||||
|
@ -343,7 +343,7 @@ void DeadStopCar(tCar_spec* pCar_spec) {
|
|||
pCar_spec->acc_force = 0.f;
|
||||
pCar_spec->brake_force = 0.f;
|
||||
pCar_spec->curvature = 0.f;
|
||||
pCar_spec->gear = 0.f;
|
||||
pCar_spec->gear = 0;
|
||||
pCar_spec->revs = 0.f;
|
||||
BrVector3Set(&pCar_spec->omega, 0.f, 0.f, 0.f);
|
||||
BrVector3Set(&pCar_spec->v, 0.f, 0.f, 0.f);
|
||||
|
@ -576,7 +576,7 @@ int SearchForSection(tRoute_section* pTemp_store, tRoute_section* pPerm_store, i
|
|||
distance_so_far = gProgram_state.AI_vehicles.path_sections[section_no].length + pDistance_so_far;
|
||||
|
||||
if (pTarget_section == section_no && distance_so_far < shortest_dist) {
|
||||
shortest_dist = gProgram_state.AI_vehicles.path_sections[section_no].length + pDistance_so_far;
|
||||
shortest_dist = distance_so_far;
|
||||
*pNum_of_perm_store_sections = pDepth + 1;
|
||||
memcpy(pPerm_store, pTemp_store, sizeof(tRoute_section) * *pNum_of_perm_store_sections);
|
||||
// dword_530DD4 = ++routes_found
|
||||
|
@ -648,7 +648,7 @@ void CalcGetNearPlayerRoute(tOpponent_spec* pOpponent_spec, tCar_spec* pPlayer)
|
|||
dr_dprintf("%s: CalcGetNearPlayerRoute() - In loop; our section #%d, player's section #%d", pOpponent_spec->car_spec->driver_name, temp_store[0].section_no, players_section);
|
||||
gSFS_count++;
|
||||
gSFS_cycles_this_time = 0;
|
||||
SearchForSection(temp_store, perm_store, &num_of_perm_store_sections, players_section, 1, 0.0, pOpponent_spec);
|
||||
SearchForSection(temp_store, perm_store, &num_of_perm_store_sections, players_section, 1, 0.f, pOpponent_spec);
|
||||
gSFS_total_cycles += gSFS_cycles_this_time;
|
||||
if (gSFS_max_cycles < gSFS_cycles_this_time) {
|
||||
gSFS_max_cycles = gSFS_cycles_this_time;
|
||||
|
@ -745,7 +745,7 @@ int ShiftOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec, int pPlaces) {
|
|||
if (pOpponent_spec->nnext_sections <= pPlaces) {
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; COUNT_OF(pOpponent_spec->next_sections) - pPlaces > i; i++) {
|
||||
for (i = 0; i < COUNT_OF(pOpponent_spec->next_sections) - pPlaces; i++) {
|
||||
pOpponent_spec->next_sections[i].section_no = pOpponent_spec->next_sections[pPlaces + i].section_no;
|
||||
pOpponent_spec->next_sections[i].direction = pOpponent_spec->next_sections[pPlaces + i].direction;
|
||||
}
|
||||
|
|
|
@ -863,12 +863,12 @@ float ControlBoundFunkGroovePlus(int pSlot_number, float pValue) {
|
|||
LOG_TRACE("(%d, %f)", pSlot_number, pValue);
|
||||
|
||||
if (pSlot_number < 0) {
|
||||
return 0.0f;
|
||||
return 0.f;
|
||||
}
|
||||
if (pSlot_number >= COUNT_OF(gGroove_funk_bindings)) {
|
||||
FatalError(kFatalError_UsedRefNumGrooveFunkOutOfRange);
|
||||
}
|
||||
*gGroove_funk_bindings[pSlot_number] = fmod(*gGroove_funk_bindings[pSlot_number] + pValue, 1.0);
|
||||
*gGroove_funk_bindings[pSlot_number] = fmodf(*gGroove_funk_bindings[pSlot_number] + pValue, 1.f);
|
||||
return *gGroove_funk_bindings[pSlot_number];
|
||||
}
|
||||
|
||||
|
@ -878,8 +878,8 @@ void ShiftBoundGrooveFunks(char* pStart, char* pEnd, ptrdiff_t pDelta) {
|
|||
LOG_TRACE("(\"%s\", \"%s\", %d)", pStart, pEnd, pDelta);
|
||||
|
||||
for (i = 0; i < COUNT_OF(gGroove_funk_bindings); i++) {
|
||||
if ((char*)gGroove_funk_bindings[i] >= (char*)pStart && (char*)gGroove_funk_bindings[i] < (char*)pEnd) {
|
||||
gGroove_funk_bindings[i] = (float*)((char*)gGroove_funk_bindings[i] + (pDelta & ~(size_t)3)); // original code is (pDelta & 0xFFFFFFFC) but this caused problems;
|
||||
if (pStart <= (char*)gGroove_funk_bindings[i] && (char*)gGroove_funk_bindings[i] < pEnd) {
|
||||
gGroove_funk_bindings[i] = (float*)((char*)gGroove_funk_bindings[i] + (pDelta & ~(sizeof(void*) - 1))); // original code is (pDelta & 0xFFFFFFFC) but this caused problems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -988,7 +988,7 @@ br_uint_32 AddProximities(br_actor* pActor, br_material* pMat, tFunkotronic_spec
|
|||
int i;
|
||||
LOG_TRACE("(%p, %p, %p)", pActor, pMat, pThe_funk);
|
||||
|
||||
if (pActor->model) {
|
||||
if (pActor->model != NULL) {
|
||||
if (pThe_funk->material == pMat) {
|
||||
AddProximityVertexXYZ(
|
||||
pActor->model->bounds.min.v[0],
|
||||
|
@ -1031,14 +1031,13 @@ br_uint_32 AddProximities(br_actor* pActor, br_material* pMat, tFunkotronic_spec
|
|||
pActor->model->bounds.max.v[2],
|
||||
pThe_funk);
|
||||
} else {
|
||||
the_face = pActor->model->faces;
|
||||
for (i = 0; i < pActor->model->nfaces; i++) {
|
||||
the_face = &pActor->model->faces[i];
|
||||
if (pThe_funk->material == the_face->material) {
|
||||
AddProximityVertex(&pActor->model->vertices[the_face->vertices[0]].p, pThe_funk);
|
||||
AddProximityVertex(&pActor->model->vertices[the_face->vertices[1]].p, pThe_funk);
|
||||
AddProximityVertex(&pActor->model->vertices[the_face->vertices[2]].p, pThe_funk);
|
||||
}
|
||||
the_face++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1388,7 +1387,7 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
|
||||
first_time = 1;
|
||||
|
||||
while (!(feof(pF))) {
|
||||
while (!feof(pF)) {
|
||||
PossibleService();
|
||||
GetALineAndDontArgue(pF, s);
|
||||
if (strcmp(s, "END OF GROOVE") == 0) {
|
||||
|
@ -1407,12 +1406,12 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
the_groove->owner = pOwner;
|
||||
the_groove->actor = DRActorFindRecurse(pParent_actor, str);
|
||||
|
||||
if (!the_groove->actor) {
|
||||
if (the_groove->actor == NULL) {
|
||||
if (!pAllowed_to_be_absent && !gAusterity_mode) {
|
||||
FatalError(kFatalError_FindActorUsedByGroovidelicFile_S, str);
|
||||
}
|
||||
if (!gGroove_by_proxy_actor) {
|
||||
gGroove_by_proxy_actor = BrActorAllocate(BR_ACTOR_MODEL, 0);
|
||||
if (gGroove_by_proxy_actor == NULL) {
|
||||
gGroove_by_proxy_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
|
||||
gGroove_by_proxy_actor->model = LoadModel("PROXY.DAT");
|
||||
BrModelAdd(gGroove_by_proxy_actor->model);
|
||||
BrActorAdd(gDont_render_actor, gGroove_by_proxy_actor);
|
||||
|
@ -1421,11 +1420,11 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
}
|
||||
the_groove->lollipop_mode = GetALineAndInterpretCommand(pF, gLollipop_names, COUNT_OF(gLollipop_names));
|
||||
the_groove->mode = GetALineAndInterpretCommand(pF, gGroove_nature_names, COUNT_OF(gGroove_nature_names));
|
||||
;
|
||||
|
||||
the_groove->path_type = GetALineAndInterpretCommand(pF, gGroove_path_names, COUNT_OF(gGroove_path_names));
|
||||
the_groove->path_interrupt_status = 0;
|
||||
the_groove->object_interrupt_status = 0;
|
||||
if (the_groove->path_type != -1) {
|
||||
the_groove->path_interrupt_status = eInterrupt_none;
|
||||
the_groove->object_interrupt_status = eInterrupt_none;
|
||||
if (the_groove->path_type != eGroove_path_none) {
|
||||
the_groove->path_mode = GetALineAndInterpretCommand(pF, gFunk_move_names, COUNT_OF(gFunk_move_names));
|
||||
}
|
||||
|
||||
|
@ -1469,20 +1468,15 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
&the_groove->path_data.straight_info.centre.v[1],
|
||||
&the_groove->path_data.straight_info.centre.v[2]);
|
||||
|
||||
if (the_groove->path_data.straight_info.centre.v[0] == 0.0
|
||||
&& the_groove->path_data.straight_info.centre.v[1] == 0.0
|
||||
&& the_groove->path_data.straight_info.centre.v[2] == 0.0) {
|
||||
|
||||
the_groove->path_data.straight_info.centre.v[0] = the_groove->actor->t.t.translate.t.v[0];
|
||||
the_groove->path_data.straight_info.centre.v[1] = the_groove->actor->t.t.translate.t.v[1];
|
||||
the_groove->path_data.straight_info.centre.v[2] = the_groove->actor->t.t.translate.t.v[2];
|
||||
if (Vector3IsZero(&the_groove->path_data.straight_info.centre)) {
|
||||
BrVector3Copy(&the_groove->path_data.straight_info.centre,
|
||||
&the_groove->actor->t.t.translate.t);
|
||||
}
|
||||
if (the_groove->path_mode != eMove_controlled && the_groove->path_mode != eMove_absolute) {
|
||||
if (the_groove->path_mode == eMove_controlled || the_groove->path_mode == eMove_absolute) {
|
||||
AddFunkGrooveBinding(pRef_offset + GetAnInt(pF), &the_groove->path_data.straight_info.period);
|
||||
} else {
|
||||
x_0 = GetAFloat(pF);
|
||||
the_groove->path_data.straight_info.period = x_0 == 0.0f ? 0.0f : 1000.0 / x_0;
|
||||
} else {
|
||||
i = GetAnInt(pF);
|
||||
AddFunkGrooveBinding(i + pRef_offset, &the_groove->path_data.straight_info.period);
|
||||
}
|
||||
GetThreeFloats(
|
||||
pF,
|
||||
|
@ -1491,18 +1485,17 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
&the_groove->path_data.straight_info.z_delta);
|
||||
}
|
||||
the_groove->object_type = GetALineAndInterpretCommand(pF, gGroove_object_names, COUNT_OF(gGroove_object_names));
|
||||
the_groove->object_position = the_groove->actor->t.t.translate.t;
|
||||
if (the_groove->object_type != -1) {
|
||||
BrVector3Copy(&the_groove->object_position, &the_groove->actor->t.t.translate.t);
|
||||
if (the_groove->object_type != eGroove_object_none) {
|
||||
the_groove->object_mode = GetALineAndInterpretCommand(pF, gFunk_move_names, COUNT_OF(gFunk_move_names));
|
||||
}
|
||||
switch (the_groove->object_type) {
|
||||
case eGroove_object_spin:
|
||||
if (the_groove->object_mode != eMove_controlled && the_groove->object_mode != eMove_absolute) {
|
||||
if (the_groove->object_mode == eMove_controlled || the_groove->object_mode == eMove_absolute) {
|
||||
AddFunkGrooveBinding(pRef_offset + GetAnInt(pF), &the_groove->object_data.spin_info.period);
|
||||
} else {
|
||||
x_0 = GetAFloat(pF);
|
||||
the_groove->object_data.spin_info.period = (x_0 == 0.0f) ? 0.0f : (1000.0f / x_0);
|
||||
} else {
|
||||
d_0 = GetAnInt(pF);
|
||||
AddFunkGrooveBinding(d_0 + pRef_offset, &the_groove->object_data.spin_info.period);
|
||||
}
|
||||
GetThreeFloats(pF,
|
||||
&the_groove->object_centre.v[0],
|
||||
|
@ -1512,8 +1505,7 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
break;
|
||||
case eGroove_object_rock:
|
||||
if (the_groove->object_mode == eMove_controlled || the_groove->object_mode == eMove_absolute) {
|
||||
d_0 = GetAnInt(pF);
|
||||
AddFunkGrooveBinding(d_0 + pRef_offset, &the_groove->object_data.rock_info.period);
|
||||
AddFunkGrooveBinding(pRef_offset + GetAnInt(pF), &the_groove->object_data.rock_info.period);
|
||||
} else {
|
||||
x_0 = GetAFloat(pF);
|
||||
the_groove->object_data.rock_info.period = (x_0 == 0.0f) ? 0.0f : (1000.0f / x_0);
|
||||
|
@ -1526,22 +1518,22 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
the_groove->object_data.rock_info.max_angle = GetAFloat(pF);
|
||||
break;
|
||||
case eGroove_object_throb:
|
||||
if (the_groove->object_mode != eMove_controlled && the_groove->object_mode != eMove_absolute) {
|
||||
if (the_groove->object_mode == eMove_controlled || the_groove->object_mode == eMove_absolute) {
|
||||
GetThreeInts(pF, &d_0, &d_1, &d_2);
|
||||
if (d_0 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_0, &the_groove->object_data.throb_info.x_period);
|
||||
}
|
||||
if (d_1 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_1, &the_groove->object_data.throb_info.y_period);
|
||||
}
|
||||
if (d_2 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_2, &the_groove->object_data.throb_info.z_period);
|
||||
}
|
||||
} else {
|
||||
GetThreeFloats(pF, &x_0, &x_1, &x_2);
|
||||
the_groove->object_data.throb_info.x_period = (x_0 == 0.0f) ? 0.0f : (1000.0f / x_0);
|
||||
the_groove->object_data.throb_info.y_period = (x_1 == 0.0f) ? 0.0f : (1000.0f / x_1);
|
||||
the_groove->object_data.throb_info.z_period = (x_2 == 0.0f) ? 0.0f : (1000.0f / x_2);
|
||||
} else {
|
||||
GetThreeInts(pF, &d_0, &d_1, &d_2);
|
||||
if (d_0 >= 0) {
|
||||
AddFunkGrooveBinding(d_0 + pRef_offset, &the_groove->object_data.throb_info.x_period);
|
||||
}
|
||||
if (d_1 >= 0) {
|
||||
AddFunkGrooveBinding(d_1 + pRef_offset, &the_groove->object_data.throb_info.y_period);
|
||||
}
|
||||
if (d_2 >= 0) {
|
||||
AddFunkGrooveBinding(d_2 + pRef_offset, &the_groove->object_data.throb_info.z_period);
|
||||
}
|
||||
}
|
||||
GetThreeFloats(pF,
|
||||
&the_groove->object_centre.v[0],
|
||||
|
@ -1554,22 +1546,22 @@ void AddGroovidelics(FILE* pF, int pOwner, br_actor* pParent_actor, int pRef_off
|
|||
&the_groove->object_data.throb_info.z_magnitude);
|
||||
break;
|
||||
case eGroove_object_shear:
|
||||
if (the_groove->object_mode != eMove_controlled && the_groove->object_mode != eMove_absolute) {
|
||||
if (the_groove->object_mode == eMove_controlled || the_groove->object_mode == eMove_absolute) {
|
||||
GetThreeInts(pF, &d_0, &d_1, &d_2);
|
||||
if (d_0 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_0, &the_groove->object_data.shear_info.x_period);
|
||||
}
|
||||
if (d_1 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_1, &the_groove->object_data.shear_info.y_period);
|
||||
}
|
||||
if (d_2 >= 0) {
|
||||
AddFunkGrooveBinding(pRef_offset + d_2, &the_groove->object_data.shear_info.z_period);
|
||||
}
|
||||
} else {
|
||||
GetThreeFloats(pF, &x_0, &x_1, &x_2);
|
||||
the_groove->object_data.shear_info.x_period = x_0 == 0.0f ? 0.0f : 1000.0 / x_0;
|
||||
the_groove->object_data.shear_info.y_period = x_1 == 0.0f ? 0.0f : 1000.0 / x_1;
|
||||
the_groove->object_data.shear_info.z_period = x_2 == 0.0f ? 0.0f : 1000.0 / x_2;
|
||||
} else {
|
||||
GetThreeInts(pF, &d_0, &d_1, &d_2);
|
||||
if (d_0 >= 0) {
|
||||
AddFunkGrooveBinding(d_0 + pRef_offset, &the_groove->object_data.shear_info.x_period);
|
||||
}
|
||||
if (d_1 >= 0) {
|
||||
AddFunkGrooveBinding(d_1 + pRef_offset, &the_groove->object_data.shear_info.y_period);
|
||||
}
|
||||
if (d_2 >= 0) {
|
||||
AddFunkGrooveBinding(d_2 + pRef_offset, &the_groove->object_data.shear_info.z_period);
|
||||
}
|
||||
}
|
||||
GetThreeFloats(pF,
|
||||
&the_groove->object_centre.v[0],
|
||||
|
@ -3807,14 +3799,8 @@ void GrooveThisDelic(tGroovidelic_spec* pGroove, tU32 pTime, int pInterrupt_it)
|
|||
the_actor = pGroove->actor;
|
||||
pGroove->done_this_frame = 1;
|
||||
CalcActorGlobalPos(&actor_pos, the_actor);
|
||||
if (pGroove->mode == eGroove_mode_distance) {
|
||||
if (PointOutOfSight(&actor_pos, gYon_squared)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (PointOutOfSight(&actor_pos, 36.0)) {
|
||||
return;
|
||||
}
|
||||
if (PointOutOfSight(&actor_pos, pGroove->mode == eGroove_mode_distance ? gYon_squared : 36.f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
the_mat = &the_actor->t.t.mat;
|
||||
|
@ -3824,34 +3810,28 @@ void GrooveThisDelic(tGroovidelic_spec* pGroove, tU32 pTime, int pInterrupt_it)
|
|||
|| pGroove->path_mode == eMove_absolute) {
|
||||
PathGrooveBastard(pGroove, pTime, the_mat, pInterrupt_it);
|
||||
}
|
||||
if ((pGroove->object_type != -1 || pGroove->lollipop_mode != -1)
|
||||
if ((pGroove->object_type != eGroove_object_none || pGroove->lollipop_mode != eLollipop_none)
|
||||
&& (!gAction_replay_mode
|
||||
|| !ReplayIsPaused()
|
||||
|| pGroove->object_mode == eMove_controlled
|
||||
|| pGroove->object_mode == eMove_absolute)) {
|
||||
the_mat->m[0][0] = 1.0;
|
||||
the_actor->t.t.mat.m[0][1] = 0.0;
|
||||
the_actor->t.t.mat.m[0][2] = 0.0;
|
||||
the_actor->t.t.mat.m[1][0] = 0.0;
|
||||
the_actor->t.t.mat.m[1][1] = 1.0;
|
||||
the_actor->t.t.mat.m[1][2] = 0.0;
|
||||
the_actor->t.t.mat.m[2][0] = 0.0;
|
||||
the_actor->t.t.mat.m[2][1] = 0.0;
|
||||
the_actor->t.t.mat.m[2][2] = 1.0;
|
||||
the_actor->t.t.mat.m[3][0] = -pGroove->object_centre.v[0];
|
||||
the_actor->t.t.mat.m[3][1] = -pGroove->object_centre.v[1];
|
||||
the_actor->t.t.mat.m[3][2] = -pGroove->object_centre.v[2];
|
||||
the_mat->m[0][0] = 1.0f;
|
||||
the_mat->m[0][1] = 0.0f;
|
||||
the_mat->m[0][2] = 0.0f;
|
||||
the_mat->m[1][0] = 0.0f;
|
||||
the_mat->m[1][1] = 1.0f;
|
||||
the_mat->m[1][2] = 0.0f;
|
||||
the_mat->m[2][0] = 0.0f;
|
||||
the_mat->m[2][1] = 0.0f;
|
||||
the_mat->m[2][2] = 1.0f;
|
||||
the_mat->m[3][0] = -pGroove->object_centre.v[0];
|
||||
the_mat->m[3][1] = -pGroove->object_centre.v[1];
|
||||
the_mat->m[3][2] = -pGroove->object_centre.v[2];
|
||||
ObjectGrooveBastard(pGroove, pTime, the_mat, pInterrupt_it);
|
||||
the_actor->t.t.mat.m[3][0] = the_actor->t.t.mat.m[3][0]
|
||||
+ pGroove->object_position.v[0]
|
||||
+ pGroove->object_centre.v[0];
|
||||
the_actor->t.t.mat.m[3][1] = pGroove->object_position.v[1]
|
||||
+ the_actor->t.t.mat.m[3][1]
|
||||
+ pGroove->object_centre.v[1];
|
||||
the_actor->t.t.mat.m[3][2] = pGroove->object_position.v[2]
|
||||
+ pGroove->object_centre.v[2]
|
||||
+ the_actor->t.t.mat.m[3][2];
|
||||
if (pGroove->lollipop_mode != -1) {
|
||||
the_actor->t.t.mat.m[3][0] += pGroove->object_position.v[0] + pGroove->object_centre.v[0];
|
||||
the_actor->t.t.mat.m[3][1] += pGroove->object_position.v[1] + pGroove->object_centre.v[1];
|
||||
the_actor->t.t.mat.m[3][2] += pGroove->object_position.v[2] + pGroove->object_centre.v[2];
|
||||
if (pGroove->lollipop_mode != eLollipop_none) {
|
||||
LollipopizeActor(pGroove->actor, &gCamera_to_world, pGroove->lollipop_mode);
|
||||
}
|
||||
}
|
||||
|
@ -3873,17 +3853,16 @@ void GrooveThoseDelics() {
|
|||
float f_the_time;
|
||||
LOG_TRACE("()");
|
||||
|
||||
if (gGroovidelics_array) {
|
||||
if (gGroovidelics_array != NULL) {
|
||||
f_the_time = (double)GetTotalTime();
|
||||
gPrevious_groove_times[1] = gPrevious_groove_times[0];
|
||||
gPrevious_groove_times[0] = f_the_time;
|
||||
|
||||
the_groove = gGroovidelics_array;
|
||||
for (i = 0; i < gGroovidelics_array_size; i++) {
|
||||
the_groove = &gGroovidelics_array[i];
|
||||
if (the_groove->owner != -999 && !the_groove->done_this_frame) {
|
||||
GrooveThisDelic(the_groove, f_the_time, 0);
|
||||
}
|
||||
the_groove++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue