Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
28.05.2001, 18:01
Executioner



hi

wollte ne waffe machn ... (M1891)

schaut selber mal

mingw32 compile fenster:

gcc -march=pentium -O2 -w -I../engine -I../common -I../pm_shared -c m1891.cpp -o
m1891.o
m1891.cpp:141: syntax error before `::'
m1891.cpp:216: syntax error before `::'
m1891.cpp: In function `void ammo_m1891(struct entvars_t *)':
m1891.cpp:276: redefinition of `void ammo_m1891(struct entvars_t *)'
m1891.cpp:275: `void ammo_m1891(struct entvars_t *)' previously defined here
C:\PROGRA~1\MINGW32\BIN\MAKE.EXE: *** [m1891.o] Error 1
1 Datei(en) kopiert

hier mal der ganze quellcode:

/***
*
* Copyright (c) 1999, 2000 Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/

#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "soundent.h"
#include "gamerules.h"

enum mp5_e
{
MP5_LONGIDLE = 0,
MP5_IDLE1,
MP5_LAUNCH,
MP5_RELOAD,
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
};

class CM1891 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int iItemSlot( void ) { return 3; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );

void PrimaryAttack( void );
void SecondaryAttack( void );
int SecondaryAmmoIndex( void );
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
float m_flNextAnimTime;
int m_iShell;
private:
unsigned short m_usM1891;
};
LINK_ENTITY_TO_CLASS( weapon_M1891, CM1891 );
LINK_ENTITY_TO_CLASS( weapon_9mmAR, CM1891 );

//=========================================================
//=========================================================
int CM1891::SecondaryAmmoIndex( void )
{
return m_iSecondaryAmmoType;
}

void CM1891::Spawn( )
{
pev->classname = MAKE_STRING("weapon_9mmAR"); // hack to allow for old names
Precache( );
SET_MODEL(ENT(pev), "models/w_9mmAR.mdl");
m_iId = WEAPON_M1891;

m_iDefaultAmmo = M1891_DEFAULT_GIVE;

FallInit();// get ready to fall down.
}

void CM1891::Precache( void )
{
PRECACHE_MODEL("models/v_9mmAR.mdl");
PRECACHE_MODEL("models/w_9mmAR.mdl");
PRECACHE_MODEL("models/p_9mmAR.mdl");

m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shellTE_MODEL

PRECACHE_MODEL("models/grenade.mdl"); // grenade

PRECACHE_MODEL("models/w_9mmARclip.mdl");
PRECACHE_SOUND("items/ammopickup1.wav");

PRECACHE_SOUND("items/clipinsert1.wav");
PRECACHE_SOUND("items/cliprelease1.wav");
// PRECACHE_SOUND("items/guncock1.wav");

PRECACHE_SOUND ("weapons/m1891-fire1.wav");// H to the K
PRECACHE_SOUND ("weapons/m1891-fire2.wav");// H to the K
PRECACHE_SOUND ("weapons/m1891-fire3.wav");// H to the K

PRECACHE_SOUND( "weapons/glauncher.wav" );
PRECACHE_SOUND( "weapons/glauncher2.wav" );

PRECACHE_SOUND ("weapons/357_cock1.wav");

m_usM1891 = PRECACHE_EVENT( 1, "events/mp5.sc" );
}

int CM1891::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "M1891";
p->iMaxAmmo1 = M1891_MAX_CARRY;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = M1891_MAX_CLIP;
p->iSlot = 2;
p->iPosition = 3;
p->iFlags = 0;
p->iId = m_iId = WEAPON_M1891;
p->iWeight = M1891_WEIGHT;

return 1;
}

int CM1891::AddToPlayer( CBasePlayer *pPlayer )
{
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return FALSE;
}

BOOL CMP5::Deploy( )
{
return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
}

void CM1891::PrimaryAttack()
{

Vector vecFeuer = pev->origin + gpGlobals->v_forward * 2;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecFeuer ); WRITE_BYTE(TE_DLIGHT);
WRITE_COORD(vecFeuer.x);
WRITE_COORD(vecFeuer.y);
WRITE_COORD(vecFeuer.z);
WRITE_BYTE( 16 ); // dies ist der Radius in dem man es sieht
// farbwerte nach RGB
WRITE_BYTE( 255 ); //rot
WRITE_BYTE( 180 ); //grün
WRITE_BYTE( 96 ); //blau
WRITE_BYTE( 0.2 ); //wie lange es leuchtet
WRITE_BYTE( 0.1 ); //wie schnell es ausgeblendet wird
MESSAGE_END( );

// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
PlayEmptySound( );
m_flNextPrimaryAttack = gpGlobals->time + 0.15;
return;
}

if (m_iClip <= 0)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->time + 0.15;
return;
}

PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usM1891 );

m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;

m_iClip--;

// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );

Vector vecSrc = m_pPlayer->GetGunPosition( );
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );

if ( g_pGameRules->IsDeathmatch() )
{
// optimized multiplayer. Widened to make it easier to hit a moving player
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_6DEGREES, 8192, BULLET_PLAYER_MP5, 2 );
}
else
{
// single player spread
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_MP5, 2 );
}

if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);

m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.95;
if (m_flNextPrimaryAttack < gpGlobals->time)
m_flNextPrimaryAttack = gpGlobals->time + 0.95;

m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 );
}

void CMP5::Reload( void )
{
DefaultReload( M1891_MAX_CLIP, MP5_RELOAD, 1.5 );
}

void CM1891::WeaponIdle( void )
{
ResetEmptySound( );

m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );

if (m_flTimeWeaponIdle > gpGlobals->time)
return;

int iAnim;
switch ( RANDOM_LONG( 0, 1 ) )
{
case 0:
iAnim = MP5_LONGIDLE;
break;

default:
case 1:
iAnim = MP5_IDLE1;
break;
}

SendWeaponAnim( iAnim );

m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 );// how long till we do this again.
}

class CM1891AmmoClip : public CBasePlayerAmmo
{
void Spawn( void )
{
Precache( );
SET_MODEL(ENT(pev), "models/w_9mmARclip.mdl");
CBasePlayerAmmo::Spawn( );
}
void Precache( void )
{
PRECACHE_MODEL ("models/w_9mmARclip.mdl");
PRECACHE_SOUND("items/ammopickup1.wav");
}
BOOL AddAmmo( CBaseEntity *pOther )
{
int bResult = (pOther->GiveAmmo( AMMO_M1891CLIP_GIVE, "M1891", M1891_MAX_CARRY) != -1);
if (bResult)
{
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/ammopickup1.wav", 1, ATTN_NORM);
}
return bResult;
}
};
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );

hab die modelz der waffe noch nich umgeändert, da ich keine neuen hab!

was is der fehler, ich versuche es schon seit 3 tagen zu fixen! ohne erfolg

help me!

thx

--

www.virus-mod.de.vu <- die neue Mod, zur Vorgeschichte von Half-Life (*lol* steht noch nich in der Story auf der Hp ... is eben noch nich formuliert)

zum Seitenanfang zum Seitenende Profil || Suche
001
28.05.2001, 19:24
Killing Me Softly



Fehler No.1+2
BOOL CMP5::Deploy( )
void CMP5::Reload( void )

soll warscheinlich:
BOOL CM1891::Deploy( )
void CM1891::Reload( void )
heißen.

Fehler No.3
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );

ein LINK_ENTITY_TO_CLASS ist mehr als genug :)

--

Der Horizont vieler Menschen ist ein Kreis mit Radius Null - und das nennen sie ihren Standpunkt.

zum Seitenanfang zum Seitenende Profil || Suche
002
28.05.2001, 20:27
Another1



Ich will dich ja nicht für dumm erklären, aber 2x exakt das selbe
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );
LINK_ENTITY_TO_CLASS( ammo_m1891, CM1891AmmoClip );

fällt doch wohl jedem auf .. oder?

naja mehr muss ich wohl nicht sagen *G*

// edit //

ooops, jetzt hab ich das von killingmesoftly gedoppelt ... *g*

--

Another1

...relaxing..atm =)
... und Schweiz suckt!

zum Seitenanfang zum Seitenende Profil || Suche
003
28.05.2001, 20:31
Executioner



hi

hehe jo ich habs mir nochma angeschaut und es is mir aufgefallen!

ich hab alle fehler alleine beseitigt! ohne das ich nur ein bisschen ahnung von c++ oder so hab *freu* (*g*) (muss mich auch mal loben *ggg*)

so nun das nächste prob:

hab den impulse101 cheat in der player.cpp umgeändert, bekomme aba die waffe nich!

hab auch die weapon_mp5.txt in mein sprite verzeichnis gehaun und in weapon_m1891.txt umbenannt <<< muss ich in der file noch was ändern?, oder wie geht das?

(ps: ich hatte wirklich keine compile fehler)

thx

--

www.virus-mod.de.vu <- die neue Mod, zur Vorgeschichte von Half-Life (*lol* steht noch nich in der Story auf der Hp ... is eben noch nich formuliert)

zum Seitenanfang zum Seitenende Profil || Suche