// Converted from BW`s Totally_stripped.txt
// DEFINE OBJECTS 0 // no needed at all
DEFINE MISSIONS 1
//DEFINE MISSION {ID} 0 AT {LABEL} @mission
DEFINE MISSION 0 AT @MS_WOLF
 
//-------------MAIN---------------
thread 'MAIN'
if $GAME_STARTED == 0
else_jump @WAITMISSION

$GAME_STARTED = 1
$COMPLETED_MS0 = 0

//Skins
$WOLF_SKIN_GUARD = #COP
$WOLF_SKIN_DOG = #COP
$WOLF_SKIN_HANS = #FBI

//Accuracy
$WOLF_ACC_GUARD = 80
$WOLF_ACC_DOG = 80
$WOLF_ACC_HANS = 80

//Weapon ids
$WOLF_WEAPON_KNIFE = 5
$WOLF_WEAPON_PISTOL = 17
$WOLF_WEAPON_MACHINEGUN = 27
$WOLF_WEAPON_CHAINGUN = 33

$WOLF_WEAPON_GUARD = 17
$WOLF_WEAPON_DOG = 17
$WOLF_WEAPON_HANS = 27

//Enemy ammo
$WOLF_WEAPON_AMMO = 240

fade 0 0
01F0: set_max_wanted_level_to 0
01EB: set_traffic_density_multiplier_to 0.0 
03DE: set_pedestrians_density_multiplier_to 0.0
set_wb_check_to 0
00C0: set_current_time 12 0
04E4: unknown_refresh_game_renderer_at 7.5 -79.5
Camera.SetAtPos(7.5, -79.5, 850.0)
$PLAYER_CHAR = Player.Create(#NULL, 7.5, -79.5, 850.0)
0055: put_player $PLAYER_CHAR at 7.5 -79.5 850.0 
0171: set_player $PLAYER_CHAR z_angle_to 0.0
0330: set_player $PLAYER_CHAR infinite_run_to 1 
$PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR) 
set_weather 0
wait 0                  
0180: set_on_mission_flag_to $ONMISSION // Note: your missions should use the variable defined here ($ONMISSION)

:INIT
start_mission 0

:WAITMISSION
wait 0

if and
$ONMISSION == 0
$COMPLETED_MS0 == 1
else_jump @WAITMISSION
 
end_thread

//-------------Mission 0---------------
// put your missions here
:MS_WOLF
thread 'MS_WOLF'
$ONMISSION = 1

wait 0
//Wolf 3D doors
Model.Load(5067)
Model.Load(5068)
Model.Load(5069)
Model.Load(5070)
Model.Load(5091)
Model.Load(5094)
Model.Load(5095)
Model.Load(5097)
Model.Load(5102)

:WOLF_LOAD
wait 0
if and
Model.Available(5067)
Model.Available(5068)
Model.Available(5069)
Model.Available(5070)
else_jump @WOLF_LOAD
if and
Model.Available(5091)
Model.Available(5094)
Model.Available(5095)
Model.Available(5097)
Model.Available(5102)
else_jump @WOLF_LOAD

//Doors, open positions
$DOOR01_X = 7.5
$DOOR01_Y = -61.5
$DOOR01_Z = 850.0
0107: $DOOR01 = create_object 5067 at 0 0 0
01BC: put_object $DOOR01 at $DOOR01_X $DOOR01_Y $DOOR01_Z
$DOOR01_X2 = 10.5
$DOOR01_Y2 = -61.5

$DOOR02_X = 7.5
$DOOR02_Y = 49.5
$DOOR02_Z = 850.0
0107: $DOOR02 = create_object 5067 at 0 0 0
01BC: put_object $DOOR02 at $DOOR02_X $DOOR02_Y $DOOR02_Z
$DOOR02_X2 = 10.5
$DOOR02_Y2 = 49.5

$DOOR03_X = 7.5
$DOOR03_Y = 67.5
$DOOR03_Z = 850.0
0107: $DOOR03 = create_object 5070 at 0 0 0
01BC: put_object $DOOR03 at $DOOR03_X $DOOR03_Y $DOOR03_Z
$DOOR03_X2 = 10.5
$DOOR03_Y2 = 67.5

