Forum

Custom colisions in walls according to textures

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Custom colisions in walls according to textures

Postby Nahuel » Wed Jun 08, 2011 10:09 pm

Thanks to Seven for the tuto to create effects and to Chris for to liberate the code of The Hunted Chronicles 3!!!!!!!!!!!!!
My English is very bad, I am going to limit myself to simple orders in this tutorial. What I did was to "extract" the code of the hunted chronicles and adapt it to the normal quake .
I am very noob with the "effectinfo.txt", Try to fix!!
You need DARKPLACES (tested in the 18/5/2011 version)

1- Create a new file called effectinfo.txt in the directory of your mod with this
Code: Select all
effect nahuel1
count 8
type spark
color 0x1f2399 0xfff32b
size 0.4 0.4
alpha 0 256 768
gravity 0.7
bounce -1
velocityoffset 0 0 20
velocityjitter 64 64 64
velocitymultiplier 1

effect nahuel
count 12
type spark
color 0x8f1313 0xfff16b
size 0.4 0.4
alpha 0 256 768
gravity 1
bounce  1
velocityoffset 0 0 40
velocityjitter 64 64 64
velocitymultiplier 1


effect nahuel2
notunderwater
count 5
type smoke
color 0x303010 0x404010
tex 0 8
size 3 3
sizeincrease 1
alpha 0 32 2
bounce -1
lighttime 0
airfriction 0.2
liquidfriction 1
velocityjitter 64 64 64   


2- put this at the end of defs.qc (if you do not have dpextensions.qc)

Code: Select all

//DP_SV_POINTPARTICLES
//idea: Spike
//darkplaces implementation: LordHavoc
//function definitions:
float(string effectname) particleeffectnum = #335; // same as in CSQC
void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; // same as in CSQC
void(float effectnum, vector org, vector vel, float howmany) pointparticles = #337; // same as in CSQC

//DP_QC_GETSURFACE
//idea: LordHavoc
//darkplaces implementation: LordHavoc
//builtin definitions:
float(entity e, float s) getsurfacenumpoints = #434;
vector(entity e, float s, float n) getsurfacepoint = #435;
vector(entity e, float s) getsurfacenormal = #436;
string(entity e, float s) getsurfacetexture = #437;
float(entity e, vector p) getsurfacenearpoint = #438;
vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
//description:
//functions to query surface information.

save and close.
3-
Open weapons.qc an put this very above


Code: Select all
enum
{
MAT_GENERIC, MAT_METAL, MAT_WOOD, MAT_COMP, MAT_FLESH
};
float (entity ent, vector org) GetTextureMaterial =
{
local float surfnum, MaterialChunk;
local string s;

makevectors(ent.v_angle);

surfnum = getsurfacenearpoint(world, org);


if (surfnum >= 0)// some textures from "start.bsp"
{
s = getsurfacetexture(world, surfnum);
   if (s == "wizmet1_1")
      return MAT_METAL;
else   if (s == "wizmet1_2")
      return MAT_METAL;
else   if (s == "met5_1")
      return MAT_METAL;
else   if (s == "metal5_5")
      return MAT_METAL;
else   if (s == "metal5_3")
      return MAT_METAL;

   else if (s == "tech01_1")
      return MAT_COMP;
   else if (s == "tech01_6")
      return MAT_COMP;
   else if (s == "tlight02")
      return MAT_COMP;
   else if (s == "slip1")
      return MAT_COMP;
   else if (s == "+0slip")
      return MAT_COMP;
   else if (s == "exit02_3")
      return MAT_FLESH;      
   else if (s == "exit02_2")
      return MAT_FLESH;      
   else if (s == "wood1_1")
      return MAT_WOOD;      
   else if (s == "wood1_5")
      return MAT_WOOD;      

   else if (s == "wizwood1_8")
      return MAT_WOOD;      
   else if (s == "wizwood1_3")
      return MAT_WOOD;      

   else if (s == "wizwood1_5")
      return MAT_WOOD;         
}
else
   return MAT_GENERIC;
      
            };

Go to the function TraceAttack, put this after
local vector vel, org;
Code: Select all
      local float surfnum, mat;
   local string s;


and replace this


else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}

with this new code
Code: Select all
else
   {
      
      mat = GetTextureMaterial(self, trace_endpos);
      
      if (mat == MAT_METAL)
      {
      pointparticles(particleeffectnum("nahuel"), org, v_forward*(-550), 1);
      }
      else if (mat == MAT_WOOD)
      {
      pointparticles(particleeffectnum("nahuel2"), org, v_forward*(-550), 1);
      }      
      else if (mat == MAT_COMP)
      {
      pointparticles(particleeffectnum("nahuel1"), org, v_forward*(-550), 1);
      }      

      else
      {
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
      WriteByte (MSG_BROADCAST, TE_GUNSHOT);
      WriteCoord (MSG_BROADCAST, org_x);
      WriteCoord (MSG_BROADCAST, org_y);
      WriteCoord (MSG_BROADCAST, org_z);
      }
   }

SAve and close.Compile and run the map start.
You can see the new effects shooting the different textures (i am very noob with the effectinfo.txt :wink: )[/code]
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby toneddu2000 » Fri Jun 10, 2011 3:59 pm

Thanks Nahuel for the excellent tuto!
and to Chris for to liberate the code of The Hunted Chronicles 3!!!!!!!!!!!!!

WHAT?! WHEN? WHERE?
I NEED IT! no, I WANT IT! :)
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Postby Nahuel » Fri Jun 10, 2011 4:42 pm

toneddu2000 wrote:Thanks Nahuel for the excellent tuto!
and to Chris for to liberate the code of The Hunted Chronicles 3!!!!!!!!!!!!!

WHAT?! WHEN? WHERE?
I NEED IT! no, I WANT IT! :)

I do not know if this code is exactly from "THC 3", You know this "snapshot of source code"!
http://chrisjpage.com/port/THCExampleSourceCode.zip
It is great!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby toneddu2000 » Fri Jun 10, 2011 6:24 pm

ah, well this is not thc3. Infact I was astonished because I talked once with Chris about it and he wasn't sure to release the source code of thc3. Anyway that man is awesome!
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Postby Seven » Sat Jun 11, 2011 8:06 am

Nice realization of your idea Nahuel.


All the time while playing with "effects, shaders and textures only" in DarkPlaces the last years,
I now found out how much more power you have if you implement them into QC.
There are no limits if you do this. Ideas, that could not be realized before, can now finally be done.
DarkPlaces gives us many additional/special commands via dpextensions.qc to life our ideas.

When I look back to things now, I notice how unspectacular they look compared to QC modification driven things.

I guess that is the process everybody goes through.

That is why I am so happy that a place like inside3d exists for noobs like me, to ask questions and get answers.

Kind regards,
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest