GSen
Житель форума
Дата регистрации : Aug 2009
Проживает : Омск
Сообщений : 336
Возраст: 32
Рейтинг
[кратко]
Пользователи:
2.6 (5 )
Нарушения:
-4.1 (? )
Сообщения:
0.0 (Метки )
Регистрация:
9.0
Помогите с Дисплейсером. Ошибка в классе
Скачал в инете код Displacer'a. С серверной частью всё скомпилилось нормально. На клиентсвой возникли траблы:
code:
..\cl_dll\hl\hl_weapons.cpp(69) : error C2146: syntax error : missing ';' before identifier 'g_Displace'
..\cl_dll\hlhl_weapons.cpp(69) : error C2501: 'Displace' : missing storage-class or type specifiers
..\cl_dll\hl\hl_weapons.cpp(69) : fatal error C1004: unexpected end of file found
Ругается на:
C++ Source Code:
Пробывал все варианты добавления в конце к дисплеёеру буквы "r", но не помогло.
Код Дисплейсера:
C++ Source Code:
4 * Code by Shambler Team.
5 * Op4-realm modify by Demiurge.
12 //=========================================================
14 // CODE PART FOR CLIENT SIDE
16 //======================
18 //======================
29 void EV_SpinDisplacer(event_args_t *args)//Original code idea by Xwider
31 if (EV_IsLocal(args->entindex))
33 gEngfuncs.pEventAPI->EV_WeaponAnimation(DISPLACER_SPINUP, 2);
34 cl_entity_t *view = gEngfuncs.GetViewModel();
39 gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x2000, view->index | 0x1000, args->iparam2, life, 0.5, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
40 gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x3000, view->index | 0x1000, args->iparam2, life, 0.5, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
41 gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x4000, view->index | 0x1000, args->iparam2, life, 0.5, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
45 if (args->bparam2 == 0)// sound mode
46 gEngfuncs.pEventAPI->EV_PlaySound(args->entindex, args->origin, CHAN_WEAPON, "weapons/displacer_spin.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
48 gEngfuncs.pEventAPI->EV_PlaySound(args->entindex, args->origin, CHAN_WEAPON, "weapons/displacer_spin2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
51 //======================
53 //======================
67 #define SF_DISP_MODE 128 //G-Cont. use for makes alternative displacer - debug features
80 class CDisplacer : public CBasePlayerWeapon
84 void Precache( void );
85 int iItemSlot( void ) { return 6; }
86 int GetItemInfo(ItemInfo *p);
87 int AddToPlayer( CBasePlayer *pPlayer );
90 void Holster( int skiplocal = 0 );
92 void PrimaryAttack( void );
93 void SecondaryAttack (void );
94 void EXPORT SpinUp( void );
95 // void EXPORT Spin( void );
96 void EXPORT Teleport( void );
97 void EXPORT Fire( void );
98 void WeaponIdle( void );
100 int m_iAttackMode;//no need save/restore this
102 unsigned short m_usDisplacer;
107 LINK_ENTITY_TO_CLASS( weapon_displacer, CDisplacer );
109 LINK_ENTITY_TO_CLASS( info_xen, CPointEntity );
110 LINK_ENTITY_TO_CLASS( info_earth, CPointEntity );
112 // displacer teleball code
114 class CDispBall : public CBaseEntity//Special for Ghoul [BB]
118 void Precache( void );
119 void Explode( TraceResult *pTrace );
120 void RemoveBall (void );
121 void EXPORT ExplodeTouch( CBaseEntity *pOther );
123 void EXPORT BallThink( void );
124 static CDispBall *CreateDispBall( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CDisplacer *pLauncher );
130 LINK_ENTITY_TO_CLASS( dispball, CDispBall );
132 CDispBall *CDispBall::CreateDispBall( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CDisplacer *pLauncher )
134 CDispBall *pDispBall = GetClassPtr( (CDispBall *)NULL );
136 UTIL_SetOrigin( pDispBall->pev, vecOrigin );
137 pDispBall->pev->angles = vecAngles;
139 pDispBall->SetTouch( CDispBall::ExplodeTouch );
140 pDispBall->pev->owner = pOwner->edict();
145 void CDispBall :: Spawn( void )
148 pev->movetype = MOVETYPE_FLY;
149 pev->solid = SOLID_BBOX;
151 SET_MODEL(ENT(pev), "sprites/exit1.spr" );
154 UTIL_SetSize(pev, Vector ( 0, 0, 0 ), Vector ( 0, 0, 0 ) );
155 UTIL_SetOrigin( pev, pev->origin );
156 pev->rendermode = kRenderTransAdd;
157 pev->renderamt = 255;
159 pev->classname = MAKE_STRING("dispball" );
161 SetThink( BallThink );
162 SetTouch( ExplodeTouch );
165 UTIL_MakeVectors( pev->angles );
166 pev->angles.x = -(pev->angles.x + 0);
167 pev->velocity = gpGlobals->v_forward * 500;
168 pev->nextthink = 0.5;
173 void CDispBall :: Precache( void )
175 PRECACHE_MODEL("sprites/exit1.spr" );
176 PRECACHE_MODEL ("sprites/plasma.spr" );
178 PRECACHE_SOUND("weapons/displacer_teleport.wav" );
179 m_iDispRing = PRECACHE_MODEL ("sprites/disp_ring.spr" );
182 void CDispBall :: BallThink( void )
189 for (int i = 0; i < 10; i++)
191 Vector vecDir = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
192 vecDir = vecDir.Normalize();
194 UTIL_TraceLine( pev->origin, pev->origin + vecDir * 1024, ignore_monsters, ENT(pev), &tr1 );
195 if (flDist > tr1.flFraction)
198 flDist = tr.flFraction;
202 if ( flDist == 1.0 ) return ;
204 pBeam = CBeam::BeamCreate("sprites/plasma.spr" ,200);
205 pBeam-><img src="images/smilies/pp2.gif" border="0" alt="" >ointEntInit( tr.vecEndPos, entindex() );
206 pBeam->SetStartPos( tr.vecEndPos );
207 pBeam->SetEndEntity( entindex() );
208 pBeam->SetColor( 90, 170, 16 );
209 pBeam->SetNoise( 65 );
210 pBeam->SetBrightness( 255 );
211 pBeam->SetWidth( 30 );
212 pBeam->SetScrollRate( 35 );
213 pBeam->LiveForTime( 1 );
215 pev->frame += 1; //animate teleball
217 pev->frame = fmod( pev->frame, 24 );
219 pev->nextthink = gpGlobals->time + 0.1;
222 void CDispBall::ExplodeTouch( CBaseEntity *pOther )
225 Vector vecSpot;// trace starts here!
227 pev->enemy = pOther->edict();
229 vecSpot = pev->origin - pev->velocity.Normalize() * 32;
230 UTIL_TraceLine( vecSpot, vecSpot + pev->velocity.Normalize() * 64, dont_ignore_monsters, ENT(pev), &tr );
235 void CDispBall::Explode( TraceResult *pTrace )
237 if (!LockRing)//for partially fix strange bug in HL engine (for full fix teleball MUST be moved to client side). g-cont
239 MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
240 WRITE_BYTE( TE_BEAMCYLINDER );
241 WRITE_COORD( pev->origin.x);
242 WRITE_COORD( pev->origin.y);
243 WRITE_COORD( pev->origin.z);
244 WRITE_COORD( pev->origin.x);
245 WRITE_COORD( pev->origin.y);
246 WRITE_COORD( pev->origin.z + 800);
247 WRITE_SHORT( m_iDispRing );
248 WRITE_BYTE( 0 ); // startframe
249 WRITE_BYTE( 10 ); // framerate
250 WRITE_BYTE( 3 ); // life
251 WRITE_BYTE( 20 ); // width
252 WRITE_BYTE( 0 ); // noise
253 WRITE_BYTE( 255 ); // r, g, b
254 WRITE_BYTE( 255 ); // r, g, b
255 WRITE_BYTE( 255 ); // r, g, b
256 WRITE_BYTE( 255 ); //brightness
257 WRITE_BYTE( 0 ); // speed
260 MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
261 WRITE_BYTE(TE_DLIGHT);
262 WRITE_COORD(pev->origin.x); // X
263 WRITE_COORD(pev->origin.y); // Y
264 WRITE_COORD(pev->origin.z); // Z
265 WRITE_BYTE( 8 ); // radius * 0.1
266 WRITE_BYTE( 243 ); // r
267 WRITE_BYTE( 231 ); // g
268 WRITE_BYTE( 16 ); // b
269 WRITE_BYTE( 20 ); // time * 10
270 WRITE_BYTE( 0 ); // decay * 0.1
273 MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
274 WRITE_BYTE(TE_DLIGHT);
275 WRITE_COORD(pev->origin.x); // X
276 WRITE_COORD(pev->origin.y); // Y
277 WRITE_COORD(pev->origin.z); // Z
278 WRITE_BYTE( 4 ); // radius * 0.1
279 WRITE_BYTE( 240 ); // r
280 WRITE_BYTE( 140 ); // g
281 WRITE_BYTE( 12 ); // b
282 WRITE_BYTE( 20 ); // time * 10
283 WRITE_BYTE( 0 ); // decay * 0.1
288 pev->velocity = g_vecZero;
290 SetThink (RemoveBall);
291 pev->nextthink = gpGlobals->time + 0.6;
295 void CDispBall::RemoveBall( void )
297 EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/displacer_teleport.wav" , 0.9, ATTN_NORM);
298 pev->effects |= EF_NODRAW;
302 pevOwner = VARS( pev->owner );
308 ::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 200, CLASS_NONE, DMG_ENERGYBEAM );
311 //-----------------------
313 //-----------------------
315 void CDisplacer::Spawn( )
318 m_iId = WEAPON_DISPLACER;
319 SET_MODEL(ENT(pev), "models/w_displacer.mdl" );
322 FallInit();// get ready to fall down.
325 int CDisplacer::AddToPlayer( CBasePlayer *pPlayer )
327 if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
329 MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
337 BOOL CDisplacer::Deploy( void )
339 return DefaultDeploy( "models/v_displacer.mdl" , "models/p_displacer.mdl" , DISPLACER_DRAW, "gauss" );
342 void CDisplacer::Holster( int skiplocal )
344 m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.5;
345 SendWeaponAnim( DISPLACER_HOLSTER );
348 int CDisplacer::GetItemInfo(ItemInfo *p)
350 p->pszName = STRING(pev->classname);
351 p->pszAmmo1 = "uranium" ;
352 p->iMaxAmmo1 = URANIUM_MAX_CARRY;
355 p->iMaxClip = WEAPON_NOCLIP;
358 p->iId = m_iId = WEAPON_DISPLACER;
365 void CDisplacer::Precache( void )
367 PRECACHE_MODEL("models/w_displacer.mdl" );
368 PRECACHE_MODEL("models/v_displacer.mdl" );
369 PRECACHE_MODEL("models/p_displacer.mdl" );
371 PRECACHE_SOUND("weapons/displacer_fire.wav" );
372 PRECACHE_SOUND ("buttons/button10.wav" );
373 PRECACHE_SOUND ("weapons/displacer_self.wav" );
375 UTIL_PrecacheOther( "dispball" );
377 m_iBeam = PRECACHE_MODEL("sprites/plasma.spr" );
378 m_usDisplacer = PRECACHE_EVENT( 1, "events/displacer.sc" );
381 void CDisplacer::SpinUp ( void )
386 if (!m_iAttackMode) SetThink (CDisplacer::Fire);
387 else SetThink (CDisplacer::Teleport);
390 PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDisplacer, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, m_iBeam, 0, m_iAttackMode);
392 pev->nextthink = gpGlobals->time + 1.1;
393 m_flTimeWeaponIdle = gpGlobals->time + 1.15;
397 void CDisplacer::PrimaryAttack( void )
399 if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 20)//Check for ammo
401 EMIT_SOUND( edict(), CHAN_BODY, "buttons/button10.wav" , 1, ATTN_NORM );
402 m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
406 m_iAttackMode = FALSE; //We set attack mode in first mode
408 SetThink (CDisplacer::SpinUp);
410 m_flNextPrimaryAttack = gpGlobals->time + 4.0;
411 m_flTimeWeaponIdle = gpGlobals->time + 1.5;
412 pev->nextthink = gpGlobals->time + 0.1;
415 void CDisplacer::SecondaryAttack ( void )
417 if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 60)
419 EMIT_SOUND( edict(), CHAN_BODY, "buttons/button10.wav" , 1, ATTN_NORM );
420 m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
424 if (m_iAttackMode) return ;
425 m_iAttackMode = TRUE; //We set attack mode in second mode
427 SetThink (CDisplacer::SpinUp);
429 m_flNextSecondaryAttack = gpGlobals->time + 4.0;
430 m_flTimeWeaponIdle = gpGlobals->time + 1.5;
431 pev->nextthink = gpGlobals->time + 0.1;
434 void CDisplacer::Fire (void )
436 SendWeaponAnim( DISPLACER_FIRE );
437 m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
439 Vector vecSrc = m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 2 + gpGlobals->v_up * -5;
440 m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 20;
442 EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/displacer_fire.wav" , 0.9, ATTN_NORM );
443 CDispBall *pDispBall = CDispBall::CreateDispBall( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this );
447 void CDisplacer:: Teleport ( void )
449 m_iPlace = !m_iPlace;
451 CBaseEntity *pSpot = NULL;
452 m_iAttackMode = FALSE;//reset firemode
454 if ( m_iPlace ) //Xen and earth target
455 pSpot = UTIL_FindEntityByClassname( pSpot, "info_xen" );
457 pSpot = UTIL_FindEntityByClassname( pSpot, "info_earth" );
461 UTIL_ScreenFade( m_pPlayer, Vector(0, 200, 0), 0.5, 0.5, 255, FFADE_IN );
463 m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 60;
464 Vector tmp = pSpot->pev->origin;
465 tmp.z -= m_pPlayer->pev->mins.z;
467 UTIL_SetOrigin( m_pPlayer->pev, tmp );
469 m_pPlayer->pev->angles = pSpot->pev->angles;
470 m_pPlayer->pev->velocity = m_pPlayer->pev->basevelocity = g_vecZero;
472 EMIT_SOUND( edict(), CHAN_BODY, "weapons/displacer_self.wav" , 1, ATTN_NORM );
473 SendWeaponAnim( DISPLACER_FIRE );
477 SendWeaponAnim( DISPLACER_SPINUP );
478 EMIT_SOUND( edict(), CHAN_BODY, "buttons/button10.wav" , 1, ATTN_NORM );
479 m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.3;
482 m_flNextSecondaryAttack = gpGlobals->time + 2.0;
483 m_flTimeWeaponIdle = gpGlobals->time + 1.0;
486 void CDisplacer::WeaponIdle( void )
490 m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
492 if ( m_flTimeWeaponIdle > gpGlobals->time )
495 float flRand = RANDOM_FLOAT(0,1);
499 iAnim = DISPLACER_IDLE1;
500 m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT(10,15);
504 iAnim = DISPLACER_IDLE2;
505 m_flTimeWeaponIdle = gpGlobals->time + 3;
508 SendWeaponAnim( iAnim );
За это сообщение GSen получил предупреждение за оверквотинг
Сообщить модератору | IP: Записан
Сообщение: 60205