Black Cat Forums   Alien Swarm - Steampowered Forums
Alien Swarm 2K4 - ThieveryUT
Black Cat Games - TTLG Forums

Go Back   Black Cat Forums > Alien Swarm Forums > Alien Swarm SDK Discussion

Reply
 
Thread Tools
Old 26th Aug 2010, 08:43 AM   #1
plaYer2k
New Member
 
Registered: Aug 2010
Posts: 2
Angry Sad Restriction from last patch forced me to cancel my project

EDIT
I made a mistake on porting the changes into our last patch.
Iam sorry to blame the DEVs for it!

But now you can grap the DLL and use those changes ! =)

Beware even if i use this DLL for about 30h+ now there is still NO official guarantee that modded client.dll's dont get you VAC banned.

DOWNLOAD: Tiny HUD - Client.DLL


This shall be my attempt to describe what i changed and why in order to increase useability.
Due to the changes the last patch made, i cancel my attempt to create a useful modded client.dll because its use would be limited to servers with sv_consistency 0 which is by default 1 (and those with sv_consistency 0 get problems with those who changed the scripts to get weapons with about >999999999 ammo + dmg + rof)
I dont know if any of those changes are possible for clients only (that they can always play on ANY server).
And my knowledge of c++ is very limited, to be honest its the first time i use that language.


Its very sad as this game is - at least for my understanding - meant to be a community based and supported game. It has been published with source code to be modded.
And even custom maps dont download automaticly (which a skilled modder could implement into a dll)

But anyway here are the changes i made so far and i hope they will be used to make this game better.




=> First of all i removed a very odd and pointles Cheat-Flags


)> viewpostprocess.cpp
Code:
// I dont see any reason to flag this command as cheat. Therefor i unflagged it.
// It takes off a lot of performance and helps people with slower machines to enjoy this game.
static ConVar mat_postprocess_enable( "mat_postprocess_enable", "0", FCVAR_ARCHIVE );
<( viewpostprocess.cpp




=> Introducing a scalable Fast Reload Bar
Since the original was absolutely useles due to its tiny size, making it scalable finally made it useful! video


)> asw_hud_3dmarinenames.cpp
Code:
ConVar asw_fast_reload_under_marine_scale( "asw_fast_reload_under_marine_scale" , "2" , FCVAR_ARCHIVE , "Scales the original Fast Reload Bar" , true , 1 , true , 12);

//The following changes involve Line 1134ff where i did rescale and reposition the Reload Bar it.
	int class_icon_size = GetClassIconSize( true ); //this seems to alwaays return 0
	int t = GetHealthBarMaxHeight( false ); // those  commands return the size of Healtbars
	int w = GetHealthBarMaxWidth( false );  // which is right under every marine
	w *= asw_fast_reload_under_marine_scale.GetFloat(); // Here i did scale up the width

	int iGap = YRES( 2 );
	int overall_width = w + iGap + class_icon_size;
	
	xPos += class_icon_size + iGap;
	yPos += ( class_icon_size - t ) / (2 * asw_fast_reload_under_marine_scale.GetFloat()); //because the height of our new reload bar changes, we have to reposition it according on the scale 
	t *= asw_fast_reload_under_marine_scale.GetFloat(); //and then finally scale the height up
<( asw_hud_3dmarinenames.cpp




=> Drop Extra-items (like dropping weapons)
I dont know why we cant drop extras, we can do so for weapons. video

)> asw_concommands.cpp
Code:
void ASW_DropExtra_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());;
	
	if (pPlayer && pPlayer->GetMarine())
	{
		CASW_Marine *pMarine = pPlayer->GetMarine();
		if (pMarine->GetFlags() & FL_FROZEN)	// don't allow this if the marine is frozen
			return;
		if (pPlayer->GetFlags() & FL_FROZEN)
			return;
		
		CBaseCombatWeapon *pWeapon = pMarine->GetWeapon(ASW_INVENTORY_SLOT_EXTRA);
		if (!pWeapon)
			return;
		pMarine->DropWeapon(ASW_INVENTORY_SLOT_EXTRA,true);

		IGameEvent * event = gameeventmanager->CreateEvent( "player_dropped_weapon" );
		if ( event )
		{
			event->SetInt( "userid", pPlayer->GetUserID() );

			gameeventmanager->FireEvent( event );
		}
	}
}
ConCommand ASW_DropExtra( "ASW_DropExtra", ASW_DropExtra_f, "Makes your marine drop his current extra", 0 );
<( asw_concommands.cpp




=> Removing the display cap for stats.
In stats summary we had some limitations where scores got capped. (e.g. 100+ kills, 500+ heal)
With the following code you remove that.

I did copy the whole switch-case in here but the limitations only involved
ASW_XP_KILLS, ASW_XP_FRIENDLY_FIRE, ASW_XP_DAMAGE_TAKEN, ASW_XP_HEALING and ASW_XP_HACKING.

)> experience_stat_line.cpp
Code:
	switch( m_XPType )
	{
		case ASW_XP_MISSION:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d%%", pPlayer->GetStatNumXP( ASW_XP_MISSION ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_MISSION ), flMissionRate, true, false );
			m_pStatsBar->AddMinMax( 0, 1000 );
			break;
		}

		case ASW_XP_KILLS:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d", pPlayer->GetStatNumXP( ASW_XP_KILLS ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_KILLS ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 100 );
			break;
		}

		case ASW_XP_TIME:
		{
			int nTime = pPlayer->GetStatNumXP( ASW_XP_TIME );
			wchar_t num[ 8 ];

			int nMinutes = nTime / 60;
			int nSeconds = nTime - nMinutes * 60;

			V_snwprintf( num, sizeof( num ), L"%d:%02d", nMinutes, nSeconds );

			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_TIME ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 100 );
			break;
		}

		case ASW_XP_FRIENDLY_FIRE:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d", pPlayer->GetStatNumXP( ASW_XP_FRIENDLY_FIRE ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_FRIENDLY_FIRE ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 100 );
			break;
		}

		case ASW_XP_DAMAGE_TAKEN:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d", pPlayer->GetStatNumXP( ASW_XP_DAMAGE_TAKEN ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_DAMAGE_TAKEN ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 100 );
			break;
		}

		case ASW_XP_HEALING:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d", pPlayer->GetStatNumXP( ASW_XP_HEALING ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_HEALING ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 50 );
			break;
		}

		case ASW_XP_HACKING:
		{
			wchar_t num[ 8 ];
			V_snwprintf( num, sizeof( num ), L"%d", pPlayer->GetStatNumXP( ASW_XP_HACKING ) );
			m_pStatNum->SetText( num );

			m_pStatsBar->Init( 0, pPlayer->GetEarnedXP( ASW_XP_HACKING ), flRate, true, false );
			m_pStatsBar->AddMinMax( 0, 50 );
			break;
		}
	}
<( experience_stat_line.cpp




=> Colored MapLines
Public games can be a mess with four players painting stupide pictures over the minimap.
This addon paints each MapLine with the players color and you know who painted what.
It should help dealing with "unwanted" paintings as admin or improving tactical briefings. video

First of all i did create a common colorbase where the different files get the color from.

)> p2k_colordef.cpp
Code:
#include "cbase.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

static Color getColorPerIndex(int player_index)
{
	switch(player_index)
	{
		case 1:
			return Color( 225, 60, 60, 255 );	//red
			break;
		case 2:
			return Color( 200, 200, 60, 255 );	//yellow
			break;
		case 3:
			return Color( 60, 225, 60, 255 );	//green
			break;
		case 4:
			return Color( 30, 90, 225, 255 );	//blue
			break;
		case 5:
			return Color( 225, 30, 190, 255 );	//pink
			break;
		case 6:
			return Color( 30, 225, 225, 255 );	//cyan
			break;
		case 7:
			return Color( 255, 255, 255, 255 );	//white
			break;
		default:
			return Color( 255, 150, 0, 255 );	//orange
			break;
	}
}

#define STATS_MAX_PLAYER_OVERRIDE 5
<( p2k_colordef.cpp

The following change edits the color players are painted within the stats screen after a mission.

)> stats_report.cpp
Code:
#include "p2k_colordef.cpp"

/* Line 165 */	m_pObjectiveMap->AddBlip( MapBlip_t( vPos, bDead ? Color( 255, 255, 255, 255 ) : getColorPerIndex(pMR->GetCommanderIndex()), bDead ? MAP_BLIP_TEXTURE_DEATH : MAP_BLIP_TEXTURE_NORMAL ) );

/* Line 316 */	Color color = getColorPerIndex(pMR->GetCommanderIndex());

<( stats_report.cpp

Now lets change that file which draws the MapLines on minimap

I dont know why the changes work when only performed here since asw_hud_minimap.cpp (Line 1093 - 1185) seems to do the same.

)> objectivemap.cpp

/* Line 523 */	vgui::surface()->DrawSetColor(getColorPerIndex(pMinimap->m_MapLines[i].player_index));

/* Line 534 */	vgui::surface()->DrawSetColor(getColorPerIndex(pMinimap->m_MapLines[i].player_index));
<( objectivemap.cpp




=> The Following change removes the "<NOT BOUND>" text on HUD when no key was bound to a slot.

)> asw_input.cpp
Code:
/* Line 1349 */	return "";
<( asw_input.cpp


=> Unlocking more than 4 Portraits on HUD
The Scaling works good for 5-6 players but 8 players dont work beacse they get out of scale.

)> asw_hud_marine_portrait.cpp
Code:
/* Line  */	if ( ASWGameResource() )
		{			
			float fOthersMarineScale =  (m_hMarineResource.Get() && m_hMarineResource->GetCommander() == pPlayer) ? 1.0f : 0.8f;			// scale down marines owned by other players
			fOthersMarineScale *= 4.0f / ASWGameResource()->GetNumMarineResources();
			SetScale(fOthersMarineScale);
		}
<( asw_hud_marine_portrait.cpp


=> Unlocking 8+ players
The whole problem is basicly a limitation within asw_shareddefs.h video

BEWARE!!! you should not mess with shared files that much, because it messes up client-server stability and usualy leads to crashes!
Some other .cpp's and .h's had fixed limitations like "i < 4" etc. which i dont remember anymore.

)> asw_shareddefs.h
Code:
#define ASW_MAX_PLAYERS 8 //Line 53

#define ASW_MAX_READY_PLAYERS 8 //Line 55
<( asw_shareddefs.h

Now you just unlucked more playerslots. Lets make them visible in Lobby.
I also added a CVar to select between multiple layouts.

)> nb_main_panel.cpp
Code:
ConVar p2k_lobby_scheme("p2k_lobby_scheme" , "0" , FCVAR_ARCHIVE , "Use different lobby schemes ? (0 = default, 1 & 2 = 8 Player styles)" , true , 0 , true , 2);

// Line 73
// Those added Rows let the game show more slots.
	m_pLobbyRow4 = new CNB_Lobby_Row_Small( this, "LobbyRow4" );
	m_pLobbyRow5 = new CNB_Lobby_Row_Small( this, "LobbyRow5" );
	m_pLobbyRow6 = new CNB_Lobby_Row_Small( this, "LobbyRow6" );
	m_pLobbyRow7 = new CNB_Lobby_Row_Small( this, "LobbyRow7" );

// Line 98
// Assign them to a slot
	m_pLobbyRow4->m_nLobbySlot = 4;
	m_pLobbyRow5->m_nLobbySlot = 5;
	m_pLobbyRow6->m_nLobbySlot = 6;
	m_pLobbyRow7->m_nLobbySlot = 7;

// Line 128
// This let the engine load the different schemes to display the lobby
// Those files must be present!
// It would be a good idea to perform a check on its existence before we load them but i dont know a command for that.
// (e.g. "if(p2k_lobby_scheme.GetInt() == 1) && _FileExists_("resource/ui/p2k_nb_main_panel_1.res"))")
// Changing the .res files is pretty easy and contains some try and error because some positions are relative to others and some seem to be absolute.
	if (p2k_lobby_scheme.GetInt() == 1)
		LoadControlSettings( "resource/ui/p2k_nb_main_panel_1.res" );
	else if (p2k_lobby_scheme.GetInt() == 2)
		LoadControlSettings( "resource/ui/p2k_nb_main_panel_2.res" );
	else
		LoadControlSettings( "resource/ui/nb_main_panel.res" );

// Line 203
// Add the tooptips
		m_pLobbyRow4->CheckTooltip( m_pLobbyTooltip );
		m_pLobbyRow5->CheckTooltip( m_pLobbyTooltip );
		m_pLobbyRow6->CheckTooltip( m_pLobbyTooltip );
		m_pLobbyRow7->CheckTooltip( m_pLobbyTooltip );
<( nb_main_panel.cpp



=> Allow multiple character selection
To unlock >8 player games it was necessary to select a character more than once.
Therefor i changed the way characterselection was handled and made a counter of it.
This is still buggy atm because the weaponselection doenst work well and only <=9 Marines can spawn.
AGAIN! THIS IS STILL BUGGY! video :-)

The DEVs did use three numbers to represent the state of "usage" for a certain characterprofile.
0 = unused, 1 = used, 2 = reserved
Now i had to change this to either count upward and make an exception for 2 which was crap or just change it to -1 = reserved, 0 = unused, >0 = number of taken characterprofiles. I of course did the last thing but this might need a change too since the code looks for the through the array for the first (which is on single selection the ONLY) occuring characterprofile and not the matching for multiselection.

First we need to add a new function which to seperate if a character is SELECTED and still SELECTABLE.

)> asw_game_resource.h
Code:
	bool IsRosterSelectable(int i); // Line 73 Add this

<( asw_game_resource.h

)> c_asw_game_resource.h

	bool IsRosterSelectable(int i); // Line 56 Add this
<( c_asw_game_resource.h

Now we can change the working code.

)> asw_game_resource.cpp
Code:
extern ConVar p2k_marine_multiselect_max;

// Line 424
// The following code is Copy & Paste and includes the change from 2 = reserverd to -1 = reserved
// plus the count upward on RosterSet(i , 1) and down for RosterSet(i , 0)
bool CASW_Game_Resource::IsRosterSelected(int i)
{
	Msg("Selected: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;

	return m_iRosterSelected[i] >= 0;
}

bool CASW_Game_Resource::IsRosterSelectable(int i)
{
	Msg("Selectable: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;

	return m_iRosterSelected[i] < p2k_marine_multiselect_max.GetInt();
}

bool CASW_Game_Resource::IsRosterReserved(int i)
{
	Msg("Reserved: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;

	return m_iRosterSelected[i] == -1;
}

void CASW_Game_Resource::SetRosterSelected(int i, int iSelected)
{
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return;
	
	// update num selected
	if (iSelected == 1 && m_iRosterSelected[i] < p2k_marine_multiselect_max.GetInt())
	{
		m_iNumMarinesSelected++;
		m_iRosterSelected.Set(i, (m_iRosterSelected[i] + 1));
	}
	else if (iSelected == 0 && m_iRosterSelected[i] <= p2k_marine_multiselect_max.GetInt())
	{
		m_iNumMarinesSelected--;
		m_iRosterSelected.Set(i, (m_iRosterSelected[i] - 1));
	}
}
<( asw_game_resource.cpp

)> c_asw_game_resource.cpp
Code:
extern ConVar p2k_marine_multiselect_max;

//Line 120
// Same here as in asw_game_resource.cpp
bool C_ASW_Game_Resource::IsRosterSelected(int i)
{
	Msg("Selected: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;

	return m_iRosterSelected[i] != 0;
}

bool C_ASW_Game_Resource::IsRosterSelectable(int i)
{
	Msg("Selectable: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;

	return m_iRosterSelected[i] < p2k_marine_multiselect_max.GetInt();
}

bool C_ASW_Game_Resource::IsRosterReserved(int i)
{
	Msg("Reserved: m_iRosterSelected[ %i ] = %i\n",i,m_iRosterSelected[i]);
	if (i<0 || i>=ASW_NUM_MARINE_PROFILES)
		return false;
	return m_iRosterSelected[i] == -1;
}
<( c_asw_game_resource.cpp

Now we need to change the gamerulse in order to let the game use our changes proppertly.
I did comment some slotreservation out since iam not sure if that might bug the whole selection thing. This is not dokumented here.
Most changes are !ASWGameResource()->IsRosterSelected(i) to ASWGameResource()->IsRosterSelectable(i) because what is Selected can not still be selectable due to the higher maximum slots.

)> asw_gamerules.cpp
Code:
ConVar p2k_marine_multiselect_max("p2k_marine_multiselect_max", "3" , FCVAR_REPLICATED , "How many times can a Marine be selected" , true , 1 , true , 5 );

/* Line 977 changed */	if (ASWGameResource()->IsRosterSelectable(i))

/* Line 1198 changed */	if (ASWGameResource()->IsRosterSelectable(RosterIndex))

/* Line 1216 added false to bypass */	if (pMR && pMR->GetProfileIndex() == RosterIndex && false)
<( asw_gamerules.cpp



source
crosslink to steamforums

I Hope to not leave any imortant information out. Have Fun
p2k

Last edited by plaYer2k; 30th Aug 2010 at 11:45 AM. Reason: Status Changed
plaYer2k is offline   Reply With Quote
Old 26th Aug 2010, 11:39 AM   #2
Kein
New Member
 
Registered: Apr 2009
Posts: 14
BUMP.
At last resizebale reload bar must be implemented!
Kein is offline   Reply With Quote
Old 30th Aug 2010, 11:41 AM   #3
plaYer2k
New Member
 
Registered: Aug 2010
Posts: 2
well ... iam SORRY but i made a mistake and failed the port

i ported the patch into my working version using a differencer but that seem to caused the bug

again iam sorry to blame the devs for a change they didnt do!


a full redone change from original source works good and will be uploaded, we just need an official confirmation that modded client.dll's dont get you VAC Banned
i use my modded dll for about 30h ingame now and nothing happened to me but that is no guarantee.
plaYer2k is offline   Reply With Quote
Reply

Tags
bump!


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Project 'RIFT' Donator Alien Swarm 2K4 Mapping 73 22nd Aug 2014 03:36 PM
Forced Door is not forcing disco Alien Swarm SDK Discussion 1 30th Jul 2010 04:57 AM
OptionsMut Restriction Help Stein Alien Swarm 2K4 Tech Help 6 8th Jun 2010 09:47 PM
How To: Disable forced inventory items. ]>CoD<[Chief Thievery Mapping 28 23rd May 2007 07:24 AM
forced equip {DB-Homicidal} Alien Swarm 2K4 Mapping 5 25th Jul 2004 02:10 AM


All times are GMT -5. The time now is 10:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, vBulletin Solutions, Inc.