Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Опубликовано:

Now that we can make the client download custom IWD's is there a way to ADD more UI elements and sounds? (not replacing old ones) i know that i can use things like

 

self playsound "mp_whatever"

 

but they are sounds already in the game, it would be nice if i could add more 8-) , thanks

Featured Replies

Опубликовано:

it's in my sig :lol: and add more sounds? impossibru?

actually no, it worked in cod 4 and i saw a mod for mw2 which added customsounds and even the juggernaut-screen from mw3. it's definitely possible, we just don't know how ._.

that's why we bump it this hard.

Опубликовано:
actually no, it worked in cod 4 and i saw a mod for mw2 which added customsounds and even the juggernaut-screen from mw3. it's definitely possible, we just don't know how ._.

that's why we bump it this hard.

 

Bumpitybumpbump, I'd love to know as well, as I couldn't get it to work either. :?

Bumperdebump.

Опубликовано:

It's not possible to add "new" sounds, however, it's possible to replace the already existing sounds and make the clients download them. NTA made custom .IWI loading (for example, the prestige 11 icon), but custom mod .iwi loading isn't implemented yet.

 

The reason why it worked in CoD4 was because it had mod tools. Mw2 does not.

Опубликовано:
It's not possible to add "new" sounds, however, it's possible to replace the already existing sounds and make the clients download them. NTA made custom .IWI loading (for example, the prestige 11 icon), but custom mod .iwi loading isn't implemented yet.

 

The reason why it worked in CoD4 was because it had mod tools. Mw2 does not.

 

So you could use a "new" sound for a mod, but name it like one of the pre-exsisting ones?

Опубликовано:

PatchMW2Materialism.cpp

// ==========================================================
// IW4M project
// 
// Component: clientdll
// Sub-component: steam_api
// Purpose: Material/image modification code
//
// Initial author: NTAuthority
// Started: 2011-06-09
// ==========================================================

#include "StdInc.h"
#include 
#include 
#include 

using google::dense_hash_map;

//static dense_hash_map> materialTable;
static dense_hash_map> materialTable;

unsigned int R_HashString(const char* string)
{
unsigned int hash = 0;

while (*string)
{
	hash = (*string | 0x20) ^ (33 * hash);
	string++;
}

return hash;
}

typedef int (__cdecl * _Reader_t)(int, int); // defaulting to int for now
typedef bool (__cdecl * Image_LoadFromFileWithReader_t)(Image* image, _Reader_t reader);
Image_LoadFromFileWithReader_t Image_LoadFromFileWithReader = (Image_LoadFromFileWithReader_t)0x53ABF0;

typedef void (__cdecl * Image_Release_t)(Image* image);
Image_Release_t Image_Release = (Image_Release_t)0x51F010;

// a3 is 'disable data needed for smoothing' or so, maybe 'do not auto-generate mipmaps'?
Image* Image_Alloc(const char* name, char a2, char a3, char a4)
{
Image* memory = (Image*)malloc(sizeof(Image) + strlen(name) + 1);
memset(memory, 0, sizeof(Image));

memory->a2 = a2;
memory->a3 = a3;
memory->a4 = a4;
memory->name = ((char*)memory) + sizeof(Image);
strcpy(memory->name, name);

return memory;
}

Image* Image_Load(const char* name)
{
Image* image = Image_Alloc(name, 3, 0, 0);
Image_LoadFromFileWithReader(image, (_Reader_t)/*0x42ECA0*/0x46CBF0);
return image;
}

static unsigned char stateMapCopy[8];
static bool stateMapCopied = false;

static void Material_InitializeStateMap()
{
if (stateMapCopied) return;

Material* base = (Material*)DB_FindXAssetHeader(ASSET_TYPE_MATERIAL, "ui_cursor");
memcpy(stateMapCopy, base->stateMap, 8);
stateMapCopied = true;
}

Material* Material_Create(const char* name, const char* imageFile)
{
Material* material = new Material;
memset(material, 0, sizeof(Material));

material->maps = new MaterialImage;
memset(material->maps, 0, sizeof(MaterialImage));

Material_InitializeStateMap();

material->name = name;
//material->flags = 0x2F00;
material->flags = 0x2200;
material->animationX = 1;
material->animationY = 1;
material->unknown2 = 0xFFFFFFFF;
material->unknown3 = 0xFFFFFF00;
memset(material->unknown4, 0xFF, sizeof(material->unknown4));
material->numMaps = 1;
material->unknownCount2 = 1;
material->unknown6 = 3;
material->unknown7 = 4;
material->techniqueSet = DB_FindXAssetHeader(ASSET_TYPE_TECHSET, "2d");

material->maps->typeHash = R_HashString("colorMap");
material->maps->firstCharacter = 'c';
material->maps->secondLastCharacter = 'p';
material->maps->unknown = 0xE2; // causes some nice filtering
material->maps->image = Image_Load(imageFile);

material->stateMap = stateMapCopy;

return material;
}

Material* Material_Obtain(const char* name, const char* imageFile)
{
if (!materialTable[name])
{
	materialTable[name] = Material_Create(name, imageFile);
}

return materialTable[name];
}

void Material_Delete(const char* name, const char* imageCondition)
{
if (materialTable[name])
{
	if (!imageCondition)
	{
		materialTable[name] = NULL;
	}
	else
	{
		if (!_stricmp(materialTable[name]->maps[0].image->name, imageCondition))
		{
			Image_Release(materialTable[name]->maps[0].image);
			free(materialTable[name]->maps[0].image);
			materialTable[name] = NULL;
		}
	}
}
}

const char* LoadScreens_Filename();

Material* Material_Register(const char* filename)
{
if (!_stricmp(filename, "preview_oilrig"))
{
	return Material_Obtain(filename, filename);
}

if (!_stricmp(filename, "preview_gulag"))
{
	return Material_Obtain(filename, filename);
}

if (!_stricmp(filename, "preview_invasion"))
{
	return Material_Obtain(filename, filename);
}

if (!_stricmp(filename, "cardicon_t5_prestige_1"))
{
	return Material_Obtain(filename, filename);
}

if (!_stricmp(filename, "hud_icon_wager"))
{
	return Material_Obtain(filename, filename);
}

if (!_stricmp(filename, "$levelbriefingX"))
{
	if (LoadScreens_Filename())
	{
		return Material_Obtain("$levelbriefingX", LoadScreens_Filename());
	}
}

// load all files that exist on disk
char diskfile [64];
_snprintf(diskfile, 64, "images/%s.iwi", filename);
if(!strstr(filename, "custom_")) return NULL; // only accept stuff with "custom_" prefix
if(FS_ReadFile(diskfile, NULL) > 0)
{
	return Material_Obtain(filename, filename);
}
return NULL;
}

StompHook materialLoadHook;
DWORD materialLoadHookLoc = 0x505E50;

void* MaterialLoadHookFunc(assetType_t type, const char* filename)
{
Material* material = Material_Register(filename);

if (material)
{
	return material;
}

return (Material*)DB_FindXAssetHeader(ASSET_TYPE_MATERIAL, filename);
}

void Material_TableDebug_f()
{
if (Cmd_Argc() < 2)
{
	Com_Printf(0, "Usage: %s [material name]\n", Cmd_Argv(0));
	return;
}

Material* material = materialTable[Cmd_Argv(1)];
Com_Printf(0, "%s is actually %s\n", Cmd_Argv(1), material->name);
}

cmd_function_t tDebugCmd;

void PatchMW2_Materialism()
{
materialTable.set_empty_key("");

materialLoadHook.initialize(materialLoadHookLoc, MaterialLoadHookFunc);
materialLoadHook.installHook();

Cmd_AddCommand("materialTableDebug", Material_TableDebug_f, &tDebugCmd, 0);
}

Just add "custom_" as a prefix to the image name and it will load.... Ingame you probably still have to precache it tho.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.