323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
struct strip s = { .tex = tex, .start = start, .num = n };
[strips addItem: &s];
}
#undef gamma
VARFP(gamma, 30, 100, 300, {
float f = gamma / 100.0f;
Uint16 ramp[256];
SDL_CalculateGammaRamp(f, ramp);
if (SDL_SetWindowGammaRamp(Cube.sharedInstance.window,
ramp, ramp, ramp) == -1) {
conoutf(
@"Could not set gamma (card/driver doesn't support it?)");
conoutf(@"sdl: %s", SDL_GetError());
}
})
void
|
>
|
|
|
>
>
|
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;
VARBP(gamma, 30, 300, ^ { return gamma; }, ^ (int value) {
float f = value / 100.0f;
Uint16 ramp[256];
SDL_CalculateGammaRamp(f, ramp);
if (SDL_SetWindowGammaRamp(Cube.sharedInstance.window,
ramp, ramp, ramp) != -1)
gamma = value;
else {
conoutf(
@"Could not set gamma (card/driver doesn't support it?)");
conoutf(@"sdl: %s", SDL_GetError());
}
})
void
|
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
}
VARP(fov, 10, 105, 120);
int xtraverts;
VAR(fog, 64, 180, 1024);
VAR(fogcolour, 0, 0x8099B3, 0xFFFFFF);
VARP(hudgun, 0, 1, 1);
OFString *hudgunnames[] = { @"hudguns/fist", @"hudguns/shotg",
@"hudguns/chaing", @"hudguns/rocket", @"hudguns/rifle" };
void
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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;
VARB(fogcolour, 0, 0xFFFFFF, (^ {
float red, green, blue;
if (fogColor == nil)
return 0x8099B3;
[fogColor getRed: &red green: &green blue: &blue alpha: NULL];
return ((unsigned char)(red * 255.0f) << 16) |
((unsigned char)(green * 255.0f) << 8) |
(unsigned char)(blue * 255.0f);
}), ^ (int value) {
unsigned char red = (value >> 16) & 0xFF;
unsigned char green = (value >> 8) & 0xFF;
unsigned char blue = value & 0xFF;
fogColor = [OFColor colorWithRed: red / 255.0f
green: green / 255.0f
blue: blue / 255.0f
alpha: 1.f];
})
VARP(hudgun, 0, 1, 1);
OFString *hudgunnames[] = { @"hudguns/fist", @"hudguns/shotg",
@"hudguns/chaing", @"hudguns/rocket", @"hudguns/rifle" };
void
|
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
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);
float fogc[4] = { (fogcolour >> 16) / 256.0f,
((fogcolour >> 8) & 255) / 256.0f, (fogcolour & 255) / 256.0f,
1.0f };
glFogfv(GL_FOG_COLOR, fogc);
glClearColor(fogc[0], fogc[1], fogc[2], 1.0f);
if (underwater) {
fovy += (float)sin(lastmillis / 1000.0) * 2.0f;
aspect += (float)sin(lastmillis / 1000.0 + PI) * 0.1f;
glFogi(GL_FOG_START, 0);
glFogi(GL_FOG_END, (fog + 96) / 8);
}
|
<
<
<
|
|
|
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);
[fogColor cube_setAsGLFogColor];
[fogColor cube_setAsGLClearColor];
if (underwater) {
fovy += (float)sin(lastmillis / 1000.0) * 2.0f;
aspect += (float)sin(lastmillis / 1000.0 + PI) * 0.1f;
glFogi(GL_FOG_START, 0);
glFogi(GL_FOG_END, (fog + 96) / 8);
}
|