Author Topic: Features: Show chance to hitting and the throw trajectory  (Read 59593 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3366
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #30 on: September 13, 2013, 07:42:54 pm »
The transparency effect looks good. But what about color shifts? Color does vanilla-like behavior of crosshair.
I think, for each pixel, something like:
Code: [Select]
If (srcPx)
    dstPx = srcPx + ((dstPx & 0xF) >> 1);

or
Code: [Select]
If (srcPx)
    dstPx = srcPx + std::max( (dstPx & 0xF) - tileShade - 2, 0 );
I know, sometimes i skip headers. But i don't know which particular) Because VC2010 compiles this without errors)
Which headers i miss? Perhaps SDL_video.h
you miss in "Map.cpp":
Code: [Select]
#include "../Engine/Screen.h"
#include "../Savegame/BattleItem.h"
in "Map.h":
Code: [Select]
class BattleAction;

This is my version:
https://github.com/Yankes/OpenXcom/tree/throw_view
As you can see it isnt many changes, most important part is `Transparent::func`, its core of this effect.
You can easy change implementation of this function to achieve different effect.

This is screenshot of `if(src) dest = src + ((dest&0xF)>>1);` function:

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #31 on: September 13, 2013, 10:26:12 pm »
Transparency without recoloring looks not good in some cases (screen046, screen047).
Transparency with recoloring reduces contrast and, as result, transparency is almost invisibly:(
So, i think, best solution is use red/yellow crosshair without transparency.

Transparency can be useful for rendering trajectory of throw.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3366
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #32 on: September 15, 2013, 12:21:19 am »
Transparent circle maybe still useful, right now when circle is behind wall it disperser completely. I think it can be transparent then.

Offline mercy

  • Colonel
  • ****
  • Posts: 341
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #33 on: September 15, 2013, 09:57:40 am »
This new transparent version is even better.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #34 on: September 15, 2013, 12:41:07 pm »
Transparent circle maybe still useful, right now when circle is behind wall it disperser completely. I think it can be transparent then.
I did some tests. What is your opinion?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3366
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #35 on: September 15, 2013, 03:29:36 pm »
I think you should change a bit transparent part. Right now it is too bright if background was dark.
Maybe try function like that:
Code: [Select]
dest = (dest & 0xF0) | ((dest & 0x0F)*3 + (src & 0x0F)*1)/4dest shade will be 3 times more dominant than src.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #36 on: September 15, 2013, 11:22:36 pm »
This tests with ((src&15) + (dest&15)*3)/4;

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Features: Show chance to hitting and the throw trajectory
« Reply #37 on: September 15, 2013, 11:37:38 pm »
I think those last ones are heading into the right direction. where the circle is directly visible it looks right, and where it is partially obscured you can still see it, but it doesn't cut through the objects like it did before.

this looks great :)

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #38 on: September 15, 2013, 11:44:02 pm »
Personally I preferred the approaches used earlier (screen046-047 etc). Circle with different color patches looks kinda weird, especially in the edge cases where only a few pixels are obscured.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3366
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #39 on: September 15, 2013, 11:44:31 pm »
I see strange patterns on transparent part, do you draw circle multiple times on one position?
If its true, you need add "mask" that will prevent multiple draws on same pixels.

you need change 2 things:
a) `Transparent::func` change first `int` arg to `const Uint8& mask` and in body add new test:
Code: [Select]
if(src && mask) {/* old draw code */}b) every `ShaderDraw<Transparent>` you need add new argument with last drew object, e.g.
Code: [Select]
ShaderSurface(tmpSurface, screenPosition.x, screenPosition.y)
If this dont fix it, send me last version and I will try fix myself.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Features: Show chance to hitting and the throw trajectory
« Reply #40 on: September 15, 2013, 11:56:39 pm »
Personally I preferred the approaches used earlier (screen046-047 etc). Circle with different color patches looks kinda weird, especially in the edge cases where only a few pixels are obscured.

But only for the directly visible part, right? I mean, those versions wozld be completely invisible in any terrain with objects (even grass)!

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #41 on: September 16, 2013, 12:03:29 am »
add:
i also like the earlier forms where it disappears behind/beneath walls & objects

(otherwise my eyes are on a roller coaster going up onto walls etc)

and goes translucent on floors that the thrower can't see, perhaps, or that the explosion won't reach. i guess



/yap!

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #42 on: September 16, 2013, 12:18:42 am »
I see strange patterns on transparent part, do you draw circle multiple times on one position?
If its true, you need add "mask" that will prevent multiple draws on same pixels.
I post updated branch: https://github.com/redv/OpenXcom/compare/throw_view#L2R224
You can check it.

In my opinion, best variant is red/yellow with blink effect. Like on picture, but without throw trajectory.
If parts of circle will be obscured, it is not problem, because this mod not affect on gameplay. It just for fun.
Latest versions is not very good.
« Last Edit: September 16, 2013, 12:29:43 am by redv »

Offline mercy

  • Colonel
  • ****
  • Posts: 341
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #43 on: September 16, 2013, 09:59:25 am »
RED color looks better, because of the "explosive warning" feel. 
The yellow looks like "agricultural spraying of pesticides" or "build a house there".

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Features: Show chance to hitting and the throw trajectory
« Reply #44 on: September 16, 2013, 10:16:29 am »
by "blink effect" you mean that the circle is red, but turns yellow-flashing if a target is within the blast radius? (maybe you should post a video :) )