Skip to content

Commit

Permalink
Commit HL: Invasion changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
malortie committed Sep 18, 2021
1 parent 4b05251 commit 3dffbec
Show file tree
Hide file tree
Showing 143 changed files with 26,746 additions and 646 deletions.
88 changes: 87 additions & 1 deletion cl_dll/StudioModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
#include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h"

// modif de Julien
#include "pm_defs.h"
#include "event_api.h"
extern vec3_t v_angles, v_origin;

int g_modif = 0; // horreur pour que les models ne se dessinent que deux fois

extern cvar_t *tfc_newmodels;

extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1];
Expand Down Expand Up @@ -700,6 +707,31 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
break;

}

// -------------------------------
// modif de Julien
// vision infrarouge
// -------------------------------

if ( g_modif == 1 )
{
vec3_t src ( transform[0][3], transform[1][3], transform[2][3] );// origine bizaroïde du monstre dans la 4eme dimension
vec3_t offset = ( v_origin - src );

float rayon = 10; // distance oeil - 2e model
float dist = offset.Length(); // distance oeil - 1e model
float scale = ( rayon / dist );

offset = offset.Normalize() * ( dist - rayon );

transform[0][3] += offset.x;
transform[1][3] += offset.y;
transform[2][3] += offset.z;

VectorScale( transform[0], scale, transform[0] );
VectorScale( transform[1], scale, transform[1] );
VectorScale( transform[2], scale, transform[2] );
}
}

/*
Expand Down Expand Up @@ -1201,8 +1233,10 @@ int CStudioModelRenderer::StudioDrawModel( int flags )

if (flags & STUDIO_RENDER)
{
nvg_ennemy_t *p = gHUD.m_NVG.IsEnnemy ( m_pCurrentEntity->index );

// see if the bounding box lets us trivially reject, also sets
if (!IEngineStudio.StudioCheckBBox ())
if (!IEngineStudio.StudioCheckBBox () && p == NULL )
return 0;

(*m_pModelsDrawn)++;
Expand Down Expand Up @@ -2081,6 +2115,58 @@ void CStudioModelRenderer::StudioRenderFinal_Hardware( void )
IEngineStudio.StudioDrawPoints();
IEngineStudio.GL_StudioDrawShadow();
}

//modifs de julien

nvg_ennemy_t *p = gHUD.m_NVG.IsEnnemy(m_pCurrentEntity->index);

if ( p != NULL )
{
// modification de la position

g_modif = 1;

StudioSetupBones( );
StudioSaveBones( );

g_modif = 0;

// modification de l'eclairage

alight_t lighting;
lighting.plightvec = Vector(0,0,0);
IEngineStudio.StudioDynamicLight(gEngfuncs.GetLocalPlayer(), &lighting );

if ( p->color.x == 0 && p->color.y == 0 && p->color.z == 0 )
p->color = Vector (1,0,0);

lighting.color = Vector(p->color.x , p->color.y, p->color.z);

IEngineStudio.StudioEntityLight( &lighting );
IEngineStudio.StudioSetupLighting (&lighting);

m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF;
m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8;
IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );

// affichage

/*
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
IEngineStudio.StudioDrawPoints();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
*/

for ( int z = 0 ; z < m_pStudioHeader->numbodyparts ; z++)
{
IEngineStudio.StudioSetupModel( z, (void **)&m_pBodyPart, (void **)&m_pSubModel );

IEngineStudio.GL_SetRenderMode( kRenderTransAdd );
IEngineStudio.StudioDrawPoints();
IEngineStudio.GL_StudioDrawShadow();

}
}
}

if ( m_pCvarDrawEntities->value == 4 )
Expand Down
53 changes: 43 additions & 10 deletions cl_dll/ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,13 @@ int CHudAmmo::DrawWList(float flTime)
else
iActiveSlot = gpActiveSel->iSlot;

x = 10; //!!!
y = 10; //!!!
// x = 10; //!!!
// y = 10; //!!!

//modif de Julien

x = ScreenWidth - 5 * (giBucketWidth + 5); // haut-gauche du weaponmenu
y = 10;

// Ensure that there are available choices in the active slot
if ( iActiveSlot > 0 )
Expand All @@ -1048,15 +1052,15 @@ int CHudAmmo::DrawWList(float flTime)
UnpackRGB(r,g,b, RGB_YELLOWISH);

if ( iActiveSlot == i )
a = 255;
a = 255; // Julien - fx amount slot selectionné
else
a = 192;
a = 192; // Julien - fx amount slot deselectionné

ScaleColors(r, g, b, 255);
SPR_Set(gHUD.GetSprite(m_HUD_bucket0 + i), r, g, b );

// make active slot wide enough to accomodate gun pictures
if ( i == iActiveSlot )
/* if ( i == iActiveSlot )
{
WEAPON *p = gWR.GetFirstPos(iActiveSlot);
if ( p )
Expand All @@ -1068,18 +1072,46 @@ int CHudAmmo::DrawWList(float flTime)
iWidth = giBucketWidth;
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i));

x += iWidth + 5;
*/

//-----------------------
// modif de Julien

iWidth = giBucketWidth;

if ( i == iActiveSlot )
{
SPR_Set(gHUD.GetSprite(m_HUD_bucket0 + i + 5), r, g, b );
SPR_DrawAdditive (
0, ScreenWidth - 5 * (giBucketWidth + 5), 10,
&gHUD.GetSpriteRect(m_HUD_bucket0 + i + 5)
);
}
else
{
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_bucket0 + i));
}

//-----------------


