Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement opponent edit functions #227

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions src/DETHRACE/common/car.c
Original file line number Diff line number Diff line change
Expand Up @@ -4527,33 +4527,60 @@ void ViewOpponent() {
// IDA: void __cdecl ToggleCarToCarCollisions()
void ToggleCarToCarCollisions() {
LOG_TRACE("()");
NOT_IMPLEMENTED();

gCar_car_collisions = !gCar_car_collisions;
if (gCar_car_collisions) {
NewTextHeadupSlot(4, 0, 3000, -4, "Car Car Collisions");
} else {
NewTextHeadupSlot(4, 0, 3000, -4, "Ghost Cars");
}
}

// IDA: void __cdecl SwapCar()
void SwapCar() {
LOG_TRACE("()");
NOT_IMPLEMENTED();
}

// IDA: void __cdecl AdjustDownForce()
void AdjustDownForce() {
char s[100];
tCar_spec* c;
LOG_TRACE("()");
NOT_IMPLEMENTED();

c = gCar_to_view;
c->down_force_speed += 50.f;
if (c->down_force_speed > 2000.f) {
c->down_force_speed = 50.f;
}
if (c->down_force_speed > 300.f) {
c->down_force_speed = 2000.0;
}
sprintf(s, "DownForceSpeed %f", c->down_force_speed);
NewTextHeadupSlot(4, 0, 1500, -4, s);
}

// IDA: void __cdecl FreezeMechanics()
void FreezeMechanics() {
LOG_TRACE("()");
NOT_IMPLEMENTED();

gFreeze_mechanics = !gFreeze_mechanics;
if (gFreeze_mechanics) {
NewTextHeadupSlot(4, 0, 3000, -4, "Mechanics Frozen");
} else {
NewTextHeadupSlot(4, 0, 3000, -4, "Thawed Mechanics");
}
}

// IDA: void __cdecl PutOpponentsInNeutral()
void PutOpponentsInNeutral() {
LOG_TRACE("()");
NOT_IMPLEMENTED();

gStop_opponents_moving = !gStop_opponents_moving;
if (gStop_opponents_moving == 0) {
NewTextHeadupSlot(4, 0, 3000, -4, "Opponents in neutral");
} else {
NewTextHeadupSlot(4, 0, 3000, -4, "Back in gear");
}
}

// IDA: void __cdecl SetPanningFieldOfView()
Expand Down
2 changes: 1 addition & 1 deletion src/DETHRACE/common/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ tEdit_func* gEdit_funcs[10][18][8] = {
// 1
{ ToggleOpponentProcessing, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
// 2
{ CopStartPointInfo, DeleteCopStartPoint, DropCopStartPoint, NULL /* sub_411E7F (empty func) */, NULL, NULL, NULL },
{ CopStartPointInfo, DeleteCopStartPoint, DropCopStartPoint, NULL, CycleCopStartPointType, NULL, NULL, NULL },
// 3
{ ToggleMellowOpponents, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
// 4
Expand Down
2 changes: 1 addition & 1 deletion src/DETHRACE/common/displays.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ int NewTextHeadupSlot2(int pSlot_index, int pFlash_rate, int pLifetime, int pFon
LOG_TRACE("(%d, %d, %d, %d, \"%s\", %d)", pSlot_index, pFlash_rate, pLifetime, pFont_index, pText, pQueue_it);

time = PDGetTotalTime();
if (pQueue_it && pSlot_index == 4 && (unsigned int)(time - gLast_centre_headup) < 1000) {
if (pQueue_it && pSlot_index == 4 && time - gLast_centre_headup < 1000) {
if (gQueued_headup_count == 4) {
KillOldestQueuedHeadup();
}
Expand Down
862 changes: 814 additions & 48 deletions src/DETHRACE/common/opponent.c

Large diffs are not rendered by default.

161 changes: 73 additions & 88 deletions src/DETHRACE/common/oppoproc.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/DETHRACE/pd/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int PDGetGorePassword(void);

void PDDisplayGoreworthiness(int pGory);

void PDEnterDebugger(char* pStr);
HARNESS_NORETURN void PDEnterDebugger(char* pStr);

// Added function
br_material* PDMissingMaterial(char* name);
Expand Down
2 changes: 1 addition & 1 deletion src/harness/io_platforms/sdl_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ tRenderer* Window_Create(char* title, int width, int height, int pRender_width,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);

if (window == NULL) {
LOG_PANIC("Failed to create window");
LOG_PANIC("Failed to create window. %s", SDL_GetError());
}

sdl_window_scale.x = ((float)pRender_width) / width;
Expand Down