Feature/load races (#31)
* loading races, powerups, opponents * runs all the way to end of initialization
This commit is contained in:
parent
77e404f141
commit
e54cf25a74
|
@ -132,7 +132,41 @@ int BrRegistryCount(br_registry* reg, char* pattern) {
|
|||
int BrRegistryEnum(br_registry* reg, char* pattern, br_enum_cbfn* callback, void* arg) {
|
||||
br_registry_entry* e;
|
||||
int r;
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
e = (br_registry_entry*)reg->list.tail;
|
||||
if (!pattern) {
|
||||
if (e->node.prev) {
|
||||
while (1) {
|
||||
r = callback(e->item, arg);
|
||||
if (r) {
|
||||
break;
|
||||
}
|
||||
e = (br_registry_entry*)e->node.prev;
|
||||
if (!e->node.prev) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!e->node.prev) {
|
||||
return 0;
|
||||
}
|
||||
while (1) {
|
||||
// as a char**, e->item[1] actually points to `identifier` field in a br_* struct etc
|
||||
if (BrNamePatternMatch(pattern, e->item[1])) {
|
||||
r = callback(e->item, arg);
|
||||
if (r) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
e = (br_registry_entry*)e->node.prev;
|
||||
if (!e->node.prev) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 1838
|
||||
|
|
|
@ -145,6 +145,9 @@ br_actor* BrActorAllocate(br_uint_8 type, void* type_data) {
|
|||
clip_plane->v[3] = 0;
|
||||
a->type_data = clip_plane;
|
||||
break;
|
||||
case BR_ACTOR_MODEL:
|
||||
// nothing to do
|
||||
break;
|
||||
default:
|
||||
LOG_WARN("Warning: Unknown type %d for BrActorAllocate", type);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void BrClipPlaneEnable(br_actor* c) {
|
|||
// Offset: 790
|
||||
// Size: 71
|
||||
void BrClipPlaneDisable(br_actor* c) {
|
||||
NOT_IMPLEMENTED();
|
||||
actorDisable(&v1db.enabled_clip_planes, c);
|
||||
}
|
||||
|
||||
// Offset: 882
|
||||
|
|
|
@ -75,7 +75,8 @@ br_uint_32 BrModelEnum(char* pattern, br_model_enum_cbfn* callback, void* arg) {
|
|||
// Offset: 981
|
||||
// Size: 185
|
||||
br_material* BrMaterialAdd(br_material* material) {
|
||||
NOT_IMPLEMENTED();
|
||||
BrRegistryAdd(&v1db.reg_materials, material);
|
||||
BrMaterialUpdate(material, BR_MATU_ALL);
|
||||
}
|
||||
|
||||
// Offset: 1183
|
||||
|
@ -138,7 +139,8 @@ br_uint_32 BrMaterialCount(char* pattern) {
|
|||
// Offset: 1930
|
||||
// Size: 55
|
||||
br_uint_32 BrMaterialEnum(char* pattern, br_material_enum_cbfn* callback, void* arg) {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("(\"%s\", %p, %p)", pattern, callback, arg);
|
||||
return BrRegistryEnum(&v1db.reg_materials, pattern, callback, arg);
|
||||
}
|
||||
|
||||
// Offset: 1994
|
||||
|
|
|
@ -150,10 +150,7 @@ typedef enum br_clip_result {
|
|||
BR_CLIP_ACCEPT = 2
|
||||
} br_clip_result;
|
||||
|
||||
enum {
|
||||
/*
|
||||
* No direct access to pixels
|
||||
*/
|
||||
typedef enum {
|
||||
BR_PMF_NO_ACCESS = 0x01,
|
||||
BR_PMF_LINEAR = 0x02,
|
||||
BR_PMF_ROW_WHOLEPIXELS = 0x04
|
||||
|
|
|
@ -21,8 +21,26 @@
|
|||
#include "CORE/V1DB/regsupt.h"
|
||||
#include "CORE/V1DB/v1dbfile.h"
|
||||
|
||||
extern struct br_font* BrFontFixed3x5;
|
||||
extern struct br_font* BrFontProp4x6;
|
||||
extern struct br_font* BrFontProp7x9;
|
||||
|
||||
br_pixelmap* BrPixelmapLoad(char* filename);
|
||||
br_uint_32 BrPixelmapLoadMany(char* filename, br_pixelmap** pixelmaps, br_uint_16 num);
|
||||
void BrDevPaletteSetOld(br_pixelmap* pm);
|
||||
void* BrMemAllocate(br_size_t size, br_uint_8 type);
|
||||
void* BrMemCalloc(int nelems, br_size_t size, br_uint_8 type);
|
||||
br_model* BrModelAllocate(char* name, int nvertices, int nfaces);
|
||||
br_pixelmap* BrMapAdd(br_pixelmap* pixelmap);
|
||||
br_material* BrMaterialAllocate(char* name);
|
||||
|
||||
br_material* BrMaterialAdd(br_material* material);
|
||||
void BrMaterialUpdate(br_material* mat, br_uint_16 flags);
|
||||
|
||||
void BrMatrix23Identity(br_matrix23* mat);
|
||||
|
||||
br_pixelmap* BrTableFind(char* pattern);
|
||||
|
||||
void BrFatal(const char* name, int line, const char* s, ...);
|
||||
|
||||
#endif
|
|
@ -1,6 +1,10 @@
|
|||
#include "controls.h"
|
||||
|
||||
#include "common/displays.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/graphics.h"
|
||||
#include "input.h"
|
||||
#include "pc-dos/dossys.h"
|
||||
#include "sound.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -866,14 +870,45 @@ void ToggleSmoke() {
|
|||
void DrawSomeText2(tDR_font* pFont) {
|
||||
int y;
|
||||
int i;
|
||||
char* txt[15];
|
||||
NOT_IMPLEMENTED();
|
||||
char* txt[15] = {
|
||||
"Cops Show all racers on map Show peds on map",
|
||||
"Random pick-up generation Pick-up respawn",
|
||||
"Open game Closed game",
|
||||
"Grid start Random start",
|
||||
"Random races Sequential races",
|
||||
"Include opponents' cars in car choices",
|
||||
"Choose cars manually randomly include Big APC",
|
||||
"Starting credits 0 2000 5000 10000 20000",
|
||||
"Driven to Destruction",
|
||||
"Car Crusher",
|
||||
"Carnage Accumulator",
|
||||
"Checkpoint Stampede",
|
||||
"Sudden Death",
|
||||
"Terminal Tag",
|
||||
"Fox 'n' Hounds"
|
||||
};
|
||||
|
||||
ClearEntireScreen();
|
||||
y = 0;
|
||||
for (i = 0; i < 15; i++) {
|
||||
TransDRPixelmapText(gBack_screen, 0, y, pFont, txt[i], 320);
|
||||
y += pFont->height + 1;
|
||||
}
|
||||
|
||||
PDScreenBufferSwap(0);
|
||||
//PrintScreen();
|
||||
}
|
||||
|
||||
// Offset: 18244
|
||||
// Size: 104
|
||||
void DrawSomeText() {
|
||||
NOT_IMPLEMENTED();
|
||||
DrawSomeText2(&gFonts[1]);
|
||||
DrawSomeText2(&gFonts[2]);
|
||||
DrawSomeText2(&gFonts[3]);
|
||||
DrawSomeText2(&gFonts[4]);
|
||||
DrawSomeText2(&gFonts[6]);
|
||||
DrawSomeText2(&gFonts[7]);
|
||||
DrawSomeText2(&gFonts[8]);
|
||||
}
|
||||
|
||||
// Offset: 18348
|
||||
|
|
|
@ -175,7 +175,7 @@ void LoadDepthTable(char* pName, br_pixelmap** pTable, int* pPower) {
|
|||
void InitDepthEffects() {
|
||||
int i;
|
||||
int j;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_WARN("skipping");
|
||||
}
|
||||
|
||||
// Offset: 4732
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "displays.h"
|
||||
#include "brender.h"
|
||||
#include "common/flicplay.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/graphics.h"
|
||||
|
@ -43,7 +44,15 @@ void GetTimerString(char* pStr, int pFudge_colon) {
|
|||
// Offset: 56
|
||||
// Size: 116
|
||||
void InitHeadups() {
|
||||
NOT_IMPLEMENTED();
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
for (i = 0; i < 15; i++) {
|
||||
gHeadups[i].type = 0;
|
||||
}
|
||||
gBR_fonts[0] = BrFontProp7x9;
|
||||
gBR_fonts[1] = BrFontFixed3x5;
|
||||
gBR_fonts[2] = gFont_7;
|
||||
gBR_fonts[3] = gHeadup_font;
|
||||
}
|
||||
|
||||
// Offset: 172
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
// These functions were compiled out of the release executable. Implementation is just a guess
|
||||
|
||||
void DrDebugLog(int level_maybe, char* pStr) {
|
||||
void DiagnosticsPrint(int level_maybe, char* pStr) {
|
||||
// maybe this is actually "errors::dprintf"?
|
||||
printf("%d: %s\n", level_maybe, pStr);
|
||||
LOG_TRACE(" \"%s\"", pStr);
|
||||
}
|
||||
|
||||
void DrDebugMessage(char* pStr, ...) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "br_types.h"
|
||||
#include "dr_types.h"
|
||||
|
||||
void DrDebugLog(int unk, char* pStr);
|
||||
void DiagnosticsPrint(int unk, char* pStr);
|
||||
|
||||
void DrDebugMessage(char* pStr, ...);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ char* gError_messages[126] = {
|
|||
int gError_code;
|
||||
char* gPalette_copy;
|
||||
int gPixel_buffer_size;
|
||||
int gMouse_was_started;
|
||||
int gMouse_was_started__;
|
||||
char* gPixels_copy;
|
||||
|
||||
// Offset: 0
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "flicplay.h"
|
||||
#include "brender.h"
|
||||
#include "common/utility.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
tFlic_bunch gFlic_bunch[9];
|
||||
|
@ -140,7 +142,9 @@ int GetPanelFlicFrameIndex(int pIndex) {
|
|||
// Offset: 744
|
||||
// Size: 91
|
||||
void FlicPaletteAllocate() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
gPalette_pixels = BrMemAllocate(0x400u, 0x8Fu);
|
||||
gPalette = DRPixelmapAllocate(BR_PMT_RGBX_888, 1, 256, gPalette_pixels, 0);
|
||||
}
|
||||
|
||||
// Offset: 836
|
||||
|
@ -447,7 +451,11 @@ void ShowFlic(int pIndex) {
|
|||
// Offset: 7016
|
||||
// Size: 76
|
||||
void InitFlics() {
|
||||
NOT_IMPLEMENTED();
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
for (i = 0; i < 372; i++) {
|
||||
gMain_flic_list[i].data_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 7092
|
||||
|
@ -637,7 +645,8 @@ void LoadInterfaceStrings() {
|
|||
int i;
|
||||
int j;
|
||||
int len;
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
LOG_WARN("Not implemented");
|
||||
}
|
||||
|
||||
// Offset: 11948
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "graphics.h"
|
||||
|
||||
#include "CORE/V1DB/modsupt.h"
|
||||
#include "brender.h"
|
||||
#include "common/flicplay.h"
|
||||
#include "errors.h"
|
||||
#include "globvars.h"
|
||||
#include "grafdata.h"
|
||||
#include "init.h"
|
||||
#include "loading.h"
|
||||
#include "pc-dos/dossys.h"
|
||||
|
@ -756,7 +758,8 @@ void InitPaletteAnimate() {
|
|||
// Offset: 19968
|
||||
// Size: 76
|
||||
void RevertPalette() {
|
||||
NOT_IMPLEMENTED();
|
||||
gPalette_munged = 0;
|
||||
gPalette_index = 0;
|
||||
}
|
||||
|
||||
// Offset: 20044
|
||||
|
@ -850,19 +853,32 @@ void EnsurePaletteUp() {
|
|||
// Size: 103
|
||||
br_uint_32 AmbientificateMaterial(br_material* pMat, void* pArg) {
|
||||
float a;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_DEBUG("%s", pMat->identifier);
|
||||
a = pMat->ka + *(br_scalar*)pArg;
|
||||
if (a >= 0.0) {
|
||||
if (a > 0.99f) {
|
||||
a = 0.99f;
|
||||
}
|
||||
} else {
|
||||
a = 0.0;
|
||||
}
|
||||
pMat->ka = a;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 21212
|
||||
// Size: 60
|
||||
void ChangeAmbience(br_scalar pDelta) {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("(%f)", pDelta);
|
||||
BrMaterialEnum("*", AmbientificateMaterial, &pDelta);
|
||||
}
|
||||
|
||||
// Offset: 21272
|
||||
// Size: 57
|
||||
void InitAmbience() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
gCurrent_ambience = gAmbient_adjustment;
|
||||
return ChangeAmbience(gAmbient_adjustment);
|
||||
}
|
||||
|
||||
// Offset: 21332
|
||||
|
@ -977,7 +993,12 @@ void DRPixelmapRectangleVScaledCopy(br_pixelmap* pDest, br_int_16 pDest_x, br_in
|
|||
// Offset: 23708
|
||||
// Size: 87
|
||||
void InitTransientBitmaps() {
|
||||
NOT_IMPLEMENTED();
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
for (i = 0; i < 50; i++) {
|
||||
gTransient_bitmaps[i].pixmap = NULL;
|
||||
gTransient_bitmaps[i].in_use = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 23796
|
||||
|
@ -1149,7 +1170,7 @@ void LoadFont(int pFont_ID) {
|
|||
// EAX: pFont_ID
|
||||
void DisposeFont(int pFont_ID) {
|
||||
LOG_TRACE("(%d)", pFont_ID);
|
||||
if (gFonts[pFont_ID].images && (!TranslationMode() || gAusterity_mode && FlicsPlayedFromDisk())) {
|
||||
if (gFonts[pFont_ID].images && (!TranslationMode() || (gAusterity_mode && FlicsPlayedFromDisk()))) {
|
||||
BrPixelmapFree(gFonts[pFont_ID].images);
|
||||
gFonts[pFont_ID].images = NULL;
|
||||
gFonts[pFont_ID].file_read_once = 0;
|
||||
|
@ -1306,7 +1327,33 @@ void ToggleShadow() {
|
|||
void InitShadow() {
|
||||
int i;
|
||||
br_vector3 temp_v;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
gShadow_clip_planes[i].clip = BrActorAllocate(BR_ACTOR_CLIP_PLANE, NULL);
|
||||
BrActorAdd(gUniverse_actor, gShadow_clip_planes[i].clip);
|
||||
BrClipPlaneDisable(gShadow_clip_planes[i].clip);
|
||||
BrMatrix34Identity(&gShadow_clip_planes[i].clip->t.t.mat);
|
||||
}
|
||||
gFancy_shadow = 1;
|
||||
gShadow_material = BrMaterialFind("SHADOW.MAT");
|
||||
gShadow_light_ray.v[0] = 0.0;
|
||||
gShadow_light_ray.v[1] = -1.0;
|
||||
gShadow_light_ray.v[2] = 0.0;
|
||||
// dword_1316E4 = 0;
|
||||
// dword_1316BC = 0;
|
||||
// dword_1316C0 = 0;
|
||||
// dword_1316CC = 0;
|
||||
// dword_1316D0 = 0;
|
||||
// dword_1316C8 = 0x3F800000;
|
||||
// dword_1316E0 = 0xBF800000;
|
||||
// dword_1316C4 = 0xBF800000;
|
||||
|
||||
gShadow_model = BrModelAllocate(NULL, 0, 0);
|
||||
gShadow_model->flags = 6;
|
||||
gShadow_actor = BrActorAllocate(BR_ACTOR_MODEL, 0);
|
||||
gShadow_actor->model = gShadow_model;
|
||||
return BrActorAdd(gUniverse_actor, gShadow_actor);
|
||||
}
|
||||
|
||||
// Offset: 31320
|
||||
|
@ -1342,7 +1389,14 @@ int SwitchToRealResolution() {
|
|||
// Offset: 31868
|
||||
// Size: 125
|
||||
int SwitchToLoresMode() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
if (!gGraf_data_index || gGraf_data_index != gReal_graf_data_index) {
|
||||
return 0;
|
||||
}
|
||||
gGraf_data_index = 0;
|
||||
gGraf_spec_index = 0;
|
||||
gCurrent_graf_data = gGraf_data;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Offset: 31996
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "common/controls.h"
|
||||
#include "common/depth.h"
|
||||
#include "common/displays.h"
|
||||
#include "common/drdebug.h"
|
||||
|
@ -135,7 +136,7 @@ void InstallFindFailedHooks() {
|
|||
void AllocateStandardLamp() {
|
||||
br_actor* lamp;
|
||||
int i;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_WARN("skipping");
|
||||
}
|
||||
|
||||
// Offset: 2152
|
||||
|
@ -242,7 +243,7 @@ void Init2DStuff() {
|
|||
void InitialiseApplication(int pArgc, char** pArgv) {
|
||||
|
||||
gProgram_state.sausage_eater_mode = gSausage_override;
|
||||
DrDebugLog(gSausage_override, *pArgv);
|
||||
DiagnosticsPrint(gSausage_override, *pArgv);
|
||||
if (gAustere_override || PDDoWeLeadAnAustereExistance() != 0) {
|
||||
gAusterity_mode = 1;
|
||||
}
|
||||
|
@ -305,7 +306,7 @@ void InitialiseApplication(int pArgc, char** pArgv) {
|
|||
gProgram_state.track_spec.the_actor = NULL;
|
||||
gCD_is_in_drive = TestForOriginalCarmaCDinDrive();
|
||||
SwitchToLoresMode();
|
||||
DrDebugLog(0, "AFTER APPLICATION INITIALISATION");
|
||||
DiagnosticsPrint(0, "AFTER APPLICATION INITIALISATION");
|
||||
}
|
||||
|
||||
// Offset: 6004
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
char* gWheel_actor_names[6];
|
||||
int gFunk_groove_flags[30];
|
||||
char* gNet_avail_names[4];
|
||||
char* gNet_avail_names[4] = { "never", "eagle", "hawk", "all" };
|
||||
char* gDamage_names[12];
|
||||
char* gDrivable_car_names[6];
|
||||
char* gYour_car_names[2][6];
|
||||
|
@ -38,7 +38,17 @@ tHeadup_info gHeadup_image_info[31];
|
|||
int gAllow_open_to_fail = 1;
|
||||
br_material* gDestn_screen_mat;
|
||||
br_material* gSource_screen_mat;
|
||||
char* gRaces_file_names[9];
|
||||
char* gRaces_file_names[9] = {
|
||||
"RACES.TXT",
|
||||
"NETRACES.TXT",
|
||||
"NETRACES.TXT",
|
||||
"PEDRACES.TXT",
|
||||
"RACES.TXT",
|
||||
"RACES.TXT",
|
||||
"NETRACES.TXT",
|
||||
"NETRACES.TXT",
|
||||
"NETRACES.TXT"
|
||||
};
|
||||
char* gFloorpan_names[5];
|
||||
int gCurrent_race_file_index;
|
||||
int gGroove_funk_offset;
|
||||
|
@ -542,7 +552,7 @@ void DRLoadLights(char* pPath_name) {
|
|||
br_actor* light_array[100];
|
||||
int number_of_lights;
|
||||
int i;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_WARN("skipping");
|
||||
}
|
||||
|
||||
// Offset: 5328
|
||||
|
@ -626,7 +636,8 @@ void UnlockInterfaceStuff() {
|
|||
// Offset: 6380
|
||||
// Size: 75
|
||||
void InitInterfaceLoadState() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
memset(gCursors, 0, sizeof(gCursors));
|
||||
}
|
||||
|
||||
// Offset: 6456
|
||||
|
@ -964,8 +975,15 @@ void DisposeHeadupImages() {
|
|||
// Offset: 28628
|
||||
// Size: 109
|
||||
FILE* OpenRaceFile() {
|
||||
FILE* f;
|
||||
tPath_name the_path;
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
PathCat(the_path, gApplication_path, gRaces_file_names[gCurrent_race_file_index]);
|
||||
f = DRfopen(the_path, "rt");
|
||||
if (!f) {
|
||||
FatalError(50);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
// Offset: 28740
|
||||
|
@ -977,7 +995,25 @@ void SkipRestOfRace(FILE* pF) {
|
|||
int text_chunk_count;
|
||||
int line_count;
|
||||
char s[256];
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
GetALineAndDontArgue(pF, s);
|
||||
GetALineAndDontArgue(pF, s);
|
||||
|
||||
text_chunk_count = GetAnInt(pF);
|
||||
for (j = 0; j < text_chunk_count; j++) {
|
||||
|
||||
PossibleService();
|
||||
GetALineAndDontArgue(pF, s);
|
||||
GetALineAndDontArgue(pF, s);
|
||||
line_count = GetAnInt(pF);
|
||||
while (line_count > 8) {
|
||||
GetALineAndDontArgue(pF, s);
|
||||
line_count--;
|
||||
}
|
||||
for (k = 0; k < line_count; k++) {
|
||||
GetALineAndDontArgue(pF, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 28960
|
||||
|
@ -991,10 +1027,52 @@ void LoadRaces(tRace_list_spec* pRace_list, int* pCount, int pRace_type_index) {
|
|||
int j;
|
||||
int k;
|
||||
int number_of_racers;
|
||||
int last_race;
|
||||
int last_race = 0;
|
||||
char s[256];
|
||||
char* str;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("(%p, %p, %d)", pRace_list, pCount, pRace_type_index);
|
||||
|
||||
gCurrent_race_file_index = pRace_type_index + 1;
|
||||
f = OpenRaceFile();
|
||||
number_of_racers = 0;
|
||||
while (!last_race) {
|
||||
GetALineAndDontArgue(f, s);
|
||||
if (strcmp(s, "END") == 0) {
|
||||
last_race = 1;
|
||||
} else {
|
||||
SkipRestOfRace(f);
|
||||
//s = (s + 48);
|
||||
number_of_racers++;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("race count %d", number_of_racers);
|
||||
|
||||
*pCount = number_of_racers;
|
||||
fclose(f);
|
||||
j = 0;
|
||||
for (i = 0; i < number_of_racers; i++) {
|
||||
pRace_list[i].suggested_rank = 99 - j / (number_of_racers - 3);
|
||||
if (i >= 3) {
|
||||
pRace_list[i].rank_required = pRace_list[i - 2].suggested_rank;
|
||||
} else {
|
||||
pRace_list[i].rank_required = 99;
|
||||
}
|
||||
j += 100;
|
||||
}
|
||||
|
||||
pRace_list[number_of_racers - 1].rank_required = 1;
|
||||
if (pRace_list[number_of_racers - 2].rank_required == 1) {
|
||||
--*pCount;
|
||||
}
|
||||
|
||||
for (i = 0; i < number_of_racers; i++) {
|
||||
if (i < *pCount - 3) {
|
||||
pRace_list[i].best_rank = pRace_list[i + 3].suggested_rank;
|
||||
} else {
|
||||
pRace_list[i].best_rank = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 29372
|
||||
|
@ -1078,6 +1156,7 @@ void DisposeGridIcons(tRace_info* pRace_info) {
|
|||
// Offset: 31320
|
||||
// Size: 1075
|
||||
void LoadOpponents() {
|
||||
FILE* f;
|
||||
tPath_name the_path;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -1085,7 +1164,74 @@ void LoadOpponents() {
|
|||
char s[256];
|
||||
char* str;
|
||||
tText_chunk* the_chunk;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
PathCat(the_path, gApplication_path, "OPPONENT.TXT");
|
||||
f = DRfopen(the_path, "rt");
|
||||
if (!f) {
|
||||
FatalError(54);
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
sscanf(str, "%d", &gNumber_of_racers);
|
||||
gOpponents = BrMemAllocate(sizeof(tOpponent) * gNumber_of_racers, 0xA3u);
|
||||
|
||||
for (i = 0; i < gNumber_of_racers; i++) {
|
||||
PossibleService();
|
||||
GetALineAndDontArgue(f, gOpponents[i].name);
|
||||
if (!strcmp(gOpponents[i].name, "END")) {
|
||||
FatalError(55);
|
||||
}
|
||||
|
||||
GetALineAndDontArgue(f, gOpponents[i].abbrev_name);
|
||||
gOpponents[i].car_number = GetAnInt(f);
|
||||
gOpponents[i].strength_rating = GetAnInt(f);
|
||||
gOpponents[i].network_availability = GetALineAndInterpretCommand(f, gNet_avail_names, 4);
|
||||
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
strcpy(gOpponents[i].mug_shot_name, str);
|
||||
|
||||
gOpponents[i].mug_shot_image_data = NULL;
|
||||
gOpponents[i].grid_icon_image = NULL;
|
||||
gOpponents[i].stolen_car_image_data = NULL;
|
||||
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
strcpy(gOpponents[i].car_file_name, str);
|
||||
GetALineAndDontArgue(f, s);
|
||||
str = strtok(s, "\t ,/");
|
||||
strcpy(gOpponents[i].stolen_car_flic_name, str);
|
||||
|
||||
gOpponents[i].text_chunk_count = GetAnInt(f);
|
||||
gOpponents[i].text_chunks = BrMemAllocate(sizeof(tText_chunk) * gOpponents[i].text_chunk_count, 0xA4u);
|
||||
|
||||
for (j = 0; j < gOpponents[i].text_chunk_count; j++) {
|
||||
the_chunk = &gOpponents[i].text_chunks[j];
|
||||
PossibleService();
|
||||
GetPairOfInts(f, &the_chunk->x_coord, &the_chunk->y_coord);
|
||||
GetPairOfInts(f, &the_chunk->frame_cue, &the_chunk->frame_end);
|
||||
the_chunk->line_count = GetAnInt(f);
|
||||
while (the_chunk->line_count > 8) {
|
||||
the_chunk->line_count--;
|
||||
GetALineAndDontArgue(f, s);
|
||||
}
|
||||
|
||||
for (k = 0; k < the_chunk->line_count; k++) {
|
||||
GetALineAndDontArgue(f, s);
|
||||
the_chunk->text[k] = BrMemAllocate(strlen(s) + 1, 0xA5u);
|
||||
strcpy(the_chunk->text[k], s);
|
||||
}
|
||||
}
|
||||
|
||||
gOpponents[i].dead = 0;
|
||||
InitOpponentPsyche(i);
|
||||
}
|
||||
GetALineAndDontArgue(f, s);
|
||||
if (strcmp(s, "END")) {
|
||||
FatalError(55);
|
||||
}
|
||||
return fclose(f);
|
||||
}
|
||||
|
||||
// Offset: 32396
|
||||
|
@ -1171,7 +1317,19 @@ int GetALineAndInterpretCommand(FILE* pF, char** pString_list, int pCount) {
|
|||
int i;
|
||||
char s[256];
|
||||
char* str;
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
GetALineAndDontArgue(pF, s);
|
||||
|
||||
str = strtok(s, "\t ,/");
|
||||
if (pCount <= 0) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < pCount; i++) {
|
||||
if (strcmp(s, pString_list[i]) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Offset: 33724
|
||||
|
@ -1628,7 +1786,7 @@ int GetCDPathFromPathsTxtFile(char* pPath_name) {
|
|||
static tPath_name cd_pathname;
|
||||
FILE* paths_txt_fp;
|
||||
tPath_name paths_txt;
|
||||
LOG_TRACE("(\"%s\")", pPath_name);
|
||||
LOG_TRACE("()");
|
||||
|
||||
if (!got_it_already) {
|
||||
sprintf(paths_txt, "%s%s%s", gApplication_path, gDir_separator, "PATHS.TXT");
|
||||
|
@ -1647,13 +1805,66 @@ int GetCDPathFromPathsTxtFile(char* pPath_name) {
|
|||
// Offset: 38784
|
||||
// Size: 44
|
||||
int TestForOriginalCarmaCDinDrive() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
// JeffH the symbol dump didn't include any local variable information.
|
||||
// These names are not necessarily the original names.
|
||||
tPath_name the_path;
|
||||
tPath_name cd_pathname;
|
||||
tPath_name cd_data_pathname;
|
||||
tPath_name cutscene_pathname;
|
||||
FILE* paths_txt_fp;
|
||||
tPath_name paths_txt;
|
||||
int paths_txt_first_char;
|
||||
|
||||
paths_txt[0] = 0;
|
||||
strcat(paths_txt, gApplication_path);
|
||||
strcat(paths_txt, gDir_separator);
|
||||
strcat(paths_txt, "PATHS.TXT");
|
||||
|
||||
if (!PDCheckDriveExists(paths_txt)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
paths_txt_fp = fopen(paths_txt, "rt");
|
||||
if (!paths_txt_fp) {
|
||||
return 0;
|
||||
}
|
||||
paths_txt_first_char = fgetc(paths_txt_fp);
|
||||
ungetc(paths_txt_first_char, paths_txt_fp);
|
||||
GetALineAndDontArgue(paths_txt_fp, cd_pathname);
|
||||
fclose(paths_txt_fp);
|
||||
strcpy(cd_data_pathname, cd_pathname);
|
||||
strcat(cd_data_pathname, gDir_separator);
|
||||
strcat(cd_data_pathname, "DATA");
|
||||
|
||||
if (DRStricmp(cd_pathname, gApplication_path) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy(cutscene_pathname, cd_pathname);
|
||||
strcat(cutscene_pathname, gDir_separator);
|
||||
strcat(cutscene_pathname, "CUTSCENE");
|
||||
|
||||
if (PDCheckDriveExists2(cd_data_pathname, "GENERAL.TXT", 100)
|
||||
&& (PDCheckDriveExists2(cd_pathname, "CARMA.EXE", 1000000)
|
||||
|| PDCheckDriveExists2(cd_pathname, "CARMAG.EXE", 1000000)
|
||||
|| PDCheckDriveExists2(cd_pathname, "MAINPROG.EXE", 1000000)
|
||||
|| PDCheckDriveExists2(cd_pathname, "CARMSPLT.EXE", 1000000)
|
||||
|| PDCheckDriveExists2(cd_pathname, "CARMGSPL.EXE", 1000000))
|
||||
&& PDCheckDriveExists2(cutscene_pathname, "SPLINTRO.SMK", 2000000)) {
|
||||
if (paths_txt_first_char != '@') {
|
||||
EncodeFile(paths_txt);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 38828
|
||||
// Size: 45
|
||||
int OriginalCarmaCDinDrive() {
|
||||
NOT_IMPLEMENTED();
|
||||
return gCD_is_in_drive;
|
||||
}
|
||||
|
||||
// Offset: 38876
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#include "oil.h"
|
||||
#include "brender.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/loading.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int gNext_oil_pixie;
|
||||
char* gOil_pixie_names[1];
|
||||
char* gOil_pixie_names[1] = { "OIL.PIX" };
|
||||
br_scalar gZ_buffer_diff;
|
||||
br_scalar gMin_z_diff;
|
||||
br_pixelmap* gOil_pixies[1];
|
||||
|
@ -11,9 +14,67 @@ tOil_spill_info gOily_spills[15];
|
|||
// Offset: 0
|
||||
// Size: 811
|
||||
void InitOilSpills() {
|
||||
int i;
|
||||
br_model* the_model;
|
||||
br_material* the_material;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
gOil_pixies[0] = LoadPixelmap(gOil_pixie_names[0]);
|
||||
BrMapAdd(gOil_pixies[0]);
|
||||
for (i = 0; i < 15; i++) {
|
||||
the_material = BrMaterialAllocate(NULL);
|
||||
BrMaterialAdd(the_material);
|
||||
the_material->ka = 0.99000001;
|
||||
the_material->kd = 0.0;
|
||||
the_material->ks = 0.0;
|
||||
the_material->power = 0.0;
|
||||
the_material->index_base = 0;
|
||||
//LOBYTE(the_material->flags) = v2 | 0x25;
|
||||
the_material->flags |= 0x25;
|
||||
the_material->index_range = 0;
|
||||
the_material->colour_map = 0;
|
||||
BrMatrix23Identity(&the_material->map_transform);
|
||||
the_material->index_shade = BrTableFind("IDENTITY.TAB");
|
||||
BrMaterialUpdate(the_material, BR_MATU_ALL);
|
||||
the_model = BrModelAllocate(NULL, 4, 2);
|
||||
the_model->flags |= BR_MODF_KEEP_ORIGINAL;
|
||||
|
||||
the_model->faces->vertices[0] = 2;
|
||||
the_model->faces->vertices[1] = 1;
|
||||
the_model->faces->vertices[2] = 0;
|
||||
the_model->faces->material = 0;
|
||||
the_model->faces->smoothing = 1;
|
||||
the_model->faces[1].vertices[0] = 3;
|
||||
the_model->faces[1].vertices[1] = 2;
|
||||
the_model->faces[1].vertices[2] = 0;
|
||||
the_model->faces[1].material = 0;
|
||||
the_model->faces[1].smoothing = 1;
|
||||
the_model->vertices->p.v[0] = -1.0;
|
||||
the_model->vertices->p.v[1] = 0.0;
|
||||
the_model->vertices->p.v[2] = -1.0;
|
||||
the_model->vertices->map.v[0] = 0.0;
|
||||
the_model->vertices->map.v[1] = 1.0;
|
||||
the_model->vertices[1].p.v[0] = 1.0;
|
||||
the_model->vertices[1].p.v[1] = 0.0;
|
||||
the_model->vertices[1].p.v[2] = 1.0;
|
||||
the_model->vertices[1].map.v[0] = 0.0;
|
||||
the_model->vertices[1].map.v[1] = 0.0;
|
||||
the_model->vertices[2].p.v[0] = 1.0;
|
||||
the_model->vertices[2].p.v[1] = 0.0;
|
||||
the_model->vertices[2].p.v[2] = -1.0;
|
||||
the_model->vertices[2].map.v[0] = 1.0;
|
||||
the_model->vertices[2].map.v[1] = 0.0;
|
||||
the_model->vertices[3].p.v[0] = -1.0;
|
||||
the_model->vertices[3].p.v[1] = 0.0;
|
||||
the_model->vertices[3].p.v[2] = 1.0;
|
||||
the_model->vertices[3].map.v[0] = 1.0;
|
||||
the_model->vertices[3].map.v[1] = 1.0;
|
||||
gOily_spills[i].actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
|
||||
gOily_spills[i].actor->model = the_model;
|
||||
gOily_spills[i].actor->render_style = 1;
|
||||
gOily_spills[i].actor->material = the_material;
|
||||
BrActorAdd(gNon_track_actor, gOily_spills[i].actor);
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 812
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "opponent.h"
|
||||
#include "common/globvars.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
char gOppo_path_filename[256];
|
||||
|
@ -920,7 +921,7 @@ int GetOpponentsSectionMaxSpeed(tOpponent_spec* pOpponent_spec, tS16 pSection, i
|
|||
// EAX: pOpponent_index
|
||||
void InitOpponentPsyche(int pOpponent_index) {
|
||||
int i;
|
||||
NOT_IMPLEMENTED();
|
||||
gOpponents[pOpponent_index].psyche.grudge_against_player = 0;
|
||||
}
|
||||
|
||||
// Offset: 38160
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "pedestrn.h"
|
||||
#include "brender.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <time.h>
|
||||
|
@ -46,7 +47,7 @@ br_scalar gExploding_ped_scale[3];
|
|||
br_vector3 gDanger_direction;
|
||||
int gPed_instruc_count;
|
||||
int gInit_ped_instruc;
|
||||
br_vector3 gZero_v;
|
||||
br_vector3 gZero_v_pedestrn; // added _pedestrn to avoid name collision with car.c
|
||||
char* gRate_commands[3];
|
||||
char* gCollide_commands[1];
|
||||
int gCurrent_lollipop_index;
|
||||
|
@ -151,7 +152,39 @@ void PedCallBack(br_actor* pActor, br_model* pModel, br_material* pMaterial, voi
|
|||
// Offset: 2136
|
||||
// Size: 516
|
||||
void InitPeds() {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
gPed_model = BrModelAllocate(0, 4, 2);
|
||||
gPed_model->faces->vertices[0] = 0;
|
||||
gPed_model->faces->vertices[1] = 2;
|
||||
gPed_model->faces->vertices[2] = 1;
|
||||
gPed_model->faces->material = 0;
|
||||
gPed_model->faces->smoothing = 1;
|
||||
gPed_model->faces[1].vertices[0] = 0;
|
||||
gPed_model->faces[1].vertices[1] = 3;
|
||||
gPed_model->faces[1].vertices[2] = 2;
|
||||
gPed_model->faces[1].material = 0;
|
||||
gPed_model->faces[1].smoothing = 1;
|
||||
gPed_model->vertices->p.v[0] = -0.5;
|
||||
gPed_model->vertices->p.v[1] = 0.0;
|
||||
gPed_model->vertices->p.v[2] = 0.0;
|
||||
gPed_model->vertices->map.v[0] = 0.000099999997;
|
||||
gPed_model->vertices->map.v[1] = 0.99989998;
|
||||
gPed_model->vertices[1].p.v[0] = -0.5;
|
||||
gPed_model->vertices[1].p.v[1] = 1.0;
|
||||
gPed_model->vertices[1].p.v[2] = 0.0;
|
||||
gPed_model->vertices[1].map.v[0] = 0.000099999997;
|
||||
gPed_model->vertices[1].map.v[1] = 0.000099999997;
|
||||
gPed_model->vertices[2].p.v[0] = 0.5;
|
||||
gPed_model->vertices[2].p.v[1] = 1.0;
|
||||
gPed_model->vertices[2].p.v[2] = 0.0;
|
||||
gPed_model->vertices[2].map.v[0] = 0.99989998;
|
||||
gPed_model->vertices[2].map.v[1] = 0.000099999997;
|
||||
gPed_model->vertices[3].p.v[0] = 0.5;
|
||||
gPed_model->vertices[3].p.v[1] = 0.0;
|
||||
gPed_model->vertices[3].p.v[2] = 0.0;
|
||||
gPed_model->vertices[3].map.v[0] = 0.99989998;
|
||||
gPed_model->vertices[3].map.v[1] = 0.99989998;
|
||||
BrModelAdd(gPed_model);
|
||||
}
|
||||
|
||||
// Offset: 2652
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#include "powerup.h"
|
||||
#include "brender.h"
|
||||
#include "common/errors.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/loading.h"
|
||||
#include "common/utility.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int gPed_harvest_sounds[4];
|
||||
|
@ -6,14 +11,14 @@ tGot_proc* gGot_procs[34];
|
|||
tLose_proc* gLose_procs[34];
|
||||
tHeadup_icon gIcon_list[20];
|
||||
tPeriodic_proc* gPeriodic_procs[34];
|
||||
char* gFizzle_names[3];
|
||||
char* gFizzle_names[3] = { "CIRCLES.PIX", "SQUARES.PIX", "DIAMONDS.PIX" };
|
||||
br_pixelmap* gFizzle_in[3];
|
||||
int gNumber_of_powerups;
|
||||
tU32* gReal_render_palette;
|
||||
int gFizzle_height;
|
||||
int gNumber_of_icons;
|
||||
tPowerup* gPowerup_array;
|
||||
br_vector3 gZero_v;
|
||||
br_vector3 gZero_v_powerup; // added _powerup suffix to avoid name collision
|
||||
|
||||
// Offset: 0
|
||||
// Size: 303
|
||||
|
@ -70,6 +75,7 @@ int GotPowerup(tCar_spec* pCar, int pIndex) {
|
|||
// Offset: 1628
|
||||
// Size: 811
|
||||
void LoadPowerups() {
|
||||
FILE* f;
|
||||
tPath_name the_path;
|
||||
char s[256];
|
||||
int i;
|
||||
|
@ -77,7 +83,67 @@ void LoadPowerups() {
|
|||
int time;
|
||||
int action_index;
|
||||
tPowerup* the_powerup;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
gFizzle_in[i] = LoadPixelmap(gFizzle_names[i]);
|
||||
}
|
||||
|
||||
gFizzle_height = gFizzle_in[0]->height / 4;
|
||||
PathCat(the_path, gApplication_path, "POWERUP.TXT");
|
||||
f = DRfopen(the_path, "rt");
|
||||
if (!f) {
|
||||
FatalError(25);
|
||||
}
|
||||
gNumber_of_powerups = GetAnInt(f);
|
||||
gPowerup_array = BrMemAllocate(sizeof(tPowerup) * gNumber_of_powerups, 0xC5u);
|
||||
for (i = 0; i < gNumber_of_powerups; i++) {
|
||||
the_powerup = &gPowerup_array[i];
|
||||
|
||||
GetALineAndDontArgue(f, the_powerup->message);
|
||||
if (strcmp(the_powerup->message, "dummy") == 0) {
|
||||
the_powerup->type = 0;
|
||||
} else {
|
||||
if (strcmp(the_powerup->message, "n/a") == 0) {
|
||||
the_powerup->message[0] = 0;
|
||||
}
|
||||
GetAString(f, s);
|
||||
the_powerup->icon = LoadPixelmap(s);
|
||||
the_powerup->fizzle_type = GetAnInt(f);
|
||||
the_powerup->duration = 1000 * GetAnInt(f);
|
||||
if (the_powerup->duration < 0) {
|
||||
the_powerup->type = ePowerup_instantaneous;
|
||||
} else if (the_powerup->duration == 0) {
|
||||
the_powerup->type = ePowerup_whole_race;
|
||||
} else {
|
||||
the_powerup->type = ePowerup_timed;
|
||||
}
|
||||
action_index = GetAnInt(f);
|
||||
if (action_index >= 0) {
|
||||
the_powerup->got_proc = gGot_procs[action_index];
|
||||
the_powerup->lose_proc = gLose_procs[action_index];
|
||||
the_powerup->periodic_proc = gPeriodic_procs[action_index];
|
||||
} else {
|
||||
the_powerup->lose_proc = NULL;
|
||||
the_powerup->periodic_proc = NULL;
|
||||
the_powerup->got_proc = NULL;
|
||||
}
|
||||
the_powerup->number_of_float_params = GetAnInt(f);
|
||||
the_powerup->float_params = BrMemAllocate(4 * the_powerup->number_of_float_params, 0xC6u);
|
||||
for (j = 0; j < the_powerup->number_of_float_params; j++) {
|
||||
the_powerup->float_params[j] = GetAFloat(f);
|
||||
}
|
||||
the_powerup->number_of_integer_params = GetAnInt(f);
|
||||
the_powerup->integer_params = BrMemAllocate(4 * the_powerup->number_of_integer_params, 0xC7u);
|
||||
for (j = 0; j < the_powerup->number_of_integer_params; j++) {
|
||||
the_powerup->integer_params[j] = GetAnInt(f);
|
||||
}
|
||||
the_powerup->group_inclusion = GetAnInt(f);
|
||||
the_powerup->prat_cam_event = GetAnInt(f);
|
||||
the_powerup->net_type = GetAnInt(f);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// Offset: 2440
|
||||
|
|
|
@ -4,6 +4,20 @@
|
|||
#include "br_types.h"
|
||||
#include "dr_types.h"
|
||||
|
||||
extern int gPed_harvest_sounds[4];
|
||||
extern tGot_proc* gGot_procs[34];
|
||||
extern tLose_proc* gLose_procs[34];
|
||||
extern tHeadup_icon gIcon_list[20];
|
||||
extern tPeriodic_proc* gPeriodic_procs[34];
|
||||
extern char* gFizzle_names[3];
|
||||
extern br_pixelmap* gFizzle_in[3];
|
||||
extern int gNumber_of_powerups;
|
||||
extern tU32* gReal_render_palette;
|
||||
extern int gFizzle_height;
|
||||
extern int gNumber_of_icons;
|
||||
extern tPowerup* gPowerup_array;
|
||||
extern br_vector3 gZero_v_powerup; // added _powerup suffix to avoid name collision
|
||||
|
||||
// Offset: 0
|
||||
// Size: 303
|
||||
// EAX: pThe_powerup
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "raycast.h"
|
||||
#include "CORE/V1DB/actsupt.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
br_matrix34 gPick_model_to_view;
|
||||
br_matrix34 gPick_model_to_view_raycast; //added _raycast suffix to avoid name collision
|
||||
int gBelow_face_index;
|
||||
br_scalar gCurrent_y;
|
||||
int gAbove_face_index;
|
||||
|
@ -23,7 +24,27 @@ int DRActorToRoot(br_actor* a, br_actor* world, br_matrix34* m) {
|
|||
// Offset: 192
|
||||
// Size: 220
|
||||
void InitRayCasting() {
|
||||
NOT_IMPLEMENTED();
|
||||
br_camera* camera_ptr;
|
||||
LOG_TRACE("()");
|
||||
br_actor* a;
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_CAMERA, NULL);
|
||||
camera_ptr = a->type_data;
|
||||
camera_ptr->type = BR_CAMERA_PERSPECTIVE_FOV;
|
||||
camera_ptr->field_of_view = BR_ANGLE_DEG(70.0f);
|
||||
camera_ptr->hither_z = 0.001;
|
||||
camera_ptr->yon_z = 1000.0;
|
||||
camera_ptr->aspect = 1.0;
|
||||
a->t.t.quat.q.x = 1.0;
|
||||
a->t.t.quat.q.y = 0.0;
|
||||
a->t.t.quat.q.z = 0.0;
|
||||
a->t.t.quat.q.w = 0.0;
|
||||
a->t.t.mat.m[1][1] = 0.0;
|
||||
a->t.t.mat.m[1][2] = -1.0;
|
||||
a->t.t.mat.m[2][0] = 0.0;
|
||||
a->t.t.mat.m[2][1] = 1.0;
|
||||
a->t.t.mat.m[2][2] = 0.0;
|
||||
gY_picking_camera = a;
|
||||
}
|
||||
|
||||
// Offset: 412
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
#include "replay.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common/loading.h"
|
||||
|
||||
int gProgress_line_top[2];
|
||||
int gProgress_line_left[2];
|
||||
int gProgress_line_right[2];
|
||||
br_pixelmap* gReplay_pixies[10];
|
||||
char* gReplay_pixie_names[10];
|
||||
char* gReplay_pixie_names[10] = {
|
||||
"REPLAY.PIX",
|
||||
"RBUTTONS.PIX",
|
||||
"REWSTART.PIX",
|
||||
"REW.PIX",
|
||||
"REVPLAY.PIX",
|
||||
"PAUSE.PIX",
|
||||
"PLAY.PIX",
|
||||
"FFWD.PIX",
|
||||
"FWDEND.PIX",
|
||||
"CAMERA.PIX"
|
||||
};
|
||||
int gKey_down;
|
||||
int gNo_cursor;
|
||||
int gSingle_frame_mode;
|
||||
|
@ -153,7 +166,12 @@ void CheckReplayTurnOn() {
|
|||
// Offset: 4928
|
||||
// Size: 98
|
||||
void InitializeActionReplay() {
|
||||
NOT_IMPLEMENTED();
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
gReplay_pixies[i] = LoadPixelmap(gReplay_pixie_names[i]);
|
||||
}
|
||||
gAction_replay_camera_mode = eAction_replay_action;
|
||||
}
|
||||
|
||||
// Offset: 5028
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#include "skidmark.h"
|
||||
#include "brender.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/globvrbm.h"
|
||||
#include "common/loading.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
char* gMaterial_names[2];
|
||||
char* gBoring_material_names[2];
|
||||
char* gMaterial_names[2] = { "OILSMEAR.MAT", "GIBSMEAR.MAT" };
|
||||
char* gBoring_material_names[2] = { "OILSMEAR.MAT", "ROBSMEAR.MAT" };
|
||||
tSkid gSkids[100];
|
||||
|
||||
// Offset: 0
|
||||
|
@ -61,11 +65,78 @@ int Reflex2D(br_vector3* pPt, br_vector3* pL1, br_vector3* pL2) {
|
|||
// Offset: 1124
|
||||
// Size: 885
|
||||
void InitSkids() {
|
||||
int skid;
|
||||
int mat;
|
||||
int sl;
|
||||
br_model* square;
|
||||
char* str;
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("()");
|
||||
|
||||
for (mat = 0; mat < 2; mat++) {
|
||||
if (gProgram_state.sausage_eater_mode) {
|
||||
str = gBoring_material_names[mat];
|
||||
} else {
|
||||
str = gMaterial_names[mat];
|
||||
}
|
||||
gMaterial[mat] = BrMaterialFind(str);
|
||||
if (!gMaterial[mat]) {
|
||||
if (gProgram_state.sausage_eater_mode) {
|
||||
str = gBoring_material_names[mat];
|
||||
} else {
|
||||
str = gMaterial_names[mat];
|
||||
}
|
||||
|
||||
sl = strlen(strtok(str, "."));
|
||||
strcpy(str + sl, ".PIX");
|
||||
BrMapAdd(LoadPixelmap(str));
|
||||
strcpy(str + sl, ".MAT");
|
||||
gMaterial[mat] = LoadMaterial(str);
|
||||
if (gMaterial[mat]) {
|
||||
BrMaterialAdd(gMaterial[mat]);
|
||||
} else {
|
||||
BrFatal("..\\..\\source\\common\\skidmark.c", 207, "Couldn't find %s", gMaterial_names[mat]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (skid = 0; skid < 100; skid++) {
|
||||
gSkids[skid].actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
|
||||
BrActorAdd(gNon_track_actor, gSkids[skid].actor);
|
||||
gSkids[skid].actor->t.t.mat.m[1][1] = 0.0099999998;
|
||||
gSkids[skid].actor->render_style = 1;
|
||||
square = BrModelAllocate(NULL, 4, 2);
|
||||
square->vertices[0].p.v[0] = -0.5;
|
||||
square->vertices[0].p.v[1] = 1.0;
|
||||
square->vertices[0].p.v[2] = -0.5;
|
||||
square->vertices[1].p.v[0] = -0.5;
|
||||
square->vertices[1].p.v[1] = 1.0;
|
||||
square->vertices[1].p.v[2] = 0.5;
|
||||
square->vertices[2].p.v[0] = 0.5;
|
||||
square->vertices[2].p.v[1] = 1.0;
|
||||
square->vertices[2].p.v[2] = 0.5;
|
||||
square->vertices[3].p.v[0] = 0.5;
|
||||
square->vertices[3].p.v[1] = 1.0;
|
||||
square->vertices[3].p.v[2] = -0.5;
|
||||
square->vertices[0].map.v[0] = 0.0;
|
||||
square->vertices[0].map.v[1] = 0.0;
|
||||
square->vertices[1].map.v[0] = 0.0;
|
||||
square->vertices[1].map.v[1] = 1.0;
|
||||
square->vertices[2].map.v[0] = 1.0;
|
||||
square->vertices[2].map.v[1] = 1.0;
|
||||
square->vertices[3].map.v[0] = 1.0;
|
||||
square->vertices[3].map.v[1] = 0.0;
|
||||
square->faces[0].vertices[0] = 0;
|
||||
square->faces[0].vertices[1] = 1;
|
||||
square->faces[0].vertices[2] = 2;
|
||||
square->faces[0].smoothing = 1;
|
||||
square->faces[1].vertices[0] = 0;
|
||||
square->faces[1].vertices[1] = 2;
|
||||
square->faces[1].vertices[2] = 3;
|
||||
square->faces[1].smoothing = 1;
|
||||
square->flags |= BR_MODF_KEEP_ORIGINAL;
|
||||
BrModelAdd(square);
|
||||
gSkids[skid].actor->model = square;
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 2012
|
||||
|
|
|
@ -66,7 +66,8 @@ void InitSound() {
|
|||
int engine_channel_count;
|
||||
int car_channel_count;
|
||||
int ped_channel_count;
|
||||
NOT_IMPLEMENTED();
|
||||
|
||||
LOG_WARN("Not implmented");
|
||||
}
|
||||
|
||||
// Offset: 1200
|
||||
|
|
|
@ -1186,7 +1186,15 @@ void SkipNLines(FILE* pF) {
|
|||
// EDX: p2
|
||||
int DRStricmp(char* p1, char* p2) {
|
||||
int val;
|
||||
NOT_IMPLEMENTED();
|
||||
while (p1) {
|
||||
val = tolower(*p1) - tolower(*p2);
|
||||
if (val != 0) {
|
||||
return val;
|
||||
}
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 15352
|
||||
|
@ -1230,18 +1238,7 @@ void NobbleNonzeroBlacks(br_pixelmap* pPalette) {
|
|||
// EAX: pThe_path
|
||||
int PDCheckDriveExists(char* pThe_path) {
|
||||
LOG_TRACE("(\"%s\")", pThe_path);
|
||||
|
||||
// Added: force unix dir separator for now >>
|
||||
char* rep = pThe_path;
|
||||
while ((rep = strchr(rep, '\\')) != NULL) {
|
||||
*rep++ = '/';
|
||||
}
|
||||
// <<
|
||||
|
||||
if (access(pThe_path, 0) != -1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return PDCheckDriveExists2(pThe_path, NULL, 0);
|
||||
}
|
||||
|
||||
// Offset: 16388
|
||||
|
|
|
@ -101,7 +101,20 @@ br_actor* CloneActor(br_actor* pSource_actor) {
|
|||
// EBX: pMax_shade_tables
|
||||
// ECX: pMax_materials
|
||||
void InitialiseStorageSpace(tBrender_storage* pStorage_space, int pMax_pixelmaps, int pMax_shade_tables, int pMax_materials, int pMax_models) {
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("(%p, %d, %d, %d, %d)", pStorage_space, pMax_pixelmaps, pMax_shade_tables, pMax_materials, pMax_models);
|
||||
pStorage_space->pixelmaps_count = 0;
|
||||
pStorage_space->shade_tables_count = 0;
|
||||
pStorage_space->materials_count = 0;
|
||||
pStorage_space->models_count = 0;
|
||||
pStorage_space->max_pixelmaps = pMax_pixelmaps;
|
||||
pStorage_space->max_shade_tables = pMax_shade_tables;
|
||||
pStorage_space->max_materials = pMax_materials;
|
||||
pStorage_space->max_models = pMax_models;
|
||||
pStorage_space->pixelmaps = BrMemCalloc(pMax_pixelmaps, 4, 0xD7u);
|
||||
pStorage_space->shade_tables = BrMemCalloc(pMax_shade_tables, 4, 0xD8u);
|
||||
pStorage_space->materials = BrMemCalloc(pMax_materials, 4, 0xD9u);
|
||||
pStorage_space->models = BrMemCalloc(pMax_models, 4, 0xDAu);
|
||||
pStorage_space->saved_colour_maps = BrMemCalloc(pMax_materials, 4, 0xDBu);
|
||||
}
|
||||
|
||||
// Offset: 872
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#include "dossys.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "brender.h"
|
||||
#include "common/car.h"
|
||||
#include "common/drdebug.h"
|
||||
|
@ -18,7 +12,12 @@
|
|||
#include "common/utility.h"
|
||||
#include "watcom_functions.h"
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int gASCII_table[128];
|
||||
tU32 gKeyboard_bits[8];
|
||||
|
@ -885,7 +884,26 @@ int PDCheckDriveExists2(char* pThe_path, char* pFile_name, tU32 pMin_size) {
|
|||
int stat_failed;
|
||||
char slasher[4];
|
||||
char the_path[256];
|
||||
NOT_IMPLEMENTED();
|
||||
LOG_TRACE("(\"%s\", \"%s\", %d)", pThe_path, pFile_name, pMin_size);
|
||||
|
||||
strcpy(slasher, "?:\\");
|
||||
if (pFile_name) {
|
||||
PathCat(the_path, pThe_path, pFile_name);
|
||||
} else {
|
||||
strcpy(the_path, pThe_path);
|
||||
}
|
||||
|
||||
// JeffH: force unix dir separator >>
|
||||
char* rep = the_path;
|
||||
while ((rep = strchr(rep, '\\')) != NULL) {
|
||||
*rep++ = '/';
|
||||
}
|
||||
// <<
|
||||
|
||||
stat_failed = stat(the_path, &buf);
|
||||
LOG_DEBUG("path: %d, %s, %d", stat_failed, the_path, buf.st_size);
|
||||
|
||||
return !stat_failed && buf.st_size >= pMin_size;
|
||||
}
|
||||
|
||||
// Offset: 10184
|
||||
|
|
|
@ -139,5 +139,5 @@ void Harness_GLRenderer_DoubleBuffer(uint32_t* screen_buffer, SDL_Window* window
|
|||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
SDL_Delay(5000);
|
||||
//SDL_Delay(5000);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include "CORE/V1DB/matsupt.h"
|
||||
#include "CORE/V1DB/regsupt.h"
|
||||
#include "tests.h"
|
||||
|
||||
int nbr_callbacks;
|
||||
|
||||
br_uint_32 callback(br_material* mat, void* arg) {
|
||||
nbr_callbacks++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void test_regsupt_BrMaterialEnum() {
|
||||
int result;
|
||||
br_material *m, *m2;
|
||||
|
||||
m = BrMaterialAllocate("mat1");
|
||||
m2 = BrMaterialAllocate("mat2");
|
||||
TEST_ASSERT_NOT_NULL(m);
|
||||
TEST_ASSERT_NOT_NULL(m2);
|
||||
BrMaterialAdd(m);
|
||||
BrMaterialAdd(m2);
|
||||
|
||||
nbr_callbacks = 0;
|
||||
result = BrMaterialEnum("*", callback, NULL);
|
||||
TEST_ASSERT_EQUAL_INT(2, nbr_callbacks);
|
||||
|
||||
nbr_callbacks = 0;
|
||||
result = BrMaterialEnum(NULL, callback, NULL);
|
||||
TEST_ASSERT_EQUAL_INT(2, nbr_callbacks);
|
||||
|
||||
nbr_callbacks = 0;
|
||||
result = BrMaterialEnum("mat1", callback, NULL);
|
||||
TEST_ASSERT_EQUAL_INT(1, nbr_callbacks);
|
||||
}
|
||||
|
||||
void test_regsupt_suite() {
|
||||
RUN_TEST(test_regsupt_BrMaterialEnum);
|
||||
}
|
|
@ -37,7 +37,7 @@ void test_loading_LoadGeneralParameters() {
|
|||
TEST_ASSERT_EQUAL_INT(7500, gInitial_credits[0]);
|
||||
TEST_ASSERT_EQUAL_INT(5000, gInitial_credits[1]);
|
||||
TEST_ASSERT_EQUAL_INT(3000, gInitial_credits[2]);
|
||||
TEST_ASSERT_EQUAL_STRING("NEWEAGLE.TXT", gBasic_car_names[0]);
|
||||
TEST_ASSERT_EQUAL_STRING("BLKEAGLE.TXT", gBasic_car_names[0]);
|
||||
TEST_ASSERT_EQUAL_FLOAT(0.2f, gDefault_default_water_spec_vol.gravity_multiplier);
|
||||
TEST_ASSERT_EQUAL_FLOAT(50.0f, gDefault_default_water_spec_vol.viscosity_multiplier);
|
||||
|
||||
|
@ -58,9 +58,38 @@ void test_loading_brfont() {
|
|||
TEST_ASSERT_EQUAL_INT(3, font->width[32]);
|
||||
}
|
||||
|
||||
void test_loading_opponents() {
|
||||
REQUIRES_DATA_DIRECTORY();
|
||||
tOpponent* o;
|
||||
|
||||
LoadOpponents();
|
||||
TEST_ASSERT_EQUAL_INT(40, gNumber_of_racers);
|
||||
o = &gOpponents[2];
|
||||
TEST_ASSERT_EQUAL_STRING("Agent Orange", o->name);
|
||||
TEST_ASSERT_EQUAL_STRING("Orange", o->abbrev_name);
|
||||
TEST_ASSERT_EQUAL_INT(12, o->car_number);
|
||||
TEST_ASSERT_EQUAL_INT(4, o->strength_rating);
|
||||
TEST_ASSERT_EQUAL_INT(eNet_avail_never, o->network_availability);
|
||||
TEST_ASSERT_EQUAL_STRING("LEADPUMP.FLI", o->mug_shot_name);
|
||||
TEST_ASSERT_EQUAL_STRING("AGENTO.TXT", o->car_file_name);
|
||||
TEST_ASSERT_EQUAL_STRING("AGENTO.FLI", o->stolen_car_flic_name);
|
||||
TEST_ASSERT_EQUAL_INT(2, o->text_chunk_count);
|
||||
TEST_ASSERT_EQUAL_INT(5, o->text_chunks[0].x_coord);
|
||||
TEST_ASSERT_EQUAL_INT(3, o->text_chunks[0].y_coord);
|
||||
TEST_ASSERT_EQUAL_INT(3, o->text_chunks[0].line_count);
|
||||
TEST_ASSERT_EQUAL_STRING("TOP SPEED: 150MPH", o->text_chunks[0].text[0]);
|
||||
}
|
||||
|
||||
void test_loading_powerups() {
|
||||
REQUIRES_DATA_DIRECTORY();
|
||||
|
||||
LoadPowerups();
|
||||
}
|
||||
|
||||
void test_loading_suite() {
|
||||
RUN_TEST(test_loading_GetCDPathFromPathsTxtFile);
|
||||
RUN_TEST(test_loading_OldDRfopen);
|
||||
RUN_TEST(test_loading_LoadGeneralParameters);
|
||||
RUN_TEST(test_loading_brfont);
|
||||
RUN_TEST(test_loading_opponents);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include "tests.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common/globvars.h"
|
||||
#include "common/powerup.h"
|
||||
|
||||
void test_loading_powerups() {
|
||||
REQUIRES_DATA_DIRECTORY();
|
||||
|
||||
LoadPowerups();
|
||||
}
|
||||
|
||||
void test_loading_suite() {
|
||||
RUN_TEST(test_loading_powerups);
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
#include "framework/unity.h"
|
||||
|
||||
#include "CORE/V1DB/dbsetup.h"
|
||||
#include "common/utility.h"
|
||||
|
||||
#include "common/globvars.h"
|
||||
#include "harness.h"
|
||||
|
@ -37,10 +38,12 @@ extern void test_register_suite();
|
|||
extern void test_pattern_suite();
|
||||
extern void test_pmfile_suite();
|
||||
extern void test_graphics_suite();
|
||||
extern void test_regsupt_suite();
|
||||
|
||||
char* root_dir;
|
||||
|
||||
void setUp(void) {
|
||||
gEncryption_method = 0;
|
||||
}
|
||||
|
||||
void tearDown(void) {
|
||||
|
@ -93,6 +96,7 @@ int main(int argc, char** argv) {
|
|||
test_pattern_suite();
|
||||
test_pmfile_suite();
|
||||
test_v1dbfile_suite();
|
||||
test_regsupt_suite();
|
||||
|
||||
// DETHRACE
|
||||
test_utility_suite();
|
||||
|
|
|
@ -110,6 +110,8 @@ def read_file():
|
|||
modules.append(current_module)
|
||||
last_fn = None
|
||||
last_local_type = ''
|
||||
if 'loading.c' not in current_module['name']:
|
||||
continue
|
||||
# if len(modules) == 2:
|
||||
# break
|
||||
|
||||
|
@ -647,6 +649,7 @@ def generate_c_file(module):
|
|||
|
||||
# functions
|
||||
for fn in module['functions']:
|
||||
print('function', fn)
|
||||
c_file.write(resolve_function_header(module, fn))
|
||||
c_file.write('\n')
|
||||
c_file.write(resolve_function_signature(module, fn))
|
||||
|
|
Loading…
Reference in New Issue