Home » MODDING HQ 1.13 » Flugente's Magika Workshop » Absurdly small code changes  () 1 Vote
Re: Absurdly small code changes[message #340118 is a reply to message #340096] Tue, 17 March 2015 20:50 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
Cardinal wrote on Tue, 17 March 2015 01:04

MOLLE pouches that fit in large slots don't show the pocket volume value/icon

Filled MOLLE pouches can be attached to a rig which makes them appear empty, and items inside them are "hidden" until the pouch is removed.


Ok, I fixed both issues in r7788.

Attaching MOLLE pockets now works like this:
If there is something inside the pocket already it will be placed into the soldiers inventory. If there is no space it will be dropped to the ground.

I used the same mechanism for detaching MOLLE pockets. If there is something inside the pocket detaching is no longer denied but the content is placed in the soldiers inventory or on the ground. If MOLLE pockets are manipulated in sector inventory contents are always put on the ground instead of the soldiers inventory.

It's not a perfect solution but still better than the old bugs.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #340142 is a reply to message #340118] Thu, 19 March 2015 15:19 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
In addition to the changes to camo I posted here exe r7791 enables us to see detailed camo info for a merc on the map screen. The info displayed is the same that we can already see on the tactical screen.

http://picload.org/image/cwwgipp/camo.png



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #340145 is a reply to message #340142] Thu, 19 March 2015 19:13 Go to previous messageGo to next message
edmortimer

 
Messages:1046
Registered:January 2015
Location: Home Free
It just keeps getting better and better!




Arulco Vacations Blog

Arulco Vacations Bears Pit Forum


Re: Absurdly small code changes[message #340344 is a reply to message #340145] Wed, 01 April 2015 00:05 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
As of r7803 and GameDir r2231, we have 2 new ammo properties:
  • <dDamageModifierLife> alters the life damage a bullet deals. Default 1.0, valid values from 0.0 to 100.0
  • <dDamageModifierBreath> alters the breath damage a bullet deals. Default 1.0, valid values from 0.0 to 100.0
Note that breath damage and life damage are independent of each other (they are both based on a bullet's impact, an internal value you won't see ingame). So it would is possible to have a bullet that deals no damage to life at all but completely knocks out a target, for example.

To demonstrate this, 12 gauge Rubber slugs have been added. Item pictures have been provided by smeagol - thank you, oh provider of Arts!
Rubber slugs have lowered range and accuraccy and deal higher breath damage than a normal slug would. Their damage, however, is just 30% of what you are used of a shotgun. Might be useful if you want to take prisoners.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340345 is a reply to message #340344] Wed, 01 April 2015 00:40 Go to previous messageGo to next message
Gambigobilla

 
Messages:719
Registered:July 2008
While it says "absurdly small code changes" yet the changes are immensely awesome.
Re: Absurdly small code changes[message #340349 is a reply to message #340345] Wed, 01 April 2015 12:23 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
Flugente, would you be so kind to replace the 2 shell picture with a picture of 2 shells? At the moment it is the same picture as the drum box which can be quite confusing.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #340351 is a reply to message #340349] Wed, 01 April 2015 14:05 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Hu? Hmm. Perhaps I made a typo somewhere, will check in the evening.

I'd also like to point out that if using an exe >= r7803, I strongly suggest using the new AmmoTypes.xml as well. The reason is that if the xml tags are not present, the game will likely use a default value of 0.0 - which would lead to gun performanece being somewhat, ehem, lacking damage. Simply add those tags to every ammo type and bee done with it. This of course goes for any mod as well. Then again, no modder would ever use a new exe without the appropriate data, right? Riiight?



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340352 is a reply to message #340351] Wed, 01 April 2015 15:14 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
p1item896.sti contains a picture of a drum box instead of two shells. It's the same picture as the p1item900.sti.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #340357 is a reply to message #340352] Wed, 01 April 2015 19:37 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Thansk, fixed in r2232.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340397 is a reply to message #340357] Fri, 03 April 2015 23:20 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
A cosmetic change in r7808: when aiming a weapon in prone stance, this also counts as mounting the weapon. I hereby redefine mounting as weapon is readied and leaning on a physical object, which can be a structure, person or floor. Calculations will not be affected - this is basically visual: whenever M appears on your gun, you get (part of) the prone stance boni.

Simply seems easier to understand to me.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340682 is a reply to message #340397] Wed, 22 April 2015 22:58 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Mercs roping down from the heli might be a cool animation, but it gets boring fast if one has to watch the entire team doing it. That's why as of r7832 up to 3 mercs can rope down at the same time. Looks a bit like synchronous swimming, but hey, it's faster.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340685 is a reply to message #340682] Thu, 23 April 2015 06:57 Go to previous messageGo to next message
Vince7403

 
Messages:146
Registered:February 2012
I resent your implication that synchronized fast-roping is a lame sport! We will take the Olympics by storm! Possibly literally!
Re: Absurdly small code changes[message #340690 is a reply to message #340685] Thu, 23 April 2015 23:55 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Pah. Synchronised squads die easily - kill one, the rest die out of team spirit.

Anyway, smeag had a good idea, and I implemented it in r7833:

Anything you'd normally apply on your merc in tactical (canteens, food, drugs, clothes, elixirs...) can now also be applied in strategic. It was always very inconvenient if you wanted to feed 10 mercs and had to give each of them food items, then assign them to a squad, then enter tactical and so on (technically not necessary, as they autofeed, but I know you people like to micromanage everything).



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340691 is a reply to message #340690] Fri, 24 April 2015 00:18 Go to previous messageGo to next message
grim

 
Messages:307
Registered:July 2006
Location: France
Yes we do!
Great addition, again.
Thanks Flug.
Re: Absurdly small code changes[message #340938 is a reply to message #340691] Sun, 10 May 2015 13:44 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Update (r7851 & GameDir r2240):
  • Some vanilla mercs (Buzz, Biff, Flo, Haywire, Razor, Bubba) were absolutely incapable of certain conversations. This meant that they could never ever be good at some conversation parts. As a result, even a lvl 10 Flo with maxed out stats everywhere and a higher killcount than Robocop was incapable of threatening, say, a shy puppy. This has been corrected - the mercs can now do these dialouge choices, they are jut very, very bad at it.
  • Wirecutters no longer give a bonus to disarm, as there is a separate tag for this JMich introduced (wasn't used in stock 1.13 before though). Similar, toolkit, wirecutter, utility knife & KCB knife now have a bonus on disarming bombs. The bonus also depends in their status, it is sufficient to have them somewhere in the inventory.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #340955 is a reply to message #340938] Mon, 11 May 2015 14:58 Go to previous messageGo to next message
Slax

 
Messages:1439
Registered:July 2006
Location: People riding polar bears...
Buns got some work done.
(Pun gun to my head. I had to)



1.13: Install JA2, unpack latest, play.
AIMNAS: Complete 1.13 installation, Download ZIP and unpack, play.

Re: Absurdly small code changes[message #341062 is a reply to message #340955] Wed, 20 May 2015 00:05 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
A little code bit that will mostly be relevant with Increased teamsizes in r7868: If a sector has less placements (map editor-defined) for militia than militia slots, what happens is that the excess militia simply does not appear in tactical. This can effectively limit you in defense - you might have 64 militia here, but only 32 will show in combat eek This is only relevant for militia in that sector itself though, not for those that reinforce from adjacent sectors in tactical.

I added a code part that distributes these excess militia to random locations instead of not spawning them, but only up to the minimum of MAX_MILITIA_PER_SECTOR, MAX_NUMBER_MILITIA_IN_TACTICAL and MAX_STRATEGIC_ENEMY_GROUP_SIZE, for compatibility reasons.

All of this wont even be an issue with stock settings (most maps have at least 32 placements) though, so no worries there.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341086 is a reply to message #341062] Thu, 21 May 2015 21:58 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
As of r7872 when a merc tries to blow up, unlock (with a key) or pick a lock he will only unlock that lock and not open the door automatically. This means that you can now unlock a door, end your turn and open the door in the next turn with almost full AP instead of being a sitting duck in the doorway.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #341090 is a reply to message #341086] Fri, 22 May 2015 00:32 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Smeag stumbled upon a very weird bug, and it took me a while to fix it (r7873). What happened was that if one of his mercs hit someone, sometimes he then gained an absolutely obscene amount of stats (in this case, he gained 32 DEX and 38 MRK).

The reason is this code part (shortened for clarity):
UINT16 usExpGain = 10;
usExpGain = (usExpGain * pBullet->sHitBy) / 100;

...

// MARKSMANSHIP/DEXTERITY GAIN: gun attack
StatChange( pFirer, MARKAMT, ( UINT16 )( (usExpGain * 2) / 3 ), FROM_SUCCESS );
StatChange( pFirer, DEXTAMT, ( UINT16 )( usExpGain / 3 ), FROM_SUCCESS );
...
This might seem harmless - we gain experience depending on how hard the shot was, represented by pBullet->sHitBy - but this is nefarious. sHitBy is INT16, thereby signed. usExpGain is UINT16, thereby unsigned. If sHitBy is negative, which happened here (at the moment I'm not interested what exactly NCTH does there), usExpGain 'rolls over' - here, it became 65535. Which is an obscene amount of experience, which results in this whacky stat gain.

Today's morale: Don't do that, dammit! Unfortunately, I cannot check for this effect in StatChange, as I cannot determine in there whether exactly this happened earlier. I can merely look at all other locations where we can gain stats (which are a lot) and build in safety checks (in this case, only award exp if sHitBy > 0.0).

Hopefully, any other coder reading this can now be aware of this problem and keep his/her eyes open.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341091 is a reply to message #341086] Fri, 22 May 2015 00:36 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
silversurfer wrote on Thu, 21 May 2015 18:58
As of r7872 when a merc tries to blow up, unlock (with a key) or pick a lock he will only unlock that lock and not open the door automatically. This means that you can now unlock a door, end your turn and open the door in the next turn with almost full AP instead of being a sitting duck in the doorway.
That sounds really helpful thumbs up . Is this also active in realtime/non-combat? It might be a bit annoying there, if you always have to open the door after picking the lock.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341097 is a reply to message #341091] Fri, 22 May 2015 10:27 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
Flugente wrote on Thu, 21 May 2015 23:36
silversurfer wrote on Thu, 21 May 2015 18:58
As of r7872 when a merc tries to blow up, unlock (with a key) or pick a lock he will only unlock that lock and not open the door automatically. This means that you can now unlock a door, end your turn and open the door in the next turn with almost full AP instead of being a sitting duck in the doorway.
That sounds really helpful thumbs up . Is this also active in realtime/non-combat? It might be a bit annoying there, if you always have to open the door after picking the lock.

That's a good point. I changed the behaviour in r7874 so the new door opening mechanism is only active during turn-based combat.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #341198 is a reply to message #341062] Wed, 27 May 2015 21:32 Go to previous messageGo to next message
Uriens

 
Messages:330
Registered:July 2006
Flugente wrote on Tue, 19 May 2015 21:05
A little code bit that will mostly be relevant with Increased teamsizes in r7868: If a sector has less placements (map editor-defined) for militia than militia slots, what happens is that the excess militia simply does not appear in tactical. This can effectively limit you in defense - you might have 64 militia here, but only 32 will show in combat eek This is only relevant for militia in that sector itself though, not for those that reinforce from adjacent sectors in tactical.

I added a code part that distributes these excess militia to random locations instead of not spawning them, but only up to the minimum of MAX_MILITIA_PER_SECTOR, MAX_NUMBER_MILITIA_IN_TACTICAL and MAX_STRATEGIC_ENEMY_GROUP_SIZE, for compatibility reasons.

All of this wont even be an issue with stock settings (most maps have at least 32 placements) though, so no worries there.


Any chance to get a new exe to use for testing? Seems very useful. I have upped enemy garrison's to 500% of normal and enemy attacks me with usually 50-60 soldiers. Having full militia force to counter this helps.
Re: Absurdly small code changes[message #341299 is a reply to message #341198] Mon, 01 June 2015 23:23 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
As of r7884 & GameDir r2247,
  • Stat losses are now displayed in the laptop, just like stat gains.
    - Breath regeneration through sleep is now displayed in a tooltip in strategic (in case you wonder how much sleep you require if your merc suffers from hunger, disease and a sleeping bag.
    - If NOTIFY_IF_SLEEP_FAILS is set to FALSE, there is no popup box is ordering a merc to sleep fails (default is TRUE). I currently play with ~50 mercs, it is annoying to order them to sleep and cosntantly have that little box pop up cheeky.
http://i.imgur.com/IVgrHwf.png



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341635 is a reply to message #341299] Wed, 08 July 2015 23:02 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
As of r7906 & GameDir r2259, there is a new item tag in Items.xml: mines with <antitankmine> set to 1 will only be activated by vehicles or robots.
I've added the soviet TM-62P2 antitank mine. It is powerful enough to seriously damage or even destroy tank... or, say, an icecream truck. Any human or animal, however, can simply walk over it without ever noticing it.
For added fun, this mine is made with plastic casing and thereby not detectable via metal detectors.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341817 is a reply to message #341635] Mon, 20 July 2015 21:14 Go to previous messageGo to next message
Parkan

 
Messages:445
Registered:April 2010
Location: Russia,Sevastopol

Toggle Spoiler


Is it possible to add this feature to stable release?I know in ja2_option.ini in stbale release that feature was here but in game it is not worked.on unstable release it work.



1.Serve the public trust
2.Protect the innocent
3.Uphold the law(c)Robocop
Re: Absurdly small code changes[message #341819 is a reply to message #341817] Mon, 20 July 2015 23:19 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
The feature was not present in the stable release and nobody is going to back-port features into an old release. You'll have to use the current development build if you want newer features.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #341821 is a reply to message #341819] Tue, 21 July 2015 01:09 Go to previous messageGo to next message
Parkan

 
Messages:445
Registered:April 2010
Location: Russia,Sevastopol

Does the stable release became already old vs Development build?



1.Serve the public trust
2.Protect the innocent
3.Uphold the law(c)Robocop
Re: Absurdly small code changes[message #341824 is a reply to message #341821] Tue, 21 July 2015 09:29 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3805
Registered:July 2009
Stable is old and severely lagging behind the Unstable on release day. Only gets worse from.there.



Chat with us!
#bearpit on IRC
Discord
Get your latest 1.13 Builds
(Pls don't use my forum PMs for general game queries)


Re: Absurdly small code changes[message #341828 is a reply to message #341821] Tue, 21 July 2015 13:25 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
Parkan wrote on Tue, 21 July 2015 00:09
Does the stable release became already old vs Development build?

The stable version is older than you think. The gap between stable r7609 and current dev build 7919 might not sound big but feature wise the stable branch is based on r6749 and that is quite a big gap. Recommendation is to use the dev build if you want all the features. I don't think that there will be another "stable" version anyway. It's too much hassle for not much gain.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #341846 is a reply to message #341828] Thu, 23 July 2015 00:45 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
There are several problems with activating cheats via Ctrl + GABBI:
  • If one accidentally presses a wrong key, cheats are reset. This is very annoying while debugging keypresses - if Ctrl is stuck and you press one of those buttons, very helpful cheats that are very useful in debugging are deactivated.
  • This isn't a competitive game. If someone wants to cheat, why not. Why have them jump through the hoop of entering that stupid code all the time?
  • The cheat activation takes up valuable key combos.
For this reason, as of r7927, pressing [Ctrl] + [g] causes this prompt to activate/deactivate cheats (whatever fits):
http://i.imgur.com/U07tRKz.png
If someone would not know that, he' still start by [Ctrl] + [g], so he'll find the prompt anyway.

And no, this is not optional. We won't keep outdated, tedious stuff just for the sake of nostalgia or whatever.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341847 is a reply to message #341846] Thu, 23 July 2015 16:29 Go to previous messageGo to next message
Slax

 
Messages:1439
Registered:July 2006
Location: People riding polar bears...
Neat! Maybe list the cheats on the menu too? For us forgetful folks.

[Updated on: Thu, 23 July 2015 16:30]




1.13: Install JA2, unpack latest, play.
AIMNAS: Complete 1.13 installation, Download ZIP and unpack, play.

Re: Absurdly small code changes[message #341848 is a reply to message #341847] Thu, 23 July 2015 22:11 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Google is your friend. I'm not checking the entire code for that.

In other cheat-related news, as of r7928,
  • Obliterating a sector [Alt] + [o]) will now destroy tanks as well.
  • Spawning a new enemy via [Alt] + [b] can create tanks.
This should make debugging tank-related issues more tester-friendly.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341859 is a reply to message #341848] Sat, 25 July 2015 00:46 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
In fortification-related news, two issues have been fixed in r7931:
  • When jumping over fences or sandbags, mercs occasionally jumped into the structure. This was a result of the code being needlessly complicated to achieve... something. This has now been fixed.
  • Sandbags could only be jumped if their height was < 2. But a structure with a .jsd-size of 1 barely offers protection, thus limiting the usefulness of sandbags. It was also no visual barrier, as pointed out here.
    I've changed the code - now sandbags with a height of 2 can also be jumped over. This requires changed jsd files, which have been added to the stock GameDir in r2266.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341863 is a reply to message #341859] Sat, 25 July 2015 20:28 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
Message boxes are very limited. I've added a little expansion in r7935:

http://i.imgur.com/pmMpmpQ.png
This dropdown box is fully functional. We are thus no longer limited to 16 buttons. I have no good example of this in the trunk, but the code is fairly simple. Here's how to create such a message box:
std::vector<std::pair<INT16, STR16> > dropdownvector;

for ( INT16 i = 12; i < 30; ++i )
  dropdownvector.push_back( std::make_pair( i, szNationalityText[i] ) );

DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).SetEntries( dropdownvector );
DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).SetHelpText( szPMCWebSite[TEXT_PMC_CONTRACT_DROPDOWNTEXT] );

wcscpy( gzUserDefinedButton1, L"Whatever." );
wcscpy( gzUserDefinedButton2, L"Uhm... green?" );

DoMessageBox( MSG_BOX_BASIC_STYLE, L"How do you feel?", GAME_SCREEN, (MSG_BOX_FLAG_GENERIC_TWO_BUTTONS | MSG_BOX_FLAG_DROPDOWN ), YourMessageBoxCallBack, NULL );

Note that MSG_BOX_FLAG_DROPDOWN is flag and can (and should) be used along other flags to create the buttons we want. Once a button is pressed, the box closes. Evaluate it in your callback:
void YourMessageBoxCallBack( UINT8 ubExitValue )
{
  INT16 val = DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).GetSelectedEntryKey( );

  switch( ubExitValue )
  {
    ...

In order for this to work, I had to alter the mouse priorities if the message box region that blocks all callbacks not in the box and the dropdown mouse priorities. In the worst case, this might led to some glitches, though I haven't found any for now.
When you add several rows of buttons, the box might be too small. In true Sirtech style code, the game crashes if that background has a height > 207, because reasons. Will fix if necessary.

[Updated on: Sat, 25 July 2015 20:29]




Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341871 is a reply to message #341863] Mon, 27 July 2015 00:54 Go to previous messageGo to next message
M16AMachinegun

 
Messages:307
Registered:September 2013
I have an idea for a use, Flugente.
Create a cheat that allows you to spawn an item using the dropdown menu? as in being able to scroll through weapon names and pick which rifle you want to spawn, etc

I imagine that especially with wil's mods there'll be some spaces between items, so some limitation will be needed. Definitely would be faster than having to alt-tab and look up values in the xml editor though
Re: Absurdly small code changes[message #341872 is a reply to message #341871] Mon, 27 July 2015 01:28 Go to previous messageGo to next message
Flugente

 
Messages:3307
Registered:April 2009
Location: Germany
You mean as an alternative for [Alt] + [.]? Even with stock data that would be way to time-consuming, scrolling through 1.7k items, let alone in mods.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #341873 is a reply to message #341872] Mon, 27 July 2015 05:45 Go to previous messageGo to next message
Someone64

 
Messages:40
Registered:May 2015
Location: Philippines
Well, you could have like a search feature where you can type the name or part of the name of any item to find it.
Re: Absurdly small code changes[message #341874 is a reply to message #341873] Mon, 27 July 2015 10:45 Go to previous messageGo to next message
silversurfer

 
Messages:2296
Registered:May 2009
Why implement a search feature that is already there? Just open Items.xml in any text editor and search for whatever you want. I would rather have Flugente spend his time on useful stuff than polishing cheats.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #341893 is a reply to message #341090] Wed, 29 July 2015 05:41 Go to previous messageGo to next message
Franimus

 
Messages:43
Registered:June 2015
Location: USA
Flugente wrote on Thu, 21 May 2015 17:32
...
This might seem harmless - we gain experience depending on how hard the shot was, represented by pBullet->sHitBy - but this is nefarious. sHitBy is INT16, thereby signed. usExpGain is UINT16, thereby unsigned. If sHitBy is negative, which happened here (at the moment I'm not interested what exactly NCTH does there), usExpGain 'rolls over' - here, it became 65535. Which is an obscene amount of experience, which results in this whacky stat gain.
...


I'd like to clean up the warnings in the code like this one. What's the best way to go about getting that integrated? Zip file or request repo access?
7-year C++ professional. With maybe a touch of OCD for stuff like that.
Re: Absurdly small code changes[message #341896 is a reply to message #341893] Wed, 29 July 2015 11:23 Go to previous messageGo to previous message
silversurfer

 
Messages:2296
Registered:May 2009
Franimus wrote on Wed, 29 July 2015 04:41

I'd like to clean up the warnings in the code like this one. What's the best way to go about getting that integrated? Zip file or request repo access?
7-year C++ professional. With maybe a touch of OCD for stuff like that.

Best way is to create a patch for the latest code and drop a message to user RoWa21. He can apply it to the repository.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Previous Topic: New feature: Intel
Goto Forum:
  


Current Time: Mon May 21 10:14:22 EEST 2018

Total time taken to generate the page: 0.01967 seconds