Comment: | Clean up identifiers, use blocks for commands |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d7661be1b1dc8fda8e4de50f9a9d7590 |
User & Date: | js on 2025-03-23 19:40:00 |
Other Links: | manifest | tags |
2025-03-23
| ||
21:31 | Remove vdist check-in: 6259424802 user: js tags: trunk | |
19:40 | Clean up identifiers, use blocks for commands check-in: d7661be1b1 user: js tags: trunk | |
17:45 | Remove fast_f2nat check-in: 51fb59fc93 user: js tags: trunk | |
Modified src/Command.h from [e984d89122] to [a73716cedf].
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 | + + + + + + + + + + + - - - + + - - + + | #import "Identifier.h" OF_ASSUME_NONNULL_BEGIN #define COMMAND(name, nargs, block_) \ OF_CONSTRUCTOR() \ { \ enqueueInit(^{ \ [Identifier \ addIdentifier:[Command commandWithName:@ #name \ argumentsTypes:nargs \ block:block_]]; \ }); \ } @interface Command: Identifier |
Modified src/Command.m from [6dc988a0ae] to [1956763843].
︙ | |||
16 17 18 19 20 21 22 23 | 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 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 163 | + + + + - + - - + + - + - + - + - + - + - + - + - + - + - - + - - + + - + - - + - + - + - - + - - + + - + | [copy addObject:@""]; [copy makeImmutable]; return copy; } @implementation Command { id _block; } + (instancetype)commandWithName:(OFString *)name |
︙ |
Modified src/Cube.m from [5126c37a7e] to [3b4164e066].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // main.cpp: initialisation & main loop #include "cube.h" #import "Command.h" #import "DynamicEntity.h" OF_APPLICATION_DELEGATE(Cube) VARF(gamespeed, 10, 100, 1000, if (multiplayer()) gamespeed = 100); VARP(minmillis, 0, 5, 1000); |
︙ | |||
369 370 371 372 373 374 375 | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - - + - + - + - - - + - - + - | [msg appendFormat:@" (%s)\n", SDL_GetError()]; [Cube.sharedInstance showMessage:msg]; [OFApplication terminateWithStatus:1]; } |
Modified src/Identifier.h from [f570e25a18] to [8e21f78264].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + + + | #import <ObjFW/ObjFW.h> OF_ASSUME_NONNULL_BEGIN @interface Identifier: OFObject @property (readonly, copy, nonatomic) OFString *name; + (void)addIdentifier:(__kindof Identifier *)identifier; + (__kindof Identifier *)identifierForName:(OFString *)name; + (void)enumerateIdentifiersUsingBlock:(void (^)(__kindof Identifier *))block; - (instancetype)init OF_UNAVAILABLE; - (instancetype)initWithName:(OFString *)name; @end OF_ASSUME_NONNULL_END |
Modified src/Identifier.m from [dfc38df5ef] to [a76ca7afae].
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 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + + + + + + + + + + + + + + + + + + + + + + + + + + + | #import "Identifier.h" // contains ALL vars/commands/aliases static OFMutableDictionary<OFString *, __kindof Identifier *> *identifiers; @implementation Identifier + (void)initialize { if (self == Identifier.class) identifiers = [[OFMutableDictionary alloc] init]; } + (void)addIdentifier:(__kindof Identifier *)identifier { identifiers[identifier.name] = identifier; } + (__kindof Identifier *)identifierForName:(OFString *)name { return identifiers[name]; } + (void)enumerateIdentifiersUsingBlock:(void (^)(__kindof Identifier *))block { [identifiers enumerateKeysAndObjectsUsingBlock:^( OFString *name, __kindof Identifier *identifier, bool *stop) { block(identifier); }]; } - (instancetype)initWithName:(OFString *)name { self = [super init]; _name = [name copy]; return self; |
︙ |
Modified src/clientextras.m from [1114a27a28] to [b510debdf2].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // clientextras.cpp: stuff that didn't fit in client.cpp or clientgame.cpp :) #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Monster.h" // render players & monsters // very messy ad-hoc handling of animation frames, should be made more // configurable |
︙ | |||
173 174 175 176 177 178 179 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - - + - | menumanual(0, scoreLines.count, @""); menumanual(0, scoreLines.count + 1, teamScores); } } // sendmap/getmap commands, should be replaced by more intuitive map downloading |
︙ | |||
206 207 208 209 210 211 212 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - + - - + - - + - - - | sendpackettoserv(packet); conoutf(@"sending map %@ to server...", mapname); OFString *msg = [OFString stringWithFormat:@"[map %@ uploaded to server, " @"\"getmap\" to receive it]", mapname]; toserver(msg); |
Modified src/clientgame.m from [8ff39fb916] to [3ae039157a].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | + - - + - - + - | // clientgame.cpp: core game related stuff #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Entity.h" #import "Monster.h" #import "OFString+Cube.h" int nextmode = 0; // nextmode becomes gamemode after next map load VAR(gamemode, 1, 0, 0); |
︙ | |||
138 139 140 141 142 143 144 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - - + - - + - | } // if we die in SP we try the same map again respawnself(); } } int sleepwait = 0; static OFString *sleepcmd = nil; |
︙ | |||
236 237 238 239 240 241 242 | 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 | - - - - + + + - + - - + - - + - - + - - + - - - - - - - + + + | [d resetToSpawnState]; d.state = CS_ALIVE; } // movement input code #define dir(name, v, d, s, os) \ |
︙ | |||
436 437 438 439 440 441 442 | 422 423 424 425 426 427 428 429 430 431 | + - + + | setvar(@"fogcolour", 0x8099B3); showscores(false); intermission = false; Cube.sharedInstance.framesInMap = 0; conoutf(@"game mode is %@", modestr(gamemode)); } COMMAND(map, ARG_1STR, ^(OFString *name) { |
Modified src/clients.m from [6542299bf2] to [d14310e680].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // client.cpp, mostly network related client game code #include "cube.h" #import "Command.h" #import "DynamicEntity.h" static ENetHost *clienthost = NULL; static int connecting = 0; static int connattempts = 0; static int disconnecting = 0; // our client id in the game |
︙ | |||
56 57 58 59 60 61 62 | 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 | - + + - + + + - + + - + + + | if (!clienthost || connecting) return; assert(ENET_PEER_PACKET_THROTTLE_SCALE == 32); enet_peer_throttle_configure(clienthost->peers, throttle_interval * 1000, throttle_accel, throttle_decel); } |
︙ | |||
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 | - - + - - - + + - - - - + + + + + + + + | void toserver(OFString *text) { conoutf(@"%@:\f %@", player1.name, text); ctext = text; } |
︙ | |||
235 236 237 238 239 240 241 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | - - + - - + - | int lastupdate = 0, lastping = 0; OFString *toservermap; bool senditemstoserver = false; // after a map change, since server doesn't have map data OFString *clientpassword; |
︙ |
Modified src/commands.m from [4117ae0f6a] to [116e44fb5b].
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 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 | - - - - + - - - + + + - - - + - - + + - + + + - - - - - - + + + + + + - - - - - - + - + + + + + + + + - + - + - + - - - - - - - - - - - - - - - | // command.cpp: implements the parsing and execution of a tiny script language // which is largely backwards compatible with the quake console language. #include "cube.h" #import "Alias.h" #import "Command.h" #import "Identifier.h" #import "OFString+Cube.h" #import "Variable.h" |
︙ | |||
164 165 166 167 168 169 170 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - + + | return strndup(word, *p - word); } // find value of ident referenced with $ in exp OFString * lookup(OFString *n) { |
︙ | |||
271 272 273 274 275 276 277 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + | c = [c substringFromIndex:1]; w[0] = c; } // empty statement if (c.length == 0) continue; |
︙ | |||
303 304 305 306 307 308 309 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | - - + + | if (!completesize) { completesize = s.length - 1; completeidx = 0; } __block int idx = 0; |
︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | + + + + | { if (!execfile([Cube.sharedInstance.userDataIRI IRIByAppendingPathComponent:cfgfile]) && !execfile([Cube.sharedInstance.gameDataIRI IRIByAppendingPathComponent:cfgfile])) conoutf(@"could not read \"%@\"", cfgfile); } COMMAND(exec, ARG_1STR, ^(OFString *cfgfile) { exec(cfgfile); }) void writecfg() { OFStream *stream; @try { OFIRI *IRI = [Cube.sharedInstance.userDataIRI |
︙ | |||
366 367 368 369 370 371 372 | 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 500 501 502 503 504 505 506 507 508 509 | - - - - - + + + + + - - - + + + - - - - - + + + + + - - - + + + - + + + - - + - - + - - + - - + - - + - - + - - + - - + - - - + + + + + - + - - + - - + - - + - - + - - - - - - - - - - - - + - - + - - - + - - + - - - + - - + - - - + - - + - - - + - + - + - - - - + - - + - - - + - - + - - - + - - + - - - + - - + - - - + - - - + + - - - + - - + - | @"overwrite these settings\n" @"// modify settings in game, or put settings in " @"autoexec.cfg to override anything\n" @"\n"]; writeclientinfo(stream); [stream writeString:@"\n"]; |
Modified src/console.m from [1ac50365c9] to [d7f7b48227].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 | + - - + - - + - | // console.cpp: the console buffer, its display, and command line control #include "cube.h" #include <ctype.h> #import "Command.h" #import "ConsoleLine.h" #import "KeyMapping.h" #import "OFString+Cube.h" static OFMutableArray<ConsoleLine *> *conlines; const int ndraw = 5; const int WORDWRAP = 80; int conskip = 0; bool saycommandon = false; static OFMutableString *commandbuf; |
︙ | |||
100 101 102 103 104 105 106 | 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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - - + - - + - - - + - - + - + - - + + - - - - + + + + + - + - - - + - - + - | (FONTH / 4 * 5) * (nd - j - 1) + FONTH / 3, 2); } // keymap is defined externally in keymap.cfg static OFMutableArray<KeyMapping *> *keyMappings = nil; |
︙ |
Modified src/cube.h from [96eff6d77d] to [6875cee25c].
︙ | |||
336 337 338 339 340 341 342 | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | - - - - - - - - | ARG_1EST, ARG_2EST, ARG_VARI }; // nasty macros for registering script functions, abuses globals to avoid // excessive infrastructure |
︙ |
Modified src/editing.m from [6ba0a980d9] to [696569b661].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + | // editing.cpp: most map editing commands go here, entity editing commands are // in world.cpp #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Monster.h" #import "OFString+Cube.h" bool editmode = false; // the current selection, used by almost all editing commands |
︙ | |||
74 75 76 77 78 79 80 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | + + - + + | [Monster resetAll]; projreset(); } Cube.sharedInstance.repeatsKeys = editmode; selset = false; editing = editmode; } COMMAND(edittoggle, ARG_NONE, ^{ |
︙ | |||
116 117 118 119 120 121 122 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - - + - - + | #define EDITSELMP \ if (noteditmode() || noselection() || multiplayer()) \ return; #define EDITMP \ if (noteditmode() || multiplayer()) \ return; |
︙ | |||
268 269 270 271 272 273 274 | 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 | - - + - - + - - + - - + - - + - - + | initWithItemSize:sizeof(struct block *)]; struct block *copy = blockcopy(&sel); [undos addItem:©]; pruneundos(undomegs << 20); } |
︙ | |||
374 375 376 377 378 379 380 | 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 | + - + + + - - + - - + - - + - | { EDITSEL; bool isfloor = flr == 0; editheightxy(isfloor, amount, &sel); addmsg(1, 7, SV_EDITH, sel.x, sel.y, sel.xs, sel.ys, isfloor, amount); } |
︙ | |||
448 449 450 451 452 453 454 | 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 | - + - + - - + - - + - - - + - - + - - - + - - + - | break; } } } struct block b = { 0, 0, ssize, ssize }; remip(&b, 0); |
︙ | |||
513 514 515 516 517 518 519 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 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 579 580 581 582 583 584 585 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 620 621 622 623 624 625 626 627 628 629 630 631 632 | - - + - - + - - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + + - - + - - - - + + + + - - - - - - - - - - - - - - | else s->ceil = hi; if (s->floor >= s->ceil) s->floor = s->ceil - 1; }); } |
Modified src/menus.m from [9134766c32] to [d14babe2b3].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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 | + - - + - - + - | // menus.cpp: ingame menu system (also used for scores and serverlist) #include "cube.h" #import "Menu.h" #import "Command.h" #import "DynamicEntity.h" #import "MenuItem.h" static OFMutableArray<OFNumber *> *menuStack; static OFMutableArray<Menu *> *menus; static int vmenu = -1; void menuset(int menu) { if ((vmenu = menu) >= 1) [player1 resetMovement]; if (vmenu == 1) menus[1].menusel = 0; } |
︙ | |||
93 94 95 96 97 98 99 | 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 | + - + + + - - + - - + - | newmenu(OFString *name) { if (menus == nil) menus = [[OFMutableArray alloc] init]; [menus addObject:[Menu menuWithName:name]]; } |
︙ |
Modified src/protos.h from [5294dddff8] to [6ea87debb4].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - | // protos for ALL external functions in cube... #ifdef __cplusplus extern "C" { #endif // command extern int variable(OFString *name, int min, int cur, int max, int *storage, void (*fun)(), bool persist); extern void setvar(OFString *name, int i); extern int getvar(OFString *name); extern bool identexists(OFString *name); |
︙ |
Modified src/rendercubes.m from [3c13e91f26] to [03979e8529].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + + | // rendercubes.cpp: sits in between worldrender.cpp and rendergl.cpp and fills // the vertex array for different cube surfaces. #include "cube.h" #import "Command.h" static struct vertex *verts = NULL; int curvert; static int curmaxverts = 10000; void setarraypointers() |
︙ | |||
57 58 59 60 61 62 63 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - - + - - + - | 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 [2902b001e4] to [e6c4962238].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // renderextras.cpp: misc gl render code and the HUD #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Entity.h" void line(int x1, int y1, float z1, int x2, int y2, float z2) { glBegin(GL_POLYGON); |
︙ | |||
199 200 201 202 203 204 205 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | - - + - | [OFString stringWithFormat:@"closest entity = %@ (%d, %d, " @"%d, %d), selection = (%d, %d)", entnames[c.type], c.attr1, c.attr2, c.attr3, c.attr4, getvar(@"selxs"), getvar(@"selys")]; } } |
︙ | |||
226 227 228 229 230 231 232 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - + - | [Cube.sharedInstance.gameDataIRI IRIByAppendingPathComponent:path], &xs, &ys, true)) conoutf(@"could not load sky textures"); } lastsky = basename; |
︙ |
Modified src/rendergl.m from [d9ebc3b45e] to [e1c74cee31].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // rendergl.cpp: core opengl rendering stuff #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Monster.h" #import "OFString+Cube.h" #ifdef DARWIN # define GL_COMBINE_EXT GL_COMBINE_ARB # define GL_COMBINE_RGB_EXT GL_COMBINE_RGB_ARB |
︙ | |||
181 182 183 184 185 186 187 | 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 | - - + - - + - - - + - - + - | for (int i = 0; i < 256; i++) for (int j = 0; j < MAXFRAMES; j++) mapping[i][j] = 0; } int curtexnum = 0; |
︙ |
Modified src/rendermd2.m from [3f3cf16cef] to [7b42d00ad3].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // rendermd2.cpp: loader code adapted from a nehe tutorial #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "MD2.h" #import "MapModelInfo.h" #import "OFString+Cube.h" static OFMutableDictionary<OFString *, MD2 *> *mdllookup = nil; static OFMutableArray<MD2 *> *mapmodels = nil; |
︙ | |||
50 51 52 53 54 55 56 | 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 | - - - + + - - - - - - - - + + + + + + + + + - - + + - - + + - - - + - - + - | mdllookup = [[OFMutableDictionary alloc] init]; mdllookup[name] = m; return m; } |
︙ |
Modified src/savegamedemo.m from [3891d96448] to [1beb03a02a].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + | // loading and saving of savegames & demos, dumps the spawn state of all // mapents, the full state of all dynents (monsters + player) #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Entity.h" #import "Monster.h" #ifdef OF_BIG_ENDIAN static const int islittleendian = 0; #else |
︙ | |||
125 126 127 128 129 130 131 | 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 | - - + - - + - | for (id player in players) { gzput(player == [OFNull null]); data = [player dataBySerializing]; gzwrite(f, data.items, data.count); } } |
︙ | |||
180 181 182 183 184 185 186 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - - + - - + - | return; out: conoutf(@"aborting: savegame/demo from a different version of " @"cube or cpu architecture"); stop(); } |
︙ | |||
264 265 266 267 268 269 270 | 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 | - - + - - + - | // demo functions int starttime = 0; int playbacktime = 0; int ddamage, bdamage; OFVector3D dorig; |
︙ | |||
333 334 335 336 337 338 339 | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - - + - - + - | ddamage = 0; } // FIXME: add all other client state which is not send through // the network } } |
︙ | |||
545 546 547 548 549 550 551 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | - - + - - + - | } break; } } // if(player1->state!=CS_DEAD) showscores(false); } |
Modified src/serverbrowser.m from [5762ec3ef4] to [6d0f47176b].
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 | + | // serverbrowser.cpp: eihrul's concurrent resolver, and server browser window // management #include "SDL_thread.h" #include "cube.h" #import "Command.h" #import "ResolverResult.h" #import "ResolverThread.h" #import "ServerInfo.h" static OFMutableArray<ResolverThread *> *resolverthreads; OFMutableArray<OFString *> *resolverqueries; OFMutableArray<ResolverResult *> *resolverresults; |
︙ | |||
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | + + + + | return; if (servers == nil) servers = [[OFMutableArray alloc] init]; [servers addObject:[ServerInfo infoWithName:servername]]; } COMMAND(addserver, ARG_1STR, ^(OFString *servername) { addserver(servername); }) void pingservers() { ENetBuffer buf; unsigned char ping[MAXTRANS]; unsigned char *p; |
︙ | |||
241 242 243 244 245 246 247 | 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 | - + - - - + + + + + - + - - - - | menumanual(1, i, si.full); if (!--maxmenu) return; }]; } |
Modified src/sound.m from [4ad5c2248e] to [24cd809ba3].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 | + | #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #include <SDL_mixer.h> VARP(soundvol, 0, 255, 255); VARP(musicvol, 0, 128, 255); bool nosound = false; |
︙ | |||
43 44 45 46 47 48 49 | 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 | - - + - - + - - - + - - + - | conoutf(@"sound init failed (SDL_mixer): %s", (size_t)Mix_GetError()); nosound = true; } Mix_AllocateChannels(MAXCHAN); } |
︙ | |||
212 213 214 215 216 217 218 | 207 208 209 210 211 212 213 214 215 216 | - - + - - + - | if (loc) newsoundloc(chan, loc); updatechanvol(chan, loc); } |
Modified src/weapon.m from [d7a9ce79c2] to [a4ab4f9d09].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // weapon.cpp: all shooting and effects code #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Monster.h" #import "OFString+Cube.h" #import "Projectile.h" static const int MONSTERDAMAGEFACTOR = 4; #define SGRAYS 20 |
︙ | |||
58 59 60 61 62 63 64 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | - - + - - + - | int reloadtime(int gun) { return guns[gun].attackdelay; } |
︙ |
Modified src/world.m from [b3c4009ae5] to [e48df32f18].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // world.cpp: core map management stuff #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #import "Entity.h" #import "Monster.h" extern OFString *entnames[]; // lookup from map entities above to strings struct sqr *world = NULL; |
︙ | |||
87 88 89 90 91 92 93 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | + - + + + | if (identexists(aliasname)) execute(aliasname, true); if (type == 2) [Monster endSinglePlayerWithAllKilled:false]; } |
︙ | |||
300 301 302 303 304 305 306 | 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 | - - + - - + - - + - - + | bdist = dist; } }]; return (bdist == 99999 ? -1 : best); } |
︙ | |||
393 394 395 396 397 398 399 | 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 | - - + - - + - - - + - - + - | if (type == LIGHT) calclight(); return e; } |
︙ | |||
547 548 549 550 551 552 553 | 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 [7be3522f11] to [f78faa674c].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // worldio.cpp: loading & saving of maps and savegames #include "cube.h" #import "Command.h" #import "Entity.h" struct persistent_entity { short x, y, z; // cube aligned position short attr1; unsigned char type; // type is one of the above unsigned char attr2, attr3, attr4; |
︙ | |||
252 253 254 255 256 257 258 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | + + - + + | t = s; } spurge; gzclose(f); conoutf(@"wrote map file %@", cgzname); settagareas(); } COMMAND(savemap, ARG_1STR, ^(OFString *mname) { |
︙ |
Modified src/worldocull.m from [1dcc5bb2a7] to [80938b4118].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | + - - + - - + - | // worldocull.cpp: occlusion map and occlusion test #include "cube.h" #import "Command.h" #import "DynamicEntity.h" #define NUMRAYS 512 float rdist[NUMRAYS]; bool ocull = true; float odist = 256; |
︙ |