Rev 11 | 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 " |
4 | #include "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) |
- | |
484 | the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1); |
483 | the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1); |
485 | #endif |
- | |
486 | } |
484 | } |
487 | return the_map; |
485 | return the_map; |
488 | } |
486 | } |
489 | 487 | ||
490 | // IDA: br_uint_32 __usercall DRPixelmapLoadMany@<EAX>(char *pFile_name@<EAX>, br_pixelmap **pPixelmaps@<EDX>, br_uint_16 pNum@<EBX>) |
488 | // IDA: br_uint_32 __usercall DRPixelmapLoadMany@<EAX>(char *pFile_name@<EAX>, br_pixelmap **pPixelmaps@<EDX>, br_uint_16 pNum@<EBX>) |
Line 495... | Line 493... | ||
495 | //br_uint_8 lobyte; // Pierre-Marie Baty -- unused variable |
493 | //br_uint_8 lobyte; // Pierre-Marie Baty -- unused variable |
496 | LOG_TRACE("(\"%s\", %p, %d)", pFile_name, pPixelmaps, pNum); |
494 | LOG_TRACE("(\"%s\", %p, %d)", pFile_name, pPixelmaps, pNum); |
497 | number_loaded = BrPixelmapLoadMany(pFile_name, pPixelmaps, pNum); |
495 | number_loaded = BrPixelmapLoadMany(pFile_name, pPixelmaps, pNum); |
498 | for (i = 0; i < number_loaded; i++) { |
496 | for (i = 0; i < number_loaded; i++) { |
499 | the_map = pPixelmaps[i]; |
497 | the_map = pPixelmaps[i]; |
500 | #if !defined(DETHRACE_FIX_BUGS) |
- | |
501 | the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1); |
498 | the_map->row_bytes = (the_map->row_bytes + sizeof(int32_t) - 1) & ~(sizeof(int32_t) - 1); |
502 | #endif |
- | |
503 | the_map->base_x = 0; |
499 | the_map->base_x = 0; |
504 | the_map->base_y = 0; |
500 | the_map->base_y = 0; |
505 | } |
501 | } |
506 | return number_loaded; |
502 | return number_loaded; |
507 | } |
503 | } |
508 | 504 | ||
509 | // IDA: void __usercall WaitFor(tU32 pDelay@<EAX>) |
505 | // IDA: void __usercall WaitFor(tU32 pDelay@<EAX>) |
510 | void WaitFor(tU32 pDelay) { |
506 | void WaitFor(tU32 pDelay) { |
511 | tU32 start_time; |
507 | tU32 start_time; |
512 | LOG_TRACE("(%d)", pDelay); |
508 | LOG_TRACE("(%d)", pDelay); |
513 | 509 | ||
514 | start_time = PDGetTotalTime(); |
510 | start_time = PDGetTotalTime(); |
515 | while (start_time + pDelay < (tU32) PDGetTotalTime()) { // Pierre-Marie Baty -- added type cast |
511 | while (start_time + pDelay < (tU32) PDGetTotalTime()) { // Pierre-Marie Baty -- added type cast |
516 | SoundService(); |
512 | SoundService(); |
517 | } |
513 | } |
518 | } |
514 | } |
519 | 515 | ||
520 | // IDA: br_uint_32 __usercall DRActorEnumRecurse@<EAX>(br_actor *pActor@<EAX>, br_actor_enum_cbfn *callback@<EDX>, void *arg@<EBX>) |
516 | // IDA: br_uint_32 __usercall DRActorEnumRecurse@<EAX>(br_actor *pActor@<EAX>, br_actor_enum_cbfn *callback@<EDX>, void *arg@<EBX>) |
521 |
|
517 | br_uintptr_t DRActorEnumRecurse(br_actor* pActor, br_actor_enum_cbfn* callback, void* arg) { |
522 |
|
518 | br_uintptr_t result; |
523 | 519 | ||
524 | result = callback(pActor, arg); |
520 | result = callback(pActor, arg); |
525 | if (result != 0) { |
521 | if (result != 0) { |
526 | return result; |
522 | return result; |
527 | } |
523 | } |
528 | for (pActor = pActor->children; pActor != NULL; pActor = pActor->next) { |
524 | for (pActor = pActor->children; pActor != NULL; pActor = pActor->next) { |
529 | result = DRActorEnumRecurse(pActor, callback, arg); |
525 | result = DRActorEnumRecurse(pActor, callback, arg); |
530 | if (result != 0) { |
526 | if (result != 0) { |
531 | return result; |
527 | return result; |
532 | } |
528 | } |
533 | } |
529 | } |
534 | return 0; |
530 | return 0; |
535 | } |
531 | } |
536 | 532 | ||
537 | // IDA: br_uint_32 __cdecl CompareActorID(br_actor *pActor, void *pArg) |
533 | // IDA: br_uint_32 __cdecl CompareActorID(br_actor *pActor, void *pArg) |
538 |
|
534 | br_uintptr_t CompareActorID(br_actor* pActor, void* pArg) { |
539 | LOG_TRACE("(%p, %p)", pActor, pArg); |
535 | LOG_TRACE("(%p, %p)", pActor, pArg); |
540 | 536 | ||
541 | if (pActor->identifier && !strcmp(pActor->identifier, (const char*)pArg)) { |
537 | if (pActor->identifier && !strcmp(pActor->identifier, (const char*)pArg)) { |
542 | return (intptr_t)pActor; |
538 | return (intptr_t)pActor; |
543 | } else { |
539 | } else { |
Line 564... | Line 560... | ||
564 | if (result != 0) { |
560 | if (result != 0) { |
565 | return result; |
561 | return result; |
566 | } |
562 | } |
567 | for (pActor = pActor->children; pActor != NULL; pActor = pActor->next) { |
563 | for (pActor = pActor->children; pActor != NULL; pActor = pActor->next) { |
568 | result = DRActorEnumRecurseWithMat(pActor, pMat, pCall_back, pArg); |
564 | result = DRActorEnumRecurseWithMat(pActor, pMat, pCall_back, pArg); |
569 | if (result != 0) { |
565 | if (result != 0) { |
570 | return result; |
566 | return result; |
571 | } |
567 | } |
572 | } |
568 | } |
573 | return 0; |
569 | return 0; |
574 | } |
570 | } |
575 | 571 | ||
576 | // IDA: br_uint_32 __usercall DRActorEnumRecurseWithTrans@<EAX>(br_actor *pActor@<EAX>, br_matrix34 *pMatrix@<EDX>, br_uint_32 (*pCall_back)(br_actor*, br_matrix34*, void*)@<EBX>, void *pArg@<ECX>) |
572 | // IDA: br_uint_32 __usercall DRActorEnumRecurseWithTrans@<EAX>(br_actor *pActor@<EAX>, br_matrix34 *pMatrix@<EDX>, br_uint_32 (*pCall_back)(br_actor*, br_matrix34*, void*)@<EBX>, void *pArg@<ECX>) |
577 | br_uint_32 DRActorEnumRecurseWithTrans(br_actor* pActor, br_matrix34* pMatrix, br_uint_32 (*pCall_back)(br_actor*, br_matrix34*, void*), void* pArg) { |
573 | br_uint_32 DRActorEnumRecurseWithTrans(br_actor* pActor, br_matrix34* pMatrix, br_uint_32 (*pCall_back)(br_actor*, br_matrix34*, void*), void* pArg) { |
578 | br_uint_32 result; |
574 | br_uint_32 result; |
Line 986... | Line 982... | ||
986 | time = PDGetTotalTime(); |
982 | time = PDGetTotalTime(); |
987 | if (time - last_service > MIN_SERVICE_INTERVAL && !gProgram_state.racing) { |
983 | if (time - last_service > MIN_SERVICE_INTERVAL && !gProgram_state.racing) { |
988 | SoundService(); |
984 | SoundService(); |
989 | NetService(gProgram_state.racing); |
985 | NetService(gProgram_state.racing); |
990 | last_service = time; |
986 | last_service = time; |
991 | } |
987 | } |
992 | } |
988 | } |
993 | 989 | ||
994 | // IDA: void __usercall DRMatrix34TApplyP(br_vector3 *pA@<EAX>, br_vector3 *pB@<EDX>, br_matrix34 *pC@<EBX>) |
990 | // IDA: void __usercall DRMatrix34TApplyP(br_vector3 *pA@<EAX>, br_vector3 *pB@<EDX>, br_matrix34 *pC@<EBX>) |
995 | void DRMatrix34TApplyP(br_vector3* pA, br_vector3* pB, br_matrix34* pC) { |
991 | void DRMatrix34TApplyP(br_vector3* pA, br_vector3* pB, br_matrix34* pC) { |
996 | br_scalar t1; |
992 | br_scalar t1; |
997 | br_scalar t2; |
993 | br_scalar t2; |
998 | br_scalar t3; |
994 | br_scalar t3; |
Line 1155... | Line 1151... | ||
1155 | } |
1151 | } |
1156 | } |
1152 | } |
1157 | 1153 | ||
1158 | // IDA: void __cdecl SubsStringJob(char *pStr, ...) |
1154 | // IDA: void __cdecl SubsStringJob(char *pStr, ...) |
1159 | void SubsStringJob(char* pStr, ...) { |
1155 | void SubsStringJob(char* pStr, ...) { |
1160 |
|
1156 | char* sub_str; |
1161 |
|
1157 | char temp_str[256]; |
1162 |
|
1158 | char* sub_pt; |
1163 |
|
1159 | va_list ap; |
1164 | LOG_TRACE("(\"%s\")", pStr); |
1160 | LOG_TRACE("(\"%s\")", pStr); |
- | 1161 | ||
- | 1162 | va_start(ap, pStr); |
|
- | 1163 | for (;;) { |
|
- | 1164 | sub_pt = strchr(pStr, '%'); |
|
- | 1165 | if (sub_pt == NULL) { |
|
1165 |
|
1166 | va_end(ap); |
- | 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 | } |
|
1166 | } |
1175 | } |
1167 | 1176 | ||
1168 | // IDA: void __usercall DecodeLine2(char *pS@<EAX>) |
1177 | // IDA: void __usercall DecodeLine2(char *pS@<EAX>) |
1169 | void DecodeLine2(char* pS) { |
1178 | void DecodeLine2(char* pS) { |
1170 | int len; |
1179 | int len; |