ioq3quest/code
Zack Middleton bc4ca164e0 From /dev/humancontroller:
really fix the confusion with game entity and refentity numbers

for any natural number M, the following is logical as a whole:
- the array size for refentities is M;
- the refentity number limit is M-1, ie., each refentity number is in [0..M-1];
- the special number for the world is M.

before r1429, the code was roughly the following:

// constants related to the game, should not be used by the renderer

// renderer stuff
refEntity_t refEntities[MAX_ENTITIES];
int numRefEntities = 0;

void addRefEntity(refEntity_t re)
{
	if (numRefEntities >= ENTITYNUM_WORLD)
		return; // full
	refEntities[numRefEntities++] = re;
}

void render(int num)
{
	if (num == ENTITYNUM_WORLD)
		renderWorld();
	else
		renderRefEntity(refEntities[num]);
}

so before r1429,
- the array size for refentities was 1023;
- the refentity number limit was 1021, ie., each refentity number was in [0..1021]; and
- the special number for the world entity was 1022.
this was a small waste of memory, as the last array element wasn't used.

r1429 changed
	if (numRefEntities >= ENTITYNUM_WORLD)
to
	if (numRefEntities >= MAX_ENTITIES).

this creates the following configuration:
- the array size for refentities is 1023;
- the refentity number limit is 1022, ie., each refentity number is in [0..1022]; and
- the special number for the world entity is 1022.

r1429 just makes things worse: it allows 1 more refentity to be added, but that entity doesn't get drawn anyway, as its number will be equal to the special number for the world. this is a small waste of not only memory, but also processing time.

perhaps in XreaL,

ENTITYNUM_WORLD is a game entity constant, and has nothing to do with refentities. a new REFENTITYNUM_WORLD constant should be added to denote the special number for the world, and that constant should be used in the renderer code in place of ENTITYNUM_WORLD. so define such a constant, and let it be equal to MAX_ENTITIES, which is 1023.
2012-10-17 21:17:37 +00:00
..
AL (#3767) Some protection from malicious qvms - patches and ideas by Amanieu d'Antras and Ben Millwood 2011-03-08 01:39:34 +00:00
SDL12/include Minor hack to SDL headers for building on Linux. 2012-04-11 04:51:58 +00:00
asm Move argument passing from VM to engine to global variables which allows to get rid of lots of OS specific stuff and also fixes errors that happens when compilers add lots of boilerplate to the DoSyscall() function 2012-08-08 09:34:03 +00:00
botlib Various bugfixes by Tobias Kuehnhammer (#5270) 2012-07-01 17:27:52 +00:00
cgame Play correct team sounds when in spectator mode and following a player. 2012-10-11 18:22:41 +00:00
client When in third person, don't play player's sounds as full volume in Base sound system. OpenAL already does this. (Related to bug 5741.) 2012-10-17 20:39:45 +00:00
game Fix game getting stuck in a do-while loop when "team follow1" or "team follow2" client sends a follownext or followprev command. 2012-09-10 01:22:13 +00:00
jpeg-8c Mark JPEG lib changes, file provided by Simon McVittie 2012-07-01 18:07:56 +00:00
libcurl/curl * add cURL support for HTTP/FTP downloading (bug 2661) 2006-09-11 16:41:55 +00:00
libs updating mac SDL stuff to 1.2.15 2012-04-10 06:01:16 +00:00
libspeex Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
null - Fix already defined command warnings for minimize 2011-08-01 10:16:40 +00:00
q3_ui Fix resetting single player level selection in q3_ui when there is no training level, such as in demoq3. 2012-09-30 06:21:08 +00:00
qcommon Oops, still need this 2012-08-08 09:42:33 +00:00
renderer From /dev/humancontroller: 2012-10-17 21:17:37 +00:00
sdl Don't include client.h in sdl_glimp.c as it is part of the external renderer lib. 2012-10-13 23:15:02 +00:00
server Don't replay to status OOB requests in Team Arena single player. 2012-08-16 21:38:02 +00:00
sys Fix this for real now. 2012-07-23 21:27:17 +00:00
tools more '\n' business 2012-06-19 15:14:57 +00:00
ui Fix UI player model FOV when using non-640x480 resolution. 2012-09-30 02:56:50 +00:00
zlib - Tested and updated MSVC project file to really make it work with new zlib 2009-10-19 16:16:52 +00:00