Overview
Comment: | Add variables with a getter / setter block |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cd2ac12a141a97a05449c82fbacc67cd |
User & Date: | js on 2025-03-29 22:29:22 |
Other Links: | manifest | tags |
Context
2025-04-18
| ||
22:18 | Check for GL_ARB_texture_env_combine as well check-in: ca2bc91bc3 user: js tags: trunk | |
2025-03-29
| ||
22:29 | Add variables with a getter / setter block check-in: cd2ac12a14 user: js tags: trunk | |
17:13 | More style fixes check-in: c634a689e7 user: js tags: trunk | |
Changes
Modified src/Cube.m from [4173147859] to [1868ef5fa1].
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 | + + - - + + + + + + + | // main.cpp: initialisation & main loop #include "cube.h" #import "Command.h" #import "Player.h" #import "Variable.h" OF_APPLICATION_DELEGATE(Cube) static int gamespeed = 100; VARB(gamespeed, 10, 1000, ^ { return gamespeed; }, ^ (int value) { |
︙ |
Modified src/Monster.m from [aa7be47ff2] to [08ccfa5f00].
︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | + + + - + + | return [[self alloc] initWithType: type yaw: yaw state: state trigger: trigger move: move]; } static int skill = 3; VARB(skill, 1, 10, ^ { return skill; }, ^ (int value) { skill = value; |
︙ |
Modified src/OFColor+Cube.h from [7398d21dd3] to [fe964137ac].
1 2 3 4 5 | 1 2 3 4 5 6 7 | + + | #import <ObjFW/ObjFW.h> @interface OFColor (Cube) - (void)cube_setAsGLColor; - (void)cube_setAsGLClearColor; - (void)cube_setAsGLFogColor; @end |
Modified src/OFColor+Cube.m from [a418a3dce6] to [054d4ed36a].
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 24 25 26 27 28 29 30 31 32 33 34 35 | + + + + + + + + + + + + + + + + + + + + + + + | #include "cube.h" #import "OFColor+Cube.h" @implementation OFColor (Cube) - (void)cube_setAsGLColor { float red, green, blue, alpha; [self getRed: &red green: &green blue: &blue alpha: &alpha]; glColor4f(red, green, blue, alpha); } - (void)cube_setAsGLClearColor { float red, green, blue, alpha; [self getRed: &red green: &green blue: &blue alpha: &alpha]; glClearColor(red, green, blue, alpha); } - (void)cube_setAsGLFogColor { float color[4]; [self getRed: &color[0] green: &color[1] blue: &color[2] alpha: &color[3]]; glFogfv(GL_FOG_COLOR, color); } @end |
Modified src/Variable.h from [237ce5cd40] to [9c9dde493b].
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 | - - - - - - - - - - - - - - - - - - + + + - + - - + - - + + + + + + - + - - - - - + + + + + + + + + + + - + - - - - - - - + + + + - - + + + - - - - - - + - - - + + + - + - - + + + - + - - - + + + + - | #import "Identifier.h" OF_ASSUME_NONNULL_BEGIN |
Modified src/Variable.m from [892ebc7d62] to [9d395dd08f].
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 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 | + + + + - + + - - + + + - + + - + + - + | #import "Variable.h" #include "cube.h" @implementation Variable { int *_storage; } + (instancetype)variableWithName: (OFString *)name min: (int)min max: (int)max storage: (int *)storage |
︙ | |||
56 57 58 59 60 61 62 | 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 | - + + - - - - - - + + + + + + + + + + + + + + | } if (value > _max) { value = _max; outOfRange = true; } |
Modified src/clients.m from [895b86000b] to [6f1a324e2b].
︙ | |||
38 39 40 41 42 43 44 | 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 | + + + - + - - + + - - - - + + + - - + + + + + + + + + + + + + + + + + | if (!allow) conoutf(@"editing in multiplayer requires coopedit mode (1)"); return allow; } static int rate = 0; VARB(rate, 0, 25000, ^ { return rate; }, ^ (int value) { rate = value; |
︙ |
Modified src/commands.m from [e486b084f6] to [1ba8e7e154].
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + - + | void setvar(OFString *name, int i) { Variable *variable = Identifier.identifiers[name]; if ([variable isKindOfClass: Variable.class]) |
︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - + | lookup(OFString *n) { __kindof Identifier *identifier = Identifier.identifiers[[n substringFromIndex: 1]]; if ([identifier isKindOfClass: Variable.class]) { return [OFString stringWithFormat: |
︙ | |||
346 347 348 349 350 351 352 | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | - - - + + + - + - | @"// modify settings in game, or put settings in autoexec.cfg to " @"override anything\n" @"\n"]; writeclientinfo(stream); [stream writeString: @"\n"]; [Identifier.identifiers enumerateKeysAndObjectsUsingBlock: |
︙ |
Modified src/editing.m from [974268cfe4] to [554de9b14f].
︙ | |||
20 21 22 23 24 25 26 | 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 | - - + + + + + + - - + + + | OF_CONSTRUCTOR() { enqueueInit(^ { static const struct { OFString *name; int *storage; |
︙ | |||
630 631 632 633 634 635 636 | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | - - - - - - - + + + + + + + + + + | remipmore(&sel, 0); sel.xs--; sel.ys--; }) |
︙ |
Modified src/rendercubes.m from [ee90f3d4f5] to [87348a3299].
︙ | |||
316 317 318 319 320 321 322 | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | + - - + + + + | nquads++; addstrip(gltex, curvert - 4, 4); } int wx1, wy1, wx2, wy2; VAR(watersubdiv, 1, 4, 64); |
︙ |
Modified src/rendergl.m from [e10c3367c9] to [072d71a9b6].
︙ | |||
323 324 325 326 327 328 329 | 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 | + - - + + - + + + | struct strip s = { .tex = tex, .start = start, .num = n }; [strips addItem: &s]; } #undef gamma static int gamma = 100; |
︙ | |||
358 359 360 361 362 363 364 | 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 | + + - + + + + + + + + + + + + + + + + + + + + + | } VARP(fov, 10, 105, 120); int xtraverts; VAR(fog, 64, 180, 1024); static OFColor *fogColor; |
︙ | |||
418 419 420 421 422 423 424 | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | - - - - - + + | float hf = hdr.waterlevel - 0.3f; float fovy = (float)fov * h / w; float aspect = w / (float)h; bool underwater = (player1.origin.z < hf); glFogi(GL_FOG_START, (fog + 64) / 8); glFogi(GL_FOG_END, fog); |
︙ |
Modified src/renderparticles.m from [187397123f] to [afec899fb1].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 | + | // renderparticles.cpp #include "cube.h" #import "OFColor+Cube.h" #import "Player.h" #import "Variable.h" #define MAXPARTICLES 10500 const int NUMPARTCUTOFF = 20; struct particle { OFVector3D o, d; |
︙ | |||
62 63 64 65 66 67 68 | 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 | - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | glDepthMask(GL_FALSE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA); glDisable(GL_FOG); struct parttype { |
︙ |