Cube  Check-in [e79356d2a6]

Overview
Comment:Fix -Wgnu-folding-constant
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e79356d2a66c0537866b4ff23389bc8b8755ac324310c769e670d4247456d604
User & Date: js on 2025-03-20 23:02:06
Other Links: manifest | tags
Context
2025-03-22
21:29
Use OFColor instead of abusing OFVector3D check-in: e258bfb559 user: js tags: trunk
2025-03-20
23:02
Fix -Wgnu-folding-constant check-in: e79356d2a6 user: js tags: trunk
22:40
Fix all warnings check-in: 0e7605d101 user: js tags: trunk
Changes

Modified src/clientextras.m from [572b41b936] to [ff738c9cd3].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
		scoreLines = [[OFMutableArray alloc] init];

	[scoreLines addObject:line];

	menumanual(0, scoreLines.count - 1, line);
}

static const int maxTeams = 4;
static OFString *teamName[maxTeams];
static int teamScore[maxTeams];
static size_t teamsUsed;

void
addteamscore(DynamicEntity *d)
{







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
		scoreLines = [[OFMutableArray alloc] init];

	[scoreLines addObject:line];

	menumanual(0, scoreLines.count - 1, line);
}

#define maxTeams 4
static OFString *teamName[maxTeams];
static int teamScore[maxTeams];
static size_t teamsUsed;

void
addteamscore(DynamicEntity *d)
{

Modified src/editing.m from [3450764149] to [72ec7780d9].

525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
setvdelta(int delta)
{
	EDITSEL;
	setvdeltaxy(delta, &sel);
	addmsg(1, 6, SV_EDITD, sel.x, sel.y, sel.xs, sel.ys, delta);
}

const int MAXARCHVERT = 50;
int archverts[MAXARCHVERT][MAXARCHVERT];
bool archvinit = false;

void
archvertex(int span, int vert, int delta)
{
	if (!archvinit) {







|







525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
setvdelta(int delta)
{
	EDITSEL;
	setvdeltaxy(delta, &sel);
	addmsg(1, 6, SV_EDITD, sel.x, sel.y, sel.xs, sel.ys, delta);
}

#define MAXARCHVERT 50
int archverts[MAXARCHVERT][MAXARCHVERT];
bool archvinit = false;

void
archvertex(int span, int vert, int delta)
{
	if (!archvinit) {

Modified src/renderextras.m from [866128604e] to [5de4da4840].

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	xtraverts += 8;
	glEnable(GL_BLEND);
	glEnable(GL_TEXTURE_2D);
	glDepthMask(GL_TRUE);
}

const int MAXSPHERES = 50;
struct sphere {
	OFVector3D o;
	float size, max;
	int type;
	struct sphere *next;
};
static struct sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;







|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	xtraverts += 8;
	glEnable(GL_BLEND);
	glEnable(GL_TEXTURE_2D);
	glDepthMask(GL_TRUE);
}

#define MAXSPHERES 50
struct sphere {
	OFVector3D o;
	float size, max;
	int type;
	struct sphere *next;
};
static struct sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;

Modified src/rendergl.m from [27f04a759e] to [2d15d16f3c].

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
	return true;
}

// management of texture slots
// each texture slot can have multople texture frames, of which currently only
// the first is used additional frames can be used for various shaders

static const int MAXTEX = 1000;
static int texx[MAXTEX]; // ( loaded texture ) -> ( name, size )
static int texy[MAXTEX];
static OFString *texname[MAXTEX];
static int curtex = 0;
static const int FIRSTTEX = 1000; // opengl id = loaded id + FIRSTTEX
// std 1+, sky 14+, mdls 20+

static const int MAXFRAMES = 2; // increase to allow more complex shader defs
static int mapping[256]
                  [MAXFRAMES]; // ( cube texture, frame ) -> ( opengl id, name )

static OFString *mapname[256][MAXFRAMES];

void
purgetextures()
{
	loopi(256) loop(j, MAXFRAMES) mapping[i][j] = 0;
}







|







|
|
|
>







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
	return true;
}

// management of texture slots
// each texture slot can have multople texture frames, of which currently only
// the first is used additional frames can be used for various shaders

#define MAXTEX 1000
static int texx[MAXTEX]; // ( loaded texture ) -> ( name, size )
static int texy[MAXTEX];
static OFString *texname[MAXTEX];
static int curtex = 0;
static const int FIRSTTEX = 1000; // opengl id = loaded id + FIRSTTEX
// std 1+, sky 14+, mdls 20+

// increase to allow more complex shader defs
#define MAXFRAMES 2
// ( cube texture, frame ) -> ( opengl id, name )
static int mapping[256][MAXFRAMES];
static OFString *mapname[256][MAXFRAMES];

void
purgetextures()
{
	loopi(256) loop(j, MAXFRAMES) mapping[i][j] = 0;
}

Modified src/renderparticles.m from [7f852b8ad3] to [f527e01774].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// renderparticles.cpp

#include "cube.h"

#import "DynamicEntity.h"

const int MAXPARTICLES = 10500;
const int NUMPARTCUTOFF = 20;
struct particle {
	OFVector3D o, d;
	int fade, type;
	int millis;
	struct particle *next;
};






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
// renderparticles.cpp

#include "cube.h"

#import "DynamicEntity.h"

#define MAXPARTICLES 10500
const int NUMPARTCUTOFF = 20;
struct particle {
	OFVector3D o, d;
	int fade, type;
	int millis;
	struct particle *next;
};

Modified src/weapon.m from [2e4de9f255] to [81ddf6dcb5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// weapon.cpp: all shooting and effects code

#include "cube.h"

#import "DynamicEntity.h"
#import "OFString+Cube.h"
#import "Projectile.h"

static const int MONSTERDAMAGEFACTOR = 4;
static const int SGRAYS = 20;
static const float SGSPREAD = 2;
static OFVector3D sg[SGRAYS];

static const struct {
	short sound, attackdelay, damage, projspeed, part, kickamount;
	OFString *name;
} guns[NUMGUNS] = {









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// weapon.cpp: all shooting and effects code

#include "cube.h"

#import "DynamicEntity.h"
#import "OFString+Cube.h"
#import "Projectile.h"

static const int MONSTERDAMAGEFACTOR = 4;
#define SGRAYS 20
static const float SGSPREAD = 2;
static OFVector3D sg[SGRAYS];

static const struct {
	short sound, attackdelay, damage, projspeed, part, kickamount;
	OFString *name;
} guns[NUMGUNS] = {
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
		if (intersect(player, &o, &worldpos))
			return [player name];
	}

	return nil;
}

static const size_t MAXPROJ = 100;
static Projectile *projs[MAXPROJ];

void
projreset()
{
	for (size_t i = 0; i < MAXPROJ; i++)
		projs[i].inuse = false;







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
		if (intersect(player, &o, &worldpos))
			return [player name];
	}

	return nil;
}

#define MAXPROJ 100
static Projectile *projs[MAXPROJ];

void
projreset()
{
	for (size_t i = 0; i < MAXPROJ; i++)
		projs[i].inuse = false;