Skip to content

Commit 83ba373

Browse files
authored
Use BRender macro's + floats + move around code blocks (#250)
1 parent acd403f commit 83ba373

File tree

7 files changed

+464
-605
lines changed

7 files changed

+464
-605
lines changed

src/DETHRACE/common/car.c

+306-403
Large diffs are not rendered by default.

src/DETHRACE/common/finteray.c

+143-175
Large diffs are not rendered by default.

src/DETHRACE/common/loading.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3534,7 +3534,7 @@ int RestoreOptions() {
35343534
LOG_WARN("Failed to open OPTIONS.TXT");
35353535
return 0;
35363536
}
3537-
while (fgets(line, 80, f)) {
3537+
while (fgets(line, COUNT_OF(line), f)) {
35383538
if (sscanf(line, "%79s%f", token, &arg) == 2) {
35393539
if (!strcmp(token, "YonFactor")) {
35403540
SetYonFactor(arg);

src/DETHRACE/common/skidmark.c

+9-21
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,17 @@ void InitSkids() {
142142
for (skid = 0; skid < COUNT_OF(gSkids); skid++) {
143143
gSkids[skid].actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
144144
BrActorAdd(gNon_track_actor, gSkids[skid].actor);
145-
gSkids[skid].actor->t.t.mat.m[1][1] = 0.0099999998;
145+
gSkids[skid].actor->t.t.mat.m[1][1] = 0.01f;
146146
gSkids[skid].actor->render_style = BR_RSTYLE_NONE;
147147
square = BrModelAllocate(NULL, 4, 2);
148-
square->vertices[0].p.v[0] = -0.5;
149-
square->vertices[0].p.v[1] = 1.0;
150-
square->vertices[0].p.v[2] = -0.5;
151-
square->vertices[1].p.v[0] = -0.5;
152-
square->vertices[1].p.v[1] = 1.0;
153-
square->vertices[1].p.v[2] = 0.5;
154-
square->vertices[2].p.v[0] = 0.5;
155-
square->vertices[2].p.v[1] = 1.0;
156-
square->vertices[2].p.v[2] = 0.5;
157-
square->vertices[3].p.v[0] = 0.5;
158-
square->vertices[3].p.v[1] = 1.0;
159-
square->vertices[3].p.v[2] = -0.5;
160-
square->vertices[0].map.v[0] = 0.0;
161-
square->vertices[0].map.v[1] = 0.0;
162-
square->vertices[1].map.v[0] = 0.0;
163-
square->vertices[1].map.v[1] = 1.0;
164-
square->vertices[2].map.v[0] = 1.0;
165-
square->vertices[2].map.v[1] = 1.0;
166-
square->vertices[3].map.v[0] = 1.0;
167-
square->vertices[3].map.v[1] = 0.0;
148+
BrVector3Set(&square->vertices[0].p, -0.5f, 1.0f, -0.5f);
149+
BrVector3Set(&square->vertices[1].p, -0.5f, 1.0f, 0.5f);
150+
BrVector3Set(&square->vertices[2].p, 0.5f, 1.0f, 0.5f);
151+
BrVector3Set(&square->vertices[3].p, 0.5f, 1.0f, -0.5f);
152+
BrVector2Set(&square->vertices[0].map, 0.0f, 0.0f);
153+
BrVector2Set(&square->vertices[1].map, 0.0f, 1.0f);
154+
BrVector2Set(&square->vertices[2].map, 1.0f, 1.0f);
155+
BrVector2Set(&square->vertices[3].map, 1.0f, 0.0f);
168156
square->faces[0].vertices[0] = 0;
169157
square->faces[0].vertices[1] = 1;
170158
square->faces[0].vertices[2] = 2;

src/DETHRACE/common/spark.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void DrMatrix34Rotate(br_matrix34* mat, br_angle r, br_vector3* a) {
837837

838838
s = FastScalarSinAngle(r);
839839
c = FastScalarCosAngle(r);
840-
t = 1.0 - c;
840+
t = 1.0f - c;
841841
txy = t * a->v[0] * a->v[1];
842842
txz = t * a->v[0] * a->v[2];
843843
tyz = t * a->v[1] * a->v[2];
@@ -1316,8 +1316,8 @@ void CreatePuffOfSmoke(br_vector3* pos, br_vector3* v, br_scalar strength, br_sc
13161316

13171317
BrVector3InvScale(&gSmoke[gSmoke_num].v, v, WORLD_SCALE);
13181318
gSmoke[gSmoke_num].v.v[1] += (1.0f / WORLD_SCALE);
1319-
gSmoke[gSmoke_num].pos = *pos;
1320-
gSmoke[gSmoke_num].radius = 0.05;
1319+
BrVector3Copy(&gSmoke[gSmoke_num].pos, pos);
1320+
gSmoke[gSmoke_num].radius = 0.05f;
13211321
if ((pType & 0xF) == 7) {
13221322
gSmoke[gSmoke_num].radius *= 2.0f;
13231323
} else {

src/DETHRACE/common/structur.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void RaceCompleted(tRace_over_reason pReason) {
118118
default:
119119
break;
120120
}
121-
if (gNet_mode) {
121+
if (gNet_mode != eNet_mode_none) {
122122
gRace_finished = 8000;
123123
} else {
124124
gRace_finished = 4000;

src/S3/audio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ tS3_sound_source* S3CreateSoundSourceBR(br_vector3* pPosition, br_vector3* pVelo
612612
return 0;
613613
}
614614
source = S3CreateSoundSource(pPosition, pVelocity, pBound_outlet);
615-
if (source) {
615+
if (source != NULL) {
616616
source->brender_vector = 1;
617617
}
618618
return source;

0 commit comments

Comments
 (0)