Commit Graph

14 Commits

Author SHA1 Message Date
Zack Middleton 037565293f From /dev/humancontroller:
to further reduce confusion, rename constants like MAX_ENTITIES to MAX_REFENTITIES
2012-10-17 21:20:29 +00:00
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
Zack Middleton 4e59ef714b Print developer message when renderer runs out of free entities. 2011-11-05 00:56:26 +00:00
Tim Angus 675e7a641a * clang support 2011-10-21 22:48:53 +00:00
Thilo Schulz 40dfcee06e Modular rendering system. Patch by use.less01
This might break MSVC builds. I'll take care of it later
2011-08-01 01:19:55 +00:00
Tim Angus 8b0f1a6737 * Rephrase broken compiler warning 2009-11-18 20:26:44 +00:00
Ryan C. Gordon ce544b23e6 Try to catch some NaNs that are almost certainly a compiler optimization bug.
Fixes Bugzilla #2998.
2009-09-14 23:01:49 +00:00
Tim Angus 3855f65d17 * Fix confusion of cgame and renderer entity array bounds (Tr3B) 2008-07-16 18:07:36 +00:00
Thilo Schulz 425c351d1b - Implement stereo rendering with anaglyph images.
- Add r_greyscale for black&white rendering
2008-04-27 17:32:14 +00:00
Tim Angus 05e8ab9538 * Added STATUS
* Updated TODO
* Moved ChangeLog to root
* Updated ChangeLog
* s/Foobar/Quake III Arena Source Code/
* Biggest patch EVAR. I wonder how many mail boxes this will fill...
2005-10-29 01:53:09 +00:00
Ludwig Nussel 5ae70d54b0 remove svn:executable property 2005-08-28 17:54:51 +00:00
Zachary Slater 59cce31e75 newlines fixed 2005-08-26 17:39:27 +00:00
Zachary Slater 5b755058f5 Itsa me, quake3io! 2005-08-26 04:48:05 +00:00
Travis Bradshaw dbe4ddb103 The Quake III Arena sources as originally released under the GPL license on August 20, 2005. 2012-01-31 13:41:34 -06:00