OpenXcom Forum

OpenXcom => Suggestions => Topic started by: Zharik1999 on May 13, 2012, 03:20:36 pm

Title: Weapon View
Post by: Zharik1999 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.
Title: Re: Weapon View
Post by: Bomb Bloke 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] (https://www.ufopaedia.org/index.php?title=UNITREF.DAT#53) == 255 && unitref[unit][54] (https://www.ufopaedia.org/index.php?title=UNITREF.DAT#53) == 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] (https://www.ufopaedia.org/index.php?title=UNITREF.DAT#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.
Title: Re: Weapon View
Post by: Zharik1999 on May 15, 2012, 01:44:00 pm
So, will it be put into the code?  :)
Title: Re: Weapon View
Post by: Yankes on May 15, 2012, 07:42:16 pm
OpenXcom was rewritten form scratch and dont use anything from original except data.
Title: Re: Weapon View
Post by: Volutar 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.
Title: Re: Weapon View
Post by: Daiky 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
Title: Re: Weapon View
Post by: michal on May 16, 2012, 12:27:03 pm
I hope you will finish diablo 3 soon ;)
Title: Re: Weapon View
Post by: Zharik1999 on May 16, 2012, 12:31:29 pm
That will be really great Daiky! :D
Title: Re: Weapon View
Post by: Zharik1999 on May 17, 2012, 06:59:51 pm
I have just checked the lastest git build. Thanks a lot Daiky, you rock! :D