Differences From Artifact [8500b9ce45]:
- File src/physics.m — part of check-in [0ee94739ce] at 2025-03-25 23:38:08 on branch trunk — Clean up Variable (user: js, size: 12292) [annotate] [blame] [check-ins using]
To Artifact [95d4c13f64]:
- File
src/physics.m
— part of check-in
[75e920ae30]
at
2025-03-29 14:25:43
on branch trunk
— Switch from clang-format to manual formatting
clang-format does too many weird things. (user: js, size: 12270) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 | if (o.origin.z - o.eyeHeight < *hi) *hi = o.origin.z - o.eyeHeight - 1; } else if (o.origin.z + o.aboveEye > *lo) *lo = o.origin.z + o.aboveEye + 1; if (fabs(o.origin.z - d.origin.z) < o.aboveEye + d.eyeHeight) return false; | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | if (o.origin.z - o.eyeHeight < *hi) *hi = o.origin.z - o.eyeHeight - 1; } else if (o.origin.z + o.aboveEye > *lo) *lo = o.origin.z + o.aboveEye + 1; if (fabs(o.origin.z - d.origin.z) < o.aboveEye + d.eyeHeight) return false; if ([d isKindOfClass: Monster.class]) return false; // hack *headspace = d.origin.z - o.origin.z - o.aboveEye - d.eyeHeight; if (*headspace < 0) *headspace = 10; } |
︙ | ︙ | |||
104 105 106 107 108 109 110 | const float fy2 = d.origin.y + d.radius; const int x1 = fx1; const int y1 = fy1; const int x2 = fx2; const int y2 = fy2; float hi = 127, lo = -128; // big monsters are afraid of heights, unless angry :) | | < | < | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | const float fy2 = d.origin.y + d.radius; const int x1 = fx1; const int y1 = fy1; const int x2 = fx2; const int y2 = fy2; float hi = 127, lo = -128; // big monsters are afraid of heights, unless angry :) float minfloor = ([d isKindOfClass: Monster.class] && !spawn && d.health > 100 ? d.origin.z - d.eyeHeight - 4.5f : -1000.0f); for (int x = x1; x <= x2; x++) { for (int y = y1; y <= y2; y++) { // collide with map if (OUTBORD(x, y)) return false; struct sqr *s = S(x, y); |
︙ | ︙ | |||
324 325 326 327 328 329 330 | // correct water feel if (water) pl.velocity = OFMakeVector3D( pl.velocity.x / 8, pl.velocity.y / 8, pl.velocity.z); if (local) playsoundc(S_JUMP); | | | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | // correct water feel if (water) pl.velocity = OFMakeVector3D( pl.velocity.x / 8, pl.velocity.y / 8, pl.velocity.z); if (local) playsoundc(S_JUMP); else if ([pl isKindOfClass: Monster.class]) { OFVector3D loc = pl.origin; playsound(S_JUMP, &loc); } } else if (pl.timeInAir > 800) { // if we land after long time must have been a // high jump, make thud sound if (local) playsoundc(S_LAND); else if ([pl isKindOfClass: Monster.class]) { OFVector3D loc = pl.origin; playsound(S_LAND, &loc); } } pl.timeInAir = 0; } else |
︙ | ︙ |