//Pickups
0213: $PICK01 = create_pickup 5102 type 3 at 19.5 49.5 850.0
0213: $PICK02 = create_pickup 5094 type 3 at -28.5 31.5 850.0
0213: $PICK03 = create_pickup 5094 type 3 at -25.5 31.5 850.0
0213: $PICK04 = create_pickup 5094 type 3 at -25.5 25.5 850.0
0213: $PICK05 = create_pickup 5094 type 3 at -28.5 25.5 850.0
0213: $PICK06 = create_pickup 5094 type 3 at -28.5 19.5 850.0
0213: $PICK07 = create_pickup 5094 type 3 at -25.5 19.5 850.0
0213: $PICK08 = create_pickup 5097 type 3 at -49.5 19.5 850.0
0213: $PICK09 = create_pickup 5095 type 3 at -46.5 19.5 850.0
0213: $PICK10 = create_pickup 5095 type 3 at -43.5 19.5 850.0
0213: $PICK11 = create_pickup 5095 type 3 at -43.5 16.5 850.0
0213: $PICK12 = create_pickup 5095 type 3 at -46.5 16.5 850.0
0213: $PICK13 = create_pickup 5095 type 3 at -49.5 16.5 850.0
0213: $PICK14 = create_pickup 5095 type 3 at -43.5 13.5 850.0
0213: $PICK15 = create_pickup 5095 type 3 at -46.5 13.5 850.0
0213: $PICK16 = create_pickup 5095 type 3 at -49.5 13.5 850.0
0213: $PICK17 = create_pickup 5095 type 3 at -49.5 10.5 850.0
0213: $PICK18 = create_pickup 5095 type 3 at -46.5 10.5 850.0
0213: $PICK19 = create_pickup 5095 type 3 at -43.5 10.5 850.0
0213: $PICK20 = create_pickup 5095 type 3 at -43.5 7.5 850.0
0213: $PICK21 = create_pickup 5095 type 3 at -46.5 7.5 850.0
0213: $PICK22 = create_pickup 5095 type 3 at -49.5 7.5 850.0
0213: $PICK23 = create_pickup 5095 type 3 at -49.5 4.5 850.0
0213: $PICK24 = create_pickup 5095 type 3 at -46.5 4.5 850.0
0213: $PICK25 = create_pickup 5095 type 3 at -43.5 4.5 850.0
0213: $PICK26 = create_pickup 5095 type 3 at -43.5 1.5 850.0
0213: $PICK27 = create_pickup 5095 type 3 at -46.5 1.5 850.0
0213: $PICK28 = create_pickup 5095 type 3 at -49.5 1.5 850.0
0213: $PICK29 = create_pickup 5095 type 3 at -49.5 -1.5 850.0
0213: $PICK30 = create_pickup 5095 type 3 at -46.5 -1.5 850.0
0213: $PICK31 = create_pickup 5095 type 3 at -43.5 -1.5 850.0
0213: $PICK32 = create_pickup 5091 type 3 at 7.5 55.5 860.0 //Dummy pickup

//Door speed
$DOOR_SPD = 0.1

//Door status
$DOOR01_S = 0
$DOOR02_S = 0

//Flags
$ACTOR01_D = 0
$WOLF_GOLDKEY = 0

