//---------------------------------------------------------------------------
// Lethal Enforcers 2
// 
// Level        Saloon
// Round        3
// Background   320, 240
// SetScale     0x1e=4696, 0x38=4096
// Layers       255 56 47 42 42   41 30 22 22 22   21 0 0 0 0
//---------------------------------------------------------------------------
// Sprites	Enemy Sets
// 		1   
// BGDEYE	X   
// BGJACK	X   
// BGMEXK	X   
// BGMEXS	X   
// BGMIKE	X   
// BGSTEV	X   
// BGTHIN	X   
// BWANGE	X   
//---------------------------------------------------------------------------

// Define hit points
define BGDEYE_hp    4
define BGJACK_hp    2
define BGMEXK_hp    2
define BGMEXS_hp    2
define BGMIKE_hp    2
define BGSTEV_hp    2
define BGTHIN_hp    2
define BWANGE_hp    1

// Define character literals
define BGDEYE1      0
define BGJACK1      1
define BGJACK2      2
define BGJACK3      3
define BGJACK4      4
define BGMEXK1      5
define BGMEXS1      6
define BGMEXS2      7
define BGMIKE1      8
define BGMIKE2      9
define BGMIKE3      10
define BGSTEV1      11
define BGSTEV2      12
define BGSTEV3      13
define BGSTEV4      14
define BGTHIN1      15
define BGTHIN2      16
define BGTHIN3      17
define BWANGE1      18
define BWANGE2      19
define BOTTLE1      20
define BOTTLE2      21
define LAMP1        22
define LAMP2        23
define LAMP1b       24
define LAMP2b       25
define DOOR1        26
define DOOR2        27
define GATLING      28

// 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 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 positions
// ps1 (bgn appear)
define ps1_x        80
define ps1_y        127
define ps1_l        3
define ps1_scale    4419

// p01 (side from left)
define p01_x        55
define p01_y        140
define p01_l        2
define p01_scale    4304

// p02 (side from right)
define p02_x        215
define p02_y        140
define p02_l        2
define p02_scale    4304

// p03 (stand)
define p03_x        245
define p03_y        200
define p03_l        9
define p03_scale    4673

// p04 (side from left (not low))
define p04_x        190
define p04_y        180
define p04_l        1
define p04_scale    4096

// p04r (right-hand door, from left)
define p04r_x       210
define p04r_y       140
define p04r_l       1
define p04r_scale   4096

// p05 (jump from right)
define p05_x        310
define p05_y        165
define p05_l        6
define p05_scale    4696

// p06 (stand behind table)
define p06_x        40
define p06_y        180
define p06_l        7
define p06_scale    4881

// p07 (roll from entrance)
define p07_x        -10
define p07_y        160
define p07_l        2
define p07_scale    4304

// p08 (roll from entrance right)
define p08_x        287
define p08_y        160
define p08_l        2
define p08_scale    4304


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

// Load characters
LoadKRT \SPRITES\LE2\SALOON\S1\BGDEYE.KRT     // Ch 0 - BGDEYE1
SetScale BGDEYE1 ps1_scale
SetTotalHitPoints BGDEYE1 BGDEYE_hp

LoadKRT \SPRITES\LE2\SALOON\S1\BGJACK.KRT     // Ch 1 - BGJACK1
SetScale BGJACK1 p05_scale
SetTotalHitPoints BGJACK1 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 2 - BGJACK2   
SetScale BGJACK2 p04_scale
SetTotalHitPoints BGJACK2 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 3 - BGJACK3   
SetScale BGJACK3 p02_scale
SetTotalHitPoints BGJACK3 BGJACK_hp

CloneCharacter BGJACK1                            // Ch 4 - BGJACK4   
SetScale BGJACK4 p02_scale
SetTotalHitPoints BGJACK4 BGJACK_hp

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

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

CloneCharacter BGMEXS1                            // Ch 7 - BGMEXS2   
SetScale BGMEXS2 p06_scale
SetTotalHitPoints BGMEXS2 BGMEXS_hp

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

CloneCharacter BGMIKE1                            // Ch 9 - BGMIKE2   
SetScale BGMIKE2 p01_scale
SetTotalHitPoints BGMIKE2 BGMIKE_hp

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

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

CloneCharacter BGSTEV1                            // Ch 12 - BGSTEV2  
SetScale BGSTEV2 p08_scale
SetTotalHitPoints BGSTEV2 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 13 - BGSTEV3  
SetScale BGSTEV3 p03_scale
SetTotalHitPoints BGSTEV3 BGSTEV_hp

CloneCharacter BGSTEV1                            // Ch 14 - BGSTEV4  
SetScale BGSTEV4 p01_scale
SetTotalHitPoints BGSTEV4 BGSTEV_hp

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

CloneCharacter BGTHIN1                            // Ch 16 - BGTHIN2  
SetScale BGTHIN2 p04_scale
SetTotalHitPoints BGTHIN2 BGTHIN_hp

