OpenXcom Forum

OpenXcom => Suggestions => Topic started by: CanadianBeaver on August 30, 2016, 08:03:28 pm

Title: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 08:03:28 pm
I think it is clear. Example: the weapons loaded by standard clips and alloy clips have the different their looks.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: ohartenstein23 on August 30, 2016, 08:09:41 pm
You should talk to Yankes about this one - it might be already possible with his scripts for OXCE, since there's already IvanDogovich's piratez mod to change corpse bigobs/floorobs based on fatal wounds/stun, and this sounds like a pretty similar concept.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Hobbes on August 30, 2016, 08:41:30 pm
I think the Handobs sprites are too small to visually make a difference - either you recolor the entire weapon according to the clip, or for each frame only a couple of pixels will have a different color (or even none, depending on direction that the weapon is facing)

More useful would be to have a small message box appearing and displaying the ammo type when the mouse cursor hovers over the weapon, like XCOM 2 does
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 09:18:44 pm
I think the Handobs sprites are too small to visually make a difference - either you recolor the entire weapon according to the clip, or for each frame only a couple of pixels will have a different color (or even none, depending on direction that the weapon is facing)

More useful would be to have a small message box appearing and displaying the ammo type when the mouse cursor hovers over the weapon, like XCOM 2 does

Please, imagine the rocket launcher like RPG, where the grenade holds outside of launcher. Or the plasma weapons with lighting that depends on type of clips.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Yankes on August 30, 2016, 09:30:16 pm
You should talk to Yankes about this one - it might be already possible with his scripts for OXCE, since there's already IvanDogovich's piratez mod to change corpse bigobs/floorobs based on fatal wounds/stun, and this sounds like a pretty similar concept.
Yes, this right now possible in OXCE. It could be done in two ways, separate graphic for each weapon or recoloring same graphic for all clips.
Ground, hand and inventory graphic can be changed.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 09:39:45 pm
Yes, this right now possible in OXCE. It could be done in two ways, separate graphic for each weapon or recoloring same graphic for all clips.
Ground, hand and inventory graphic can be changed.

Can you show an example from .rul?
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Hobbes on August 30, 2016, 10:48:31 pm
Please, imagine the rocket launcher like RPG, where the grenade holds outside of launcher. Or the plasma weapons with lighting that depends on type of clips.

Have you considered this system would be totally dependent on color? And that color blindness, in one form or the other, affects about 10% of the world population?