//Actors
Model.Load($WOLF_SKIN_HANS)
//Pickups
Model.Load(#KNIFECUR)
Model.Load(#COLT45)
Model.Load(#RUGER)
Model.Load(#MINIGUN)
Model.Load(#MINIGUN2)

:MISSION0_LOAD
wait 0
if and
Model.Available($WOLF_SKIN_HANS)
else_jump @MISSION0_LOAD
if and
Model.Available(#KNIFECUR)
Model.Available(#COLT45)
Model.Available(#RUGER)
Model.Available(#MINIGUN)
Model.Available(#MINIGUN2)
else_jump @MISSION0_LOAD

//Enemies
$ACTOR01 = Actor.Create(Criminal, $WOLF_SKIN_HANS, 7.5, 52.5, 850.0)
Actor.Angle($ACTOR01) = 180.0
01ED: reset_actor $ACTOR01 flags
011A: set_actor $ACTOR01 flags 1
0243: set_actor $ACTOR01 ped_stats_to 16
01B2: give_actor $ACTOR01 weapon $WOLF_WEAPON_HANS ammo $WOLF_WEAPON_AMMO
01B9: set_actor $ACTOR01 armed_weapon_to $WOLF_WEAPON_HANS
02E2: set_actor $ACTOR01 weapon_accuracy_to $WOLF_ACC_HANS
0446: set_actor $ACTOR01 head_decapitatation_possible 0 
Actor.Health($ACTOR01) = 2500

00C0: set_current_time 12 0
0055: put_player $PLAYER_CHAR at 7.5 -79.5 850.0
0171: set_player $PLAYER_CHAR z_angle_to 0.0
01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_KNIFE ammo 1
01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_PISTOL ammo 300
01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_MACHINEGUN ammo 200

set_weather 0
wait 0

if
  NOT Actor.Dead($PLAYER_ACTOR)
then
  0352: set_actor $PLAYER_ACTOR skin_to 'PLAYER'
  038B: load_requested_models
  0353: refresh_actor $PLAYER_ACTOR
end 
fade 1 (out)  1000 ms
     
:MISSION_LOOP               
wait 0

//Very bad hack with hp check, because wasted_or_busted won't stop the crash
//At least it works
0225: $PLAYER_HP_CHK = player $PLAYER_CHAR health
if and
$PLAYER_HP_CHK > 0
not wasted_or_busted
else_jump @WOLF3D_END

jump @WOLF3D

:WOLF3D1
if
    00F5: player $PLAYER_CHAR 0 7.5 80.5 850.0 radius 9.0 9.0 2.5
else_jump @MISSION_LOOP

0394: play_music 1
01E3: text_1number_styled 'M_PASS' 100 5000 ms 1
Player.Money($PLAYER_CHAR) += 100
wait 3000
fade 0 (in)  1000 ms
wait 1000
0055: put_player $PLAYER_CHAR at 238.4181 -1279.1786 11.0712
01F0: set_max_wanted_level_to 6
01EB: set_traffic_density_multiplier_to 1.0 
03DE: set_pedestrians_density_multiplier_to 1.0 
fade 1 (out)  1000 ms

$COMPLETED_MS0 = 1
:WOLF3D_END
$ONMISSION = 0
Model.Destroy($WOLF_SKIN_HANS)
Model.Destroy(#KNIFE)
Model.Destroy(#COLT45)
Model.Destroy(#RUGER)
Model.Destroy(#MINIGUN)
Model.Destroy(#MINIGUN2)
Model.Destroy(5067)
Model.Destroy(5068)
Model.Destroy(5069)
Model.Destroy(5070)
Model.Destroy(5091)
Model.Destroy(5094)
Model.Destroy(5095)
Model.Destroy(5097)
Model.Destroy(5102)
0108: destroy_object $DOOR01
0108: destroy_object $DOOR02
009B: destroy_actor_instantly $ACTOR01
0215: destroy_pickup $PICK01
0215: destroy_pickup $PICK02
0215: destroy_pickup $PICK03
0215: destroy_pickup $PICK04
0215: destroy_pickup $PICK05
0215: destroy_pickup $PICK06
0215: destroy_pickup $PICK07
0215: destroy_pickup $PICK08
0215: destroy_pickup $PICK09
0215: destroy_pickup $PICK10
0215: destroy_pickup $PICK11
0215: destroy_pickup $PICK12
0215: destroy_pickup $PICK13
0215: destroy_pickup $PICK14
0215: destroy_pickup $PICK15
0215: destroy_pickup $PICK16
0215: destroy_pickup $PICK17
0215: destroy_pickup $PICK18
0215: destroy_pickup $PICK19
0215: destroy_pickup $PICK20
0215: destroy_pickup $PICK21
0215: destroy_pickup $PICK22
0215: destroy_pickup $PICK23
0215: destroy_pickup $PICK24
0215: destroy_pickup $PICK25
0215: destroy_pickup $PICK26
0215: destroy_pickup $PICK27
0215: destroy_pickup $PICK28
0215: destroy_pickup $PICK29
0215: destroy_pickup $PICK30
0215: destroy_pickup $PICK31
0215: destroy_pickup $PICK32
mission_cleanup
end_thread
return
         
//-----------------MAP SCRIPTS---------------
:WOLF3D

//Doors
if and
$DOOR01_S == 0
00F5: player $PLAYER_CHAR 0 $DOOR01_X $DOOR01_Y $DOOR01_Z radius 4.0 4.0 4.0
then
    $DOOR01_S = 1
end

if
$DOOR01_S == 1
then
    if
    034E: move_object $DOOR01 to $DOOR01_X2 $DOOR01_Y2 $DOOR01_Z speed $DOOR_SPD $DOOR_SPD 0.0 flag 0
    then
         $DOOR01_S = 2
    end
end

if and
$DOOR02_S == 0
00F5: player $PLAYER_CHAR 0 $DOOR02_X $DOOR02_Y $DOOR02_Z radius 4.0 4.0 4.0
then
    $DOOR02_S = 1
end

if
$DOOR02_S == 1
then
    if
    034E: move_object $DOOR02 to $DOOR02_X2 $DOOR02_Y2 $DOOR02_Z speed $DOOR_SPD $DOOR_SPD 0.0 flag 0
    then
         $DOOR02_S = 2
    end
end

if and
$DOOR03_S == 0
$WOLF_GOLDKEY == 1
00F5: player $PLAYER_CHAR 0 $DOOR03_X $DOOR03_Y $DOOR03_Z radius 4.0 4.0 4.0
then
    $DOOR03_S = 1
end

if
$DOOR03_S == 1
then
    if
    034E: move_object $DOOR03 to $DOOR03_X2 $DOOR03_Y2 $DOOR03_Z speed $DOOR_SPD $DOOR_SPD 0.0 flag 0
    then
         $DOOR03_S = 2
    end
end

//Pickups
if
    Pickup.Picked_up($PICK01)
then
   gosub @WOLF_EXTRALIFE
end

if
    Pickup.Picked_up($PICK02)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK03)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK04)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK05)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK06)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK07)
then
   gosub @WOLF_MEDKIT
end

if
    Pickup.Picked_up($PICK08)
then
   gosub @WOLF_WP_CHAINGUN
end

if
    Pickup.Picked_up($PICK09)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK10)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK11)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK12)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK13)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK14)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK15)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK16)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK17)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK18)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK19)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK20)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK21)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK22)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK23)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK24)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK25)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK26)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK27)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK28)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK29)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK30)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK31)
