Skip to content

Commit db3d6ac

Browse files
Implement edit functions + functions around camera + ... (#146)
* Fix SEGFAULT due to reading out of bounds (we were using wrong index) * Use floats instead of doubles * Implement all flicplay.c functions * Compare ptr against NULL * Implement TotalRepair * Implement some edit functions * Implement actor/special volume related edit functions * Implement MungeSpecialVolume * Implement a few depth functions * Fix location of spawned actors (when SHIFT was not pressed) Co-authored-by: Dethrace Engineering Department <78985374+dethrace-labs@users.noreply.github.com>
1 parent b5ccfe7 commit db3d6ac

File tree

10 files changed

+1215
-194
lines changed

10 files changed

+1215
-194
lines changed

src/BRSRC13/include/brender/brender.h

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern struct br_font* BrFontProp7x9;
1212
// BrActor
1313
br_actor* BrActorLoad(char* filename);
1414
br_uint_32 BrActorLoadMany(char* filename, br_actor** actors, br_uint_16 num);
15+
br_uint_32 BrActorSave(char* filename, br_actor* ptr);
1516
br_actor* BrActorAllocate(br_uint_8 type, void* type_data);
1617
br_actor* BrActorAdd(br_actor* parent, br_actor* a);
1718
void BrActorRelink(br_actor* parent, br_actor* a);
@@ -77,6 +78,7 @@ void BrMatrix34Copy(br_matrix34* A, br_matrix34* B);
7778
void BrMatrix34PreRotateY(br_matrix34* mat, br_angle ry);
7879
void BrMatrix34RotateY(br_matrix34* mat, br_angle ry);
7980
void BrMatrix34PostScale(br_matrix34* mat, br_scalar sx, br_scalar sy, br_scalar sz);
81+
void BrMatrix34PreScale(br_matrix34* mat, br_scalar sx, br_scalar sy, br_scalar sz);
8082
void BrMatrix34PreTransform(br_matrix34* mat, br_transform* xform);
8183
void BrMatrix34PostTransform(br_matrix34* mat, br_transform* xform);
8284
void BrMatrix34PreRotateX(br_matrix34* mat, br_angle rx);
@@ -118,6 +120,7 @@ br_model* BrModelLoad(char* filename);
118120
void BrModelFree(br_model* model);
119121
void BrModelUpdate(br_model* model, br_uint_16 flags);
120122
br_uint_32 BrModelLoadMany(char* filename, br_model** models, br_uint_16 num);
123+
br_uint_32 BrModelSaveMany(char* filename, br_model** models, br_uint_16 num);
121124
br_model_find_cbfn* BrModelFindHook(br_model_find_cbfn* hook);
122125

123126
// BrPixelmap

src/DETHRACE/common/car.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,26 @@ void MungeSpecialVolume(tCollision_info* pCar) {
12061206
tCar_spec* car;
12071207
LOG_TRACE("(%p)", pCar);
12081208

1209-
STUB_ONCE();
1209+
new_special_volume = FindSpecialVolume(&pCar->pos, pCar->last_special_volume);
1210+
if (pCar->auto_special_volume != NULL && (new_special_volume == NULL || new_special_volume->gravity_multiplier == 1.f)) {
1211+
if (pCar->water_d == 10000.f && pCar->water_depth_factor != 1.f) {
1212+
pCar->auto_special_volume = NULL;
1213+
} else {
1214+
new_special_volume = pCar->auto_special_volume;
1215+
}
1216+
}
1217+
if (pCar->last_special_volume != new_special_volume && pCar->driver == eDriver_local_human) {
1218+
if (pCar->last_special_volume != NULL && pCar->last_special_volume->exit_noise >= 0 && (new_special_volume == NULL || pCar->last_special_volume->exit_noise != new_special_volume->exit_noise)) {
1219+
DRS3StartSound(gCar_outlet, pCar->last_special_volume->exit_noise);
1220+
}
1221+
if (new_special_volume != NULL && new_special_volume->entry_noise >= 0 && (pCar->last_special_volume == NULL || pCar->last_special_volume->entry_noise != new_special_volume->entry_noise)) {
1222+
DRS3StartSound(gCar_outlet, new_special_volume->entry_noise);
1223+
}
1224+
}
1225+
pCar->last_special_volume = new_special_volume;
1226+
if (new_special_volume != NULL && pCar->num_smoke_columns != 0 && pCar->last_special_volume != NULL && pCar->last_special_volume->gravity_multiplier < 1.f) {
1227+
StopCarSmoking((tCar_spec*)pCar);
1228+
}
12101229
}
12111230

12121231
// IDA: void __usercall ResetCarSpecialVolume(tCollision_info *pCar@<EAX>)

0 commit comments

Comments
 (0)