MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000948VCMIGUI - Battlespublic2012-05-04 09:382014-05-30 17:41
Reporterench0 
Assigned ToWarmonger 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version0.89 
Summary0000948: Add enemy unit movement shadow (like in King's Bounty - The Legend )
DescriptionIn the new King's Bounty (KB - The lgened and KB - Armored Princess) games there is a very neat feature, which I think would be great to add to VCMI.

In the battle, when you place the mouse over an enemy unit it turns off your current unit movement shadow and displays a shadow for the enemy unit (i.e. tells you how far this enemy unit would move in its turn).

A variant (perhaps slight improvement) of this feature would be to display a movement shadow for the the enemy unit without hiding your current unit's movement shadow. Perhaps display enemy's shadow with a slightly different color (reddish?). This way you could easily see how far you can move your unit without it being reachable by the enemy unit.
Additional InformationI will see if I can add a KB screen shot here to illustrate this featrue request
TagsNo tags attached.
Attached Files? file icon kb-enemy-movmt-shdw-256.bmp [^] (397,870 bytes) 2012-05-07 16:54


patch file icon show-enemy-move-shadow.01.patch [^] (1,328 bytes) 2012-05-14 13:01 [Show Content]
? file icon CCELLSH2.bmp [^] (3,572 bytes) 2012-05-28 08:25


patch file icon colorize-enemy-move-shadow.01.patch [^] (2,053 bytes) 2012-05-28 08:25 [Show Content]
patch file icon colorize-enemy-move-shadow.02.patch [^] (969 bytes) 2012-05-28 09:04 [Show Content]

- Relationships
related to 0000966closedIvan Crash occurs at the end of the battle. 

-  Notes
(0002401)
majaczek (reporter)
2012-05-04 13:53
edited on: 2012-05-04 13:53

I insist to include this feature. Similair feature is also in H5 I believe. Shading the hexes is just for not having to count them, and I many times in H3 had to count hexes to know to be out of meele fighter range.

(0002407)
ench0 (reporter)
2012-05-07 16:59

I added a screenshot. Here's the explanation:
- The currently active unit are my Red Snakes (100). This is indicated by the greenish runic-like aura underneath them.
- My mouse pointer is over the enemy Ghosts (2). Don't mind the ugly mouse pointer, I added it manually for illustration purposes, coz the screenshot does not capture the mouse. As u can see moving the mouse over the enemy units hides the movement shadow of my Snakes and displays a shadow for the ghosts, showing how far the ghosts would move when their turn comes.
(0002423)
ench0 (reporter)
2012-05-14 13:07

I added a patch which displays a movement shadow when mouse is hovered over a stack. I started a couple battles and it seems to be working as supposed to.

It works WITHOUT hiding the shadow of the active stack so the two may be present on the map at the same (and may even be overlapping). IMO it looks fine for a first-cut of the feature, but adding a couple of different shadow BMPs for the enemy units and for the friendly units would make it look better...

...btw if anyone could point me to where these BMPs are located they could save me some debugging time :) I mean this line in client/BattleInterface/CBattleInterface.cpp:
  cellShade = BitmapHandler::loadBitmap("CCELLSHD.BMP");
(0002428)
Ivan (developer)
2012-05-14 16:51
edited on: 2012-05-14 21:45

You mean location of bmp files on disk?
Bitmap handler loads them from VCMI/Data/H3Bitmap.lod
You can use MMArchive to extract them: http://wogarchive.ru/file.php?id=119 [^] (Only for Windows, but works in wine)

Some thoughts about patch:
- It should check for if movement shadow enabled in options

- To change transparency without any additional images:
cellShade->format->palette->colors[4].unused = 128;
128 - default, 255 - transparent, 0 - opaque

!!!
- There is crash at the end of battle.
!!!

I'll leave patch to somebody else (Warmonger?) but I like this feature.

(0002475)
ench0 (reporter)
2012-05-17 16:36

1. When I tested the patch the game did NOT crash at the end of the battle.
2. On the next day (and on another machine) it DID crash at the end of the battle.
3. Today (tag 2686) vcmi crashes as soon as I try to start a scenario...

Unfortunately I do not remember what I first tested with, I think it was at 2661 or 2663.

There may very well be some problem with my code but I need to be able to start a scenario and enter a battle to debug :) I will be looking into this in the next few days and as soon as there is a working release will try to verify whether my patch is causing any problems at the end of the battle...
(0002476)
Ivan (developer)
2012-05-17 16:52

Hmm... 2686 works fine for me. Can you post stacktrace of crash?
Or at least try with rev. 2684:
svn update -r 2864
(0002518)
Warmonger (administrator)
2012-05-22 10:16

Implemented patch in r2704. Thanks!
(0002529)
ench0 (reporter)
2012-05-23 13:33

I finally managed to find some time to look into this today and I saw that Wamonger has taken my patch in as-is, so I guess it was not the cause of the problem? Or at least is not easily reproducible... It certainly is not happening for me today in Revision:2707.
(0002579)
ench0 (reporter)
2012-05-28 08:24
edited on: 2012-05-28 08:35

Adding a patch and a BMP hex image to color enemy shadow a bit differently...

The BMP uses color 2 (0-based) from the original palette, hence the name CCELLSH2.BMP. I thought it may be important to preserve the 8.3 filename format...

The patch displays the enemy shadow in a slightly lighter shade than the current unit's shadow. Thus it is easier to see where the two shadows intersect and which is your unit vs. the other unit.

This is not the ideal solution, e.g. it would be much cooler to color the enemy shadow with some reddish color (you know - enemy... red...). However I have nott not looked yet into how exactly the CSDL_Ext::blit8bppAlphaTo24bpp function does its magic so I am not sure how exactly to make it display a red semi-transparent shade...