then
   gosub @WOLF_AMMO
end

if
    Pickup.Picked_up($PICK32)
then
   $WOLF_GOLDKEY = 1
end

if and
    $ACTOR01_D == 0
    Actor.Dead($ACTOR01)
then
   $ACTOR01_D = 1
   Actor.StorePos($ACTOR01, $ACTOR01_X, $ACTOR01_Y, $ACTOR01_Z)
   0215: destroy_pickup $PICK32
   0213: $PICK32 = create_pickup 5091 type 3 at $ACTOR01_X $ACTOR01_Y $ACTOR01_Z
   gosub @WOLF_SCORE_HANS
end

jump @WOLF3D1

//Pickup handlers

:WOLF_TR_CROSS
    Player.Money($PLAYER_CHAR) += 100
return

:WOLF_TR_CHALICE
    Player.Money($PLAYER_CHAR) += 500
return

:WOLF_TR_CHEST
    Player.Money($PLAYER_CHAR) += 1000
return

:WOLF_TR_CROWN
    Player.Money($PLAYER_CHAR) += 5000
return

:WOLF_MEDKIT
    0225: $PLAYER_HP = player $PLAYER_CHAR health
    $PLAYER_HP += 25 
    0222: set_player $PLAYER_CHAR health_to $PLAYER_HP
return

:WOLF_FOOD
    0225: $PLAYER_HP = player $PLAYER_CHAR health
    $PLAYER_HP += 10 
    0222: set_player $PLAYER_CHAR health_to $PLAYER_HP
return

:WOLF_DOGFOOD
    0225: $PLAYER_HP = player $PLAYER_CHAR health
    $PLAYER_HP += 5 
    0222: set_player $PLAYER_CHAR health_to $PLAYER_HP
return

:WOLF_EXTRALIFE
    0222: set_player $PLAYER_CHAR health_to 100
    01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_PISTOL ammo 25
return

:WOLF_AMMO
    01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_MACHINEGUN ammo 8
return

:WOLF_WP_MACHINEGUN
	01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_MACHINEGUN ammo 150
return

:WOLF_WP_CHAINGUN
	01B1: give_player $PLAYER_CHAR weapon $WOLF_WEAPON_CHAINGUN ammo 100
return

:WOLF_SCORE_GUARD
    Player.Money($PLAYER_CHAR) += 100
return

:WOLF_SCORE_DOG
    Player.Money($PLAYER_CHAR) += 200
return

:WOLF_SCORE_HANS
    Player.Money($PLAYER_CHAR) += 5000
return