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

Cops car is not rendered on damage gallery #208

Closed
rafalp opened this issue Oct 9, 2022 · 2 comments · Fixed by #235
Closed

Cops car is not rendered on damage gallery #208

rafalp opened this issue Oct 9, 2022 · 2 comments · Fixed by #235

Comments

@rafalp
Copy link

rafalp commented Oct 9, 2022

Finish race with cop car and go to damage gallery, it won't be displayed:

Zrzut ekranu 2022-10-10 o 00 04 51

Zrzut ekranu 2022-10-10 o 00 04 53

@zear
Copy link
Collaborator

zear commented Nov 8, 2022

@madebr @dethrace-labs
This happens, because BrModelUpdate nukes vertices for the Squad Car's model:

if (!(model->flags & BR_MODF_UPDATEABLE)) {
if (model->faces) {
BrResFree(model->faces);
}
if (model->vertices) {
BrResFree(model->vertices);
}
model->vertices = NULL;
model->nfaces = 0;
model->nvertices = 0;
model->faces = NULL;
}

Squad Car is a bit special, because it is the only car that doesn't have damage model [1]. As such, the code deals with it explicitly:

if (pOwner == eDriver_net_human || gAusterity_mode) {
if ((pModel->flags & BR_MODF_UPDATEABLE) != 0) {
pModel->flags &= ~(BR_MODF_KEEP_ORIGINAL | BR_MODF_UPDATEABLE);
BrModelUpdate(pModel, BR_MODU_ALL);
}

Here pOwner == 3 does not mean tDriver type value, but rather the opponent number of the Squad Car.

Same wrong assumptions are made here:

// Jeff: Bug? pOwner will never be 3. Probably this was supposed to be "pDriver == eDriver_net_human"?
if (pOwner == 3 || gAusterity_mode) {

and here:
if (pCar_spec->driver < eDriver_net_human || gAusterity_mode) {

I don't have the OG assembly to confirm where this issue stems from, but it sounds like the BR_MODF_KEEP_ORIGINAL | BR_MODF_UPDATEABLE flags should not have been removed for this model.

When said flags are forcibly set, Squad Car ends up being rendered correctly:
apc

[1] https://carmageddon.fandom.com/wiki/The_Cops

@madebr
Copy link
Collaborator

madebr commented Nov 8, 2022

This is also the behavior in OG (tested with CARM95.EXE).
A fix can be added using preprocessor define DETHRACE_FIX_BUGS.
DUMP0000

zear added a commit to zear/dethrace that referenced this issue Nov 8, 2022
Fix OG bug, where APC car would have its vertices and faces removed,
preventing it from being rendered in the wreck gallery.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
dethrace-labs pushed a commit that referenced this issue Nov 9, 2022
Fix OG bug, where APC car would have its vertices and faces removed,
preventing it from being rendered in the wreck gallery.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants