CRLF to LF, nothing to see here

This commit is contained in:
Alibek Omarov 2024-04-04 03:16:19 +03:00
parent b44b52a093
commit 2e3a0c6ba2
20 changed files with 10683 additions and 10683 deletions

View File

@ -1,141 +1,141 @@
/***
*
* (C) 2008 Vyacheslav Dzhura
*
****/
//
// mode.cpp
//
// implementation of CHudModeIcon class
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_AlienCrosshair, AlienState)
// gHUD.m_AlienCrosshair.m_iState
/*
class CHudAlienCrosshair: public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
void Reset( void );
int MsgFunc_AlienState(const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hCrosshair[4];
wrect_t *m_prcCrosshair[4];
int m_iState;
};
*/
int CHudAlienCrosshair::Init(void)
{
m_iState = 0;
HOOK_MESSAGE(AlienState);
m_iFlags |= HUD_ACTIVE;
m_iFlags |= HUD_ALIEN;
gHUD.AddHudElem(this);
return 1;
};
void CHudAlienCrosshair::Reset(void)
{
m_iState = 0;
}
int CHudAlienCrosshair::VidInit(void)
{
int sCenter = gHUD.GetSpriteIndex( "islave_center" );
int sCharged = gHUD.GetSpriteIndex( "islave_charged" );
int sInner = gHUD.GetSpriteIndex( "islave_inner" );
int sOuter = gHUD.GetSpriteIndex( "islave_outer" );
if ( (sCenter == -1) || (sCharged == -1) || (sInner == -1) || (sOuter == -1) )
return 0;
m_hCrosshair[0] = gHUD.GetSprite(sOuter);
m_hCrosshair[1] = gHUD.GetSprite(sInner);
m_hCrosshair[2] = gHUD.GetSprite(sCenter);
m_hCrosshair[3] = gHUD.GetSprite(sCharged);
m_prcCrosshair[0] = &gHUD.GetSpriteRect( sOuter );
m_prcCrosshair[1] = &gHUD.GetSpriteRect( sInner );
m_prcCrosshair[2] = &gHUD.GetSpriteRect( sCenter );
m_prcCrosshair[3] = &gHUD.GetSpriteRect( sCharged );
return 1;
};
int CHudAlienCrosshair:: MsgFunc_AlienState(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_iState = READ_BYTE();
return 1;
}
int CHudAlienCrosshair::Draw(float flTime)
{
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_ALL ) )
return 1;
if ( !gHUD.m_bAlienMode )
return 1;
if (m_iState > 3)
m_iState = 3;
int chR, chG, chB;
chR = chG = chB = 0;
for (int i = 0; i < 4; i++ )
{
if ( i > m_iState )
break;
m_hActiveSprite = m_hCrosshair[i];
m_prcActiveRect = m_prcCrosshair[i];
if ( i < 3 )
{ // 180, 255, 96
chR = 180;
chG = 255;
chB = 96;
} else
{
chR = 255;
chG = 0;
chB = 0;
}
if (( i == 2 ) && ( m_iState == 3 ))
continue;
int x,y, SWidth, SHeight;
SWidth = m_prcActiveRect->right - m_prcActiveRect->left;
SHeight = m_prcActiveRect->bottom - m_prcActiveRect->top; // SPR_Height(m_hActiveSprite,0);
x = ScreenWidth / 2 - ( SWidth / 2 );
y = ScreenHeight / 2 - ( SHeight / 2 );
SPR_Set(m_hActiveSprite, chR, chG, chB );
SPR_DrawAdditive(0, x, y, m_prcActiveRect);
}
//char szMes[20];
//sprintf(szMes,"%d %d/%d", m_fMode, SWidth, SHeight);
//gHUD.DrawHudString( 5, 5, ScreenWidth, szMes, r, g, b);
return 1;
/***
*
* (C) 2008 Vyacheslav Dzhura
*
****/
//
// mode.cpp
//
// implementation of CHudModeIcon class
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_AlienCrosshair, AlienState)
// gHUD.m_AlienCrosshair.m_iState
/*
class CHudAlienCrosshair: public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
void Reset( void );
int MsgFunc_AlienState(const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hCrosshair[4];
wrect_t *m_prcCrosshair[4];
int m_iState;
};
*/
int CHudAlienCrosshair::Init(void)
{
m_iState = 0;
HOOK_MESSAGE(AlienState);
m_iFlags |= HUD_ACTIVE;
m_iFlags |= HUD_ALIEN;
gHUD.AddHudElem(this);
return 1;
};
void CHudAlienCrosshair::Reset(void)
{
m_iState = 0;
}
int CHudAlienCrosshair::VidInit(void)
{
int sCenter = gHUD.GetSpriteIndex( "islave_center" );
int sCharged = gHUD.GetSpriteIndex( "islave_charged" );
int sInner = gHUD.GetSpriteIndex( "islave_inner" );
int sOuter = gHUD.GetSpriteIndex( "islave_outer" );
if ( (sCenter == -1) || (sCharged == -1) || (sInner == -1) || (sOuter == -1) )
return 0;
m_hCrosshair[0] = gHUD.GetSprite(sOuter);
m_hCrosshair[1] = gHUD.GetSprite(sInner);
m_hCrosshair[2] = gHUD.GetSprite(sCenter);
m_hCrosshair[3] = gHUD.GetSprite(sCharged);
m_prcCrosshair[0] = &gHUD.GetSpriteRect( sOuter );
m_prcCrosshair[1] = &gHUD.GetSpriteRect( sInner );
m_prcCrosshair[2] = &gHUD.GetSpriteRect( sCenter );
m_prcCrosshair[3] = &gHUD.GetSpriteRect( sCharged );
return 1;
};
int CHudAlienCrosshair:: MsgFunc_AlienState(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_iState = READ_BYTE();
return 1;
}
int CHudAlienCrosshair::Draw(float flTime)
{
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_ALL ) )
return 1;
if ( !gHUD.m_bAlienMode )
return 1;
if (m_iState > 3)
m_iState = 3;
int chR, chG, chB;
chR = chG = chB = 0;
for (int i = 0; i < 4; i++ )
{
if ( i > m_iState )
break;
m_hActiveSprite = m_hCrosshair[i];
m_prcActiveRect = m_prcCrosshair[i];
if ( i < 3 )
{ // 180, 255, 96
chR = 180;
chG = 255;
chB = 96;
} else
{
chR = 255;
chG = 0;
chB = 0;
}
if (( i == 2 ) && ( m_iState == 3 ))
continue;
int x,y, SWidth, SHeight;
SWidth = m_prcActiveRect->right - m_prcActiveRect->left;
SHeight = m_prcActiveRect->bottom - m_prcActiveRect->top; // SPR_Height(m_hActiveSprite,0);
x = ScreenWidth / 2 - ( SWidth / 2 );
y = ScreenHeight / 2 - ( SHeight / 2 );
SPR_Set(m_hActiveSprite, chR, chG, chB );
SPR_DrawAdditive(0, x, y, m_prcActiveRect);
}
//char szMes[20];
//sprintf(szMes,"%d %d/%d", m_fMode, SWidth, SHeight);
//gHUD.DrawHudString( 5, 5, ScreenWidth, szMes, r, g, b);
return 1;
}

View File

@ -1,117 +1,117 @@
/***
*
* Copyright (c) 1996-2002, 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.
*
****/
//
// mode.cpp
//
// implementation of CHudModeIcon class
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_ModeIcon, ChangeMode)
int CHudModeIcon::Init(void)
{
m_fMode = 0;
HOOK_MESSAGE(ChangeMode);
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
return 1;
};
void CHudModeIcon::Reset(void)
{
m_fMode = 0;
}
int CHudModeIcon::VidInit(void)
{
int HUD_mode_stand = gHUD.GetSpriteIndex( "mode_stand" );
int HUD_mode_run = gHUD.GetSpriteIndex( "mode_run" );
int HUD_mode_crouch = gHUD.GetSpriteIndex( "mode_crouch" );
int HUD_mode_jump = gHUD.GetSpriteIndex( "mode_jump" );
m_hSpriteStand = m_hSpriteRun = m_hSpriteCrouch = m_hSpriteJump = 0;
m_hSpriteStand = gHUD.GetSprite(HUD_mode_stand);
m_hSpriteRun = gHUD.GetSprite(HUD_mode_run);
m_hSpriteCrouch = gHUD.GetSprite(HUD_mode_crouch);
m_hSpriteJump = gHUD.GetSprite(HUD_mode_jump);
m_prcStand = &gHUD.GetSpriteRect( HUD_mode_stand );
m_prcRun = &gHUD.GetSpriteRect( HUD_mode_run );
m_prcCrouch = &gHUD.GetSpriteRect( HUD_mode_crouch );
m_prcJump = &gHUD.GetSpriteRect( HUD_mode_jump );
return 1;
};
int CHudModeIcon:: MsgFunc_ChangeMode(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_fMode = READ_BYTE();
return 1;
}
int CHudModeIcon::Draw(float flTime)
{
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_ALL ) )
return 1;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;
switch(m_fMode){
case 0: m_hActiveSprite = m_hSpriteStand;
m_prcActiveRect = m_prcStand;
break;
case 1: m_hActiveSprite = m_hSpriteRun;
m_prcActiveRect = m_prcRun;
break;
case 2: m_hActiveSprite = m_hSpriteCrouch;
m_prcActiveRect = m_prcCrouch;
break;
case 3: m_hActiveSprite = m_hSpriteJump;
m_prcActiveRect = m_prcJump;
break;
}
int r,g,b, x,y, SWidth, SHeight;
SWidth = m_prcActiveRect->right - m_prcActiveRect->left;// SPR_Width(m_hActiveSprite,0);
SHeight = SPR_Height(m_hActiveSprite,0);
x = ScreenWidth - SWidth - SWidth/2;
y = 64;
UnpackRGB(r,g,b, gHUD.uColor);
SPR_Set(m_hActiveSprite, r, g, b );
SPR_DrawAdditive(0, x, y, m_prcActiveRect);
//char szMes[20];
//sprintf(szMes,"%d %d/%d", m_fMode, SWidth, SHeight);
//gHUD.DrawHudString( 5, 5, ScreenWidth, szMes, r, g, b);
return 1;
/***
*
* Copyright (c) 1996-2002, 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.
*
****/
//
// mode.cpp
//
// implementation of CHudModeIcon class
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_ModeIcon, ChangeMode)
int CHudModeIcon::Init(void)
{
m_fMode = 0;
HOOK_MESSAGE(ChangeMode);
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
return 1;
};
void CHudModeIcon::Reset(void)
{
m_fMode = 0;
}
int CHudModeIcon::VidInit(void)
{
int HUD_mode_stand = gHUD.GetSpriteIndex( "mode_stand" );
int HUD_mode_run = gHUD.GetSpriteIndex( "mode_run" );
int HUD_mode_crouch = gHUD.GetSpriteIndex( "mode_crouch" );
int HUD_mode_jump = gHUD.GetSpriteIndex( "mode_jump" );
m_hSpriteStand = m_hSpriteRun = m_hSpriteCrouch = m_hSpriteJump = 0;
m_hSpriteStand = gHUD.GetSprite(HUD_mode_stand);
m_hSpriteRun = gHUD.GetSprite(HUD_mode_run);
m_hSpriteCrouch = gHUD.GetSprite(HUD_mode_crouch);
m_hSpriteJump = gHUD.GetSprite(HUD_mode_jump);
m_prcStand = &gHUD.GetSpriteRect( HUD_mode_stand );
m_prcRun = &gHUD.GetSpriteRect( HUD_mode_run );
m_prcCrouch = &gHUD.GetSpriteRect( HUD_mode_crouch );
m_prcJump = &gHUD.GetSpriteRect( HUD_mode_jump );
return 1;
};
int CHudModeIcon:: MsgFunc_ChangeMode(const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_fMode = READ_BYTE();
return 1;
}
int CHudModeIcon::Draw(float flTime)
{
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_ALL ) )
return 1;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;
switch(m_fMode){
case 0: m_hActiveSprite = m_hSpriteStand;
m_prcActiveRect = m_prcStand;
break;
case 1: m_hActiveSprite = m_hSpriteRun;
m_prcActiveRect = m_prcRun;
break;
case 2: m_hActiveSprite = m_hSpriteCrouch;
m_prcActiveRect = m_prcCrouch;
break;
case 3: m_hActiveSprite = m_hSpriteJump;
m_prcActiveRect = m_prcJump;
break;
}
int r,g,b, x,y, SWidth, SHeight;
SWidth = m_prcActiveRect->right - m_prcActiveRect->left;// SPR_Width(m_hActiveSprite,0);
SHeight = SPR_Height(m_hActiveSprite,0);
x = ScreenWidth - SWidth - SWidth/2;
y = 64;
UnpackRGB(r,g,b, gHUD.uColor);
SPR_Set(m_hActiveSprite, r, g, b );
SPR_DrawAdditive(0, x, y, m_prcActiveRect);
//char szMes[20];
//sprintf(szMes,"%d %d/%d", m_fMode, SWidth, SHeight);
//gHUD.DrawHudString( 5, 5, ScreenWidth, szMes, r, g, b);
return 1;
}

View File

