Differences From Artifact [38933acc1f]:
- File src/worldlight.m — part of check-in [51fb59fc93] at 2025-03-23 17:45:28 on branch trunk — Remove fast_f2nat (user: js, size: 6259) [annotate] [blame] [check-ins using]
To Artifact [230a66c274]:
- File
src/worldlight.m
— part of check-in
[304230c1e1]
at
2025-03-23 21:52:54
on branch trunk
— Avoid pointless pointers
Passing OFVector3D by reference is annoying and is worse at passing via registers. (user: js, size: 6236) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
195 196 197 198 199 200 201 | [dlights removeLastItem]; blockpaste(backup); OFFreeMemory(backup); } } void | | | | | | | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | [dlights removeLastItem]; blockpaste(backup); OFFreeMemory(backup); } } void dodynlight(OFVector3D vold, OFVector3D v, int reach, int strength, DynamicEntity *owner) { if (!reach) reach = dynlight; if ([owner isKindOfClass:Monster.class]) reach = reach / 2; if (!reach) return; if (v.x < 0 || v.y < 0 || v.x > ssize || v.y > ssize) return; int creach = reach + 16; // dependant on lightray random offsets! struct block b = { (int)v.x - creach, (int)v.y - creach, creach * 2 + 1, creach * 2 + 1 }; if (b.x < 1) b.x = 1; if (b.y < 1) b.y = 1; if (b.xs + b.x > ssize - 2) b.xs = ssize - 2 - b.x; if (b.ys + b.y > ssize - 2) b.ys = ssize - 2 - b.y; if (dlights == nil) dlights = [[OFMutableData alloc] initWithItemSize:sizeof(struct block *)]; // backup area before rendering in dynlight struct block *copy = blockcopy(&b); [dlights addItem:©]; Entity *l = [Entity entity]; l.x = v.x; l.y = v.y; l.z = v.z; l.attr1 = reach; l.type = LIGHT; l.attr2 = strength; calclightsource(l); postlightarea(&b); } |
︙ | ︙ |