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

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #15 on: September 09, 2013, 09:19:54 pm »
The problem with 3D interceptions resolved.
PR sent)

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #16 on: September 09, 2013, 09:38:37 pm »
May have ideas about improve drawing trajectory of throw?

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Features: Show chance to hitting and the throw trajectory
« Reply #17 on: September 10, 2013, 04:41:18 pm »
hmmm... yeah, the circle now looks better, but I guess we'll run into visibility problems if the ground has a lot of objects on it (underbrush in jungle terrain, wheat field in farm terrain, "roof" tiles in the urban tileset etc.) because it might obscure the circle completely...

the shading routine used for path preview only re-colors the ground, doesn't it? is there a shading routine that also affects objects in the tile? if yes, perhaps make everything inside the circle flash red? including units and other objects, of course. that way, you can immediately see who and what will be affected.

Offline MyThos

  • Sergeant
  • **
  • Posts: 43
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #18 on: September 10, 2013, 08:15:40 pm »
Nice job redv. Hope to see that in the options of the nightly builds soon  :D

Offline Yankes

  • Commander
  • *****
  • Posts: 3245
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #19 on: September 10, 2013, 10:22:34 pm »
it would look better if it was semi "transparent". What function you used to blit it?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #20 on: September 10, 2013, 11:05:58 pm »
it would look better if it was semi "transparent". What function you used to blit it?

I use blitNShade   https://github.com/redv/OpenXcom/compare/throw_view#L2R415

Do you mean semi-transparency for blast circle or for trajectory?

I think need to remove rendering trajectory from this commit. Leave only blast area. I have tried several options to render trajectory, but stay dissatisfied.
« Last Edit: September 10, 2013, 11:17:39 pm by redv »

Offline Yankes

  • Commander
  • *****
  • Posts: 3245
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #21 on: September 10, 2013, 11:54:34 pm »
tomorrow I will made special function that will made blast circle more transparent.

Offline luke83

  • Commander
  • *****
  • Posts: 1558
    • View Profile
    • openxcommods
Re: Features: Show chance to hitting and the throw trajectory
« Reply #22 on: September 11, 2013, 02:14:52 pm »
tomorrow I will made special function that will made blast circle more transparent.
Keep me posted on when and How it works ,  i am thinking i may need other things partially transparent later on :P

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #23 on: September 11, 2013, 04:06:20 pm »
the shading routine used for path preview only re-colors the ground, doesn't it? is there a shading routine that also affects objects in the tile? if yes, perhaps make everything inside the circle flash red? including units and other objects, of course. that way, you can immediately see who and what will be affected.

It is possible. But will be need check each tile, repaint them or not. Even if this option will be disabled. I'll think about it.

tomorrow I will made special function that will made blast circle more transparent.

It would be nice)

Offline Yankes

  • Commander
  • *****
  • Posts: 3245
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #24 on: September 13, 2013, 01:22:25 am »
first try.

BTW redv you didnt include correct headers to `Map.cpp` file. When I try first compile I get couple errors.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Features: Show chance to hitting and the throw trajectory
« Reply #25 on: September 13, 2013, 09:35:47 am »
Looks nice!

Could you post a screenshot with the circle in a wheat field?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #26 on: September 13, 2013, 12:46:24 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 );

BTW redv you didnt include correct headers to `Map.cpp` file. When I try first compile I get couple errors.
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
« Last Edit: September 13, 2013, 12:48:51 pm by redv »

Offline Sharp

  • Colonel
  • ****
  • Posts: 181
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #27 on: September 13, 2013, 01:06:36 pm »
Looks really cool and red/yellow much better then blue as a colour but how would it look if it just did outline on affected tiles? It would be a lot different to your implementation because I believe yours is based on the location of the cursor and not from the tile so you could have a grid outline and put it around affected tiles, if you can tell what the active tile is then could do the radius from a snap to centre of the tile instead of location of cursor so it should be accurate and you don't need to actually locate the tiles you are going to draw it around, just the one tile at the centre.

Although thinking about it even though it would be more accurate it might look even more jarring, tile outline only difference is accuracy of blast radius on edge of the radius so only affects those fringe tiles where the blast power is heavily reduced anyway so it doesn't really even matter if friendly or hostile is on edge.

So in conclusion ignore the above but good job :D

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #28 on: September 13, 2013, 01:33:58 pm »
Looks really cool and red/yellow much better then blue as a colour but how would it look if it just did outline on affected tiles? It would be a lot different to your implementation because I believe yours is based on the location of the cursor and not from the tile so you could have a grid outline and put it around affected tiles, if you can tell what the active tile is then could do the radius from a snap to centre of the tile instead of location of cursor so it should be accurate and you don't need to actually locate the tiles you are going to draw it around, just the one tile at the centre.

I exactly know, where the center of the explosion in the tile space.
https://github.com/redv/OpenXcom/compare/throw_view#L2R348
And I can calculate locations of affected tiles.
https://github.com/redv/OpenXcom/compare/throw_view#L2R1273

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2161
    • View Profile
Re: Features: Show chance to hitting and the throw trajectory
« Reply #29 on: September 13, 2013, 04:58:12 pm »
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 need to disable the precompiled headers (Properties > C++ > Precompiled Headers) to see header errors, an annoying side-effect of using them.