Or that there's 8 vanilla damage types, so you'd need at least 7 different colors (for Melee it wouldn't be needed) but the palettes are limited in choice? And if you use some colors like yellow, green, brown, etc., the lightning will be barely discernible when superimposed against the terrain?

Imagine that when you hover the cursor over the weapon, it displays both the damage type and the damage power. To me that would be a lot more useful than a lot of flashy graphic effects that won't be that easy to distinguish and that will be there just for the firework show. But this is only my opinion.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 10:58:18 pm
Have you considered this system would be totally dependent on color? And that color blindness, in one form or the other, affects about 10% of the world population?

Or that there's 8 vanilla damage types, so you'd need at least 7 different colors (for Melee it wouldn't be needed) but the palettes are limited in choice? And if you use some colors like yellow, green, brown, etc., the lightning will be barely discernible when superimposed against the terrain?

Imagine that when you hover the cursor over the weapon, it displays both the damage type and the damage power. To me that would be a lot more useful than a lot of flashy graphic effects that won't be that easy to distinguish and that will be there just for the firework show. But this is only my opinion.

Sorry, I did not think about cursor and I do not want to discuss about "what is better - cursor or color?". I want to have an opportunity to change the image (not color) of the weapons in the game which depends on the type of clip.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: ivandogovich on August 30, 2016, 11:15:17 pm
I want to have an opportunity to change the image (not color) of the weapons in the game which depends on the type of clip.

If you are serious about considering the functionality of the OpenXcom Extended branch, I might be willing to show you the script that we use to change corpse object images.  But as far as I understand from previous conversation, you want to stay Debian and 1.0 milestone. 

If you aren't interested in the features that OpenXcom Extended offers then this will be no interest to you.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 11:46:39 pm

... now possible in OXCE ...

Can you show an example from .rul?
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 30, 2016, 11:49:46 pm
Sorry, I think I am wrong. OpenXcom Extended is OXCE, is not it? Or are these things different?
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Arthanor on August 30, 2016, 11:56:24 pm
OXC = OpenXCom (ideally followed by 1.0 or nightly to specify which one istalked about)
OXCE = OpenXCom Extended, Yankes' branch (hence why Yankes was mentioning it)
OXCE+ = OpenXCom Extended, plus Meridian's changes

So yes, Ivan was making sure you weren't wasting either yours or Yankes' time by looking into a feature you are unlikely to actually want to use.

That being said, it would be a nice thing to have for the RPG in XPiratez, for example. To see if it's a nuke that's loaded in there.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: yrizoud on August 31, 2016, 12:41:33 am
(edited)
Even in vanilla UFO, it would be prettier if the empty Heavy Plasma was displayed without its banana clip.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Yankes on August 31, 2016, 12:47:34 am
Can you show an example from .rul?

Here is implementation for custom (3 possible version per weapon) graphic based on ammo:
Code: [Select]
extended:
  tags:
    RuleItem:
      CUSTOM_GUN_GRAPHIC_ALT_MOD: RuleList
      CUSTOM_GUN_GRAPHIC_ALT_1: int
      CUSTOM_GUN_GRAPHIC_ALT_2: int
      CUSTOM_GUN_GRAPHIC_ALT_3: int
      CUSTOM_GUN_GRAPHIC_ALT_SELECT: int
  scripts:
    selectItemSprite:
      - offset: 1
        code: |
          var int version;
          var int temp;
          var ptr BattleItem ammo;
          var ptr RuleItem weaponType;
          var ptr RuleItem ammoType;
         
          #only for big sprites
          if neq blit_part blit_item_big;
            return sprite_index;
          end;
         
          item.getAmmoItem ammo;
          item.getRuleItem weaponType;
          ammo.getRuleItem ammoType;
          ammoType.getTag version Tag.CUSTOM_GUN_GRAPHIC_ALT_SELECT;
         
          if neq version 0;
            weaponType.getTag temp Tag.CUSTOM_GUN_GRAPHIC_ALT_MOD;
            if eq version 1;
              weaponType.getTag sprite_index Tag.CUSTOM_GUN_GRAPHIC_ALT_1;
            else eq version 2;
              weaponType.getTag sprite_index Tag.CUSTOM_GUN_GRAPHIC_ALT_2;
            else eq version 3;
              weaponType.getTag sprite_index Tag.CUSTOM_GUN_GRAPHIC_ALT_3;
            end;
            rules.getSpriteOffsetBigobs sprite_index temp;
          end;
          return sprite_index;
items:
  - type: STR_SOME_WEAPON
    bigSprite: 110
    tags:
      CUSTOM_GUN_GRAPHIC_ALT_MOD: current #in what mode graphic is defined
      CUSTOM_GUN_GRAPHIC_ALT_1: 111 #next `bigSprite` value
      CUSTOM_GUN_GRAPHIC_ALT_2: 112
      CUSTOM_GUN_GRAPHIC_ALT_3: 112

  - type: STR_AMMO_FOR_SOME_WEAPON_1
    tags:
      CUSTOM_GUN_GRAPHIC_ALT_SELECT: 1
  - type: STR_AMMO_FOR_SOME_WEAPON_2
    tags:
      CUSTOM_GUN_GRAPHIC_ALT_SELECT: 2
  - type: STR_AMMO_FOR_SOME_WEAPON_3
    tags:
      CUSTOM_GUN_GRAPHIC_ALT_SELECT: 3

Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 31, 2016, 03:58:24 am
It will be great, if openxcom has something simple, like that:

Code: [Select]
- myweapon
    bigimage: 111
    compatibleammo:
      - myclip 

- myclip
    bigimage: 112
    bigimage_PARENT: 113

PS: I am speaking about OpenXcom
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: CanadianBeaver on August 31, 2016, 06:53:34 am
Here is implementation for custom (3 possible version per weapon) graphic based on ammo:

Thank you, I will think about.
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Nord on September 23, 2021, 02:08:11 pm
Excuse me, but i can not understand what
Code: [Select]
rules.getSpriteOffsetBigobs sprite_index temp;doing.
Can you explain please?

(I thinked it is like "auto-adding mod offset when more than one mod is used" but looks like it is not working like that.)
Title: Re: Clips should be able to change weapons images (big, hands and floor)
Post by: Yankes on September 25, 2021, 12:37:42 pm
This is to recover real index of surface in common surface sets.
In any times you define index based on your mod, this mean index `1` in two different mods it should convert to different real index like `2001` or `4001` (and this value will change when you swap mod load order).
First value initial value is surface index in given mod, second is mod id.

As one another details, this function some times do not add mod offsets, because some index are "common" and all mods share same surface, this is for base game asserts where every mod can override it or use in its own units.