Nevertheless this is an improvement of my original impl. so please let's take it in for the time being, if there's no objections regarding the code.

(0002580)
ench0 (reporter)
2012-05-28 08:34

oh and I need to add a check for what Ivan said:

>>It should check for if movement shadow enabled in options

So I will add one more patch here for this as well.
(0002581)
Ivan (developer)
2012-05-28 08:45

Red (or any other non-gray) may not work. Red can be difficult to see for example on lava or fire fields, green won't work on grass or magic plains.

>> I am not sure how exactly to make it display a red semi-transparent shade...
I am not sure how to do this at all. Check CSDL_Ext::alphaTransform - it will change first 8 colors into semi-transparent colors
(0002582)
ench0 (reporter)
2012-05-28 09:11

Thanks for the tip Ivan, I look there.

Before doing this I also took a (very quick) look at the CDSL_Ext functions, saw that it is somewhat complex, decided that it's not something I can do in 30 minutes on a Monday morning and instead made the quick fix above :) (using color 2 from the palette). I'll look at this in more detail as soon as I have a little more free time...

In the mean time:
- the uploaded file colorize-enemy-move-shadow.02.patch is an incremental patch to only display the enemy movement shadow when movement and cursor shadows are enabled in the battle interface...
(0002584)
Tow (developer)
2012-05-28 22:49

> I am not sure how to do this at all. Check CSDL_Ext::alphaTransform - it will change first 8 colors into semi-transparent colors

Alpha transform just replaces first 8 colors in palette with transparent (or shady) black. You can't have transparent non-black colors with it.


However if you save 8bpp picture with transparent colors in palette (and not using the first, reserved colors), then it should "just work" with or without any transforms, if blitted with blit8bppAlphaTo24bpp.
(0002598)
Tow (developer)
2012-06-01 17:23

Second patch committed in r2738.
(0002691)
ench0 (reporter)
2012-06-15 12:01

Um, Tow... part-2 of this feature didn't actually make into the trunk.. sorry may have been my mistake due to not knowing the proper way of submitting patches or maybe I didn't explain it properly..

To get this in, both patch files (colorize-enemy-move-shadow.01.patch and colorize-enemy-move-shadow.02.patch) need to be applied, incrementally. Atm, it seems that only patch 02 has been applied.

And also the BMP file also needs to be added somehow to the resources - something which I also was not sure at all how you do it so I left it for someone more knowledgeable to decide how to go about this. On my machine I just added it to h3bitmap.lod with MMArchive but this is probably not the proper way..

I will wait a few days to see if anyone comments here and then will change status to unresolved again, to draw attention...

- Issue History
Date Modified Username Field Change
2012-05-04 09:38 ench0 New Issue
2012-05-04 13:53 majaczek Note Added: 0002401
2012-05-04 13:53 majaczek Note Edited: 0002401 View Revisions
2012-05-07 16:54 ench0 File Added: kb-enemy-movmt-shdw-256.bmp
2012-05-07 16:59 ench0 Note Added: 0002407
2012-05-14 13:01 ench0 File Added: show-enemy-move-shadow.01.patch
2012-05-14 13:07 ench0 Note Added: 0002423
2012-05-14 13:08 ench0 Note Added: 0002424
2012-05-14 13:08 ench0 Status new => feedback
2012-05-14 13:51 ench0 Note Edited: 0002424 View Revisions
2012-05-14 13:51 ench0 Note Deleted: 0002424
2012-05-14 16:51 Ivan Note Added: 0002428
2012-05-14 17:11 Ivan Note Edited: 0002428 View Revisions
2012-05-14 17:13 Ivan Note Edited: 0002428 View Revisions
2012-05-14 21:45 Ivan Note Edited: 0002428 View Revisions
2012-05-17 16:36 ench0 Note Added: 0002475
2012-05-17 16:36 ench0 Status feedback => new
2012-05-17 16:52 Ivan Note Added: 0002476
2012-05-22 08:28 Warmonger Assigned To => Warmonger
2012-05-22 08:28 Warmonger Status new => assigned
2012-05-22 10:16 Warmonger Note Added: 0002518
2012-05-22 10:16 Warmonger Status assigned => resolved
2012-05-22 10:16 Warmonger Fixed in Version => 0.89
2012-05-22 10:16 Warmonger Resolution open => fixed
2012-05-23 13:33 ench0 Note Added: 0002529
2012-05-24 15:20 Ivan Relationship added related to 0000966
2012-05-28 08:24 ench0 Note Added: 0002579
2012-05-28 08:24 ench0 Status resolved => feedback
2012-05-28 08:24 ench0 Resolution fixed => reopened
2012-05-28 08:25 ench0 File Added: CCELLSH2.bmp
2012-05-28 08:25 ench0 File Added: colorize-enemy-move-shadow.01.patch
2012-05-28 08:33 ench0 Note Edited: 0002579 View Revisions
2012-05-28 08:34 ench0 Note Added: 0002580
2012-05-28 08:34 ench0 Status feedback => assigned
2012-05-28 08:35 ench0 Note Edited: 0002579 View Revisions
2012-05-28 08:45 Ivan Note Added: 0002581
2012-05-28 09:04 ench0 File Added: colorize-enemy-move-shadow.02.patch
2012-05-28 09:11 ench0 Note Added: 0002582
2012-05-28 22:49 Tow Note Added: 0002584
2012-06-01 17:23 Tow Note Added: 0002598
2012-06-01 17:23 Tow Status assigned => resolved
2012-06-01 17:23 Tow Resolution reopened => fixed
2012-06-15 12:01 ench0 Note Added: 0002691
2014-05-30 17:41 beegee Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean