I'm making a mod for HL1 based on SDK2.3 and i need to insert the 3dskybox ability. I tried to copy it from Spirit, but it doesnt work, cause i'm not a coder, and may be i missed some little things. If here are some experienced guys, can you help me please to complete my task.
I show below what exactly i did, if you'll see something missing, gratefuly if you correct it
THIS below IS IN HL.DLL
effects.cpp added a class:
[blue]
class CEnvSky : public CBaseEntity
{
public:
void Activate( void );
void Think( void );
};void CEnvSky :: Activate ( void )
{
pev->effects |= EF_NODRAW;
pev->nextthink = gpGlobals->time + 1.0;
}extern int gmsgSetSky;
void CEnvSky :: Think ()
{
MESSAGE_BEGIN(MSG_BROADCAST, gmsgSetSky, NULL);
WRITE_BYTE(1); // mode
WRITE_COORD(pev->origin.x); // view position
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
MESSAGE_END();
}LINK_ENTITY_TO_CLASS( env_sky, CEnvSky );
[/blue]
then i went toplayer.cpp and after line
int gmsgTeamNames = 0;
i put:
int gmsgSetSky = 0;
In same file, i found:
gmsgSelAmmo = REG_USER_MSG("SelAmmo", sizeof(SelAmmo));
and put nearby:
gmsgSetSky = REG_USER_MSG( "SetSky", 7 );
At this i've finished working in hl.dll
Go to c_dll.dll
Open hud.cpp
find:
//DECLARE_MESSAGE(m_Logo, Logo)
int __MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf)
{
return gHUD.MsgFunc_ResetHUD(pszName, iSize, pbuf );
}and put after that this new code:
[blue]
int __MsgFunc_SetSky(const char *pszName, int iSize, void *pbuf)
{
gHUD.MsgFunc_SetSky( pszName, iSize, pbuf );
return 1;
}[/blue]
In same file find this line:
HOOK_MESSAGE( Concuss );
and put neraby:
HOOK_MESSAGE( SetSky );
Now i go to hud.h
and before this line:
class CHud
i put:
#define SKY_OFF 0
#define SKY_ON 1
in same file, after this line:
int GetNumWidth(int iNumber, int iFlags);
i put:
Vector m_vecSkyPos;
int m_iSkyMode;
next, i find this existing line:
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
and put nearby:
void _cdecl MsgFunc_SetSky( const char *pszName, int iSize, void *pbuf );
now i go to hud_msg.cpp
find:
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
and after braket i put:
m_iSkyMode = SKY_OFF;
it must come like that:
[blue]
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
m_iSkyMode = SKY_OFF;
// prepare all hud data
HUDLIST *pList = m_pHudList;
while (pList)
{
if ( pList->p )
pList->p->InitHUDData();
pList = pList->pNext;
}
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
}[/blue]
and below i put:
[blue]
void CHud :: MsgFunc_SetSky( const char *pszName, int iSize, void *pbuf )
{
// CONPRINT("MSG:SetSky");
BEGIN_READ( pbuf, iSize );
m_iSkyMode = READ_BYTE();
m_vecSkyPos.x = READ_COORD();
m_vecSkyPos.y = READ_COORD();
m_vecSkyPos.z = READ_COORD();
}[/blue]
open view.cpp
find:
void V_CalcNormalRefdef ( struct ref_params_s *pparams )
and in the end of it i put this:
[blue]
if (gHUD.m_iSkyMode == SKY_ON && pparams->nextView == 0)
{
pparams->vieworg[0] = gHUD.m_vecSkyPos.x;
pparams->vieworg[1] = gHUD.m_vecSkyPos.y;
pparams->vieworg[2] = gHUD.m_vecSkyPos.z;
pparams->nextView = 1;
}[/blue]
in the same file find this:
view = gEngfuncs.GetViewModel();
and after i put this:
[blue]
if (gHUD.m_iSkyMode == SKY_ON)
{
savedviewmodel = view->model;
view->model = NULL;
}[/blue]
Im really noob in the programming and need your help!
It could be nice tutor for newbies like me if to finish it with help of expirienced dads