@ -1,144 +1,144 @@
//=========== (C) Copyright 2008 Vyacheslav Dzhura. All rights reserved. ===========
//
// Purpose: Notification which is displayed for players which have connected
// to Decay game server, after there are two human players, also
// displays count down before disconnecting player
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include "vgui_int.h"
#include "VGUI_Font.h"
#include "VGUI_ScrollPanel.h"
#include "VGUI_TextImage.h"
#include "VGUI_loadtga.h"
#include "hud.h"
#include "cl_util.h"
#include "vgui_TeamFortressViewport.h"
// Windows' Dimensions
#define SNW_TITLE_X XRES(40)
#define SNW_TITLE_Y YRES(32)
#define SNW_TOPLEFT_BUTTON_X XRES(251)//was 245
#define SNW_TOPLEFT_BUTTON_Y YRES(400)
#define SNW_BUTTON_SIZE_X XRES(100)
#define SNW_BUTTON_SIZE_Y YRES(24)
#define SNW_BUTTON_SPACER_Y YRES(8)
#define SNW_WINDOW_X XRES(150)
#define SNW_WINDOW_Y YRES(150)
#define SNW_WINDOW_SIZE_X XRES(350)
#define SNW_WINDOW_SIZE_Y YRES(220)
#define SNW_WINDOW_TITLE_X XRES(16)
#define SNW_WINDOW_TITLE_Y YRES(16)
#define SNW_WINDOW_TEXT_X XRES(80) // was 16
#define SNW_WINDOW_TEXT_Y YRES(32)
#define SNW_WINDOW_TEXT_SIZE_Y YRES(168)
#define SNW_WINDOW_INFO_X XRES(16)
#define SNW_WINDOW_INFO_Y YRES(234)
// Creation
CSparePlayerWindow::CSparePlayerWindow(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hDecayFont = pSchemes->getSchemeHandle( "Briefing Text" ); //Decay
// get the Font used for the Titles
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
int r, g, b, a;
// Create the Info Window itself
m_pWindow = new CTransparentPanel( 255, SNW_WINDOW_X, SNW_WINDOW_Y, SNW_WINDOW_SIZE_X, SNW_WINDOW_SIZE_Y );
m_pWindow->setParent( this );
m_pWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Title label
m_pTitle = new Label( "", SNW_WINDOW_TEXT_X, YRES(5) );
m_pTitle->setParent( m_pWindow );
m_pTitle->setFont( pTitleFont );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pTitle->setBgColor( r, g, b, a );
m_pTitle->setContentAlignment( vgui::Label::a_west );
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Decay_SparePlayerTitle"));
// Create the Briefing panel
m_pMemo = new TextPanel("", SNW_WINDOW_TEXT_X, SNW_WINDOW_TEXT_Y, YRES(230), SNW_WINDOW_TEXT_SIZE_Y );
m_pMemo->setParent( m_pWindow );
m_pMemo->setFont( pSchemes->getFont(hDecayFont) );
pSchemes->getFgColor( hDecayFont, r, g, b, a );
m_pMemo->setFgColor( r, g, b, a );
pSchemes->getBgColor( hDecayFont, r, g, b, a );
m_pMemo->setBgColor( r, g, b, a );
m_pMemo->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Decay_SparePlayerMessage"));
// Create the Cancel button
//m_pCancelButton = new CommandButton( "", SNW_TOPLEFT_BUTTON_X, SNW_TOPLEFT_BUTTON_Y, SNW_BUTTON_SIZE_X, SNW_BUTTON_SIZE_Y, true);
//m_pCancelButton->setParent( this );
//m_pCancelButton->setText( gHUD.m_TextMessage.BufferedLocaliseTextString(" CLOSE") );
//m_pCancelButton->setVisible( true );
//m_pCancelButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
m_pImage = new CImageLabel( "gina", 0, 0, 128, 256 ); // gfx/vgui/640_gina.tga
//m_pImage->setText(25, "this is a test!!!");
m_pImage->setParent( m_pWindow );
m_pImage->setVisible( true );
Initialize();
}
//-----------------------------------------------------------------------------
// Purpose: Called each time a new level is started.
//-----------------------------------------------------------------------------
void CSparePlayerWindow::Initialize( void )
{
//m_pScrollPanel->setScrollValue( 0, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Called everytime the Team Menu is displayed
//-----------------------------------------------------------------------------
void CSparePlayerWindow::Update( void )
{
// TODO: maybe update "Disconnect in ..." label here?
//m_pMemo->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
//m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
int iYPos = SNW_TOPLEFT_BUTTON_Y;
// Move the AutoAssign button into place
//m_pCancelButton->setPos( SNW_TOPLEFT_BUTTON_X, iYPos );
//m_pScrollPanel->validate();
m_pImage->setBounds( XRES(8), YRES(16), 128, 256 );
}
//=====================================
// Key inputs
bool CSparePlayerWindow::SlotInput( int iSlot )
{
if ( iSlot == 1)
{
//m_pCancelButton->fireActionSignal();
return true;
}
return false;
}
//======================================
// Update the Team menu before opening it
void CSparePlayerWindow::Open( void )
{
Update();
CMenuPanel::Open();
}
//=========== (C) Copyright 2008 Vyacheslav Dzhura. All rights reserved. ===========
//
// Purpose: Notification which is displayed for players which have connected
// to Decay game server, after there are two human players, also
// displays count down before disconnecting player
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include "vgui_int.h"
#include "VGUI_Font.h"
#include "VGUI_ScrollPanel.h"
#include "VGUI_TextImage.h"
#include "VGUI_loadtga.h"
#include "hud.h"
#include "cl_util.h"
#include "vgui_TeamFortressViewport.h"
// Windows' Dimensions
#define SNW_TITLE_X XRES(40)
#define SNW_TITLE_Y YRES(32)
#define SNW_TOPLEFT_BUTTON_X XRES(251)//was 245
#define SNW_TOPLEFT_BUTTON_Y YRES(400)
#define SNW_BUTTON_SIZE_X XRES(100)
#define SNW_BUTTON_SIZE_Y YRES(24)
#define SNW_BUTTON_SPACER_Y YRES(8)
#define SNW_WINDOW_X XRES(150)
#define SNW_WINDOW_Y YRES(150)
#define SNW_WINDOW_SIZE_X XRES(350)
#define SNW_WINDOW_SIZE_Y YRES(220)
#define SNW_WINDOW_TITLE_X XRES(16)
#define SNW_WINDOW_TITLE_Y YRES(16)
#define SNW_WINDOW_TEXT_X XRES(80) // was 16
#define SNW_WINDOW_TEXT_Y YRES(32)
#define SNW_WINDOW_TEXT_SIZE_Y YRES(168)
#define SNW_WINDOW_INFO_X XRES(16)
#define SNW_WINDOW_INFO_Y YRES(234)
// Creation
CSparePlayerWindow::CSparePlayerWindow(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hDecayFont = pSchemes->getSchemeHandle( "Briefing Text" ); //Decay
// get the Font used for the Titles
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
int r, g, b, a;
// Create the Info Window itself
m_pWindow = new CTransparentPanel( 255, SNW_WINDOW_X, SNW_WINDOW_Y, SNW_WINDOW_SIZE_X, SNW_WINDOW_SIZE_Y );
m_pWindow->setParent( this );
m_pWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Title label
m_pTitle = new Label( "", SNW_WINDOW_TEXT_X, YRES(5) );
m_pTitle->setParent( m_pWindow );
m_pTitle->setFont( pTitleFont );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pTitle->setBgColor( r, g, b, a );
m_pTitle->setContentAlignment( vgui::Label::a_west );
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Decay_SparePlayerTitle"));
// Create the Briefing panel
m_pMemo = new TextPanel("", SNW_WINDOW_TEXT_X, SNW_WINDOW_TEXT_Y, YRES(230), SNW_WINDOW_TEXT_SIZE_Y );
m_pMemo->setParent( m_pWindow );
m_pMemo->setFont( pSchemes->getFont(hDecayFont) );
pSchemes->getFgColor( hDecayFont, r, g, b, a );
m_pMemo->setFgColor( r, g, b, a );
pSchemes->getBgColor( hDecayFont, r, g, b, a );
m_pMemo->setBgColor( r, g, b, a );
m_pMemo->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Decay_SparePlayerMessage"));
// Create the Cancel button
//m_pCancelButton = new CommandButton( "", SNW_TOPLEFT_BUTTON_X, SNW_TOPLEFT_BUTTON_Y, SNW_BUTTON_SIZE_X, SNW_BUTTON_SIZE_Y, true);
//m_pCancelButton->setParent( this );
//m_pCancelButton->setText( gHUD.m_TextMessage.BufferedLocaliseTextString(" CLOSE") );
//m_pCancelButton->setVisible( true );
//m_pCancelButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
m_pImage = new CImageLabel( "gina", 0, 0, 128, 256 ); // gfx/vgui/640_gina.tga
//m_pImage->setText(25, "this is a test!!!");
m_pImage->setParent( m_pWindow );
m_pImage->setVisible( true );
Initialize();
}
//-----------------------------------------------------------------------------
// Purpose: Called each time a new level is started.
//-----------------------------------------------------------------------------
void CSparePlayerWindow::Initialize( void )
{
//m_pScrollPanel->setScrollValue( 0, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Called everytime the Team Menu is displayed
//-----------------------------------------------------------------------------
void CSparePlayerWindow::Update( void )
{
// TODO: maybe update "Disconnect in ..." label here?
//m_pMemo->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
//m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
int iYPos = SNW_TOPLEFT_BUTTON_Y;
// Move the AutoAssign button into place
//m_pCancelButton->setPos( SNW_TOPLEFT_BUTTON_X, iYPos );
//m_pScrollPanel->validate();
m_pImage->setBounds( XRES(8), YRES(16), 128, 256 );
}
//=====================================
// Key inputs
bool CSparePlayerWindow::SlotInput( int iSlot )
{
if ( iSlot == 1)
{
//m_pCancelButton->fireActionSignal();
return true;
}
return false;
}
//======================================
// Update the Team menu before opening it
void CSparePlayerWindow::Open( void )
{
Update();
CMenuPanel::Open();
}

View File

@ -1,154 +1,154 @@
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: Notepad
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include "vgui_int.h"
#include "VGUI_Font.h"
#include "VGUI_ScrollPanel.h"
#include "VGUI_TextImage.h"
#include "VGUI_loadtga.h"
#include "hud.h"
#include "cl_util.h"
#include "vgui_TeamFortressViewport.h"
// Notepad Dimensions
#define NOTEPAD_TITLE_X XRES(40)
#define NOTEPAD_TITLE_Y YRES(32)
#define NOTEPAD_TOPLEFT_BUTTON_X XRES(251)//was 245
#define NOTEPAD_TOPLEFT_BUTTON_Y YRES(400)
#define NOTEPAD_BUTTON_SIZE_X XRES(100)
#define NOTEPAD_BUTTON_SIZE_Y YRES(24)
#define NOTEPAD_BUTTON_SPACER_Y YRES(8)
#define NOTEPAD_WINDOW_X XRES(150)
#define NOTEPAD_WINDOW_Y YRES(150)
#define NOTEPAD_WINDOW_SIZE_X XRES(300)
#define NOTEPAD_WINDOW_SIZE_Y YRES(220)
#define NOTEPAD_WINDOW_TITLE_X XRES(16)
#define NOTEPAD_WINDOW_TITLE_Y YRES(16)
#define NOTEPAD_WINDOW_TEXT_X XRES(16)
#define NOTEPAD_WINDOW_TEXT_Y YRES(32)
#define NOTEPAD_WINDOW_TEXT_SIZE_Y YRES(168)
#define NOTEPAD_WINDOW_INFO_X XRES(16)
#define NOTEPAD_WINDOW_INFO_Y YRES(234)
// Creation
CNotepad::CNotepad(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hDecayFont = pSchemes->getSchemeHandle( "Briefing Text" ); //Decay
// get the Font used for the Titles
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
int r, g, b, a;
// Create the title
m_pTitle = new Label( "", NOTEPAD_WINDOW_X+10, NOTEPAD_WINDOW_Y+5 );
m_pTitle->setParent( this );
m_pTitle->setFont( pTitleFont );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pTitle->setBgColor( r, g, b, a );
m_pTitle->setContentAlignment( vgui::Label::a_west );
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
// Create the Info Window
m_pNotepadWindow = new CTransparentPanel( 255, NOTEPAD_WINDOW_X, NOTEPAD_WINDOW_Y, NOTEPAD_WINDOW_SIZE_X, NOTEPAD_WINDOW_SIZE_Y );
m_pNotepadWindow->setParent( this );
m_pNotepadWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Scroll panel
m_pScrollPanel = new CTFScrollPanel( NOTEPAD_WINDOW_TEXT_X, NOTEPAD_WINDOW_TEXT_Y, NOTEPAD_WINDOW_SIZE_X - (NOTEPAD_WINDOW_TEXT_X * 2), NOTEPAD_WINDOW_TEXT_SIZE_Y );
m_pScrollPanel->setParent(m_pNotepadWindow);
m_pScrollPanel->setScrollBarVisible(false, false);
// Create the Map Briefing panel
m_pBriefing = new TextPanel("", 0,0, NOTEPAD_WINDOW_SIZE_X - NOTEPAD_WINDOW_TEXT_X, NOTEPAD_WINDOW_TEXT_SIZE_Y );
m_pBriefing->setParent( m_pScrollPanel->getClient() );
m_pBriefing->setFont( pSchemes->getFont(hDecayFont) );
pSchemes->getFgColor( hDecayFont, r, g, b, a );
m_pBriefing->setFgColor( r, g, b, a );
pSchemes->getBgColor( hDecayFont, r, g, b, a );
m_pBriefing->setBgColor( r, g, b, a );
m_pBriefing->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
// Create the Cancel button
m_pCancelButton = new CommandButton( "", NOTEPAD_TOPLEFT_BUTTON_X, NOTEPAD_TOPLEFT_BUTTON_Y, NOTEPAD_BUTTON_SIZE_X, NOTEPAD_BUTTON_SIZE_Y, true);
m_pCancelButton->setParent( this );
m_pCancelButton->setText( gHUD.m_TextMessage.BufferedLocaliseTextString(" CLOSE") );
m_pCancelButton->setVisible( true );
m_pCancelButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
/*
m_pImage = new CImageLabel( "gina", 0, 0, 128, 256 ); // gfx/vgui/640_gina.tga
//m_pImage->setText(25, "this is a test!!!");
m_pImage->setParent( this );
m_pImage->setVisible( true );
*/
Initialize();
}
//-----------------------------------------------------------------------------
// Purpose: Called each time a new level is started.
//-----------------------------------------------------------------------------
void CNotepad::Initialize( void )
{
m_pScrollPanel->setScrollValue( 0, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Called everytime the Team Menu is displayed
//-----------------------------------------------------------------------------
void CNotepad::Update( void )
{
m_pBriefing->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
int iYPos = NOTEPAD_TOPLEFT_BUTTON_Y;
// Move the AutoAssign button into place
m_pCancelButton->setPos( NOTEPAD_TOPLEFT_BUTTON_X, iYPos );
m_pScrollPanel->validate();
//m_pImage->setBounds( NOTEPAD_TOPLEFT_BUTTON_X, NOTEPAD_TOPLEFT_BUTTON_Y-256-32, 128, 256 );
}
//=====================================
// Key inputs
bool CNotepad::SlotInput( int iSlot )
{
if ( iSlot == 1)
{
m_pCancelButton->fireActionSignal();
return true;
}
return false;
}
//======================================
// Update the Team menu before opening it
void CNotepad::Open( void )
{
Update();
CMenuPanel::Open();
}
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: Notepad
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include "vgui_int.h"
#include "VGUI_Font.h"
#include "VGUI_ScrollPanel.h"
#include "VGUI_TextImage.h"
#include "VGUI_loadtga.h"
#include "hud.h"
#include "cl_util.h"
#include "vgui_TeamFortressViewport.h"
// Notepad Dimensions
#define NOTEPAD_TITLE_X XRES(40)
#define NOTEPAD_TITLE_Y YRES(32)
#define NOTEPAD_TOPLEFT_BUTTON_X XRES(251)//was 245
#define NOTEPAD_TOPLEFT_BUTTON_Y YRES(400)
#define NOTEPAD_BUTTON_SIZE_X XRES(100)
#define NOTEPAD_BUTTON_SIZE_Y YRES(24)
#define NOTEPAD_BUTTON_SPACER_Y YRES(8)
#define NOTEPAD_WINDOW_X XRES(150)
#define NOTEPAD_WINDOW_Y YRES(150)
#define NOTEPAD_WINDOW_SIZE_X XRES(300)
#define NOTEPAD_WINDOW_SIZE_Y YRES(220)
#define NOTEPAD_WINDOW_TITLE_X XRES(16)
#define NOTEPAD_WINDOW_TITLE_Y YRES(16)
#define NOTEPAD_WINDOW_TEXT_X XRES(16)
#define NOTEPAD_WINDOW_TEXT_Y YRES(32)
#define NOTEPAD_WINDOW_TEXT_SIZE_Y YRES(168)
#define NOTEPAD_WINDOW_INFO_X XRES(16)
#define NOTEPAD_WINDOW_INFO_Y YRES(234)
// Creation
CNotepad::CNotepad(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
// Get the scheme used for the Titles
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
// schemes
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
SchemeHandle_t hDecayFont = pSchemes->getSchemeHandle( "Briefing Text" ); //Decay
// get the Font used for the Titles
Font *pTitleFont = pSchemes->getFont( hTitleScheme );
int r, g, b, a;
// Create the title
m_pTitle = new Label( "", NOTEPAD_WINDOW_X+10, NOTEPAD_WINDOW_Y+5 );
m_pTitle->setParent( this );
m_pTitle->setFont( pTitleFont );
pSchemes->getFgColor( hTitleScheme, r, g, b, a );
m_pTitle->setFgColor( r, g, b, a );
pSchemes->getBgColor( hTitleScheme, r, g, b, a );
m_pTitle->setBgColor( r, g, b, a );
m_pTitle->setContentAlignment( vgui::Label::a_west );
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
// Create the Info Window
m_pNotepadWindow = new CTransparentPanel( 255, NOTEPAD_WINDOW_X, NOTEPAD_WINDOW_Y, NOTEPAD_WINDOW_SIZE_X, NOTEPAD_WINDOW_SIZE_Y );
m_pNotepadWindow->setParent( this );
m_pNotepadWindow->setBorder( new LineBorder( Color(255*0.7,170*0.7,0,0 )) );
// Create the Scroll panel
m_pScrollPanel = new CTFScrollPanel( NOTEPAD_WINDOW_TEXT_X, NOTEPAD_WINDOW_TEXT_Y, NOTEPAD_WINDOW_SIZE_X - (NOTEPAD_WINDOW_TEXT_X * 2), NOTEPAD_WINDOW_TEXT_SIZE_Y );
m_pScrollPanel->setParent(m_pNotepadWindow);
m_pScrollPanel->setScrollBarVisible(false, false);
// Create the Map Briefing panel
m_pBriefing = new TextPanel("", 0,0, NOTEPAD_WINDOW_SIZE_X - NOTEPAD_WINDOW_TEXT_X, NOTEPAD_WINDOW_TEXT_SIZE_Y );
m_pBriefing->setParent( m_pScrollPanel->getClient() );
m_pBriefing->setFont( pSchemes->getFont(hDecayFont) );
pSchemes->getFgColor( hDecayFont, r, g, b, a );
m_pBriefing->setFgColor( r, g, b, a );
pSchemes->getBgColor( hDecayFont, r, g, b, a );
m_pBriefing->setBgColor( r, g, b, a );
m_pBriefing->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
// Create the Cancel button
m_pCancelButton = new CommandButton( "", NOTEPAD_TOPLEFT_BUTTON_X, NOTEPAD_TOPLEFT_BUTTON_Y, NOTEPAD_BUTTON_SIZE_X, NOTEPAD_BUTTON_SIZE_Y, true);
m_pCancelButton->setParent( this );
m_pCancelButton->setText( gHUD.m_TextMessage.BufferedLocaliseTextString(" CLOSE") );
m_pCancelButton->setVisible( true );
m_pCancelButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
/*
m_pImage = new CImageLabel( "gina", 0, 0, 128, 256 ); // gfx/vgui/640_gina.tga
//m_pImage->setText(25, "this is a test!!!");
m_pImage->setParent( this );
m_pImage->setVisible( true );
*/
Initialize();
}
//-----------------------------------------------------------------------------
// Purpose: Called each time a new level is started.
//-----------------------------------------------------------------------------
void CNotepad::Initialize( void )
{
m_pScrollPanel->setScrollValue( 0, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: Called everytime the Team Menu is displayed
//-----------------------------------------------------------------------------
void CNotepad::Update( void )
{
m_pBriefing->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szText));
m_pTitle->setText(gHUD.m_TextMessage.BufferedLocaliseTextString(szTitle));
int iYPos = NOTEPAD_TOPLEFT_BUTTON_Y;
// Move the AutoAssign button into place
m_pCancelButton->setPos( NOTEPAD_TOPLEFT_BUTTON_X, iYPos );
m_pScrollPanel->validate();
//m_pImage->setBounds( NOTEPAD_TOPLEFT_BUTTON_X, NOTEPAD_TOPLEFT_BUTTON_Y-256-32, 128, 256 );
}
//=====================================
// Key inputs
bool CNotepad::SlotInput( int iSlot )
{
if ( iSlot == 1)
{
m_pCancelButton->fireActionSignal();
return true;
}
return false;
}
//======================================
// Update the Team menu before opening it
void CNotepad::Open( void )
{
Update();
CMenuPanel::Open();
}

View File

@ -1,36 +1,36 @@
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "animation.h"
#include "effects.h"
#include "actanimating.h"
TYPEDESCRIPTION CActAnimating::m_SaveData[] =
{
DEFINE_FIELD( CActAnimating, m_Activity, FIELD_INTEGER ),
DEFINE_FIELD( CActAnimating, m_iSequence, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CActAnimating, CBaseAnimating );
void CActAnimating :: SetActivity( Activity act )
{
int sequence = LookupActivity( act );
if ( sequence != ACTIVITY_NOT_AVAILABLE )
{
m_iSequence = sequence;
pev->sequence = sequence;
m_Activity = act;
pev->frame = 0;
ResetSequenceInfo( );
}
}
void CActAnimating :: SetSequence( int sequence )
{
//m_Activity = ACTIVITY_NOT_AVAILABLE;
pev->sequence = sequence;
m_iSequence = sequence;
pev->frame = 0;
ResetSequenceInfo( );
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "animation.h"
#include "effects.h"
#include "actanimating.h"
TYPEDESCRIPTION CActAnimating::m_SaveData[] =
{
DEFINE_FIELD( CActAnimating, m_Activity, FIELD_INTEGER ),
DEFINE_FIELD( CActAnimating, m_iSequence, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CActAnimating, CBaseAnimating );
void CActAnimating :: SetActivity( Activity act )
{
int sequence = LookupActivity( act );
if ( sequence != ACTIVITY_NOT_AVAILABLE )
{
m_iSequence = sequence;
pev->sequence = sequence;
m_Activity = act;
pev->frame = 0;
ResetSequenceInfo( );
}
}
void CActAnimating :: SetSequence( int sequence )
{
//m_Activity = ACTIVITY_NOT_AVAILABLE;
pev->sequence = sequence;
m_iSequence = sequence;
pev->frame = 0;
ResetSequenceInfo( );
}

View File

@ -1,19 +1,19 @@
class CActAnimating : public CBaseAnimating
{
public:
void SetActivity( Activity act );
inline Activity GetActivity( void ) { return m_Activity; }
void SetSequence( int sequence );
inline int GetSequence( void ) { return m_iSequence; }
virtual int ObjectCaps( void ) { return CBaseAnimating :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
private:
Activity m_Activity;
int m_iSequence;
};
class CActAnimating : public CBaseAnimating
{
public:
void SetActivity( Activity act );
inline Activity GetActivity( void ) { return m_Activity; }
void SetSequence( int sequence );
inline int GetSequence( void ) { return m_iSequence; }
virtual int ObjectCaps( void ) { return CBaseAnimating :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
private:
Activity m_Activity;
int m_iSequence;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +1,177 @@
// botman's Half-Life bot example
//
// http://planethalflife.com/botman/
//
// bot.h
//
#ifndef BOT_H
#define BOT_H
#define LADDER_UP 1
#define LADDER_DOWN 2
#define WANDER_LEFT 1
#define WANDER_RIGHT 2
#define MODEL_GINA 1
#define MODEL_COLETTE 2
#define BOT_YAW_SPEED 20 // degrees per 10th of second turning speed
#define BOT_SKIN_LEN 128
#define BOT_NAME_LEN 31
#define ENEMY_HEADCRAB 0
#define ENEMY_ZOMBIE 1
#define ENEMY_BULLSQUID 2
#define ENEMY_ASLAVE 3
#define ENEMY_HOUNDEYE 4
#define ENEMY_AGRUNT 5
#define ENEMY_HGRUNT 6
#define ENEMY_CONTROLLER 7
#define ENEMY_FLYER 8
#define ENEMY_UNKNOWN 254
#define ENEMY_NONE 255
typedef struct // used in checking if bot can pick up ammo
{
const char *ammo_name;
const char *weapon_name;
int max_carry;
} ammo_check_t;
#define BOT_IDLE 0
#define BOT_NEED_TO_KICK 1
#define BOT_NEED_TO_RESPAWN 2
#define BOT_IS_RESPAWNING 3
typedef struct // used to respawn bot at end of round (time/frag limit)
{
BOOL is_used; // is this slot in use?
int state; // current state of the bot
char skin[BOT_SKIN_LEN+1];
char name[BOT_NAME_LEN+1];
char skill[2];
CBasePlayer *pBot;
} respawn_t;
#define GI_SND1 "gina/gina_attacked0.wav"
#define GI_SND2 "gina/gina_attacked1.wav "
#define GI_SND3 "gina/gina_pain1.wav "
#define GI_SND4 "gina/gina_pain2.wav "
#define GI_SND5 "gina/gina_pain3.wav "
#define CO_SND1 "colette/colette_attacked0.wav"
#define CO_SND2 "colette/colette_attacked1.wav"
#define CO_SND3 "colette/colette_pain0.wav"
#define CO_SND4 "colette/colette_pain2.wav"
#define CO_SND5 "colette/colette_pain3.wav"
//
// joy after successful enemy kill
//
#define CO_TNT1 "colette/colette_kill0.wav"
#define CO_TNT2 "colette/colette_kill1.wav"
#define CO_TNT3 "colette/colette_kill2.wav"
#define CO_TNT4 "colette/colette_kill3.wav"
#define CO_TNT5 "colette/colette_kill4.wav"
#define GI_TNT1 "gina/gina_kill0.wav"
#define GI_TNT2 "gina/gina_kill1.wav"
#define GI_TNT3 "gina/gina_kill2.wav"
#define GI_TNT4 "gina/gina_kill3.wav"
#define GI_TNT5 "gina/gina_kill4.wav"
#define USE_TEAMPLAY_SND "barney/teamup2.wav"
#define USE_TEAMPLAY_LATER_SND "barney/seeya.wav"
#define USE_TEAMPLAY_ENEMY_SND "barney/ba_raincheck.wav"
void BotDebug( char *buffer ); // print out message to HUD for debugging
class CBot : public CBasePlayer //Derive a bot class from CBasePlayer
{
public:
Vector v_prev_origin; // previous origin (i.e. location)
float f_shoot_time; // next time to shoot weapon at
float f_max_speed; // last sv_maxspeed setting
float f_speed_check_time; // check sv_maxspeed every so often
float f_move_speed; // speed at which the bot will move
int ladder_dir; // direction traveling on ladder (UP or DOWN)
int wander_dir; // randomly wander left or right
float f_pause_time; // timeout for periods when the bot pauses
float f_find_item; // timeout for not looking for items
char model_name[64];
int bot_model;
int bot_skill; // bot skill level (0=very good, 4=very bad)
float f_pain_time; // time when pain sound can be spoken
BOOL b_use_health_station; // set if bot should "use" health station
float f_use_health_time; // time when b_use_health_station is set
BOOL b_use_HEV_station; // set if bot should "use" HEV station
float f_use_HEV_time; // time when b_use_HEV_station is set
BOOL b_use_button; // set if bot should "use" button
float f_use_button_time; // time when b_use_button is set
BOOL b_lift_moving; // flag set when lift (elevator) is moving
float f_use_ladder_time; // time when bot sees a ladder
BOOL b_see_tripmine; // set if bot "sees" a tripmine
BOOL b_shoot_tripmine; // set if bot should shoot a tripmine
Vector v_tripmine_origin; // origin of tripmine
float f_fire_gauss; // time to release secondary fire on gauss gun
BOOL bot_was_paused; // TRUE if bot was previously "paused"
float f_weapon_inventory_time; // time to check weapon inventory
int respawn_index; // index in respawn structure for this bot
float f_dont_avoid_wall_time; // time when avoiding walls is OK
float f_bot_use_time; // time the bot was "used" by player
float f_wall_on_left; // time since bot has had a wall on the left
float f_wall_on_right; // time since bot has had a wall on the right
CBaseEntity *pBotEnemy; // pointer to bot's enemy
EOFFSET pBotEnemyOffset;
byte pBotEnemyClass;
CBaseEntity *pBotUser; // pointer to player using bot
CBaseEntity *pBotPickupItem; // pointer to item we are trying to get
CBasePlayerItem *weapon_ptr[MAX_WEAPONS]; // pointer array to weapons
int primary_ammo[MAX_WEAPONS]; // amount of primary ammo available
int secondary_ammo[MAX_WEAPONS]; // amount of secondary ammo available
char message[256]; // buffer for debug messages
void Spawn( void );
void BotThink( void ); // think function for the bot
// Bots should return FALSE for this, they can't receive NET messages
virtual BOOL IsNetClient( void ) { return FALSE; }
int BloodColor() { return BLOOD_COLOR_RED; }
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
float flDamage, int bitsDamageType );
int ObjectCaps() { return FCAP_IMPULSE_USE; };
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller,
USE_TYPE useType, float value );
int BotInFieldOfView( Vector dest );
BOOL BotEntityIsVisible( Vector dest );
float BotChangeYaw( float speed );
void BotOnLadder( float moved_distance );
void BotUnderWater( void );
CBaseEntity * BotFindEnemy( void );
Vector BotBodyTarget( CBaseEntity *pBotEnemy );
void BotWeaponInventory( void );
BOOL BotFireWeapon( Vector enemy, int weapon_choice = 0, BOOL primary = TRUE );
void BotShootAtEnemy( void );
void BotFindItem( void );
void BotUseLift( float moved_distance );
void BotTurnAtWall( TraceResult *tr );
BOOL BotCantMoveForward( TraceResult *tr );
BOOL BotCanJumpUp( void );
BOOL BotCanDuckUnder( void );
BOOL BotShootTripmine( void );
BOOL BotFollowUser( void ); // returns FALSE if can find "user"
BOOL BotCheckWallOnLeft( void );
BOOL BotCheckWallOnRight( void );
};
#endif // BOT_H
// botman's Half-Life bot example
//
// http://planethalflife.com/botman/
//
// bot.h
//
#ifndef BOT_H
#define BOT_H
#define LADDER_UP 1
#define LADDER_DOWN 2
#define WANDER_LEFT 1
#define WANDER_RIGHT 2
#define MODEL_GINA 1
#define MODEL_COLETTE 2
#define BOT_YAW_SPEED 20 // degrees per 10th of second turning speed
#define BOT_SKIN_LEN 128
#define BOT_NAME_LEN 31
#define ENEMY_HEADCRAB 0
#define ENEMY_ZOMBIE 1
#define ENEMY_BULLSQUID 2
#define ENEMY_ASLAVE 3
#define ENEMY_HOUNDEYE 4
#define ENEMY_AGRUNT 5
#define ENEMY_HGRUNT 6
#define ENEMY_CONTROLLER 7
#define ENEMY_FLYER 8
#define ENEMY_UNKNOWN 254
#define ENEMY_NONE 255
typedef struct // used in checking if bot can pick up ammo
{
const char *ammo_name;
const char *weapon_name;
int max_carry;
} ammo_check_t;
#define BOT_IDLE 0
#define BOT_NEED_TO_KICK 1
#define BOT_NEED_TO_RESPAWN 2
#define BOT_IS_RESPAWNING 3
typedef struct // used to respawn bot at end of round (time/frag limit)
{
BOOL is_used; // is this slot in use?
int state; // current state of the bot
char skin[BOT_SKIN_LEN+1];
char name[BOT_NAME_LEN+1];
char skill[2];
CBasePlayer *pBot;
} respawn_t;
#define GI_SND1 "gina/gina_attacked0.wav"
#define GI_SND2 "gina/gina_attacked1.wav "
#define GI_SND3 "gina/gina_pain1.wav "
#define GI_SND4 "gina/gina_pain2.wav "
#define GI_SND5 "gina/gina_pain3.wav "
#define CO_SND1 "colette/colette_attacked0.wav"
#define CO_SND2 "colette/colette_attacked1.wav"
#define CO_SND3 "colette/colette_pain0.wav"
#define CO_SND4 "colette/colette_pain2.wav"
#define CO_SND5 "colette/colette_pain3.wav"
//
// joy after successful enemy kill
//
#define CO_TNT1 "colette/colette_kill0.wav"
#define CO_TNT2 "colette/colette_kill1.wav"
#define CO_TNT3 "colette/colette_kill2.wav"
#define CO_TNT4 "colette/colette_kill3.wav"
#define CO_TNT5 "colette/colette_kill4.wav"
#define GI_TNT1 "gina/gina_kill0.wav"
#define GI_TNT2 "gina/gina_kill1.wav"
#define GI_TNT3 "gina/gina_kill2.wav"
#define GI_TNT4 "gina/gina_kill3.wav"
#define GI_TNT5 "gina/gina_kill4.wav"
#define USE_TEAMPLAY_SND "barney/teamup2.wav"
#define USE_TEAMPLAY_LATER_SND "barney/seeya.wav"
#define USE_TEAMPLAY_ENEMY_SND "barney/ba_raincheck.wav"
void BotDebug( char *buffer ); // print out message to HUD for debugging
class CBot : public CBasePlayer //Derive a bot class from CBasePlayer
{
public:
Vector v_prev_origin; // previous origin (i.e. location)
float f_shoot_time; // next time to shoot weapon at
float f_max_speed; // last sv_maxspeed setting
float f_speed_check_time; // check sv_maxspeed every so often
float f_move_speed; // speed at which the bot will move
int ladder_dir; // direction traveling on ladder (UP or DOWN)
int wander_dir; // randomly wander left or right
float f_pause_time; // timeout for periods when the bot pauses
float f_find_item; // timeout for not looking for items
char model_name[64];
int bot_model;
int bot_skill; // bot skill level (0=very good, 4=very bad)
float f_pain_time; // time when pain sound can be spoken
BOOL b_use_health_station; // set if bot should "use" health station
float f_use_health_time; // time when b_use_health_station is set
BOOL b_use_HEV_station; // set if bot should "use" HEV station
float f_use_HEV_time; // time when b_use_HEV_station is set
BOOL b_use_button; // set if bot should "use" button
float f_use_button_time; // time when b_use_button is set
BOOL b_lift_moving; // flag set when lift (elevator) is moving
float f_use_ladder_time; // time when bot sees a ladder
BOOL b_see_tripmine; // set if bot "sees" a tripmine
BOOL b_shoot_tripmine; // set if bot should shoot a tripmine
Vector v_tripmine_origin; // origin of tripmine
float f_fire_gauss; // time to release secondary fire on gauss gun
BOOL bot_was_paused; // TRUE if bot was previously "paused"
float f_weapon_inventory_time; // time to check weapon inventory
int respawn_index; // index in respawn structure for this bot
float f_dont_avoid_wall_time; // time when avoiding walls is OK
float f_bot_use_time; // time the bot was "used" by player
float f_wall_on_left; // time since bot has had a wall on the left
float f_wall_on_right; // time since bot has had a wall on the right
CBaseEntity *pBotEnemy; // pointer to bot's enemy
EOFFSET pBotEnemyOffset;
byte pBotEnemyClass;
CBaseEntity *pBotUser; // pointer to player using bot
CBaseEntity *pBotPickupItem; // pointer to item we are trying to get
CBasePlayerItem *weapon_ptr[MAX_WEAPONS]; // pointer array to weapons
int primary_ammo[MAX_WEAPONS]; // amount of primary ammo available
int secondary_ammo[MAX_WEAPONS]; // amount of secondary ammo available
char message[256]; // buffer for debug messages
void Spawn( void );
void BotThink( void ); // think function for the bot
// Bots should return FALSE for this, they can't receive NET messages
virtual BOOL IsNetClient( void ) { return FALSE; }
int BloodColor() { return BLOOD_COLOR_RED; }
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
float flDamage, int bitsDamageType );
int ObjectCaps() { return FCAP_IMPULSE_USE; };
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller,
USE_TYPE useType, float value );
int BotInFieldOfView( Vector dest );
BOOL BotEntityIsVisible( Vector dest );
float BotChangeYaw( float speed );
void BotOnLadder( float moved_distance );
void BotUnderWater( void );
CBaseEntity * BotFindEnemy( void );
Vector BotBodyTarget( CBaseEntity *pBotEnemy );
void BotWeaponInventory( void );
BOOL BotFireWeapon( Vector enemy, int weapon_choice = 0, BOOL primary = TRUE );
void BotShootAtEnemy( void );
void BotFindItem( void );
void BotUseLift( float moved_distance );
void BotTurnAtWall( TraceResult *tr );
BOOL BotCantMoveForward( TraceResult *tr );
BOOL BotCanJumpUp( void );
BOOL BotCanDuckUnder( void );
BOOL BotShootTripmine( void );
BOOL BotFollowUser( void ); // returns FALSE if can find "user"
BOOL BotCheckWallOnLeft( void );
BOOL BotCheckWallOnRight( void );
};
#endif // BOT_H

File diff suppressed because it is too large Load Diff

View File

@ -1,236 +1,236 @@
//
// Decay entities (chargers: health and hev; retinal scanner)
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "defaultai.h"
#include "scripted.h"
#include "animation.h"
#include "soundent.h"
#include "actanimating.h"
//
// EYE RETINAL SCANNER
//
#define EYESCANNER_HIDE_TIME 3
#define EYESCANNER_SCAN_LOOPS 3
class CEyeScanner : public CActAnimating
{
public:
void Precache( void );
void Spawn( void );
void Touch( CBaseEntity *pOther );
void EXPORT ScannerThink( void );
void EXPORT UseThink( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void KeyValue( KeyValueData *pkvd );
virtual int ObjectCaps( void ) { return CActAnimating :: ObjectCaps() | /*FCAP_CONTINUOUS_USE | */FCAP_IMPULSE_USE; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
BOOL m_bState;
BOOL m_bIsKeymaker;
int m_iCheckFrame;
int m_iCheckLoop;
int m_iszTargetUnlocked;
int m_iszTargetLocked;
int m_iszKeymaker; // The One's who unlocks name :)
};
LINK_ENTITY_TO_CLASS(item_eyescanner, CEyeScanner);
//
// Implementing save/restore
//
TYPEDESCRIPTION CEyeScanner::m_SaveData[] =
{
DEFINE_FIELD( CEyeScanner, m_bState, FIELD_BOOLEAN ),
DEFINE_FIELD( CEyeScanner, m_bIsKeymaker, FIELD_BOOLEAN ),
DEFINE_FIELD( CEyeScanner, m_iCheckLoop, FIELD_INTEGER ),
DEFINE_FIELD( CEyeScanner, m_iCheckFrame, FIELD_INTEGER ),
DEFINE_FIELD( CEyeScanner, m_iszTargetUnlocked, FIELD_STRING ),
DEFINE_FIELD( CEyeScanner, m_iszTargetLocked, FIELD_STRING ),
DEFINE_FIELD( CEyeScanner, m_iszKeymaker, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CEyeScanner, CActAnimating );
//
// common functions
//
#define mdlScanner "models/eye_scanner.mdl"
#define sndScannerBeep "buttons/blip1.wav"
#define sndScannerOpen "buttons/blip2.wav"
#define sndScannerDeny "buttons/button11.wav"
void CEyeScanner::Precache( void )
{
PRECACHE_MODEL( mdlScanner );
PRECACHE_SOUND( sndScannerBeep );
PRECACHE_SOUND( sndScannerOpen );
PRECACHE_SOUND( sndScannerDeny );
}
void CEyeScanner::Spawn( void )
{
Precache( );
SET_MODEL(ENT(pev), mdlScanner );
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_TRIGGER;
UTIL_SetSize( pev, Vector(-8,-8,0), Vector(8,8,32));
SetActivity( ACT_CROUCHIDLE );
SetThink ( &CEyeScanner::ScannerThink );
pev->nextthink = gpGlobals->time + 0.1;
//pev->frame = RANDOM_FLOAT(0,255);
}
void CEyeScanner::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "unlocked_target"))
{
m_iszTargetUnlocked = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_target"))
{
m_iszTargetLocked = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlockersname"))
{
m_iszKeymaker = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CActAnimating::KeyValue( pkvd );
//m_iReactivate = atoi(pkvd->szValue);
}
void CEyeScanner::ScannerThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
switch( GetActivity() )
{
case ACT_CROUCH: // deactivate in progress
if ( m_fSequenceFinished )
SetActivity( ACT_CROUCHIDLE );
break;
case ACT_CROUCHIDLE: // deactivated
pev->skin = 0;
m_bState = FALSE;
break;
case ACT_STAND: // activate in progress
m_bState = TRUE;
if ( m_fSequenceFinished )
SetActivity( ACT_IDLE );
break;
case ACT_IDLE: // activated
if ( gpGlobals->time > pev->dmgtime )
SetActivity( ACT_CROUCH );
break;
default:
break;
}
}
void CEyeScanner :: Touch( CBaseEntity *pOther )
{/*
int iClass = pOther->Classify();
//if ( pOther->IsPlayer() )
if (iClass == CLASS_PLAYER || iClass == CLASS_PLAYER_ALLY)
{
pev->dmgtime = gpGlobals->time + EYESCANNER_HIDE_TIME;
if ( GetActivity() == ACT_CROUCH || GetActivity() == ACT_CROUCHIDLE )
{
SetActivity( ACT_STAND );
}
}*/
}
void CEyeScanner :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if (GetActivity() == ACT_CROUCHIDLE)
{
pev->dmgtime = gpGlobals->time + EYESCANNER_HIDE_TIME;
//if ( GetActivity() == ACT_CROUCH || GetActivity() == ACT_CROUCHIDLE )
//{
SetActivity( ACT_STAND );
//}
}
//if (m_bState == FALSE)
// return;
int m_iszCallerName;
if (pActivator)
m_iszCallerName = pActivator->pev->targetname;
else
m_iszCallerName = pCaller->pev->targetname;
//ALERT( at_console, "caller name is %s\n", STRING(m_iszCallerName) );
if (m_iszKeymaker) // if unlocker's name is specified then do check activator's name
m_bIsKeymaker = !strcmp(STRING(m_iszCallerName), STRING(m_iszKeymaker));
else // otherwise open for everyone
m_bIsKeymaker = true;
m_iCheckLoop = 0;
m_iCheckFrame = 1;
m_bState = FALSE;
SetThink( &CEyeScanner::UseThink );
pev->nextthink = gpGlobals->time + 1.5;
}
void CEyeScanner :: UseThink( void )
{
pev->nextthink = gpGlobals->time + 0.15;
// buttons/blip1.wav
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerBeep, 0.85, ATTN_NORM );
if (m_iCheckLoop == EYESCANNER_SCAN_LOOPS)
{
// scan process finished - do something!
if (m_bIsKeymaker)
{
FireTargets( STRING(m_iszTargetUnlocked), this, this, USE_TOGGLE, 0 );
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerOpen, 0.85, ATTN_NORM );
} else
{
FireTargets( STRING(m_iszTargetLocked), this, this, USE_TOGGLE, 0 );
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerDeny, 0.85, ATTN_NORM );
}
SetThink( &CEyeScanner::ScannerThink );
pev->skin = 0;
return;
}
// if we are in last animation frame, skip to first one
if (m_iCheckFrame == 4)
{
m_iCheckFrame = 1;
m_iCheckLoop++;
}
pev->skin = m_iCheckFrame;
m_iCheckFrame++;
}
//
// Decay entities (chargers: health and hev; retinal scanner)
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "defaultai.h"
#include "scripted.h"
#include "animation.h"
#include "soundent.h"
#include "actanimating.h"
//
// EYE RETINAL SCANNER
//
#define EYESCANNER_HIDE_TIME 3
#define EYESCANNER_SCAN_LOOPS 3
class CEyeScanner : public CActAnimating
{
public:
void Precache( void );
void Spawn( void );
void Touch( CBaseEntity *pOther );
void EXPORT ScannerThink( void );
void EXPORT UseThink( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void KeyValue( KeyValueData *pkvd );
virtual int ObjectCaps( void ) { return CActAnimating :: ObjectCaps() | /*FCAP_CONTINUOUS_USE | */FCAP_IMPULSE_USE; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
BOOL m_bState;
BOOL m_bIsKeymaker;
int m_iCheckFrame;
int m_iCheckLoop;
int m_iszTargetUnlocked;
int m_iszTargetLocked;
int m_iszKeymaker; // The One's who unlocks name :)
};
LINK_ENTITY_TO_CLASS(item_eyescanner, CEyeScanner);
//
// Implementing save/restore
//
TYPEDESCRIPTION CEyeScanner::m_SaveData[] =
{
DEFINE_FIELD( CEyeScanner, m_bState, FIELD_BOOLEAN ),
DEFINE_FIELD( CEyeScanner, m_bIsKeymaker, FIELD_BOOLEAN ),
DEFINE_FIELD( CEyeScanner, m_iCheckLoop, FIELD_INTEGER ),
DEFINE_FIELD( CEyeScanner, m_iCheckFrame, FIELD_INTEGER ),
DEFINE_FIELD( CEyeScanner, m_iszTargetUnlocked, FIELD_STRING ),
DEFINE_FIELD( CEyeScanner, m_iszTargetLocked, FIELD_STRING ),
DEFINE_FIELD( CEyeScanner, m_iszKeymaker, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CEyeScanner, CActAnimating );
//
// common functions
//
#define mdlScanner "models/eye_scanner.mdl"
#define sndScannerBeep "buttons/blip1.wav"
#define sndScannerOpen "buttons/blip2.wav"
#define sndScannerDeny "buttons/button11.wav"
void CEyeScanner::Precache( void )
{
PRECACHE_MODEL( mdlScanner );
PRECACHE_SOUND( sndScannerBeep );
PRECACHE_SOUND( sndScannerOpen );
PRECACHE_SOUND( sndScannerDeny );
}
void CEyeScanner::Spawn( void )
{
Precache( );
SET_MODEL(ENT(pev), mdlScanner );
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_TRIGGER;
UTIL_SetSize( pev, Vector(-8,-8,0), Vector(8,8,32));
SetActivity( ACT_CROUCHIDLE );
SetThink ( &CEyeScanner::ScannerThink );
pev->nextthink = gpGlobals->time + 0.1;
//pev->frame = RANDOM_FLOAT(0,255);
}
void CEyeScanner::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "unlocked_target"))
{
m_iszTargetUnlocked = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_target"))
{
m_iszTargetLocked = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlockersname"))
{
m_iszKeymaker = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CActAnimating::KeyValue( pkvd );
//m_iReactivate = atoi(pkvd->szValue);
}
void CEyeScanner::ScannerThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
switch( GetActivity() )
{
case ACT_CROUCH: // deactivate in progress
if ( m_fSequenceFinished )
SetActivity( ACT_CROUCHIDLE );
break;
case ACT_CROUCHIDLE: // deactivated
pev->skin = 0;
m_bState = FALSE;
break;
case ACT_STAND: // activate in progress
m_bState = TRUE;
if ( m_fSequenceFinished )
SetActivity( ACT_IDLE );
break;
case ACT_IDLE: // activated
if ( gpGlobals->time > pev->dmgtime )
SetActivity( ACT_CROUCH );
break;
default:
break;
}
}
void CEyeScanner :: Touch( CBaseEntity *pOther )
{/*
int iClass = pOther->Classify();
//if ( pOther->IsPlayer() )
if (iClass == CLASS_PLAYER || iClass == CLASS_PLAYER_ALLY)
{
pev->dmgtime = gpGlobals->time + EYESCANNER_HIDE_TIME;
if ( GetActivity() == ACT_CROUCH || GetActivity() == ACT_CROUCHIDLE )
{
SetActivity( ACT_STAND );
}
}*/
}
void CEyeScanner :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if (GetActivity() == ACT_CROUCHIDLE)
{
pev->dmgtime = gpGlobals->time + EYESCANNER_HIDE_TIME;
//if ( GetActivity() == ACT_CROUCH || GetActivity() == ACT_CROUCHIDLE )
//{
SetActivity( ACT_STAND );
//}
}
//if (m_bState == FALSE)
// return;
int m_iszCallerName;
if (pActivator)
m_iszCallerName = pActivator->pev->targetname;
else
m_iszCallerName = pCaller->pev->targetname;
//ALERT( at_console, "caller name is %s\n", STRING(m_iszCallerName) );
if (m_iszKeymaker) // if unlocker's name is specified then do check activator's name
m_bIsKeymaker = !strcmp(STRING(m_iszCallerName), STRING(m_iszKeymaker));
else // otherwise open for everyone
m_bIsKeymaker = true;
m_iCheckLoop = 0;
m_iCheckFrame = 1;
m_bState = FALSE;
SetThink( &CEyeScanner::UseThink );
pev->nextthink = gpGlobals->time + 1.5;
}
void CEyeScanner :: UseThink( void )
{
pev->nextthink = gpGlobals->time + 0.15;
// buttons/blip1.wav
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerBeep, 0.85, ATTN_NORM );
if (m_iCheckLoop == EYESCANNER_SCAN_LOOPS)
{
// scan process finished - do something!
if (m_bIsKeymaker)
{
FireTargets( STRING(m_iszTargetUnlocked), this, this, USE_TOGGLE, 0 );
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerOpen, 0.85, ATTN_NORM );
} else
{
FireTargets( STRING(m_iszTargetLocked), this, this, USE_TOGGLE, 0 );
EMIT_SOUND( ENT(pev), CHAN_ITEM, sndScannerDeny, 0.85, ATTN_NORM );
}
SetThink( &CEyeScanner::ScannerThink );
pev->skin = 0;
return;
}
// if we are in last animation frame, skip to first one
if (m_iCheckFrame == 4)
{
m_iCheckFrame = 1;
m_iCheckLoop++;
}
pev->skin = m_iCheckFrame;
m_iCheckFrame++;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +1,66 @@
/***
*
* Copyright (c) 1996-2002, 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.
*
****/
//=========================================================
// Monster Maker - this is an entity that creates monsters
// in the game.
//=========================================================
// Monstermaker spawnflags
#define SF_MONSTERMAKER_START_ON 1 // start active ( if has targetname )
#define SF_MONSTERMAKER_CYCLIC 4 // drop one monster every time fired.
#define SF_MONSTERMAKER_MONSTERCLIP 8 // Children are blocked by monsterclip
#define SF_MONSTERMAKER_FIREONCE 16 // kill after all children spawned if not cyclic
#define SF_WARPBALL_ONCE 1 // spawn monster only once, ignore "maxlivechildren"
//=========================================================
// MonsterMaker - this ent creates monsters during the game.
//=========================================================
class CMonsterMaker : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void KeyValue( KeyValueData* pkvd);
void EXPORT ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT CyclicUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT MakerThink ( void );
void DeathNotice ( entvars_t *pevChild );// monster maker children use this to tell the monster maker that they have died.
void MakeMonster( void );
void MonsterMakerInit( const char* ChildName, int MaxLiveChildren, int NumMonsters );
static CMonsterMaker *MonsterMakerCreate( const char* ChildName, int MaxLiveChildren, int NumMonsters );
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
string_t m_iszMonsterClassname; // classname of the monster(s) that will be created.
string_t m_iszWarpTarget; // name of the entity which's origin will be used to spawn monsters at.
int m_cNumMonsters;// counter number of monsters this ent should create
int m_cTotalMonstersCount; // number of monsters to create
int m_iChildrenSpawnflags;
int m_cLiveChildren;// how many monsters made by this monster maker that are currently alive
int m_iMaxLiveChildren;// max number of monsters that this maker may have out at one time.
float m_flGround; // z coord of the ground under me, used to make sure no monsters are under the maker when it drops a new child
BOOL m_fActive;
BOOL m_fFadeChildren;// should we make the children fadeout?
BOOL m_fIsWarpBall;
/***
*
* Copyright (c) 1996-2002, 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.
*
****/
//=========================================================
// Monster Maker - this is an entity that creates monsters
// in the game.
//=========================================================
// Monstermaker spawnflags
#define SF_MONSTERMAKER_START_ON 1 // start active ( if has targetname )
#define SF_MONSTERMAKER_CYCLIC 4 // drop one monster every time fired.
#define SF_MONSTERMAKER_MONSTERCLIP 8 // Children are blocked by monsterclip
#define SF_MONSTERMAKER_FIREONCE 16 // kill after all children spawned if not cyclic
#define SF_WARPBALL_ONCE 1 // spawn monster only once, ignore "maxlivechildren"
//=========================================================
// MonsterMaker - this ent creates monsters during the game.
//=========================================================
class CMonsterMaker : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void KeyValue( KeyValueData* pkvd);
void EXPORT ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT CyclicUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT MakerThink ( void );
void DeathNotice ( entvars_t *pevChild );// monster maker children use this to tell the monster maker that they have died.
void MakeMonster( void );
void MonsterMakerInit( const char* ChildName, int MaxLiveChildren, int NumMonsters );
static CMonsterMaker *MonsterMakerCreate( const char* ChildName, int MaxLiveChildren, int NumMonsters );
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
string_t m_iszMonsterClassname; // classname of the monster(s) that will be created.
string_t m_iszWarpTarget; // name of the entity which's origin will be used to spawn monsters at.
int m_cNumMonsters;// counter number of monsters this ent should create
int m_cTotalMonstersCount; // number of monsters to create
int m_iChildrenSpawnflags;
int m_cLiveChildren;// how many monsters made by this monster maker that are currently alive
int m_iMaxLiveChildren;// max number of monsters that this maker may have out at one time.
float m_flGround; // z coord of the ground under me, used to make sure no monsters are under the maker when it drops a new child
BOOL m_fActive;
BOOL m_fFadeChildren;// should we make the children fadeout?
BOOL m_fIsWarpBall;
};

View File

@ -1,136 +1,136 @@
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "items.h"
#include "gamerules.h"
class CNotepad : public CBaseToggle
{
public:
void Spawn( );
void Precache( void );
void EXPORT Off(void);
void EXPORT Recharge(void);
void KeyValue( KeyValueData *pkvd );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
virtual int ObjectCaps( void ) { return (CBaseToggle :: ObjectCaps() | FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
char m_iszText[256];
int m_iTitle;
static TYPEDESCRIPTION m_SaveData[];
float m_flNextCharge;
int m_iReactivate ; // DeathMatch Delay until reactvated
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
};
TYPEDESCRIPTION CNotepad::m_SaveData[] =
{
DEFINE_FIELD( CNotepad, m_flNextCharge, FIELD_TIME),
DEFINE_FIELD( CNotepad, m_iReactivate, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_iJuice, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_iOn, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_flSoundTime, FIELD_TIME),
};
IMPLEMENT_SAVERESTORE( CNotepad, CBaseEntity );
LINK_ENTITY_TO_CLASS(func_notepad, CNotepad);
extern int gmsgNotepad;
extern int gmsgSparePlayer;
void CNotepad::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "dmdelay"))
{
m_iReactivate = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "title"))
{
m_iTitle = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseToggle::KeyValue( pkvd );
FStrEq(pkvd->szKeyName, "text");
sprintf(m_iszText, "%s", pkvd->szValue);
}
void CNotepad::Spawn()
{
Precache( );
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
UTIL_SetOrigin(pev, pev->origin); // set size and link into world
UTIL_SetSize(pev, pev->mins, pev->maxs);
SET_MODEL(ENT(pev), STRING(pev->model) );
m_iJuice = gSkillData.healthchargerCapacity;
pev->frame = 0;
}
void CNotepad::Precache()
{
}
void CNotepad::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
// Make sure that we have a caller
if (!pActivator)
return;
// if it's not a player, ignore
if ( !pActivator->IsPlayer() )
return;
pev->nextthink = pev->ltime + 0.25;
SetThink(&CNotepad::Off);
// Time to recharge yet?
if (m_flNextCharge >= gpGlobals->time)
return;
MESSAGE_BEGIN( MSG_ONE, gmsgNotepad, NULL, GetClassPtr((CBasePlayer *)pActivator->pev)->pev );
WRITE_STRING( m_iszText );
WRITE_BYTE( m_iTitle );
MESSAGE_END();
// govern the rate of charge
m_flNextCharge = gpGlobals->time + 0.1;
}
void CNotepad::Recharge(void)
{
pev->frame = 0;
SetThink( &CNotepad::SUB_DoNothing );
}
void CNotepad::Off(void)
{
m_iOn = 0;
if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0) )
{
pev->nextthink = pev->ltime + m_iReactivate;
SetThink(&CNotepad::Recharge);
}
else
SetThink( &CNotepad::SUB_DoNothing );
}
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "items.h"
#include "gamerules.h"
class CNotepad : public CBaseToggle
{
public:
void Spawn( );
void Precache( void );
void EXPORT Off(void);
void EXPORT Recharge(void);
void KeyValue( KeyValueData *pkvd );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
virtual int ObjectCaps( void ) { return (CBaseToggle :: ObjectCaps() | FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
char m_iszText[256];
int m_iTitle;
static TYPEDESCRIPTION m_SaveData[];
float m_flNextCharge;
int m_iReactivate ; // DeathMatch Delay until reactvated
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
};
TYPEDESCRIPTION CNotepad::m_SaveData[] =
{
DEFINE_FIELD( CNotepad, m_flNextCharge, FIELD_TIME),
DEFINE_FIELD( CNotepad, m_iReactivate, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_iJuice, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_iOn, FIELD_INTEGER),
DEFINE_FIELD( CNotepad, m_flSoundTime, FIELD_TIME),
};
IMPLEMENT_SAVERESTORE( CNotepad, CBaseEntity );
LINK_ENTITY_TO_CLASS(func_notepad, CNotepad);
extern int gmsgNotepad;
extern int gmsgSparePlayer;
void CNotepad::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "dmdelay"))
{
m_iReactivate = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "title"))
{
m_iTitle = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseToggle::KeyValue( pkvd );
FStrEq(pkvd->szKeyName, "text");
sprintf(m_iszText, "%s", pkvd->szValue);
}
void CNotepad::Spawn()
{
Precache( );
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
UTIL_SetOrigin(pev, pev->origin); // set size and link into world
UTIL_SetSize(pev, pev->mins, pev->maxs);
SET_MODEL(ENT(pev), STRING(pev->model) );
m_iJuice = gSkillData.healthchargerCapacity;
pev->frame = 0;
}
void CNotepad::Precache()
{
}
void CNotepad::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
// Make sure that we have a caller
if (!pActivator)
return;
// if it's not a player, ignore
if ( !pActivator->IsPlayer() )
return;
pev->nextthink = pev->ltime + 0.25;
SetThink(&CNotepad::Off);
// Time to recharge yet?
if (m_flNextCharge >= gpGlobals->time)
return;
MESSAGE_BEGIN( MSG_ONE, gmsgNotepad, NULL, GetClassPtr((CBasePlayer *)pActivator->pev)->pev );
WRITE_STRING( m_iszText );
WRITE_BYTE( m_iTitle );
MESSAGE_END();
// govern the rate of charge
m_flNextCharge = gpGlobals->time + 0.1;
}
void CNotepad::Recharge(void)
{
pev->frame = 0;
SetThink( &CNotepad::SUB_DoNothing );
}
void CNotepad::Off(void)
{
m_iOn = 0;
if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0) )
{
pev->nextthink = pev->ltime + m_iReactivate;
SetThink(&CNotepad::Recharge);
}
else
SetThink( &CNotepad::SUB_DoNothing );
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,21 @@
class CTriggerKicker : public CBaseDelay
{
public:
void Spawn( void );
void Think( void );
void KickPlayer( CBasePlayer *pKickMe );
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
private:
CBasePlayer *pPlayerToKick;
};
class CTriggerLockedMission : public CBaseDelay
{
public:
void Spawn( void );
void Think( void );
void Lock( void );
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
class CTriggerKicker : public CBaseDelay
{
public:
void Spawn( void );
void Think( void );
void KickPlayer( CBasePlayer *pKickMe );
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
private:
CBasePlayer *pPlayerToKick;
};
class CTriggerLockedMission : public CBaseDelay
{
public:
void Spawn( void );
void Think( void );
void Lock( void );
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
};

File diff suppressed because it is too large Load Diff