Curse of the Azure Bonds – build 1.1.3 released

Version 1.1.3 of Curse of the Azure Bonds is now up on the Google Code project site (Windows & Mac OS X builds).

I had managed to break a number of parts of the game that were working correctly due to “refactoring” the code. Not sure I’ve learn my lesson, but there are a good many issues introduced, of which not all are fixed yet.

Fixed in this version:

  • Issue 54, Fixed join items command, to not loose items
  • Issue 55, Fixed crash from readying items from wrong class
  • Issue 56, Fixed pooling of party money loosing gems and jewellery
  • Issue 61, Fixed the group view display of AC
  • Fixed colouring of sprites, missing black pixels
  • Fixed sharing not removing treasure from ground

Thanks to Manning and Chaney for providing issue reports, and as always any issues found, post them here in the comments, email me directly (simeon.pilgrim@gmail.com), or post on the issue list.

IDA Script: Fixing overlay jumps

In the DOS Gold Box games they use overlays to manage the ‘more code than memory’ problem of the DOS environment.

So when this code here (seg000:00F6) calls the sub_21979 it goes via a sub function sub_10180

Which jumps to the actual function when it has been loaded into ram (after swapping some other code out and other magic!)

here the actual called function

And IDA Pro links this all together auto-magically so life is good.

But really we want to remove the jump functions out of the loop, as we can have the whole project in memory. The main advantage of cleaning up is that sub_21979 only shows one place the refers to this function (green code in top right of picture), but the jump function may have many callers, and we don’t see that, and to explore the code requires jump in and out of the jump function, which gets annoying.

Here an .idc script to fix this up. It finds all the overlay jump functions, then loops across the referencing locations and rewrite those to call the actual jump target.

#include <idc.idc>

static main()
{
	auto seg, loc;
	auto off, base;
	auto xref;

	seg = FirstSeg();

	while(seg != BADADDR )
	{
		loc = SegStart(seg);

		if( Byte(loc) == 0xCD && Byte(loc+1) == 0x3F)
		{
			Message("Fixing segment %s jumps\n", SegName(seg));

			loc = loc + 0x20;

			while(loc < SegEnd(seg))
			{
				if( Byte(loc) == 0xEA )
				{
					off = Word(loc+1);
					base = Word(loc+3);

					xref = RfirstB(loc);
					while( xref != BADADDR )
					{
						Message("Loc %x ref from %x\n", loc, xref);

						PatchWord(xref+1, off);
						PatchWord(xref+3, base);

						DelCodeXref(xref, loc, 0 );

						xref = RnextB(loc, xref);
					}
				}

				loc = loc + 5;
			}
		}

		seg = NextSeg(seg);
	}
}

And now our original calling function calls the real function

And the jump function has nobody call it, but we leave it there in case some later decoded code does call it…

And our called function correctly refers to the code that calls it

Gold Box games Cheat Codes

On the Forgotten Realms Unlimited Adventures Forum it was asked for the ‘The Gods intervene!’ cheats for all the Gold Box based games, so I produced this list.

Pool of Radiance Forgotten Realms series:

  • Pool of Radiance cheat code is ‘start.exe STING’
  • Curse of the Azure Bonds cheat code is ‘start.exe STING Wooden’ as noted here
  • Secrets of the Silver Blade cheat code is ‘start.exe Hoop Gem’ as noted here
  • Pools of Darkness cheat code is ‘game.exe 2 2 Helm’ as noted here
  • FRUA doesn’t seem to have obvious cheat code. aka not based on PoR code

Savage Frontier Forgotten Realms series:

  • Gateway to the Savage Frontier currently needs a hacked executable (here) and then ‘game.exe Super Wooden’ press the Z button on your turn and ‘-‘ on the monsters
  • Treasure of the Savage Frontier ‘game.exe 2 2 Helm’

Dragonlance series:

  • Champions of Krynn cheat code is ‘start.exe Woof Helm’
  • Death Knights of Krynn cheat code is ‘start.exe anything Helm’
  • Dark Queen of Krynn appears the same code as FRUA so again not sure.

The two Buck Rogers game are using the PoR code base, but all the normal cheat code has been removed. And there is no obvious “Gods intervene!” in the text strings of the engine

Spelljammer: Pirates of Realmspace  is a different code base, the previous games PoR based code bases are Pascal where as this one is C/C++, I couldn’t see anything that looks like a “Gods intervene” text string ether.

Secerts of the Silver Blade cheat codes

Parameter 1 set to Hoop

  • Skips the title screen
  • Allows turning on/off of the debugging
  • Allows player affect dumping

Parameter 2 set to Gem

  • Skips the copy protection
  • Allows ‘The Gods intervene!”, via alt-x
  • Allows area view in all locations
  • The code has support for ‘Turning on/off free training, via J in training menu’ but as the menu’s no longer use keyboard short-cuts, so I can’t see how to activate it

Pools of Darkness cheat codes

There are a few debugging/testing cheat codes for the DOS version of Pools of Darkness.

The first: adding a 1 as the first parameter skips the title screen, and copy protection.

game.exe 1

Then there are three choices of third parameter

  • Gem – Allows view of the area map in all locations
  • HALIBUT – Allows editing/modifying of experienced players
  • Helm – Allows ‘The GODS Intervene!’ – a.k.a. kills all enemy in combat, via alt-x

Thus to play the latter you would type

game.exe 1 2 Helm

What I don’t know yet is how to control what game is loaded if you use the 1 parameter, and the game ends up in a slightly unplayable mode. From reading the code it looks like it should load saved game Z. But that’s not working out for me so far.