Need QuakeC help: can't get decals/bulletholes to work with spawned in BSP entities.
I spawn a bsp model in game. Though when you shoot it there are particle effects, there are no bullet holes/decals.
I can't figure out how to make them stick to it. I look in the darkplaces source to no avail, the quakec source, and google.
No mention of this.
spawnfunc_misc_clientmodel(); //(Also tried spawnfunc_func_clientwall, same thing)
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
how do I get decals/bulletholes to go on it, if possible? Is there a flag? The non-entity 0 movers in the map get bullet holes...
I notice entity 0 gets bullet holes, and other entities (movers, doors in the map) also get bullet
holes and decals. They aren't entity 0 but are part of the map.
Engine: darkplaces.
QuakeC: Xonotic
I asked on IRC but was told to fuck off they won't help me.
Announcement
Collapse
No announcement yet.
Need QuakeC help: can't get decals/bulletholes to work with spawned in BSP entities.
Collapse
X
-
True, I was meaning that it can be challenging, depending on what you are wanting to to , to determine the relative angles and position of the follow ent with respect to the ent its intending to follow. More of a statement that shows my shortcomings in advanced math I guess.
Originally posted by frag.machine View PostThis example comes with dpextension.qc:
Everything is handled by the engine, no need of extra code to track anything.Code://DP_MOVETYPEFOLLOW //idea: id Software, LordHavoc (redesigned) //darkplaces implementation: LordHavoc //movetype definitions: float MOVETYPE_FOLLOW = 12; //description: //MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways: //aiment - the entity this is attached to. //punchangle - the original angles when the follow began. //view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle). //v_angle - the relative angles. //here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates: //hole.movetype = MOVETYPE_FOLLOW; // make the hole follow //hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid //hole.aiment = bmodel; // make the hole follow bmodel //hole.punchangle = bmodel.angles; // the original angles of bmodel //hole.view_ofs = hole.origin - bmodel.origin; // relative origin //hole.v_angle = hole.angles - bmodel.angles; // relative angles
Leave a comment:
-
DP has built in decals.
You can see it's working on the worldspawn bsp and also where the other bsp entities are near a surface of the worldspawn bsp. Also static ents spawned by the worldspawn have decals. There is an internal variable (allowdecals) that seems to allow it. It is not conventionally accessable via QC and I don't know how to get it to allow a func_clientwall to get allowdecals'ed.
Leave a comment:
-
This example comes with dpextension.qc:
Everything is handled by the engine, no need of extra code to track anything.Code://DP_MOVETYPEFOLLOW //idea: id Software, LordHavoc (redesigned) //darkplaces implementation: LordHavoc //movetype definitions: float MOVETYPE_FOLLOW = 12; //description: //MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways: //aiment - the entity this is attached to. //punchangle - the original angles when the follow began. //view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle). //v_angle - the relative angles. //here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates: //hole.movetype = MOVETYPE_FOLLOW; // make the hole follow //hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid //hole.aiment = bmodel; // make the hole follow bmodel //hole.punchangle = bmodel.angles; // the original angles of bmodel //hole.view_ofs = hole.origin - bmodel.origin; // relative origin //hole.v_angle = hole.angles - bmodel.angles; // relative angles
Leave a comment:
-
If they are gonna move the decal more or less has to track the other ent with respect to its origin and angles. Thats why MOVETYPE_FOLLOW would be my first choice. Calculating the relative angles of the follow_ent can be challenging though depending on maybe if the other ent is changing frames, and thereby showing a different shape for ex.
Leave a comment:
-
makestatic(self); didn't work too well.
The models don't show up at all after that.
I need away to allowdecals on the models regular.
They're tricked where they intersect the world, the engine thinks it's aight to add decals to those surfaces.
Could it be done prvm edict?
Leave a comment:
-
These entities need to beable be removed. A nuclear bomb can wreck them. Also DP only allows 1024 static entities.Originally posted by Zop View PostThere is a quakec function called makestatic() that turns entities static. Such entities they can no longer move, think, or be removed(), so hopefully that's ok.
Im going to try that out tho, to see if the makestatic(); lets it have decals, will report back.
Leave a comment:
-
At first I thought you made up .allowdecals, and were hoping it would just work. I see it's an actual field, in the c code, but quakec has access to many less fields.
Quakec calls the spawn() function, and you should be able to find that in the code. You also hit a bit of a jackpot with static entities. There is a quakec function called makestatic() that turns entities static. Such entities they can no longer move, think, or be removed(), so hopefully that's ok.
Leave a comment:
-
Tryd putting in various places in cl_main.c...
ent->render.allowdecals = TRUE; //See if this does it
(didn't work)
Leave a comment:
-
Static entities seem to get decals allowed:
/*
=====================
CL_ParseStatic
=====================
*/
static void CL_ParseStatic (int large)
{
entity_t *ent;
if (cl.num_static_entities >= cl.max_static_entities)
Host_Error ("Too many static entities");
ent = &cl.static_entities[cl.num_static_entities++];
CL_ParseBaseline (ent, large);
if (ent->state_baseline.modelindex == 0)
{
Con_DPrintf("svc_parsestatic: static entity without model at %f %f %f\n", ent->state_baseline.origin[0], ent->state_baseline.origin[1], ent->state_baseline.origin[2]);
cl.num_static_entities--;
// This is definitely a cheesy way to conserve resources...
return;
}
// copy it to the current state
ent->render.model = CL_GetModelByIndex(ent->state_baseline.modelindex);
ent->render.framegroupblend[0].frame = ent->state_baseline.frame;
ent->render.framegroupblend[0].lerp = 1;
// make torchs play out of sync
ent->render.framegroupblend[0].start = lhrandom(-10, -1);
ent->render.skinnum = ent->state_baseline.skin;
ent->render.effects = ent->state_baseline.effects;
ent->render.alpha = 1;
//VectorCopy (ent->state_baseline.origin, ent->render.origin);
//VectorCopy (ent->state_baseline.angles, ent->render.angles);
Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, ent->state_baseline.origin[0], ent->state_baseline.origin[1], ent->state_baseline.origin[2], ent->state_baseline.angles[0], ent->state_baseline.angles[1], ent->state_baseline.angles[2], 1);
ent->render.allowdecals = true;
CL_UpdateRenderEntity(&ent->render);
}
" Mr. Bougo Offline
Author of commit e128932
*******
Posts: 4,316
Joined: Mar 2010
Reputation: 108
RE: QuakeWiki revival
I believe the static entities are the brush-based ones. Like lifts, doors, perhaps some trigger brushes, etc.
EDIT: And, since 2010, DP supports 256 static entities when compiled with SMALLMEMORY #define'd, but 1024 otherwise. "
Leave a comment:
-
(Doesn't work in CSQC either)
Could one of you ask on the IRC?
Maybe they'll answer for you
Leave a comment:
-
If only this worked (it doesn't)
self.allowdecals = TRUE;
spawnfunc_func_clientwall(); //Sets solid right away, otherwise similar to clientmodel
mutators/mutator_spawnvehicles.qc:15291:5: error: unexpected identifier: allowdecals
mutators/mutator_spawnvehicles.qc:15291:5: error: there have been errors, bailing out
(was worth a shot given the engine code
entrender->allowdecals = true;
Leave a comment:

Leave a comment: