Comment: | Switch from clang-format to manual formatting
clang-format does too many weird things. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
75e920ae307d96d6ce0141652617959f |
User & Date: | js on 2025-03-29 14:25:43 |
Other Links: | manifest | tags |
2025-03-29
| ||
17:13 | More style fixes check-in: c634a689e7 user: js tags: trunk | |
14:25 | Switch from clang-format to manual formatting check-in: 75e920ae30 user: js tags: trunk | |
13:01 | Make more use of OFColor check-in: 932a90c261 user: js tags: trunk | |
Deleted src/.clang-format version [0d630f9489].
Modified src/Alias.h from [9b91901d8c] to [0fb6418ce5].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - - - - - - - + + + + + + + | #import "Identifier.h" OF_ASSUME_NONNULL_BEGIN @interface Alias: Identifier @property (direct, copy, nonatomic) OFString *action; @property (readonly, nonatomic) bool persisted; |
Modified src/Alias.m from [dce3b067a2] to [fe2a009013].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - - - + + + - - - + + + - - - + + + - + | #import "Alias.h" @implementation Alias |
Modified src/Command.h from [710ad3a2bf] to [f6eb8c644d].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + | #import "Identifier.h" OF_ASSUME_NONNULL_BEGIN |
Modified src/Command.m from [1956763843] to [254356cb16].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + - - - + + + - - - + + + - - - + + + - + - + - + - - + + - - - + + + - - - - + + + + | OFMutableArray<OFString *> *copy; if (arguments.count >= count) return arguments; copy = [arguments mutableCopy]; while (copy.count < count) |
︙ | |||
150 151 152 153 154 155 156 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - - + + | arguments[1], arguments[2]); } break; case ARG_VARI: if (isDown) // limit, remove ((void (^)(OFString *))_block)([[arguments |
Modified src/ConsoleLine.h from [3048f3e388] to [7afa80390f].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 | - - + + | #import <ObjFW/ObjFW.h> OF_DIRECT_MEMBERS @interface ConsoleLine: OFObject @property (readonly, copy) OFString *text; @property (readonly) int outtime; |
Modified src/ConsoleLine.m from [8c83ebcd46] to [558d4dd328].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + - + - + | #import "ConsoleLine.h" @implementation ConsoleLine |
︙ |
Modified src/Cube.m from [37d676edf6] to [67dd855e73].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - + | } + (Cube *)sharedInstance { return (Cube *)OFApplication.sharedApplication.delegate; } |
︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + - + - - + + - - + + | { 'i', @"ip", 1, NULL, &ip }, { 'm', @"master", 1, NULL, &master }, { 'p', @"password", 1, NULL, &passwd }, { 'c', @"max-clients", 1, NULL, NULL }, { '\0', nil, 0, NULL, NULL } }; OFOptionsParser *optionsParser = |
︙ | |||
141 142 143 144 145 146 147 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + - - - + - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - + - - - - + + - - - - + + - - - + - + - + - + - + | SDL_ShowCursor(0); log(@"gl"); gl_init(_width, _height); log(@"basetex"); int xs, ys; |
︙ | |||
291 292 293 294 295 296 297 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | - + - + - + | break; } } } } } |
︙ | |||
335 336 337 338 339 340 341 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - - + + - - - + + - + - - + + - + - - + + - + - + | memcpy(dest, (char *)image->pixels + 3 * _width * (_height - 1 - idx), 3 * _width); endianswap(dest, 3, _width); } |
Modified src/DynamicEntity.h from [0ee26a40fb] to [0008508591].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 | - + | @property (direct, readonly, nonatomic) int *ammo; @property (direct, nonatomic) bool attacking; // used by physics to signal ai @property (direct, nonatomic) bool blocked, moving; @property (direct, copy, nonatomic) OFString *name; - (OFData *)dataBySerializing; |
Modified src/DynamicEntity.m from [7a1598ea36] to [ba58eb8bdf].
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | - + - + - + - + | .moving = _moving }; for (int i = 0; i < NUMGUNS; i++) data.ammo[i] = _ammo[i]; memcpy(data.name, _name.UTF8String, min(_name.UTF8StringLength, 259)); |
︙ | |||
235 236 237 238 239 240 241 | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + - + - + | for (int i = 0; i < NUMGUNS; i++) _ammo[i] = d.ammo[i]; _blocked = d.blocked; _moving = d.moving; |
︙ |
Modified src/Identifier.h from [79fe1b6b9a] to [91de4ded4b].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + | #import <ObjFW/ObjFW.h> OF_ASSUME_NONNULL_BEGIN @interface Identifier: OFObject @property (direct, readonly, copy, nonatomic) OFString *name; @property (class, direct, readonly, nonatomic) OFMutableDictionary<OFString *, __kindof Identifier *> *identifiers; - (instancetype)init OF_UNAVAILABLE; |
Modified src/Identifier.m from [9cd9c4b220] to [eff0175544].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | } + (OFMutableDictionary<OFString *, __kindof Identifier *> *)identifiers { return identifiers; } |
︙ |
Modified src/KeyMapping.h from [3b8ccce865] to [7e5483fe4c].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + - + | #import <ObjFW/ObjFW.h> OF_ASSUME_NONNULL_BEGIN OF_DIRECT_MEMBERS @interface KeyMapping: OFObject @property (readonly) int code; @property (readonly, nonatomic) OFString *name; @property (copy, nonatomic) OFString *action; |
Modified src/KeyMapping.m from [49eed66821] to [962ce788ca].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + - + - + | #import "KeyMapping.h" @implementation KeyMapping |
︙ |
Modified src/MD2.h from [738081230a] to [25323c6c56].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - - - - - - - - - - - - + + + + + + + + + + + + | @interface MD2: OFObject @property (nonatomic) MapModelInfo *mmi; @property (copy, nonatomic) OFString *loadname; @property (nonatomic) int mdlnum; @property (nonatomic) bool loaded; + (instancetype)md2; |
Modified src/MD2.m from [eb988e3999] to [64d68c27a0].
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | - + - - - + + + - + - + - - - + + + - - - + + + - + - - - - - - - - - - + + + + + + + + + + - + | if (_mverts != NULL) for (size_t i = 0; i < _numFrames; i++) OFFreeMemory(_mverts[i]); OFFreeMemory(_mverts); } |
︙ |
Modified src/MapModelInfo.h from [3aab1dec04] to [9966a1ab68].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - - - - - + + + + + - - - - - + + + + + | #import <ObjFW/ObjFW.h> OF_ASSUME_NONNULL_BEGIN OF_DIRECT_MEMBERS @interface MapModelInfo: OFObject @property (nonatomic) int rad, h, zoff, snap; @property (copy, nonatomic) OFString *name; |
Modified src/MapModelInfo.m from [d506409929] to [19135ee4c2].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - - - - - + + + + + - + + + + + - - - - - + + + + + | #import "MapModelInfo.h" @implementation MapModelInfo |
︙ |
Modified src/Menu.h from [213d149aa4] to [fddccab06a].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + - + | #import <ObjFW/ObjFW.h> OF_ASSUME_NONNULL_BEGIN @class MenuItem; OF_DIRECT_MEMBERS @interface Menu: OFObject @property (readonly, nonatomic) OFString *name; @property (readonly) OFMutableArray<MenuItem *> *items; @property (nonatomic) int mwidth; @property (nonatomic) int menusel; |
Modified src/Menu.m from [e5fbce3936] to [106bd88ce2].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + - + - + | #import "Menu.h" @implementation Menu |
︙ |
Modified src/MenuItem.h from [969de9221d] to [d2df5485ed].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 | - + - + | #import <ObjFW/ObjFW.h> OF_DIRECT_MEMBERS @interface MenuItem: OFObject @property (readonly, nonatomic) OFString *text, *action; |
Modified src/MenuItem.m from [5ee318d452] to [c51eda1a22].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - + - + - + - + | #import "MenuItem.h" @implementation MenuItem |
︙ |
Modified src/Monster.h from [f02a70099a] to [ecb02516a6].
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - - - - - - - - - - - - + + + + + + + + + + + + | // called after map start of when toggling edit mode to reset/spawn all // monsters to initial state + (void)restoreAll; + (void)resetAll; + (void)thinkAll; + (void)renderAll; // TODO: Move this somewhere else |
Modified src/Monster.m from [96bb3308b2] to [911d4fb855].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - - - - - + + + + + - - - - - + + + + + | } + (OFMutableArray<Monster *> *)monsters { return monsters; } |
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - - - - + + + + + | @"a hellpig", @"monster/hellpig" }, { GUN_ICEBALL, 12, 250, 1, 0, 10, 400, 6, 18, 18, S_PAINH, S_DEATHH, @"a knight", @"monster/knight" }, { GUN_SLIMEBALL, 15, 100, 1, 0, 200, 400, 2, 13, 10, S_PAIND, S_DEATHD, @"a goblin", @"monster/goblin" }, }; |
︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - - - - - + + + + + - - - - - + + + + + - + | for (int i = 0;; i++) { if ((n -= monstertypes[i].freq) < 0) { type = i; break; } } |
︙ | |||
233 234 235 236 237 238 239 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + - + - + | // where they execute a particular behaviour until the trigger time is hit, and // then they reevaluate their situation based on the current state, the // environment etc., and transition to the next state. Transition timeframes are // parametrized by difficulty level (skill), faster transitions means quicker // decision making means tougher AI. // n = at skill 0, n/2 = at skill 10, r = added random factor |
︙ | |||
284 285 286 287 288 289 290 | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | - - - - + + + + - + + + + - + - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - - - - + + + + - + - + - + | if (!rnd(20000 / monstertypes[self.monsterType].speed)) self.jumpNext = true; // search for a way around (common) else if (self.trigger < lastmillis && (self.monsterState != M_HOME || !rnd(5))) { // patented "random walk" AI pathfinding (tm) ;) self.targetYaw += 180 + rnd(180); |
︙ |
Modified src/OFColor+Cube.m from [830e6212b6] to [a418a3dce6].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 | - + | #include "cube.h" #import "OFColor+Cube.h" @implementation OFColor (Cube) - (void)cube_setAsGLColor { float red, green, blue, alpha; |
Modified src/OFString+Cube.h from [521e5eedaf] to [4053523497].
1 2 3 4 5 | 1 2 3 4 5 6 7 | - + | #import <ObjFW/ObjFW.h> @interface OFString (Cube) @property (readonly, nonatomic) int cube_intValue; |
Modified src/OFString+Cube.m from [fe77741148] to [fa8b89b835].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + - + | return 0; } @catch (OFOutOfRangeException *e) { conoutf(@"invalid value: %@", self); return 0; } } |
︙ |
Modified src/Player.m from [0c9f736137] to [312fff2095].
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | } + (instancetype)player { return [[self alloc] init]; } |
︙ |
Modified src/ResolverResult.h from [48e906dbd2] to [97bc46e6ab].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - + + - + + | #import <ObjFW/ObjFW.h> #import "cube.h" OF_DIRECT_MEMBERS @interface ResolverResult: OFObject @property (readonly, nonatomic) OFString *query; @property (readonly, nonatomic) ENetAddress address; |
Modified src/ResolverResult.m from [36dcd5aa96] to [2be4a1c685].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + - + - + | #import "ResolverResult.h" @implementation ResolverResult |
︙ |
Modified src/ResolverThread.m from [5a480794ce] to [c6ab30f422].
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - - - + + + | _starttime = lastmillis; } ENetAddress address = { ENET_HOST_ANY, CUBE_SERVINFO_PORT }; enet_address_set_host(&address, _query.UTF8String); @synchronized(ResolverThread.class) { |
︙ |
Modified src/ServerInfo.h from [8949d4cc02] to [688d346abd].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | - + - + | #import <ObjFW/ObjFW.h> #include <enet/enet.h> OF_DIRECT_MEMBERS @interface ServerInfo: OFObject <OFComparing> @property (readonly, nonatomic) OFString *name; @property (copy, nonatomic) OFString *full; @property (copy, nonatomic) OFString *map; @property (copy, nonatomic) OFString *sdesc; @property (nonatomic) int mode, numplayers, ping, protocol, minremain; @property (nonatomic) ENetAddress address; |
Modified src/ServerInfo.m from [77aa772923] to [774d015eb0].
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + - + - + - + - + - + | #import "ServerInfo.h" #include "cube.h" @implementation ServerInfo |
Modified src/Variable.h from [b06c507597] to [780b5706d6].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - + | #import "Identifier.h" OF_ASSUME_NONNULL_BEGIN |
Modified src/Variable.m from [eb5893de54] to [60a145c003].
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - + | #import "Variable.h" #include "cube.h" @implementation Variable |
︙ |
Modified src/clientextras.m from [89ccbf227a] to [d459541c88].
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + - + - - + + - - + + - + - + - + - - - - - + + + + + - - - + + - - - + + + - + - + | } } if (mz < -1000) return; // mdl = (((int)d>>6)&1)+1; // mz = d.o.z-d.eyeHeight+0.2f; // scale = 1.2f; |
︙ | |||
153 154 155 156 157 158 159 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + - + - - + + - + | { if (!scoreson) return; [scoreLines removeAllObjects]; if (!demoplayback) renderscore(Player.player1); for (Player *player in players) |
︙ | |||
200 201 202 203 204 205 206 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - + - - + - - + | } memcpy(p, mapdata.items, mapdata.count); p += mapdata.count; *(unsigned short *)start = ENET_HOST_TO_NET_16(p - start); enet_packet_resize(packet, p - start); sendpackettoserv(packet); conoutf(@"sending map %@ to server...", mapname); |
Modified src/clientgame.m from [591f2f2799] to [0b8b0d202d].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | #import "OFString+Cube.h" #import "Player.h" #import "Variable.h" int nextmode = 0; // nextmode becomes gamemode after next map load VAR(gamemode, 1, 0, 0); |
︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + | } static void arenacount(Player *d, int *alive, int *dead, OFString **lastteam, bool *oneteam) { if (d.state != CS_DEAD) { (*alive)++; |
︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - - - - + + + + - - - - - + + + + + - - - - - + + + + + | } extern int democlientnum; void otherplayers() { |
︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + | } // if we die in SP we try the same map again respawnself(); } } int sleepwait = 0; static OFString *sleepcmd = nil; |
︙ | |||
233 234 235 236 237 238 239 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - - - - - - + + + + + + - + - + - + | entinmap(d); [d resetToSpawnState]; d.state = CS_ALIVE; } // movement input code |
︙ | |||
372 373 374 375 376 377 378 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | - + - + | { if (cn < 0 || cn >= MAXCLIENTS) { neterr(@"clientnum"); return nil; } while (cn >= players.count) |
︙ | |||
414 415 416 417 418 419 420 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | - + - + | sleepwait = 0; [Monster resetAll]; projreset(); spawncycle = -1; spawnplayer(Player.player1); Player.player1.frags = 0; for (Player *player in players) |
Modified src/clients.m from [0204d78717] to [0b6e5b2153].
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - + - + - + - + - - + + | static void newname(OFString *name) { c2sinit = false; if (name.length > 16) |
︙ | |||
181 182 183 184 185 186 187 | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + - + - + - + - - - - - + + + + + - + - + - + | void toserver(OFString *text) { conoutf(@"%@:\f %@", Player.player1.name, text); ctext = text; } |
︙ | |||
313 314 315 316 317 318 319 | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | - - - - + + + | putint(&p, (int)(d.pitch * DAF)); putint(&p, (int)(d.roll * DAF)); // quantize to 1/100, almost always 1 byte putint(&p, (int)(d.velocity.x * DVF)); putint(&p, (int)(d.velocity.y * DVF)); putint(&p, (int)(d.velocity.z * DVF)); // pack rest in 1 byte: strafe:2, move:2, onFloor:1, state:3 |
︙ | |||
345 346 347 348 349 350 351 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | - + - - + + | putint(&p, SV_INITC2S); sendstring(Player.player1.name, &p); sendstring(Player.player1.team, &p); putint(&p, Player.player1.lifeSequence); } for (OFData *msg in messages) { // send messages collected during the previous frames |
︙ |
Modified src/clients2c.m from [476557dd41] to [11f87c82e6].
︙ | |||
170 171 172 173 174 175 176 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | - - - + + + + - - + | if (mapchanged) setspawn(n, true); break; } // server requests next map case SV_MAPRELOAD: { getint(&p); |
︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - + | OFVector3D loc = d_.origin; playsound(S_DIE1 + rnd(2), &loc); d_.lifeSequence++; break; } case SV_FRAGS: |
︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + | case SV_EDITENT: // coop edit of ent { unsigned int i = getint(&p); while (ents.count <= i) { Entity *e = [Entity entity]; e.type = NOTUSED; |
︙ | |||
368 369 370 371 372 373 374 | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | - + | addmsg(0, 2, SV_CLIENTPING, Player.player1.ping = (Player.player1.ping * 5 + lastmillis - getint(&p)) / 6); break; case SV_CLIENTPING: |
︙ |
Modified src/commands.m from [45f7f8cf15] to [e072f98aae].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - - - + + + - + - + - + - + - + | void alias(OFString *name, OFString *action) { Alias *alias = Identifier.identifiers[name]; if (alias == nil) |
︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | - - + + | return NULL; } } char *s = strndup(word, *p - word - 1); if (left == '(') { OFString *t; @try { |
︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | - + - - - + + + + - + - + - + - + - + - - + + - + - + | } // find value of ident referenced with $ in exp OFString * lookup(OFString *n) { __kindof Identifier *identifier = |
︙ | |||
235 236 237 238 239 240 241 | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | - - + + - + - - + + - - + + - + - - - + + + - + - + - + - + - - - + + + + + - - - - - - + + + + + + - + - - - + + + - - + + - + - + - - - - + + + + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - - + + - + - + | } p += strcspn(p, ";\n\0"); // more statements if this isn't the end of the string cont = *p++ != 0; OFString *c = w[0]; // strip irc-style command prefix |
Modified src/console.m from [a83084fb6c] to [1d463d8f9f].
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - + - + - + - - - + + + - - + + - - + + | const int ndraw = 5; const int WORDWRAP = 80; int conskip = 0; bool saycommandon = false; static OFMutableString *commandbuf; |
︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | - + - - + + - + - + - + | (FONTH / 4 * 5) * (nd - j - 1) + FONTH / 3, 2); } // keymap is defined externally in keymap.cfg static OFMutableArray<KeyMapping *> *keyMappings = nil; |
︙ | |||
139 140 141 142 143 144 145 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - + - + - + - + | if (init == nil) init = @""; commandbuf = [init mutableCopy]; } |
︙ | |||
222 223 224 225 226 227 228 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | - - + + - - + + - + | if (commandbuf.length > 0) { if (vhistory == nil) vhistory = [[OFMutableArray alloc] init]; if (vhistory.count == 0 || |
︙ | |||
257 258 259 260 261 262 263 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + - - + + | } } void input(OFString *text) { if (saycommandon) |
Modified src/cube.h from [8e48390c7e] to [e6d07ee71e].
︙ | |||
306 307 308 309 310 311 312 | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | - + | #define m_noitemsrail (gamemode <= 5) #define m_arena (gamemode >= 8) #define m_tarena (gamemode >= 10) #define m_teammode (gamemode & 1 && gamemode > 2) #define m_sp (gamemode < 0) #define m_dmsp (gamemode == -1) #define m_classicsp (gamemode == -2) |
︙ |
Modified src/editing.m from [bc0b6a3e18] to [1510ae8332].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + - - - - - - - + + + + + + + | // invariant: all code assumes that these are kept inside MINBORD distance of // the edge of the map struct block sel = { 0, 0, 0, 0 }; OF_CONSTRUCTOR() { |
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + | projreset(); } Cube.sharedInstance.repeatsKeys = editmode; selset = false; editing = editmode; } |
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - + | #define EDITSELMP \ if (noteditmode() || noselection() || multiplayer()) \ return; #define EDITMP \ if (noteditmode() || multiplayer()) \ return; |
︙ | |||
217 218 219 220 221 222 223 | 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 246 247 | - - - - + + + + - - - - + + + + - - - - + + + + | if (SOLID(s)) continue; float h1 = sheight(s, s, z); float h2 = sheight(s, SWS(s, 1, 0, ssize), z); float h3 = sheight(s, SWS(s, 1, 1, ssize), z); float h4 = sheight(s, SWS(s, 0, 1, ssize), z); if (s->tag) |
︙ | |||
258 259 260 261 262 263 264 | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - - - - + + + + - + - + - + - + - + - + - + | sheight(s, SWS(s, 0, 1, ssize), z)); linestyle(GRIDS, OFColor.red); dot(cx, cy, ih); ch = (int)ih; } if (selset) { |
︙ | |||
397 398 399 400 401 402 403 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | - + | EDITSEL; bool isfloor = flr == 0; editheightxy(isfloor, amount, &sel); addmsg(1, 7, SV_EDITH, sel.x, sel.y, sel.xs, sel.ys, isfloor, amount); } |
︙ | |||
420 421 422 423 424 425 426 | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | - + - + | break; case 3: s->utex = t; break; }); } |
︙ | |||
493 494 495 496 497 498 499 | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | - + - + - + | return; } edittypexy(type, &sel); addmsg(1, 6, SV_EDITS, sel.x, sel.y, sel.xs, sel.ys, type); } |
︙ | |||
525 526 527 528 529 530 531 | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | - + - + - + - + | else s->ceil = hi; if (s->floor >= s->ceil) s->floor = s->ceil - 1; }); } |
︙ | |||
586 587 588 589 590 591 592 | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | - + - + | ? (archverts[sel->xs - 1][x] + (y == 0 || y == sel->ys - 1 ? sidedelta : 0)) : (archverts[sel->ys - 1][y] + (x == 0 || x == sel->xs - 1 ? sidedelta : 0))); remipmore(sel, 0); }) |
︙ | |||
635 636 637 638 639 640 641 | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | - + - - + + - - - - + + + + | fullbright, 0, 0, 1, if (fullbright) { if (noteditmode()) return; for (int i = 0; i < mipsize; i++) world[i].r = world[i].g = world[i].b = 176; }); |
Modified src/entities.m from [e376d54115] to [945da2b6da].
︙ | |||
309 310 311 312 313 314 315 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - + | checkitems() { Player *player1 = Player.player1; if (editmode) return; |
︙ | |||
344 345 346 347 348 349 350 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + | } } // puts items in network stream and also spawns them locally void putitems(unsigned char **p) { |
︙ |
Modified src/menus.m from [c38d6c5a56] to [abea91099d].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + - + | { if ((vmenu = menu) >= 1) [Player.player1 resetMovement]; if (vmenu == 1) menus[1].menusel = 0; } |
︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + | if (vmenu == 1) refreshservers(); Menu *m = menus[vmenu]; OFString *title; if (vmenu > 1) |
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + - + - - + + - + - - - - + + + + | void newmenu(OFString *name) { if (menus == nil) menus = [[OFMutableArray alloc] init]; |
︙ | |||
151 152 153 154 155 156 157 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - + | OFString *action = menus[vmenu].items[menusel].action; if (vmenu == 1) connects(getservername(menusel)); if (menuStack == nil) menuStack = [[OFMutableArray alloc] init]; |
Modified src/physics.m from [8500b9ce45] to [95d4c13f64].
︙ | |||
28 29 30 31 32 33 34 | 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; |
︙ | |||
104 105 106 107 108 109 110 | 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 :) |
︙ | |||
324 325 326 327 328 329 330 | 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); |
︙ |
Modified src/rendercubes.m from [4e2c5682e1] to [d20e5d1984].
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - + | const float TEXTURESCALE = 32.0f; bool floorstrip = false, deltastrip = false; int oh, oy, ox, ogltex; // the o* vars are used by the stripification int ol3r, ol3g, ol3b, ol4r, ol4g, ol4b; int firstindex; bool showm = false; |
︙ |
Modified src/renderextras.m from [efc1c2688d] to [f1478ac26e].
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | - - - - + + + + - - - - + + + + | blendbox(int x1, int y1, int x2, int y2, bool border) { glDepthMask(GL_FALSE); glDisable(GL_TEXTURE_2D); glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); glBegin(GL_QUADS); if (border) |
︙ | |||
129 130 131 132 133 134 135 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | - - - - + + + + | glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBindTexture(GL_TEXTURE_2D, 4); for (struct sphere *p, **pp = &slist; (p = *pp) != NULL;) { glPushMatrix(); float size = p->size / p->max; |
︙ | |||
203 204 205 206 207 208 209 | 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 | - - + + + - + - - + + - + - - + + - + - - + - | particle_splash(2, 2, 40, OFMakeVector3D(e.x, e.y, e.z)); } int e = closestent(); if (e >= 0) { Entity *c = ents[e]; closeent = |
︙ | |||
357 358 359 360 361 362 363 | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | - - - - + + + + - - - - + + + + | glDepthMask(GL_FALSE); if (dblend || underwater) { glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); glBegin(GL_QUADS); if (dblend) |
︙ | |||
400 401 402 403 404 405 406 | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - - - - + + + + + | [OFColor.white cube_setAsGLColor]; if (crosshairfx) { if (player1.gunWait) [OFColor.gray cube_setAsGLColor]; else if (player1.health <= 25) [OFColor.red cube_setAsGLColor]; else if (player1.health <= 50) |
︙ |
Modified src/rendergl.m from [a52bf36780] to [8875dffa42].
︙ | |||
186 187 188 189 190 191 192 | 186 187 188 189 190 191 192 193 194 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 246 247 248 249 250 251 | - + - + - - + + - + - - + + - + - - + - | for (int i = 0; i < 256; i++) for (int j = 0; j < MAXFRAMES; j++) mapping[i][j] = 0; } int curtexnum = 0; |
︙ | |||
318 319 320 321 322 323 324 | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + - + | } void addstrip(int tex, int start, int n) { if (strips == nil) strips = [[OFMutableData alloc] |
︙ |
Modified src/rendermd2.m from [c6c4c06ab4] to [923fa1d88f].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - - + + - + - - + + + - + + - + - + - - + - - - - - - - - + + + + + + + - - + + - - + + - + | static const int FIRSTMDL = 20; void delayedload(MD2 *m) { if (!m.loaded) { |
︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + - - - - + + + + - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + | int xs, ys; glBindTexture(GL_TEXTURE_2D, tex ? lookuptexture(tex, &xs, &ys) : FIRSTMDL + m.mdlnum); int ix = (int)position.x; int iy = (int)position.z; |
Modified src/rendertext.m from [da461b7a90] to [656fe9791c].
︙ | |||
135 136 137 138 139 140 141 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - - + + | } void draw_textf(OFConstantString *format, int left, int top, int gl_num, ...) { va_list arguments; va_start(arguments, gl_num); |
︙ | |||
166 167 168 169 170 171 172 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | - - - - + + + + | if (c == '\t') { x = (x - left + PIXELTAB) / PIXELTAB * PIXELTAB + left; continue; } if (c == '\f') { |
︙ |
Modified src/savegamedemo.m from [fe0624b79b] to [94bda1495e].
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + - | } void savestate(OFIRI *IRI) { stop(); f = gzopen([IRI.fileSystemRepresentation |
︙ | |||
127 128 129 130 131 132 133 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | - + - - - + + + + - + - | for (id player in players) { gzput(player == [OFNull null]); data = [player dataBySerializing]; gzwrite(f, data.items, data.count); } } |
︙ | |||
179 180 181 182 183 184 185 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - - - - + + + + + | return; out: conoutf(@"aborting: savegame/demo from a different version of " @"cube or cpu architecture"); stop(); } |
︙ | |||
213 214 215 216 217 218 219 | 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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | - - + + - + - + - + - + - - - + + + | if (e.type == CARROT && !e.spawned) trigger(e.attr1, e.attr2, true); } restoreserverstate(ents); OFMutableData *data = |
︙ | |||
329 330 331 332 333 334 335 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - - - - + + + + | ddamage = 0; } // FIXME: add all other client state which is not send through // the network } } |
︙ | |||
458 459 460 461 462 463 464 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | - + - + | playerhistory.lastObject.lastUpdate != playbacktime)) { Player *d = [target copy]; d.lastUpdate = playbacktime; if (playerhistory == nil) playerhistory = [[OFMutableArray alloc] init]; |
︙ | |||
538 539 540 541 542 543 544 | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | - + | } break; } } // if(player1->state!=CS_DEAD) showscores(false); } |
Modified src/server.m from [853a6dbe34] to [95faadaf28].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - - + + | bool notgotitems = true; int mode = 0; // hack: called from savegame code, only works in SP void restoreserverstate(OFArray<Entity *> *ents) { |
︙ | |||
97 98 99 100 101 102 103 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - - + + | if (packet->referenceCount == 0) enet_packet_destroy(packet); } void disconnect_client(int n, OFString *reason) { |
︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | - + - - + + | clients[sender].mapvote = map; clients[sender].modevote = reqmode; int yes = 0, no = 0; for (Client *client in clients) { if (client.type != ST_EMPTY) { if (client.mapvote.length > 0) { |
︙ | |||
223 224 225 226 227 228 229 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - - + + | } case SV_ITEMLIST: { int n; while ((n = getint(&p)) != -1) if (notgotitems) { while (sents.count <= n) |
︙ | |||
310 311 312 313 314 315 316 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - - + + | sendstring(serverpassword, &p); putint(&p, clients.count > maxclients); if (smapname.length > 0) { putint(&p, SV_MAPCHANGE); sendstring(smapname, &p); putint(&p, mode); putint(&p, SV_ITEMLIST); |
︙ | |||
352 353 354 355 356 357 358 | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + | return client; Client *client = [Client client]; if (clients == nil) clients = [[OFMutableArray alloc] init]; |
︙ | |||
401 402 403 404 405 406 407 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - - + + - - + + | void serverslice(int seconds, unsigned int timeout) // main server update, called from cube main loop in // sp, or dedicated server loop { // spawn entities when timer reached |
︙ | |||
471 472 473 474 475 476 477 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | - - + + - + + | c.peer = event.peer; c.peer->data = (void *)(clients.count - 1); char hn[1024]; c.hostname = (enet_address_get_host( &c.peer->address, hn, sizeof(hn)) == 0 ? @(hn) : @"localhost"); |
︙ |
Modified src/serverbrowser.m from [738828d34a] to [8678daf863].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + - + | resolverresults = [[OFMutableArray alloc] init]; resolverlimit = limit; resolversem = SDL_CreateSemaphore(0); while (threads > 0) { ResolverThread *rt = [ResolverThread thread]; rt.name = @"resolverthread"; |
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + | } } void resolverquery(OFString *name) { @synchronized(ResolverThread.class) { |
︙ | |||
114 115 116 117 118 119 120 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + - + - + | return servers[n].name; } void addserver(OFString *servername) { for (ServerInfo *si in servers) |
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + | OFString *name = nil; ENetAddress addr = { ENET_HOST_ANY, CUBE_SERVINFO_PORT }; while (resolvercheck(&name, &addr)) { if (addr.host == ENET_HOST_ANY) continue; for (ServerInfo *si in servers) { |
︙ | |||
213 214 215 216 217 218 219 | 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 246 247 248 | - - + + - + - - - + + - - - + + + - + | checkresolver(); checkpings(); if (lastmillis - lastinfo >= 5000) pingservers(); [servers sort]; __block int maxmenu = 16; |
︙ | |||
261 262 263 264 265 266 267 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | - + - + | for (ServerInfo *si in servers) resolverquery(si.name); refreshservers(); menuset(1); } |
︙ |
Modified src/serverms.m from [3e3cb4cc55] to [86b7b53d7e].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + - - - - + + + + + - + | // all server side masterserver and pinging functionality #include "cube.h" static ENetSocket mssock = ENET_SOCKET_NULL; static void httpgetsend(ENetAddress *ad, OFString *hostname, OFString *req, OFString *ref, OFString *agent) { if (ad->host == ENET_HOST_ANY) { |
︙ | |||
73 74 75 76 77 78 79 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - + + | static ENetBuffer masterb; static void updatemasterserver(int seconds) { // send alive signal to masterserver every hour of uptime if (seconds > updmaster) { |
︙ | |||
96 97 98 99 100 101 102 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - - + + | if (busy && mssock == ENET_SOCKET_NULL) printf("masterserver reply: %s\n", stripheader(masterrep)); } unsigned char * retrieveservers(unsigned char *buf, int buflen) { |
︙ | |||
136 137 138 139 140 141 142 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - - + + - + + | if (len < 0) return; p = &pong[len]; putint(&p, PROTOCOL_VERSION); putint(&p, mode); putint(&p, numplayers); putint(&p, minremain); |
Modified src/serverutil.m from [25b79fa395] to [da87a5e2ce].
︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - + - + | void fatal(OFConstantString *s, ...) { cleanupserver(); va_list args; va_start(args, s); |
︙ |
Modified src/sound.m from [0732f14714] to [78a898d2ad].
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + - - - - + + + + - + - + - + - - + + - + | conoutf(@"sound init failed (SDL_mixer): %s", (size_t)Mix_GetError()); nosound = true; } Mix_AllocateChannels(MAXCHAN); } |
︙ | |||
189 190 191 192 193 194 195 | 189 190 191 192 193 194 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 | - + - - + + - + - + | return; if (n < 0 || n >= samples.count) { conoutf(@"unregistered sound: %d", n); return; } |
Modified src/weapon.m from [48ff54c543] to [6c8b962c81].
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - + | int reloadtime(int gun) { return guns[gun].attackdelay; } |
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | playerincrosshair() { if (demoplayback) return NULL; OFVector3D o = Player.player1.origin; for (Player *player in players) { |
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - - - + + + | static void hit(int target, int damage, __kindof DynamicEntity *d, DynamicEntity *at) { OFVector3D o = d.origin; if (d == Player.player1) selfdamage(damage, (at == Player.player1) ? -1 : -2, at); |
︙ | |||
221 222 223 224 225 226 227 | 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 246 247 | - - + + - - + + | dodynlight(vold, v, 0, 0, p.owner); if (!p.local) return; radialeffect(Player.player1, v, -1, qdam, p.owner); |
︙ | |||
264 265 266 267 268 269 270 | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | - + | for (size_t i = 0; i < MAXPROJ; i++) { Projectile *p = projs[i]; if (!p.inuse) continue; int qdam = guns[p.gun].damage * (p.owner.quadMillis ? 4 : 1); |
︙ | |||
332 333 334 335 336 337 338 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - + | break; case GUN_RL: case GUN_FIREBALL: case GUN_ICEBALL: case GUN_SLIMEBALL: pspeed = guns[gun].projspeed; |
︙ | |||
364 365 366 367 368 369 370 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | - + | DynamicEntity *o, OFVector3D from, OFVector3D to, DynamicEntity *d, int i) { if (o.state != CS_ALIVE) return; int qdam = guns[d.gunSelect].damage; if (d.quadMillis) qdam *= 4; |
︙ | |||
419 420 421 422 423 424 425 | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | - + - + + - + | } if (d.gunSelect == GUN_SG) createrays(from, to); if (d.quadMillis && attacktime > 200) playsoundc(S_ITEMPUP); shootv(d.gunSelect, from, to, d, true); |
Modified src/world.m from [1c22ea0614] to [a8feb3f63c].
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + - - + + - + - + | // set for playing void settagareas() { settag(0, 1); |
︙ | |||
289 290 291 292 293 294 295 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - + - + - + - + | closestent() // used for delent and edit mode ent display { if (noteditmode()) return -1; __block int best; __block float bdist = 99999; |
︙ | |||
385 386 387 388 389 390 391 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | - + - + | case PLAYERSTART: e.attr1 = (int)Player.player1.yaw; break; } addmsg(1, 10, SV_EDITENT, ents.count, type, e.x, e.y, e.z, e.attr1, e.attr2, e.attr3, e.attr4); |
︙ | |||
416 417 418 419 420 421 422 | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | - + | { int n = c * intens / 100; if (n > 255) n = 255; return n; } |
︙ | |||
541 542 543 544 545 546 547 | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | - + - + - + | if (oldworld) { OFFreeMemory(oldworld); toggleedit(); execute(@"fullbright 1", true); } } |
Modified src/worldio.m from [d379fda5be] to [f35a650122].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | - - + + - - + + - - + + - - - - - - - - + + + + + + + + | unsigned char type; // type is one of the above unsigned char attr2, attr3, attr4; }; void backup(OFString *name, OFString *backupname) { |
︙ | |||
141 142 143 144 145 146 147 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - + - + - - + + | void writemap(OFString *mname, int msize, unsigned char *mdata) { setnames(mname); backup(cgzname, bakname); |
︙ | |||
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - + - - + + | } spurge; gzclose(f); conoutf(@"wrote map file %@", cgzname); settagareas(); } |
︙ | |||
301 302 303 304 305 306 307 | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | - + | e.y = tmp.y; e.z = tmp.z; e.attr1 = tmp.attr1; e.type = tmp.type; e.attr2 = tmp.attr2; e.attr3 = tmp.attr3; e.attr4 = tmp.attr4; |
︙ | |||
392 393 394 395 396 397 398 | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - - + + - - - + + + | lookuptexture(i, &xs, &ys); conoutf(@"read map %@ (%d milliseconds)", cgzname, SDL_GetTicks() - lastmillis); conoutf(@"%s", hdr.maptitle); startmap(mname); for (int l = 0; l < 256; l++) { // can this be done smarter? |
Modified src/worldlight.m from [279400f849] to [38a360a277].
︙ | |||
201 202 203 204 205 206 207 | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + | void dodynlight(OFVector3D vold, OFVector3D v, int reach, int strength, DynamicEntity *owner) { if (!reach) reach = dynlight; |
︙ | |||
223 224 225 226 227 228 229 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - + - + | 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] |
︙ |
Modified src/worldocull.m from [201c3dd9c9] to [a7de71ad12].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | // worldocull.cpp: occlusion map and occlusion test #include "cube.h" #import "Command.h" #import "Player.h" #define NUMRAYS 512 float rdist[NUMRAYS]; bool ocull = true; float odist = 256; |
︙ |