#define  ONE_SECOND  1193200    /* 65536(ticks/cycle) * 18.207(cycles/sec) */
#define  TM_LARGE_TIMER   (*((unsigned long far *)MK_FP(0x40, 0x6C)))

// Detail macros
#define NONE 0 // Render methods
#define FLAT 1
#define PHONG 2
#define FULL 3
#define BASIC 4
#define ON 1 // Render options
#define OFF 0
// Rendering options
#define DRAWFULL 1
#define DRAWMOST 3
#define DRAWLINE 4
#define DRAWROOM 5
#define DRW_SIMPLE 2
#define DRW_MOBILE 1
// Math
#define PI 3.1415962
// All the gun types "o[f].g[g].type, o[f].t[g].type"
#define LASER 1
#define BEAM 2
#define ION 3
#define BOMB 4
#define NUKE 5
#define TORP 6
#define MISSILE 7
#define TURBOLASER 8
#define ALIENBEAM 9
#define ALIENTORP 10
#define CHAINGUN 11
// All the ship AI types "o[f].type"
#define TYPE_NOTHING -1
#define TYPE_DERELICT 0
#define TYPE_NORMAL 1
#define TYPE_APPROXIMATE 2
#define TYPE_BROADSIDE 3
#define TYPE_AMBUSH 4
#define TYPE_NONSENTIENT 5
#define TYPE_CONVOY 6
#define TYPE_DUMBCONVOY 7
// All the ships habits "o[f].DOING"
#define ATTACKING 0
#define WITHDRAWING 1
#define EVADING 2
#define APPROACHING 4
#define LININGUP 5
#define LANDING 6
#define PREPARINGTOBOARD 7
#define BOARDING 8
#define BOARDED 9
#define DIEING 10
#define LEAVING_HYPERSPACE 20
#define ENTERING_HYPERSPACE 21
#define LAUNCHING 22
// All the subconsious
#define SUBNORMAL 0
#define SUBSTUBBORN 1
#define SUBPATHALOGICAL 2
// All the wingman types
#define LOYAL 0
#define DISLOYAL 1
#define SLAVETARGETER 2
#define FREESPIRITLOYAL 3
#define FREESPIRITDISLOYAL 4
#define FORMATIONONLY 5

//Mission control stuff
#define MISSION_ABORT -1
#define MISSION 0         //missiontype[n] if a mission
#define MISSION_SUCCESS 1 //missiontype[n] if a success cutscene
#define MISSION_FAILURE 2 //missiontype[n] if a failure cutscene
#define MISSION_ALWAYS 3
#define MISESS_YES 0      //missionessential[n] if need to win mission
#define MISESS_NO 0       //missionessential[n] if don't need to win mission

#define CAMPAIGN_SUCCESS 1 //Campaign success
#define CAMPAIGN_FAILURE 2 //campaign failure

// All the terminateflag types
#define ALWAYS 0
#define HYPERSPACED 1
#define DOCKED 2
#define DEAD 3
#define CUTSCENEOVER 5
#define HYPERSPACEIN 6
#define TAKEOFF 7
#define ABORTED -1
#define COMPLETED 1
#define NOTCOMPLETED 2

// Macro for finding absolute value of summat
#define ABS(a) (a<0?-a:a)
#define SQR(a) (a*a)
#define CHK(a) (ABS(a)<0.01?0.01:a)

#define _ESC            0x01
#define _F1             0x3b
#define _F2             0x3c
#define _F3             0x3d
#define _F4             0x3e
#define _F5             0x3f
#define _F6             0x40
#define _F7             0x41
#define _F8             0x42
#define _F9             0x43
#define _F10            0x44
#define _F11            0x57
#define _F12            0x58
#define _SYSRQ          0xb7
#define _SCROLLLOCK     0x46

#define _TICK           0x29
#define _1              0x02
#define _2              0x03
#define _3              0x04
#define _4              0x05
#define _5              0x06
#define _6              0x07
#define _7              0x08
#define _8              0x09
#define _9              0x0a
#define _0              0x0b
#define _MINUS          0x0c
#define _EQUALS         0x0d
#define _BACKSPACE      0x0e
#define _C_INSERT         0xd2
#define _C_HOME           0xc7
#define _C_PGUP           0xc9
#define _NUMLOCK        0x45
#define _PADSLASH       0xb5
#define _PADSTAR        0x37
#define _PADMINUS       0x4a

#define _TAB            0x0f
#define _Q              0x10
#define _W              0x11
#define _E              0x12
#define _R              0x13
#define _T              0x14
#define _Y              0x15
#define _U              0x16    
#define _I              0x17
#define _O              0x18
#define _P              0x19
#define _LEFTBRACKET    0x1a
#define _RIGHTBRACKET   0x1b
#define _BACKSLASH      0x2b
#define _C_DELETE         0xd3
#define _C_END            0xcf
#define _C_PGDN           0xd1
#define _PAD7           0x47
#define _PAD8           0x48
#define _PAD9           0x49
#define _PADPLUS        0x4e

#define _CAPSLOCK       0x3a
#define _A              0x1e
#define _S              0x1f
#define _D              0x20
#define _F              0x21
#define _G              0x22
#define _H              0x23
#define _J              0x24
#define _K              0x25
#define _L              0x26
#define _SEMICOLON      0x27
#define _QUOTE          0x28
#define _RETURN         0x1c
#define _PAD4           0x4b
#define _PAD5           0x4c
#define _PAD6           0x4d

#define _L_SHIFT      0x2a
#define _Z              0x2c
#define _X              0x2d
#define _C              0x2e
#define _V              0x2f
#define _B              0x30
#define _N              0x31
#define _M              0x32
#define _COMMA          0x33
#define _FULL_STOP      0x34
#define _SLASH          0x35
#define _R_SHIFT     0x36
#define _C_UP        0xc8
#define _PAD1           0x4f
#define _PAD2           0x50
#define _PAD3           0x51
#define _PADENTER       0x9c

#define _L_CTRL         0x1d
#define _LEFTWINDOW     0xdb
#define _ALTERNATE      0x38
#define _SPACEBAR          0x39
#define _R_ALT          0xb8
#define _RIGHTWINDOW    0xdc
#define _KEYBOARDMOUSE  0xdd
#define _R_CTRL         0x9d
#define _C_LEFT      0xcb
#define _C_DOWN      0xd0
#define _C_RIGHT     0xcd
#define _PAD0           0x52
#define _PADPERIOD      0x53


/*
1 SHIELDS LOW.
2 HULL CRITICAL.
3 INCOMING MISSILE.
4 MISSION CRITICAL
5 MISSION COMPLETED
6 MISSION FAILED
7 ACCELLERATION COMMIT
8 ENGINES ENGAGED
9 TRANSFERRING FLIGHT CONTROL. FIRING COMBAT ENGINES.
10 TARGET DESTROYED

13 FRIENDLY FORCES ENTERING BATTLEFIELD
14 ENEMY REINFORCEMENTS ENTERING BATTLEFIELD
15 ENEMY CAPITAL SHIP DESTROYED
16 FRIENDLY CAPITAL SHIP DESTROYED
17 ENEMY FIGHTER DESTROYED
18 FRIENDLY FIGHTER DESTROYED
19 CAUTION LOW ALTITUDE
*/