//---------------------------------------------------------------------------
// Lethal Enforcers 2
// 
// Level        Saloon
// Round        2
// Background   320, 240
// SetScale     0x39=3485, 0x20=4827
// Layers       255 57 53 53 53 52 38 35 35 35 33 32 32 32 32
//---------------------------------------------------------------------------
// Sprites	Enemy Sets
// 		1   
// BGJACK       X   
// BGMEXB       X   
// BGMEXK       X   
// BGMEXS       X   
// BGMIKE       X   
// BGSTEV       X   
// BGTHIN       X   
// BMBIG        X   
// BWANGE       X   
// GMGMBL       X   
// GWKATH       X   
// GWKAY        X   
//---------------------------------------------------------------------------

// Define hit points
define BGJACK_hp    2
define BGMEXB_hp    2
define BGMEXK_hp    2
define BGMEXS_hp    2
define BGMIKE_hp    2
define BGSTEV_hp    2
define BGTHIN_hp    2
define BMBIG_hp     2
define BWANGE_hp    1
define GMGMBL_hp    1
define GWKATH_hp    1
define GWKAY_hp     1

// Define character literals
define BGJACK1      0
define BGJACK2      1
define BGJACK3      2
define BGJACK4      3
define BGJACK5      4
define BGJACK6      5
define BGMEXB1      6
define BGMEXB2      7
define BGMEXK1      8
define BGMEXK2      9
define BGMEXK3      10
define BGMEXK4      11
define BGMEXK5      12
define BGMEXS1      13
define BGMEXS2      14
define BGMEXS3      15
define BGMIKE1      16
define BGMIKE2      17
define BGMIKE3      18
define BGMIKE4      19
define BGMIKE5      20
define BGMIKE6      21
define BGSTEV1      22
define BGSTEV2      23
define BGSTEV3      24
define BGSTEV4      25
define BGSTEV5      26
define BGSTEV6      27
define BGSTEV7      28
define BGTHIN1      29
define BGTHIN2      30
define BGTHIN3      31
define BMBIG1       32
define BMBIG2       33
define BMBIG3       34
define BMBIG4       35
define BWANGE1      36
define BWANGE2      37
define GMGMBL1      38
define GWKATH1      39
define GWKAY1       40
define GMGMBL2	    41
define PICTURE      42
define DOOR1        43
define DOOR2        44
define VASE1        45
define VASE1b       46
define LAMP1        47
define LAMP1b       48
define CANNON       49
define RIFLE        50
define KNIFE1       51
define KNIFE2       52
define KNIFE3       53
define KNIFE4       54
define KNIFE5       55

// Define object characteristics
define ENEMY        0x0001    // Enemy
define VICTIM       0x0002    // Victim
define DISAPPEAR    0x0004    // Disappear when out of screen
define GUN          0x0008    // Gun (red contour)
define FALL         0x0010    // Fall, so check for collision
define WINDOW       0x0020    // Window (translucent)
define THROWN       0x0040    // Thrown object (zoom)
define START_ANIM   0x0080    // Can start another anim. over actual one
define ARROW        0x0100    // Arrow (do an arc)
define BLINK        0x0200    // Blink at the end
define SCROLL       0x0400    // We can scroll even though he's not dead
define BOSS         0x0800    // Boss
define VEH_SINUSOID 0x1000    // Vehicle (sinusoidal movement)
define VEH_LINEAR   0x2000    // Vehicle (linear movement)
define NOKILL       0x4000    // Can't be killed
define NODISPLAY    0x8000    // Don't display

// Define difficulty levels
define L1           0
define L2           1
define L3           2
define L4           3
define L5           4
define L6           5
define L7           6
define L8           7

// Define positions
// p01 (side from door #1 left)
define p01_x        10
define p01_y        125
define p01_l        1
define p01_scale    3485

// p02 (side from door #1 right)
define p02_x        105
define p02_y        125
define p02_l        1
define p02_scale    3485

// p03 (side from door #2 left)
define p03_x        140
define p03_y        130
define p03_l        2
define p03_scale    3700

// p04 (side from door #2 right)
define p04_x        250
define p04_y        130
define p04_l        2
define p04_scale    3700

