MCPcopy Create free account
hub / github.com/assaultcube/AC / render_wall

Function render_wall

source/src/worldrender.cpp:6–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "cube.h"
5
6void render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d1, sqr *d2, bool topleft, int dir)
7{
8 if(minimap) return;
9 if(SOLID(o) || o->type==SEMISOLID)
10 {
11 float c1 = s->floor;
12 float c2 = s->floor;
13 if(s->type==FHF) { c1 -= d1->vdelta/4.0f; c2 -= d2->vdelta/4.0f; }
14 float f1 = s->ceil;
15 float f2 = s->ceil;
16 if(s->type==CHF) { f1 += d1->vdelta/4.0f; f2 += d2->vdelta/4.0f; }
17 //if(f1-c1<=0 && f2-c2<=0) return;
18 render_square(o->wtex, c1, c2, f1, f2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft, dir);
19 return;
20 }
21 {
22 float f1 = s->floor;
23 float f2 = s->floor;
24 float c1 = o->floor;
25 float c2 = o->floor;
26 if(o->type==FHF && s->type!=FHF)
27 {
28 c1 -= d1->vdelta/4.0f;
29 c2 -= d2->vdelta/4.0f;
30 }
31 if(s->type==FHF && o->type!=FHF)
32 {
33 f1 -= d1->vdelta/4.0f;
34 f2 -= d2->vdelta/4.0f;
35 }
36 if(f1>=c1 && f2>=c2) goto skip;
37 render_square(o->wtex, f1, f2, c1, c2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft, dir);
38 }
39 skip:
40 {
41 float f1 = o->ceil;
42 float f2 = o->ceil;
43 float c1 = s->ceil;
44 float c2 = s->ceil;
45 if(o->type==CHF && s->type!=CHF)
46 {
47 f1 += d1->vdelta/4.0f;
48 f2 += d2->vdelta/4.0f;
49 }
50 else if(s->type==CHF && o->type!=CHF)
51 {
52 c1 += d1->vdelta/4.0f;
53 c2 += d2->vdelta/4.0f;
54 }
55 if(c1<=f1 && c2<=f2) return;
56 render_square(o->utex, f1, f2, c1, c2, x1<<mip, y1<<mip, x2<<mip, y2<<mip, 1<<mip, d1, d2, topleft, dir);
57 }
58}
59
60const int MAX_MIP = 5; // 32x32 unit blocks
61const int MIN_LOD = 2;

Callers 1

worldrender.cppFile · 0.85

Calls 1

render_squareFunction · 0.85

Tested by

no test coverage detected