<?php
	include("header.php");
?>
		<div id="content">
		<h1>Technical Information</h1>
<p>This page contains information about data structures and other internals that might be useful for patching or modding Hardwar.</p>

<h2>General Definitions</h2>

<p>General stuff that will be used throughout, and scale-related constants.</p>

<pre>
D=DWORD and B=BYTE.

const D TD_Second=0xC22;
#define Foot 488
#define Inch 41
#define Metre 1600
#define Mile 2575610
#define Kilometre 1600000

#define Gravity (Metre*8)

#define MPH 715
#define KMH 444
</pre>

<h2>Moths</h2>

<p>There is a separate page describing various aspects of the moths <a href="/hardwar/hwtech/moths">here</a>


<h2>Object Definition</h2>

<p>This describes an Object Type, and is used in the <a href="/hardwar/hwtech/masterobj">Master Object Types</a> definition.</p>

<pre>
typedef struct
{
    B TName[32]; // Name used in terminal commands
    B Name[32]; // Original 'game' name
    D Value;
    D Properties; // Properties - see OP_xxxx in OBJECT.H
    B CompShapeName[16];
    B Description[256];
    D Mass; // Mass per unit in kg.
} ObjDef;
</pre>

<p>Object property flags are a bitmask as follows:</p>
<pre>
1 OP_Commodity - A commodity that can be bought and sold.
2 OP_Part - A part that can be fitted to a moth.
4 OP_Weapon - Can be fitted, is a weapon.
8 OP_NewMoth - A complete new moth.
16 OP_EWeapon - An energy weapon (Always has OP_Weapon)
32 OP_Pod - A pod.
64 OP_Fusion - Requires fusion technology. Hidden from
             player until relevant point in plot
128 OP_BgInstall - Can be installed in a building.
</pre>


<h2>Installable Manufacturing Machinery</h2>

<p>The machinery that can be installed in buildings to allow custom
manufacturing is based on normal objects, with the OP_BgInstall property.
These objects are defined in the <a href="/hardwar/hwtech/masterobj">Master
Object Types</a> list in the usual way. However, the manufacturing
capabilities of each of these objects are hard-coded. It should be possible
to locate this in the EXE and customise it. For reference:</p>

<pre>
//****************************************************************************
//
//		Install an object in a building. Returns non-zero if successful.
//
//****************************************************************************
D BgInstallObject(BgID b,ObjType ot,D num)
{
	switch(ot)
	{
		case OT_Clone:
			b->ClonesInstalled+=num;
			return(1);
		case OT_IndManWeapons:
			b->Flags|=BgFlag_UseNewMan;
			BgAllowManufacture(b,OT_Sprat);
			BgAllowManufacture(b,OT_Swarm);
			BgAllowManufacture(b,OT_Devastator);
			BgAllowManufacture(b,OT_Leach);
			BgAllowManufacture(b,OT_FireBurst);
			BgAllowManufacture(b,OT_Underkill);
			BgAllowManufacture(b,OT_Groundbase);
			BgAllowManufacture(b,OT_Hologram);
			BgAllowManufacture(b,OT_Trojan);
			return(1);
		case OT_IndManComp:
			b->Flags|=BgFlag_UseNewMan;
			BgAllowManufacture(b,OT_CompComp);
			BgAllowManufacture(b,OT_MachParts);
			BgAllowManufacture(b,OT_Drone);
			BgAllowManufacture(b,OT_Chaff);
			BgAllowManufacture(b,OT_Cell1);
			BgAllowManufacture(b,OT_Cell2);
			BgAllowManufacture(b,OT_Cell3);
			BgAllowManufacture(b,OT_Cell4);
			BgAllowManufacture(b,OT_FCell);
			return(1);
		case OT_IndManOreProc:
			b->Flags|=BgFlag_UseNewMan;
			BgAllowManufacture(b,OT_SheetMetal);
			BgAllowManufacture(b,OT_ExMetal);
			return(1);
		case OT_IndManBooze:
			b->Flags|=BgFlag_UseNewMan;
			BgAllowManufacture(b,OT_Booze);
			return(1);
		case OT_IndManNarcotics:
			b->Flags|=BgFlag_UseNewMan;
			BgAllowManufacture(b,OT_Narcotics);
			return(1);
		default:
			return(0);
	}

}
</pre>


		</div>


<?php
	include("footer.php");
?>
