Subversion Repositories Games.Carmageddon

Rev

Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 20
Line 2... Line 2...
2
#include <stdlib.h>
2
#include <stdlib.h>
3
 
3
 
4
#include "brender.h"
4
#include "brender/brender.h"
5
#include "brucetrk.h"
5
#include "brucetrk.h"
6
#include "car.h"
6
#include "car.h"
7
#include "depth.h"
7
#include "depth.h"
8
#include "displays.h"
8
#include "displays.h"
9
#include "drmem.h"
9
#include "drmem.h"
10
#include "errors.h"
10
#include "errors.h"
11
#include "finteray.h"
11
#include "finteray.h"
12
#include "flicplay.h"
12
#include "flicplay.h"
13
#include "formats.h"
-
 
14
#include "globvars.h"
13
#include "globvars.h"
15
#include "globvrpb.h"
14
#include "globvrpb.h"
16
#include "graphics.h"
15
#include "graphics.h"
17
#include "harness/trace.h"
16
#include "harness/trace.h"
18
#include "input.h"
17
#include "input.h"
Line 1860... Line 1859...
1860
    LOG_TRACE("()");
1859
    LOG_TRACE("()");
1861
    NOT_IMPLEMENTED();
1860
    NOT_IMPLEMENTED();
1862
}
1861
}
1863
 
1862
 
1864
// IDA: br_uint_32 __cdecl ProcessFaceMaterials(br_actor *pActor, tPMFMCB pCallback)
1863
// IDA: br_uint_32 __cdecl ProcessFaceMaterials(br_actor *pActor, tPMFMCB pCallback)
1865
br_uintptr_t ProcessFaceMaterials(br_actor* pActor, tPMFMCB pCallback) {
1864
intptr_t ProcessFaceMaterials(br_actor* pActor, tPMFMCB pCallback) {
1866
    LOG_TRACE("(%p, %d)", pActor, pCallback);
1865
    LOG_TRACE("(%p, %d)", pActor, pCallback);
1867
 
1866
 
1868
    if (pActor->identifier == NULL || pActor->identifier[0] != '&') {
1867
    if (pActor->identifier == NULL || pActor->identifier[0] != '&') {
1869
        if (pActor->type == BR_ACTOR_MODEL && pActor->model != NULL) {
1868
        if (pActor->type == BR_ACTOR_MODEL && pActor->model != NULL) {
1870
            ProcessModelFaceMaterials(pActor->model, pCallback);
1869
            ProcessModelFaceMaterials(pActor->model, pCallback);
Line 2270... Line 2269...
2270
        ProcessFaceMaterials(gProgram_state.track_spec.the_actor, DisposeSuffixedMaterials);
2269
        ProcessFaceMaterials(gProgram_state.track_spec.the_actor, DisposeSuffixedMaterials);
2271
    }
2270
    }
2272
}
2271
}
2273
 
2272
 
2274
// IDA: br_uint_32 __cdecl SetAccessoryRenderingCB(br_actor *pActor, void *pFlag)
2273
// IDA: br_uint_32 __cdecl SetAccessoryRenderingCB(br_actor *pActor, void *pFlag)
2275
br_uintptr_t SetAccessoryRenderingCB(br_actor* pActor, void* pFlag) {
2274
intptr_t SetAccessoryRenderingCB(br_actor* pActor, void* pFlag) {
2276
    if (pActor->identifier && *pActor->identifier == '&') {
2275
    if (pActor->identifier && *pActor->identifier == '&') {
2277
        pActor->render_style = *(br_uint_8*)pFlag;
2276
        pActor->render_style = *(br_uint_8*)pFlag;
2278
    }
2277
    }
2279
    return 0;
2278
    return 0;
2280
}
2279
}
Line 2582... Line 2581...
2582
        if (gTrack_storage_space.models[i] && gTrack_storage_space.models[i]->flags & 0x82) {
2581
        if (gTrack_storage_space.models[i] && gTrack_storage_space.models[i]->flags & 0x82) {
2583
            gTrack_storage_space.models[i]->flags &= 0xFF7Du;
2582
            gTrack_storage_space.models[i]->flags &= 0xFF7Du;
2584
            for (group = 0; group < V11MODEL(gTrack_storage_space.models[i])->ngroups; group++) {
2583
            for (group = 0; group < V11MODEL(gTrack_storage_space.models[i])->ngroups; group++) {
2585
                int f = V11MODEL(gTrack_storage_space.models[i])->groups[group].face_user[0];
2584
                int f = V11MODEL(gTrack_storage_space.models[i])->groups[group].face_user[0];
2586
                material = gTrack_storage_space.models[i]->faces[f].material;
2585
                material = gTrack_storage_space.models[i]->faces[f].material;
2587
                V11MODEL(gTrack_storage_space.models[i])->groups[group].user = material;
2586
                V11MODEL(gTrack_storage_space.models[i])->groups[group].face_colours_material = material;
2588
                if (material && !material->index_shade) {
2587
                if (material && !material->index_shade) {
2589
                    material->index_shade = BrTableFind("DRRENDER.TAB");
2588
                    material->index_shade = BrTableFind("DRRENDER.TAB");
2590
                    BrMaterialUpdate(material, 0x7FFFu);
2589
                    BrMaterialUpdate(material, 0x7FFFu);
2591
                }
2590
                }
2592
            }
2591
            }
Line 2896... Line 2895...
2896
        LoadInKevStuff(NULL);
2895
        LoadInKevStuff(NULL);
2897
    } else {
2896
    } else {
2898
        LoadInKevStuff(f);
2897
        LoadInKevStuff(f);
2899
    }
2898
    }
2900
    if (gRace_file_version < 5) {
2899
    if (gRace_file_version < 5) {
2901
        gYon_multiplier = viewdistance_surmultiplier * 1.0; // Pierre-Marie Baty -- view distance surmultiplier addition
2900
        gYon_multiplier = viewdistance_surmultiplier * 1.0;
2902
    } else {
2901
    } else {
2903
        gYon_multiplier = viewdistance_surmultiplier * GetAScalar(f); // Pierre-Marie Baty -- view distance surmultiplier addition
2902
        gYon_multiplier = viewdistance_surmultiplier * GetAScalar(f);
2904
    }
2903
    }
2905
    GetAString(f, s);
2904
    GetAString(f, s);
2906
    if (strcmp(s, pFile_name) != 0) {
2905
    if (strcmp(s, pFile_name) != 0) {
2907
        FatalError(kFatalError_FileCorrupt_S, pFile_name);
2906
        FatalError(kFatalError_FileCorrupt_S, pFile_name);
2908
    }
2907
    }
2909
    fclose(f);
2908
    fclose(f);
2910
}
2909
}
2911
 