// p05 (stand behind table)
define p05_x        115
define p05_y        155
define p05_l        7
define p05_scale    4666

// p06 (right low from stairs)
define p06_x        360
define p06_y         80
define p06_l        11
define p06_scale    4827

// p07 (big enemy left)
define p07_x        97
define p07_y        190
define p07_l        14
define p07_scale    4096

// p08 (big enemy right)
define p08_x        216
define p08_y        190
define p08_l        14
define p08_scale    4096

// p09 (right hostage stand behind table)
define p09_x        135
define p09_y        150
define p09_l        6
define p09_scale    4505


// Load backgrounds and sounds
LoadBKD \BACKGRND\LE2\SALOON\SALOON2.BKD
SetBKDLoc 0 0 0 0
LoadVAB \SOUNDFX\LE2\SALOON.VAB

// Load characters
LoadKRT \SPRITES\LE2\SALOON\S1\BGJACK.KRT     // Ch 0 - BGJACK1
SetScale BGJACK1 p04_scale
SetTotalHitPoints BGJACK1 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 1 - BGJACK2   
SetScale BGJACK2 p05_scale
SetTotalHitPoints BGJACK2 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 2 - BGJACK3   
SetScale BGJACK3 p06_scale
SetTotalHitPoints BGJACK3 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 3 - BGJACK4   
SetScale BGJACK4 p03_scale
SetTotalHitPoints BGJACK4 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 4 - BGJACK5   
SetScale BGJACK5 p03_scale
SetTotalHitPoints BGJACK5 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 5 - BGJACK6   
SetScale BGJACK6 p02_scale
SetTotalHitPoints BGJACK6 BGJACK_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGMEXB.KRT     // Ch 6 - BGMEXB1
SetScale BGMEXB1 p07_scale
SetTotalHitPoints BGMEXB1 BGMEXB_hp

CloneCharacter BGMEXB1                            // Ch 7 - BGMEXB2   
SetScale BGMEXB2 p07_scale
SetTotalHitPoints BGMEXB2 BGMEXB_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGMEXK.KRT     // Ch 8 - BGMEXK1
SetScale BGMEXK1 p02_scale
SetTotalHitPoints BGMEXK1 BGMEXK_hp

CloneCharacter BGMEXK1                            // Ch 9 - BGMEXK2   
SetScale BGMEXK2 p03_scale
SetTotalHitPoints BGMEXK2 BGMEXK_hp

CloneCharacter BGMEXK1                            // Ch 10 - BGMEXK3  
SetScale BGMEXK3 p05_scale
SetTotalHitPoints BGMEXK3 BGMEXK_hp

CloneCharacter BGMEXK1                            // Ch 11 - BGMEXK4  
SetScale BGMEXK4 p01_scale
SetTotalHitPoints BGMEXK4 BGMEXK_hp

CloneCharacter BGMEXK1                            // Ch 12 - BGMEXK5  
SetScale BGMEXK5 p03_scale
SetTotalHitPoints BGMEXK5 BGMEXK_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGMEXS.KRT     // Ch 13 - BGMEXS1
SetScale BGMEXS1 p01_scale
SetTotalHitPoints BGMEXS1 BGMEXS_hp

CloneCharacter BGMEXS1                            // Ch 14 - BGMEXS2  
SetScale BGMEXS2 p05_scale
SetTotalHitPoints BGMEXS2 BGMEXS_hp

CloneCharacter BGMEXS1                            // Ch 15 - BGMEXS3  
SetScale BGMEXS3 p02_scale
SetTotalHitPoints BGMEXS3 BGMEXS_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGMIKE.KRT     // Ch 16 - BGMIKE1
SetScale BGMIKE1 p02_scale
SetTotalHitPoints BGMIKE1 BGMIKE_hp

CloneCharacter BGMIKE1                            // Ch 17 - BGMIKE2  
SetScale BGMIKE2 p09_scale
SetTotalHitPoints BGMIKE2 BGMIKE_hp

CloneCharacter BGMIKE1                            // Ch 18 - BGMIKE3  
SetScale BGMIKE3 p04_scale
SetTotalHitPoints BGMIKE3 BGMIKE_hp

