ioq3quest/code/renderer
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
..
iqm.h Fix forgotten IQM2 support in iqm.h, patch by Zack Middleton 2011-06-11 20:20:30 +00:00
qgl.h * (bug 3393) Blank user names still possible (Michael Jard <kfaust@gmail.com>) 2007-11-02 23:36:23 +00:00
tr_animation.c - Add licence headers to new files 2011-05-02 20:30:14 +00:00
tr_backend.c From /dev/humancontroller: 2012-10-17 21:17:37 +00:00
tr_bsp.c * Fix various warnings with GCC and clang 2011-10-27 21:32:28 +00:00
tr_cmds.c Add color combination green-magenta for anaglyph 2011-11-18 12:47:42 +00:00
tr_curve.c Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
tr_flares.c REFACTOR [reletive -> relative] 2012-06-18 16:32:03 +00:00
tr_font.c Moved dpi variable inside BUILD_FREETYPE ifdef. 2012-04-07 16:34:21 +00:00
tr_image.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_image_bmp.c Remove newlines from Com_Error calls, patch by DevHC 2011-05-14 14:32:43 +00:00
tr_image_jpg.c Remove newlines from Com_Error calls, patch by DevHC 2011-05-14 14:32:43 +00:00
tr_image_pcx.c * Fix some new GCC 4.3 warnings 2008-11-10 23:55:22 +00:00
tr_image_png.c REFACTOR [a vs an] 2012-06-18 16:31:16 +00:00
tr_image_tga.c Remove newlines from Com_Error calls, patch by DevHC 2011-05-14 14:32:43 +00:00
tr_init.c Incorrect number of overbright bits printed by GfxInfo_f() (#5510) - fix by Serge Belyshev 2012-07-01 16:59:20 +00:00
tr_light.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_local.h Fixed usage of various entity defines. 2011-11-05 01:02:35 +00:00
tr_main.c From /dev/humancontroller: 2012-10-17 21:17:37 +00:00
tr_marks.c Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
tr_mesh.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_model.c Reverted r2209... 2011-12-08 23:34:51 +00:00
tr_model_iqm.c * clang support 2011-10-21 22:48:53 +00:00
tr_noise.c - Add support for linearly desaturating images via r_greyscale 2011-02-04 16:04:37 +00:00
tr_public.h Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_scene.c From /dev/humancontroller: 2012-10-17 21:17:37 +00:00
tr_shade.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_shade_calc.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_shader.c REFACTOR [reletive -> relative] 2012-06-18 16:32:03 +00:00
tr_shadows.c - Implement stereo rendering with anaglyph images. 2008-04-27 17:32:14 +00:00
tr_sky.c Modular rendering system. Patch by use.less01 2011-08-01 01:19:55 +00:00
tr_subs.c Add forgotten file for last rev 2011-08-01 01:30:54 +00:00
tr_surface.c Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
tr_types.h From /dev/humancontroller: 2012-10-17 21:17:37 +00:00
tr_world.c From /dev/humancontroller: 2012-10-17 21:17:37 +00:00