-----------------------------------------------------------------------------
File name:	zoom_fix.txt		Revision date:	2000.09.12
Revised by:	Ronald Andersson	Revision start:	2000.09.12
Created by:	Ronald Andersson	Email address:	dlanor@ettnet.se
-----------------------------------------------------------------------------
Format:		Normal Ascii with 78 char line limit and 8 char tab spacing.
Origin:		"add1.doc" and "addr2.doc" from the archive "ffehack.zip".
-----------------------------------------------------------------------------
Credits:
Some info in this file were found in FFE hacking files by George Hooper.
The material includes patch address information quoted from those files,
and I hope that this does not offend him or anyone else.

Other info comes from my own experiments with FE2 hacking on Atari systems.
Most of the table structures of FFE are identical to those of FE2, in some
cases even including the same bugs, which can then be fixed just as for FE2.
-----------------------------------------------------------------------------
The purpose of zoom_fix:
------------------------

zoom_fix is not a hack to change the game, but a bugfix to make one of the
game features work as it was intended, which it will not do at present for
some of the 'non-standard' ships.  (Ships not intended for game player.)
Applying zoom_fix to a normal game version does not change it into a hacked
version, but only changes it to be a bugfixed but still normal game version.

Hacks exist for letting a player get non-standard ships, and some even have
info on how to fix the 'zoom' data, but that means using a hacked version of
the game.  That is not a good idea, as it is better to use hacked versions
only to produce a commander file with the non-standard ship, and then use a
normal game version for playing the game with that ship.

This is where zoom_fix comes in, as it lets you make a perfectly normal
game version, capable of letting the player use any of those ships without
problems, though it will not make them available for purchase.  No release
version of the game can use those ships without serious problems, unless
zoom_fix or equivalent patches have been applied.

Attempting to do so will cause erroneously zoomed displays to be so garbled
that continued gameplay is impossible, and in some cases the huge amounts
of graphic data produced by such zooming will overwrite some RAM area that
is crucial to the system or to the game. The system will then usually crash.

For lighter ships it is less likely to be so bad, but it is still annoying
when a ship is displayed only as a microscopic dot, instead of properly
scaled. For full enjoyment of all these ships the zoom_fix patch is needed.

That is why zoom_fix should be considered a mandatory patch, and needed by
all who want to be able to use non-standard ships in a normal game version.
-----------------------------------------------------------------------------
Purposes zoom_fix does NOT have:
--------------------------------

It is not my intention to teach you to hack in general, nor even how to do
it for FFE. For general info on that I refer you to the many fine files on
that subject written by George Hooper.  IMO you should get FFEHACK.LZH .
That package contains the program HEXED.EXE, used for patching the game
file, as well as a number of documents describing various hack methods in
some detail.

If you have any trouble applying the zoom_fix patch to your game, then it
is because you lack some of the info in the documents above, so read them.


What you get from me:
---------------------
I will only give you the base addresses of each ship as used in FFEHACK.LZH,
which covers the five most common versions, and has some info on how to find
similar tables in any version existing.  That will have to do.

That is of course in addition to the list of ZOOM fix values for the ships.
-----------------------------------------------------------------------------
The 'zoom_fix' patches:
-----------------------
Here follows the patch info for ships that need 'zoom_fix' if ever flown by
player.  Note that not all of them are intended as ships, but can be used as
such by hacking the 'Startup' ships in a hacked version of the game.

Starting that and saving to disk allows you to use those ships in the normal
game later.  This is the only way to get ships with some special properties,
such as 1 ton 'Fully Loaded Mass', without running a 'hacked' game version.
(As explained further above, 'zoom_fix' itself is a bugfix, not a hack.)