CloneCharacter BGTHIN1                            // Ch 17 - BGTHIN3  
SetScale BGTHIN3 p03_scale
SetTotalHitPoints BGTHIN3 BGTHIN_hp

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

CloneCharacter BWANGE1                            // Ch 19 - BWANGE2  
SetScale BWANGE2 p02_scale
SetTotalHitPoints BWANGE2 BWANGE_hp

LoadKRT \SPRITES\LE2\SALOON\S2\S1BOTT.KRT            // Ch 20 - BOTTLE1
ObjectCharacteristics BOTTLE1 SCROLL
CloneCharacter BOTTLE1                            // Ch 21 - BOTTLE2
SetScale BOTTLE1 4096*55/100

LoadKRT \SPRITES\LE2\SALOON\S1\B2LAMP.KRT            // Ch 22 - LAMP1
ObjectCharacteristics LAMP1 SCROLL
CloneCharacter LAMP1                              // Ch 23 - LAMP2
CloneCharacter LAMP1                              // Ch 24 - LAMP1b
CloneCharacter LAMP1                              // Ch 25 - LAMP2b

LoadKRT \SPRITES\LE2\SALOON\S2\S3DOOR.KRT            // Ch 26 - DOOR1
ObjectCharacteristics DOOR1 SCROLL|NOKILL|START_ANIM
CloneCharacter DOOR1                              // Ch 27 - DOOR2

LoadKRT \SPRITES\LE2\L2GUNS.KRT                   // Ch 28 - GATLING
ObjectCharacteristics GATLING SCROLL|GUN

// Links
Link LAMP1b LAMP1   4 3 0 0  56  81
Link LAMP2b LAMP1   4 3 0 0 208  81
Link DOOR1  BGDEYE1 0 4 0 0 112 117
Link DOOR2  BGDEYE1 0 4 0 1 151 117

PlayTrack 508 0                 // SD_BGM9

// Place objects
StartActionXY BOTTLE1  14    224      165      11    0        0 L1
StartActionXY BOTTLE2   9    232      151      11    0        0 L1
StartActionXY LAMP1     2     56       74       6    0        0 L1
StartActionXY LAMP2     2    208       74       6    0        0 L1
StartActionXY DOOR1     1    112      117       5    0        0 L1
StartActionXY DOOR2     1    151      117       5    0        1 L1

// Action!
define FC     0  // Frame Counter
StartActionXY BGSTEV1  12    p07_x    p07_y    p07_l FC+64    0 L1  // ROLL
StartActionXY BGMIKE1   3    p03_x    p03_y    p03_l FC+128   1 L5  // STND
StartActionXY BGJACK1  10    p05_x    p05_y    p05_l FC+192   1 L1  // JUMP
StartActionXY BGDEYE1   3    ps1_x    ps1_y    ps1_l FC+320   0 L1  // 0x04
StartActionXY BGSTEV2  12    p08_x    p08_y    p08_l FC+576   1 L1  // ROLL
StartActionXY BGTHIN1  10    p06_x    p06_y+10 p06_l FC+578   0 L5  // STND
StartActionXY BGJACK2   8    p04r_x   p04r_y   p04r_l FC+672   0 L1  // SIDE
StartActionXY BGMEXS1  14    p02_x    p02_y+5  p02_l FC+688   1 L3  // LOW
StartActionXY BWANGE1   4    p03_x    p03_y-10 p03_l FC+736   1 L5  // STND
StartActionXY BGMIKE2   5    p01_x    p01_y    p01_l FC+800   0 L1  // SIDE
Attach GATLING BGMIKE2 4 0 FC+800 0 0 p01_l L1
StartActionXY BGTHIN2  14    p04_x    p04_y-20 p04_l FC+896   1 L4  // LOW
StartActionXY BGMEXK1   4    p06_x    p06_y    p06_l FC+897   0 L1  // STND
StartActionXY BGJACK3   8    p02_x    p02_y    p02_l FC+960   1 L2  // SIDE
StartActionXY BGSTEV3   6    p03_x    p03_y    p03_l FC+1024  0 L7  // STND
StartActionXY BGJACK4  15    p02_x+40 p02_y    p02_l FC+1028  1 L1  // RUN
StartActionXY BGTHIN3  10    p03_x    p03_y    p03_l FC+1088  0 L3  // STND
StartActionXY BGSTEV4  10    p01_x    p01_y+10 p01_l FC+1152  0 L1  // LOW
StartActionXY BWANGE2   6    p02_x    p02_y    p02_l FC+1153  1 L1  // SIDE
StartActionXY BGMEXS2  10    p06_x    p06_y    p06_l FC+1216  1 L5  // STND
StartActionXY BGMIKE3   5    p04r_x   p04r_y   p04r_l FC+1280  0 L1  // SIDE
ScrollBKDTo 0 0 0 0 FC+1312

define FC  FC+1312  // Frame Counter
EndRound FC+30
