I'm currently trying to do something that might sound strange to people who are common with the modding of Q3A : Rendering entities in a different place than they are "really" ... If this is not clear, please take a look at my other topic that talks about the main project : http://quake3world.com/forum/viewtopic.php?f=16&t=48898
I could do that by duplicating the actual entities, but that would be a waste of space in the entity list since I only need the "visual" information of the entities (position, orientation, ...).
So, I read a lot of code and I think I found the place I wanted to add things in. That's inside the R_AddEntitySurfaces function (tr_main.c, line 1258). In that function, all the game entities are passed in a loop in which their render type (model, sprite, beam, ...) points the out to a specific "addSurface" function (example : "R_addMD3Surfaces( ent )").
Here's what I did : Inside that function, there is a "temp" intity called "ent", that hosts the entity from which the visual infos are used to add the surfaces to render. So, I created another "slot" ( "ent2" ) that also copies the entity, and that modifies the position :
Code: Select all
R_AddMD3Surfaces( ent );
ent2 = ent;
ent2->e.origin[0] += 128;
R_AddMD3Surfaces( ent2 );

As you can see, the player model seems to be 128 units from it's origin point (which can be seen from the shadow), But there is only one rendered model ! That's the problem n°1.
(Actually, this might be a pointer problem : the original "ent" is actually a pointer and not an independent copy of the concerned entity. And my ent2 was also a pointer, so modifying the position of the same, original entity ... I have to try actually creating an empty instance of an entity, not a pointer. I hope this is possible.).
The problem n°2 is that my modification applies to ALL the md3 objects, as you can see on the interface, the ammo and player head are distant. How can I limit my system on only the "scene" entities ?