Forum

Adding new weapons into the engine...

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Adding new weapons into the engine...

Postby DusterdooSmock » Tue Feb 15, 2011 10:54 pm

How does the engine know what all of the IT_WEAPONS are? Does it just read the defs in the qc, or are they hardcoded into the engine somehow? If they're in the engine, would you mind showing me how to add new ones? As well as adding other new stats that are similar to the health...
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Baker » Wed Feb 16, 2011 5:34 am

The weapon definitions in the QuakeC and the engine have to match. The short version is that you should re-define the weapon constants for your mod in both the engine and the QuakeC to match.

Files you should be looking at:

Engine: quakedef.h, sbar.c (cl_sbar.c in ProQuake PSP) ... examples http://bladebattles.com/kurok/SVN/quakedef.h and http://bladebattles.com/kurok/SVN/sbar.c
QuakeC: defs.qc ... (I think, I'm not as quick with QuakeC recall as engine) like http://inside3d.com/browse.php?show=defs.qc

Look for stuff like this:

Code: Select all
//
// stats are integers communicated to the client by the server
//
#define   MAX_CL_STATS      32
#define   STAT_HEALTH         0
#define   STAT_FRAGS         1
#define   STAT_WEAPON         2
#define   STAT_AMMO         3
#define   STAT_ARMOR         4
#define   STAT_WEAPONFRAME   5
#define   STAT_SHELLS         6
#define   STAT_NAILS         7
#define   STAT_ROCKETS      8
#define   STAT_CELLS         9
#define   STAT_ACTIVEWEAPON   10
#define   STAT_TOTALSECRETS   11
#define   STAT_TOTALMONSTERS   12
#define   STAT_SECRETS      13      // bumped on client side by svc_foundsecret
#define   STAT_MONSTERS      14      // bumped by svc_killedmonster

// stock defines

#define   IT_SHOTGUN            1
#define   IT_SUPER_SHOTGUN      2
#define   IT_NAILGUN            4
#define   IT_SUPER_NAILGUN      8
#define   IT_GRENADE_LAUNCHER      16
#define   IT_ROCKET_LAUNCHER      32
#define   IT_LIGHTNING         64
//#define IT_SUPER_LIGHTNING      128
#define IT_SHELLS               256
#define IT_NAILS                512
#define IT_ROCKETS              1024
#define IT_CELLS                2048

#define IT_AXE                  4096
#define IT_ARMOR1               8192
#define IT_ARMOR2               16384
#define IT_ARMOR3               32768
#define IT_SUPERHEALTH          65536
#define IT_KEY1                 131072
#define IT_KEY2                 262144
#define   IT_INVISIBILITY         524288
#define   IT_INVULNERABILITY      1048576
#define   IT_SUIT               2097152
#define   IT_QUAD               4194304
#define IT_SIGIL1               (1<<28)
#define IT_SIGIL2               (1<<29)
#define IT_SIGIL3               (1<<30)
#define IT_SIGIL4               (1<<31)

//===========================================
//kurok changed and added defines

#define KIT_SHELLS              128
#define KIT_NAILS               256
#define KIT_ROCKETS             512
#define KIT_CELLS               1024
#define KIT_AXE                 2048
#define KIT_TEKBOW             4096
#define KIT_UZI               8192
#define KIT_M99               16384
#define KIT_EXTRAW1              32768
#define KIT_EXTRAW2              65536
#define KIT_ARMOR1              8388608
#define KIT_ARMOR2              16777216
#define KIT_ARMOR3              33554432
#define KIT_50CAL              67108864
#define KIT_60CAL              134217728
#define KIT_EXTRA1             268435456
#define KIT_EXTRA2              536870912
#define KIT_EXTRA3              1073741824
#define KIT_SUPERHEALTH         2147483648

//===========================================
//rogue changed and added defines

#define RIT_SHELLS              128
#define RIT_NAILS               256
#define RIT_ROCKETS             512
#define RIT_CELLS               1024
#define RIT_AXE                 2048
#define RIT_LAVA_NAILGUN        4096
#define RIT_LAVA_SUPER_NAILGUN  8192
#define RIT_MULTI_GRENADE       16384
#define RIT_MULTI_ROCKET        32768
#define RIT_PLASMA_GUN          65536
#define RIT_ARMOR1              8388608
#define RIT_ARMOR2              16777216
#define RIT_ARMOR3              33554432
#define RIT_LAVA_NAILS          67108864
#define RIT_PLASMA_AMMO         134217728
#define RIT_MULTI_ROCKETS       268435456
#define RIT_SHIELD              536870912
#define RIT_ANTIGRAV            1073741824
#define RIT_SUPERHEALTH         2147483648

//MED 01/04/97 added hipnotic defines
//===========================================
//hipnotic added defines
#define HIT_PROXIMITY_GUN_BIT 16
#define HIT_MJOLNIR_BIT       7
#define HIT_LASER_CANNON_BIT  23
#define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
#define HIT_MJOLNIR         (1<<HIT_MJOLNIR_BIT)
#define HIT_LASER_CANNON    (1<<HIT_LASER_CANNON_BIT)
#define HIT_WETSUIT         (1<<(23+2))
#define HIT_EMPATHY_SHIELDS (1<<(23+3))
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Mexicouger » Wed Feb 16, 2011 2:32 pm

It's easy Duster
In your QC, if you have a weapon, like..
Code: Select all
float IT_SMASHER = 8388608;


Then you would go into your engine code and Put...
Code: Select all
#define IT_SMASHER 8388608


And wala. Then if you'd like to use it in the engine you go...

i
Code: Select all
f (cl.stats[STAT_WEAPON] == IT_SMASHER)
dostuff;
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby DusterdooSmock » Wed Feb 16, 2011 6:42 pm

Got it. Thanks guys. ;)
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest