HLFX.Ru Forum
профиль •  правила •  регистрация •  календарь •  народ •  FAQ •  поиск •  новое •  сутки •  главная •  выход  
HLFX.Ru Forum HLFX.Ru Forum > Разработка игр > Наши проекты > XashXT > Problems with compilation
Used an old code for HL SDK and got compilation errors.
  Предыдущая тема   Следующая тема
Автор
Тема Новая тема    Ответить
CRxTRDude
Dude extraordinare

Дата регистрации: Apr 2014
Проживает: (void)
Сообщений: 46
Возраст: 31

Рейтинг



Half-Life Problems with compilation

Hello again guys. I'm adding various features to the game, so far I added a body damage hud.

This time, I'm going to add a new feature, namely a parachute. I got this from an old tutorial for HL SDK and I want to carry it over to XashXT. I got some of the problems fixed, now the part that boggled me which brings up the question.

Here's the code for the gliding.

C++ Source Code:
1
player.cpp
2
line 1384
3
 
4
void CBasePlayer::ParaGlide( void )
5
{
6
  if (!m_fParachute) {
7
    EMIT_SOUND( "common/wpn_denyselect.wav" );
8
    return;
9
  }
10
  if (m_fParaOpen) {
11
    GetClassPtr((CBasePlayer *)pev)->m_flFallVelocity = 50;
12
    GetClassPtr((CBasePlayer *)pev)->pev->velocity = GetClassPtr((CBasePlayer *)pev)->pev->velocity - 100;
13
  }
14
}


When I compiled the cpp, this came out:

E:\Applications\Xash Source Code\Nikki\server\player.cpp(1392) : error C2666: '-' : 3 overloads have similar conversions


The code has something to do with the long velocity check: GetClassPtr((CBasePlayer *)pev)->pev->velocity = GetClassPtr((CBasePlayer *)pev)->pev->velocity - 100;

I tried to find solutions online, but there's none that helped me. I don't know if you guys can help about this. If you can, I'll truly appreciate that.

If it does matter, I used VC++ 6.0 Standard with no service packs installed for it.

__________________
CRxTRDude
-----------------------
Nikki Shore blog / XashXT Cookbook (CSM)

Отредактировано CRxTRDude 11-05-2014 в 05:34

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

Старое сообщение 11-05-2014 05:17
- За что?
Ku2zoff
Мастер Ёда из Деревни Дуракоф

Дата регистрации: Apr 2007
Проживает: В Деревне дураков
Сообщений: 6749
Возраст: 33

Рейтинг




C++ Source Code:
void [b]CBasePlayer[/b]::ParaGlide( void )

Maybe you should rewrite the code?
C++ Source Code:
GetClassPtr((CBasePlayer *)pev)

Is a piece of shit in this code, i think. You don't need for this.
C++ Source Code:
1
void CBasePlayer::ParaGlide( void )
2
{
3
  if (!m_fParachute)
4
  {
5
    EMIT_SOUND( "common/wpn_denyselect.wav" );
6
    return;
7
  }
8
 
9
  if (m_fParaOpen)
10
  {
11
    m_flFallVelocity = 50;
12
    pev->velocity = pev->velocity - 100;
13
  }
14
}

And next: pev->velocity is a vector. You cannot substract any constant values from it. You can substract values from the components of pev->velocity, such as pev->velocity.x, pev->velocity.y and pev->velocity.z:
C++ Source Code:
pev->velocity = Vector(pev->velocity.x, pev->velocity.y, pev->velocity.z - 100)

IINM
Or more simple, just:
C++ Source Code:
pev->velocity.z -= 100


Добавлено 11-05-2014 в 15:35:

Also, you can add any vector to pev->velocity:
C++ Source Code:
pev->velocity = pev->velocity + gpGlobals->v_up * 100

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

Старое сообщение 11-05-2014 08:35
- За что?
 Дядя Миша
racing for fish

