Quake3World.com https://www.quake3world.com/forum/ |
|
R_AddEntitySurfaces https://www.quake3world.com/forum/viewtopic.php?f=16&t=49253 |
Page 1 of 1 |
Author: | D-Meat [ 06-13-2013 01:58 AM ] |
Post subject: | R_AddEntitySurfaces |
Hello ! 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: R_AddMD3Surfaces( ent ); ent2 = ent; ent2->e.origin[0] += 128; R_AddMD3Surfaces( ent2 ); The result that would be expected is that a "copy" of every md3 model in the scene would appear 128 units next to the original. Here's the result : 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 ? |
Author: | UglyFoot [ 06-15-2013 09:37 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
You can add an entity calling RE_AddRefEntityToScene inside the renderer project. But you can also add entities in cgame with trap_R_AddRefEntityToScene, which would be useful to only duplicate the entities you want. I think you should do it in CG_DrawActiveFrame. |
Author: | D-Meat [ 06-16-2013 12:19 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
Thanks ! I'll investigate that ! |
Author: | D-Meat [ 06-27-2013 03:39 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
Ok, I understand much more now, and I have a vague idea about how I'll do what I want to do But I have a problem : it seems I can't use CG_Printf in the CG folder files ! and that's quite strange, take a look at that small extract from cg_view.c, at the end of CG_DrawActiveFrame : Code: if ( cg_stats.integer ) { CG_Printf( "cg.clientFrame:%i\n", cg.clientFrame ); } CG_Printf( "Dmeat testing\n" ); I added the last line. In game, when I activate the cvar cg_stats 1, the text is actually added to the console, but my "Dmeat Testing" is not ! How do you explain that ? I'm sorry this might sound basic ... But well, it's difficult to code whithout feedback ! |
Author: | D-Meat [ 06-28-2013 12:23 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
I think I might have an idea of what's going on. First, one question : are the cgame files always used in the virtual machine ? Because since my 6dof Project, I have a compilation error, which didn't cause any sort of visible problem in the strict client side and in the renderer project. Here's what thecompiler says : Code: CGAME_Q3LCC code/cgame/cg_view.c Q3ASM build/release-mingw32-x86/baseq3/vm/cgame.qvm build/release-mingw32-x86/baseq3/qcommon/q_math.asm:7050 error: symbol asin undefined make[2]: *** [build/release-mingw32-x86/baseq3/vm/cgame.qvm] Error 1 make[2]: Leaving directory `/m/_boulot/prog/ioq3' make[1]: *** [targets] Error 2 make[1]: Leaving directory `/m/_boulot/prog/ioq3' make: *** [release] Error 2 the math asin function is used in on the client side for some euler <-> quaternion conversions. It seems it doesn't exist in the Virtual machine ! Do you think it would be easy to add ? |
Author: | Eraser [ 06-28-2013 12:36 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
I always used Com_Printf() in the cgame module. |
Author: | D-Meat [ 06-28-2013 01:39 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
Ok, I think what I pointed out previously is actually true : the compilation actually stops at the virtual machine stage because of the asin function. (sorry, this topic is stepping aside from the original theme) A friend gave ma a solution, using the "acos" function, and since the "acos" function is declared in game/bg_lib.c along with "atan2" and other math things, this should do the trick. Except it doesn't ! Code: Q3ASM build/release-mingw32-x86/baseq3/vm/qagame.qvm build/release-mingw32-x86/baseq3/qcommon/q_math.asm:7050 error: symbol acos undefined The message is the same when I use "Q_acos" ! Now that I found this out, I guess I just need to declare "more" that Acos function I need ... Now, if someone played with this and happens to read this, I'm always eager to save some time and neurones |
Author: | D-Meat [ 06-28-2013 11:55 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
OK, now I can chill out a little bit : ioQ3 was reading the .vm files from the old pk3 instead of the newly compiled ones. So, Com_Printf and CG_Printf seem to be working ! Just a question : is it possible to force the game to look for the .vm files always in the baseq3 vm folder ? At the moment, I have to manually update a "pak9.pk3" each time I do a change ... I can now go back to the real stuff |
Author: | Eraser [ 06-29-2013 12:31 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
You should put your pk3 in a separate folder next to baseq3 and run it as mod. |
Author: | D-Meat [ 06-29-2013 02:21 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
With my current workflow, this still means that I have to move files after I compile. And I have to study what are the prerequisites to make a working mod And my objective is in fine to learn how to have a standalone game using the engine Thanks anyway ! I'm currently making good progress |
Author: | Eraser [ 06-29-2013 09:43 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
It's not hard. Just dump the qvm files in a "vm" subfolder in a folder, for example "dmeat". Then start quake3 with quake3.exe +set fs_game dmeat You can edit the batchfiles for compiling qvm's to erite to another output folder. |
Author: | UglyFoot [ 06-30-2013 11:55 AM ] |
Post subject: | Re: R_AddEntitySurfaces |
I don't have the ioq3 source but in the vq3 source there's a batch file called "installvms" which just moves the .qvm files to the mod folder, you don't need to put them in a .pk3. |
Author: | tw1sted1 [ 04-01-2017 09:33 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
I found a work-around for the acos problem. I thought I'd toss it out there just in case someone hadn't actually found a solution... After much experimentation, I decided to try just copying the create acos table from bg_lib.c and put it in the qcommon q_math.c right after the Q_crandom... That did it, the compiler liked it, everything compiled nicely. |
Author: | D-Meat [ 08-08-2017 12:31 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
Nice ! |
Author: | Ganemi [ 09-19-2017 07:55 PM ] |
Post subject: | Re: R_AddEntitySurfaces |
You shouldn't have to mess with the underlying engine code, only the mod code. Bazooka Quake 3 had a "displacement" powerup that would place your player 20 feet away so that you could confuse enemies, and that was before the release of the source. |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |