@@ -72,17 +72,20 @@ public static void drawClipping() {
72
72
for (int y = Math .max (0 , tileY - clippingRenderDistance ); y < Math .min (104 , tileY + clippingRenderDistance ); y ++) {
73
73
int data = Landscape .currentCollisionMap [Player .worldLevel ].clippingData [x ][y ];
74
74
75
+ // center of tile to avoid needless projection calcs in next step
75
76
Point2d screenPos = MovedStatics .getProjectedScreenPosition (0 , y * 128 + 64 , x * 128 + 64 );
76
77
77
78
if (screenPos == null ) {
78
79
continue ;
79
80
}
80
81
82
+ // ground-level points to indicate walkability
81
83
Point2d posSW = MovedStatics .getProjectedScreenPosition (0 , y * 128 , x * 128 );
82
84
Point2d posNW = MovedStatics .getProjectedScreenPosition (0 , y * 128 + 128 , x * 128 );
83
85
Point2d posSE = MovedStatics .getProjectedScreenPosition (0 , y * 128 , x * 128 + 128 );
84
86
Point2d posNE = MovedStatics .getProjectedScreenPosition (0 , y * 128 + 128 , x * 128 + 128 );
85
87
88
+ // mid-level points to indicate projectile shootability
86
89
Point2d posSWA = MovedStatics .getProjectedScreenPosition (100 , y * 128 , x * 128 );
87
90
Point2d posNWA = MovedStatics .getProjectedScreenPosition (100 , y * 128 + 128 , x * 128 );
88
91
Point2d posSEA = MovedStatics .getProjectedScreenPosition (100 , y * 128 , x * 128 + 128 );
@@ -91,31 +94,31 @@ public static void drawClipping() {
91
94
int blockWalkColor = 0xFF0000 ;
92
95
int blockProjectileColor = 0x539FE9 ;
93
96
94
- if ((data & 0x2 ) == 0x2 ) {
97
+ if ((data & 0x2 ) == 0x2 ) { // north
95
98
if (posNE != null && posNW != null ) {
96
99
Rasterizer .drawDiagonalLine (posNE .x , posNE .y , posNW .x , posNW .y , blockWalkColor );
97
100
}
98
101
}
99
102
100
- if ((data & 0x8 ) == 0x8 ) {
103
+ if ((data & 0x8 ) == 0x8 ) { // east
101
104
if (posSE != null && posNE != null ) {
102
105
Rasterizer .drawDiagonalLine (posSE .x , posSE .y , posNE .x , posNE .y , blockWalkColor );
103
106
}
104
107
}
105
108
106
- if ((data & 0x20 ) == 0x20 ) {
109
+ if ((data & 0x20 ) == 0x20 ) { // south
107
110
if (posSE != null && posSW != null ) {
108
111
Rasterizer .drawDiagonalLine (posSE .x , posSE .y , posSW .x , posSW .y , blockWalkColor );
109
112
}
110
113
}
111
114
112
- if ((data & 0x80 ) == 0x80 ) {
115
+ if ((data & 0x80 ) == 0x80 ) { // west
113
116
if (posSW != null && posNW != null ) {
114
117
Rasterizer .drawDiagonalLine (posSW .x , posSW .y , posNW .x , posNW .y , blockWalkColor );
115
118
}
116
119
}
117
120
118
- if ((data & 0x100 ) == 0x100 ) {
121
+ if ((data & 0x100 ) == 0x100 ) { // total block
119
122
if (posNE != null && posNW != null ) {
120
123
Rasterizer .drawDiagonalLine (posNE .x , posNE .y , posNW .x , posNW .y , blockWalkColor );
121
124
}
@@ -130,7 +133,10 @@ public static void drawClipping() {
130
133
}
131
134
}
132
135
133
- if ((data & 0x400 ) == 0x400 ) {
136
+ // below this are projectiles. these draw more lines than the ground-level ones,
137
+ // because there are vertical bars to join them to the ground
138
+
139
+ if ((data & 0x400 ) == 0x400 ) { // north (projectile)
134
140
if (posNEA != null && posNWA != null ) {
135
141
Rasterizer .drawDiagonalLine (posNEA .x , posNEA .y , posNWA .x , posNWA .y , blockProjectileColor );
136
142
@@ -144,25 +150,25 @@ public static void drawClipping() {
144
150
}
145
151
}
146
152
147
- if ((data & 0x1000 ) == 0x1000 ) {
153
+ if ((data & 0x1000 ) == 0x1000 ) { // east (projectile)
148
154
if (posSEA != null && posNEA != null ) {
149
155
Rasterizer .drawDiagonalLine (posSEA .x , posSEA .y , posNEA .x , posNEA .y , blockProjectileColor );
150
156
}
151
157
}
152
158
153
- if ((data & 0x4000 ) == 0x4000 ) {
159
+ if ((data & 0x4000 ) == 0x4000 ) { // south (projectile)
154
160
if (posSEA != null && posSWA != null ) {
155
161
Rasterizer .drawDiagonalLine (posSEA .x , posSEA .y , posSWA .x , posSWA .y , blockProjectileColor );
156
162
}
157
163
}
158
164
159
- if ((data & 0x8000 ) == 0x8000 ) {
165
+ if ((data & 0x10000 ) == 0x10000 ) { // west (projectile)
160
166
if (posSWA != null && posNWA != null ) {
161
167
Rasterizer .drawDiagonalLine (posSWA .x , posSWA .y , posNWA .x , posNWA .y , blockProjectileColor );
162
168
}
163
169
}
164
170
165
- if ((data & 0x20000 ) == 0x20000 ) {
171
+ if ((data & 0x20000 ) == 0x20000 ) { // total block (projectile)
166
172
if (posNEA != null && posNWA != null ) {
167
173
Rasterizer .drawDiagonalLine (posNEA .x , posNEA .y , posNWA .x , posNWA .y , blockProjectileColor );
168
174
0 commit comments