x += iWidth + 4;
}


a = 128; //!!!
x = 10;
// x = 10;

// modif de Julien
x = ScreenWidth - 5 * (giBucketWidth + 5); // haut-gauche du weaponmenu

// Draw all of the buckets
for (i = 0; i < MAX_WEAPON_SLOTS; i++)
{
y = giBucketHeight + 10;
//y = giBucketHeight + 10;

//modif de Julien
y = gHUD.GetSpriteRect(m_HUD_bucket0 + i + 5).bottom - gHUD.GetSpriteRect(m_HUD_bucket0 + i + 5).top + 10 + 5;

// If this is the active slot, draw the bigger pictures,
// otherwise just draw boxes
Expand Down Expand Up @@ -1135,7 +1167,7 @@ int CHudAmmo::DrawWList(float flTime)
x += iWidth + 5;

}
else
/* else
{
// Draw Row of weapons.
Expand Down Expand Up @@ -1166,6 +1198,7 @@ int CHudAmmo::DrawWList(float flTime)
x += giBucketWidth + 5;
}
*/
}

return 1;
Expand Down
104 changes: 104 additions & 0 deletions cl_dll/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ int CHudBattery::Init(void)

gHUD.AddHudElem(this);

// modif de Julien
m_sprCorps = SPR_Load("sprites/hud_health_body.spr");
m_wrcCorps = CreateWrect ( 0, 0, 144, 152 );

for ( int i=0; i<MAX_ARMOR_GROUP; i++ )
{
m_flArmor [i] [0] = 0;
m_flArmor [i] [1] = 0;
m_flArmor [i] [2] = 0;
}


return 1;
};

Expand All @@ -51,6 +63,18 @@ int CHudBattery::VidInit(void)
m_prc2 = &gHUD.GetSpriteRect( HUD_suit_full );
m_iHeight = m_prc2->bottom - m_prc1->top;
m_fFade = 0;

// modif de Julien
m_sprCorps = SPR_Load("sprites/hud_health_body.spr");
m_wrcCorps = CreateWrect ( 0, 0, 144, 152 );

for ( int i=0; i<MAX_ARMOR_GROUP; i++ )
{
m_flArmor [i] [0] = 0;
m_flArmor [i] [1] = 0;
m_flArmor [i] [2] = 0;
}

return 1;
};

Expand All @@ -76,6 +100,42 @@ int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
m_fFade = FADE_TIME;
m_iBat = x;
}

// modif de Julien

float unTiers = ( (float)MAX_MEMBER_ARMOR / 3 );
float deuxTiers = ( (float)MAX_MEMBER_ARMOR * 2 / 3 );

for ( int i=0; i<MAX_ARMOR_GROUP; i++ )
{
// lecture
float value = READ_COORD();

// dommages

if ( value > m_flArmorvalue[i] )
m_flPain[i] = ARMOR_PAIN_TIME;

else if ( value < m_flArmorvalue[i] )
m_flPain[i] = -ARMOR_PAIN_TIME;

m_flArmorvalue [i] = value;

// couleurs

/* horreur pour simplifier les couleurs :
blanc 255 255 255
jaune 255 255 0
orange 255 128 0
rouge 255 0 0
*/

m_flArmor [i] [0] = (int)( value > unTiers ? 255 : ( value / unTiers ) * ( 255 - 150 ) + 150 );
m_flArmor [i] [1] = (int)( value > deuxTiers ? 255 : ( value / deuxTiers ) * 255 );
m_flArmor [i] [2] = (int)( value < deuxTiers ? 0 : ( (value - deuxTiers) / unTiers ) * 255 );

}

#endif

return 1;
Expand All @@ -87,6 +147,11 @@ int CHudBattery::Draw(float flTime)
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
return 1;

// modif de jUlien
if ( !(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) )
return 1;

/*
int r, g, b, x, y, a;
wrect_t rc;
Expand Down Expand Up @@ -153,6 +218,45 @@ int CHudBattery::Draw(float flTime)
x += (m_prc1->right - m_prc1->left);
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b);
*/


// modif de Julien
// affichage du nouveau hud

for ( int i = 0; i < 7; i++ )
{
// couleurs précalculées
int r = m_flArmor[i][0], g = m_flArmor[i][1], b = m_flArmor[i][2];

// brillance pour les dommages
if ( m_flPain[i] > 0 )
{
// blanc
r = r + ( m_flPain[i] / ARMOR_PAIN_TIME ) * ( 255 - r );
g = g + ( m_flPain[i] / ARMOR_PAIN_TIME ) * ( 255 - g );
b = b + ( m_flPain[i] / ARMOR_PAIN_TIME ) * ( 255 - b );

m_flPain[i] = std::max ( 0, m_flPain[i] - gHUD.m_flTimeDelta );
}

if ( m_flPain[i] < 0 )
{
// rouge
r = r + ( -m_flPain[i] / ARMOR_PAIN_TIME ) * ( 255 - r );
g = g + ( -m_flPain[i] / ARMOR_PAIN_TIME ) * ( 0 - g );
b = b + ( -m_flPain[i] / ARMOR_PAIN_TIME ) * ( 0 - b );

m_flPain[i] = std::min ( 0, m_flPain[i] + gHUD.m_flTimeDelta );
}

ScaleColors ( r,g,b, 200 );

SPR_Set( m_sprCorps, r, g, b );
SPR_DrawAdditive(i, 0, 0, &m_wrcCorps);
}

//-----------------------

return 1;
}
Loading

0 comments on commit 3dffbec

Please sign in to comment.