3dfx info mode (#443)

* adds third debug info mode added in 3dfx patch

* fix DRPixelmapHasZeros
This commit is contained in:
Dethrace Engineering Department 2025-04-02 12:34:42 +13:00 committed by GitHub
parent 08ff6f20c0
commit 2e31fc6956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 53 additions and 17 deletions

View File

@ -67,7 +67,13 @@ void ToggleInfo(void) {
} else {
gInfo_on = !gInfo_on;
if (gInfo_on) {
#ifdef DETHRACE_3DFX_PATCH
if (PDKeyDown(KEY_SHIFT_ANY)) {
gInfo_mode = (gInfo_mode + 1) % 3;
}
#else
gInfo_mode = PDKeyDown(KEY_SHIFT_ANY);
#endif
}
}
}
@ -146,17 +152,8 @@ void MungeHeadups(void) {
gMr_odo = (double)gFrame_period * gProgram_state.current_car.speedo_speed * WORLD_SCALE / 1600.0 + gMr_odo;
if (gInfo_on) {
bearing = 360.0 - FastScalarArcTan2(gCamera_to_world.m[0][2], gCamera_to_world.m[2][2]);
if (gInfo_mode) {
sprintf(
the_text,
"P'cam: curr=%d, ambi=%d, pend=%d Car: c=%+.3f, a=%+.3f, b=%+.3f",
PratcamGetCurrent(),
PratcamGetAmbient(),
PratcamGetPending(),
gCar_to_view->curvature,
gCar_to_view->acc_force,
gCar_to_view->brake_force);
} else {
switch (gInfo_mode) {
case 0:
sprintf(
the_text,
"%d.%d (%.3f, %.3f, %.3f) %.0f, %.0f, MILES=%.2f",
@ -168,6 +165,45 @@ void MungeHeadups(void) {
gCamera_to_horiz_angle,
bearing,
gMr_odo);
break;
case 1:
sprintf(
the_text,
"P'cam: curr=%d, ambi=%d, pend=%d Car: c=%+.3f, a=%+.3f, b=%+.3f",
PratcamGetCurrent(),
PratcamGetAmbient(),
PratcamGetPending(),
gCar_to_view->curvature,
gCar_to_view->acc_force,
gCar_to_view->brake_force);
break;
#ifdef DETHRACE_3DFX_PATCH
case 2:
nearby = SomeNearbyMaterial();
strcpy(the_text, nearby->identifier);
if (nearby->colour_map != NULL) {
sprintf(&the_text[strlen(the_text)], " %s", nearby->colour_map->identifier);
user = (tPixelmap_user_data*)nearby->colour_map->user;
if (user != NULL) {
sprintf(&the_text[strlen(the_text)], " %dx%d to", user->orig_width, user->orig_height);
} else {
sprintf(&the_text[strlen(the_text)], " %dx%d", nearby->colour_map->width, nearby->colour_map->height);
}
if ((nearby->flags & BR_MATF_MAP_INTERPOLATION)) {
strcat(the_text, " bilinear");
} else {
strcat(the_text, " nobilinear");
}
if ((nearby->flags & BR_MATF_MAP_ANTIALIASING) && nearby->colour_map != NULL && nearby->colour_map->mip_offset != 0) {
strcat(the_text, " mipmap");
} else {
strcat(the_text, " nomipmap");
}
break;
}
#endif
default:
break;
}
ChangeHeadupText(gProgram_state.frame_rate_headup, the_text);
} else {

View File

@ -2443,9 +2443,8 @@ void InitOpponents(tRace_info* pRace_info) {
gHead_on_cos_value = cosf(.5235668f);
gAcme_frame_count = 0;
gProgram_state.current_car.no_of_processes_recording_my_trail = 0;
rank_dependent_difficulty = (101.f - (gCurrent_race.suggested_rank < 10 ? .5f : (float)gCurrent_race.suggested_rank));
// FIXME: unsure about gBig_bang
gBig_bang = 70.f - (float)(3 * rank_dependent_difficulty + 10 * gProgram_state.skill_level) * gOpponent_nastyness_frigger;
rank_dependent_difficulty = (101.f - (gCurrent_race.suggested_rank < 10 ? .5f : gCurrent_race.suggested_rank)) / 10.0f;
gBig_bang = 70.f - (3 * rank_dependent_difficulty + 10 * gProgram_state.skill_level) * gOpponent_nastyness_frigger;
gIn_view_distance = gCamera_yon + 10.f;
if (gCamera_yon + 10.f <= 45.f) {
gIn_view_distance = 45.f;

View File

@ -1735,8 +1735,7 @@ void GlorifyMaterial(br_material** pArray, int pCount) {
if (gInterpolate_textures) {
// use linear texture filtering unless we have a "nobilinear" flag or the texture has transparent parts
if ((e == NULL || (e->flags & ExceptionFlag_NoBilinear) == 0)
&& !DRPixelmapHasZeros(pArray[i]->colour_map)) {
if ((e == NULL || (e->flags & ExceptionFlag_NoBilinear) == 0) && !DRPixelmapHasZeros(pArray[i]->colour_map)) {
pArray[i]->flags |= BR_MATF_MAP_INTERPOLATION;
}
}

View File

@ -1946,11 +1946,13 @@ int DRPixelmapHasZeros(br_pixelmap* pm) {
if (pm->flags & BR_PMF_NO_ACCESS) {
return 1;
}
row_ptr = (char*)pm->pixels + (pm->row_bytes * pm->base_y) + pm->base_x;
for (y = 0; y < pm->height; y++) {
pp = row_ptr;
for (x = 0; x < pm->width; x++) {
if (!pp)
// found a zero (transparent) pixel?
if (*pp == 0)
return 1;
pp++;
}