Cube  Check-in [7c3936be15]

Overview
Comment:Work around conflicting declaration of gamma
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7c3936be15500a3bdaa3aa603479e02786123f92c9f697b4a420d3b7411aa998
User & Date: js on 2025-03-24 21:11:31
Other Links: manifest | tags
Context
2025-03-24
22:14
Convert player into a class check-in: 5b7b7d2fc5 user: js tags: trunk
21:11
Work around conflicting declaration of gamma check-in: 7c3936be15 user: js tags: trunk
2025-03-23
22:14
Fix wrong argument order for calculating distance check-in: 75095b4f6e user: js tags: trunk
Changes

Modified src/cube.h from [5dab6dec5b] to [9e15fb9815].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// one big bad include file for the whole engine... nasty!

#import <ObjFW/ObjFW.h>

#define gamma gamma__
#include <SDL2/SDL.h>
#undef gamma

#include "tools.h"

#define _MAXDEFSTR 260

@class Entity;
@class DynamicEntity;




<

<







1
2
3
4

5

6
7
8
9
10
11
12
// one big bad include file for the whole engine... nasty!

#import <ObjFW/ObjFW.h>


#include <SDL2/SDL.h>


#include "tools.h"

#define _MAXDEFSTR 260

@class Entity;
@class DynamicEntity;

Modified src/rendergl.m from [e1c74cee31] to [27faa2c25f].

1
2


3
4
5
6
7
8
9
// rendergl.cpp: core opengl rendering stuff



#include "cube.h"

#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"
#import "OFString+Cube.h"



>
>







1
2
3
4
5
6
7
8
9
10
11
// rendergl.cpp: core opengl rendering stuff

#define gamma math_gamma

#include "cube.h"

#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"
#import "OFString+Cube.h"

319
320
321
322
323
324
325


326
327
328
329
330
331
332
	if (strips == nil)
		strips = [[OFMutableData alloc]
		    initWithItemSize:sizeof(struct strip)];

	struct strip s = { .tex = tex, .start = start, .num = n };
	[strips addItem:&s];
}



VARFP(gamma, 30, 100, 300, {
	float f = gamma / 100.0f;
	Uint16 ramp[256];

	SDL_CalculateGammaRamp(f, ramp);








>
>







321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	if (strips == nil)
		strips = [[OFMutableData alloc]
		    initWithItemSize:sizeof(struct strip)];

	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);

Modified src/tools.h from [4adaa385b0] to [754911f423].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// generic useful stuff for any C++ program

#ifndef _TOOLS_H
#define _TOOLS_H

#ifdef __GNUC__
# define gamma __gamma
#endif

#include <math.h>

#ifdef __GNUC__
# undef gamma
#endif

#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>






<
<
<
<


<
<
<
<







1
2
3
4
5




6
7




8
9
10
11
12
13
14
// generic useful stuff for any C++ program

#ifndef _TOOLS_H
#define _TOOLS_H





#include <math.h>





#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>