HomeNewsFeaturesLicensingDownloadsScreenshotsFAQRoadmap Contact Us
Search:
10 Online

Community

Discussion Topics Recent Postings User Contributions General Articles Example Documentation Credits

Licensed Developer

Programmer's Manual Artists Manual Tutorials and Articles

Programming: Game Code

Game Code Overview Server Side Game Code Client Side Game Code

Programming: System

Alphabetical Function List Renderer File System Collision & Ray Casting Low Level Audio Game Audio The Console Console Variable List Multiplayer Localisation Maths Library Memory Manager Model File Formats Texture Formats

Art: Overviews

Specifications Shaders Particle Systems Lens Flares Cipher console Cipher file types Tutorials Reference

Art: Tools

Shader Designer Particle Designer 3dsmax tools Model Conversion Font Generator

Cipher Engine
Game Development Search Engine
GameDev.net
You are not signed in - [sign in] [register]

Viewable Weapons

Overview

Author: Mattxl
Date Submitted: 2003-12-15 22:24:04

Source Code

void DrawWeapon(void)
{
	com_zeromem(&cg_weapon.weapon, sizeof(cg_weapon.weapon));
	cg_EulerToAxis(cg.viewangles, cg_weapon.weapon.axis[0], cg_weapon.weapon.axis[1], cg_weapon.weapon.axis[2]);
	vec3_Copy(cg.view.origin, cg_weapon.weapon.origin);
	cg_weapon.weapon.model = cg_weapon.model[cg_player.current_weapon];
	cg_weapon.weapon.type = ITEMTYPE_MODEL;
	cipher_r_AddItemToScene(&cg_weapon.weapon);
}


Description

This displays a weapon model on the screen. cg_weapon.weapon is an iteminfo_t structure. cg_weapon.model is an array of integers that have each model loaded. cg_player.current_weapon is an integer representing the current weapon that's out. This is based on the temple demo camera and player system. The weapon model may need to be moved around in the editing software until it's where you want it in the game. Sorry no collision or animation yet.

[Recent Contributions] [Recent Source Code]

User Contributed Comments

Rhuarc 23rd January, 2005 04:36
Thanks for the contribution, very easy to implement (and good for learning your way around cipher ^_^). I was able to implement it without a hitch. I'll have to play around with coding in a gun with effects and such :-).

-Rhuarc


Mattxl 23rd January, 2005 14:17
Glad it helped!

Matt




Register and Sign In to discuss this article