But 'nuff said'  for now, here is the base address info:
--------------------------------------------------------
Ship	Name			Eng-CD	Eng-CD	Eng-CD	Eng-FD	Eng-FD
 ID	 ID	ITEM		v1.01	v1.05	v1.1R	v1.02	v1.1R

 04	 00	Dummy Mine	088A80	088B94	088E48	088684	088C18
 05	 01	Proximity Mine	088B06	088C1A	088ECE	08870A	088C9E
 06	 02	Homing Missile	088B90	088CA4	088F58	088794	088D28
 07	 03	Smart Missile	088C1A	088D2E	088FE2	08881E	088DB2
 08	 04	Naval Missile	088CA4	088DB8	08906C	088898	088E3C
 09	 05	MV1 A.Missile	088D2E	088E42	0890F6	088932	088EC6
 0A	 06	MV2 A.Missile	088DB8	088ECC	089180	0889BC	088F50
 0B	 07	Tharg. Missile	088E42	088F56	08920A	088A46	088FDA
 0C	 08	Mycoid Missile	088ECC	088FE0	089294	088AD0	089064
 0D	 09	Nuclear Missile	088F56	08906A	08931E	088B5A	0890EE
 11	 0D	Unknown_11	0895AC	0896C0	089974	0891B0	089744
 31	 2E	Unknown_31	0914F6	09160A	0918BE	0910FA	09168E
 34	 31	Unknown_34	0919AC	091AC0	091D74	0915B0	091B44
 3F	 3E	Unknown_3F	093C38	093D4C	094000	09383C	093DD0
 45	 45	Thargoid	096430	096544	0967F8	096034	0965C8
 46	 3C	Lynx BC		096544	096658	09690C	096148	0966DC
 47	 46	LR Cruiser	0967E6	0968FA	096BAE	0963EA	09697E

NB:  All of the above can be flown as player ships in a normal game version,
     (my own favourite is the 'dummy mine', with turrets and 60 G thrustors)
     although you need a hacked version to be able to get these ships. Some
     of the ships also need minor hacks for best usefulness, such as adding
     functional turrets, but such things are not saved in commander files.
     For such hack features you need to play in a slightly hacked version.


And here is how to use the base addresses:
------------------------------------------
We need to patch the ZOOM word (2 bytes) which is at offset 12 ($0C) from
the base addresses given above.  What you should do is to identify that
location for each ship, and check the value there to see if it is the same
as the 'Old Value' specified in the table below, and if so you just replace
it with the 'New Value' also specified in the table.  If something doesn't
match up, be careful, for you may be digging in the wrong place...

And finally, here are the 'zoom_fix' codes:
-------------------------------------------
Ship	Name			 Old	 New
 ID	 ID	ITEM		Value	Value

 04	 00	Dummy Mine	64 00	0A 00
 05	 01	Proximity Mine	64 00	0A 00
 06	 02	Homing Missile	64 00	10 00
 07	 03	Smart Missile	64 00	10 00
 08	 04	Naval Missile	64 00	10 00
 09	 05	MV1 A.Missile	64 00	10 00
 0A	 06	MV2 A.Missile	64 00	10 00
 0B	 07	Tharg. Missile	64 00	10 00
 0C	 08	Mycoid Missile	64 00	10 00
 0D	 09	Nuclear Missile	64 00	10 00
 11	 0D	Unknown_11	3C 00	82 00
 31	 2E	Unknown_31	B4 00	08 02
 34	 31	Unknown_34	E0 01	18 01
 3F	 3E	Unknown_3F	3C 00	2C 01
 45	 45	Thargoid	F4 01	DC 05
 46	 3C	Lynx BC		20 03	1A 04
 47	 46	LR Cruiser	64 00	98 3A

Here is a reminder of the data table layout:
--------------------------------------------
F-THR R-THR GM SM FLM   IC    COST  ZOOM  ID    CW    MP    DV
xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 40 xx 00 xx 00 xx

And the same as a C struct:  (heavily commented, and with additions)
---------------------------
typedef	struct ship_data_block
{	int16	f_thrust;	/* Forward thrust. +60G == 0x7FBC	*/
	int16	r_thrust;	/* Reverse thrust. -60G == 0x8044	*/
	uint8	gun_mounts;	/* Number of gun mounts.  0..4 allowed.	*/
	uint8	scoop_mount;	/* 0x01 to have it, else 0x00		*/
	int16	full_mass;	/* Fully loaded mass < 32768		*/
	int16	intern_capacity;/* room for equipment < 32768		*/
	int16	cost;		/* Ship cost/ 1000			*/
	uint16	zoom_divisor;	/* divides ship size for some displays	*/
	uint16	ship_id;	/* id of interpreter string for ship	*/
	uint16	crew;		/* Avoid high value (too few recruits)	*/
	uint16	missile_pylons;	/* up to 10 missile pylons allowed	*/
	uint8	norm_drive;	/* code of normal drive for ship	*/

/* Here ends the part of the struct documented by George Hooper in the	*/
/* hack archive mentioned above. I found the following additional facts */
/* in my analysis of FE2, and have verified identical FFE functionality	*/

	uint8	aux_drive;	/* code of aux drive + fixdrive flag	*/

/* The byte above is what you change to make it legal to swap drives	*/
/* in ships that normally don't allow this.  Just clear the top bit.	*/
/* The low bits can specify an alternate drive for built-in commanders.	*/
/* They get either norm_drive or aux_drive.  You only get norm_drive.	*/

	uint16	rating;		/* rating*256 for killing this ship	*/

/* The word above was intended to allow variable scoring for all kills	*/
/* based on how lethal the ship is to attackers, but the implementation	*/
/* was abandoned during FE2 development.  Most ships just have $0100 in */
/* this word, which corresponds to one rating point.  But some do have	*/
/* other values, proving the original plan, but they were obviously not	*/
/* defined for the current rating scale, so they contribute only a small*/
/* fraction of one rating point, which is quite silly.			*/

/* Anyway, you get exactly the same rating added for killing a Shuttle	*/
/* as you get for killing a Panther or Long Range Cruiser even, so the	*/
/* rating system as it now is 'stinks to high heaven'.  The system that	*/
/* was abandoned seems much more realistic and would reward daring and	*/
/* skillful combateers in a more entertaining way than at present.	*/


/* The four words below define the positioning of the front and rear	*/
/* view 'cameras' as signed coordinates relative to the origo of the	*/
/* ship.  Unfortunately it is seldom obvious where that origo is...	*/
/* Avoid having cameras at same vertical height as gun mounts, as that	*/
/* will make the display of your laser beams very ugly.			*/

	int16	front_vx;	/* lengthwise position of front viewer	*/
	int16	front_vy;	/* vertical position of front viewer	*/
	int16	rear_vx;	/* lengthwise position of rear viewer	*/
	int16	rear_vy;	/* vertical position of rear viewer	*/

/* Here ends the mandatory part of the struct, and each entry below will*/
/* only exist for ships originally intended to use the corresponding gun*/

/* Be careful in modifications to these entries.  If the original ship	*/
/* doesn't have the mount/turret you edit, then you are really patching	*/
/* some entirely different table, which can have unknown results.	*/
/* One known result in some cases is that the 3D shape of the next ship	*/
/* becomes 'garbled' in some way (eg: ship only exists in one direction)*/

/* Another problem is that you can easily get a turret inside the ship,	*/
/* which is asking for trouble. (You will only shoot yourself to death.)*/
/* This turret gun problem was the reason why early FE2 versions always	*/
/* caused the Boa to shoot its own hull when using the bottom turret.	*/
/* I fixed that by adjusting the 'bottom_gy' value, until it worked.	*/

	int16	front_gx;	/* lengthwise position of front gun	*/
	int16	front_gy;	/* vertical position of front gun	*/
	int16	rear_gx;	/* lengthwise position of rear gun	*/
	int16	rear_gy;	/* vertical position of rear gun	*/
	int16	top_gx;		/* lengthwise position of top turret	*/
	int16	top_gy;		/* vertical position of top turret	*/
	int16	bottom_gx;	/* lengthwise position of bottom turret	*/
	uint16	bottom_gy;	/* vertical position of bottom turret	*/
}	SHIP_DB;
-----------------------------------------------------------------------------
End of file:	zoom_fix.txt
-----------------------------------------------------------------------------
