Author Topic: Weapon View  (Read 6867 times)

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Weapon View
« on: May 13, 2012, 03:20:36 pm »
It's really hard for me to explaine this one but I will try. When in original X-Com you held two things in the same time(a weapon and something like grenade or flare) it usually shown what you are holding in the right hand. But when you for example want to use a grenade and open action menu it will display you this grenade/flare instead of weapon in hands (Screenshot 2) When you later use a weapon (it begins when you open action menu) the game will show it (Screenshot 1) and wil continue showing last used thing in your hands. So, in OpenXcom despite our actions game always shows the item you are carrying in your right hand. Are you gonna make these like in original or you will leave it as it is right now.

Offline Bomb Bloke

  • Sergeant
  • **
  • Posts: 19
    • View Profile
    • StrategyCore
Re: Weapon View
« Reply #1 on: May 15, 2012, 01:09:10 pm »
Dunno if OpenXcom uses the original UnitRef table, but if so, then the code should be along these lines.

Quote
if (unitref[unit][53] == 255 && unitref[unit][54] == 255)
{
   https:// Unit has no weapon in hands.
   weapon = 255;
}
else if (unitref[unit][53] == 255)
{
   https:// Unit is using right hand object.
   weapon = unitref[unit][54];
}
else if (unitref[unit][54] == 255)
{
   https:// Unit is using left hand object.
   weapon = unitref[unit][53];
}
else
{
   https:// Unit is holding two items.
   weapon = unitref[unit][53+((unitref[unit][120]&32)/32)];
}

The relevant bit in unitref[120] should be updated whenever the player clicks on the the weapon slots for the right/left hands, whereas [53]/[54] should be updated whenever the unit re-equips.
« Last Edit: May 15, 2012, 01:37:12 pm by Bomb Bloke »

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Re: Weapon View
« Reply #2 on: May 15, 2012, 01:44:00 pm »
So, will it be put into the code?  :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Weapon View
« Reply #3 on: May 15, 2012, 07:42:16 pm »
OpenXcom was rewritten form scratch and dont use anything from original except data.

Volutar

  • Guest
Re: Weapon View
« Reply #4 on: May 16, 2012, 01:52:17 am »
Yankes, you're not quite right. It doesn't use original code DIRECTLY, but it uses alot of obvious things and among them weapon placement and conditions which logically are the same as original's.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Weapon View
« Reply #5 on: May 16, 2012, 10:49:30 am »
I guess it is not hard to do, just keeping track of the "active weapon".
I'll just have to find some free time that I am behind my pc at home and can resist to spend that free time not playing Diablo 3 :p

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Weapon View
« Reply #6 on: May 16, 2012, 12:27:03 pm »
I hope you will finish diablo 3 soon ;)

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Re: Weapon View
« Reply #7 on: May 16, 2012, 12:31:29 pm »
That will be really great Daiky! :D

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Re: Weapon View
« Reply #8 on: May 17, 2012, 06:59:51 pm »
I have just checked the lastest git build. Thanks a lot Daiky, you rock! :D