Subversion Repositories Games.Carmageddon

Rev

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

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