Subversion Repositories Games.Carmageddon

Rev

Rev 18 | 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 "constants.h"
5
#include "constants.h"
6
#include "errors.h"
6
#include "errors.h"
7
#include "globvars.h"
7
#include "globvars.h"
8
#include "globvrpb.h"
8
#include "globvrpb.h"
9
#include "graphics.h"
9
#include "graphics.h"
Line 478... Line 478...
478
 
478
 
479
    the_map = BrPixelmapLoad(pFile_name);
479
    the_map = BrPixelmapLoad(pFile_name);
480
    if (the_map != NULL) {
480
    if (the_map != NULL) {
481
        the_map->origin_x = 0;
481
        the_map->origin_x = 0;
482
        the_map->origin_y = 0;
482
        the_map->origin_y = 0;
-
 
483
#if !defined(DETHRACE_FIX_BUGS)
483
        the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1);
484
        the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1);
-
 
485
#endif
484
    }
486
    }
485
    return the_map;
487
    return the_map;
486
}
488
}
487
 
489
 
488
// IDA: br_uint_32 __usercall DRPixelmapLoadMany@<EAX>(char *pFile_name@<EAX>, br_pixelmap **pPixelmaps@<EDX>, br_uint_16 pNum@<EBX>)
490
// IDA: br_uint_32 __usercall DRPixelmapLoadMany@<EAX>(char *pFile_name@<EAX>, br_pixelmap **pPixelmaps@<EDX>, br_uint_16 pNum@<EBX>)
Line 493... Line 495...
493
    //br_uint_8 lobyte; // Pierre-Marie Baty -- unused variable
495
    //br_uint_8 lobyte; // Pierre-Marie Baty -- unused variable
494
    LOG_TRACE("(\"%s\", %p, %d)", pFile_name, pPixelmaps, pNum);
496
    LOG_TRACE("(\"%s\", %p, %d)", pFile_name, pPixelmaps, pNum);
495
    number_loaded = BrPixelmapLoadMany(pFile_name, pPixelmaps, pNum);
497
    number_loaded = BrPixelmapLoadMany(pFile_name, pPixelmaps, pNum);
496
    for (i = 0; i < number_loaded; i++) {
498
    for (i = 0; i < number_loaded; i++) {
497
        the_map = pPixelmaps[i];
499
        the_map = pPixelmaps[i];
-
 
500
#if !defined(DETHRACE_FIX_BUGS)
498
        the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1);
501
        the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1);
-
 
502
#endif
499
        the_map->base_x = 0;
503
        the_map->base_x = 0;
500
        the_map->base_y = 0;
504
        the_map->base_y = 0;
501
    }
505
    }
502
    return number_loaded;
506
    return number_loaded;
503
}
507
}
Line 512... Line 516...
512
        SoundService();
516
        SoundService();
513
    }
517
    }
514
}
518
}
515
 
519
 
516
// IDA: br_uint_32 __usercall DRActorEnumRecurse@<EAX>(br_actor *pActor@<EAX>, br_actor_enum_cbfn *callback@<EDX>, void *arg@<EBX>)
520
// IDA: br_uint_32 __usercall DRActorEnumRecurse@<EAX>(br_actor *pActor@<EAX>, br_actor_enum_cbfn *callback@<EDX>, void *arg@<EBX>)
517
br_uintptr_t DRActorEnumRecurse(br_actor* pActor, br_actor_enum_cbfn* callback, void* arg) {
521
intptr_t DRActorEnumRecurse(br_actor* pActor, br_actor_enum_cbfn* callback, void* arg) {
518
    br_uintptr_t result;
522
    intptr_t result;
519
 
523
 
520
    result = callback(pActor, arg);
524
    result = callback(pActor, arg);
521
    if (result != 0) {
525
    if (result != 0) {
522
        return result;
526
        return result;
523
    }
527
    }
Line 529... Line 533...
529
    }
533
    }
530
    return 0;
534
    return 0;
531
}
535
}
532
 
536
 
533
// IDA: br_uint_32 __cdecl CompareActorID(br_actor *pActor, void *pArg)
537
// IDA: br_uint_32 __cdecl CompareActorID(br_actor *pActor, void *pArg)
534
br_uintptr_t CompareActorID(br_actor* pActor, void* pArg) {
538
intptr_t CompareActorID(br_actor* pActor, void* pArg) {
535
    LOG_TRACE("(%p, %p)", pActor, pArg);
539
    LOG_TRACE("(%p, %p)", pActor, pArg);
536
 
540
 
537
    if (pActor->identifier && !strcmp(pActor->identifier, (const char*)pArg)) {
541
    if (pActor->identifier && !strcmp(pActor->identifier, (const char*)pArg)) {
538
        return (intptr_t)pActor;
542
        return (intptr_t)pActor;
539
    } else {
543
    } else {
Line 1151... Line 1155...
1151
    }
1155
    }
1152
}
1156
}
1153
 
1157
 
1154
// IDA: void __cdecl SubsStringJob(char *pStr, ...)
1158
// IDA: void __cdecl SubsStringJob(char *pStr, ...)
1155
void SubsStringJob(char* pStr, ...) {
1159
void SubsStringJob(char* pStr, ...) {
1156
    char* sub_str;
1160
    //char* sub_str; // Pierre-Marie Baty -- unused variable
1157
    char temp_str[256];
1161
    //char temp_str[256]; // Pierre-Marie Baty -- unused variable
1158
    char* sub_pt;
1162
    //char* sub_pt; // Pierre-Marie Baty -- unused variable
1159
    va_list ap;
1163
    //va_list ap; // Pierre-Marie Baty -- unused variable
1160
    LOG_TRACE("(\"%s\")", pStr);
1164
    LOG_TRACE("(\"%s\")", pStr);
1161
 
-
 
1162
    va_start(ap, pStr);
-
 
1163
    for (;;) {
-
 
1164
        sub_pt = strchr(pStr, '%');
-
 
1165
        if (sub_pt == NULL) {
-
 
1166
            va_end(ap);
1165
    NOT_IMPLEMENTED();
1167
            return;
-
 
1168
        }
-
 
1169
        sub_str = va_arg(ap, char *);
-
 
1170
        StripCR(sub_str);
-
 
1171
        strcpy(temp_str, &sub_pt[1]);
-
 
1172
        strcpy(sub_pt, sub_str);
-
 
1173
        strcat(pStr, temp_str);
-
 
1174
    }
-
 
1175
}
1166
}
1176
 
1167
 
1177
// IDA: void __usercall DecodeLine2(char *pS@<EAX>)
1168
// IDA: void __usercall DecodeLine2(char *pS@<EAX>)
1178
void DecodeLine2(char* pS) {
1169
void DecodeLine2(char* pS) {
1179
    int len;
1170
    int len;