Cursed Lands. Refreshing the gameplay

Hi! Surely many have played a wonderful game from Nival Interactive – Cursed Lands.

It happens...
It happens…

Someone remembers her for seemingly difficult opponents, someone for a chic and amazing plot, someone for amazing features (crafting, stealth, the ability to steal enemy things from pockets and take partners for herself), and someone fell in love with her so like me, he chases orcs and wild boars throughout the allod to this day.

As for unique chips – there are really a lot of them in the PZ! What is the opportunity to collect different types of weapons from different materials, and even insert spells into them! By the way, you can do the same with armor.

Assembling weapons in the 1st shop provided to the main character
Assembling weapons in the 1st shop provided to the main character

The next feature is generally an amazing element of game design for the year 2000!

The white clouds represent the orc's field of vision (caused by casting the 4th from the top spell "line of sight") - she does not see Zach through a stump
White clouds mean the area of ​​view of the orc (caused by using the 4th from the top spell “Field of View”) – she does not see Zack through the stump

Zak sits behind a tree stump right in front of the orcs, who can’t see him. But if you get up…

Standing Zack falls into the field of view of the orc and she begins to fire...
Standing Zack falls into the field of view of the orc and she begins to fire…

Then the orc begins to see Zack, because now he is already taller than a stump! But this is far from all that for which you can express great respect to game designers and programmers of that time. Anyone who has run a PZ for at least 30 minutes probably remembers that romantic moment when Zack is given the opportunity to rob the first hefty cannibal he meets.

Stealing coins from an ogre
Stealing coins from an ogre

There are 4 ways to move in the game: running, walking, on cortans and lying down. The last 2 in the original balance of the game are absolutely silent ways of movement, while running, on the contrary, gathers suspicious opponents with its sound from a long distance. Therefore, I decided to rob the cannibal precisely on cortans so that he would not hear me.
While running, the stamina is consumed, and it is restored only if you are passively in one place. Attacking, casting, and moving characters cannot regenerate their stamina.

The game also has combat magic. Using offensive spells, like all others, seriously wastes the character’s stamina. Just look how beautiful Zack casts lightning on this lumberjack! It costs him almost his entire stamina despite inadequate pumping.

Very well developed character
Very well developed character

I love the dynamics in games, but this is not the most important thing. Most importantly, it looks rather stupid how the magician stands still and pours magic on his opponents, as if he is a warrior who put on armor and endures, and not a magician at all. In many modern games, you can attack on the move, which makes it possible for mages to keep a distance from the enemy and not get hit in the face by, say, a fat troll with a lot of HP and a lot of damage.

In the PZ, even the animation of such an action is not provided, because the gameplay of the magician is extremely ugly. Like, by the way, the shooter, who, although he doesn’t need a reserve of strength for shooting, can run away from the enemy for only a few seconds, and then he will immediately run out of steam … What can be done about this?

We will need: Cheat Engine, IDA, HxD and the Cursed Lands game itself.

We start the game and the Cheat Engine… We need to find out what writes the stamina into memory and what reads it from our hero’s memory.

Stamina = 375
Stamina = 375

We drive in the number opposite the blue scale and look for it in the memory of the game.exe process. It’s pretty easy to check that a character’s stamina is a float, like most numbers in this game regarding the stats of objects on cards.

To find the desired address, it is enough to run the hero around the map so that his stamina reserve changes and select the Decreased value option for screening in the Cheat Engine.

Hero power pool in game memory
Hero power pool in game memory

Already from the 3rd attempt, I found a reserve of strength in my memory. Now it’s time to find out what writes it and what reads it. Press RMB + Find out what writes to this address.

00548323 - D9 57 14  - fst dword ptr [edi+14]
0052382D - D9 5E 14  - fstp dword ptr [esi+14]
0054834B - C7 47 14 00000000 - mov [edi+14],00000000

We get such results. 1st – wasting stamina, 2nd – restoring stamina, 3rd – completely depleting stamina. The most interesting thing so far is that the character is not suffocated and runs depending on the amount of strength, and not a miserable 10 seconds.

The team keeps a reserve of strength in memory
The team keeps a reserve of strength in memory

We go a little higher and look at what is there at EDI + 14 and EDI + 18. The 1st and 2nd naturally turn out to be the hero’s reserve of strength. 1st – current, 2nd – maximum.

The fst instruction writes to memory from the FPU register, while the fld instruction takes from memory and writes to the FPU register.

It is worth paying attention to exactly where the fst dword ptr command we found [EDI+14] writes. The above command, on the contrary, takes the value from there.

Further, everything is already clear: first the current one is taken into the FPU registers, then the maximum stamina, then the maximum is multiplied by a constant (in the original it = 0.006666666666666666, but I changed it to 0.1), this number is subtracted from the current stamina and the result is thrown at it place. I wanted to make it so that the reserve of forces was spent at 0.2, and not at 0.1%. We do not need the maximum reserve of forces, as well as multiplication by something, we need to subtract the number itself. Using the site https://defuse.ca/online-x86-assembler.htm we get that the command we want has the following code:

dc 25 88 f0 73 00       fsub   QWORD PTR ds:0x73f088 

We insert it into the game engine using HxD, and the rest can be scored with the NOP command.

Rewriting the game code directly in HxD!
Rewriting the game code directly in HxD!

Now we need to put in another constant so that the character somehow loses his stamina while running (subtracting 1/150 is too little)…

9A 99 99 99 99 99 C9 3F = 0.2f
9A 99 99 99 99 99 C9 3F = 0.2f

Okay, now the character is running, losing stamina not by 1/150 of his part, but by 0.2 units. But this only means that with a stamina of more than 30, our main character will run longer than in the original, but this will not bring special dynamics in itself. Certainly in battles.

The very fact of the restoration of the reserve of forces suits us perfectly, we only need to change its conditions. Well, to be more precise, remove them away. Let’s see what the reserve of forces reads from the pieces of code and what is repelled from it. Restart the game and Cheat Engine. Press RMB + Find out what accesses this address. It is necessary to run a little again and stand, restoring the hero’s reserve of strength.

00548679 - D9 47 14  - fld dword ptr [edi+14]
005482D3 - D9 47 14  - fld dword ptr [edi+14]
00548315 - D9 47 14  - fld dword ptr [edi+14]
00522C82 - 8B 51 14  - mov edx,[ecx+14]
0052377A - D9 46 14  - fld dword ptr [esi+14]
00523805 - D8 46 14  - fadd dword ptr [esi+14]

We get this content. 1st – the inclusion of running, 2nd running, 3rd – running, 4th – change in stamina, 5th – relaxation, 6th – restoration of stamina.

It is natural and obvious that we are interested in the 6th and in what cases this command is executed in the game code. We carefully look higher in the assembler listing and find this is the beginning of the function there. We see a conditional transition just below, which does not immediately throw out of the function, but completely skips other checks, including skipping the restoration of stamina. Most likely this is a check whether the character is in 1st place (in relaxation) or not.

Function start
Function start

We are trying to change it so that there is no jump through this piece of code …

NOP commands have replaced the transition
NOP commands have replaced the transition

And yes! Everything worked out, now the hero regenerates his stamina even during the casting of the spell. Well, while running, of course, too.

Zak cast a spell and regenerated his stamina in 2 ticks
Zak cast a spell and regenerated his stamina in 2 ticks

Let’s change the value in game.exe via HxD to enjoy a dynamic game…

We remove the condition
We remove the condition

But that’s not all. The game for the magician, of course, is obtained in principle because of the magic. And dynamic play for the magician is determined by the spells themselves. There is a lot of unused magic in the game. Some spells are quite working and are simply not sold in stores, such as “dead man” and “dead man’s vision” (and in the add-on to the Cursed Lands – Cursed Lands: Lost in the Astral, on the contrary, they are sold, but “fireworks” and “teleportation” are not sold “). But some spells of the game are severely disabled right in the engine itself.

At 0x0067F870, there is a function in the game’s memory that selects 1 of 43 effects for the spell being used. Surely this screenshot will say a lot about the complexity of this function (there is quite a lot of everything)…

Scary spell function in PZ seen through IDA
Scary spell function in PZ seen through IDA

Quite a long and tedious, but at the same time, easily and simply, I came to this address, where 3 spells are cut out hard and rudely on the way by their number.

3 conditional jumps at the bottom - check for Link, Possession and Charm spells
3 conditional jumps at the bottom – check for Link, Possession and Charm spells

15h – Possession, 18h – Link, 24h – Charm. Now it all needs to be turned into a NOP in order to gain access to the secret spells! Wow, how intriguing!

We turn prohibitions (conditional jumps) into NOP
We turn prohibitions (conditional jumps) into NOP

So… New spells received! Now it is enough to enter the following commands in the game in the store into the console by clicking on “e”:

thingamabob
give 0 money 99999999
give 0 assortment

Now, so that the game does not get bugged, it is worth leaving the store, well, go back…

We buy spells for 200 (with pink smoke and light shine, this is Possession), for 3200 (with a dog, this is Charm) and for 400 (with a drunken man walking in the dark, this is Link) and go to test them!

Let’s start from the end… Link does absolutely nothing, it doesn’t even have code, just animation and its completion, a very useful spell.

Most likely they just didn’t have time to write the spell code
Most likely they just didn’t have time to write the spell code

Charm subdues the enemy in a very strange way, the spell clearly does not have a full code and the game crashes when trying to subdue the next enemy.

Possession is really a godsend!.. A screenshot would be better than any words.

Action Possession
Action Possession

This spell allows you to transfer the hero’s gaze to the enemy. The effect itself is not very effective, but very interesting. If it were on early allods, and eagle eye, night vision and clairvoyance were not on Gipat and Ingos (well, or in PZ: ZvA – on Suslanger and Gipat), this spell would be an excellent and interesting tool for spying on patrols and positions opponents.

I introduced these changes to the software a long time ago, and a little later I managed to push them in and add many more new ones to a special library, which is one of the largest additions to the software engine, which I called SpellAddon.

Using in-game scripts, it turned out to reset the aggression of opponents, which in the original was impossible without re-entering the game location, even teleporting across the entire map, through mountains and rivers, the enemy still found the main character and tried to kill him until 1 of them was defeated.

It is worth noting that everything written above is relevant for version 1.06 of the game and operations were not carried out on other versions.

Useful links:

https://evilislandsaddon.forumotion.com – a forum where you can find SpellAddon.
https://vk.com/evil.islands – group in VK
http://gipat.ru – forum “City of Junes”.
http://gipatgroup.org/forum – the largest, but not particularly functioning forum “GipatGroup”. However, it is now possible to read useful information on it.
http://honestgroup.net/forum — forum HonestGroup.

The Chosen One has arrived!
The Chosen One has arrived!

Good luck to all!

Similar Posts

Leave a Reply