Дата регистрации: Oct 2005
Проживает: Кубань
Сообщений: 32210
Нанёс повреждений: 392 ед.

Рейтинг



Цитата:
CRxTRDude писал:
EMIT_SOUND( "common/wpn_denyselect.wav" );

replace with
C++ Source Code:
EMIT_SOUND( (ENT(pev), CHAN_BODY, "common/wpn_denyselect.wav", 0.8, ATTN_NORM );

__________________
My Projects: download page

F.A.Q по XashNT
Блог разработчика в телеграме

Цитата:

C:\DOCUME~1\C4C5~1\LOCALS~1\Temp\a33328if(72) : see declaration of 'size_t'

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

Старое сообщение 11-05-2014 09:21
-
CRxTRDude
Dude extraordinare

Дата регистрации: Apr 2014
Проживает: (void)
Сообщений: 46
Возраст: 31

Рейтинг



Ku2zoff, Well, I didn't see that before. I just realized that I'm branching already to CBasePlayer, so there's no need to point. Thanks for the advice. BTW, can I go PM you whenever I have problems codewise?

I also want to ask if there's a way to make hud messages within CBasePlayer or any code for that matter too? I was originally intending to use a hud message if the player doesn't have a chute.

Thanks for the reply guys! I'll check this code now.

BTW,Дядя Миша , is there a rename the first post as solved?

__________________
CRxTRDude
-----------------------
Nikki Shore blog / XashXT Cookbook (CSM)

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

Старое сообщение 11-05-2014 10:54
- За что?
 Дядя Миша
racing for fish

Дата регистрации: Oct 2005
Проживает: Кубань
Сообщений: 32210
Нанёс повреждений: 392 ед.

Рейтинг



Цитата:
CRxTRDude писал:
is there a rename the first post as solved?

__________________
My Projects: download page

F.A.Q по XashNT
Блог разработчика в телеграме

Цитата:

C:\DOCUME~1\C4C5~1\LOCALS~1\Temp\a33328if(72) : see declaration of 'size_t'

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

Старое сообщение 11-05-2014 11:38
-
CRxTRDude
Dude extraordinare

Дата регистрации: Apr 2014
Проживает: (void)
Сообщений: 46
Возраст: 31

Рейтинг



Hey guys, I got the thing working! It took me last night and today to fix the code after Ku2zoff's fix.

I got a problem with the chute's speed. It keeps on killing me, but I modified the velocity to be halfed by 3/4 and it worked! And I implemented a fully working chute. Just a little modification to the code again to add some sprites whenever the parachute is in effect and when the player picks it up.


Here's another thing that I want to ask. This is for whenever I land on the ground with the parachute on, the parachute is still active.

What part in jump would I place the m_fParaOpen = FALSE parameter in the player.cpp? The jump is kind of convoluted and I don't know where to place.

Thanks again guys!

Добавлено 12-05-2014 в 14:30:

Yeah, i got my own attempt at it in jump, but still doesn't work. I don't have a clue where to put it.

Anyhow, I also want to know aside from disabling the parachute once the player lands on the ground, is there also a way to disable the use of the parachute while still in the ground as well? I know it has something to do with the PlayerUse function as well, since I used it as a trigger for the chute.

Sorry for this one, the edit post was disabled for my post.

__________________
CRxTRDude
-----------------------
Nikki Shore blog / XashXT Cookbook (CSM)

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

Старое сообщение 12-05-2014 05:30
- За что?
Тема: (Опционально)
Ваш ответ:



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


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

Временная зона GMT. Текущее время 22:12. Новая тема    Ответить
  Предыдущая тема   Следующая тема
HLFX.Ru Forum HLFX.Ru Forum > Разработка игр > Наши проекты > XashXT > Problems with compilation
Used an old code for HL SDK and got compilation errors.
Версия для печати | Отправить тему по E-Mail | Подписаться на эту тему

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

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

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

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