#define
gravity = 55
spike_damage = A
Boostdir = [49E6E6]
JumpKey=[493610]
ShootKey=[493614]
NextWepKey=[493618]
PrevWepKey=[49361C]
MenuKey=[493620]
MapKey=[493624]
JumpKey=[493628]
ShootKey=[49362C]
LeftKey=[493630]
UpKey=[493634]
RightKey=[493638]
DownKey=[49363C]
#enddefine
offset 4156C0
push ebp
mov ebp,esp
sub esp,2C
movzx eax,byte PlayerFlags //player flags
and eax,2
jnz :end_of_code
mov ecx, PlayerTile
and ecx,100
je :WaterPhysics
mov [ebp-14],196
mov [ebp-C],2FF
mov [ebp-1C],28
mov [ebp-10],10
mov [ebp-28],280
mov [ebp-24],2A
mov [ebp-18],10
mov [ebp-20],19
jmp :physics_set
:WaterPhysics
mov [ebp-14],32C
mov [ebp-C],5FF
mov [ebp-1C],50
mov [ebp-10],20
mov [ebp-28],500
mov [ebp-24],55
mov [ebp-18],20
mov [ebp-20],33
:physics_set
mov byte [49E6E5],0
cmp [ebp+8],0
jne :doukutsu41576B
mov byte Boostdir,0 //jump state flag???
:doukutsu41576B
mov edx, 8
or edx,10
or edx,20
and edx, PlayerTile //player tile
jz :in_the_air
mov byte Boostdir,0 //jump state flag???
mov edx, EquippedItems //equiped items
and edx,1
je :No_booster_0.8
mov JetpackEnergy,32 //refill booster fuel
jmp :booster_set
:No_booster_0.8
mov eax, EquippedItems
and eax,20 //booster 2.0 check
jz :No_booster_2.0
mov JetpackEnergy,32 //refill booster fuel
jmp :booster_set
:No_booster_2.0
mov JetpackEnergy,0
:booster_set
cmp [ebp+8],0 //check arg
je :doukutsu4158B3
mov ecx, KeyPressed
cmp ecx, DownKey //so you look down even of you only hold the key for 1 frame
jne :doukutsu415826
mov edx, KeyHeld
cmp edx, DownKey
jne :doukutsu415826
movzx eax,byte PlayerFlags
and eax,1 //inspecting check
jne :doukutsu415826
mov ecx, [49E1E8] //gamestate check for gameover.black fade
and ecx,4
jne :doukutsu415826
movzx edx,byte PlayerFlags
or edx,1
mov byte PlayerFlags,dl
mov byte [49E6E5], 1
jmp :doukutsu4158B3
:doukutsu415826
mov eax, KeyHeld
cmp eax, DownKey
je :doukutsu4158B3
mov ecx, KeyHeld
and ecx, LeftKey
je :doukutsu41585D
mov edx, [ebp-14]
neg edx
cmp PlayerXVel,edx
jle :doukutsu41585D
mov eax, PlayerXVel
sub eax, [ebp-24] //friction
mov PlayerXVel,eax
:doukutsu41585D
mov ecx, KeyHeld
and ecx, RightKey
je :doukutsu415883
mov edx, PlayerXVel
cmp edx, [ebp-14]
jge :doukutsu415883
mov eax, PlayerXVel
add eax,dword [ebp-24]
mov PlayerXVel,eax
:doukutsu415883
mov ecx, KeyHeld
and ecx, LeftKey
je :doukutsu41589B
mov DirectionFaced,0
:doukutsu41589B
mov edx, KeyHeld
and edx, RightKey
je :doukutsu4158B3
mov DirectionFaced,2
:doukutsu4158B3
movzx eax,byte PlayerFlags
and eax,20
jne :doukutsu415B5E
cmp PlayerXVel,0
jge :doukutsu4158F0
mov ecx,dword ptr ss:[ebp-20]
neg ecx
cmp PlayerXVel,ecx
jle :doukutsu4158E1
:doukutsu41585D
mov PlayerXVel,0
jmp :doukutsu4158F0
:doukutsu4158E1
mov edx, PlayerXVel
add edx, [ebp-20]
mov PlayerXVel,edx
:doukutsu4158F0
cmp PlayerXVel,0
jle :doukutsu415B5E
mov eax, PlayerXVel
cmp eax, [ebp-20]
jge :doukutsu41590F
mov PlayerXVel,0
jmp :doukutsu415B5E
:doukutsu41590F
mov ecx, PlayerXVel
sub ecx, [ebp-20]
mov PlayerXVel,ecx
jmp :doukutsu415B5E
:in_the_air
cmp [ebp+8],0
je :doukutsu415ADC
mov edx, EquippedItems
and edx,21 //check for boosters
je :Booster_done
mov eax, KeyPressed
and eax, JumpKey
je :Booster_done
cmp JetpackEnergy,0 //IBF HACK GOES HERE!!!
je :Booster_done
mov ecx, EquippedItems
and ecx,1
jz :booster_2.0_check
mov byte Boostdir,1
cmp PlayerYVel,100
jle :booster_2.0_check
mov eax, PlayerYVel
cdq
sub eax,edx
sar eax,1
mov PlayerYVel,eax
:booster_2.0_check
mov edx, EquippedItems
and edx,20
jz :Booster_done
mov eax, KeyHeld
and eax, UpKey
je :doukutsu4159C3
mov byte ptr ds: Boostdir,2
mov PlayerXVel,0
mov PlayerYVel,FFFFFA01
jmp :Booster_done
:doukutsu4159C3
mov ecx, KeyHeld
and ecx, LeftKey
je :doukutsu4159EE
mov byte ptr ds: Boostdir,1
mov PlayerYVel,0
mov PlayerXVel,FFFFFA01
jmp :Booster_done
:doukutsu4159EE
mov edx, KeyHeld
and edx, RightKey
je :doukutsu415A19
mov byte ptr ds: Boostdir,1
mov PlayerYVel,0
mov PlayerXVel,5FF
jmp :Booster_done
:doukutsu415A19
mov eax, KeyHeld
and eax, DownKey
je :doukutsu415A43
mov byte ptr ds: Boostdir,3
mov PlayerXVel,0
mov PlayerYVel,5FF
jmp :Booster_done
:doukutsu415A43
mov byte ptr ds: Boostdir,2
mov PlayerXVel,0
mov PlayerYVel,FFFFFA01
:Booster_done //at least that part is
mov ecx, KeyHeld
and ecx, LeftKey
jz :doukutsu415A86
mov DirectionFaced,0
mov edx, [ebp-14]
neg edx
cmp PlayerXVel,edx
jle :doukutsu415A86
mov eax, PlayerXVel
sub eax,dword ptr ss:[ebp-18]
mov PlayerXVel,eax
:doukutsu415A86
mov ecx, KeyHeld
and ecx, RightKey
jz :doukutsu415AAC
mov DirectionFaced,2
mov edx, PlayerXVel
cmp edx,dword ptr ss:[ebp-14]
jge :doukutsu415AAC //speed cap
mov eax, PlayerXVel
add eax,dword ptr ss:[ebp-18]
mov PlayerXVel,eax
:doukutsu415AAC
mov eax, EquippedItems
and eax,20
je :doukutsu415B40
movsx ecx,byte ptr ds: Boostdir
test ecx,ecx
je :doukutsu415B40
:doukutsu415ADC
mov edx, KeyHeld
and edx, JumpKey
je :doukutsu415B08
cmp JetpackEnergy,0
jne :doukutsu415B40
:doukutsu415B08
movsx eax,byte ptr ds: Boostdir
cmp eax,1
jne :doukutsu415B25
mov eax, PlayerXVel
cdq
sub eax,edx
sar eax,1
mov PlayerXVel,eax
jmp :doukutsu415B40
:doukutsu415B25
movsx ecx,byte ptr ds: Boostdir
cmp ecx,2
jne :doukutsu415B40
mov eax, PlayerYVel
cdq
sub eax,edx
sar eax,1
mov PlayerYVel,eax
:doukutsu415B40
cmp JetpackEnergy,0
je :doukutsu415B57
mov edx, KeyHeld
and edx, JumpKey
jne :doukutsu415B5E
:doukutsu415B57
mov byte ptr ds: Boostdir,0
:doukutsu415B5E
cmp [ebp+8],0
je :doukutsu415C0E
mov eax, KeyHeld
and eax, UpKey
je :doukutsu415B81
mov IsFacingUp,1
jmp :doukutsu415B8B
:doukutsu415B81
mov IsFacingUp,0
:doukutsu415B8B
mov ecx, KeyHeld
and ecx, DownKey
je :doukutsu415BB0
mov edx, PlayerTile
and edx,8
jne :doukutsu415BB0
mov IsFacingDown,1
jmp :doukutsu415BBA
:doukutsu415BB0
mov IsFacingDown,0
:doukutsu415BBA
mov eax, KeyPressed
and eax, JumpKey
je :doukutsu415C0E
//collision check
mov edx, 8
or edx,10
or edx,20
and edx, PlayerTile //player tile
jz :doukutsu415C0E
mov ecx, PlayerTile
and ecx,2000
mov edx,dword ptr ss:[ebp-28]
neg edx
mov dword ptr ds:[49E670],edx
push 1
push F
call Playsound
add esp,8
:doukutsu415C0E
cmp [ebp+8],0
je :doukutsu415C49
mov eax, LeftKey
or eax, RightKey
or eax, UpKey
or eax, JumpKey
or eax, ShootKey
and eax, KeyHeld
jz :doukutsu415C49
movzx ecx,byte PlayerFlags
and ecx,FFFFFFFE // -2
mov byte ptr ds:PlayerFlags,cl
:doukutsu415C49
movsx edx,byte ptr ds: Boostdir
test edx,edx
je :doukutsu415C6A
cmp JetpackEnergy,0
je :doukutsu415C6A
dec JetpackEnergy //IBF HACK GOES HERE
:doukutsu415C6A
mov ecx, PlayerTile
and ecx,1000 //WindLeft
jz :WindLDone
mov edx, PlayerXVel
sub edx,88
mov PlayerXVel,edx
:WindLDone
mov eax, PlayerTile
and eax,2000 //windUp
je :WindUDone
mov ecx, PlayerYVel
sub ecx,80
mov PlayerYVel,ecx
:WindUDone
mov edx, PlayerTile
and edx,4000 //WindRight
je :WindRDone
mov eax, PlayerXVel
add eax,88
mov PlayerXVel,eax
:WindRDone
mov ecx, PlayerTile
and ecx,8000 //WindDown
je :WindDDone
mov edx, PlayerYVel
add edx, gravity
mov PlayerYVel,edx
:WindDDone
mov eax, EquippedItems
and eax,20
je :doukutsu415EA3
movsx ecx,byte Boostdir
test ecx,ecx
je :doukutsu415EA3
movsx edx,byte ptr ds: Boostdir
cmp edx,1
jne :doukutsu415DDF
mov eax, PlayerTile
and eax,5
je :doukutsu415D23
mov PlayerYVel,FFFFFF00 //-10
:doukutsu415D23
cmp DirectionFaced,0
jne :doukutsu415D3B
sub PlayerXVel 20
:doukutsu415D3B
cmp DirectionFaced,2
jne :doukutsu415D53
add PlayerXVel, 20
:doukutsu415D53
mov eax, KeyPressed
and eax, JumpKey
jne :doukutsu415D72
mov eax, JetpackEnergy
cdq
mov ecx,3
idiv ecx //shoot exhaust every 3 frames
cmp edx,1
jne :doukutsu415F87
:doukutsu415D72
cmp DirectionFaced,0
jne :doukutsu415D9F
push 2
push 7 //ID = puff
mov edx, PlayerYPos
add edx,400
push edx
mov eax, PlayerXPos
add eax,400
push eax
call 40AC90 //create booster exhaust
add esp,10
:doukutsu415D9F
cmp DirectionFaced,2
jne :doukutsu415DCE
push 0
push 7
mov ecx, PlayerYPos
add ecx,400
push ecx
mov edx, PlayerXPos
sub edx,400
push edx
call 40AC90
add esp,10
:doukutsu415DCE
push 1
push 71
call Playsound //booster exhaust
add esp,8
jmp :doukutsu415F87
:doukutsu415DDF
movsx eax,byte ptr ds: Boostdir
cmp eax,2
jne :doukutsu415E47
sub PlayerYVel, 20
mov edx, KeyPressed
and edx, JumpKey
jne :doukutsu415E15
mov eax, JetpackEnergy
cdq
mov ecx,3
idiv ecx
:doukutsu415E15
cmp edx,1
jne :doukutsu415F87
push 3
push 7
mov edx, PlayerYPos
add edx,C00
push edx
mov eax, PlayerXPos
push eax
call 40AC90 //animated effect
add esp,10
push 1
push 71
call Playsound
add esp,8
jmp :doukutsu415F87
:doukutsu415E47
movsx ecx,byte ptr ds: Boostdir
cmp ecx,3
jne :doukutsu415F87
mov edx, KeyPressed
and edx, JumpKey
jnz :doukutsu415E73
mov eax, JetpackEnergy
cdq
mov ecx,3
idiv ecx
cmp edx,1
jne :doukutsu415F87
:doukutsu415E73
push 1
push 7
mov edx, PlayerYPos
sub edx,C00
push edx
mov eax, PlayerXPos
push eax
call 40AC90 //animated effect
add esp,10
push 1
push 71
call Playsound
add esp,8
jmp :doukutsu415F87
:doukutsu415EA3
mov ecx, PlayerTile
and ecx,2000 //wind up
je :doukutsu415EC5
mov edx,dword ptr ss:[ebp-1C]
add PlayerYVel,edx
jmp :doukutsu415F87
:doukutsu415EC5
mov eax, EquippedItems
and eax,1
jz :doukutsu415F4C
movsx ecx,byte ptr ds: Boostdir
test ecx,ecx
je :doukutsu415F4C
cmp PlayerYVel,FFFFFC00 //speedcap check
jle :doukutsu415F4C
mov edx, PlayerYVel
sub edx,20
mov PlayerYVel,edx
mov eax, JetpackEnergy
cdq
mov ecx,3
idiv ecx
test edx,edx
jnz :doukutsu415F36
push 3
push 7
mov eax, [49E688]
cdq
sub eax,edx
sar eax,1
add eax, PlayerYPos
push eax
mov edx, PlayerXPos
push edx
call 40AC90
add esp,10
push 1
push 71
call 420640
add esp,8
:doukutsu415F36
mov eax, PlayerTile
and eax,2
jz :doukutsu415F87
mov PlayerYVel,200
jmp :doukutsu415F87
:doukutsu415F4C
cmp PlayerYVel,0
jge :doukutsu415F7A
cmp [ebp+8],0
je :doukutsu415F7A
mov ecx, KeyHeld
and ecx, JumpKey
je :doukutsu415F7A
mov edx, PlayerYVel
add edx,dword ptr ss:[ebp-10]
mov PlayerYVel,edx
jmp :doukutsu415F87
:doukutsu415F7A
mov eax, PlayerYVel
add eax,dword ptr ss:[ebp-1C]
mov PlayerYVel,eax
:doukutsu415F87
cmp [ebp+8],0
je :doukutsu415F9F
mov ecx, KeyPressed
and ecx, JumpKey
jne :doukutsu416063
:doukutsu415F9F
mov edx, PlayerTile
and edx,10 //slope up left
je :doukutsu415FBF
cmp PlayerXVel,0
jge :doukutsu415FBF
mov eax, PlayerXVel
neg eax
mov PlayerYVel,eax
:doukutsu415FBF
mov ecx, PlayerTile
and ecx,20 //slope up right
je :doukutsu415FDF
cmp PlayerXVel,0
jle :doukutsu415FDF
mov edx, PlayerXVel
mov PlayerYVel,edx
:doukutsu415FDF
mov eax, PlayerTile
and eax,8 //ground
je :doukutsu41600A
mov ecx, PlayerTile
and ecx,80000
je :doukutsu41600A
cmp PlayerXVel,0
jge :doukutsu41600A
mov PlayerYVel,400
:doukutsu41600A
mov edx, PlayerTile
and edx,8
je :doukutsu416034
mov eax, PlayerTile
and eax,10000 //unknown tile type
je :doukutsu416034
cmp PlayerXVel,0
jle :doukutsu416034
mov PlayerYVel,400
:doukutsu416034
mov ecx, PlayerTile
and ecx,8 //solid ground
je :doukutsu416063
mov edx, PlayerTile
and edx,20000
je :doukutsu416063
mov eax, PlayerTile
and eax,40000
je :doukutsu416063
mov PlayerYVel,400
:doukutsu416063
mov edx, PlayerTile
and edx,100 //water
jz :doukutsu4160D7
mov eax, PlayerTile
and eax,F000
jnz :doukutsu4160D7
cmp PlayerXVel,FFFFFD01 //speed caps underwater
jge :doukutsu416093
mov PlayerXVel,FFFFFD01
:doukutsu416093
cmp PlayerXVel,2FF
jle :doukutsu4160A9
mov PlayerXVel,2FF
:doukutsu4160A9
cmp PlayerYVel,FFFFFD01
jge :doukutsu4160BF
mov PlayerYVel,FFFFFD01
:doukutsu4160BF
cmp PlayerYVel,2FF
jle :doukutsu41612F
mov PlayerYVel,2FF
jmp :doukutsu41612F
:doukutsu4160D7 //speed caps
cmp PlayerXVel,FFFFFA01
jge :doukutsu4160ED
mov PlayerXVel,FFFFFA01
:doukutsu4160ED
cmp PlayerXVel,5FF
jle :doukutsu416103
mov PlayerXVel,5FF
:doukutsu416103
cmp PlayerYVel,FFFFFA01
jge :doukutsu416119
mov PlayerYVel,FFFFFA01
:doukutsu416119
cmp PlayerYVel,5FF
jle :doukutsu41612F
mov PlayerYVel,5FF
:doukutsu41612F
movsx ecx,byte ptr ds:[49E6E4]
test ecx,ecx
jnz :doukutsu4162CE
mov edx, PlayerTile
and edx,100
jz :doukutsu4162CE
mov eax, PlayerTile
and eax,800
jz :doukutsu416165
mov [ebp-2C],2
jmp :doukutsu41616C
:doukutsu416165
mov [ebp-2C],0
:doukutsu41616C
mov ecx, PlayerTile
and ecx,8 //ground
jne :doukutsu416225
cmp PlayerYVel,200
jle :doukutsu416225
mov [ebp-8],0
jmp :doukutsu41619D
:doukutsu416194 //water splash loop
inc [ebp-8]
:doukutsu41619D
cmp [ebp-8],8
jge :doukutsu416214
push 8
push FFFFFFF8
call RANDOM
add esp,8
shl eax,9
add eax, PlayerXPos
mov [ebp-4],eax
push 0
push 0
mov eax,dword ptr ss:[ebp-2C]
push eax
push 80
push FFFFFE00
call RANDOM
add esp,8
mov ecx,eax
mov eax, PlayerYVel
cdq
sub eax,edx
sar eax,1
sub ecx,eax
push ecx
push 200
push FFFFFE00
call RANDOM
add esp,8
add eax, PlayerXVel
push eax
mov edx, PlayerYPos
push edx
mov eax,dword ptr ss:[ebp-4]
push eax
push 49
call 46EFD0 //create water drop on entry into water
add esp,20
jmp :doukutsu416194
:doukutsu416214
push 1
push 38
call 420640 //splash sound
add esp,8
jmp :doukutsu4162C7
:doukutsu416225
cmp PlayerXVel,200
jg :doukutsu416241
cmp PlayerXVel,FFFFFE00 //exit water
jge :doukutsu4162C7
:doukutsu416241
mov [ebp-8],0
jmp :doukutsu416253
:doukutsu41624A
inc [ebp-8]
:doukutsu416253
cmp [ebp-8],8
jge :doukutsu4162BB
push 8
push FFFFFFF8
call Random
add esp,8
shl eax,9
add eax, PlayerXPos
mov [ebp-4],eax
push 0
push 0
mov edx,dword ptr ss:[ebp-2C]
push edx
push 80
push FFFFFE00
call Random
add esp,8
push eax
push 200
push FFFFFE00
call random
add esp,8
add eax, PlayerXVel
push eax
mov eax, PlayerYPos
push eax
mov ecx,dword ptr ss:[ebp-4]
push ecx
push 49
call 46EFD0 //npc create water drops
add esp,20
jmp :doukutsu41624A
:doukutsu4162BB
push 1
push 38 //exit water sfx
call Playsound
add esp,8
:doukutsu4162C7
mov byte ptr ds:[49E6E4],1
:doukutsu4162CE
mov edx, PlayerTile
and edx,100 //water check
jnz :doukutsu4162E3
mov byte ptr ds:[49E6E4],0
:doukutsu4162E3
mov eax, PlayerTile
and eax,400 //spike tile
je :doukutsu4162F9
push spike_damage
call 419910 //damage
add esp,4
:doukutsu4162F9
cmp DirectionFaced,0
jne :doukutsu41632C
mov ecx, [49E664]
sub ecx,200
mov [49E664],ecx
cmp [49E664],FFFF8000
jge :doukutsu416354
mov [49E664],FFFF8000
jmp :doukutsu416354
:doukutsu41632C
mov edx, [49E664]
add edx,200
mov [49E664],edx
cmp [49E664],8000
jle :doukutsu416354
mov [49E664],8000
:doukutsu416354
mov eax, KeyHeld
and eax, UpKey
je :doukutsu416391
cmp [ebp+8],0
je :doukutsu416391
mov ecx, [49E668]
sub ecx,200
mov [49E668],ecx
cmp [49E668],FFFF8000
jge :doukutsu416408
mov [49E668],FFFF8000
jmp :doukutsu416408
:doukutsu416391
mov edx, KeyHeld
and edx, DownKey
je :doukutsu4163CC
cmp [ebp+8],0
je :doukutsu4163CC
mov eax, [49E668]
add eax,200
mov [49E668],eax
cmp [49E668],8000
jle :doukutsu416408
mov [49E668],8000
jmp :doukutsu416408
:doukutsu4163CC
cmp [49E668],200
jle :doukutsu4163EA
mov ecx, [49E668]
sub ecx,200
mov [49E668],ecx
:doukutsu4163EA
cmp [49E668],FFFFFE00
jge :doukutsu416408
mov edx, [49E668]
add edx,200
mov [49E668],edx
:doukutsu416408
mov eax, PlayerXPos
add eax, [49E664]
mov [49E65C],eax
mov ecx, PlayerYPos
add ecx, [49E668]
mov [49E660],ecx
mov edx, PlayerXVel
cmp edx,dword ptr ss:[ebp-20]
jg :doukutsu416444
mov eax,dword ptr ss:[ebp-20]
neg eax
cmp PlayerXVel,eax
jg :doukutsu416456
:doukutsu416444
mov ecx, PlayerXPos
add ecx, PlayerXVel
mov PlayerXPos,ecx
:doukutsu416456
mov edx, PlayerYPos
add edx, PlayerYVel
mov PlayerYPos,edx
:end_of_code
mov esp,ebp
pop ebp
retn