2910
 
2912
// IDA: br_uint_32 __cdecl RemoveBounds(br_actor *pActor, void *pArg)
2911
// IDA: br_uint_32 __cdecl RemoveBounds(br_actor *pActor, void *pArg)
2913
br_uintptr_t RemoveBounds(br_actor* pActor, void* pArg) {
2912
intptr_t RemoveBounds(br_actor* pActor, void* pArg) {
2914
    LOG_TRACE("(%p, %p)", pActor, pArg);
2913
    LOG_TRACE("(%p, %p)", pActor, pArg);
2915
 
2914
 
2916
    if (pActor->type == BR_ACTOR_BOUNDS || pActor->type == BR_ACTOR_BOUNDS_CORRECT) {
2915
    if (pActor->type == BR_ACTOR_BOUNDS || pActor->type == BR_ACTOR_BOUNDS_CORRECT) {
2917
        BrResFree(pActor->type_data);
2916
        BrResFree(pActor->type_data);
2918
        pActor->type_data = NULL;
2917
        pActor->type_data = NULL;
Line 4322... Line 4321...
4322
    if (pActor->model != NULL) {
4321
    if (pActor->model != NULL) {
4323
        strcat(s2, ".DAT");
4322
        strcat(s2, ".DAT");
4324
        new_model = BrModelAllocate(s2, pActor->model->nvertices, pActor->model->nfaces);
4323
        new_model = BrModelAllocate(s2, pActor->model->nvertices, pActor->model->nfaces);
4325
        memcpy(new_model->vertices, pActor->model->vertices, pActor->model->nvertices * sizeof(br_vertex));
4324
        memcpy(new_model->vertices, pActor->model->vertices, pActor->model->nvertices * sizeof(br_vertex));
4326
        memcpy(new_model->faces, pActor->model->faces, pActor->model->nfaces * sizeof(br_face));
4325
        memcpy(new_model->faces, pActor->model->faces, pActor->model->nfaces * sizeof(br_face));
4327
        new_model->flags |= BR_MODF_UPDATEABLE;
4326
        new_model->flags |= 0x80; // FIXME: unknown model flag
4328
        BrModelAdd(new_model);
4327
        BrModelAdd(new_model);
4329
        BrModelUpdate(new_model, BR_MODU_ALL);
4328
        BrModelUpdate(new_model, BR_MODU_ALL);
4330
        pActor->model = new_model;
4329
        pActor->model = new_model;
4331
        gAdditional_models[gNumber_of_additional_models] = new_model;
4330
        gAdditional_models[gNumber_of_additional_models] = new_model;
4332
        gNumber_of_additional_models++;
4331
        gNumber_of_additional_models++;
Line 4425... Line 4424...
4425
 
4424
 
4426
                gKnown_actor = gLast_actor;
4425
                gKnown_actor = gLast_actor;
4427
                BrVector3Copy(&gActor_centre, &gLast_actor->t.t.translate.t);
4426
                BrVector3Copy(&gActor_centre, &gLast_actor->t.t.translate.t);
4428
                DuplicateIfNotAmpersand(gLast_actor);
4427
                DuplicateIfNotAmpersand(gLast_actor);
4429
                UniquificateActorsName(gUniverse_actor, gLast_actor);
4428
                UniquificateActorsName(gUniverse_actor, gLast_actor);
4430
                gLast_actor->model->flags |= BR_MODF_UPDATEABLE;
4429
                gLast_actor->model->flags |= 0x80; // FIXME: unknown flag
4431
                if (gLast_actor->identifier == NULL || gLast_actor->identifier[0] == '&') {
4430
                if (gLast_actor->identifier == NULL || gLast_actor->identifier[0] == '&') {
4432
                    last_non_ampersand = gAdditional_actors;
4431
                    last_non_ampersand = gAdditional_actors;
4433
                    for (a = gAdditional_actors->children; a != NULL; a = a->next) {
4432
                    for (a = gAdditional_actors->children; a != NULL; a = a->next) {
4434
                        if (a->identifier != NULL && a->identifier[0] != '&') {
4433
                        if (a->identifier != NULL && a->identifier[0] != '&') {
4435
                            last_non_ampersand = a;
4434
                            last_non_ampersand = a;