CloneCharacter BGMIKE1                            // Ch 19 - BGMIKE4  
SetScale BGMIKE4 p02_scale
SetTotalHitPoints BGMIKE4 BGMIKE_hp

CloneCharacter BGMIKE1                            // Ch 20 - BGMIKE5  
SetScale BGMIKE5 p03_scale
SetTotalHitPoints BGMIKE5 BGMIKE_hp

CloneCharacter BGMIKE1                            // Ch 21 - BGMIKE6  
SetScale BGMIKE6 p06_scale
SetTotalHitPoints BGMIKE6 BGMIKE_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGSTEV.KRT     // Ch 22 - BGSTEV1
SetScale BGSTEV1 p01_scale
SetTotalHitPoints BGSTEV1 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 23 - BGSTEV2  
SetScale BGSTEV2 p06_scale
SetTotalHitPoints BGSTEV2 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 24 - BGSTEV3  
SetScale BGSTEV3 p04_scale
SetTotalHitPoints BGSTEV3 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 25 - BGSTEV4  
SetScale BGSTEV4 p05_scale
SetTotalHitPoints BGSTEV4 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 26 - BGSTEV5  
SetScale BGSTEV5 p05_scale
SetTotalHitPoints BGSTEV5 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 27 - BGSTEV6  
SetScale BGSTEV6 p04_scale
SetTotalHitPoints BGSTEV6 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 28 - BGSTEV7  
SetScale BGSTEV7 p04_scale
SetTotalHitPoints BGSTEV7 BGSTEV_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGTHIN.KRT     // Ch 29 - BGTHIN1
SetScale BGTHIN1 p03_scale
SetTotalHitPoints BGTHIN1 BGTHIN_hp

CloneCharacter BGTHIN1                            // Ch 30 - BGTHIN2  
SetScale BGTHIN2 p06_scale
SetTotalHitPoints BGTHIN2 BGTHIN_hp

CloneCharacter BGTHIN1                            // Ch 31 - BGTHIN3  
SetScale BGTHIN3 p02_scale
SetTotalHitPoints BGTHIN3 BGTHIN_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BMBIG.KRT      // Ch 32 - BMBIG1
SetScale BMBIG1 p08_scale
SetTotalHitPoints BMBIG1 BMBIG_hp

CloneCharacter BMBIG1                             // Ch 33 - BMBIG2   
SetScale BMBIG2 p08_scale
SetTotalHitPoints BMBIG2 BMBIG_hp

CloneCharacter BMBIG1                             // Ch 34 - BMBIG3   
SetScale BMBIG3 p08_scale
SetTotalHitPoints BMBIG3 BMBIG_hp

CloneCharacter BMBIG1                             // Ch 35 - BMBIG4   
SetScale BMBIG4 p08_scale
SetTotalHitPoints BMBIG4 BMBIG_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BWANGE.KRT     // Ch 36 - BWANGE1
SetScale BWANGE1 p05_scale
SetTotalHitPoints BWANGE1 BWANGE_hp

CloneCharacter BWANGE1                            // Ch 37 - BWANGE2  
SetScale BWANGE2 p05_scale
SetTotalHitPoints BWANGE2 BWANGE_hp

LoadKRT \SPRITES\LE2\SALOON\S1\GMGMBL.KRT     // Ch 38 - GMGMBL1
SetScale GMGMBL1 p05_scale
SetTotalHitPoints GMGMBL1 GMGMBL_hp
ObjectCharacteristics GMGMBL1 1030

LoadKRT \SPRITES\LE2\SALOON\S2\GWKATH.KRT     // Ch 39 - GWKATH1
SetScale GWKATH1 p01_scale
SetTotalHitPoints GWKATH1 GWKATH_hp
ObjectCharacteristics GWKATH1 1030

LoadKRT \SPRITES\LE2\SALOON\S2\GWKAY.KRT      // Ch 40 - GWKAY1
SetScale GWKAY1 p05_scale
SetTotalHitPoints GWKAY1 GWKAY_hp
ObjectCharacteristics GWKAY1 1030

CloneCharacter GMGMBL1			          // Ch 41 - GMGMBL2
SetScale GMGMBL2 p09_scale
SetTotalHitPoints GMGMBL2 GMGMBL_hp
ObjectCharacteristics GMGMBL2 1158

LoadKRT \SPRITES\LE2\SALOON\S1\B4PICT.KRT            // Ch 42 - PICTURE
ObjectCharacteristics PICTURE SCROLL

LoadKRT \SPRITES\LE2\SALOON\S2\S2DOOR.KRT            // Ch 43 - DOOR1
ObjectCharacteristics DOOR1 SCROLL|NOKILL|START_ANIM
CloneCharacter DOOR1                              // Ch 44 - DOOR2
SetScale DOOR1  3891

LoadKRT \SPRITES\LE2\SALOON\S2\S1BOTT.KRT            // Ch 45 - VASE1b
ObjectCharacteristics VASE1 SCROLL
CloneCharacter VASE1                              // Ch 46 - VASE1b
ObjectCharacteristics VASE1b SCROLL|NOKILL

LoadKRT \SPRITES\LE2\SALOON\S1\B2LAMP.KRT            // Ch 47 - LAMP1
ObjectCharacteristics LAMP1 SCROLL
CloneCharacter LAMP1                              // Ch 48 - LAMP1b

LoadKRT \SPRITES\LE2\L2GUNS.KRT                   // Ch 49 - CANNON
ObjectCharacteristics CANNON GUN|SCROLL
CloneCharacter CANNON                             // Ch 50 - RIFLE

LoadKRT \SPRITES\LE2\L2NIFE.KRT                   // Ch 51 - KNIFE1
ObjectCharacteristics KNIFE1 DISAPPEAR|THROWN|SCROLL
CloneCharacter KNIFE1                             // Ch 52 - KNIFE2
CloneCharacter KNIFE1                             // Ch 53 - KNIFE3
CloneCharacter KNIFE1                             // Ch 54 - KNIFE4
CloneCharacter KNIFE1                             // Ch 55 - KNIFE5
AssignProjectile BGMEXK1 KNIFE1
AssignProjectile BGMEXK2 KNIFE2
AssignProjectile BGMEXK3 KNIFE3
AssignProjectile BGMEXK4 KNIFE4
AssignProjectile BGMEXK5 KNIFE5

// Hostage
SetDepth BGMIKE2 p09_l
Link BGMIKE2 GMGMBL2 9 1 0 1 p09_x p09_y	// Stand when hostage stands
Link BGMIKE2 GMGMBL2 3 0 0 1 p09_x p09_y	// Shoot when hostage dies

// Doors
SetDepth LAMP1b 6
Link DOOR1   BGSTEV1  1  8 0 0  55 121
Link DOOR2   BGJACK1  1  8 0 0 197 121
Link VASE1b  VASE1   19 18 1 0 231 150
Link RIFLE   VASE1    2 18 0 0 220 136
Link LAMP1b  LAMP1    4  3 0 0 152  73

PlayTrack 501 0                 // SD_BGM2
        
// Objects
StartActionXY PICTURE   4    110      78        6    0        0 L1
StartActionXY DOOR1     0     55     121        6    0        0 L1
StartActionXY DOOR2     0    197     121        6    0        0 L1
StartActionXY LAMP1     2    152      66        6    0        0 L1
StartActionXY VASE1    17    220     136       11    0        0 L1

// Action!
define FC     0  // Frame Counter
StartActionXY BGSTEV1   8    p01_x    p01_y    p01_l FC+64    0 L1  // SIDE
StartActionXY BWANGE1   4    p05_x    p05_y    p05_l FC+96    1 L5  // STND
StartActionXY BGMIKE1   5    p02_x    p02_y    p02_l FC+224   1 L5  // SIDE
StartActionXY BMBIG1    4    p08_x    p08_y    p08_l FC+256   0 L2  // STND
StartActionXY GMGMBL2   1    p09_x-25 p09_y    p09_l+1 FC+288   1 L1  // Hostage
StartActionXY BGMIKE2   3    p09_x    p09_y    p09_l FC+289   1 L1  // STND (After hostage)
StartActionXY BGJACK1   8    p04_x    p04_y    p04_l FC+352   1 L1  // SIDE
StartActionXY BGMEXS1  12    p01_x    p01_y    p01_l FC+368   0 L1  // SIDE
StartActionXY BGTHIN1  12    p03_x    p03_y    p03_l FC+480   0 L5  // SIDE
StartActionXY BGJACK2   6    p05_x    p05_y+5  p05_l FC+488   0 L4  // STND
StartActionXY BMBIG2    4    p08_x    p08_y    p08_l FC+512   0 L1  // STND
StartActionXY BGJACK3  13    p06_x    p06_y+7  p06_l FC+608   1 L7  // LOW
StartActionXY BGMIKE3   5    p04_x    p04_y    p04_l FC+612   1 L1  // SIDE
StartActionXY GWKAY1    1    p05_x    p05_y    p05_l FC+640   0 L5  // STND
StartActionXY BGMEXK1   6    p02_x    p02_y    p02_l FC+704   1 L1  // SIDE
StartActionXY BGJACK4   8    p03_x    p03_y    p03_l FC+720   0 L6  // SIDE
StartActionXY BGSTEV2  10    p06_x-4  p06_y+4  p06_l FC+768   1 L3  // LOW
StartActionXY BGMEXS2  10    p05_x    p05_y    p05_l FC+832   1 L1  // STND
StartActionXY BGMEXB1   5    p07_x    p07_y+50 p07_l FC+840   1 L5  // STND
StartActionXY GWKATH1   2    p01_x    p01_y    p01_l FC+896   0 L1  // WALK
Attach CANNON GWKATH1 5 0 FC+896 0 0 p01_l L1
StartActionXY BGSTEV3   8    p04_x    p04_y    p04_l FC+960   1 L7  // SIDE
StartActionXY BGMIKE4   5    p02_x    p02_y    p02_l FC+1024  1 L2  // SIDE
StartActionXY BGSTEV4   6    p05_x    p05_y    p05_l FC+1028  0 L6  // STND
StartActionXY BGJACK5   8    p03_x    p03_y    p03_l FC+1088  0 L1  // SIDE
StartActionXY BMBIG3    4    p08_x    p08_y    p08_l FC+1104  0 L7  // STND
StartActionXY BGTHIN2  14    p06_x    p06_y+12 p06_l FC+1152  1 L1  // LOW
StartActionXY BGSTEV5   6    p05_x    p05_y    p05_l FC+1164  1 L6  // STND
StartActionXY BGMEXS3  12    p02_x    p02_y    p02_l FC+1216  1 L5  // SIDE
StartActionXY BGMEXK2   6    p03_x    p03_y    p03_l FC+1232  0 L1  // SIDE
StartActionXY BMBIG4    4    p08_x    p08_y    p08_l FC+1280  0 L2  // STND
StartActionXY BGMEXK3   4    p05_x    p05_y    p05_l FC+1344  1 L3  // STND
StartActionXY BGJACK6   8    p02_x    p02_y    p02_l FC+1348  1 L5  // SIDE
StartActionXY BGMEXB2   5    p07_x    p07_y+50 p07_l FC+1408  0 L6  // STND
StartActionXY BGSTEV6   8    p04_x    p04_y    p04_l FC+1472  1 L1  // SIDE
StartActionXY BGMEXK4   6    p01_x    p01_y    p01_l FC+1476  0 L5  // SIDE
StartActionXY BWANGE2   4    p05_x    p05_y    p05_l FC+1536  0 L1  // STND
StartActionXY BGMIKE5   5    p03_x    p03_y    p03_l FC+1552  0 L4  // SIDE
StartActionXY BGMIKE6   5    p06_x-5  p06_y-16 p06_l FC+1600  1 L1  // LOW
StartActionXY GMGMBL1   1    p05_x    p05_y    p05_l FC+1601  1 L4  // STND
StartActionXY BGSTEV7   8    p04_x    p04_y    p04_l FC+1664  1 L1  // SIDE
StartActionXY BGTHIN3  12    p02_x    p02_y    p02_l FC+1668  1 L5  // SIDE
StartActionXY BGMEXK5   6    p03_x    p03_y    p03_l FC+1680  0 L1  // SIDE

ResetCharacteristics DOOR1 NOKILL|SCROLL FC+1711
ResetCharacteristics DOOR2 NOKILL|SCROLL FC+1711
ScrollBKDTo 0 0 0 0 FC+1712

define FC  1936  // Frame Counter
EndRound FC
