HLFX.Ru Forum
профиль •  правила •  регистрация •  календарь •  народ •  FAQ •  поиск •  новое •  сутки •  главная •  выход  
HLFX.Ru Forum HLFX.Ru Forum > Теория и практика > Half-Life SDK > Having more than 32 weapons in Half-Life mod?
Questions on the appropriate method to define more than 32 weapons in HL engine.
  Предыдущая тема   Следующая тема
Автор
Тема Новая тема    Ответить
Napoleon321
Admiral

Дата регистрации: Jan 2017
Проживает: Sofia
Сообщений: 57
Возраст: 34

Рейтинг



Half-Life Having more than 32 weapons in Half-Life mod?

Hello All, first I would like to apologize for writing in English, my Russian is awful and if I try to write you'll have a fun time reading.

I have the following issue:

Having more than 32 weapons in Half-Life mod.

For quite some time I was trying to incorporate more than 32 weapon in my Half-Life mod. I noticed there's a dependency between the number of "WEAPON_SUIT" and the number of allowed weapons on the mod.

For example by default the number of the suit is 31:

.\dlls\weapons.h

C++ Source Code:
#define WEAPON_SUIT 31 // ?????


.\common\cdll_dll.h
C++ Source Code:
#define WEAPON_SUIT 31


Note that I already have the Max_WEAPONS redefined as 64 defined (I know that the hard limit for max weapons in the engine is actually 64:

C++ Source Code:
#define MAX_WEAPONS 64


The definition for all weapons is the following:

C++ Source Code:
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))


So we're dependent on the number of the WEAPON_SUIT. If I try to add weapon with number above 32, I get the game to crash/freeze. I have double checked and it's not with the weapon code or with the definitions for that specific weapon (I obviously commented out another weapon and placed my code over that weapon's place and it all worked fine).
If I add weapon beyond 32, I don't get errors in the compiler and the "client" and "server" library compile well. So I started playing around with the definitions.

If I put WEAPON_SUIT to greater value than 31, (example 64, 128 or 256; I tested other values from 33 to 256 - the result is the same).
I can define more than 32 weapons for the mod, however there are other issues arising after that...

1. I get the following warnings when I compile:

1>d:\sdk_\dlls\player.cpp(761): warning C4293: '<<' : shift count negative or too big, undefined behavior
1>d:\sdk_\dlls\items.cpp(188): warning C4293: '<<' : shift count negative or too big, undefined behavior
1>d:\sdk_\dlls\healthkit.cpp(199): warning C4293: '<<' : shift count negative or too big, undefined behavior
1>d:\sdk_\dlls\h_battery.cpp(121): warning C4293: '<<' : shift count negative or too big, undefined behavior
1>d:\sdk_\dlls\bot.cpp(882): warning C4293: '<<' : shift count negative or too big, undefined behavior

Those warnings are related to lines containing "pev->weapons & (1<
So clearly changing the number of WEAPON_SUIT is the issue here.

2. When I start a game with the compiled libraries (with more than 32 weapons defined), I observe stage behaviors with the weapons above 32:

a) game crashing / freezing upon spawning / getting that weapon.
b) game working OK, however the gun has no animations, sprites and sounds.
c) game working, but with no sprites for the game in general.

So I guess the current definition does not support more than 32 (32-1).
I've searched everywhere for example on how to change the definitions properly to support more than 32 bytes (including based on warning C4293) and I'm unable to find a solution or workaround.

I know there are mods out there that have the functionality implemented - I've seen it in HL Weapon's Edition, XASH, Half-Life: Enhanced and few others; and I was wondering did anyone faced the same issue like me?
Have you been able to find a workaround for this one?

Any inside on this would be greatly appreciated.

Отредактировано Napoleon321 07-07-2019 в 07:19

Сообщить модератору | | IP: Записан
Сообщение: 181049

Старое сообщение 07-07-2019 07:05
- За что?
 XaeroX
Crystice Softworks

Дата регистрации: Oct 2005
Проживает: Торонто
Сообщений: 34498
Нанёс повреждений: 514 ед.
Возраст: 37

Рейтинг



Награды
 
[1 награда]


Napoleon321
You oughtn't to blindly increase the value of WEAPON_SUIT, because there is a hard limit of 32 bits in an integer variable.
Please read this tutorial, it explains the problem and gives a solution:
https://hlfx.ru/forum/showthread.php?s=&threadid=5053

__________________
Правдой дорожить, лжи не потакать,
Дальних не судить, ближним помогать,
С тишиной сойтись на исходе дня
Научи меня, Родина моя!

Сообщить модератору | | IP: Записан
Сообщение: 181052

Старое сообщение 07-07-2019 07:22
-
Napoleon321
Admiral

Дата регистрации: Jan 2017
Проживает: Sofia
Сообщений: 57
Возраст: 34

Рейтинг



Hello, I'm sorry for the bump, just for completion sake:

I was not able to follow the tutorial by Дядя Миша , however...

This one actually works (with few extra tweaks) - http://www.half-life.ru/forum/showt...p?threadid=6129

__________________
FlatLine Arena | Tutorials

If you don't like something, MOD it!

Сообщить модератору | | IP: Записан
Сообщение: 205394

Старое сообщение 22-11-2021 08:47
- За что?
Тема: (Опционально)
Ваш ответ:



Переводчик транслита


[проверить длину сообщения]
Опции: Автоматическое формирование ссылок: автоматически добавлять [url] и [/url] вокруг интернет адресов.
Уведомление по E-Mail: отправить вам уведомление, если кто-то ответил в тему (только для зарегистрированных пользователей).
Отключить смайлики в сообщении: не преобразовывать текстовые смайлики в картинки.
Показать подпись: добавить вашу подпись в конец сообщения (только зарегистрированные пользователи могут иметь подписи).

Временная зона GMT. Текущее время 15:19. Новая тема    Ответить
  Предыдущая тема   Следующая тема
HLFX.Ru Forum HLFX.Ru Forum > Теория и практика > Half-Life SDK > Having more than 32 weapons in Half-Life mod?
Questions on the appropriate method to define more than 32 weapons in HL engine.
Версия для печати | Отправить тему по E-Mail | Подписаться на эту тему

Быстрый переход:
Оцените эту тему:

Правила Форума:
Вы not можете создавать новые темы
Вы not можете отвечать в темы
Вы not можете прикреплять вложения
Вы not можете редактировать ваши сообщения
HTML Код ВЫКЛ
vB Код ВКЛ
Смайлики ВКЛ
[IMG] Код ВКЛ
 

< Обратная связь - HLFX.ru >

На основе vBulletin
Авторское право © 2000 - 2002, Jelsoft Enterprises Limited.
Дизайн и программирование: Crystice Softworks © 2005 - 2024